[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240814-google-remove-crtc-index-from-parameter-v1-8-6e179abf9fd4@bootlin.com>
Date: Wed, 14 Aug 2024 16:36:30 +0200
From: Louis Chauvet <louis.chauvet@...tlin.com>
To: Rodrigo Siqueira <rodrigosiqueiramelo@...il.com>,
Melissa Wen <melissa.srw@...il.com>,
MaĆra Canal <mairacanal@...eup.net>,
Haneen Mohammed <hamohammed.sa@...il.com>, Daniel Vetter <daniel@...ll.ch>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>
Cc: dri-devel@...ts.freedesktop.org, arthurgrillo@...eup.net,
linux-kernel@...r.kernel.org, jeremie.dautheribes@...tlin.com,
miquel.raynal@...tlin.com, thomas.petazzoni@...tlin.com,
seanpaul@...gle.com, nicolejadeyee@...gle.com,
Louis Chauvet <louis.chauvet@...tlin.com>
Subject: [PATCH RFC 08/15] drm/vkms: Introduce plane rotation configuration
VKMS driver supports all the rotation on planes, but for testing it can be
useful to only advertise few of them. This new configuration interface
will allow configuring the rotation per planes.
Signed-off-by: Louis Chauvet <louis.chauvet@...tlin.com>
---
drivers/gpu/drm/vkms/vkms_config.c | 9 +++++++++
drivers/gpu/drm/vkms/vkms_config.h | 4 ++++
drivers/gpu/drm/vkms/vkms_plane.c | 5 +++--
3 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/vkms/vkms_config.c b/drivers/gpu/drm/vkms/vkms_config.c
index b8e235a22e90..2a24da9c0fc9 100644
--- a/drivers/gpu/drm/vkms/vkms_config.c
+++ b/drivers/gpu/drm/vkms/vkms_config.c
@@ -80,6 +80,8 @@ struct vkms_config_plane *vkms_config_create_plane(struct vkms_config *vkms_conf
return NULL;
vkms_config_overlay->type = DRM_PLANE_TYPE_OVERLAY;
+ vkms_config_overlay->supported_rotations = DRM_MODE_ROTATE_MASK | DRM_MODE_REFLECT_MASK;
+ vkms_config_overlay->default_rotation = DRM_MODE_ROTATE_0;
list_add(&vkms_config_overlay->link, &vkms_config->planes);
@@ -114,6 +116,11 @@ bool vkms_config_is_valid(struct vkms_config *config)
bool has_primary = false;
list_for_each_entry(config_plane, &config->planes, link) {
+ // Default rotation not in supported rotations
+ if ((config_plane->default_rotation & config_plane->supported_rotations) !=
+ config_plane->default_rotation)
+ return false;
+
if (config_plane->type == DRM_PLANE_TYPE_PRIMARY) {
// Multiple primary planes for only one CRTC
if (has_primary)
@@ -146,6 +153,8 @@ static int vkms_config_show(struct seq_file *m, void *data)
seq_puts(m, "plane:\n");
seq_printf(m, "\tname: %s\n", config_plane->name);
seq_printf(m, "\ttype: %d\n", config_plane->type);
+ seq_printf(m, "\tsupported rotations: 0x%x\n", config_plane->supported_rotations);
+ seq_printf(m, "\tdefault rotation: 0x%x\n", config_plane->default_rotation);
}
return 0;
diff --git a/drivers/gpu/drm/vkms/vkms_config.h b/drivers/gpu/drm/vkms/vkms_config.h
index 792c5e904aa1..77a72a3a637c 100644
--- a/drivers/gpu/drm/vkms/vkms_config.h
+++ b/drivers/gpu/drm/vkms/vkms_config.h
@@ -28,6 +28,8 @@ struct vkms_config {
* @name: Name of the plane
* @type: Type of the plane. The creator of configuration needs to ensures that at least one
* plane is primary.
+ * @default_rotation: Default rotation that should be used by this plane
+ * @supported_rotation: Rotation that this plane will support
* @plane: Internal usage. This pointer should never be considered as valid. It can be used to
* store a temporary reference to a vkms plane during device creation. This pointer is
* not managed by the configuration and must be managed by other means.
@@ -37,6 +39,8 @@ struct vkms_config_plane {
char *name;
enum drm_plane_type type;
+ unsigned int default_rotation;
+ unsigned int supported_rotations;
/* Internal usage */
struct vkms_plane *plane;
diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c
index d2b1b524499f..3a2b8b0b5980 100644
--- a/drivers/gpu/drm/vkms/vkms_plane.c
+++ b/drivers/gpu/drm/vkms/vkms_plane.c
@@ -237,8 +237,9 @@ struct vkms_plane *vkms_plane_init(struct vkms_device *vkmsdev,
drm_plane_helper_add(&plane->base, &vkms_plane_helper_funcs);
- drm_plane_create_rotation_property(&plane->base, DRM_MODE_ROTATE_0,
- DRM_MODE_ROTATE_MASK | DRM_MODE_REFLECT_MASK);
+ drm_plane_create_rotation_property(&plane->base,
+ config->default_rotation,
+ config->supported_rotations);
drm_plane_create_color_properties(&plane->base,
BIT(DRM_COLOR_YCBCR_BT601) |
--
2.44.2
Powered by blists - more mailing lists