[PATCH RFC v2 12/20] drm/crtc: Track post-blend color pipeline client cap in drm_crtc_state

Nícolas F. R. A. Prado posted 20 patches 2 weeks ago
[PATCH RFC v2 12/20] drm/crtc: Track post-blend color pipeline client cap in drm_crtc_state
Posted by Nícolas F. R. A. Prado 2 weeks ago
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 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 <nfraprado@collabora.com>
---
 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 6982c978dc530b838353ace60f748660c3b4524d..bbfa35c800240722785a6db440eb3d47ef9c8ed6 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -386,6 +386,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->post_blend_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 df03637ca25abd45e96b5944229297f776fd046d..cb9eda6335e0d6728d99d67cc6916ad2d0e1d94e 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.50.1

Re: [PATCH RFC v2 12/20] drm/crtc: Track post-blend color pipeline client cap in drm_crtc_state
Posted by Louis Chauvet 1 week, 5 days ago

Le 18/09/2025 à 02:43, Nícolas F. R. A. Prado a écrit :
> 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 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.

Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com>

> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
> ---
>   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 6982c978dc530b838353ace60f748660c3b4524d..bbfa35c800240722785a6db440eb3d47ef9c8ed6 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -386,6 +386,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->post_blend_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 df03637ca25abd45e96b5944229297f776fd046d..cb9eda6335e0d6728d99d67cc6916ad2d0e1d94e 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:
>   	 *
> 

-- 
--
Louis Chauvet, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com