From: Louis Chauvet <louis.chauvet@bootlin.com>
To: "Maíra Canal" <mairacanal@riseup.net>,
"Haneen Mohammed" <hamohammed.sa@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Melissa Wen" <melissa.srw@gmail.com>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"David Airlie" <airlied@gmail.com>
Cc: arthurgrillo@riseup.net, jeremie.dautheribes@bootlin.com,
miquel.raynal@bootlin.com, thomas.petazzoni@bootlin.com,
seanpaul@google.com, nicolejadeyee@google.com,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
"Louis Chauvet" <louis.chauvet@bootlin.com>,
"José Expósito" <jose.exposito89@gmail.com>
Subject: [PATCH v3 03/16] drm/vkms: Move default_config creation to its own function
Date: Tue, 21 Jan 2025 11:55:27 +0100 [thread overview]
Message-ID: <20250121-google-remove-crtc-index-from-parameter-v3-3-cac00a3c3544@bootlin.com> (raw)
In-Reply-To: <20250121-google-remove-crtc-index-from-parameter-v3-0-cac00a3c3544@bootlin.com>
Extract the initialization of the default configuration to a function.
Refactor, no functional changes.
Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
[Changes: Cherry pick and solve conflicts]
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
---
drivers/gpu/drm/vkms/vkms_config.c | 15 +++++++++++++++
drivers/gpu/drm/vkms/vkms_config.h | 9 +++++++++
drivers/gpu/drm/vkms/vkms_drv.c | 7 +------
3 files changed, 25 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/vkms/vkms_config.c b/drivers/gpu/drm/vkms/vkms_config.c
index 8d5c1429e6e196ef46c95c6ae73330bc4be2be39..e7c7f46303e8ce4c9de68878668b855ac0fc5d2e 100644
--- a/drivers/gpu/drm/vkms/vkms_config.c
+++ b/drivers/gpu/drm/vkms/vkms_config.c
@@ -18,6 +18,21 @@ struct vkms_config *vkms_config_create(void)
}
EXPORT_SYMBOL_IF_KUNIT(vkms_config_create);
+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 df571dd67352ca90fb47bd937fb9f11ceb95fcb2..2afb795586c6924a46dd4ba777bf22a4f51cddda 100644
--- a/drivers/gpu/drm/vkms/vkms_config.h
+++ b/drivers/gpu/drm/vkms/vkms_config.h
@@ -42,4 +42,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 6b0e5fd0e26f04359b0d10252496c52b15d83896..4440549c3084a341d03ec66119ba7998012bd662 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.c
+++ b/drivers/gpu/drm/vkms/vkms_drv.c
@@ -213,15 +213,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.47.1
next prev parent reply other threads:[~2025-01-21 10:55 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-21 10:55 [PATCH v3 00/16] drm/vkms: Introduce detailed configuration Louis Chauvet
2025-01-21 10:55 ` [PATCH v3 01/16] drm/vkms: Extract vkms_config header Louis Chauvet
2025-01-21 10:55 ` [PATCH v3 02/16] drm/vkms: Add a validation function for vkms configuration Louis Chauvet
2025-01-21 10:55 ` Louis Chauvet [this message]
2025-01-21 10:55 ` [PATCH v3 04/16] drm/vkms: Introduce config for plane Louis Chauvet
2025-01-21 10:55 ` [PATCH v3 05/16] drm/vkms: Introduce config for plane name Louis Chauvet
2025-01-21 10:55 ` [PATCH v3 06/16] drm/vkms: Introduce config for plane rotation Louis Chauvet
2025-01-21 10:55 ` [PATCH v3 07/16] drm/vkms: Introduce config for CRTCs and encoders Louis Chauvet
2025-01-21 10:55 ` [PATCH v3 08/16] drm/vkms: Introduce config for encoder name Louis Chauvet
2025-01-21 10:55 ` [PATCH v3 09/16] drm/vkms: Introduce config for CRTC name Louis Chauvet
2025-01-21 10:55 ` [PATCH v3 10/16] drm/vkms: Add test for config structure Louis Chauvet
2025-01-21 10:55 ` [PATCH v3 11/16] drm/vkms: Introduce config for connector Louis Chauvet
2025-01-21 10:55 ` [PATCH v3 12/16] drm/vkms: Introduce config for connector type Louis Chauvet
2025-01-21 10:55 ` [PATCH v3 13/16] drm/vkms: Introduce config for plane format Louis Chauvet
2025-01-21 10:55 ` [PATCH v3 14/16] drm/vkms: Introduce config for connector status Louis Chauvet
2025-01-21 10:55 ` [PATCH v3 15/16] drm/vkms: Introduce config for connector EDID Louis Chauvet
2025-01-21 10:55 ` [PATCH v3 16/16] drm/vkms: Introduce config for encoder type Louis Chauvet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250121-google-remove-crtc-index-from-parameter-v3-3-cac00a3c3544@bootlin.com \
--to=louis.chauvet@bootlin.com \
--cc=airlied@gmail.com \
--cc=arthurgrillo@riseup.net \
--cc=dri-devel@lists.freedesktop.org \
--cc=hamohammed.sa@gmail.com \
--cc=jeremie.dautheribes@bootlin.com \
--cc=jose.exposito89@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mairacanal@riseup.net \
--cc=melissa.srw@gmail.com \
--cc=miquel.raynal@bootlin.com \
--cc=mripard@kernel.org \
--cc=nicolejadeyee@google.com \
--cc=seanpaul@google.com \
--cc=simona@ffwll.ch \
--cc=thomas.petazzoni@bootlin.com \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®