All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gustavo Padovan <gustavo@padovan.org>
To: linux-samsung-soc@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org, inki.dae@samsung.com,
	Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Subject: [PATCH 22/29] drm/exynos: create exynos_check_plane()
Date: Thu, 18 Dec 2014 11:58:48 -0200	[thread overview]
Message-ID: <1418911135-5207-23-git-send-email-gustavo@padovan.org> (raw)
In-Reply-To: <1418911135-5207-1-git-send-email-gustavo@padovan.org>

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Split update plane in two parts, an initial check part that can fail
and the update part that can't fail.

This is a important step for the upcoming atomic modesetting support.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c  | 11 ++++++++--
 drivers/gpu/drm/exynos/exynos_drm_plane.c | 34 +++++++++++++++++++------------
 drivers/gpu/drm/exynos/exynos_drm_plane.h | 11 +++++-----
 3 files changed, 36 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 357fcd5..a85c451 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -92,6 +92,7 @@ exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,
 	struct drm_framebuffer *fb = crtc->primary->fb;
 	unsigned int crtc_w;
 	unsigned int crtc_h;
+	int ret;
 
 	/*
 	 * copy the mode data adjusted by mode_fixup() into crtc->mode
@@ -99,10 +100,16 @@ exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,
 	 */
 	memcpy(&crtc->mode, adjusted_mode, sizeof(*adjusted_mode));
 
+	ret = exynos_check_plane(crtc->primary, fb);
+	if (ret < 0)
+		return ret;
+
 	crtc_w = fb->width - x;
 	crtc_h = fb->height - y;
-	return exynos_plane_mode_set(crtc->primary, crtc, fb, 0, 0,
-				     crtc_w, crtc_h, x, y, crtc_w, crtc_h);
+	exynos_plane_mode_set(crtc->primary, crtc, fb, 0, 0,
+			      crtc_w, crtc_h, x, y, crtc_w, crtc_h);
+
+	return 0;
 }
 
 static int exynos_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index 95442e6..358cff6 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
@@ -12,6 +12,7 @@
 #include <drm/drmP.h>
 
 #include <drm/exynos_drm.h>
+#include <drm/drm_plane_helper.h>
 #include "exynos_drm_drv.h"
 #include "exynos_drm_crtc.h"
 #include "exynos_drm_fb.h"
@@ -61,16 +62,9 @@ static int exynos_plane_get_size(int start, unsigned length, unsigned last)
 	return size;
 }
 
-int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc,
-			  struct drm_framebuffer *fb, int crtc_x, int crtc_y,
-			  unsigned int crtc_w, unsigned int crtc_h,
-			  uint32_t src_x, uint32_t src_y,
-			  uint32_t src_w, uint32_t src_h)
+int exynos_check_plane(struct drm_plane *plane, struct drm_framebuffer *fb)
 {
 	struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
-	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
-	unsigned int actual_w;
-	unsigned int actual_h;
 	int nr;
 	int i;
 
@@ -89,6 +83,20 @@ int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc,
 				i, (unsigned long)exynos_plane->dma_addr[i]);
 	}
 
+	return 0;
+}
+
+void exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc,
+			  struct drm_framebuffer *fb, int crtc_x, int crtc_y,
+			  unsigned int crtc_w, unsigned int crtc_h,
+			  uint32_t src_x, uint32_t src_y,
+			  uint32_t src_w, uint32_t src_h)
+{
+	struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
+	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
+	unsigned int actual_w;
+	unsigned int actual_h;
+
 	actual_w = exynos_plane_get_size(crtc_x, crtc_w, crtc->mode.hdisplay);
 	actual_h = exynos_plane_get_size(crtc_y, crtc_h, crtc->mode.vdisplay);
 
@@ -135,8 +143,6 @@ int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc,
 
 	if (exynos_crtc->ops->win_mode_set)
 		exynos_crtc->ops->win_mode_set(exynos_crtc, exynos_plane);
-
-	return 0;
 }
 
 void exynos_plane_dpms(struct drm_plane *plane, int mode)
@@ -177,12 +183,14 @@ exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
 	struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
 	int ret;
 
-	ret = exynos_plane_mode_set(plane, crtc, fb, crtc_x, crtc_y,
-			crtc_w, crtc_h, src_x >> 16, src_y >> 16,
-			src_w >> 16, src_h >> 16);
+	ret = exynos_check_plane(plane, fb);
 	if (ret < 0)
 		return ret;
 
+	exynos_plane_mode_set(plane, crtc, fb, crtc_x, crtc_y,
+			      crtc_w, crtc_h, src_x >> 16, src_y >> 16,
+			      src_w >> 16, src_h >> 16);
+
 	if (exynos_crtc->ops->win_commit)
 		exynos_crtc->ops->win_commit(exynos_crtc, exynos_plane->zpos);
 
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.h b/drivers/gpu/drm/exynos/exynos_drm_plane.h
index d25c079..59d4075 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.h
@@ -9,11 +9,12 @@
  *
  */
 
-int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc,
-			  struct drm_framebuffer *fb, int crtc_x, int crtc_y,
-			  unsigned int crtc_w, unsigned int crtc_h,
-			  uint32_t src_x, uint32_t src_y,
-			  uint32_t src_w, uint32_t src_h);
+int exynos_check_plane(struct drm_plane *plane, struct drm_framebuffer *fb);
+void exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc,
+			   struct drm_framebuffer *fb, int crtc_x, int crtc_y,
+			   unsigned int crtc_w, unsigned int crtc_h,
+			   uint32_t src_x, uint32_t src_y,
+			   uint32_t src_w, uint32_t src_h);
 int exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
 			struct drm_framebuffer *fb, int crtc_x, int crtc_y,
 			unsigned int crtc_w, unsigned int crtc_h,
