[PATCH V11 07/47] drm/colorop: Add BYPASS property

Sebastian Wick sebastian.wick at redhat.com
Tue Aug 19 15:15:26 UTC 2025


On Fri Aug 15, 2025 at 5:49 AM CEST, Alex Hung wrote:
> From: Harry Wentland <harry.wentland at amd.com>
>
> We want to be able to bypass each colorop at all times.
> Introduce a new BYPASS boolean property for this.
>
> Reviewed-by: Simon Ser <contact at emersion.fr>
> Reviewed-by: Louis Chauvet <louis.chauvet at bootlin.com>
> Signed-off-by: Alex Hung <alex.hung at amd.com>
> Signed-off-by: Harry Wentland <harry.wentland at amd.com>
> Reviewed-by: Daniel Stone <daniels at collabora.com>
> Reviewed-by: Melissa Wen <mwen at igalia.com>
> ---
> v6:
>  - clarify that bypass is only valid if BYPASS prop exists (Louis Chauvet)
>
>  drivers/gpu/drm/drm_atomic_uapi.c |  6 +++++-
>  drivers/gpu/drm/drm_colorop.c     | 15 +++++++++++++++
>  include/drm/drm_colorop.h         | 22 ++++++++++++++++++++++
>  3 files changed, 42 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
> index 52b5a9b5523e..44665efbef55 100644
> --- a/drivers/gpu/drm/drm_atomic_uapi.c
> +++ b/drivers/gpu/drm/drm_atomic_uapi.c
> @@ -650,7 +650,9 @@ static int drm_atomic_colorop_set_property(struct drm_colorop *colorop,
>  		struct drm_colorop_state *state, struct drm_file *file_priv,
>  		struct drm_property *property, uint64_t val)
>  {
> -	if (property == colorop->curve_1d_type_property) {
> +	if (property == colorop->bypass_property) {
> +		state->bypass = val;
> +	} else if (property == colorop->curve_1d_type_property) {
>  		state->curve_1d_type = val;
>  	} else {
>  		drm_dbg_atomic(colorop->dev,
> @@ -670,6 +672,8 @@ drm_atomic_colorop_get_property(struct drm_colorop *colorop,
>  {
>  	if (property == colorop->type_property) {
>  		*val = colorop->type;
> +	} else if (property == colorop->bypass_property) {
> +		*val = state->bypass;
>  	} else if (property == colorop->curve_1d_type_property) {
>  		*val = state->curve_1d_type;
>  	} else {
> diff --git a/drivers/gpu/drm/drm_colorop.c b/drivers/gpu/drm/drm_colorop.c
> index 6fbc3c284d33..11c37916c758 100644
> --- a/drivers/gpu/drm/drm_colorop.c
> +++ b/drivers/gpu/drm/drm_colorop.c
> @@ -79,6 +79,17 @@ static int drm_plane_colorop_init(struct drm_device *dev, struct drm_colorop *co
>  				   colorop->type_property,
>  				   colorop->type);
>  
> +	/* bypass */
> +	prop = drm_property_create_bool(dev, DRM_MODE_PROP_ATOMIC,
> +					"BYPASS");
> +	if (!prop)
> +		return -ENOMEM;
> +
> +	colorop->bypass_property = prop;
> +	drm_object_attach_property(&colorop->base,
> +				   colorop->bypass_property,
> +				   1);
> +
>  	return ret;
>  }
>  
> @@ -136,6 +147,7 @@ int drm_plane_colorop_curve_1d_init(struct drm_device *dev, struct drm_colorop *
>  	/* initialize 1D curve only attribute */
>  	prop = drm_property_create_enum(dev, DRM_MODE_PROP_ATOMIC, "CURVE_1D_TYPE",
>  					enum_list, len);
> +
>  	if (!prop)
>  		return -ENOMEM;
>  
> @@ -152,6 +164,8 @@ static void __drm_atomic_helper_colorop_duplicate_state(struct drm_colorop *colo
>  							struct drm_colorop_state *state)
>  {
>  	memcpy(state, colorop->state, sizeof(*state));
> +
> +	state->bypass = true;
>  }
>  
>  struct drm_colorop_state *
> @@ -190,6 +204,7 @@ static void __drm_colorop_state_reset(struct drm_colorop_state *colorop_state,
>  	u64 val;
>  
>  	colorop_state->colorop = colorop;
> +	colorop_state->bypass = true;
>  
>  	if (colorop->curve_1d_type_property) {
>  		drm_object_property_get_default_value(&colorop->base,
> diff --git a/include/drm/drm_colorop.h b/include/drm/drm_colorop.h
> index fa167e642e0d..49e6564c17ba 100644
> --- a/include/drm/drm_colorop.h
> +++ b/include/drm/drm_colorop.h
> @@ -82,6 +82,16 @@ struct drm_colorop_state {
>  	 * information.
>  	 */
>  
> +
> +	/**
> +	 * @bypass:
> +	 *
> +	 * When the property BYPASS exists on this colorop, this stores
> +	 * the requested bypass state: true if colorop shall be bypassed,
> +	 * false if colorop is enabled.
> +	 */
> +	bool bypass;
> +
>  	/**
>  	 * @curve_1d_type:
>  	 *
> @@ -171,6 +181,18 @@ struct drm_colorop {
>  	 */
>  	struct drm_property *type_property;
>  
> +	/**
> +	 * @bypass_property:
> +	 *
> +	 * Boolean property to control enablement of the color
> +	 * operation. Setting bypass to "true" shall always be supported

This doesn't actually seem to be the case when the patches later in the
series are to be believed.

Somewhere else it says

  The BYPASS property is not mandatory for a colorop, as long as the
  entire pipeline can get bypassed by setting the COLOR_PIPELINE on a
  plane to '0'.

and later there is a "drm/colorop: allow non-bypass colorops" patch.

So I'm pretty sure this instance here should be adjusted.

> +	 * in order to allow compositors to quickly fall back to
> +	 * alternate methods of color processing. This is important
> +	 * since setting color operations can fail due to unique
> +	 * HW constraints.
> +	 */
> +	struct drm_property *bypass_property;
> +
>  	/**
>  	 * @curve_1d_type_property:
>  	 *



More information about the amd-gfx mailing list