All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH REBASED 0/3] drm/exynos: add support for dynamic zpos in DECON and FIMD
       [not found] <CGME20181207100156eucas1p237b32702dc8e7859ce972c12e37e2417@eucas1p2.samsung.com>
@ 2018-12-07 10:01 ` Andrzej Hajda
       [not found]   ` <CGME20181207100157eucas1p25b30167172753f14d0128b0a70e3483e@eucas1p2.samsung.com>
                     ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Andrzej Hajda @ 2018-12-07 10:01 UTC (permalink / raw)
  To: Inki Dae
  Cc: linux-samsung-soc, Marek Szyprowski, dri-devel,
	Bartlomiej Zolnierkiewicz

Hi Inki,

This small patchset adds dynamic zpos support for DECON and FIMD.
It was tested on tm2 and trats2.

The patchset is rebased on current exynos-drm-next.

Regards
Andrzej


Andrzej Hajda (3):
  drm/exynos/decon5433: add dynamic zpos support
  drm/exynos/fimd: create local helper for disabling hardware window
  drm/exynos/fimd: add dynamic zpos support

 drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 34 +++++-------
 drivers/gpu/drm/exynos/exynos_drm_fimd.c      | 54 ++++++++-----------
 2 files changed, 34 insertions(+), 54 deletions(-)

-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH REBASED 1/3] drm/exynos/decon5433: add dynamic zpos support
       [not found]   ` <CGME20181207100157eucas1p25b30167172753f14d0128b0a70e3483e@eucas1p2.samsung.com>
@ 2018-12-07 10:01     ` Andrzej Hajda
  0 siblings, 0 replies; 4+ messages in thread
From: Andrzej Hajda @ 2018-12-07 10:01 UTC (permalink / raw)
  To: Inki Dae
  Cc: linux-samsung-soc, Marek Szyprowski, dri-devel,
	Bartlomiej Zolnierkiewicz

DECON has fixed hardware window order. To implement dynamic zpos
normalized_zpos of active plane has to be connected to window number, and
remaining windows have to be disabled.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
 drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 34 +++++++------------
 1 file changed, 13 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
index 5b4e0e8b23bc..e0fda6da2ccb 100644
--- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
@@ -83,14 +83,6 @@ static const enum drm_plane_type decon_win_types[WINDOWS_NR] = {
 	[CURSON_WIN] = DRM_PLANE_TYPE_CURSOR,
 };
 
