]> Gentwo Git Trees - linux/.git/commitdiff
drm/colorop: Introduce DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE
authorHarry Wentland <harry.wentland@amd.com>
Sat, 15 Nov 2025 00:01:36 +0000 (17:01 -0700)
committerSimon Ser <contact@emersion.fr>
Wed, 26 Nov 2025 22:03:32 +0000 (23:03 +0100)
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 register with
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.

Reviewed-by: Simon Ser <contact@emersion.fr>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Melissa Wen <mwen@igalia.com>
Reviewed-by: Sebastian Wick <sebastian.wick@redhat.com>
Signed-off-by: Simon Ser <contact@emersion.fr>
Link: https://patch.msgid.link/20251115000237.3561250-12-alex.hung@amd.com
drivers/gpu/drm/drm_connector.c
drivers/gpu/drm/drm_crtc_internal.h
drivers/gpu/drm/drm_ioctl.c
drivers/gpu/drm/drm_mode_object.c
include/drm/drm_file.h
include/uapi/drm/drm.h

index 272d6254ea4784e97ca894ec4d463beebf9fdbf0..4d6dc9ebfdb5bc730b1aff7a184448af7b93f078 100644 (file)
@@ -3439,6 +3439,7 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,
         * properties reflect the latest status.
         */
        ret = drm_mode_object_get_properties(&connector->base, file_priv->atomic,
+                       file_priv->plane_color_pipeline,
                        (uint32_t __user *)(unsigned long)(out_resp->props_ptr),
                        (uint64_t __user *)(unsigned long)(out_resp->prop_values_ptr),
                        &out_resp->count_props);
index 89706aa8232fc0b2830af67c7588985a29653299..c094092296448093c5cd192ecdc8ea9a50769c90 100644 (file)
@@ -163,6 +163,7 @@ struct drm_mode_object *__drm_mode_object_find(struct drm_device *dev,
 void drm_mode_object_unregister(struct drm_device *dev,
                                struct drm_mode_object *object);
 int drm_mode_object_get_properties(struct drm_mode_object *obj, bool atomic,
+                                  bool plane_color_pipeline,
                                   uint32_t __user *prop_ptr,
                                   uint64_t __user *prop_values,
                                   uint32_t *arg_count_props);
index d8a24875a7bab143e6366862574152af5141c984..ff193155129e7e863888d8958458978566b144f8 100644 (file)
@@ -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;
        }
index e943205a2394cd9c0d64b940a5e15ccff7f35246..b45d501b10c868c6d9b7a5a8760eadbd7b372a6a 100644 (file)
@@ -28,6 +28,7 @@
 #include <drm/drm_device.h>
 #include <drm/drm_file.h>
 #include <drm/drm_mode_object.h>
+#include <drm/drm_plane.h>
 #include <drm/drm_print.h>
 
 #include "drm_crtc_internal.h"
@@ -386,6 +387,7 @@ EXPORT_SYMBOL(drm_object_property_get_default_value);
 
 /* helper for getconnector and getproperties ioctls */
 int drm_mode_object_get_properties(struct drm_mode_object *obj, bool atomic,
+                                  bool plane_color_pipeline,
                                   uint32_t __user *prop_ptr,
                                   uint64_t __user *prop_values,
                                   uint32_t *arg_count_props)
@@ -399,6 +401,21 @@ int drm_mode_object_get_properties(struct drm_mode_object *obj, bool atomic,
                if ((prop->flags & DRM_MODE_PROP_ATOMIC) && !atomic)
                        continue;
 
+               if (plane_color_pipeline && obj->type == DRM_MODE_OBJECT_PLANE) {
+                       struct drm_plane *plane = obj_to_plane(obj);
+
+                       if (prop == plane->color_encoding_property ||
+                           prop == plane->color_range_property)
+                               continue;
+               }
+
+               if (!plane_color_pipeline && obj->type == DRM_MODE_OBJECT_PLANE) {
+                       struct drm_plane *plane = obj_to_plane(obj);
+
+                       if (prop == plane->color_pipeline_property)
+                               continue;
+               }
+
                if (*arg_count_props > count) {
                        ret = __drm_object_property_get_value(obj, prop, &val);
                        if (ret)
@@ -457,6 +474,7 @@ int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
        }
 
        ret = drm_mode_object_get_properties(obj, file_priv->atomic,
+                       file_priv->plane_color_pipeline,
                        (uint32_t __user *)(unsigned long)(arg->props_ptr),
                        (uint64_t __user *)(unsigned long)(arg->prop_values_ptr),
                        &arg->count_props);
index 115763799625baae194ad1074f7225e015e9e5d3..1a3018e4a537b3341acb50187d47371f6b781b9d 100644 (file)
@@ -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:
         *
index 3cd5cf15e3c9ce220aa3171ec1342ba7ef61d273..27cc159c1d275c7a7fe057840ef792f30a582bb7 100644 (file)
@@ -906,6 +906,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;