Commit 6f2bb119 authored by Thomas Zimmermann's avatar Thomas Zimmermann

drm/qxl: Use simple encoder

The qxl driver uses an empty implementation for its encoder. Replace
the code with the generic simple encoder.

v4:
	* handle errors returned from drm_simple_encoder_init()
v2:
	* rebase onto new simple-encoder interface
Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
Acked-by: default avatarGerd Hoffmann <kraxel@redhat.com>
Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20200228081828.18463-5-tzimmermann@suse.de
parent 03e44ad1
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_plane_helper.h> #include <drm/drm_plane_helper.h>
#include <drm/drm_probe_helper.h> #include <drm/drm_probe_helper.h>
#include <drm/drm_simple_kms_helper.h>
#include "qxl_drv.h" #include "qxl_drv.h"
#include "qxl_object.h" #include "qxl_object.h"
...@@ -1007,9 +1008,6 @@ static struct drm_encoder *qxl_best_encoder(struct drm_connector *connector) ...@@ -1007,9 +1008,6 @@ static struct drm_encoder *qxl_best_encoder(struct drm_connector *connector)
return &qxl_output->enc; return &qxl_output->enc;
} }
static const struct drm_encoder_helper_funcs qxl_enc_helper_funcs = {
};
static const struct drm_connector_helper_funcs qxl_connector_helper_funcs = { static const struct drm_connector_helper_funcs qxl_connector_helper_funcs = {
.get_modes = qxl_conn_get_modes, .get_modes = qxl_conn_get_modes,
.mode_valid = qxl_conn_mode_valid, .mode_valid = qxl_conn_mode_valid,
...@@ -1059,15 +1057,6 @@ static const struct drm_connector_funcs qxl_connector_funcs = { ...@@ -1059,15 +1057,6 @@ static const struct drm_connector_funcs qxl_connector_funcs = {
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
}; };
static void qxl_enc_destroy(struct drm_encoder *encoder)
{
drm_encoder_cleanup(encoder);
}
static const struct drm_encoder_funcs qxl_enc_funcs = {
.destroy = qxl_enc_destroy,
};
static int qxl_mode_create_hotplug_mode_update_property(struct qxl_device *qdev) static int qxl_mode_create_hotplug_mode_update_property(struct qxl_device *qdev)
{ {
if (qdev->hotplug_mode_update_property) if (qdev->hotplug_mode_update_property)
...@@ -1086,6 +1075,7 @@ static int qdev_output_init(struct drm_device *dev, int num_output) ...@@ -1086,6 +1075,7 @@ static int qdev_output_init(struct drm_device *dev, int num_output)
struct qxl_output *qxl_output; struct qxl_output *qxl_output;
struct drm_connector *connector; struct drm_connector *connector;
struct drm_encoder *encoder; struct drm_encoder *encoder;
int ret;
qxl_output = kzalloc(sizeof(struct qxl_output), GFP_KERNEL); qxl_output = kzalloc(sizeof(struct qxl_output), GFP_KERNEL);
if (!qxl_output) if (!qxl_output)
...@@ -1098,15 +1088,19 @@ static int qdev_output_init(struct drm_device *dev, int num_output) ...@@ -1098,15 +1088,19 @@ static int qdev_output_init(struct drm_device *dev, int num_output)
drm_connector_init(dev, &qxl_output->base, drm_connector_init(dev, &qxl_output->base,
&qxl_connector_funcs, DRM_MODE_CONNECTOR_VIRTUAL); &qxl_connector_funcs, DRM_MODE_CONNECTOR_VIRTUAL);
drm_encoder_init(dev, &qxl_output->enc, &qxl_enc_funcs, ret = drm_simple_encoder_init(dev, &qxl_output->enc,
DRM_MODE_ENCODER_VIRTUAL, NULL); DRM_MODE_ENCODER_VIRTUAL);
if (ret) {
drm_err(dev, "drm_simple_encoder_init() failed, error %d\n",
ret);
goto err_drm_connector_cleanup;
}
/* we get HPD via client monitors config */ /* we get HPD via client monitors config */
connector->polled = DRM_CONNECTOR_POLL_HPD; connector->polled = DRM_CONNECTOR_POLL_HPD;
encoder->possible_crtcs = 1 << num_output; encoder->possible_crtcs = 1 << num_output;
drm_connector_attach_encoder(&qxl_output->base, drm_connector_attach_encoder(&qxl_output->base,
&qxl_output->enc); &qxl_output->enc);
drm_encoder_helper_add(encoder, &qxl_enc_helper_funcs);
drm_connector_helper_add(connector, &qxl_connector_helper_funcs); drm_connector_helper_add(connector, &qxl_connector_helper_funcs);
drm_object_attach_property(&connector->base, drm_object_attach_property(&connector->base,
...@@ -1116,6 +1110,11 @@ static int qdev_output_init(struct drm_device *dev, int num_output) ...@@ -1116,6 +1110,11 @@ static int qdev_output_init(struct drm_device *dev, int num_output)
drm_object_attach_property(&connector->base, drm_object_attach_property(&connector->base,
dev->mode_config.suggested_y_property, 0); dev->mode_config.suggested_y_property, 0);
return 0; return 0;
err_drm_connector_cleanup:
drm_connector_cleanup(&qxl_output->base);
kfree(qxl_output);
return ret;
} }
static struct drm_framebuffer * static struct drm_framebuffer *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment