renderer/native: Make onscreen handle setting gamma

It's state that is part of the onscreen/CRTC, so move it there.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2814>
This commit is contained in:
Jonas Ådahl 2022-07-07 12:00:23 +02:00
parent 2f39f759c2
commit 8e7ada70a5
3 changed files with 22 additions and 11 deletions

View File

@ -1386,6 +1386,18 @@ add_onscreen_frame_info (MetaCrtc *crtc)
CLUTTER_STAGE_VIEW (view));
}
void
meta_onscreen_native_prepare_frame (CoglOnscreen *onscreen,
ClutterFrame *frame)
{
MetaOnscreenNative *onscreen_native = META_ONSCREEN_NATIVE (onscreen);
MetaCrtcKms *crtc_kms = META_CRTC_KMS (onscreen_native->crtc);
MetaKmsCrtc *kms_crtc = meta_crtc_kms_get_kms_crtc (crtc_kms);
MetaKmsDevice *kms_device = meta_kms_crtc_get_device (kms_crtc);
meta_crtc_kms_maybe_set_gamma (crtc_kms, kms_device);
}
void
meta_onscreen_native_finish_frame (CoglOnscreen *onscreen,
ClutterFrame *frame)

View File

@ -37,6 +37,9 @@ G_DECLARE_FINAL_TYPE (MetaOnscreenNative, meta_onscreen_native,
void meta_renderer_native_release_onscreen (CoglOnscreen *onscreen);
void meta_onscreen_native_prepare_frame (CoglOnscreen *onscreen,
ClutterFrame *frame);
void meta_onscreen_native_finish_frame (CoglOnscreen *onscreen,
ClutterFrame *frame);

View File

@ -1461,24 +1461,20 @@ meta_renderer_native_prepare_frame (MetaRendererNative *renderer_native,
MetaBackend *backend = meta_renderer_get_backend (renderer);
MetaMonitorManager *monitor_manager =
meta_backend_get_monitor_manager (backend);
MetaCrtc *crtc = meta_renderer_view_get_crtc (view);
CoglFramebuffer *framebuffer =
clutter_stage_view_get_onscreen (CLUTTER_STAGE_VIEW (view));
MetaPowerSave power_save_mode;
MetaCrtcKms *crtc_kms;
MetaKmsCrtc *kms_crtc;
MetaKmsDevice *kms_device;
if (!META_IS_CRTC_KMS (crtc))
return;
power_save_mode = meta_monitor_manager_get_power_save_mode (monitor_manager);
if (power_save_mode != META_POWER_SAVE_ON)
return;
crtc_kms = META_CRTC_KMS (crtc);
kms_crtc = meta_crtc_kms_get_kms_crtc (META_CRTC_KMS (crtc));
kms_device = meta_kms_crtc_get_device (kms_crtc);
if (COGL_IS_ONSCREEN (framebuffer))
{
CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer);
meta_crtc_kms_maybe_set_gamma (crtc_kms, kms_device);
meta_onscreen_native_prepare_frame (onscreen, frame);
}
}
void