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 8C10939B484 for ; Wed, 22 Apr 2026 16:50:01 +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=1776876606; cv=none; b=hyLmZhWVdHZMivFFT9YkjpDleR5VREZd/SSGSZAYMgCJMnSAB3nSeoJcRYe3mF3+gkXeCGjhNzQnyF6/tRJccVyf8aCvxrqS2M6Zuth9hezSq7M31FKaQY340dzIrzuRvBKZoJ2VbVgIvG3Rs9SjwwI/oX5wWVAXbFw7KBkHo4g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776876606; c=relaxed/simple; bh=/scdl+yum6tDemz+EBivhAlkJUXfHrtDlC8P1/IVn+c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mWlVKmE9fRZN9uEObVeHqiaZuaatavSNWx4pRE9NA580yoYZNtVbWQePZCG0BAryAnkNO0bYCxPI+FVvHkuJO2TX9Q7WK0X6SdYY7CM3pZvARWn58ywybT40TzDfu58WLX2MR/FcM2OxShxXRn4Zv939yuG7iQ/DSn8LMZMlqZY= 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=hKI2iDgN; 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="hKI2iDgN" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 936AEC5EF06; Wed, 22 Apr 2026 16:50:40 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id AFFD45FA8F; Wed, 22 Apr 2026 16:49:59 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 7EBDD104608C5; Wed, 22 Apr 2026 18:49:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1776876598; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=t3Ks7JS2bXPVs2EXpchsXMgZDSggGzJrIJdbTNoa0SM=; b=hKI2iDgNmo9xnQR8xUWibvdC7McbfXPqY0QzvfUpzGOzxCAIYAmOkWsWZGy/ATXhWQozr1 a5HoP0+/jlyZFIQDAsr5gHyFQvgLBdR0FMa/dEycBXacJegzeDQI/pX4ITZMSfvlx4HC7t gCy5pKNdtDVw8KRDZpKog2AGAsO8I/B+dAZp/+FPWiYcHh3jGvfauo+zHuIH0vNZQuTjKV xEIYsR+tDmw7xoJs1XnwtGA1UB0RmwbJjzVk4gjgJVqZ1zegw8dPPViu9nKrKbzmZ3u6GE RFt5ESjJocCnMLX4MRpHA6O4/3/VA6EDevQPfj+Otdo4e4Z9H6pecNHGBmZNjw== From: Louis Chauvet Date: Wed, 22 Apr 2026 18:48:22 +0200 Subject: [PATCH v4 25/37] drm/vkms: Introduce configfs for plane zpos property Precedence: bulk X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260422-vkms-all-config-v4-25-dbb52e9aadc3@bootlin.com> References: <20260422-vkms-all-config-v4-0-dbb52e9aadc3@bootlin.com> In-Reply-To: <20260422-vkms-all-config-v4-0-dbb52e9aadc3@bootlin.com> To: Haneen Mohammed , Simona Vetter , Melissa Wen , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , jose.exposito89@gmail.com, Jonathan Corbet , Shuah Khan , Miguel Ojeda , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt 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 , llvm@lists.linux.dev, Luca Ceresoli X-Mailer: b4 0.16-dev 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 <= zpos_max - zpos_max - Maximum zpos value for this plane. Must be >= 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/testing/configfs-vkms index dae8b9e9d6bf..9f77a878aeef 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. +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 94f7b0d85ca7..c811290af983 100644 --- a/Documentation/gpu/vkms.rst +++ b/Documentation/gpu/vkms.rst @@ -87,7 +87,7 @@ Start by creating one or more planes:: sudo mkdir /config/vkms/my-vkms/planes/plane0 -Planes have 9 configurable attributes: +Planes have 14 configurable attributes: - 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 zpos_max. No + effect if zpos_enabled is not set. +- zpos_min: Set the minimum zpos value. No effect if zpos_enabled is not set. +- zpos_max: Set the maximum zpos value. No effect if zpos_enabled is not set. Continue by creating one or more CRTCs:: diff --git a/drivers/gpu/drm/vkms/vkms_configfs.c b/drivers/gpu/drm/vkms/vkms_configfs.c index b38d724cfb94..832f73011353 100644 --- a/drivers/gpu/drm/vkms/vkms_configfs.c +++ b/drivers/gpu/drm/vkms/vkms_configfs.c @@ -747,6 +747,176 @@ static ssize_t plane_supported_formats_store(struct config_item *item, return count; } +static ssize_t plane_zpos_enabled_show(struct config_item *item, char *page) +{ + struct vkms_configfs_plane *plane; + bool enabled; + + plane = plane_item_to_vkms_configfs_plane(item); + + scoped_guard(mutex, &plane->dev->lock) + enabled = 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 char *page, + size_t count) +{ + struct vkms_configfs_plane *plane; + bool enabled; + + plane = 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 *page) +{ + struct vkms_configfs_plane *plane; + bool mutable; + + plane = plane_item_to_vkms_configfs_plane(item); + + scoped_guard(mutex, &plane->dev->lock) + mutable = 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 char *page, + size_t count) +{ + struct vkms_configfs_plane *plane; + bool mutable; + + plane = 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 *page) +{ + struct vkms_configfs_plane *plane; + unsigned int initial; + + plane = plane_item_to_vkms_configfs_plane(item); + + scoped_guard(mutex, &plane->dev->lock) + initial = 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 char *page, + size_t count) +{ + struct vkms_configfs_plane *plane; + unsigned int initial; + + plane = 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 = plane_item_to_vkms_configfs_plane(item); + + scoped_guard(mutex, &plane->dev->lock) + min = 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 = 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 = plane_item_to_vkms_configfs_plane(item); + + scoped_guard(mutex, &plane->dev->lock) + max = 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 = 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); @@ -756,6 +926,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); static struct configfs_attribute *plane_item_attrs[] = { &plane_attr_type, @@ -767,6 +942,11 @@ static struct configfs_attribute *plane_item_attrs[] = { &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, }; -- 2.54.0