Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/colorop: Introduce DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE

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

authored by

Harry Wentland and committed by
Simon Ser
179ab8e7 2afc3184

+49
+1
drivers/gpu/drm/drm_connector.c
··· 3439 3439 * properties reflect the latest status. 3440 3440 */ 3441 3441 ret = drm_mode_object_get_properties(&connector->base, file_priv->atomic, 3442 + file_priv->plane_color_pipeline, 3442 3443 (uint32_t __user *)(unsigned long)(out_resp->props_ptr), 3443 3444 (uint64_t __user *)(unsigned long)(out_resp->prop_values_ptr), 3444 3445 &out_resp->count_props);
+1
drivers/gpu/drm/drm_crtc_internal.h
··· 163 163 void drm_mode_object_unregister(struct drm_device *dev, 164 164 struct drm_mode_object *object); 165 165 int drm_mode_object_get_properties(struct drm_mode_object *obj, bool atomic, 166 + bool plane_color_pipeline, 166 167 uint32_t __user *prop_ptr, 167 168 uint64_t __user *prop_values, 168 169 uint32_t *arg_count_props);
+7
drivers/gpu/drm/drm_ioctl.c
··· 373 373 return -EINVAL; 374 374 file_priv->supports_virtualized_cursor_plane = req->value; 375 375 break; 376 + case DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE: 377 + if (!file_priv->atomic) 378 + return -EINVAL; 379 + if (req->value > 1) 380 + return -EINVAL; 381 + file_priv->plane_color_pipeline = req->value; 382 + break; 376 383 default: 377 384 return -EINVAL; 378 385 }
+18
drivers/gpu/drm/drm_mode_object.c
··· 28 28 #include <drm/drm_device.h> 29 29 #include <drm/drm_file.h> 30 30 #include <drm/drm_mode_object.h> 31 + #include <drm/drm_plane.h> 31 32 #include <drm/drm_print.h> 32 33 33 34 #include "drm_crtc_internal.h" ··· 387 386 388 387 /* helper for getconnector and getproperties ioctls */ 389 388 int drm_mode_object_get_properties(struct drm_mode_object *obj, bool atomic, 389 + bool plane_color_pipeline, 390 390 uint32_t __user *prop_ptr, 391 391 uint64_t __user *prop_values, 392 392 uint32_t *arg_count_props) ··· 400 398 401 399 if ((prop->flags & DRM_MODE_PROP_ATOMIC) && !atomic) 402 400 continue; 401 + 402 + if (plane_color_pipeline && obj->type == DRM_MODE_OBJECT_PLANE) { 403 + struct drm_plane *plane = obj_to_plane(obj); 404 + 405 + if (prop == plane->color_encoding_property || 406 + prop == plane->color_range_property) 407 + continue; 408 + } 409 + 410 + if (!plane_color_pipeline && obj->type == DRM_MODE_OBJECT_PLANE) { 411 + struct drm_plane *plane = obj_to_plane(obj); 412 + 413 + if (prop == plane->color_pipeline_property) 414 + continue; 415 + } 403 416 404 417 if (*arg_count_props > count) { 405 418 ret = __drm_object_property_get_value(obj, prop, &val); ··· 474 457 } 475 458 476 459 ret = drm_mode_object_get_properties(obj, file_priv->atomic, 460 + file_priv->plane_color_pipeline, 477 461 (uint32_t __user *)(unsigned long)(arg->props_ptr), 478 462 (uint64_t __user *)(unsigned long)(arg->prop_values_ptr), 479 463 &arg->count_props);
+7
include/drm/drm_file.h
··· 207 207 bool writeback_connectors; 208 208 209 209 /** 210 + * @plane_color_pipeline: 211 + * 212 + * True if client understands plane color pipelines 213 + */ 214 + bool plane_color_pipeline; 215 + 216 + /** 210 217 * @was_master: 211 218 * 212 219 * This client has or had, master capability. Protected by struct
+15
include/uapi/drm/drm.h
··· 906 906 */ 907 907 #define DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT 6 908 908 909 + /** 910 + * DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE 911 + * 912 + * If set to 1 the DRM core will allow setting the COLOR_PIPELINE 913 + * property on a &drm_plane, as well as drm_colorop properties. 914 + * 915 + * Setting of these plane properties will be rejected when this client 916 + * cap is set: 917 + * - COLOR_ENCODING 918 + * - COLOR_RANGE 919 + * 920 + * The client must enable &DRM_CLIENT_CAP_ATOMIC first. 921 + */ 922 + #define DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE 7 923 + 909 924 /* DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */ 910 925 struct drm_set_client_cap { 911 926 __u64 capability;