summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/vkms/vkms_drv.c
diff options
context:
space:
mode:
authorRodrigo Siqueira <rodrigosiqueiramelo@gmail.com>2018-05-17 02:56:21 +0300
committerGustavo Padovan <gustavo.padovan@collabora.com>2018-07-05 15:46:23 +0300
commit854502fa0a38dc77c9e855c95d239a8fd50a9b13 (patch)
tree2f5c7eda6ce367710a9e37a66057f05aa051d2cf /drivers/gpu/drm/vkms/vkms_drv.c
parentc04372ea4abd83ec6c86083f2afe9322515ee293 (diff)
downloadlinux-854502fa0a38dc77c9e855c95d239a8fd50a9b13.tar.xz
drm/vkms: Add basic CRTC initialization
This commit adds the essential infrastructure for around CRTCs which is composed of: a new data struct for output data information, a function for creating planes, and a simple encoder attached to the connector. Finally, due to the introduction of a new initialization function, connectors were moved from vkms_drv.c to vkms_display.c. Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> Reviewed-by: Haneen Mohammed <hamohammed.sa@gmail.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com> Link: https://patchwork.freedesktop.org/patch/msgid/b6e27bc6a54f5cb340658fa5969f7b48fbfbf1b7.1526514457.git.rodrigosiqueiramelo@gmail.com
Diffstat (limited to 'drivers/gpu/drm/vkms/vkms_drv.c')
-rw-r--r--drivers/gpu/drm/vkms/vkms_drv.c60
1 files changed, 17 insertions, 43 deletions
diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
index aec3f180f96d..070613e32934 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.c
+++ b/drivers/gpu/drm/vkms/vkms_drv.c
@@ -6,7 +6,6 @@
*/
#include <linux/module.h>
-#include <drm/drmP.h>
#include <drm/drm_gem.h>
#include <drm/drm_crtc_helper.h>
#include <drm/drm_atomic_helper.h>
@@ -59,25 +58,24 @@ static struct drm_driver vkms_driver = {
.minor = DRIVER_MINOR,
};
-static const u32 vkms_formats[] = {
- DRM_FORMAT_XRGB8888,
+static const struct drm_mode_config_funcs vkms_mode_funcs = {
+ .atomic_check = drm_atomic_helper_check,
+ .atomic_commit = drm_atomic_helper_commit,
};
-static void vkms_connector_destroy(struct drm_connector *connector)
+static int vkms_modeset_init(struct vkms_device *vkmsdev)
{
- drm_connector_unregister(connector);
- drm_connector_cleanup(connector);
-}
+ struct drm_device *dev = &vkmsdev->drm;
-static const struct drm_connector_funcs vkms_connector_funcs = {
- .fill_modes = drm_helper_probe_single_connector_modes,
- .destroy = vkms_connector_destroy,
-};
+ drm_mode_config_init(dev);
+ dev->mode_config.funcs = &vkms_mode_funcs;
+ dev->mode_config.min_width = XRES_MIN;
+ dev->mode_config.min_height = YRES_MIN;
+ dev->mode_config.max_width = XRES_MAX;
+ dev->mode_config.max_height = YRES_MAX;
-static const struct drm_mode_config_funcs vkms_mode_funcs = {
- .atomic_check = drm_atomic_helper_check,
- .atomic_commit = drm_atomic_helper_commit,
-};
+ return vkms_output_init(vkmsdev);
+}
static int __init vkms_init(void)
{
@@ -98,48 +96,24 @@ static int __init vkms_init(void)
goto out_fini;
}
- drm_mode_config_init(&vkms_device->drm);
- vkms_device->drm.mode_config.funcs = &vkms_mode_funcs;
- vkms_device->drm.mode_config.min_width = XRES_MIN;
- vkms_device->drm.mode_config.min_height = YRES_MIN;
- vkms_device->drm.mode_config.max_width = XRES_MAX;
- vkms_device->drm.mode_config.max_height = YRES_MAX;
-
- ret = drm_connector_init(&vkms_device->drm, &vkms_device->connector,
- &vkms_connector_funcs,
- DRM_MODE_CONNECTOR_VIRTUAL);
- if (ret < 0) {
- DRM_ERROR("Failed to init connector\n");
- goto out_unregister;
- }
-
- ret = drm_simple_display_pipe_init(&vkms_device->drm,
- &vkms_device->pipe,
- NULL,
- vkms_formats,
- ARRAY_SIZE(vkms_formats),
- NULL,
- &vkms_device->connector);
- if (ret < 0) {
- DRM_ERROR("Cannot setup simple display pipe\n");
+ ret = vkms_modeset_init(vkms_device);
+ if (ret)
goto out_unregister;
- }
ret = drm_dev_register(&vkms_device->drm, 0);
if (ret)
goto out_unregister;
- drm_connector_register(&vkms_device->connector);
-
return 0;
out_unregister:
platform_device_unregister(vkms_device->platform);
+
out_fini:
drm_dev_fini(&vkms_device->drm);
+
out_free:
kfree(vkms_device);
-
return ret;
}