From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.54 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796138844; b=ZIyqgTPwgJ4ekB/jvmzMWmsP0jq6ExnNxFOdh6tsFo+p477S82eNzyU9waHRH7JGGibm JJNe7LuOUaAehotawwmxOBDVK8ZXMXegWgANoFm3OPKVBMP7HqXwfj3IXFMdWDm3Kc8Td 4GKO5YfDmbBu/7Qb3Vmv3ijJPWSHPTwLkfwE/Lrb6V0NjdtgcDbP8pRvyQOHTGBOwfQVQ AJiMXSEhE5ss28zNTqjQ2tJ9yJcIcizg9yw6bisGPzyBmCAYmvneyIOx85vwlEZO3Fq7R eMfcYndJ21KsyA82/mIAsXz+iSe8BUQy1Ceibc2Q5OxdMzGGSQPCCFqpnkoOhsUvI6A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796138844; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Type:Content-Disposition: Content-Transfer-Encoding; bh=g9EsOtK6FZkC6gV8rd00/FvsyB8EgIOdF3tbQT6i/+o=; b=rBV1cvUJs6zU0WTWkqxOeT8BmUejSWbk+NgdzzI0xdzbaUkgJaFrjuUonQxbLptqTDmH REcNXEjuy1qpwSlDtjvR/yvyQYWr8mUMI3/eD9V7Raa+8QrJqSeGEZozj/PM81W7hwt0R K1Ohf2nGUkPDLRiqRjljfOil6LIzaxPHCTgXCgib7NmS+/IjGp80zPTvzmjwI83kRlUnF s8S0x0XF1XMrabPSWgyaLPaOwI7B63rI0THTwfWrWqvPTQgJM2nXxla0CzYYQaE8hLoCH c5mGleSSyj9f77l8ijgWCqTOxPZKX7/MuZBu0QeGJgK9bunFmmwncDSTnaVE4Fx6I+w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=aitINptD; arc=none smtp.remote-ip=209.85.128.54 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8BADD606A686 for ; Tue, 1 Dec 2026 15:27:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8BADD606A686 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=aitINptD Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4bb85e07aadso146828975e9.1 for ; Tue, 01 Dec 2026 07:27:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796138843; x=1796743643; darn=vger.kernel.org; h=content-transfer-encoding:content-disposition:content-type :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=g9EsOtK6FZkC6gV8rd00/FvsyB8EgIOdF3tbQT6i/+o=; b=aitINptDz5bMF2oPkus/QpZhQtFS44l5EBFaZ0K+XPXkjW0U9ucaVwngUVpA5tr/+x O+N4OpmoGVk/HBi/Y2kBtxOcNqSOweeDwUuo0Nbw4VxFVBEY7ptmHrMGxafQMI0My5fx UgvCxSbN80raAPJbyYn2yrEZ7QH1iWeH2NdHMzb2ERR5qnyvwLQvIlgBgy/92y6q3Opx Eiz/qbEcrm4qcIwz8+szzgMd6HEqdjFOj6XVRr2pPzLb3wh5MtLIY1RZJFOWs+zhp2fB MTl4v1KLOSFjqvA96AWzQdQTxvXBd2mNYwIu2BV0/gcrtsjk+LKEQrfu+MOnkrscMxu4 sosg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796138843; x=1796743643; h=content-transfer-encoding:content-disposition:content-type :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=g9EsOtK6FZkC6gV8rd00/FvsyB8EgIOdF3tbQT6i/+o=; b=cvZBeTb7z+qUTdubQfpjd/LFloiVpti85q4q6DnKx4T593iqdhUWlYiIkE5nV9B+1y rn2fOfbn6c86FDUDUbSHG3WWrDizsykg/wPpXA8HGBWMlPBPdBKAMd4egBiNXUkp4joA SrqAyqccLHYsMwpJNA6PrWy2mgV+8og4ZDVR0IlmBUqLZ0cZesUyWxQ3ToPyOvvUGbYG X7fWNtgT6kPAvHquQiXqDNcLZk3mIEvROmP5Ado0VM8Vn4YLCWOW2zxyylTYjUMUazwL +WuQtvzqnnBxOYfnEFZiL0/R2M+csRq5X+i1XIqM9gdWjxFqXsdpFKvER8S+EMNBuyLX JINQ== X-Forwarded-Encrypted: i=1; AL+hErF4VfB6CRcxC8hklbOxXAUD/YdXlXjh17i71OJgvHslWx3iiw48+WsbPkZ6jXrsFQFSptYtj31Odkk=@vger.kernel.org X-Gm-Message-State: APuU4Z8VWVFNn8JfJHNcrkBkOS7oazmW8rkSxJfjaBYPZ4B1P5GbSABm QK69KBywTbD18kqm+RP/aVanoLAT8IBOGpMypcoHnEaOGZ74umpe2GXr X-Gm-Gg: AZFdTZdd3YVkNq1ID8y6Tn/7MuhRQzlBB4n/ByDoc564/qsUDuryDGDWU08unfhlAQk 9ws6NvBMWhES1bFRGOLhgDF+T6rRqarECOLALoVerycph9wT/8M7wP1e0paaKRyLwte5Gezf6ra r4mcCOn4rbcrf+39ydWqCYmV4UaV5ThQiyugwN5vCw52Cudgar5QRUBvuYqWHyHTSgDmVYvvnEu dF7i/Sm9DFWSBqXuU3bB6foDBof78pUEAgnpH7d0DMUQLFuSH639ICwemPEmqtd8IumWQcLTHdx +CPULWPsHeDvXg64Fq7QWcCT+WEVxk3fe1+5E+VqV/oDqDLTxzAnNChcMPdbNQ9JzScxfpTEssE +wQn+FUychtAIJRMqMebNIxx71/Jg2rfuncrM+ZyZJ5aZhUQCR2Ek+oPaj8EZNDogQSwSkDd7HW UqFc6D9zMhs0pR1aawIxg/1UAENaliSEDDHnx80NdFeRvrT6grwxrUyK34AF0wNLCLn3nVS5Lqy oefQChIbRqlgifXTbx//uAxrDVawhWouiP6ekgjkqYS8RWj5vWrBfDKGWSJNpZix66Ua3AOvRG5 LHHMjIOsMIcFPjaJRopw/v4V+wW+7IE= X-Received: by 2002:a05:600c:3ba3:b0:4bb:6118:4c9a with SMTP id 5b1f17b1804b1-4bb88819940mr872827585e9.30.1796138842849; Tue, 01 Dec 2026 07:27:22 -0800 (PST) Received: from ArchOarora ([95.179.249.152]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb8526cbd0sm1366540335e9.0.2026.12.01.07.27.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2026 07:27:22 -0800 (PST) From: Oarora Etimis To: Louis Chauvet Cc: Haneen Mohammed , Simona Vetter , Melissa Wen , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , jose.exposito89@gmail.com, Jonathan Corbet , Harry Wentland , Lucas De Marchi , Ville =?utf-8?B?U3lyasOkbMOk?= , Randy Dunlap , Nick Desaulniers , Shuah Khan , Miguel Ojeda , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Luca Ceresoli , Kory Maincent , sebastian.wick@redhat.com, victoria@system76.com, thomas.petazzoni@bootlin.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH v7 20/43] drm/vkms: Introduce configfs for plane rotation Date: Tue, 1 Dec 2026 16:27:10 +0100 Message-ID: X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261126-vkms-all-config-v7-20-21194cda2468@bootlin.com> References: <20261126-vkms-all-config-v7-0-21194cda2468@bootlin.com> <20261126-vkms-all-config-v7-20-21194cda2468@bootlin.com> X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit On Thu, Nov 26, 2026 at 12:29:03PM +0100, Louis Chauvet wrote: > To allows the userspace to test many hardware configurations, introduce a > new interface to configure the available rotation per planes. VKMS > supports any rotation and reflection, so the userspace can choose any > combination. > > The supported rotations are configured by writing a rotation bitmask to > the file `supported_rotations` and the default rotation is chosen by > writing a rotation bitmask to `default_rotation`. > > Signed-off-by: Louis Chauvet > --- > Documentation/ABI/testing/configfs-vkms | 19 ++++++++ > Documentation/gpu/vkms.rst | 7 ++- > drivers/gpu/drm/vkms/vkms_configfs.c | 84 +++++++++++++++++++++++++++++++++ > 3 files changed, 109 insertions(+), 1 deletion(-) > > diff --git a/Documentation/ABI/testing/configfs-vkms b/Documentation/ABI/testing/configfs-vkms > index 55e4183046ec..07ebb797617d 100644 > --- a/Documentation/ABI/testing/configfs-vkms > +++ b/Documentation/ABI/testing/configfs-vkms > @@ -108,6 +108,25 @@ Description: > Plane type. Possible values: 0 - overlay, 1 - primary, > 2 - cursor. > > +What: /sys/kernel/config/vkms//planes//supported_rotations > +Date: Nov 2025 > +Contact: dri-devel@lists.freedesktop.org > +Description: > + Available rotations for the plane, as a bitmask: > + 0x01 - no rotation, 0x02 - rotate 90°, 0x04 - rotate 180°, > + 0x08 - rotate 270°, 0x10 - reflect x, 0x20 - reflect y. > + The value may be written in decimal or hexadecimal (with > + a 0x prefix) and is read back as a decimal number. > + > +What: /sys/kernel/config/vkms//planes//default_rotation > +Date: Nov 2025 > +Contact: dri-devel@lists.freedesktop.org > +Description: > + Default rotation presented to userspace, using the same > + bit values as supported_rotations. The value must contain > + exactly one rotation bit; reflection bits may be set in > + addition. > + > 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 1e79e62a6bc4..610305483716 100644 > --- a/Documentation/gpu/vkms.rst > +++ b/Documentation/gpu/vkms.rst > @@ -87,10 +87,15 @@ Start by creating one or more planes:: > > sudo mkdir /config/vkms/my-vkms/planes/plane0 > > -Planes have 1 configurable attribute: > +Planes have 3 configurable attributes: > > - type: Plane type: 0 overlay, 1 primary, 2 cursor (same values as those > exposed by the "type" property of a plane) > +- supported_rotations: Available rotation for a plane, as a bitmask: 0x01 no rotation, > + 0x02 rotate 90°, 0x04 rotate 180°, 0x08 rotate 270°, 0x10 reflect x, 0x20 reflect y > + (same values as those exposed by the "rotation" property of a plane) > +- default_rotation: Default rotation presented to the userspace, same values as > + supported_rotations. > > 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 bbfc0c8a922c..5c62797627c1 100644 > --- a/drivers/gpu/drm/vkms/vkms_configfs.c > +++ b/drivers/gpu/drm/vkms/vkms_configfs.c > @@ -322,10 +322,94 @@ static ssize_t plane_type_store(struct config_item *item, const char *page, > return (ssize_t)count; > } > > +static ssize_t plane_supported_rotations_show(struct config_item *item, char *page) > +{ > + struct vkms_configfs_plane *plane = plane_item_to_vkms_configfs_plane(item); > + unsigned int plane_supported_rotations; > + > + scoped_guard(mutex, &plane->dev->config->lock) > + plane_supported_rotations = vkms_config_plane_get_supported_rotations(plane->config); > + > + return sprintf(page, "%u\n", plane_supported_rotations); > +} > + > +static ssize_t plane_supported_rotations_store(struct config_item *item, > + const char *page, size_t count) > +{ > + struct vkms_configfs_plane *plane = plane_item_to_vkms_configfs_plane(item); > + int ret; > + unsigned int val = 0; > + > + ret = kstrtouint(page, 0, &val); > + if (ret) > + return ret; > + > + /* Should be a supported value */ > + if (val & ~(DRM_MODE_ROTATE_MASK | DRM_MODE_REFLECT_MASK)) > + return -EINVAL; > + /* Should at least provide one rotation */ > + if (!(val & DRM_MODE_ROTATE_MASK)) > + return -EINVAL; > + > + scoped_guard(mutex, &plane->dev->config->lock) { > + if (plane->dev->enabled) > + return -EBUSY; > + > + vkms_config_plane_set_supported_rotations(plane->config, val); > + } > + > + return count; > +} > + > +static ssize_t plane_default_rotation_show(struct config_item *item, char *page) > +{ > + struct vkms_configfs_plane *plane = plane_item_to_vkms_configfs_plane(item); > + unsigned int plane_default_rotation; > + > + scoped_guard(mutex, &plane->dev->config->lock) { > + plane_default_rotation = vkms_config_plane_get_default_rotation(plane->config); > + } > + > + return sprintf(page, "%u\n", plane_default_rotation); > +} > + > +static ssize_t plane_default_rotation_store(struct config_item *item, > + const char *page, size_t count) > +{ > + struct vkms_configfs_plane *plane = plane_item_to_vkms_configfs_plane(item); > + int ret; > + unsigned int val = 0; > + > + ret = kstrtouint(page, 0, &val); > + if (ret) > + return ret; > + > + /* Should be a supported value */ > + if (val & ~(DRM_MODE_ROTATE_MASK | DRM_MODE_REFLECT_MASK)) > + return -EINVAL; > + > + /* Should contain exactly one rotation */ > + if (!is_power_of_2(val & DRM_MODE_ROTATE_MASK)) > + return -EINVAL; > + > + scoped_guard(mutex, &plane->dev->config->lock) { > + if (plane->dev->enabled) > + return -EBUSY; > + > + vkms_config_plane_set_default_rotation(plane->config, val); > + } > + > + return count; > +} > + > CONFIGFS_ATTR(plane_, type); > +CONFIGFS_ATTR(plane_, supported_rotations); > +CONFIGFS_ATTR(plane_, default_rotation); > > static struct configfs_attribute *plane_item_attrs[] = { > &plane_attr_type, > + &plane_attr_supported_rotations, > + &plane_attr_default_rotation, > NULL, > }; > > > -- > 2.56.0 > Reviewed-by: Oarora Etimis