From: "NĂ­colas F. R. A. Prado" <[email protected]>

Some drivers, like VKMS, only have access to the drm_crtc_state but not
the drm_atomic_state during composition of the output framebuffer. Store
the state of the CRTC (post-blend) color pipeline client cap in the
drm_crtc_state so those drivers can decide whether to look at the color
pipeline or the legacy properties for the color management settings to
apply.

Signed-off-by: NĂ­colas F. R. A. Prado <[email protected]>
Co-developed-by: Ariel D'Alessandro <[email protected]>
Signed-off-by: Ariel D'Alessandro <[email protected]>
Reviewed-by: Louis Chauvet <[email protected]>
Reviewed-by: Harry Wentland <[email protected]>
---
 drivers/gpu/drm/drm_atomic.c | 1 +
 include/drm/drm_crtc.h       | 8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index aa4aa2f589b3d..f2028e6cdd62f 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -389,6 +389,7 @@ drm_atomic_get_crtc_state(struct drm_atomic_state *state,
        state->crtcs[index].new_state = crtc_state;
        state->crtcs[index].ptr = crtc;
        crtc_state->state = state;
+       crtc_state->color_pipeline_enabled = state->crtc_color_pipeline;
 
        drm_dbg_atomic(state->dev, "Added [CRTC:%d:%s] %p state to %p\n",
                       crtc->base.id, crtc->name, crtc_state, state);
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index b3c9818715851..888a3a5aa3a27 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -282,6 +282,14 @@ struct drm_crtc_state {
         */
        struct drm_colorop *color_pipeline;
 
+       /**
+        * @color_pipeline_enabled:
+        *
+        * Whether color management should be done based on the &color_pipeline
+        * or the legacy color properties (&ctm, &gamma_lut and &degamma_lut).
+        */
+       bool color_pipeline_enabled;
+
        /**
         * @target_vblank:
         *

-- 
2.51.0

Reply via email to