[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DF5NDYOIZB26.1GQDHWE4ETZLL@bootlin.com>
Date: Tue, 23 Dec 2025 14:58:26 +0100
From: "Luca Ceresoli" <luca.ceresoli@...tlin.com>
To: "Louis Chauvet" <louis.chauvet@...tlin.com>, "Haneen Mohammed"
<hamohammed.sa@...il.com>, "Simona Vetter" <simona@...ll.ch>, "Melissa Wen"
<melissa.srw@...il.com>, "Maarten Lankhorst"
<maarten.lankhorst@...ux.intel.com>, "Maxime Ripard" <mripard@...nel.org>,
"Thomas Zimmermann" <tzimmermann@...e.de>, "David Airlie"
<airlied@...il.com>, <jose.exposito89@...il.com>, "Jonathan Corbet"
<corbet@....net>
Cc: <victoria@...tem76.com>, <sebastian.wick@...hat.com>,
<thomas.petazzoni@...tlin.com>, <dri-devel@...ts.freedesktop.org>,
<linux-kernel@...r.kernel.org>, <linux-doc@...r.kernel.org>
Subject: Re: [PATCH v3 16/33] drm/vkms: Introduce configfs for plane color
range
On Mon Dec 22, 2025 at 11:11 AM CET, Louis Chauvet wrote:
> To allows the userspace to test many hardware configuration, introduce a
> new interface to configure the available color ranges per planes. VKMS
> supports multiple color ranges, so the userspace can choose any
> combination.
>
> The supported color ranges are configured by writing a color range bitmask
> to the file `supported_color_ranges` and the default color range is
> chosen by writing a color encoding bitmask to `default_color_range`.
>
> Signed-off-by: Louis Chauvet <louis.chauvet@...tlin.com>
> --- a/Documentation/ABI/testing/configfs-vkms
> +++ b/Documentation/ABI/testing/configfs-vkms
> @@ -138,6 +138,21 @@ Description:
> Default color encoding presented to userspace, same
> values as supported_color_encoding.
>
> +What: /sys/kernel/config/vkms/<device>/planes/<plane>/supported_color_ranges
> +Date: Nov 2025
This should be Jan 2026 I guess. Same for the previous patches in the
series which I already reviewed, sorry I didn't notice before.
BTW I wonder whether it is really important to have a date here. The time
before a patch is applied can make it quite wrong, but mostly I don't see
an obvious usefulness.
> --- a/drivers/gpu/drm/vkms/vkms_configfs.c
> +++ b/drivers/gpu/drm/vkms/vkms_configfs.c
> +static ssize_t plane_default_color_range_show(struct config_item *item, char *page)
> +{
> + struct vkms_configfs_plane *plane = plane_item_to_vkms_configfs_plane(item);;
Double semicolon.
> +static ssize_t plane_default_color_range_store(struct config_item *item,
> + const char *page, size_t count)
> +{
> + struct vkms_configfs_plane *plane = plane_item_to_vkms_configfs_plane(item);
> + int ret, val = 0;
> +
> + ret = kstrtouint(page, 10, &val);
> + if (ret)
> + return ret;
> +
> + /* Should be a supported value */
> + if (val & ~VKMS_SUPPORTED_COLOR_RANGES)
> + return -EINVAL;
> + /* Should at least provide one color range */
> + if ((val & VKMS_SUPPORTED_COLOR_RANGES) == 0)
> + return -EINVAL;
As for patch 13, these 3 lines are redundant, the is_power_of_2() below is
enough.
> +
> + if (!is_power_of_2(val))
> + return -EINVAL;
> +
> + /* Convert bit position to the proper enum value */
> + val = __ffs(val) + DRM_COLOR_YCBCR_LIMITED_RANGE;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I wonder whether this should just be '+ 1'. After all it's just the __ffs
semantics counting from 1 as opposed to the BIT() semantics counting from
0. Any pair of BIT() to read and __ffs() to write will need a '+ 1',
regardless of the meaning of the bits.
Same in patch 13, but realized just now.
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Powered by blists - more mailing lists