[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250117-b4-vkms-allocated-v4-2-8ec8fd21aaf6@bootlin.com>
Date: Fri, 17 Jan 2025 10:04:28 +0100
From: Louis Chauvet <louis.chauvet@...tlin.com>
To: Rodrigo Siqueira <rodrigosiqueiramelo@...il.com>,
Maíra Canal <mairacanal@...eup.net>,
Haneen Mohammed <hamohammed.sa@...il.com>,
Melissa Wen <melissa.srw@...il.com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
Simona Vetter <simona.vetter@...ll.ch>
Cc: thomas.petazzoni@...tlin.com, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org, Louis Chauvet <louis.chauvet@...tlin.com>,
José Expósito <jose.exposito89@...il.com>
Subject: [PATCH v4 2/3] drm/vkms: Switch to dynamic allocation for encoder
A specific allocation for the encoder is not strictly necessary at this
point, but in order to implement dynamic configuration of VKMS (configFS),
it will be easier to have one allocation per encoder.
Reviewed-by: Maxime Ripard <mripard@...nel.org>
Reviewed-by: José Expósito <jose.exposito89@...il.com>
Signed-off-by: Louis Chauvet <louis.chauvet@...tlin.com>
---
drivers/gpu/drm/vkms/vkms_drv.h | 1 -
drivers/gpu/drm/vkms/vkms_output.c | 7 ++++++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
index afa625457b6156135d2b07cbd5b5e3f3c7f8f33a..333983bcf8d46ef85101e7c344e256df57551b78 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.h
+++ b/drivers/gpu/drm/vkms/vkms_drv.h
@@ -176,7 +176,6 @@ struct vkms_crtc_state {
*/
struct vkms_output {
struct drm_crtc crtc;
- struct drm_encoder encoder;
struct drm_writeback_connector wb_connector;
struct drm_encoder wb_encoder;
struct hrtimer vblank_hrtimer;
diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c
index a41d7a29a377c14a3281968dfeb8f2b43000b120..21ca975e424d148b0669b87784d86f5da2a8b333 100644
--- a/drivers/gpu/drm/vkms/vkms_output.c
+++ b/drivers/gpu/drm/vkms/vkms_output.c
@@ -33,7 +33,7 @@ int vkms_output_init(struct vkms_device *vkmsdev)
struct vkms_output *output = &vkmsdev->output;
struct drm_device *dev = &vkmsdev->drm;
struct drm_connector *connector;
- struct drm_encoder *encoder = &output->encoder;
+ struct drm_encoder *encoder;
struct drm_crtc *crtc = &output->crtc;
struct vkms_plane *primary, *overlay, *cursor = NULL;
int ret;
@@ -86,6 +86,11 @@ int vkms_output_init(struct vkms_device *vkmsdev)
drm_connector_helper_add(connector, &vkms_conn_helper_funcs);
+ encoder = drmm_kzalloc(dev, sizeof(*encoder), GFP_KERNEL);
+ if (!encoder) {
+ DRM_ERROR("Failed to allocate encoder\n");
+ return -ENOMEM;
+ }
ret = drmm_encoder_init(dev, encoder, NULL,
DRM_MODE_ENCODER_VIRTUAL, NULL);
if (ret) {
--
2.47.1
Powered by blists - more mailing lists