From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 07AC9E6F092 for ; Tue, 23 Dec 2025 13:58:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6ECD110E00C; Tue, 23 Dec 2025 13:58:35 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.b="l1L6mxsa"; dkim-atps=neutral Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2F8C510E00C for ; Tue, 23 Dec 2025 13:58:34 +0000 (UTC) Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 9C2881A22CA; Tue, 23 Dec 2025 13:58:32 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 6DEFF60716; Tue, 23 Dec 2025 13:58:32 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 0373F10AB01FB; Tue, 23 Dec 2025 14:58:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1766498311; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=OKaoNE2kG2LGETGezyB3qQSBG77m7FSpf0Xy44rSniQ=; b=l1L6mxsaUAmLs1BWHOR13oL9JBBJGQ4TBKx51AoePG6cP6EDR3DEZ7pNVLFhKZrangavJe xpJeHHqklbUdGhARIbCHlAPufz05Ej/Naefr2EYeYCFihGX5Ar39Y6TEXXqVEtwqPFRt0u Z/kDOLhFmQIMUQD/hfNMMwm7nMr4QS7NMEArh0HGRQoMIpLccyczsGen2q9eM3lUPNlXti dLOHgpN3OgfYHs/sOIj6fku20FoTQBvjWN//WD7t3mLIUZCwwxAHUTM0moJuusM5WuSVCs i+PP7fO3FgzyUIsPXBxbxZEJb5rE/NyB+U6nbglmo0J8yASLl8lbqjKnfRIY8Q== Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Tue, 23 Dec 2025 14:58:26 +0100 Message-Id: From: "Luca Ceresoli" Subject: Re: [PATCH v3 16/33] drm/vkms: Introduce configfs for plane color range Cc: , , , , , To: "Louis Chauvet" , "Haneen Mohammed" , "Simona Vetter" , "Melissa Wen" , "Maarten Lankhorst" , "Maxime Ripard" , "Thomas Zimmermann" , "David Airlie" , , "Jonathan Corbet" X-Mailer: aerc 0.20.1 References: <20251222-vkms-all-config-v3-0-ba42dc3fb9ff@bootlin.com> <20251222-vkms-all-config-v3-16-ba42dc3fb9ff@bootlin.com> In-Reply-To: <20251222-vkms-all-config-v3-16-ba42dc3fb9ff@bootlin.com> X-Last-TLS-Session-Version: TLSv1.3 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 bitmas= k > 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 > --- 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//planes//supported_color_r= anges > +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 =3D 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 =3D plane_item_to_vkms_configfs_plane= (item); > + int ret, val =3D 0; > + > + ret =3D 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) =3D=3D 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 =3D __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