[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240814-google-remove-crtc-index-from-parameter-v1-5-6e179abf9fd4@bootlin.com>
Date: Wed, 14 Aug 2024 16:36:27 +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>,
José Expósito <jose.exposito89@...il.com>
Subject: [PATCH RFC 05/15] drm/vkms: Move default_config creation to its
own function
Extract the initialization of the default configuration to a function.
Refactor, no functional changes.
Signed-off-by: Louis Chauvet <louis.chauvet@...tlin.com>
[Changes: Cherry pick and solve conflicts]
Signed-off-by: José Expósito <jose.exposito89@...il.com>
---
drivers/gpu/drm/vkms/vkms_config.c | 16 ++++++++++++++++
drivers/gpu/drm/vkms/vkms_config.h | 9 +++++++++
drivers/gpu/drm/vkms/vkms_drv.c | 7 +------
3 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/vkms/vkms_config.c b/drivers/gpu/drm/vkms/vkms_config.c
index d8348af9587e..27b49a2ad9c8 100644
--- a/drivers/gpu/drm/vkms/vkms_config.c
+++ b/drivers/gpu/drm/vkms/vkms_config.c
@@ -16,6 +16,22 @@ struct vkms_config *vkms_config_create(void)
return config;
}
+struct vkms_config *vkms_config_alloc_default(bool enable_writeback, bool enable_overlay,
+ bool enable_cursor)
+{
+ struct vkms_config *vkms_config = vkms_config_create();
+
+ if (IS_ERR(vkms_config))
+ return vkms_config;
+
+ vkms_config->writeback = enable_writeback;
+ vkms_config->overlay = enable_overlay;
+ vkms_config->cursor = enable_cursor;
+
+ return vkms_config;
+}
+
+
void vkms_config_destroy(struct vkms_config *config)
{
kfree(config);
diff --git a/drivers/gpu/drm/vkms/vkms_config.h b/drivers/gpu/drm/vkms/vkms_config.h
index 363f5bc8f64b..50c3b021a66b 100644
--- a/drivers/gpu/drm/vkms/vkms_config.h
+++ b/drivers/gpu/drm/vkms/vkms_config.h
@@ -43,4 +43,13 @@ void vkms_config_destroy(struct vkms_config *config);
bool vkms_config_is_valid(struct vkms_config *vkms_config);
+/**
+ * vkms_config_alloc_default() - Allocate the configuration for the default device
+ * @enable_writeback: Enable the writeback connector for this configuration
+ * @enable_overlay: Create some overlay planes
+ * @enable_cursor: Create a cursor plane
+ */
+struct vkms_config *vkms_config_alloc_default(bool enable_writeback, bool enable_overlay,
+ bool enable_cursor);
+
#endif //_VKMS_CONFIG_H
diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
index dbdb1f565a8f..af237daa3c5c 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.c
+++ b/drivers/gpu/drm/vkms/vkms_drv.c
@@ -328,15 +328,10 @@ static int vkms_create(struct vkms_config *config)
static int __init vkms_init(void)
{
int ret;
-
- default_config = vkms_config_create();
+ default_config = vkms_config_alloc_default(enable_writeback, enable_overlay, enable_cursor);
if (IS_ERR(default_config))
return PTR_ERR(default_config);
- default_config->cursor = enable_cursor;
- default_config->writeback = enable_writeback;
- default_config->overlay = enable_overlay;
-
ret = vkms_create(default_config);
if (ret)
vkms_config_destroy(default_config);
--
2.44.2
Powered by blists - more mailing lists