From nobody Mon Feb 9 11:29:38 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (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 0A70531771B; Mon, 22 Dec 2025 10:12:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766398340; cv=none; b=Azr10IM0wac1NMxQFxfDoKWJhXTYTT+TiUiUjIrjJHeBHaqibWE8DaKgJAmLAd/759o0ocvNclG+QTj73Ctr6thxE3effMuQgegkhKJnd7roVAgqiKekvdI7Px5bjEkTGz0ld8RjEDwj/h4pvZCVwCXWR8KxTjAC4qHPP19lD4E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766398340; c=relaxed/simple; bh=zg66emRQ9vJX8Db5mLafvXO4tBtRi+ohu+fCJI2oHoc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kNIhExSj76edU8Oha8M1LC0Bmby1QeEfbv8M2qzhztAGtDtg5Q6VZhFYmGo67Td+JJ06oy6HBZlFjKcjraTFCfjxE1Mk2pN88zI+GWiojnXHK4OTkIQcLA9pTo6ztwJjKrsFQdPN6i+ruAGw3QszsRk0Z5zMj6mAGHR1mHRS7uw= 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=TGWKVPvY; arc=none smtp.client-ip=185.246.85.4 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="TGWKVPvY" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 8C8394E41D33; Mon, 22 Dec 2025 10:12:13 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 5FFD9606C1; Mon, 22 Dec 2025 10:12:13 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 0CFB110AB0194; Mon, 22 Dec 2025 11:12:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1766398329; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=LvPL07YQ2+ZbO1wTrUyzmuhR4CILGij69D3/1xLFg/k=; b=TGWKVPvYWzONttYZ2+Ug5ROaosxRRFDpyn9dyuewhy1fbWN98Ps/30yNwnHRjI+3hHKPne e0h9lN/EXYnhXQzpsoSkfLQMkrYD2ydt2kTcjc30AJ6971Yn7vghYpT2BWoFjK2y//IAGy wPFYApps4Uca+kjwFzJyCr8mvPiQl94vcObB0Eb0LzK2cPDL2dAu5G7SttM/Jhn6reqtu6 Z8gBszOE2S8y/8IoOYqv2uZ0rT2ntSU5Q/N45V62cxf1YTqbMG+kvp1b3LqjIgBXawWt5t 0iRYpwRGwBp7LJyQ28VRCtPsDj84An62v/q+hBk6eqECBdXLU7Y7XuK3tfqSLA== From: Louis Chauvet Date: Mon, 22 Dec 2025 11:11:23 +0100 Subject: [PATCH v3 21/33] drm/vkms: Introduce configfs for plane zpos property Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251222-vkms-all-config-v3-21-ba42dc3fb9ff@bootlin.com> References: <20251222-vkms-all-config-v3-0-ba42dc3fb9ff@bootlin.com> In-Reply-To: <20251222-vkms-all-config-v3-0-ba42dc3fb9ff@bootlin.com> To: Haneen Mohammed , Simona Vetter , Melissa Wen , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , jose.exposito89@gmail.com, Jonathan Corbet Cc: victoria@system76.com, sebastian.wick@redhat.com, victoria@system76.com, airlied@gmail.com, thomas.petazzoni@bootlin.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Louis Chauvet , Luca Ceresoli X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=9470; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=zg66emRQ9vJX8Db5mLafvXO4tBtRi+ohu+fCJI2oHoc=; b=owEBiQJ2/ZANAwAIASCtLsZbECziAcsmYgBpSRlCeKdoP342N0jwBjUgZFHFtsi6hPJoMlwic craHDOaMoeJAk8EAAEIADkWIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCaUkZQhsUgAAAAAAEAA5t YW51MiwyLjUrMS4xMSwyLDIACgkQIK0uxlsQLOIKWxAAs6zEXjqhz4ezTDqXyuaII/VQN7C85sR Bl6m8hEVI4Scp4gA/OSij8SBmk7yD7yfjC0YQN6/dHJHKrFkpSQNu3kTmh79wDcSdr4ShDIQKJY rVRFa/o7dfgDb1W11S+mTr1zP9QfHMzh3DaATTvidIKewFhW5E5e/ebR8qw9Ka/1vINsMgtt5Xj Ad6bMhYnA9AzEhoZ4V07HCzjFlYtfMUmKcIR9Rf9FuvGBBhgzd8MQnHppNvd68xvSZ7Cp1aCUSp hgEeMyFn0lSLS6avpZ9k3gKY/L4itpGd4BGF4wAhcq6o33fMHV8wL3Ciq5tjdITq60d1N5WnLHh TrfwZ2vweQMPrJAglILUuOEtC/8uXBaTtgnxgSqm4H5UTXkri8sRG/nLJd07bchq8n5AsbXof2U +rV326aZ1fFfHEe4BQ8mHYntnXIzfvJWfccfzagcqnR7+hrEhtt9e0Pl7BhXxYY9QBTL1yhmXIl bs2v/Kba74bZP1CfvXDyPWjLgqtkB5dhiY+o0bCe3lxb0b92z21u2wyU+u2E9cJ5lKc5S75lOKg eBtYPmZRIk6xIuJGrVS0BxGgooVNw1XsZf8EzFzishSNuVXEJ8H4MAsq1jpM+Tq6yq5b0U5mQR9 mXDEA0CLnb2tDgWnmkc+4dOVwVmjwedgkLfCdMBIr3qeCh5Z2cQQ= X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-Last-TLS-Session-Version: TLSv1.3 Modern compositor rely on zpos management to offload some processing to deticated hardware. In order to test multiple configurations, add zpos configuration to configFS. Introduce multiple attributes to configure zpos: - zpos_enabled - Create or not the zpos property. If not created, the zpos is undefined. - zpos_mutable - If the zpos property is created, allow or not the userspace to modify it - zpos_initial - Initial value for zpos property. Must be between zpos_min and zpos_max - zpos_min - Minimum zpos value for this plane. Must be <=3D zpos_max - zpos_max - Maximum zpos value for this plane. Must be >=3D zpos_min Reviewed-by: Luca Ceresoli Signed-off-by: Louis Chauvet --- Documentation/ABI/testing/configfs-vkms | 36 +++++++ Documentation/gpu/vkms.rst | 9 +- drivers/gpu/drm/vkms/vkms_configfs.c | 180 ++++++++++++++++++++++++++++= ++++ 3 files changed, 224 insertions(+), 1 deletion(-) diff --git a/Documentation/ABI/testing/configfs-vkms b/Documentation/ABI/te= sting/configfs-vkms index 48f92538c602..34cb6aeec411 100644 --- a/Documentation/ABI/testing/configfs-vkms +++ b/Documentation/ABI/testing/configfs-vkms @@ -162,6 +162,42 @@ Description: use '-' prefix. Use '+*' to add all formats, '-*' to remove all. =20 +What: /sys/kernel/config/vkms//planes//zpos_enabled +Date: Nov 2025 +Contact: dri-devel@lists.freedesktop.org +Description: + Enable or disable the zpos property. Value: 1 - enabled, + 0 - disabled. + +What: /sys/kernel/config/vkms//planes//zpos_mutable +Date: Nov 2025 +Contact: dri-devel@lists.freedesktop.org +Description: + Create the zpos property as mutable or immutable. + Value: 1 - mutable, 0 - immutable. No effect if + zpos_enabled is not set. + +What: /sys/kernel/config/vkms//planes//zpos_initial +Date: Nov 2025 +Contact: dri-devel@lists.freedesktop.org +Description: + Set the initial zpos value. Must be between zpos_min + and zpos_max. No effect if zpos_enabled is not set. + +What: /sys/kernel/config/vkms//planes//zpos_min +Date: Nov 2025 +Contact: dri-devel@lists.freedesktop.org +Description: + Set the minimal zpos value. No effect if zpos_enabled + is not set. + +What: /sys/kernel/config/vkms//planes//zpos_max +Date: Nov 2025 +Contact: dri-devel@lists.freedesktop.org +Description: + Set the maximal zpos value. No effect if zpos_enabled + is not set. + What: /sys/kernel/config/vkms//planes//possible_crtcs Date: Nov 2025 Contact: dri-devel@lists.freedesktop.org diff --git a/Documentation/gpu/vkms.rst b/Documentation/gpu/vkms.rst index 15d62ad963c9..791c4f33a90a 100644 --- a/Documentation/gpu/vkms.rst +++ b/Documentation/gpu/vkms.rst @@ -87,7 +87,7 @@ Start by creating one or more planes:: =20 sudo mkdir /config/vkms/my-vkms/planes/plane0 =20 -Planes have 9 configurable attributes: +Planes have 14 configurable attributes: =20 - type: Plane type: 0 overlay, 1 primary, 2 cursor (same values as those exposed by the "type" property of a plane) @@ -114,6 +114,13 @@ Planes have 9 configurable attributes: To remove a format, use a minus and its fourcc: -XR24 To add all formats use +* To remove all formats, use -* +- zpos_enabled: Enable or not the zpos property: 1 enable, 0 disable +- zpos_mutable: Create the zpos property as a mutable or imutable property= : 1 mutable, + 0 immutable. No effect if zpos_enabled is not set. +- zpos_initial: Set the initial zpos value. Must be between zpos_min and z= pos_max. No + effect if zpos_enabled is not set. +- zpos_min: Set the minimum zpos value. No effect if zpos_enabled is not s= et. +- zpos_max: Set the maximum zpos value. No effect if zpos_enabled is not s= et. =20 Continue by creating one or more CRTCs:: =20 diff --git a/drivers/gpu/drm/vkms/vkms_configfs.c b/drivers/gpu/drm/vkms/vk= ms_configfs.c index a451d1122acf..e7f3ab54b5a1 100644 --- a/drivers/gpu/drm/vkms/vkms_configfs.c +++ b/drivers/gpu/drm/vkms/vkms_configfs.c @@ -744,6 +744,176 @@ static ssize_t plane_supported_formats_store(struct c= onfig_item *item, return count; } =20 +static ssize_t plane_zpos_enabled_show(struct config_item *item, char *pag= e) +{ + struct vkms_configfs_plane *plane; + bool enabled; + + plane =3D plane_item_to_vkms_configfs_plane(item); + + scoped_guard(mutex, &plane->dev->lock) + enabled =3D vkms_config_plane_get_zpos_enabled(plane->config); + + return sprintf(page, "%d\n", enabled); +} + +static ssize_t plane_zpos_enabled_store(struct config_item *item, const ch= ar *page, + size_t count) +{ + struct vkms_configfs_plane *plane; + bool enabled; + + plane =3D plane_item_to_vkms_configfs_plane(item); + + if (kstrtobool(page, &enabled)) + return -EINVAL; + + scoped_guard(mutex, &plane->dev->lock) { + if (plane->dev->enabled) + return -EBUSY; + + vkms_config_plane_set_zpos_enabled(plane->config, enabled); + } + + return (ssize_t)count; +} + +static ssize_t plane_zpos_mutable_show(struct config_item *item, char *pag= e) +{ + struct vkms_configfs_plane *plane; + bool mutable; + + plane =3D plane_item_to_vkms_configfs_plane(item); + + scoped_guard(mutex, &plane->dev->lock) + mutable =3D vkms_config_plane_get_zpos_mutable(plane->config); + + return sprintf(page, "%d\n", mutable); +} + +static ssize_t plane_zpos_mutable_store(struct config_item *item, const ch= ar *page, + size_t count) +{ + struct vkms_configfs_plane *plane; + bool mutable; + + plane =3D plane_item_to_vkms_configfs_plane(item); + + if (kstrtobool(page, &mutable)) + return -EINVAL; + + scoped_guard(mutex, &plane->dev->lock) { + if (plane->dev->enabled) + return -EBUSY; + + vkms_config_plane_set_zpos_mutable(plane->config, mutable); + } + + return (ssize_t)count; +} + +static ssize_t plane_zpos_initial_show(struct config_item *item, char *pag= e) +{ + struct vkms_configfs_plane *plane; + unsigned int initial; + + plane =3D plane_item_to_vkms_configfs_plane(item); + + scoped_guard(mutex, &plane->dev->lock) + initial =3D vkms_config_plane_get_zpos_initial(plane->config); + + return sprintf(page, "%u\n", initial); +} + +static ssize_t plane_zpos_initial_store(struct config_item *item, const ch= ar *page, + size_t count) +{ + struct vkms_configfs_plane *plane; + unsigned int initial; + + plane =3D plane_item_to_vkms_configfs_plane(item); + + if (kstrtouint(page, 10, &initial)) + return -EINVAL; + + scoped_guard(mutex, &plane->dev->lock) { + if (plane->dev->enabled) + return -EBUSY; + + vkms_config_plane_set_zpos_initial(plane->config, initial); + } + + return (ssize_t)count; +} + +static ssize_t plane_zpos_min_show(struct config_item *item, char *page) +{ + struct vkms_configfs_plane *plane; + unsigned int min; + + plane =3D plane_item_to_vkms_configfs_plane(item); + + scoped_guard(mutex, &plane->dev->lock) + min =3D vkms_config_plane_get_zpos_min(plane->config); + + return sprintf(page, "%u\n", min); +} + +static ssize_t plane_zpos_min_store(struct config_item *item, const char *= page, + size_t count) +{ + struct vkms_configfs_plane *plane; + unsigned int min; + + plane =3D plane_item_to_vkms_configfs_plane(item); + + if (kstrtouint(page, 10, &min)) + return -EINVAL; + + scoped_guard(mutex, &plane->dev->lock) { + if (plane->dev->enabled) + return -EBUSY; + + vkms_config_plane_set_zpos_min(plane->config, min); + } + + return (ssize_t)count; +} + +static ssize_t plane_zpos_max_show(struct config_item *item, char *page) +{ + struct vkms_configfs_plane *plane; + unsigned int max; + + plane =3D plane_item_to_vkms_configfs_plane(item); + + scoped_guard(mutex, &plane->dev->lock) + max =3D vkms_config_plane_get_zpos_max(plane->config); + + return sprintf(page, "%u\n", max); +} + +static ssize_t plane_zpos_max_store(struct config_item *item, const char *= page, + size_t count) +{ + struct vkms_configfs_plane *plane; + unsigned int max; + + plane =3D plane_item_to_vkms_configfs_plane(item); + + if (kstrtouint(page, 10, &max)) + return -EINVAL; + + scoped_guard(mutex, &plane->dev->lock) { + if (plane->dev->enabled) + return -EBUSY; + + vkms_config_plane_set_zpos_max(plane->config, max); + } + + return (ssize_t)count; +} + CONFIGFS_ATTR(plane_, type); CONFIGFS_ATTR(plane_, name); CONFIGFS_ATTR(plane_, supported_rotations); @@ -753,6 +923,11 @@ CONFIGFS_ATTR(plane_, default_color_range); CONFIGFS_ATTR(plane_, supported_color_encodings); CONFIGFS_ATTR(plane_, default_color_encoding); CONFIGFS_ATTR(plane_, supported_formats); +CONFIGFS_ATTR(plane_, zpos_enabled); +CONFIGFS_ATTR(plane_, zpos_mutable); +CONFIGFS_ATTR(plane_, zpos_initial); +CONFIGFS_ATTR(plane_, zpos_min); +CONFIGFS_ATTR(plane_, zpos_max); =20 static struct configfs_attribute *plane_item_attrs[] =3D { &plane_attr_type, @@ -764,6 +939,11 @@ static struct configfs_attribute *plane_item_attrs[] = =3D { &plane_attr_supported_color_encodings, &plane_attr_default_color_encoding, &plane_attr_supported_formats, + &plane_attr_zpos_enabled, + &plane_attr_zpos_mutable, + &plane_attr_zpos_initial, + &plane_attr_zpos_min, + &plane_attr_zpos_max, NULL, }; =20 --=20 2.51.2