]> Gentwo Git Trees - linux/.git/commitdiff
drm/colorop: Add BYPASS property
authorHarry Wentland <harry.wentland@amd.com>
Sat, 15 Nov 2025 00:01:32 +0000 (17:01 -0700)
committerSimon Ser <contact@emersion.fr>
Wed, 26 Nov 2025 22:03:32 +0000 (23:03 +0100)
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@emersion.fr>
Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com>
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-8-alex.hung@amd.com
drivers/gpu/drm/drm_atomic_uapi.c
drivers/gpu/drm/drm_colorop.c
include/drm/drm_colorop.h

index e01eaab9b2f734839260066ec4d0a2c0f8aac6f7..25a898090fd9a1521448216c9307328392088557 100644 (file)
@@ -655,7 +655,9 @@ static int drm_atomic_colorop_set_property(struct drm_colorop *colorop,
                                           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,
@@ -675,6 +677,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
index 81c55e0639c360ae15b5c347c2e1e1a1eaf0b253..4c088a5a489cd24c771e6a5198e48b0695fa70f0 100644 (file)
@@ -78,6 +78,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;
 }
 
@@ -134,6 +145,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;
 
@@ -150,6 +162,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 *
@@ -187,6 +201,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,
index 3594e50cfd68b6371c6fab506ca535fd328993d0..2d24f7248831781429b9750b9c80a799f7d8f1a8 100644 (file)
@@ -81,6 +81,15 @@ 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:
         *
@@ -170,6 +179,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
+        * 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:
         *