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@kernel.org>
Reviewed-by: José Expósito <jose.exposito89@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250117-b4-vkms-allocated-v4-2-8ec8fd21aaf6@bootlin.com
Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
This commit is contained in:
Louis Chauvet
2025-01-17 10:04:28 +01:00
parent b0a76faea6
commit 45a4778415
2 changed files with 6 additions and 2 deletions

View File

@@ -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;

View File

@@ -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) {