[PATCH V8 11/43] drm/colorop: Introduce DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE
Shengyu Qu
wiagn233 at outlook.com
Tue Apr 1 01:42:38 UTC 2025
在 2025/3/27 7:46, Alex Hung 写道:
> From: Harry Wentland <harry.wentland at amd.com>
>
> With the introduction of the pre-blending color pipeline we
> can no longer have color operations that don't have a clear
> position in the color pipeline. We deprecate all existing
> plane properties. For upstream drivers those are:
> - COLOR_ENCODING
> - COLOR_RANGE
>
> Drivers are expected to ignore these properties when
> programming the HW. DRM clients that don't register with
don't?
Seems conflict with change note below.
> DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE will not be allowed to
> set the COLOR_ENCODING and COLOR_RANGE properties.
>
> Setting of the COLOR_PIPELINE plane property or drm_colorop
> properties is only allowed for userspace that sets this
> client cap.
>
> Signed-off-by: Alex Hung <alex.hung at amd.com>
> Signed-off-by: Harry Wentland <harry.wentland at amd.com>
> ---
> v8:
> - Disallow setting of COLOR_RANGE and COLOR_ENCODING when
> DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE is set
>
> v5:
> - Fix kernel docs
>
> v4:
> - Don't block setting of COLOR_RANGE and COLOR_ENCODING
> when client cap is set
>
>
> drivers/gpu/drm/drm_atomic_uapi.c | 23 ++++++++++++++++++++++-
> drivers/gpu/drm/drm_ioctl.c | 7 +++++++
> include/drm/drm_file.h | 7 +++++++
> include/uapi/drm/drm.h | 15 +++++++++++++++
> 4 files changed, 51 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
> index 5738b1c18755..e0b4b122ef6b 100644
> --- a/drivers/gpu/drm/drm_atomic_uapi.c
> +++ b/drivers/gpu/drm/drm_atomic_uapi.c
> @@ -567,10 +567,26 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane,
> } else if (property == plane->zpos_property) {
> state->zpos = val;
> } else if (property == plane->color_encoding_property) {
> + if (file_priv->plane_color_pipeline) {
> + drm_dbg_atomic(dev,
> + "Setting COLOR_ENCODING plane property not permitted with DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE client cap\n");
> + return -EINVAL;
> + }
> state->color_encoding = val;
> } else if (property == plane->color_range_property) {
> + if (file_priv->plane_color_pipeline) {
> + drm_dbg_atomic(dev,
> + "Setting COLOR_RANGE plane property not permitted with DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE client cap\n");
> + return -EINVAL;
> + }
> state->color_range = val;
> } else if (property == plane->color_pipeline_property) {
> + if (!file_priv->plane_color_pipeline) {
> + drm_dbg_atomic(dev,
> + "Setting COLOR_PIPELINE plane property not permitted unless DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE is set\n");
> + return -EINVAL;
> + }
> +
> /* find DRM colorop object */
> struct drm_colorop *colorop = NULL;
>
> @@ -1197,6 +1213,12 @@ int drm_atomic_set_property(struct drm_atomic_state *state,
> break;
> }
> case DRM_MODE_OBJECT_COLOROP: {
> + if (!file_priv->plane_color_pipeline) {
> + drm_dbg_atomic(prop->dev,
> + "[OBJECT:%d] is a colorop but DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE not set\n",
> + obj->id);
> + ret = -EINVAL;
> + }
> struct drm_colorop *colorop = obj_to_colorop(obj);
> struct drm_colorop_state *colorop_state;
>
> @@ -1209,7 +1231,6 @@ int drm_atomic_set_property(struct drm_atomic_state *state,
> ret = drm_atomic_colorop_set_property(colorop,
> colorop_state, file_priv,
> prop, prop_value);
> -
> break;
> }
> default:
> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
> index f593dc569d31..5c89c586da7c 100644
> --- a/drivers/gpu/drm/drm_ioctl.c
> +++ b/drivers/gpu/drm/drm_ioctl.c
> @@ -373,6 +373,13 @@ drm_setclientcap(struct drm_device *dev, void *data, struct drm_file *file_priv)
> return -EINVAL;
> file_priv->supports_virtualized_cursor_plane = req->value;
> break;
> + case DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE:
> + if (!file_priv->atomic)
> + return -EINVAL;
> + if (req->value > 1)
> + return -EINVAL;
> + file_priv->plane_color_pipeline = req->value;
> + break;
> default:
> return -EINVAL;
> }
> diff --git a/include/drm/drm_file.h b/include/drm/drm_file.h
> index 94d365b22505..86929ca667aa 100644
> --- a/include/drm/drm_file.h
> +++ b/include/drm/drm_file.h
> @@ -206,6 +206,13 @@ struct drm_file {
> */
> bool writeback_connectors;
>
> + /**
> + * @plane_color_pipeline:
> + *
> + * True if client understands plane color pipelines
> + */
> + bool plane_color_pipeline;
> +
> /**
> * @was_master:
> *
> diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
> index 7fba37b94401..3d12fbab066f 100644
> --- a/include/uapi/drm/drm.h
> +++ b/include/uapi/drm/drm.h
> @@ -875,6 +875,21 @@ struct drm_get_cap {
> */
> #define DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT 6
>
> +/**
> + * DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE
> + *
> + * If set to 1 the DRM core will allow setting the COLOR_PIPELINE
> + * property on a &drm_plane, as well as drm_colorop properties.
> + *
> + * Setting of these plane properties will be rejected when this client
> + * cap is set:
> + * - COLOR_ENCODING
> + * - COLOR_RANGE
> + *
> + * The client must enable &DRM_CLIENT_CAP_ATOMIC first.
> + */
> +#define DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE 7
> +
> /* DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */
> struct drm_set_client_cap {
> __u64 capability;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0xE3520CC91929C8E7.asc
Type: application/pgp-keys
Size: 6868 bytes
Desc: OpenPGP public key
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20250401/c51fcf82/attachment-0001.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20250401/c51fcf82/attachment-0001.sig>
More information about the amd-gfx
mailing list