[mutter/benzea/gamma-fix-3.36: 2/2] renderer-native: Re-set gamma curve while configuring CRTCs




commit 8cec21e6736a9cb89a5c473d0ea2fcd383e0584c
Author: Benjamin Berg <bberg redhat com>
Date:   Fri Aug 28 19:58:27 2020 +0200

    renderer-native: Re-set gamma curve while configuring CRTCs
    
    Since commit 2e5b767c0 (gpu/kms: Turn off CRTCs as well for DPMS) we
    turn off the CRTCs. This has the undesired side effect that (at least
    currently) updates to the gamma curve are lost. While this can be
    considered a kernel issue, it has the major side effect of breaking
    Night Light in ugly ways.
    
    This fetches the (cached) gamma curve and sets it again when setting the
    CRTC mode. This way we re-apply the gamma curve even if the kernel may
    have lost it due to the CRTC having been turned off at the time.
    
    Note that this may be considered a DRM/driver bug. See
      https://gitlab.freedesktop.org/drm/intel/-/issues/2362
    
    Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1392

 src/backends/native/meta-renderer-native.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
---
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
index e94562b286..41e62f3065 100644
--- a/src/backends/native/meta-renderer-native.c
+++ b/src/backends/native/meta-renderer-native.c
@@ -1408,6 +1408,7 @@ meta_onscreen_native_set_crtc_mode (CoglOnscreen              *onscreen,
 {
   CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
   MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
+  const MetaKmsCrtcState *current_state;
 
   COGL_TRACE_BEGIN_SCOPED (MetaOnscreenNativeSetCrtcModes,
                            "Onscreen (set CRTC modes)");
@@ -1431,6 +1432,15 @@ meta_onscreen_native_set_crtc_mode (CoglOnscreen              *onscreen,
 
   meta_crtc_kms_set_mode (onscreen_native->crtc, kms_update);
   meta_output_kms_set_underscan (onscreen_native->output, kms_update);
+
+  current_state = meta_kms_crtc_get_current_state (meta_crtc_kms_get_kms_crtc (onscreen_native->crtc));
+  meta_kms_crtc_set_gamma (meta_crtc_kms_get_kms_crtc (onscreen_native->crtc),
+                           kms_update,
+                           current_state->gamma.size,
+                           current_state->gamma.red,
+                           current_state->gamma.green,
+                           current_state->gamma.blue);
+
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]