[PATCH 13/23] drm/exynos: set primary and cursor planes in exynos_drm_crtc_init

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



exynos_drm_crtc_init has all information necessary to discover primary
and cursor planes. Let's move logic for setting these planes into this
function.

Signed-off-by: Andrzej Hajda <a.hajda@xxxxxxxxxxx>
---
 drivers/gpu/drm/exynos/exynos5433_drm_decon.c |  3 ---
 drivers/gpu/drm/exynos/exynos7_drm_decon.c    |  1 -
 drivers/gpu/drm/exynos/exynos_drm_crtc.c      | 12 +++++++++++-
 drivers/gpu/drm/exynos/exynos_drm_drv.h       |  2 --
 drivers/gpu/drm/exynos/exynos_drm_fimd.c      |  1 -
 drivers/gpu/drm/exynos/exynos_drm_vidi.c      |  1 -
 drivers/gpu/drm/exynos/exynos_mixer.c         |  1 -
 7 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
index 663446ca2d09..958972e3ee1e 100644
--- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
@@ -30,8 +30,6 @@
 #define DSD_CFG_MUX_TE_UNMASK_GLOBAL BIT(13)
 
 #define WINDOWS_NR	5
-#define PRIMARY_WIN	2
-#define CURSON_WIN	4
 
 #define MIN_FB_WIDTH_FOR_16WORD_BURST	128
 
@@ -625,7 +623,6 @@ static int decon_bind(struct device *dev, struct device *master, void *data)
 	ret = exynos_drm_crtc_init(&ctx->crtc, drm_dev);
 	if (ret)
 		return ret;
-	ctx->crtc.base.primary = &ctx->planes[PRIMARY_WIN].base;
 
 	decon_clear_channels(&ctx->crtc);
 
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index b6ad2faed159..3d8c96f0b02a 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -635,7 +635,6 @@ static int decon_bind(struct device *dev, struct device *master, void *data)
 		decon_ctx_remove(ctx);
 		return ret;
 	}
-	ctx->crtc.base.primary = &ctx->planes[DEFAULT_WIN].base;
 
 	if (ctx->encoder)
 		exynos_dpi_bind(drm_dev, ctx->encoder);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 72e224e80565..303df018f0a1 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -176,9 +176,19 @@ int exynos_drm_crtc_init(struct exynos_drm_crtc *exynos_crtc,
 			 struct drm_device *drm_dev)
 {
 	struct drm_crtc *crtc = &exynos_crtc->base;
+	struct drm_plane *primary = NULL, *cursor = NULL, *plane;
+
+	drm_for_each_plane(plane, drm_dev) {
+		if (plane->possible_crtcs != BIT(drm_dev->mode_config.num_crtc))
+			continue;
+		if (!primary && plane->type == DRM_PLANE_TYPE_PRIMARY)
+			primary = plane;
+		if (!cursor && plane->type == DRM_PLANE_TYPE_CURSOR)
+			cursor = plane;
+	}
 
 	drm_crtc_helper_add(crtc, &exynos_crtc_helper_funcs);
-	return drm_crtc_init_with_planes(drm_dev, crtc, NULL, NULL,
+	return drm_crtc_init_with_planes(drm_dev, crtc, primary, cursor,
 					 &exynos_crtc_funcs, NULL);
 }
 
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index 23b27b82de6e..6643db865500 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -21,8 +21,6 @@
 #define MAX_PLANE	5
 #define MAX_FB_BUFFER	4
 
-#define DEFAULT_WIN	0
-
 #define to_exynos_crtc(x)	container_of(x, struct exynos_drm_crtc, base)
 #define to_exynos_plane(x)	container_of(x, struct exynos_drm_plane, base)
 
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index b3c11bca5aed..14e70971547a 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -1051,7 +1051,6 @@ static int fimd_bind(struct device *dev, struct device *master, void *data)
 	ret = exynos_drm_crtc_init(&ctx->crtc, drm_dev);
 	if (ret)
 		return ret;
-	ctx->crtc.base.primary = &ctx->planes[DEFAULT_WIN].base;
 
 	if (ctx->driver_data->has_dp_clk) {
 		ctx->dp_clk.enable = fimd_dp_clock_enable;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
index eb1fd3a2cdf3..19cd7275b20f 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
@@ -387,7 +387,6 @@ static int vidi_bind(struct device *dev, struct device *master, void *data)
 		DRM_ERROR("failed to create crtc.\n");
 		return ret;
 	}
-	ctx->crtc.base.primary = &ctx->planes[DEFAULT_WIN].base;
 
 	drm_encoder_init(drm_dev, encoder, &exynos_vidi_encoder_funcs,
 			 DRM_MODE_ENCODER_TMDS, NULL);
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
index d0dcbbfc67e5..8bb31a0e572e 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -1157,7 +1157,6 @@ static int mixer_bind(struct device *dev, struct device *manager, void *data)
 		mixer_ctx_remove(ctx);
 		goto free_ctx;
 	}
-	ctx->crtc.base.primary = &ctx->planes[DEFAULT_WIN].base;
 
 	return 0;
 
-- 
2.17.1




[Index of Archives]     [Linux SoC Development]     [Linux Rockchip Development]     [Linux for Synopsys ARC Processors]    
  • [Linux on Unisoc (RDA Micro) SoCs]     [Linux Actions SoC]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Linux SCSI]     [Yosemite News]

  •   Powered by Linux