-- 
1.9.3

  parent reply	other threads:[~2014-12-18 14:00 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-18 13:58 [PATCH 00/29] drm/exynos: clean up + atomic phases 1 and 2 Gustavo Padovan
2014-12-18 13:58 ` [PATCH 01/29] drm/exynos/fimd: only finish pageflip if START == START_S Gustavo Padovan
2014-12-30 14:05   ` Inki Dae
2015-01-12 21:13     ` Gustavo Padovan
2015-01-19 16:35       ` Daniel Stone
2014-12-18 13:58 ` [PATCH 02/29] drm/exynos: move to_exynos_crtc() macro to main header Gustavo Padovan
2014-12-18 13:58 ` [PATCH 03/29] drm/exynos: expose struct exynos_drm_crtc Gustavo Padovan
2014-12-18 13:58 ` [PATCH 04/29] drm/exynos: remove exynos_drm_crtc_plane_* wrappers Gustavo Padovan
2014-12-18 13:58 ` [PATCH 05/29] drm/exynos: remove struct exynos_drm_overlay Gustavo Padovan
2014-12-18 13:58 ` [PATCH 06/29] drm/exynos/fimd: don't initialize 'ret' variable in fimd_probe() Gustavo Padovan
2014-12-18 13:58 ` [PATCH 07/29] drm/exynos/vidi: remove useless ops->commit() Gustavo Padovan
2014-12-18 13:58 ` [PATCH 08/29] drm/exynos: Don't touch DPMS when updating overlay planes Gustavo Padovan
2014-12-18 13:58 ` [PATCH 09/29] drm/exynos: don't do any DPMS operation while updating planes Gustavo Padovan
2014-12-18 13:58 ` [PATCH 10/29] drm/exynos: remove exynos_plane_commit() wrapper Gustavo Padovan
2014-12-18 13:58 ` [PATCH 11/29] drm/exynos: unify plane update on exynos_update_plane() Gustavo Padovan
2014-12-18 13:58 ` [PATCH 12/29] drm/exynos: call exynos_update_plane() directly on page flips Gustavo Padovan
2014-12-18 13:58 ` [PATCH 13/29] drm/exynos: remove exynos_drm_crtc_mode_set_commit() Gustavo Padovan
2014-12-18 13:58 ` [PATCH 14/29] drm/exynos: rename base object of struct exynos_drm_crtc to 'base' Gustavo Padovan
2014-12-18 13:58 ` [PATCH 15/29] drm/exynos: add pipe param to exynos_drm_crtc_create() Gustavo Padovan
2014-12-18 13:58 ` [PATCH 16/29] drm/exynos: remove pipe member of struct exynos_drm_manager Gustavo Padovan
2014-12-18 13:58 ` [PATCH 17/29] drm/exynos: move 'type' from manager to crtc struct Gustavo Padovan
2014-12-18 13:58 ` [PATCH 18/29] drm/exynos: remove drm_dev from struct exynos_drm_manager Gustavo Padovan
2014-12-18 13:58 ` [PATCH 19/29] drm/exynos: remove " Gustavo Padovan
2014-12-18 13:58 ` [PATCH 20/29] drm/exynos: don't duplicate drm_display_mode in fimd context Gustavo Padovan
2014-12-18 13:58 ` [PATCH 21/29] drm/exynos: remove mode_set() ops from exynos_crtc Gustavo Padovan
2014-12-18 13:58 ` Gustavo Padovan [this message]
2014-12-18 13:58 ` [PATCH 23/29] drm/exynos: atomic phase 1: use drm_plane_helper_update() Gustavo Padovan
2014-12-18 13:58 ` [PATCH 24/29] drm/exynos: make exynos_plane_mode_set() static Gustavo Padovan
2014-12-18 13:58 ` [PATCH 25/29] drm/exynos: atomic phase 1: use drm_plane_helper_disable() Gustavo Padovan
2014-12-18 15:30   ` Daniel Vetter
2014-12-30 14:19   ` Inki Dae
2015-01-07 19:10     ` Gustavo Padovan
2014-12-18 13:58 ` [PATCH 26/29] drm/exynos: atomic phase 1: add atomic_begin()/atomic_flush() Gustavo Padovan
2014-12-30 14:42   ` Inki Dae
2015-01-07 19:29     ` Gustavo Padovan
2014-12-18 13:58 ` [PATCH 27/29] drm/exynos: atomic phase 1: add .mode_set_nofb() callback Gustavo Padovan
2014-12-18 13:58 ` [PATCH 28/29] drm/exynos: atomic phase 2: wire up state reset(), duplicate() and destroy() Gustavo Padovan
2014-12-18 13:58 ` [PATCH 29/29] drm/exynos: atomic phase 2: keep track of framebuffer pointer Gustavo Padovan
2015-01-11 17:16 ` [PATCH 00/29] drm/exynos: clean up + atomic phases 1 and 2 Inki Dae

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1418911135-5207-23-git-send-email-gustavo@padovan.org \
    --to=gustavo@padovan.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gustavo.padovan@collabora.co.uk \
    --cc=inki.dae@samsung.com \
    --cc=linux-samsung-soc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.