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 2FC2CE6F08E for ; Tue, 23 Dec 2025 12:56:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4E69E10E128; Tue, 23 Dec 2025 12:56:19 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.b="lObb7jai"; 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 E868510E128 for ; Tue, 23 Dec 2025 12:56:17 +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 6FCD81A23A4; Tue, 23 Dec 2025 12:56:16 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 3083260716; Tue, 23 Dec 2025 12:56:16 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 67B6E10AB047E; Tue, 23 Dec 2025 13:56:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1766494575; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=v11StIVYhZW6pNTNvm2d00yDP+Y/pPkF0IvfYZUT+Hw=; b=lObb7jaiJpxfKsS5jJoLgOlK4NgWwBycnaEXq+JymdWbNgc+WIXZt6hp+/qRB+2+72A5O5 gIuqWhh3YVKUSVqnPu0Hl3nUDoolNihHzsS4nuxLxBCTQw65IWpH5AsddvbwxoqMCgrSGT BOANIJSp3YgSGVAn3dPXHroctC7h+izv34dpc2+vlW/pjvvT0EXfElYX8V2tXcWbLNf3Du iwSX7WpK2RGjk6brF6c8kY5eRBBJuKI2JTQPXEG/07AnHgoD6INeEbCHXjg7VU4Txhu0k4 YcNJQjlvjWvJwa9ox7/aZO8LTPfnII4XnhKNqJBq8EpDYqWrkt91I5iFsw2VDg== Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Tue, 23 Dec 2025 13:56:09 +0100 Message-Id: To: "Louis Chauvet" , "Haneen Mohammed" , "Simona Vetter" , "Melissa Wen" , "Maarten Lankhorst" , "Maxime Ripard" , "Thomas Zimmermann" , "David Airlie" , , "Jonathan Corbet" From: "Luca Ceresoli" Subject: Re: [PATCH v3 13/33] drm/vkms: Introduce configfs for plane color encoding Cc: , , , , , X-Mailer: aerc 0.20.1 References: <20251222-vkms-all-config-v3-0-ba42dc3fb9ff@bootlin.com> <20251222-vkms-all-config-v3-13-ba42dc3fb9ff@bootlin.com> In-Reply-To: <20251222-vkms-all-config-v3-13-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 encoding per planes. VKMS > supports multiple color encoding, so the userspace can choose any > combination. > > The supported color encoding are configured by writing a color encoding > bitmask to the file `supported_color_encoding` and the default color > encoding is chosen by writing a color encoding bitmask to > `default_color_encoding`. > > Signed-off-by: Louis Chauvet > --- a/Documentation/ABI/testing/configfs-vkms > +++ b/Documentation/ABI/testing/configfs-vkms > @@ -124,6 +124,20 @@ Description: > Default rotation presented to userspace, same values as > possible_rotations. > > +What: /sys/kernel/config/vkms//planes//supported_color_e= ncoding = ^ supported_color_encodings (final 's'). > --- a/Documentation/gpu/vkms.rst > +++ b/Documentation/gpu/vkms.rst > +static ssize_t plane_supported_color_encodings_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_ENCODINGS)) > + return -EINVAL; > + /* Should at least provide one color range */ ^ encoding > +static ssize_t plane_default_color_encoding_show(struct config_item *ite= m, char *page) > +{ > + struct vkms_configfs_plane *plane; > + unsigned int default_color_encoding; > + > + plane =3D plane_item_to_vkms_configfs_plane(item); Set on declare, for consistency (and conciseness). > +static ssize_t plane_default_color_encoding_store(struct config_item *it= em, > + 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_ENCODINGS) > + return -EINVAL; > + /* Should at least provide one color range */ > + if ((val & VKMS_SUPPORTED_COLOR_ENCODINGS) =3D=3D 0) > + return -EINVAL; This if() is redundant, the is_power_of_2() implies it because you already ruled out any unsupported bit. Also, the comment is wrong. You can drop these 3 lines entirely. Luca -- Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com