* [PATCH v2] drm: Guard DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE
@ 2026-07-02 8:16 Robert Mader
2026-07-02 8:34 ` Maarten Lankhorst
0 siblings, 1 reply; 3+ messages in thread
From: Robert Mader @ 2026-07-02 8:16 UTC (permalink / raw)
To: dri-devel
Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Simona Vetter, linux-kernel, amd-gfx, intel-gfx,
Harry Wentland, Daniel Stone, Chaitanya Kumar Borah, Uma Shankar,
Louis Chauvet, Melissa Wen, Simon Ser, Pekka Paalanen,
Leandro Ribeiro, Robert Mader
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 or tools like drm_info, enable the client cap on
such drivers they will be left without both color pipeline and the legacy
properties COLOR_ENCODING and COLOR_RANGE, effectively breaking YUV->RGB
conversion support.
Prevent that by only marking the cap supported if there are actually planes
with color pipelines.
Note: while the color pipeline replacement for the legacy properties is
still under review (1), we can assume that it will work as a drop-in
replacement. That means any plane on any hardware currently supporting
the legacy properties will be able to offer a functionally equal color
pipeline and there will be no technical reason keep using the legacy
properties if both the driver and the client support the new API.
1: https://lore.kernel.org/dri-devel/20260623164812.81110-1-harry.wentland@amd.com/
Signed-off-by: Robert Mader <robert.mader@collabora.com>
---
Changes in v2:
- Replace the driver feature with a simple check (suggested by Maarten
Lankhorst <maarten.lankhorst@linux.intel.com>)
- Expand the commit message slightly and change the title
---
drivers/gpu/drm/drm_ioctl.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index e2df4becce62..b2c0234eaf14 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -373,13 +373,26 @@ drm_setclientcap(struct drm_device *dev, void *data, struct drm_file *file_priv)
return -EINVAL;
file_priv->supports_virtualized_cursor_plane = req->value;
break;
- case DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE:
+ case DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE: {
+ struct drm_plane *plane;
+ bool has_plane_with_color_pipeline = false;
+
+ drm_for_each_plane(plane, dev) {
+ if (plane->color_pipeline_property) {
+ has_plane_with_color_pipeline = true;
+ break;
+ }
+ }
+ if (!has_plane_with_color_pipeline)
+ return -EOPNOTSUPP;
+
if (!file_priv->atomic)
return -EINVAL;
if (req->value > 1)
return -EINVAL;
file_priv->plane_color_pipeline = req->value;
break;
+ }
default:
return -EINVAL;
}
--
2.55.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] drm: Guard DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE
2026-07-02 8:16 [PATCH v2] drm: Guard DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE Robert Mader
@ 2026-07-02 8:34 ` Maarten Lankhorst
2026-07-02 9:31 ` Robert Mader
0 siblings, 1 reply; 3+ messages in thread
From: Maarten Lankhorst @ 2026-07-02 8:34 UTC (permalink / raw)
To: Robert Mader, dri-devel
Cc: Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
linux-kernel, amd-gfx, intel-gfx, Harry Wentland, Daniel Stone,
Chaitanya Kumar Borah, Uma Shankar, Louis Chauvet, Melissa Wen,
Simon Ser, Pekka Paalanen, Leandro Ribeiro
Hello,
On 7/2/26 10:16, Robert Mader wrote:
> 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 or tools like drm_info, enable the client cap on
> such drivers they will be left without both color pipeline and the legacy
> properties COLOR_ENCODING and COLOR_RANGE, effectively breaking YUV->RGB
> conversion support.
>
> Prevent that by only marking the cap supported if there are actually planes
> with color pipelines.
>
> Note: while the color pipeline replacement for the legacy properties is
> still under review (1), we can assume that it will work as a drop-in
> replacement. That means any plane on any hardware currently supporting
> the legacy properties will be able to offer a functionally equal color
> pipeline and there will be no technical reason keep using the legacy
> properties if both the driver and the client support the new API.
>
> 1: https://lore.kernel.org/dri-devel/20260623164812.81110-1-harry.wentland@amd.com/
>
> Signed-off-by: Robert Mader <robert.mader@collabora.com>
>
> ---
>
> Changes in v2:
> - Replace the driver feature with a simple check (suggested by Maarten
> Lankhorst <maarten.lankhorst@linux.intel.com>)
> - Expand the commit message slightly and change the title
> ---
> drivers/gpu/drm/drm_ioctl.c | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
> index e2df4becce62..b2c0234eaf14 100644
> --- a/drivers/gpu/drm/drm_ioctl.c
> +++ b/drivers/gpu/drm/drm_ioctl.c
> @@ -373,13 +373,26 @@ drm_setclientcap(struct drm_device *dev, void *data, struct drm_file *file_priv)
> return -EINVAL;
> file_priv->supports_virtualized_cursor_plane = req->value;
> break;
> - case DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE:
> + case DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE: {
> + struct drm_plane *plane;
> + bool has_plane_with_color_pipeline = false;
> +
> + drm_for_each_plane(plane, dev) {
> + if (plane->color_pipeline_property) {
> + has_plane_with_color_pipeline = true;
> + break;
> + }
> + }
> + if (!has_plane_with_color_pipeline)
> + return -EOPNOTSUPP;
> +
> if (!file_priv->atomic)
> return -EINVAL;
> if (req->value > 1)
> return -EINVAL;
> file_priv->plane_color_pipeline = req->value;
> break;
> + }
Perhaps put the most specific check (is there a plane with color pipeline?)
last, and return -EINVAL, as that is the default before
DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE was added.
Kind regards,
~Maarten Lankhorst
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] drm: Guard DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE
2026-07-02 8:34 ` Maarten Lankhorst
@ 2026-07-02 9:31 ` Robert Mader
0 siblings, 0 replies; 3+ messages in thread
From: Robert Mader @ 2026-07-02 9:31 UTC (permalink / raw)
To: Maarten Lankhorst, dri-devel
Cc: Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
linux-kernel, amd-gfx, intel-gfx, Harry Wentland, Daniel Stone,
Chaitanya Kumar Borah, Uma Shankar, Louis Chauvet, Melissa Wen,
Simon Ser, Pekka Paalanen, Leandro Ribeiro
Hi,
On 02.07.26 10:34, Maarten Lankhorst wrote:
> Hello,
<snip>
> On 7/2/26 10:16, Robert Mader wrote:
>> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
>> index e2df4becce62..b2c0234eaf14 100644
>> --- a/drivers/gpu/drm/drm_ioctl.c
>> +++ b/drivers/gpu/drm/drm_ioctl.c
>> @@ -373,13 +373,26 @@ drm_setclientcap(struct drm_device *dev, void *data, struct drm_file *file_priv)
>> return -EINVAL;
>> file_priv->supports_virtualized_cursor_plane = req->value;
>> break;
>> - case DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE:
>> + case DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE: {
>> + struct drm_plane *plane;
>> + bool has_plane_with_color_pipeline = false;
>> +
>> + drm_for_each_plane(plane, dev) {
>> + if (plane->color_pipeline_property) {
>> + has_plane_with_color_pipeline = true;
>> + break;
>> + }
>> + }
>> + if (!has_plane_with_color_pipeline)
>> + return -EOPNOTSUPP;
>> +
>> if (!file_priv->atomic)
>> return -EINVAL;
>> if (req->value > 1)
>> return -EINVAL;
>> file_priv->plane_color_pipeline = req->value;
>> break;
>> + }
> Perhaps put the most specific check (is there a plane with color pipeline?)
> last, and return -EINVAL, as that is the default before
> DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE was added.
>
> Kind regards,
> ~Maarten Lankhorst
Thanks, will do so in v3. Will wait a bit more for further feedback and
send it out tomorrow.
--
Robert Mader
Consultant Software Developer
Collabora Ltd.
Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK
Registered in England & Wales, no. 5513718
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-07-02 9:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-02 8:16 [PATCH v2] drm: Guard DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE Robert Mader
2026-07-02 8:34 ` Maarten Lankhorst
2026-07-02 9:31 ` Robert Mader
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®