Unverified Commit 16d22ba2 authored by Louis Chauvet's avatar Louis Chauvet
Browse files

drm/vkms: Switch to managed for encoder



The current VKMS driver uses non-managed function to create encoders. It
is not an issue yet, but in order to support multiple devices easily,
convert this code to use drm and device managed helpers.

Reviewed-by: default avatarMaxime Ripard <mripard@kernel.org>
Reviewed-by: default avatarMaíra Canal <mcanal@igalia.com>
Reviewed-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarJosé Expósito <jose.exposito89@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250116-google-vkms-managed-v9-2-3e4ae1bd05a0@bootlin.com


Signed-off-by: default avatarLouis Chauvet <louis.chauvet@bootlin.com>
parent 0a3f3f7c
Loading
Loading
Loading
Loading
+3 −9
Original line number Diff line number Diff line
@@ -13,10 +13,6 @@ static const struct drm_connector_funcs vkms_connector_funcs = {
	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
};

static const struct drm_encoder_funcs vkms_encoder_funcs = {
	.destroy = drm_encoder_cleanup,
};

static int vkms_conn_get_modes(struct drm_connector *connector)
{
	int count;
@@ -84,7 +80,7 @@ int vkms_output_init(struct vkms_device *vkmsdev)

	drm_connector_helper_add(connector, &vkms_conn_helper_funcs);

	ret = drm_encoder_init(dev, encoder, &vkms_encoder_funcs,
	ret = drmm_encoder_init(dev, encoder, NULL,
				DRM_MODE_ENCODER_VIRTUAL, NULL);
	if (ret) {
		DRM_ERROR("Failed to init encoder\n");
@@ -95,7 +91,7 @@ int vkms_output_init(struct vkms_device *vkmsdev)
	ret = drm_connector_attach_encoder(connector, encoder);
	if (ret) {
		DRM_ERROR("Failed to attach connector to encoder\n");
		goto err_attach;
		return ret;
	}

	if (vkmsdev->config->writeback) {
@@ -108,7 +104,5 @@ int vkms_output_init(struct vkms_device *vkmsdev)

	return 0;

err_attach:
	drm_encoder_cleanup(encoder);
	return ret;
}