summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/vkms/vkms_crtc.c
diff options
context:
space:
mode:
authorRodrigo Siqueira <rodrigosiqueiramelo@gmail.com>2018-05-17 01:56:21 +0200
committerGustavo Padovan <gustavo.padovan@collabora.com>2018-07-05 14:46:23 +0200
commit854502fa0a38dc77c9e855c95d239a8fd50a9b13 (patch)
tree2f5c7eda6ce367710a9e37a66057f05aa051d2cf /drivers/gpu/drm/vkms/vkms_crtc.c
parentdrm/vkms: Add mode_config initialization (diff)
downloadlinux-854502fa0a38dc77c9e855c95d239a8fd50a9b13.tar.xz
linux-854502fa0a38dc77c9e855c95d239a8fd50a9b13.zip
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_crtc.c')
-rw-r--r--drivers/gpu/drm/vkms/vkms_crtc.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
new file mode 100644
index 000000000000..bf76cd39ece7
--- /dev/null
+++ b/drivers/gpu/drm/vkms/vkms_crtc.c
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include "vkms_drv.h"
+#include <drm/drm_atomic_helper.h>
+#include <drm/drm_crtc_helper.h>
+
+static const struct drm_crtc_funcs vkms_crtc_funcs = {
+ .set_config = drm_atomic_helper_set_config,
+ .destroy = drm_crtc_cleanup,
+ .page_flip = drm_atomic_helper_page_flip,
+ .reset = drm_atomic_helper_crtc_reset,
+ .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
+ .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
+};
+
+int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
+ struct drm_plane *primary, struct drm_plane *cursor)
+{
+ int ret;
+
+ ret = drm_crtc_init_with_planes(dev, crtc, primary, cursor,
+ &vkms_crtc_funcs, NULL);
+ if (ret) {
+ DRM_ERROR("Failed to init CRTC\n");
+ return ret;
+ }
+
+ return ret;
+}