From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2CF5624E4B4 for ; Tue, 23 Dec 2025 12:56:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766494582; cv=none; b=M2+C+LofyKzgt2T3APnVihtROq7uGBpTZoZR6OneDprYpIs5VvktDmAakWaTPeZS0z0S7IKAQ/gyHGlsan/xWuhf6BsaZ/wzvkMbvuWrMUPRNn3Zend6t2BGUVE7j6YmKzEBZ4DAm5bzB+vvrOtXMcZZlvSLT6VP7Egg8AbU11s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766494582; c=relaxed/simple; bh=+vNrHV00bDw+659hIS/F03Bd6EpmW6mCxIjl4rYYDVw=; h=Mime-Version:Content-Type:Date:Message-Id:To:From:Subject:Cc: References:In-Reply-To; b=axhVnMbw6qg8eEq7Hahhvk0bKDgPKnnswx2yQN7A3NRPdgCVeKKWJ6XUOEB1nIj12Fj2vsfzKMYr60SfLC3C+NHJxVElMFlvEIk6t0XCjQX/9PZ7ToghNR4+WLyOu/o8khBWJI7kLoXRPk4v/YFDNRyz58lJRd/UYyah5Hgxh90= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=lObb7jai; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="lObb7jai" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 5ABC7C1AE21; Tue, 23 Dec 2025 12:55:51 +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== Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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