]> Gentwo Git Trees - linux/.git/commitdiff
drm/colorop: Add NEXT property
authorHarry Wentland <harry.wentland@amd.com>
Sat, 15 Nov 2025 00:01:33 +0000 (17:01 -0700)
committerSimon Ser <contact@emersion.fr>
Wed, 26 Nov 2025 22:03:32 +0000 (23:03 +0100)
We'll construct color pipelines out of drm_colorop by
chaining them via the NEXT pointer. NEXT will point to
the next drm_colorop in the pipeline, or by 0 if we're
at the end of the pipeline.

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-9-alex.hung@amd.com
drivers/gpu/drm/drm_colorop.c
include/drm/drm_colorop.h

index 4c088a5a489cd24c771e6a5198e48b0695fa70f0..6dd685b7348b508b26e3c9cfcb9e3b7b9dce85c4 100644 (file)
@@ -57,6 +57,7 @@ static int drm_plane_colorop_init(struct drm_device *dev, struct drm_colorop *co
        colorop->dev = dev;
        colorop->type = type;
        colorop->plane = plane;
+       colorop->next = NULL;
 
        list_add_tail(&colorop->head, &config->colorop_list);
        colorop->index = config->num_colorop++;
@@ -89,6 +90,16 @@ static int drm_plane_colorop_init(struct drm_device *dev, struct drm_colorop *co
                                   colorop->bypass_property,
                                   1);
 
+       /* next */
+       prop = drm_property_create_object(dev, DRM_MODE_PROP_IMMUTABLE | DRM_MODE_PROP_ATOMIC,
+                                         "NEXT", DRM_MODE_OBJECT_COLOROP);
+       if (!prop)
+               return -ENOMEM;
+       colorop->next_property = prop;
+       drm_object_attach_property(&colorop->base,
+                                  colorop->next_property,
+                                  0);
+
        return ret;
 }
 
@@ -260,3 +271,19 @@ const char *drm_get_colorop_curve_1d_type_name(enum drm_colorop_curve_1d_type ty
 
        return colorop_curve_1d_type_names[type];
 }
+
+/**
+ * drm_colorop_set_next_property - sets the next pointer
+ * @colorop: drm colorop
+ * @next: next colorop
+ *
+ * Should be used when constructing the color pipeline
+ */
+void drm_colorop_set_next_property(struct drm_colorop *colorop, struct drm_colorop *next)
+{
+       drm_object_property_set_value(&colorop->base,
+                                     colorop->next_property,
+                                     next ? next->base.id : 0);
+       colorop->next = next;
+}
+EXPORT_SYMBOL(drm_colorop_set_next_property);
index 2d24f7248831781429b9750b9c80a799f7d8f1a8..d8c17c53758681ab8ce4c2cb42eb59224807fd09 100644 (file)
@@ -171,6 +171,14 @@ struct drm_colorop {
         */
        enum drm_colorop_type type;
 
+       /**
+        * @next:
+        *
+        * Read-only
+        * Pointer to next drm_colorop in pipeline
+        */
+       struct drm_colorop *next;
+
        /**
         * @type_property:
         *
@@ -198,6 +206,13 @@ struct drm_colorop {
         */
        struct drm_property *curve_1d_type_property;
 
+       /**
+        * @next_property:
+        *
+        * Read-only property to next colorop in the pipeline
+        */
+       struct drm_property *next_property;
+
 };
 
 #define obj_to_colorop(x) container_of(x, struct drm_colorop, base)
@@ -273,4 +288,6 @@ const char *drm_get_colorop_type_name(enum drm_colorop_type type);
  */
 const char *drm_get_colorop_curve_1d_type_name(enum drm_colorop_curve_1d_type type);
 
+void drm_colorop_set_next_property(struct drm_colorop *colorop, struct drm_colorop *next);
+
 #endif /* __DRM_COLOROP_H__ */