The client cap is currently advertised unconditionally, even for drivers that do
not support plane color pipelines. If clients supporting the later, like Wayland
compositors and drm_info, enable the client cap on sich drivers they will be
left without both color pipeline and the legacy properties COLOR_ENCODING and
COLOR_RANGE, effectively breaking YUV->RGB conversion support.

Add a new driver feature and guard the client cap behind it, allowing
plane color pipeline and legacy YUV->RGB support to co-exist.

Signed-off-by: Robert Mader <[email protected]>
---
 drivers/gpu/drm/drm_ioctl.c | 2 ++
 include/drm/drm_drv.h       | 6 ++++++
 2 files changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index ff193155129e..96fda92e31b9 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -374,6 +374,8 @@ drm_setclientcap(struct drm_device *dev, void *data, struct 
drm_file *file_priv)
                file_priv->supports_virtualized_cursor_plane = req->value;
                break;
        case DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE:
+               if (!drm_core_check_feature(dev, DRIVER_PLANE_COLOR_PIPELINE))
+                       return -EOPNOTSUPP;
                if (!file_priv->atomic)
                        return -EINVAL;
                if (req->value > 1)
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index e09559495c5b..108ddd2c8d30 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -116,6 +116,12 @@ enum drm_driver_feature {
         * the cursor planes to work correctly).
         */
        DRIVER_CURSOR_HOTSPOT           = BIT(9),
+       /**
+        * @DRIVER_PLANE_COLOR_PIPELINE:
+        *
+        * Driver supports PLANE_COLOR_PIPELINE.
+        */
+       DRIVER_PLANE_COLOR_PIPELINE     = BIT(10),
 
        /* IMPORTANT: Below are all the legacy flags, add new ones above. */
 
-- 
2.54.0

Reply via email to