-static const unsigned int capabilities[WINDOWS_NR] = {
-	0,
-	EXYNOS_DRM_PLANE_CAP_WIN_BLEND | EXYNOS_DRM_PLANE_CAP_PIX_BLEND,
-	EXYNOS_DRM_PLANE_CAP_WIN_BLEND | EXYNOS_DRM_PLANE_CAP_PIX_BLEND,
-	EXYNOS_DRM_PLANE_CAP_WIN_BLEND | EXYNOS_DRM_PLANE_CAP_PIX_BLEND,
-	EXYNOS_DRM_PLANE_CAP_WIN_BLEND | EXYNOS_DRM_PLANE_CAP_PIX_BLEND,
-};
-
 static inline void decon_set_bits(struct decon_context *ctx, u32 reg, u32 mask,
 				  u32 val)
 {
@@ -402,7 +394,7 @@ static void decon_update_plane(struct exynos_drm_crtc *crtc,
 				to_exynos_plane_state(plane->base.state);
 	struct decon_context *ctx = crtc->ctx;
 	struct drm_framebuffer *fb = state->base.fb;
-	unsigned int win = plane->index;
+	unsigned int win = state->base.normalized_zpos + ctx->first_win;
 	unsigned int cpp = fb->format->cpp[0];
 	unsigned int pitch = fb->pitches[0];
 	dma_addr_t dma_addr = exynos_drm_fb_dma_addr(fb, 0);
@@ -452,19 +444,18 @@ static void decon_update_plane(struct exynos_drm_crtc *crtc,
 	decon_set_bits(ctx, DECON_WINCONx(win), WINCONx_ENWIN_F, ~0);
 }
 
-static void decon_disable_plane(struct exynos_drm_crtc *crtc,
-				struct exynos_drm_plane *plane)
-{
-	struct decon_context *ctx = crtc->ctx;
-	unsigned int win = plane->index;
-
-	decon_set_bits(ctx, DECON_WINCONx(win), WINCONx_ENWIN_F, 0);
-}
-
 static void decon_atomic_flush(struct exynos_drm_crtc *crtc)
 {
 	struct decon_context *ctx = crtc->ctx;
 	unsigned long flags;
+	int win = hweight32(crtc->base.state->plane_mask) + ctx->first_win;
+
+	/* disable windows corresponding to disabled planes */
+	for (; win < WINDOWS_NR; ++win) {
+		if (!readl(ctx->addr + DECON_WINCONx(win)) & WINCONx_ENWIN_F)
+			break;
+		decon_set_bits(ctx, DECON_WINCONx(win), WINCONx_ENWIN_F, 0);
+	}
 
 	spin_lock_irqsave(&ctx->vblank_lock, flags);
 
@@ -538,7 +529,7 @@ static void decon_disable(struct exynos_drm_crtc *crtc)
 	 * a destroyed buffer later.
 	 */
 	for (i = ctx->first_win; i < WINDOWS_NR; i++)
-		decon_disable_plane(crtc, &ctx->planes[i]);
+		decon_set_bits(ctx, DECON_WINCONx(i), WINCONx_ENWIN_F, 0);
 
 	decon_swreset(ctx);
 
@@ -607,7 +598,6 @@ static const struct exynos_drm_crtc_ops decon_crtc_ops = {
 	.disable_vblank		= decon_disable_vblank,
 	.atomic_begin		= decon_atomic_begin,
 	.update_plane		= decon_update_plane,
-	.disable_plane		= decon_disable_plane,
 	.mode_valid		= decon_mode_valid,
 	.atomic_flush		= decon_atomic_flush,
 };
@@ -628,7 +618,9 @@ static int decon_bind(struct device *dev, struct device *master, void *data)
 		ctx->configs[win].num_pixel_formats = ARRAY_SIZE(decon_formats);
 		ctx->configs[win].zpos = win - ctx->first_win;
 		ctx->configs[win].type = decon_win_types[win];
-		ctx->configs[win].capabilities = capabilities[win];
+		ctx->configs[win].capabilities = EXYNOS_DRM_PLANE_CAP_ZPOS
+					| EXYNOS_DRM_PLANE_CAP_WIN_BLEND
+					| EXYNOS_DRM_PLANE_CAP_PIX_BLEND;
 
 		ret = exynos_plane_init(drm_dev, &ctx->planes[win], win,
 					&ctx->configs[win]);
-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH REBASED 2/3] drm/exynos/fimd: create local helper for disabling hardware window
       [not found]   ` <CGME20181207100157eucas1p2a7ab15738d7d436ced74cc487dc24c21@eucas1p2.samsung.com>
@ 2018-12-07 10:01     ` Andrzej Hajda
  0 siblings, 0 replies; 4+ messages in thread
From: Andrzej Hajda @ 2018-12-07 10:01 UTC (permalink / raw)
  To: Inki Dae
  Cc: linux-samsung-soc, Marek Szyprowski, dri-devel,
	Bartlomiej Zolnierkiewicz

Hardware window disabling is performed in multiple places. Creating
helper for it simplifies the code and prepares it for further improvements.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 786a8ee6f10f..a7993f5d8371 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -345,6 +345,14 @@ static void fimd_enable_shadow_channel_path(struct fimd_context *ctx,
 	writel(val, ctx->regs + SHADOWCON);
 }
 
+static void fimd_disable_win(struct fimd_context *ctx, int win)
+{
+	fimd_enable_video_output(ctx, win, false);
+
+	if (ctx->driver_data->has_shadowcon)
+		fimd_enable_shadow_channel_path(ctx, win, false);
+}
+
 static void fimd_clear_channels(struct exynos_drm_crtc *crtc)
 {
 	struct fimd_context *ctx = crtc->ctx;
@@ -363,12 +371,7 @@ static void fimd_clear_channels(struct exynos_drm_crtc *crtc)
 		u32 val = readl(ctx->regs + WINCON(win));
 
 		if (val & WINCONx_ENWIN) {
-			fimd_enable_video_output(ctx, win, false);
-
-			if (ctx->driver_data->has_shadowcon)
-				fimd_enable_shadow_channel_path(ctx, win,
-								false);
-
+			fimd_disable_win(ctx, win);
 			ch_enabled = 1;
 		}
 	}
@@ -880,15 +883,11 @@ static void fimd_disable_plane(struct exynos_drm_crtc *crtc,
 			       struct exynos_drm_plane *plane)
 {
 	struct fimd_context *ctx = crtc->ctx;
-	unsigned int win = plane->index;
 
 	if (ctx->suspended)
 		return;
 
-	fimd_enable_video_output(ctx, win, false);
-
-	if (ctx->driver_data->has_shadowcon)
-		fimd_enable_shadow_channel_path(ctx, win, false);
+	fimd_disable_win(ctx, plane->index);
 }
 
 static void fimd_enable(struct exynos_drm_crtc *crtc)
@@ -923,7 +922,7 @@ static void fimd_disable(struct exynos_drm_crtc *crtc)
 	 * a destroyed buffer later.
 	 */
 	for (i = 0; i < WINDOWS_NR; i++)
-		fimd_disable_plane(crtc, &ctx->planes[i]);
+		fimd_disable_win(ctx, i);
 
 	fimd_enable_vblank(crtc);
 	fimd_wait_for_vblank(crtc);
-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH REBASED 3/3] drm/exynos/fimd: add dynamic zpos support
       [not found]   ` <CGME20181207100157eucas1p150fec40afefbe9f5f1f5c676b5e09d54@eucas1p1.samsung.com>
@ 2018-12-07 10:01     ` Andrzej Hajda
  0 siblings, 0 replies; 4+ messages in thread
From: Andrzej Hajda @ 2018-12-07 10:01 UTC (permalink / raw)
  To: Inki Dae
  Cc: linux-samsung-soc, Marek Szyprowski, dri-devel,
	Bartlomiej Zolnierkiewicz

FIMD has fixed hardware window order. To implement dynamic zpos
normalized_zpos of active plane has to be connected to window number, and
remaining windows have to be disabled.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 33 ++++++++----------------
 1 file changed, 11 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index a7993f5d8371..4d2bc32e26b6 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -228,14 +228,6 @@ static const uint32_t fimd_formats[] = {
 	DRM_FORMAT_ARGB8888,
 };
 
-static const unsigned int capabilities[WINDOWS_NR] = {
-	0,
-	EXYNOS_DRM_PLANE_CAP_WIN_BLEND | EXYNOS_DRM_PLANE_CAP_PIX_BLEND,
-	EXYNOS_DRM_PLANE_CAP_WIN_BLEND | EXYNOS_DRM_PLANE_CAP_PIX_BLEND,
-	EXYNOS_DRM_PLANE_CAP_WIN_BLEND | EXYNOS_DRM_PLANE_CAP_PIX_BLEND,
-	EXYNOS_DRM_PLANE_CAP_WIN_BLEND | EXYNOS_DRM_PLANE_CAP_PIX_BLEND,
-};
-
 static inline void fimd_set_bits(struct fimd_context *ctx, u32 reg, u32 mask,
 				 u32 val)
 {
@@ -781,6 +773,12 @@ static void fimd_atomic_flush(struct exynos_drm_crtc *crtc)
 	if (ctx->suspended)
 		return;
 
+	for (i = hweight32(crtc->base.state->plane_mask); i < WINDOWS_NR; i++) {
+		if (!(readl(ctx->regs + WINCON(i)) & WINCONx_ENWIN))
+			break;
+		fimd_disable_win(ctx, i);
+	}
+
 	for (i = 0; i < WINDOWS_NR; i++)
 		fimd_shadow_protect_win(ctx, i, false);
 
@@ -797,7 +795,7 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc,
 	dma_addr_t dma_addr;
 	unsigned long val, size, offset;
 	unsigned int last_x, last_y, buf_offsize, line_size;
-	unsigned int win = plane->index;
+	unsigned int win = state->base.normalized_zpos;
 	unsigned int cpp = fb->format->cpp[0];
 	unsigned int pitch = fb->pitches[0];
 
@@ -879,17 +877,6 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc,
 		atomic_set(&ctx->win_updated, 1);
 }
 
-static void fimd_disable_plane(struct exynos_drm_crtc *crtc,
-			       struct exynos_drm_plane *plane)
-{
-	struct fimd_context *ctx = crtc->ctx;
-
-	if (ctx->suspended)
-		return;
-
-	fimd_disable_win(ctx, plane->index);
-}
-
 static void fimd_enable(struct exynos_drm_crtc *crtc)
 {
 	struct fimd_context *ctx = crtc->ctx;
@@ -1008,7 +995,6 @@ static const struct exynos_drm_crtc_ops fimd_crtc_ops = {
 	.disable_vblank = fimd_disable_vblank,
 	.atomic_begin = fimd_atomic_begin,
 	.update_plane = fimd_update_plane,
-	.disable_plane = fimd_disable_plane,
 	.atomic_flush = fimd_atomic_flush,
 	.atomic_check = fimd_atomic_check,
 	.te_handler = fimd_te_handler,
@@ -1062,7 +1048,10 @@ static int fimd_bind(struct device *dev, struct device *master, void *data)
 		ctx->configs[i].num_pixel_formats = ARRAY_SIZE(fimd_formats);
 		ctx->configs[i].zpos = i;
 		ctx->configs[i].type = fimd_win_types[i];
-		ctx->configs[i].capabilities = capabilities[i];
+		ctx->configs[i].capabilities = EXYNOS_DRM_PLANE_CAP_ZPOS
+					     | EXYNOS_DRM_PLANE_CAP_WIN_BLEND
+					     | EXYNOS_DRM_PLANE_CAP_PIX_BLEND;
+
 		ret = exynos_plane_init(drm_dev, &ctx->planes[i], i,
 					&ctx->configs[i]);
 		if (ret)
-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-12-07 10:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20181207100156eucas1p237b32702dc8e7859ce972c12e37e2417@eucas1p2.samsung.com>
2018-12-07 10:01 ` [PATCH REBASED 0/3] drm/exynos: add support for dynamic zpos in DECON and FIMD Andrzej Hajda
     [not found]   ` <CGME20181207100157eucas1p25b30167172753f14d0128b0a70e3483e@eucas1p2.samsung.com>
2018-12-07 10:01     ` [PATCH REBASED 1/3] drm/exynos/decon5433: add dynamic zpos support Andrzej Hajda
     [not found]   ` <CGME20181207100157eucas1p2a7ab15738d7d436ced74cc487dc24c21@eucas1p2.samsung.com>
2018-12-07 10:01     ` [PATCH REBASED 2/3] drm/exynos/fimd: create local helper for disabling hardware window Andrzej Hajda
     [not found]   ` <CGME20181207100157eucas1p150fec40afefbe9f5f1f5c676b5e09d54@eucas1p1.samsung.com>
2018-12-07 10:01     ` [PATCH REBASED 3/3] drm/exynos/fimd: add dynamic zpos support Andrzej Hajda

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.