If the driver doesn't support post-blend colorop, refuse attempts from
userspace to set it. Same approach is taken for pre-blend colorop since
commit ac7c6b4308c5 ("drm: Guard DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE").Signed-off-by: Melissa Wen <[email protected]> --- v3: - refuse the cap when no CRTC has a color pipeline as the plane guard does - drop the stale DRM_CAP_CRTC_COLOR_PIPELINE requirement from the cap documentation --- drivers/gpu/drm/drm_ioctl.c | 15 ++++++++++++++- include/uapi/drm/drm.h | 3 --- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index 3e57453ef258..9325202f8cbd 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -392,13 +392,26 @@ drm_setclientcap(struct drm_device *dev, void *data, struct drm_file *file_priv) file_priv->plane_color_pipeline = req->value; break; } - case DRM_CLIENT_CAP_CRTC_COLOR_PIPELINE: + case DRM_CLIENT_CAP_CRTC_COLOR_PIPELINE: { + struct drm_crtc *crtc; + bool has_crtc_with_color_pipeline = false; + if (!file_priv->atomic) return -EINVAL; if (req->value > 1) return -EINVAL; + drm_for_each_crtc(crtc, dev) { + if (crtc->color_pipeline_property) { + has_crtc_with_color_pipeline = true; + break; + } + } + if (!has_crtc_with_color_pipeline) + return -EOPNOTSUPP; + file_priv->crtc_color_pipeline = req->value; break; + } default: return -EINVAL; } diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h index 08bd616774a4..c0971de2c0a3 100644 --- a/include/uapi/drm/drm.h +++ b/include/uapi/drm/drm.h @@ -920,9 +920,6 @@ struct drm_get_cap { * the hidden model to default values. * * The client must enable &DRM_CLIENT_CAP_ATOMIC first. - * - * This client cap can only be set if the driver sets the corresponding driver - * cap &DRM_CAP_CRTC_COLOR_PIPELINE. */ #define DRM_CLIENT_CAP_CRTC_COLOR_PIPELINE 8 -- 2.53.0
