diff mbox series

[04/23] drm/exynos: add exynos_drm_crtc_init function

Message ID 20190301122055.7135-5-a.hajda@samsung.com (mailing list archive)
State Not Applicable
Headers show
Series drm/exynos: add support for GSCALER planes on Exynos5433 | expand

Commit Message

Andrzej Hajda March 1, 2019, 12:20 p.m. UTC
Since exynos_drm_crtc is a struct which maps 1:1 to underlying device it
is better to put it directly into device's context instead of allocating
it separately. Another benefit is possibility of initialisation of
its fields directly, without expanding exynos_drm_crtc_create which is
already overloaded with number of arguments.
As a first step of the transition initialisation function should be
created.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 10 ++++++++++
 drivers/gpu/drm/exynos/exynos_drm_crtc.h |  2 ++
 2 files changed, 12 insertions(+)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 1eebfa3fa8da..4ff1e0ff2255 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -172,6 +172,16 @@  static const struct drm_crtc_funcs exynos_crtc_funcs = {
 	.disable_vblank = exynos_drm_crtc_disable_vblank,
 };
 
+int exynos_drm_crtc_init(struct exynos_drm_crtc *exynos_crtc,
+			 struct drm_device *drm_dev)
+{
+	struct drm_crtc *crtc = &exynos_crtc->base;
+
+	drm_crtc_helper_add(crtc, &exynos_crtc_helper_funcs);
+	return drm_crtc_init_with_planes(drm_dev, crtc, NULL, NULL,
+					 &exynos_crtc_funcs, NULL);
+}
+
 struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev,
 					struct drm_plane *plane,
 					enum exynos_drm_output_type type,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.h b/drivers/gpu/drm/exynos/exynos_drm_crtc.h
index dec446109e6c..9e35a9e02332 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.h
@@ -18,6 +18,8 @@ 
 
 #include "exynos_drm_drv.h"
 
+int exynos_drm_crtc_init(struct exynos_drm_crtc *exynos_crtc,
+			 struct drm_device *drm_dev);
 struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev,
 					struct drm_plane *plane,
 					enum exynos_drm_output_type out_type,