All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -v3 00/11] drm/exynos: Add atomic modesetting support
@ 2015-04-03 18:09 Gustavo Padovan
  2015-04-03 18:09 ` [PATCH -v3 01/11] drm/exynos: atomic phase 1: use drm_plane_helper_update() Gustavo Padovan
                   ` (11 more replies)
  0 siblings, 12 replies; 28+ messages in thread
From: Gustavo Padovan @ 2015-04-03 18:09 UTC (permalink / raw)
  To: linux-samsung-soc; +Cc: Gustavo Padovan, dri-devel

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

Hi,

Here goes the full support for atomic modesetting on exynos. I've
split the patches in the various phases of atomic support.

These patches sits on top of the clean up patches I've sent yesterday
to this mailing list[1].

v2: fixes comments by Joonyoung
        - remove unused var in patch 09
        - use ->disable instead of outdated ->dpms in hdmi code
        - remove WARN_ON from crtc enable/disable

v3: fixes comment by Joonyoung
	- move the removal of drm_helper_disable_unused_functions() to 
	separated patch

	Gustavo
---

Gustavo Padovan (11):
  drm/exynos: atomic phase 1: use drm_plane_helper_update()
  drm/exynos: atomic phase 1: use drm_plane_helper_disable()
  drm/exynos: atomic phase 1: add .mode_set_nofb() callback
  drm/exynos: atomic phase 2: wire up state reset(), duplicate() and
    destroy()
  drm/exynos: atomic phase 2: keep track of framebuffer pointer
  drm/exynos: atomic phase 3: atomic updates of planes
  drm/exynos: atomic phase 3: use atomic .set_config helper
  drm/exynos: atomic phase 3: convert page flips
  drm/exynos: remove exported functions from exynos_drm_plane
  drm/exynos: don't disable unused functions at init
  drm/exynos: atomic dpms support

 drivers/gpu/drm/bridge/ptn3460.c              |   4 +
 drivers/gpu/drm/exynos/exynos_dp_core.c       |   6 +-
 drivers/gpu/drm/exynos/exynos_drm_connector.c |   6 +-
 drivers/gpu/drm/exynos/exynos_drm_crtc.c      | 226 ++++++++------------------
 drivers/gpu/drm/exynos/exynos_drm_dpi.c       |   6 +-
 drivers/gpu/drm/exynos/exynos_drm_drv.c       |   2 +
 drivers/gpu/drm/exynos/exynos_drm_drv.h       |   4 +-
 drivers/gpu/drm/exynos/exynos_drm_dsi.c       |   6 +-
 drivers/gpu/drm/exynos/exynos_drm_encoder.c   |  27 +--
 drivers/gpu/drm/exynos/exynos_drm_fb.c        |  12 +-
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c     |   3 -
 drivers/gpu/drm/exynos/exynos_drm_plane.c     | 113 +++++++------
 drivers/gpu/drm/exynos/exynos_drm_plane.h     |  11 --
 drivers/gpu/drm/exynos/exynos_drm_vidi.c      |   6 +-
 drivers/gpu/drm/exynos/exynos_hdmi.c          |  10 +-
 15 files changed, 187 insertions(+), 255 deletions(-)

-- 
2.1.0

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

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

* [PATCH -v3 01/11] drm/exynos: atomic phase 1: use drm_plane_helper_update()
  2015-04-03 18:09 [PATCH -v3 00/11] drm/exynos: Add atomic modesetting support Gustavo Padovan
@ 2015-04-03 18:09 ` Gustavo Padovan
  2015-04-03 18:09 ` [PATCH -v3 02/11] drm/exynos: atomic phase 1: use drm_plane_helper_disable() Gustavo Padovan
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 28+ messages in thread
From: Gustavo Padovan @ 2015-04-03 18:09 UTC (permalink / raw)
  To: linux-samsung-soc; +Cc: dri-devel, inki.dae, jy0922.shim, Gustavo Padovan

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

Rip out the check from exynos_update_plane() and create
exynos_check_plane() for the check phase enabling use to use
the atomic helpers to call our check and update phases when updating
planes.

Update all users of exynos_update_plane() accordingly to call
exynos_check_plane() before.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c  | 29 ++++++++++++------------
 drivers/gpu/drm/exynos/exynos_drm_plane.c | 37 ++++++++++++++++++++++---------
 drivers/gpu/drm/exynos/exynos_drm_plane.h |  2 +-
 3 files changed, 43 insertions(+), 25 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index eb49195..1c0d936 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -116,6 +116,7 @@ static int exynos_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
 	struct drm_framebuffer *fb = crtc->primary->fb;
 	unsigned int crtc_w;
 	unsigned int crtc_h;
+	int ret;
 
 	/* when framebuffer changing is requested, crtc's dpms should be on */
 	if (exynos_crtc->dpms > DRM_MODE_DPMS_ON) {
@@ -123,11 +124,16 @@ static int exynos_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
 		return -EPERM;
 	}
 
+	ret = exynos_check_plane(crtc->primary, fb);
+	if (ret)
+		return ret;
+
 	crtc_w = fb->width - x;
 	crtc_h = fb->height - y;
+	exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
+			    crtc_w, crtc_h, x, y, crtc_w, crtc_h);
 
-	return exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
-				   crtc_w, crtc_h, x, y, crtc_w, crtc_h);
+	return 0;
 }
 
 static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
@@ -164,7 +170,6 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
 {
 	struct drm_device *dev = crtc->dev;
 	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
-	struct drm_framebuffer *old_fb = crtc->primary->fb;
 	unsigned int crtc_w, crtc_h;
 	int ret;
 
@@ -183,6 +188,10 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
 		goto out;
 	}
 
+	ret = exynos_check_plane(crtc->primary, fb);
+	if (ret)
+		goto out;
+
 	ret = drm_vblank_get(dev, exynos_crtc->pipe);
 	if (ret) {
 		DRM_DEBUG("failed to acquire vblank counter\n");
@@ -201,17 +210,9 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
 	crtc->primary->fb = fb;
 	crtc_w = fb->width - crtc->x;
 	crtc_h = fb->height - crtc->y;
-	ret = exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
-				  crtc_w, crtc_h, crtc->x, crtc->y,
-				  crtc_w, crtc_h);
-	if (ret) {
-		crtc->primary->fb = old_fb;
-		spin_lock_irq(&dev->event_lock);
-		exynos_crtc->event = NULL;
-		drm_vblank_put(dev, exynos_crtc->pipe);
-		spin_unlock_irq(&dev->event_lock);
-		return ret;
-	}
+	exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
+			    crtc_w, crtc_h, crtc->x, crtc->y,
+			    crtc_w, crtc_h);
 
 	return 0;
 
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index 2b0479e..5a37816 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
@@ -140,21 +140,15 @@ void exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc,
 	plane->crtc = crtc;
 }
 
-int
+void
 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,
 		     uint32_t src_x, uint32_t src_y,
 		     uint32_t src_w, uint32_t src_h)
 {
-
 	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
 	struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
-	int ret;
-
-	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,
@@ -162,8 +156,6 @@ exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
 
 	if (exynos_crtc->ops->win_commit)
 		exynos_crtc->ops->win_commit(exynos_crtc, exynos_plane->zpos);
-
-	return 0;
 }
 
 static int exynos_disable_plane(struct drm_plane *plane)
@@ -179,11 +171,34 @@ static int exynos_disable_plane(struct drm_plane *plane)
 }
 
 static struct drm_plane_funcs exynos_plane_funcs = {
-	.update_plane	= exynos_update_plane,
+	.update_plane	= drm_plane_helper_update,
 	.disable_plane	= exynos_disable_plane,
 	.destroy	= drm_plane_cleanup,
 };
 
+static int exynos_plane_atomic_check(struct drm_plane *plane,
+				     struct drm_plane_state *state)
+{
+	return exynos_check_plane(plane, state->fb);
+}
+
+static void exynos_plane_atomic_update(struct drm_plane *plane,
+				       struct drm_plane_state *old_state)
+{
+	struct drm_plane_state *state = plane->state;
+
+	exynos_update_plane(plane, state->crtc, state->fb,
+			    state->crtc_x, state->crtc_y,
+			    state->crtc_w, state->crtc_h,
+			    state->src_x >> 16, state->src_y >> 16,
+			    state->src_w >> 16, state->src_h >> 16);
+}
+
+static const struct drm_plane_helper_funcs plane_helper_funcs = {
+	.atomic_check = exynos_plane_atomic_check,
+	.atomic_update = exynos_plane_atomic_update,
+};
+
 static void exynos_plane_attach_zpos_property(struct drm_plane *plane,
 					      unsigned int zpos)
 {
@@ -219,6 +234,8 @@ int exynos_plane_init(struct drm_device *dev,
 		return err;
 	}
 
+	drm_plane_helper_add(&exynos_plane->base, &plane_helper_funcs);
+
 	exynos_plane->zpos = zpos;
 
 	if (type == DRM_PLANE_TYPE_OVERLAY)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.h b/drivers/gpu/drm/exynos/exynos_drm_plane.h
index f360590..560ca71 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.h
@@ -15,7 +15,7 @@ void exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc,
 			   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,
+void 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,
 			uint32_t src_x, uint32_t src_y,
-- 
2.1.0

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

* [PATCH -v3 02/11] drm/exynos: atomic phase 1: use drm_plane_helper_disable()
  2015-04-03 18:09 [PATCH -v3 00/11] drm/exynos: Add atomic modesetting support Gustavo Padovan
  2015-04-03 18:09 ` [PATCH -v3 01/11] drm/exynos: atomic phase 1: use drm_plane_helper_update() Gustavo Padovan
@ 2015-04-03 18:09 ` Gustavo Padovan
  2015-04-03 18:09 ` [PATCH -v3 03/11] drm/exynos: atomic phase 1: add .mode_set_nofb() callback Gustavo Padovan
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 28+ messages in thread
From: Gustavo Padovan @ 2015-04-03 18:09 UTC (permalink / raw)
  To: linux-samsung-soc; +Cc: dri-devel, inki.dae, jy0922.shim, Gustavo Padovan

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

The atomic helper to disable planes also uses the optional
.atomic_disable() helper. The unique operation it does is calling
.win_disable()

exynos_drm_fb_get_buf_cnt() needs a fb check too to avoid a null pointer.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/gpu/drm/exynos/exynos_drm_fb.c    |  2 +-
 drivers/gpu/drm/exynos/exynos_drm_plane.c | 26 +++++++++++++-------------
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c
index d346d1e..470456d 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fb.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c
@@ -136,7 +136,7 @@ unsigned int exynos_drm_fb_get_buf_cnt(struct drm_framebuffer *fb)
 
 	exynos_fb = to_exynos_fb(fb);
 
-	return exynos_fb->buf_cnt;
+	return exynos_fb ? exynos_fb->buf_cnt : 0;
 }
 
 struct drm_framebuffer *
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index 5a37816..2152a24 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
@@ -158,21 +158,9 @@ exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
 		exynos_crtc->ops->win_commit(exynos_crtc, exynos_plane->zpos);
 }
 
-static int exynos_disable_plane(struct drm_plane *plane)
-{
-	struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
-	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(plane->crtc);
-
-	if (exynos_crtc->ops->win_disable)
-		exynos_crtc->ops->win_disable(exynos_crtc,
-					      exynos_plane->zpos);
-
-	return 0;
-}
-
 static struct drm_plane_funcs exynos_plane_funcs = {
 	.update_plane	= drm_plane_helper_update,
-	.disable_plane	= exynos_disable_plane,
+	.disable_plane	= drm_plane_helper_disable,
 	.destroy	= drm_plane_cleanup,
 };
 
@@ -194,9 +182,21 @@ static void exynos_plane_atomic_update(struct drm_plane *plane,
 			    state->src_w >> 16, state->src_h >> 16);
 }
 
+static void exynos_plane_atomic_disable(struct drm_plane *plane,
+				        struct drm_plane_state *old_state)
+{
+	struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
+	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(old_state->crtc);
+
+	if (exynos_crtc->ops->win_disable)
+		exynos_crtc->ops->win_disable(exynos_crtc,
+					      exynos_plane->zpos);
+}
+
 static const struct drm_plane_helper_funcs plane_helper_funcs = {
 	.atomic_check = exynos_plane_atomic_check,
 	.atomic_update = exynos_plane_atomic_update,
+	.atomic_disable = exynos_plane_atomic_disable,
 };
 
 static void exynos_plane_attach_zpos_property(struct drm_plane *plane,
-- 
2.1.0

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

* [PATCH -v3 03/11] drm/exynos: atomic phase 1: add .mode_set_nofb() callback
  2015-04-03 18:09 [PATCH -v3 00/11] drm/exynos: Add atomic modesetting support Gustavo Padovan
  2015-04-03 18:09 ` [PATCH -v3 01/11] drm/exynos: atomic phase 1: use drm_plane_helper_update() Gustavo Padovan
  2015-04-03 18:09 ` [PATCH -v3 02/11] drm/exynos: atomic phase 1: use drm_plane_helper_disable() Gustavo Padovan
@ 2015-04-03 18:09 ` Gustavo Padovan
  2015-04-03 18:09 ` [PATCH -v3 04/11] drm/exynos: atomic phase 2: wire up state reset(), duplicate() and destroy() Gustavo Padovan
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 28+ messages in thread
From: Gustavo Padovan @ 2015-04-03 18:09 UTC (permalink / raw)
  To: linux-samsung-soc; +Cc: Gustavo Padovan, dri-devel

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

The new atomic infrastructure needs the .mode_set_nofb() callback to
update CRTC timings before setting any plane.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 60 +++++---------------------------
 1 file changed, 9 insertions(+), 51 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 1c0d936..35f101f 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -81,59 +81,16 @@ exynos_drm_crtc_mode_fixup(struct drm_crtc *crtc,
 	return true;
 }
 
-static int
-exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,
-			  struct drm_display_mode *adjusted_mode, int x, int y,
-			  struct drm_framebuffer *old_fb)
-{
-	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
-	 * so that hardware can be seet to proper 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;
-	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,
-					  struct drm_framebuffer *old_fb)
+static void
+exynos_drm_crtc_mode_set_nofb(struct drm_crtc *crtc)
 {
 	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
-	struct drm_framebuffer *fb = crtc->primary->fb;
-	unsigned int crtc_w;
-	unsigned int crtc_h;
-	int ret;
 
-	/* when framebuffer changing is requested, crtc's dpms should be on */
-	if (exynos_crtc->dpms > DRM_MODE_DPMS_ON) {
-		DRM_ERROR("failed framebuffer changing request.\n");
-		return -EPERM;
-	}
-
-	ret = exynos_check_plane(crtc->primary, fb);
-	if (ret)
-		return ret;
-
-	crtc_w = fb->width - x;
-	crtc_h = fb->height - y;
-	exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
-			    crtc_w, crtc_h, x, y, crtc_w, crtc_h);
+	if (WARN_ON(!crtc->state))
+		return;
 
-	return 0;
+	if (exynos_crtc->ops->commit)
+		exynos_crtc->ops->commit(exynos_crtc);
 }
 
 static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
@@ -158,8 +115,9 @@ static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
 	.prepare	= exynos_drm_crtc_prepare,
 	.commit		= exynos_drm_crtc_commit,
 	.mode_fixup	= exynos_drm_crtc_mode_fixup,
-	.mode_set	= exynos_drm_crtc_mode_set,
-	.mode_set_base	= exynos_drm_crtc_mode_set_base,
+	.mode_set	= drm_helper_crtc_mode_set,
+	.mode_set_nofb	= exynos_drm_crtc_mode_set_nofb,
+	.mode_set_base	= drm_helper_crtc_mode_set_base,
 	.disable	= exynos_drm_crtc_disable,
 };
 
-- 
2.1.0

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

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

* [PATCH -v3 04/11] drm/exynos: atomic phase 2: wire up state reset(), duplicate() and destroy()
  2015-04-03 18:09 [PATCH -v3 00/11] drm/exynos: Add atomic modesetting support Gustavo Padovan
                   ` (2 preceding siblings ...)
  2015-04-03 18:09 ` [PATCH -v3 03/11] drm/exynos: atomic phase 1: add .mode_set_nofb() callback Gustavo Padovan
@ 2015-04-03 18:09 ` Gustavo Padovan
  2015-04-03 18:09 ` [PATCH -v3 05/11] drm/exynos: atomic phase 2: keep track of framebuffer pointer Gustavo Padovan
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 28+ messages in thread
From: Gustavo Padovan @ 2015-04-03 18:09 UTC (permalink / raw)
  To: linux-samsung-soc; +Cc: dri-devel, inki.dae, jy0922.shim, Gustavo Padovan

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

Set CRTC, planes and connectors to use the default implementations from
the atomic helper library. The helpers will work to keep track of state
for each DRM object.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/gpu/drm/bridge/ptn3460.c              | 4 ++++
 drivers/gpu/drm/exynos/exynos_dp_core.c       | 4 ++++
 drivers/gpu/drm/exynos/exynos_drm_connector.c | 4 ++++
 drivers/gpu/drm/exynos/exynos_drm_crtc.c      | 6 ++++++
 drivers/gpu/drm/exynos/exynos_drm_dpi.c       | 4 ++++
 drivers/gpu/drm/exynos/exynos_drm_drv.c       | 2 ++
 drivers/gpu/drm/exynos/exynos_drm_dsi.c       | 4 ++++
 drivers/gpu/drm/exynos/exynos_drm_plane.c     | 4 ++++
 drivers/gpu/drm/exynos/exynos_drm_vidi.c      | 4 ++++
 drivers/gpu/drm/exynos/exynos_hdmi.c          | 4 ++++
 10 files changed, 40 insertions(+)

diff --git a/drivers/gpu/drm/bridge/ptn3460.c b/drivers/gpu/drm/bridge/ptn3460.c
index 826833e..30da10c 100644
--- a/drivers/gpu/drm/bridge/ptn3460.c
+++ b/drivers/gpu/drm/bridge/ptn3460.c
@@ -27,6 +27,7 @@
 
 #include "drm_crtc.h"
 #include "drm_crtc_helper.h"
+#include "drm_atomic_helper.h"
 #include "drm_edid.h"
 #include "drmP.h"
 
@@ -263,6 +264,9 @@ static struct drm_connector_funcs ptn3460_connector_funcs = {
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.detect = ptn3460_detect,
 	.destroy = ptn3460_connector_destroy,
+	.reset = drm_atomic_helper_connector_reset,
+	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
+	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
 int ptn3460_bridge_attach(struct drm_bridge *bridge)
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c
index bf17a60..6704d5c 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -28,6 +28,7 @@
 #include <drm/drmP.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_atomic_helper.h>
 #include <drm/drm_panel.h>
 #include <drm/bridge/ptn3460.h>
 
@@ -952,6 +953,9 @@ static struct drm_connector_funcs exynos_dp_connector_funcs = {
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.detect = exynos_dp_detect,
 	.destroy = exynos_dp_connector_destroy,
+	.reset = drm_atomic_helper_connector_reset,
+	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
+	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
 static int exynos_dp_get_modes(struct drm_connector *connector)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_connector.c b/drivers/gpu/drm/exynos/exynos_drm_connector.c
index ba9b3d5..980b085 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_connector.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_connector.c
@@ -13,6 +13,7 @@
 
 #include <drm/drmP.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_atomic_helper.h>
 
 #include <drm/exynos_drm.h>
 #include "exynos_drm_drv.h"
@@ -182,6 +183,9 @@ static struct drm_connector_funcs exynos_connector_funcs = {
 	.fill_modes	= exynos_drm_connector_fill_modes,
 	.detect		= exynos_drm_connector_detect,
 	.destroy	= exynos_drm_connector_destroy,
+	.reset = drm_atomic_helper_connector_reset,
+	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
+	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
 struct drm_connector *exynos_drm_connector_create(struct drm_device *dev,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 35f101f..44e73d0 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -14,6 +14,8 @@
 
 #include <drm/drmP.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_atomic.h>
+#include <drm/drm_atomic_helper.h>
 
 #include "exynos_drm_crtc.h"
 #include "exynos_drm_drv.h"
@@ -194,8 +196,12 @@ static struct drm_crtc_funcs exynos_crtc_funcs = {
 	.set_config	= drm_crtc_helper_set_config,
 	.page_flip	= exynos_drm_crtc_page_flip,
 	.destroy	= exynos_drm_crtc_destroy,
+	.reset = drm_atomic_helper_crtc_reset,
+	.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
+	.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
 };
 
+
 struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev,
 					       struct drm_plane *plane,
 					       int pipe,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
index 37678cf..ced5c23 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
@@ -13,6 +13,7 @@
 #include <drm/drmP.h>
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_panel.h>
+#include <drm/drm_atomic_helper.h>
 
 #include <linux/regulator/consumer.h>
 
@@ -63,6 +64,9 @@ static struct drm_connector_funcs exynos_dpi_connector_funcs = {
 	.detect = exynos_dpi_detect,
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.destroy = exynos_dpi_connector_destroy,
+	.reset = drm_atomic_helper_connector_reset,
+	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
+	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
 static int exynos_dpi_get_modes(struct drm_connector *connector)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index 8ac4652..08b9a8c 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -98,6 +98,8 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
 	if (ret)
 		goto err_cleanup_vblank;
 
+	drm_mode_config_reset(dev);
+
 	/*
 	 * enable drm irq mode.
 	 * - with irq_enabled = true, we can use the vblank feature.
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
index 05fe93d..6e9c2c3 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
@@ -14,6 +14,7 @@
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_panel.h>
+#include <drm/drm_atomic_helper.h>
 
 #include <linux/clk.h>
 #include <linux/gpio/consumer.h>
@@ -1461,6 +1462,9 @@ static struct drm_connector_funcs exynos_dsi_connector_funcs = {
 	.detect = exynos_dsi_detect,
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.destroy = exynos_dsi_connector_destroy,
+	.reset = drm_atomic_helper_connector_reset,
+	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
+	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
 static int exynos_dsi_get_modes(struct drm_connector *connector)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index 2152a24..3cd628e 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
@@ -13,6 +13,7 @@
 
 #include <drm/exynos_drm.h>
 #include <drm/drm_plane_helper.h>
+#include <drm/drm_atomic_helper.h>
 #include "exynos_drm_drv.h"
 #include "exynos_drm_crtc.h"
 #include "exynos_drm_fb.h"
@@ -162,6 +163,9 @@ static struct drm_plane_funcs exynos_plane_funcs = {
 	.update_plane	= drm_plane_helper_update,
 	.disable_plane	= drm_plane_helper_disable,
 	.destroy	= drm_plane_cleanup,
+	.reset = drm_atomic_helper_plane_reset,
+	.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
+	.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
 };
 
 static int exynos_plane_atomic_check(struct drm_plane *plane,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
index 27e84ec..ee842c0 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
@@ -20,6 +20,7 @@
 
 #include <drm/drm_edid.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_atomic_helper.h>
 
 #include "exynos_drm_drv.h"
 #include "exynos_drm_crtc.h"
@@ -388,6 +389,9 @@ static struct drm_connector_funcs vidi_connector_funcs = {
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.detect = vidi_detect,
 	.destroy = vidi_connector_destroy,
+	.reset = drm_atomic_helper_connector_reset,
+	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
+	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
 static int vidi_get_modes(struct drm_connector *connector)
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 229b361..5b597bc 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -17,6 +17,7 @@
 #include <drm/drmP.h>
 #include <drm/drm_edid.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_atomic_helper.h>
 
 #include "regs-hdmi.h"
 
@@ -1054,6 +1055,9 @@ static struct drm_connector_funcs hdmi_connector_funcs = {
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.detect = hdmi_detect,
 	.destroy = hdmi_connector_destroy,
+	.reset = drm_atomic_helper_connector_reset,
+	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
+	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
 static int hdmi_get_modes(struct drm_connector *connector)
-- 
2.1.0

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

* [PATCH -v3 05/11] drm/exynos: atomic phase 2: keep track of framebuffer pointer
  2015-04-03 18:09 [PATCH -v3 00/11] drm/exynos: Add atomic modesetting support Gustavo Padovan
                   ` (3 preceding siblings ...)
  2015-04-03 18:09 ` [PATCH -v3 04/11] drm/exynos: atomic phase 2: wire up state reset(), duplicate() and destroy() Gustavo Padovan
@ 2015-04-03 18:09 ` Gustavo Padovan
  2015-04-03 18:09 ` [PATCH -v3 06/11] drm/exynos: atomic phase 3: atomic updates of planes Gustavo Padovan
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 28+ messages in thread
From: Gustavo Padovan @ 2015-04-03 18:09 UTC (permalink / raw)
  To: linux-samsung-soc; +Cc: dri-devel, inki.dae, jy0922.shim, Gustavo Padovan

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

Use drm_atomic_set_fb_for_plane() in the legacy page_flip path to keep
track of the framebuffer pointer and reference.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 44e73d0..b080e83 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -174,6 +174,9 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
 			    crtc_w, crtc_h, crtc->x, crtc->y,
 			    crtc_w, crtc_h);
 
+	if (crtc->primary->state)
+		drm_atomic_set_fb_for_plane(crtc->primary->state, fb);
+
 	return 0;
 
 out:
-- 
2.1.0

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

* [PATCH -v3 06/11] drm/exynos: atomic phase 3: atomic updates of planes
  2015-04-03 18:09 [PATCH -v3 00/11] drm/exynos: Add atomic modesetting support Gustavo Padovan
                   ` (4 preceding siblings ...)
  2015-04-03 18:09 ` [PATCH -v3 05/11] drm/exynos: atomic phase 2: keep track of framebuffer pointer Gustavo Padovan
@ 2015-04-03 18:09 ` Gustavo Padovan
  2015-04-03 18:09 ` [PATCH -v3 07/11] drm/exynos: atomic phase 3: use atomic .set_config helper Gustavo Padovan
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 28+ messages in thread
From: Gustavo Padovan @ 2015-04-03 18:09 UTC (permalink / raw)
  To: linux-samsung-soc; +Cc: dri-devel, inki.dae, jy0922.shim, Gustavo Padovan

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

Now that phase 1 and 2 are complete we can switch the update/disable_plane
callbacks to their atomic version.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/gpu/drm/exynos/exynos_drm_fb.c    | 3 +++
 drivers/gpu/drm/exynos/exynos_drm_plane.c | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c
index 470456d..b83ceea 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fb.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c
@@ -16,6 +16,7 @@
 #include <drm/drm_crtc.h>
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_fb_helper.h>
+#include <drm/drm_atomic_helper.h>
 #include <uapi/drm/exynos_drm.h>
 
 #include "exynos_drm_drv.h"
@@ -309,6 +310,8 @@ static void exynos_drm_output_poll_changed(struct drm_device *dev)
 static const struct drm_mode_config_funcs exynos_drm_mode_config_funcs = {
 	.fb_create = exynos_user_fb_create,
 	.output_poll_changed = exynos_drm_output_poll_changed,
+	.atomic_check = drm_atomic_helper_check,
+	.atomic_commit = drm_atomic_helper_commit,
 };
 
 void exynos_drm_mode_config_init(struct drm_device *dev)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index 3cd628e..e83908a 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
@@ -160,8 +160,8 @@ exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
 }
 
 static struct drm_plane_funcs exynos_plane_funcs = {
-	.update_plane	= drm_plane_helper_update,
-	.disable_plane	= drm_plane_helper_disable,
+	.update_plane	= drm_atomic_helper_update_plane,
+	.disable_plane	= drm_atomic_helper_disable_plane,
 	.destroy	= drm_plane_cleanup,
 	.reset = drm_atomic_helper_plane_reset,
 	.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
-- 
2.1.0

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

* [PATCH -v3 07/11] drm/exynos: atomic phase 3: use atomic .set_config helper
  2015-04-03 18:09 [PATCH -v3 00/11] drm/exynos: Add atomic modesetting support Gustavo Padovan
                   ` (5 preceding siblings ...)
  2015-04-03 18:09 ` [PATCH -v3 06/11] drm/exynos: atomic phase 3: atomic updates of planes Gustavo Padovan
@ 2015-04-03 18:09 ` Gustavo Padovan
  2015-04-03 18:09 ` [PATCH -v3 08/11] drm/exynos: atomic phase 3: convert page flips Gustavo Padovan
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 28+ messages in thread
From: Gustavo Padovan @ 2015-04-03 18:09 UTC (permalink / raw)
  To: linux-samsung-soc; +Cc: Gustavo Padovan, dri-devel

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

Now that phase 1 and 2 are complete switch .set_config helper to
use the atomic one.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index b080e83..b0888d4 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -196,7 +196,7 @@ static void exynos_drm_crtc_destroy(struct drm_crtc *crtc)
 }
 
 static struct drm_crtc_funcs exynos_crtc_funcs = {
-	.set_config	= drm_crtc_helper_set_config,
+	.set_config	= drm_atomic_helper_set_config,
 	.page_flip	= exynos_drm_crtc_page_flip,
 	.destroy	= exynos_drm_crtc_destroy,
 	.reset = drm_atomic_helper_crtc_reset,
-- 
2.1.0

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

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

* [PATCH -v3 08/11] drm/exynos: atomic phase 3: convert page flips
  2015-04-03 18:09 [PATCH -v3 00/11] drm/exynos: Add atomic modesetting support Gustavo Padovan
                   ` (6 preceding siblings ...)
  2015-04-03 18:09 ` [PATCH -v3 07/11] drm/exynos: atomic phase 3: use atomic .set_config helper Gustavo Padovan
@ 2015-04-03 18:09 ` Gustavo Padovan
  2015-04-03 18:09 ` [PATCH -v3 09/11] drm/exynos: remove exported functions from exynos_drm_plane Gustavo Padovan
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 28+ messages in thread
From: Gustavo Padovan @ 2015-04-03 18:09 UTC (permalink / raw)
  To: linux-samsung-soc; +Cc: Gustavo Padovan, dri-devel

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

PageFlips now use the atomic helper to work through the atomic modesetting
API. Async page flips are not supported yet.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 63 +-------------------------------
 drivers/gpu/drm/exynos/exynos_drm_fb.c   |  9 ++++-
 2 files changed, 9 insertions(+), 63 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index b0888d4..0db7b91 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -123,67 +123,6 @@ static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
 	.disable	= exynos_drm_crtc_disable,
 };
 
-static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
-				     struct drm_framebuffer *fb,
-				     struct drm_pending_vblank_event *event,
-				     uint32_t page_flip_flags)
-{
-	struct drm_device *dev = crtc->dev;
-	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
-	unsigned int crtc_w, crtc_h;
-	int ret;
-
-	/* when the page flip is requested, crtc's dpms should be on */
-	if (exynos_crtc->dpms > DRM_MODE_DPMS_ON) {
-		DRM_ERROR("failed page flip request.\n");
-		return -EINVAL;
-	}
-
-	if (!event)
-		return -EINVAL;
-
-	spin_lock_irq(&dev->event_lock);
-	if (exynos_crtc->event) {
-		ret = -EBUSY;
-		goto out;
-	}
-
-	ret = exynos_check_plane(crtc->primary, fb);
-	if (ret)
-		goto out;
-
-	ret = drm_vblank_get(dev, exynos_crtc->pipe);
-	if (ret) {
-		DRM_DEBUG("failed to acquire vblank counter\n");
-		goto out;
-	}
-
-	exynos_crtc->event = event;
-	spin_unlock_irq(&dev->event_lock);
-
-	/*
-	 * the pipe from user always is 0 so we can set pipe number
-	 * of current owner to event.
-	 */
-	event->pipe = exynos_crtc->pipe;
-
-	crtc->primary->fb = fb;
-	crtc_w = fb->width - crtc->x;
-	crtc_h = fb->height - crtc->y;
-	exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
-			    crtc_w, crtc_h, crtc->x, crtc->y,
-			    crtc_w, crtc_h);
-
-	if (crtc->primary->state)
-		drm_atomic_set_fb_for_plane(crtc->primary->state, fb);
-
-	return 0;
-
-out:
-	spin_unlock_irq(&dev->event_lock);
-	return ret;
-}
-
 static void exynos_drm_crtc_destroy(struct drm_crtc *crtc)
 {
 	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
@@ -197,7 +136,7 @@ static void exynos_drm_crtc_destroy(struct drm_crtc *crtc)
 
 static struct drm_crtc_funcs exynos_crtc_funcs = {
 	.set_config	= drm_atomic_helper_set_config,
-	.page_flip	= exynos_drm_crtc_page_flip,
+	.page_flip	= drm_atomic_helper_page_flip,
 	.destroy	= exynos_drm_crtc_destroy,
 	.reset = drm_atomic_helper_crtc_reset,
 	.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c
index b83ceea..b4bc3ef 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fb.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c
@@ -307,11 +307,18 @@ static void exynos_drm_output_poll_changed(struct drm_device *dev)
 		exynos_drm_fbdev_init(dev);
 }
 
+static int exynos_atomic_commit(struct drm_device *dev,
+				struct drm_atomic_state *state,
+				bool async)
+{
+	return drm_atomic_helper_commit(dev, state, false);
+}
+
 static const struct drm_mode_config_funcs exynos_drm_mode_config_funcs = {
 	.fb_create = exynos_user_fb_create,
 	.output_poll_changed = exynos_drm_output_poll_changed,
 	.atomic_check = drm_atomic_helper_check,
-	.atomic_commit = drm_atomic_helper_commit,
+	.atomic_commit = exynos_atomic_commit,
 };
 
 void exynos_drm_mode_config_init(struct drm_device *dev)
-- 
2.1.0

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

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

* [PATCH -v3 09/11] drm/exynos: remove exported functions from exynos_drm_plane
  2015-04-03 18:09 [PATCH -v3 00/11] drm/exynos: Add atomic modesetting support Gustavo Padovan
                   ` (7 preceding siblings ...)
  2015-04-03 18:09 ` [PATCH -v3 08/11] drm/exynos: atomic phase 3: convert page flips Gustavo Padovan
@ 2015-04-03 18:09 ` Gustavo Padovan
  2015-04-03 18:09 ` [PATCH -v3 10/11] drm/exynos: don't disable unused functions at init Gustavo Padovan
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 28+ messages in thread
From: Gustavo Padovan @ 2015-04-03 18:09 UTC (permalink / raw)
  To: linux-samsung-soc; +Cc: dri-devel, inki.dae, jy0922.shim, Gustavo Padovan

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

Now that no one is using the functions exported by exynos_drm_plane due
to the atomic conversion we can make remove some of the them or make them
static.

v2: remove unused exynos_drm_crtc

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/gpu/drm/exynos/exynos_drm_plane.c | 90 +++++++++++++------------------
 drivers/gpu/drm/exynos/exynos_drm_plane.h | 11 ----
 2 files changed, 37 insertions(+), 64 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index e83908a..5d3066d 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
@@ -62,35 +62,12 @@ static int exynos_plane_get_size(int start, unsigned length, unsigned last)
 	return size;
 }
 
-int exynos_check_plane(struct drm_plane *plane, struct drm_framebuffer *fb)
-{
-	struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
-	int nr;
-	int i;
-
-	nr = exynos_drm_fb_get_buf_cnt(fb);
-	for (i = 0; i < nr; i++) {
-		struct exynos_drm_gem_buf *buffer = exynos_drm_fb_buffer(fb, i);
-
-		if (!buffer) {
-			DRM_DEBUG_KMS("buffer is null\n");
-			return -EFAULT;
-		}
-
-		exynos_plane->dma_addr[i] = buffer->dma_addr;
-
-		DRM_DEBUG_KMS("buffer: %d, dma_addr = 0x%lx\n",
-				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)
+static 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);
 	unsigned int actual_w;
@@ -141,24 +118,6 @@ void exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc,
 	plane->crtc = crtc;
 }
 
-void
-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,
-		     uint32_t src_x, uint32_t src_y,
-		     uint32_t src_w, uint32_t src_h)
-{
-	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
-	struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
-
-	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);
-}
-
 static struct drm_plane_funcs exynos_plane_funcs = {
 	.update_plane	= drm_atomic_helper_update_plane,
 	.disable_plane	= drm_atomic_helper_disable_plane,
@@ -171,19 +130,44 @@ static struct drm_plane_funcs exynos_plane_funcs = {
 static int exynos_plane_atomic_check(struct drm_plane *plane,
 				     struct drm_plane_state *state)
 {
-	return exynos_check_plane(plane, state->fb);
+	struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
+	int nr;
+	int i;
+
+	nr = exynos_drm_fb_get_buf_cnt(state->fb);
+	for (i = 0; i < nr; i++) {
+		struct exynos_drm_gem_buf *buffer =
+					exynos_drm_fb_buffer(state->fb, i);
+
+		if (!buffer) {
+			DRM_DEBUG_KMS("buffer is null\n");
+			return -EFAULT;
+		}
+
+		exynos_plane->dma_addr[i] = buffer->dma_addr;
+
+		DRM_DEBUG_KMS("buffer: %d, dma_addr = 0x%lx\n",
+				i, (unsigned long)exynos_plane->dma_addr[i]);
+	}
+
+	return 0;
 }
 
 static void exynos_plane_atomic_update(struct drm_plane *plane,
 				       struct drm_plane_state *old_state)
 {
 	struct drm_plane_state *state = plane->state;
+	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(state->crtc);
+	struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
 
-	exynos_update_plane(plane, state->crtc, state->fb,
-			    state->crtc_x, state->crtc_y,
-			    state->crtc_w, state->crtc_h,
-			    state->src_x >> 16, state->src_y >> 16,
-			    state->src_w >> 16, state->src_h >> 16);
+	exynos_plane_mode_set(plane, state->crtc, state->fb,
+			      state->crtc_x, state->crtc_y,
+			      state->crtc_w, state->crtc_h,
+			      state->src_x >> 16, state->src_y >> 16,
+			      state->src_w >> 16, state->src_h >> 16);
+
+	if (exynos_crtc->ops->win_commit)
+		exynos_crtc->ops->win_commit(exynos_crtc, exynos_plane->zpos);
 }
 
 static void exynos_plane_atomic_disable(struct drm_plane *plane,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.h b/drivers/gpu/drm/exynos/exynos_drm_plane.h
index 560ca71..8c88ae9 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.h
@@ -9,17 +9,6 @@
  *
  */
 
-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);
-void 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,
-			uint32_t src_x, uint32_t src_y,
-			uint32_t src_w, uint32_t src_h);
 int exynos_plane_init(struct drm_device *dev,
 		      struct exynos_drm_plane *exynos_plane,
 		      unsigned long possible_crtcs, enum drm_plane_type type,
-- 
2.1.0

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

* [PATCH -v3 10/11] drm/exynos: don't disable unused functions at init
  2015-04-03 18:09 [PATCH -v3 00/11] drm/exynos: Add atomic modesetting support Gustavo Padovan
                   ` (8 preceding siblings ...)
  2015-04-03 18:09 ` [PATCH -v3 09/11] drm/exynos: remove exported functions from exynos_drm_plane Gustavo Padovan
@ 2015-04-03 18:09 ` Gustavo Padovan
  2015-04-03 18:09 ` [PATCH -v3 11/11] drm/exynos: atomic dpms support Gustavo Padovan
  2015-04-06 10:46 ` [PATCH -v3 00/11] drm/exynos: Add atomic modesetting support Inki Dae
  11 siblings, 0 replies; 28+ messages in thread
From: Gustavo Padovan @ 2015-04-03 18:09 UTC (permalink / raw)
  To: linux-samsung-soc; +Cc: dri-devel, inki.dae, jy0922.shim, Gustavo Padovan

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

Everything starts disabled so we don't really need to disable anything.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
index e71e331..e0b085b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
@@ -275,9 +275,6 @@ int exynos_drm_fbdev_init(struct drm_device *dev)
 
 	}
 
-	/* disable all the possible outputs/crtcs before entering KMS mode */
-	drm_helper_disable_unused_functions(dev);
-
 	ret = drm_fb_helper_initial_config(helper, PREFERRED_BPP);
 	if (ret < 0) {
 		DRM_ERROR("failed to set up hw configuration.\n");
-- 
2.1.0

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

* [PATCH -v3 11/11] drm/exynos: atomic dpms support
  2015-04-03 18:09 [PATCH -v3 00/11] drm/exynos: Add atomic modesetting support Gustavo Padovan
                   ` (9 preceding siblings ...)
  2015-04-03 18:09 ` [PATCH -v3 10/11] drm/exynos: don't disable unused functions at init Gustavo Padovan
@ 2015-04-03 18:09 ` Gustavo Padovan
  2015-04-05 14:42   ` Inki Dae
  2015-04-10 18:57   ` [PATCH] drm/exynos: remove unnecessary calls to disable_plane() Gustavo Padovan
  2015-04-06 10:46 ` [PATCH -v3 00/11] drm/exynos: Add atomic modesetting support Inki Dae
  11 siblings, 2 replies; 28+ messages in thread
From: Gustavo Padovan @ 2015-04-03 18:09 UTC (permalink / raw)
  To: linux-samsung-soc; +Cc: dri-devel, inki.dae, jy0922.shim, Gustavo Padovan

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

Run dpms operations through the atomic intefaces. This basically removes
the .dpms() callback from econders and crtcs and use .disable() and
.enable() to turn the crtc on and off.

v2: Address comments by Joonyoung:
	- make hdmi code call ->disable() instead of ->dpms()
	- do not use WARN_ON on crtc enable/disable

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/gpu/drm/exynos/exynos_dp_core.c       |  2 +-
 drivers/gpu/drm/exynos/exynos_drm_connector.c |  2 +-
 drivers/gpu/drm/exynos/exynos_drm_crtc.c      | 99 +++++++++++++++------------
 drivers/gpu/drm/exynos/exynos_drm_dpi.c       |  2 +-
 drivers/gpu/drm/exynos/exynos_drm_drv.h       |  4 +-
 drivers/gpu/drm/exynos/exynos_drm_dsi.c       |  2 +-
 drivers/gpu/drm/exynos/exynos_drm_encoder.c   | 27 ++------
 drivers/gpu/drm/exynos/exynos_drm_vidi.c      |  2 +-
 drivers/gpu/drm/exynos/exynos_hdmi.c          |  6 +-
 9 files changed, 70 insertions(+), 76 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c
index 6704d5c..e030d16 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -949,7 +949,7 @@ static void exynos_dp_connector_destroy(struct drm_connector *connector)
 }
 
 static struct drm_connector_funcs exynos_dp_connector_funcs = {
-	.dpms = drm_helper_connector_dpms,
+	.dpms = drm_atomic_helper_connector_dpms,
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.detect = exynos_dp_detect,
 	.destroy = exynos_dp_connector_destroy,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_connector.c b/drivers/gpu/drm/exynos/exynos_drm_connector.c
index 980b085..e459e64 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_connector.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_connector.c
@@ -179,7 +179,7 @@ static void exynos_drm_connector_destroy(struct drm_connector *connector)
 }
 
 static struct drm_connector_funcs exynos_connector_funcs = {
-	.dpms		= drm_helper_connector_dpms,
+	.dpms		= drm_atomic_helper_connector_dpms,
 	.fill_modes	= exynos_drm_connector_fill_modes,
 	.detect		= exynos_drm_connector_detect,
 	.destroy	= exynos_drm_connector_destroy,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 0db7b91..519c569 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -22,51 +22,57 @@
 #include "exynos_drm_encoder.h"
 #include "exynos_drm_plane.h"
 
-static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode)
+static void exynos_drm_crtc_enable(struct drm_crtc *crtc)
 {
 	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
+	struct exynos_drm_plane *exynos_plane = to_exynos_plane(crtc->primary);
 
-	DRM_DEBUG_KMS("crtc[%d] mode[%d]\n", crtc->base.id, mode);
-
-	if (exynos_crtc->dpms == mode) {
-		DRM_DEBUG_KMS("desired dpms mode is same as previous one.\n");
+	if (exynos_crtc->enabled)
 		return;
-	}
-
-	if (mode > DRM_MODE_DPMS_ON) {
-		/* wait for the completion of page flip. */
-		if (!wait_event_timeout(exynos_crtc->pending_flip_queue,
-				(exynos_crtc->event == NULL), HZ/20))
-			exynos_crtc->event = NULL;
-		drm_crtc_vblank_off(crtc);
-	}
 
 	if (exynos_crtc->ops->dpms)
-		exynos_crtc->ops->dpms(exynos_crtc, mode);
+		exynos_crtc->ops->dpms(exynos_crtc, DRM_MODE_DPMS_ON);
 
-	exynos_crtc->dpms = mode;
+	exynos_crtc->enabled = true;
 
-	if (mode == DRM_MODE_DPMS_ON)
-		drm_crtc_vblank_on(crtc);
-}
+	drm_crtc_vblank_on(crtc);
 
-static void exynos_drm_crtc_prepare(struct drm_crtc *crtc)
-{
-	/* drm framework doesn't check NULL. */
+	if (exynos_crtc->ops->win_commit)
+		exynos_crtc->ops->win_commit(exynos_crtc, exynos_plane->zpos);
+
+	if (exynos_crtc->ops->commit)
+		exynos_crtc->ops->commit(exynos_crtc);
 }
 
-static void exynos_drm_crtc_commit(struct drm_crtc *crtc)
+static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
 {
 	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
-	struct exynos_drm_plane *exynos_plane = to_exynos_plane(crtc->primary);
+	struct drm_plane *plane;
+	int ret;
+
+	if (!exynos_crtc->enabled)
+		return;
 
-	exynos_drm_crtc_dpms(crtc, DRM_MODE_DPMS_ON);
+	/* wait for the completion of page flip. */
+	if (!wait_event_timeout(exynos_crtc->pending_flip_queue,
+				(exynos_crtc->event == NULL), HZ/20))
+		exynos_crtc->event = NULL;
 
-	if (exynos_crtc->ops->win_commit)
-		exynos_crtc->ops->win_commit(exynos_crtc, exynos_plane->zpos);
+	drm_crtc_vblank_off(crtc);
 
-	if (exynos_crtc->ops->commit)
-		exynos_crtc->ops->commit(exynos_crtc);
+	if (exynos_crtc->ops->dpms)
+		exynos_crtc->ops->dpms(exynos_crtc, DRM_MODE_DPMS_OFF);
+
+	exynos_crtc->enabled = false;
+
+	drm_for_each_legacy_plane(plane, &crtc->dev->mode_config.plane_list) {
+		if (plane->crtc != crtc)
+			continue;
+
+		ret = plane->funcs->disable_plane(plane);
+		if (ret)
+			DRM_ERROR("Failed to disable plane %d\n", ret);
+	}
 }
 
 static bool
@@ -95,32 +101,36 @@ exynos_drm_crtc_mode_set_nofb(struct drm_crtc *crtc)
 		exynos_crtc->ops->commit(exynos_crtc);
 }
 
-static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
+static int exynos_crtc_atomic_check(struct drm_crtc *crtc,
+				     struct drm_crtc_state *state)
 {
-	struct drm_plane *plane;
+	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
 	int ret;
 
-	exynos_drm_crtc_dpms(crtc, DRM_MODE_DPMS_OFF);
+	if (exynos_crtc->event)
+		return -EBUSY;
 
-	drm_for_each_legacy_plane(plane, &crtc->dev->mode_config.plane_list) {
-		if (plane->crtc != crtc)
-			continue;
+	if (state->event) {
+		ret = drm_vblank_get(crtc->dev, exynos_crtc->pipe);
+		if (ret) {
+			DRM_ERROR("failed to acquire vblank counter\n");
+			return ret;
+		}
 
-		ret = plane->funcs->disable_plane(plane);
-		if (ret)
-			DRM_ERROR("Failed to disable plane %d\n", ret);
+		exynos_crtc->event = state->event;
 	}
+
+	return 0;
 }
 
 static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
-	.dpms		= exynos_drm_crtc_dpms,
-	.prepare	= exynos_drm_crtc_prepare,
-	.commit		= exynos_drm_crtc_commit,
+	.enable		= exynos_drm_crtc_enable,
+	.disable	= exynos_drm_crtc_disable,
 	.mode_fixup	= exynos_drm_crtc_mode_fixup,
 	.mode_set	= drm_helper_crtc_mode_set,
 	.mode_set_nofb	= exynos_drm_crtc_mode_set_nofb,
 	.mode_set_base	= drm_helper_crtc_mode_set_base,
-	.disable	= exynos_drm_crtc_disable,
+	.atomic_check	= exynos_crtc_atomic_check,
 };
 
 static void exynos_drm_crtc_destroy(struct drm_crtc *crtc)
@@ -162,7 +172,6 @@ struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev,
 
 	init_waitqueue_head(&exynos_crtc->pending_flip_queue);
 
-	exynos_crtc->dpms = DRM_MODE_DPMS_OFF;
 	exynos_crtc->pipe = pipe;
 	exynos_crtc->type = type;
 	exynos_crtc->ops = ops;
@@ -193,7 +202,7 @@ int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int pipe)
 	struct exynos_drm_crtc *exynos_crtc =
 		to_exynos_crtc(private->crtc[pipe]);
 
-	if (exynos_crtc->dpms != DRM_MODE_DPMS_ON)
+	if (!exynos_crtc->enabled)
 		return -EPERM;
 
 	if (exynos_crtc->ops->enable_vblank)
@@ -208,7 +217,7 @@ void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int pipe)
 	struct exynos_drm_crtc *exynos_crtc =
 		to_exynos_crtc(private->crtc[pipe]);
 
-	if (exynos_crtc->dpms != DRM_MODE_DPMS_ON)
+	if (!exynos_crtc->enabled)
 		return;
 
 	if (exynos_crtc->ops->disable_vblank)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
index ced5c23..6dc328e 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
@@ -60,7 +60,7 @@ static void exynos_dpi_connector_destroy(struct drm_connector *connector)
 }
 
 static struct drm_connector_funcs exynos_dpi_connector_funcs = {
-	.dpms = drm_helper_connector_dpms,
+	.dpms = drm_atomic_helper_connector_dpms,
 	.detect = exynos_dpi_detect,
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.destroy = exynos_dpi_connector_destroy,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index a1013aa..a7b708e 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -205,7 +205,7 @@ struct exynos_drm_crtc_ops {
  *	drm framework doesn't support multiple irq yet.
  *	we can refer to the crtc to current hardware interrupt occurred through
  *	this pipe value.
- * @dpms: store the crtc dpms value
+ * @enabled: if the crtc is enabled or not
  * @event: vblank event that is currently queued for flip
  * @ops: pointer to callbacks for exynos drm specific functionality
  * @ctx: A pointer to the crtc's implementation specific context
@@ -214,7 +214,7 @@ struct exynos_drm_crtc {
 	struct drm_crtc			base;
 	enum exynos_drm_output_type	type;
 	unsigned int			pipe;
-	unsigned int			dpms;
+	bool				enabled;
 	wait_queue_head_t		pending_flip_queue;
 	struct drm_pending_vblank_event	*event;
 	struct exynos_drm_crtc_ops	*ops;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
index 6e9c2c3..28233a5 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
@@ -1458,7 +1458,7 @@ static void exynos_dsi_connector_destroy(struct drm_connector *connector)
 }
 
 static struct drm_connector_funcs exynos_dsi_connector_funcs = {
-	.dpms = drm_helper_connector_dpms,
+	.dpms = drm_atomic_helper_connector_dpms,
 	.detect = exynos_dsi_detect,
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.destroy = exynos_dsi_connector_destroy,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
index 57de0bd..0648ba4 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
@@ -32,17 +32,6 @@ struct exynos_drm_encoder {
 	struct exynos_drm_display	*display;
 };
 
-static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode)
-{
-	struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder);
-	struct exynos_drm_display *display = exynos_encoder->display;
-
-	DRM_DEBUG_KMS("encoder dpms: %d\n", mode);
-
-	if (display->ops->dpms)
-		display->ops->dpms(display, mode);
-}
-
 static bool
 exynos_drm_encoder_mode_fixup(struct drm_encoder *encoder,
 			       const struct drm_display_mode *mode,
@@ -76,12 +65,7 @@ static void exynos_drm_encoder_mode_set(struct drm_encoder *encoder,
 		display->ops->mode_set(display, adjusted_mode);
 }
 
-static void exynos_drm_encoder_prepare(struct drm_encoder *encoder)
-{
-	/* drm framework doesn't check NULL. */
-}
-
-static void exynos_drm_encoder_commit(struct drm_encoder *encoder)
+static void exynos_drm_encoder_enable(struct drm_encoder *encoder)
 {
 	struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder);
 	struct exynos_drm_display *display = exynos_encoder->display;
@@ -95,10 +79,13 @@ static void exynos_drm_encoder_commit(struct drm_encoder *encoder)
 
 static void exynos_drm_encoder_disable(struct drm_encoder *encoder)
 {
+	struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder);
+	struct exynos_drm_display *display = exynos_encoder->display;
 	struct drm_plane *plane;
 	struct drm_device *dev = encoder->dev;
 
-	exynos_drm_encoder_dpms(encoder, DRM_MODE_DPMS_OFF);
+	if (display->ops->dpms)
+		display->ops->dpms(display, DRM_MODE_DPMS_OFF);
 
 	/* all planes connected to this encoder should be also disabled. */
 	drm_for_each_legacy_plane(plane, &dev->mode_config.plane_list) {
@@ -108,11 +95,9 @@ static void exynos_drm_encoder_disable(struct drm_encoder *encoder)
 }
 
 static struct drm_encoder_helper_funcs exynos_encoder_helper_funcs = {
-	.dpms		= exynos_drm_encoder_dpms,
 	.mode_fixup	= exynos_drm_encoder_mode_fixup,
 	.mode_set	= exynos_drm_encoder_mode_set,
-	.prepare	= exynos_drm_encoder_prepare,
-	.commit		= exynos_drm_encoder_commit,
+	.enable		= exynos_drm_encoder_enable,
 	.disable	= exynos_drm_encoder_disable,
 };
 
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
index ee842c0..5e4c181 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
@@ -385,7 +385,7 @@ static void vidi_connector_destroy(struct drm_connector *connector)
 }
 
 static struct drm_connector_funcs vidi_connector_funcs = {
-	.dpms = drm_helper_connector_dpms,
+	.dpms = drm_atomic_helper_connector_dpms,
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.detect = vidi_detect,
 	.destroy = vidi_connector_destroy,
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 5b597bc..2ea7d01 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -1051,7 +1051,7 @@ static void hdmi_connector_destroy(struct drm_connector *connector)
 }
 
 static struct drm_connector_funcs hdmi_connector_funcs = {
-	.dpms = drm_helper_connector_dpms,
+	.dpms = drm_atomic_helper_connector_dpms,
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.detect = hdmi_detect,
 	.destroy = hdmi_connector_destroy,
@@ -2127,8 +2127,8 @@ static void hdmi_dpms(struct exynos_drm_display *display, int mode)
 		 */
 		if (crtc)
 			funcs = crtc->helper_private;
-		if (funcs && funcs->dpms)
-			(*funcs->dpms)(crtc, mode);
+		if (funcs && funcs->disable)
+			(*funcs->disable)(crtc, mode);
 
 		hdmi_poweroff(hdata);
 		break;
-- 
2.1.0

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

* Re: [PATCH -v3 11/11] drm/exynos: atomic dpms support
  2015-04-03 18:09 ` [PATCH -v3 11/11] drm/exynos: atomic dpms support Gustavo Padovan
@ 2015-04-05 14:42   ` Inki Dae
  2015-04-06 18:26     ` Gustavo Padovan
  2015-04-10 18:57   ` [PATCH] drm/exynos: remove unnecessary calls to disable_plane() Gustavo Padovan
  1 sibling, 1 reply; 28+ messages in thread
From: Inki Dae @ 2015-04-05 14:42 UTC (permalink / raw)
  To: Gustavo Padovan; +Cc: linux-samsung-soc, Gustavo Padovan, DRI mailing list

Hi,

2015-04-04 3:09 GMT+09:00 Gustavo Padovan <gustavo@padovan.org>:
> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>
> Run dpms operations through the atomic intefaces. This basically removes
> the .dpms() callback from econders and crtcs and use .disable() and
> .enable() to turn the crtc on and off.
>
> v2: Address comments by Joonyoung:
>         - make hdmi code call ->disable() instead of ->dpms()
>         - do not use WARN_ON on crtc enable/disable
>
> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> ---
>  drivers/gpu/drm/exynos/exynos_dp_core.c       |  2 +-
>  drivers/gpu/drm/exynos/exynos_drm_connector.c |  2 +-
>  drivers/gpu/drm/exynos/exynos_drm_crtc.c      | 99 +++++++++++++++------------
>  drivers/gpu/drm/exynos/exynos_drm_dpi.c       |  2 +-
>  drivers/gpu/drm/exynos/exynos_drm_drv.h       |  4 +-
>  drivers/gpu/drm/exynos/exynos_drm_dsi.c       |  2 +-
>  drivers/gpu/drm/exynos/exynos_drm_encoder.c   | 27 ++------
>  drivers/gpu/drm/exynos/exynos_drm_vidi.c      |  2 +-
>  drivers/gpu/drm/exynos/exynos_hdmi.c          |  6 +-
>  9 files changed, 70 insertions(+), 76 deletions(-)
>

...snip...

> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
> index 5b597bc..2ea7d01 100644
> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
> @@ -1051,7 +1051,7 @@ static void hdmi_connector_destroy(struct drm_connector *connector)
>  }
>
>  static struct drm_connector_funcs hdmi_connector_funcs = {
> -       .dpms = drm_helper_connector_dpms,
> +       .dpms = drm_atomic_helper_connector_dpms,
>         .fill_modes = drm_helper_probe_single_connector_modes,
>         .detect = hdmi_detect,
>         .destroy = hdmi_connector_destroy,
> @@ -2127,8 +2127,8 @@ static void hdmi_dpms(struct exynos_drm_display *display, int mode)
>                  */
>                 if (crtc)
>                         funcs = crtc->helper_private;
> -               if (funcs && funcs->dpms)
> -                       (*funcs->dpms)(crtc, mode);
> +               if (funcs && funcs->disable)
> +                       (*funcs->disable)(crtc, mode);

This patch makes funcs->disable callback to be called instead of
funcs->dpms callback. However, funcs->disable callback isn't required
for second argument so the build is failed like below,

drivers/gpu/drm/exynos/exynos_hdmi.c: In function 'hdmi_dpms':
drivers/gpu/drm/exynos/exynos_hdmi.c:2131:4: error: too many arguments
to function 'funcs->disable'

Please, keep in mind that you should build it and at least have a
basic test before posting.

Thanks,
Inki Dae

>
>                 hdmi_poweroff(hdata);
>                 break;
> --
> 2.1.0
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH -v3 00/11] drm/exynos: Add atomic modesetting support
  2015-04-03 18:09 [PATCH -v3 00/11] drm/exynos: Add atomic modesetting support Gustavo Padovan
                   ` (10 preceding siblings ...)
  2015-04-03 18:09 ` [PATCH -v3 11/11] drm/exynos: atomic dpms support Gustavo Padovan
@ 2015-04-06 10:46 ` Inki Dae
  2015-04-06 15:44   ` Inki Dae
  11 siblings, 1 reply; 28+ messages in thread
From: Inki Dae @ 2015-04-06 10:46 UTC (permalink / raw)
  To: Gustavo Padovan; +Cc: linux-samsung-soc, Gustavo Padovan, dri-devel

On 2015년 04월 04일 03:09, Gustavo Padovan wrote:
> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> 
> Hi,
> 
> Here goes the full support for atomic modesetting on exynos. I've
> split the patches in the various phases of atomic support.
> 
> These patches sits on top of the clean up patches I've sent yesterday
> to this mailing list[1].
> 
> v2: fixes comments by Joonyoung
>         - remove unused var in patch 09
>         - use ->disable instead of outdated ->dpms in hdmi code
>         - remove WARN_ON from crtc enable/disable
> 
> v3: fixes comment by Joonyoung
> 	- move the removal of drm_helper_disable_unused_functions() to 
> 	separated patch

With this patch series, Kernel booting is halted at end of kernel
booting. I tested this patch series on Trats2 board based on Exynos4412 SoC.

Below is a part of full booting logs, which was halted,
[    1.992015] exynos-drm-ipp exynos-drm-ipp: drm ipp registered
successfully.
[    1.993009] exynos-drm exynos-drm: bound exynos-drm-vidi (ops
vidi_component_ops)
[    1.993036] exynos-drm exynos-drm: bound 11c00000.fimd (ops
fimd_component_ops)
[    1.993385] exynos-drm exynos-drm: bound 11c80000.dsi (ops
exynos_dsi_component_ops)
[    1.993390] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[    1.993393] [drm] No driver support for vblank timestamp query.
[    1.993442] [drm] Initialized exynos 1.0.0 20110530 on minor 0
[    2.043358] WARNING: CPU: 2 PID: 1209 at drivers/clk/clk.c:898
clk_unprepare+0x24/0x2c()
[    2.051412] Modules linked in:
[    2.054422] CPU: 2 PID: 1209 Comm: kworker/2:1 Tainted: G        W
    4.0.0-rc6-00526-gc49d7de-dirty #1278
[    2.064337] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[    2.070428] Workqueue: pm pm_runtime_work>\x1e\x02

After that, I tested it again without FIMD and the booting is ok. So I
guess that this atomic feature has a bug to FIMD driver.

Thanks,
Inki Dae

> 
> 	Gustavo
> ---
> 
> Gustavo Padovan (11):
>   drm/exynos: atomic phase 1: use drm_plane_helper_update()
>   drm/exynos: atomic phase 1: use drm_plane_helper_disable()
>   drm/exynos: atomic phase 1: add .mode_set_nofb() callback
>   drm/exynos: atomic phase 2: wire up state reset(), duplicate() and
>     destroy()
>   drm/exynos: atomic phase 2: keep track of framebuffer pointer
>   drm/exynos: atomic phase 3: atomic updates of planes
>   drm/exynos: atomic phase 3: use atomic .set_config helper
>   drm/exynos: atomic phase 3: convert page flips
>   drm/exynos: remove exported functions from exynos_drm_plane
>   drm/exynos: don't disable unused functions at init
>   drm/exynos: atomic dpms support
> 
>  drivers/gpu/drm/bridge/ptn3460.c              |   4 +
>  drivers/gpu/drm/exynos/exynos_dp_core.c       |   6 +-
>  drivers/gpu/drm/exynos/exynos_drm_connector.c |   6 +-
>  drivers/gpu/drm/exynos/exynos_drm_crtc.c      | 226 ++++++++------------------
>  drivers/gpu/drm/exynos/exynos_drm_dpi.c       |   6 +-
>  drivers/gpu/drm/exynos/exynos_drm_drv.c       |   2 +
>  drivers/gpu/drm/exynos/exynos_drm_drv.h       |   4 +-
>  drivers/gpu/drm/exynos/exynos_drm_dsi.c       |   6 +-
>  drivers/gpu/drm/exynos/exynos_drm_encoder.c   |  27 +--
>  drivers/gpu/drm/exynos/exynos_drm_fb.c        |  12 +-
>  drivers/gpu/drm/exynos/exynos_drm_fbdev.c     |   3 -
>  drivers/gpu/drm/exynos/exynos_drm_plane.c     | 113 +++++++------
>  drivers/gpu/drm/exynos/exynos_drm_plane.h     |  11 --
>  drivers/gpu/drm/exynos/exynos_drm_vidi.c      |   6 +-
>  drivers/gpu/drm/exynos/exynos_hdmi.c          |  10 +-
>  15 files changed, 187 insertions(+), 255 deletions(-)
> 

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

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

* Re: [PATCH -v3 00/11] drm/exynos: Add atomic modesetting support
  2015-04-06 10:46 ` [PATCH -v3 00/11] drm/exynos: Add atomic modesetting support Inki Dae
@ 2015-04-06 15:44   ` Inki Dae
  2015-04-07  7:06     ` Inki Dae
  0 siblings, 1 reply; 28+ messages in thread
From: Inki Dae @ 2015-04-06 15:44 UTC (permalink / raw)
  To: Gustavo Padovan; +Cc: linux-samsung-soc, Gustavo Padovan, dri-devel

2015-04-06 19:46 GMT+09:00 Inki Dae <inki.dae@samsung.com>:
> On 2015년 04월 04일 03:09, Gustavo Padovan wrote:
>> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>>
>> Hi,
>>
>> Here goes the full support for atomic modesetting on exynos. I've
>> split the patches in the various phases of atomic support.
>>
>> These patches sits on top of the clean up patches I've sent yesterday
>> to this mailing list[1].
>>
>> v2: fixes comments by Joonyoung
>>         - remove unused var in patch 09
>>         - use ->disable instead of outdated ->dpms in hdmi code
>>         - remove WARN_ON from crtc enable/disable
>>
>> v3: fixes comment by Joonyoung
>>       - move the removal of drm_helper_disable_unused_functions() to
>>       separated patch
>
> With this patch series, Kernel booting is halted at end of kernel
> booting. I tested this patch series on Trats2 board based on Exynos4412 SoC.
>
> Below is a part of full booting logs, which was halted,
> [    1.992015] exynos-drm-ipp exynos-drm-ipp: drm ipp registered
> successfully.
> [    1.993009] exynos-drm exynos-drm: bound exynos-drm-vidi (ops
> vidi_component_ops)
> [    1.993036] exynos-drm exynos-drm: bound 11c00000.fimd (ops
> fimd_component_ops)
> [    1.993385] exynos-drm exynos-drm: bound 11c80000.dsi (ops
> exynos_dsi_component_ops)
> [    1.993390] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
> [    1.993393] [drm] No driver support for vblank timestamp query.
> [    1.993442] [drm] Initialized exynos 1.0.0 20110530 on minor 0
> [    2.043358] WARNING: CPU: 2 PID: 1209 at drivers/clk/clk.c:898
> clk_unprepare+0x24/0x2c()
> [    2.051412] Modules linked in:
> [    2.054422] CPU: 2 PID: 1209 Comm: kworker/2:1 Tainted: G        W
>     4.0.0-rc6-00526-gc49d7de-dirty #1278
> [    2.064337] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
> [    2.070428] Workqueue: pm pm_runtime_work>
>
> After that, I tested it again without FIMD and the booting is ok. So I
> guess that this atomic feature has a bug to FIMD driver.
>

More information,

The reason the booting is halted is that a deadlock occurs at fbcon
module when register_framebuffer() is called.

Below are our test results,
- with only cleanup series, FIMD and HDMI work well.
- with cleanup and atomic series, HDMI works well but FIMD doesn't
work - a deadlock occurs.

Could anyone test it with the atomic series on trats2 board? You can
test it on top of exynos-drm-next-todo branch which contains all
relevant patches,
https://git.kernel.org/cgit/linux/kernel/git/daeinki/drm-exynos.git/log/?h=exynos-drm-next-todo

Anyway, we will continue to take a look at the this issue why the
deadlock occurs.

Thanks,
Inki Dae

> Thanks,
> Inki Dae
>
>>
>>       Gustavo
>> ---
>>
>> Gustavo Padovan (11):
>>   drm/exynos: atomic phase 1: use drm_plane_helper_update()
>>   drm/exynos: atomic phase 1: use drm_plane_helper_disable()
>>   drm/exynos: atomic phase 1: add .mode_set_nofb() callback
>>   drm/exynos: atomic phase 2: wire up state reset(), duplicate() and
>>     destroy()
>>   drm/exynos: atomic phase 2: keep track of framebuffer pointer
>>   drm/exynos: atomic phase 3: atomic updates of planes
>>   drm/exynos: atomic phase 3: use atomic .set_config helper
>>   drm/exynos: atomic phase 3: convert page flips
>>   drm/exynos: remove exported functions from exynos_drm_plane
>>   drm/exynos: don't disable unused functions at init
>>   drm/exynos: atomic dpms support
>>
>>  drivers/gpu/drm/bridge/ptn3460.c              |   4 +
>>  drivers/gpu/drm/exynos/exynos_dp_core.c       |   6 +-
>>  drivers/gpu/drm/exynos/exynos_drm_connector.c |   6 +-
>>  drivers/gpu/drm/exynos/exynos_drm_crtc.c      | 226 ++++++++------------------
>>  drivers/gpu/drm/exynos/exynos_drm_dpi.c       |   6 +-
>>  drivers/gpu/drm/exynos/exynos_drm_drv.c       |   2 +
>>  drivers/gpu/drm/exynos/exynos_drm_drv.h       |   4 +-
>>  drivers/gpu/drm/exynos/exynos_drm_dsi.c       |   6 +-
>>  drivers/gpu/drm/exynos/exynos_drm_encoder.c   |  27 +--
>>  drivers/gpu/drm/exynos/exynos_drm_fb.c        |  12 +-
>>  drivers/gpu/drm/exynos/exynos_drm_fbdev.c     |   3 -
>>  drivers/gpu/drm/exynos/exynos_drm_plane.c     | 113 +++++++------
>>  drivers/gpu/drm/exynos/exynos_drm_plane.h     |  11 --
>>  drivers/gpu/drm/exynos/exynos_drm_vidi.c      |   6 +-
>>  drivers/gpu/drm/exynos/exynos_hdmi.c          |  10 +-
>>  15 files changed, 187 insertions(+), 255 deletions(-)
>>
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH -v3 11/11] drm/exynos: atomic dpms support
  2015-04-05 14:42   ` Inki Dae
@ 2015-04-06 18:26     ` Gustavo Padovan
  2015-04-07  7:22       ` Joonyoung Shim
  0 siblings, 1 reply; 28+ messages in thread
From: Gustavo Padovan @ 2015-04-06 18:26 UTC (permalink / raw)
  To: Inki Dae; +Cc: linux-samsung-soc, Gustavo Padovan, DRI mailing list

Hi Inki,

2015-04-05 Inki Dae <inki.dae@samsung.com>:

> Hi,
> 
> 2015-04-04 3:09 GMT+09:00 Gustavo Padovan <gustavo@padovan.org>:
> > From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> >
> > Run dpms operations through the atomic intefaces. This basically removes
> > the .dpms() callback from econders and crtcs and use .disable() and
> > .enable() to turn the crtc on and off.
> >
> > v2: Address comments by Joonyoung:
> >         - make hdmi code call ->disable() instead of ->dpms()
> >         - do not use WARN_ON on crtc enable/disable
> >
> > Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> > ---
> >  drivers/gpu/drm/exynos/exynos_dp_core.c       |  2 +-
> >  drivers/gpu/drm/exynos/exynos_drm_connector.c |  2 +-
> >  drivers/gpu/drm/exynos/exynos_drm_crtc.c      | 99 +++++++++++++++------------
> >  drivers/gpu/drm/exynos/exynos_drm_dpi.c       |  2 +-
> >  drivers/gpu/drm/exynos/exynos_drm_drv.h       |  4 +-
> >  drivers/gpu/drm/exynos/exynos_drm_dsi.c       |  2 +-
> >  drivers/gpu/drm/exynos/exynos_drm_encoder.c   | 27 ++------
> >  drivers/gpu/drm/exynos/exynos_drm_vidi.c      |  2 +-
> >  drivers/gpu/drm/exynos/exynos_hdmi.c          |  6 +-
> >  9 files changed, 70 insertions(+), 76 deletions(-)
> >
> 
> ...snip...
> 
> > diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
> > index 5b597bc..2ea7d01 100644
> > --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
> > +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
> > @@ -1051,7 +1051,7 @@ static void hdmi_connector_destroy(struct drm_connector *connector)
> >  }
> >
> >  static struct drm_connector_funcs hdmi_connector_funcs = {
> > -       .dpms = drm_helper_connector_dpms,
> > +       .dpms = drm_atomic_helper_connector_dpms,
> >         .fill_modes = drm_helper_probe_single_connector_modes,
> >         .detect = hdmi_detect,
> >         .destroy = hdmi_connector_destroy,
> > @@ -2127,8 +2127,8 @@ static void hdmi_dpms(struct exynos_drm_display *display, int mode)
> >                  */
> >                 if (crtc)
> >                         funcs = crtc->helper_private;
> > -               if (funcs && funcs->dpms)
> > -                       (*funcs->dpms)(crtc, mode);
> > +               if (funcs && funcs->disable)
> > +                       (*funcs->disable)(crtc, mode);
> 
> This patch makes funcs->disable callback to be called instead of
> funcs->dpms callback. However, funcs->disable callback isn't required
> for second argument so the build is failed like below,
> 
> drivers/gpu/drm/exynos/exynos_hdmi.c: In function 'hdmi_dpms':
> drivers/gpu/drm/exynos/exynos_hdmi.c:2131:4: error: too many arguments
> to function 'funcs->disable'
> 
> Please, keep in mind that you should build it and at least have a
> basic test before posting.

Sure, I think this happened because I've been using exynos_defconfig to test
my kernels and HDMI is not there. Maybe should we add the EXYNOS_DRM_HDMI to
defconfig? What do you think?

	Gustavo

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

* Re: [PATCH -v3 00/11] drm/exynos: Add atomic modesetting support
  2015-04-06 15:44   ` Inki Dae
@ 2015-04-07  7:06     ` Inki Dae
  2015-04-07 11:14       ` Inki Dae
  2015-04-07 18:39       ` Gustavo Padovan
  0 siblings, 2 replies; 28+ messages in thread
From: Inki Dae @ 2015-04-07  7:06 UTC (permalink / raw)
  To: Gustavo Padovan; +Cc: linux-samsung-soc, Gustavo Padovan, dri-devel

On 2015년 04월 07일 00:44, Inki Dae wrote:
> 2015-04-06 19:46 GMT+09:00 Inki Dae <inki.dae@samsung.com>:
>> On 2015년 04월 04일 03:09, Gustavo Padovan wrote:
>>> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>>>
>>> Hi,
>>>
>>> Here goes the full support for atomic modesetting on exynos. I've
>>> split the patches in the various phases of atomic support.
>>>
>>> These patches sits on top of the clean up patches I've sent yesterday
>>> to this mailing list[1].
>>>
>>> v2: fixes comments by Joonyoung
>>>         - remove unused var in patch 09
>>>         - use ->disable instead of outdated ->dpms in hdmi code
>>>         - remove WARN_ON from crtc enable/disable
>>>
>>> v3: fixes comment by Joonyoung
>>>       - move the removal of drm_helper_disable_unused_functions() to
>>>       separated patch
>>
>> With this patch series, Kernel booting is halted at end of kernel
>> booting. I tested this patch series on Trats2 board based on Exynos4412 SoC.
>>
>> Below is a part of full booting logs, which was halted,
>> [    1.992015] exynos-drm-ipp exynos-drm-ipp: drm ipp registered
>> successfully.
>> [    1.993009] exynos-drm exynos-drm: bound exynos-drm-vidi (ops
>> vidi_component_ops)
>> [    1.993036] exynos-drm exynos-drm: bound 11c00000.fimd (ops
>> fimd_component_ops)
>> [    1.993385] exynos-drm exynos-drm: bound 11c80000.dsi (ops
>> exynos_dsi_component_ops)
>> [    1.993390] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
>> [    1.993393] [drm] No driver support for vblank timestamp query.
>> [    1.993442] [drm] Initialized exynos 1.0.0 20110530 on minor 0
>> [    2.043358] WARNING: CPU: 2 PID: 1209 at drivers/clk/clk.c:898
>> clk_unprepare+0x24/0x2c()
>> [    2.051412] Modules linked in:
>> [    2.054422] CPU: 2 PID: 1209 Comm: kworker/2:1 Tainted: G        W
>>     4.0.0-rc6-00526-gc49d7de-dirty #1278
>> [    2.064337] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
>> [    2.070428] Workqueue: pm pm_runtime_work>
>>
>> After that, I tested it again without FIMD and the booting is ok. So I
>> guess that this atomic feature has a bug to FIMD driver.
>>
> 
> More information,
> 
> The reason the booting is halted is that a deadlock occurs at fbcon
> module when register_framebuffer() is called.
> 
> Below are our test results,
> - with only cleanup series, FIMD and HDMI work well.
> - with cleanup and atomic series, HDMI works well but FIMD doesn't
> work - a deadlock occurs.
> 
> Could anyone test it with the atomic series on trats2 board? You can
> test it on top of exynos-drm-next-todo branch which contains all
> relevant patches,
> https://git.kernel.org/cgit/linux/kernel/git/daeinki/drm-exynos.git/log/?h=exynos-drm-next-todo
> 
> Anyway, we will continue to take a look at the this issue why the
> deadlock occurs.

In addition,

I added some codes temporarily to fbmem module which mitigates the
deadlock issue. After that, I see below panic log,

[    3.254840] Unable to handle kernel NULL pointer dereference at
virtual address 000000a4
[    3.262870] pgd = c0004000
[    3.265539] [000000a4] *pgd=00000000
[    3.269102] Internal error: Oops: 5 [#1] PREEMPT SMP ARM
[    3.274392] Modules linked in:
[    3.277435] CPU: 2 PID: 1 Comm: swapper/0 Tainted: G        W
4.0.0-rc6-00526-gc49d7de-dirty #1308
[    3.286892] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[    3.292970] task: ee878000 ti: ee880000 task.ti: ee880000
[    3.298356] PC is at exynos_plane_atomic_update+0x24/0x1d4
[    3.303824] LR is at drm_atomic_helper_commit_planes+0xa4/0x18c
[    3.309723] pc : [<c028bff4>]    lr : [<c0265308>]    psr: 60000113
[    3.309723] sp : ee881b38  ip : 00000020  fp : 00000000
[    3.321179] r10: c04cfc00  r9 : 00000008  r8 : eebfb9c0
[    3.326387] r7 : 00000002  r6 : 00000000  r5 : 00000000  r4 : ee925308
[    3.332897] r3 : ee329fc0  r2 : 00000000  r1 : 00000000  r0 : ee925308
[    3.339409] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM
Segment kernel
[    3.346699] Control: 10c5387d  Table: 4000404a  DAC: 00000015
[    3.352427] Process swapper/0 (pid: 1, stack limit = 0xee880210)
[    3.358416] Stack: (0xee881b38 to 0xee882000)
[    3.362757] 1b20:
   c0726794 00000008
[    3.370919] 1b40: 00000002 ee925308 00000000 ee329e00 00000002
eebfb9c0 00000008 c04cfc00
[    3.379078] 1b60: 00000000 c0265308 00000008 00000000 ee329e00
ee0a8000 00000008 00000000
[    3.387237] 1b80: 00000000 c0267304 ee329e00 ee8efe00 ee914c00
00000002 00000000 00000002
[    3.395396] 1ba0: 00000000 c026609c c0265ef0 00000000 ee914c00
00000028 ee8eff00 00000001
[    3.403555] 1bc0: 00000000 c06c8380 00000000 c02770d0 ee8efe00
00000000 00000028 ee8eff00
[    3.411714] 1be0: 00000001 c0267a2c ee0a8000 c0286214 ee8eff00
ee8eff00 ee0a8000 00000000
[    3.419874] 1c00: 00000000 c0722ad4 ee35e000 c0269900 00000000
ee915400 00000000 c0269958
[    3.428033] 1c20: ee808c00 c020cc8c c0248620 c05d5448 ee808c00
ee808c00 ee808d34 00000000
[    3.436192] 1c40: 00000000 00000001 00000066 c0724acc c0724fd4
0000005b 00000066 0000005b
[    3.444351] 1c60: c05b28cc ee808c00 ee808d74 00000000 00000000
00000001 ee808c00 00000000
[    3.452511] 1c80: 00000001 c0246564 c04b4950 00000000 c0724fdc
c07250f0 00000001 c0248568
[    3.460670] 1ca0: c049cc58 c06ce2e4 00000000 0000003e c070da2c
c05d09ec 00000000 c0724fcc
[    3.468829] 1cc0: 00000000 c04b4950 c0724fe8 00000000 00000000
00000000 0000003e 00000000
[    3.476988] 1ce0: c0725604 c0248de0 c05d54ac 00000001 ee074780
00000001 c0724920 c06c8380
[    3.485148] 1d00: c0724acc 00008380 00000005 00000000 00000000
01d00000 00000000 c020cd5c
[    3.493306] 1d20: c06c8754 ffffffff ee881d88 c0039890 c06c8754
00000005 ee881d88 ffffffff
[    3.501466] 1d40: ee915644 ee91540c 01d00000 c0039bec 00000000
00000000 ee915644 c06badb8
[    3.509625] 1d60: ee915400 c06badb8 00000000 c0039c1c 00000000
ee915400 c06badb8 c0215980
[    3.517784] 1d80: c05d101c 00000000 ee915400 00000000 00000000
00000000 000002d0 00000500
[    3.525943] 1da0: 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000
[    3.534103] 1dc0: 00000000 00000020 ee8efe50 ee8eff00 ee915400
00000001 ee8efe50 c0726794
[    3.542262] 1de0: 00000002 c0269bc4 000002d0 00000500 000002d0
00000500 00000020 00000018
[    3.550421] 1e00: ee0a8000 00000000 eebfbdc0 ee8eff00 ee0a8190
c028a374 ee0a8288 00000001
[    3.558580] 1e20: ee0a8294 ee0a8000 ee0a8190 c025ff20 00000000
c0491308 c06933e0 c0492b3c
[    3.566740] 1e40: ee08b374 ee914428 ee9000d4 ee08b200 ee08b208
00000000 00000098 c06933e0
[    3.574899] 1e60: 00000000 c028e764 ee08b200 c0288088 ee9000d0
ee9000d4 ee08b200 c029c5bc
[    3.583058] 1e80: c0726874 ee08b208 c06d42a4 00000000 00000000
c02a2504 ee08b208 c06d42a4
[    3.591217] 1ea0: ee08b23c c06d2b7c eebf83c0 c02a2708 00000000
c06d42a4 c02a267c c02a0ad8
[    3.599376] 1ec0: ee9bf674 ee06db40 c06d42a4 ee06df00 00000000
c02a1d2c c05dee34 c06bcbe0
[    3.607535] 1ee0: c0681fc8 c06d42a4 c06bcbe0 c0681fc8 00000000
c02a2d04 c06bcbe0 c06bcbe0
[    3.615695] 1f00: c0681fc8 c0008990 ee855980 c04971d0 00000025
00000000 60000100 c06c066c
[    3.623854] 1f20: 00000000 c06c066c 60000113 00000003 ef7fc9ed
ef7fc9de c04a96e8 c00384d0
[    3.632013] 1f40: c05f26cc ef7fc9fc 00000006 00000006 c06c0648
ef7fc940 c06b3f98 00000006
[    3.640172] 1f60: c06933d8 c06eabc0 c06eabc0 00000098 c06933e0
c0668dac 00000006 00000006
[    3.648331] 1f80: c0668594 c003c944 0000abc0 c048bed0 00000000
00000000 00000000 00000000
[    3.656490] 1fa0: 00000000 c048bedc 00000000 c000e7c0 00000000
00000000 00000000 00000000
[    3.664649] 1fc0: 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000
[    3.672809] 1fe0: 00000000 00000000 00000000 00000000 00000013
00000000 ffffffff ffffffff
[    3.680977] [<c028bff4>] (exynos_plane_atomic_update) from
[<c0265308>] (drm_atomic_helper_commit_planes+0xa4/0x18c)
[    3.691475] [<c0265308>] (drm_atomic_helper_commit_planes) from
[<c0267304>] (drm_atomic_helper_commit+0xec/0x144)
[    3.701804] [<c0267304>] (drm_atomic_helper_commit) from [<c026609c>]
(drm_atomic_helper_set_config+0x1ac/0x3d0)
[    3.711962] [<c026609c>] (drm_atomic_helper_set_config) from
[<c02770d0>] (drm_mode_set_config_internal+0x58/0xd4)
[    3.722288] [<c02770d0>] (drm_mode_set_config_internal) from
[<c0267a2c>] (restore_fbdev_mode+0xd4/0xf4)
[    3.731749] [<c0267a2c>] (restore_fbdev_mode) from [<c0269900>]
(drm_fb_helper_restore_fbdev_mode_unlocked+0x1c/0x5c)
[    3.742338] [<c0269900>] (drm_fb_helper_restore_fbdev_mode_unlocked)
from [<c0269958>] (drm_fb_helper_set_par+0x18/0x34)
[    3.753191] [<c0269958>] (drm_fb_helper_set_par) from [<c020cc8c>]
(fbcon_init+0x5c8/0x614)
[    3.761525] [<c020cc8c>] (fbcon_init) from [<c0246564>]
(visual_init+0xa4/0xec)

exynos_plane_atomic_update function calls internally
exynos_plane_mode_set function, and this call incurs a panic because
exynos_plane_mode_set function is called with null argument -
state->crtc is null.


And below is the place where the deadlock occurs,

                                            actual_w =
exynos_plane_get_size(crtc_x, crtc_w, crtc->mode.hdisplay);
NSR:C028BFF4 E595E0A4                  ldr    r14,[r5,%0xA4]


Thanks,
Inki Dae

> 
> Thanks,
> Inki Dae
> 
>> Thanks,
>> Inki Dae
>>
>>>
>>>       Gustavo
>>> ---
>>>
>>> Gustavo Padovan (11):
>>>   drm/exynos: atomic phase 1: use drm_plane_helper_update()
>>>   drm/exynos: atomic phase 1: use drm_plane_helper_disable()
>>>   drm/exynos: atomic phase 1: add .mode_set_nofb() callback
>>>   drm/exynos: atomic phase 2: wire up state reset(), duplicate() and
>>>     destroy()
>>>   drm/exynos: atomic phase 2: keep track of framebuffer pointer
>>>   drm/exynos: atomic phase 3: atomic updates of planes
>>>   drm/exynos: atomic phase 3: use atomic .set_config helper
>>>   drm/exynos: atomic phase 3: convert page flips
>>>   drm/exynos: remove exported functions from exynos_drm_plane
>>>   drm/exynos: don't disable unused functions at init
>>>   drm/exynos: atomic dpms support
>>>
>>>  drivers/gpu/drm/bridge/ptn3460.c              |   4 +
>>>  drivers/gpu/drm/exynos/exynos_dp_core.c       |   6 +-
>>>  drivers/gpu/drm/exynos/exynos_drm_connector.c |   6 +-
>>>  drivers/gpu/drm/exynos/exynos_drm_crtc.c      | 226 ++++++++------------------
>>>  drivers/gpu/drm/exynos/exynos_drm_dpi.c       |   6 +-
>>>  drivers/gpu/drm/exynos/exynos_drm_drv.c       |   2 +
>>>  drivers/gpu/drm/exynos/exynos_drm_drv.h       |   4 +-
>>>  drivers/gpu/drm/exynos/exynos_drm_dsi.c       |   6 +-
>>>  drivers/gpu/drm/exynos/exynos_drm_encoder.c   |  27 +--
>>>  drivers/gpu/drm/exynos/exynos_drm_fb.c        |  12 +-
>>>  drivers/gpu/drm/exynos/exynos_drm_fbdev.c     |   3 -
>>>  drivers/gpu/drm/exynos/exynos_drm_plane.c     | 113 +++++++------
>>>  drivers/gpu/drm/exynos/exynos_drm_plane.h     |  11 --
>>>  drivers/gpu/drm/exynos/exynos_drm_vidi.c      |   6 +-
>>>  drivers/gpu/drm/exynos/exynos_hdmi.c          |  10 +-
>>>  15 files changed, 187 insertions(+), 255 deletions(-)
>>>
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/dri-devel
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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

* Re: [PATCH -v3 11/11] drm/exynos: atomic dpms support
  2015-04-06 18:26     ` Gustavo Padovan
@ 2015-04-07  7:22       ` Joonyoung Shim
  2015-04-07 19:56         ` [PATCH v4] " Gustavo Padovan
  0 siblings, 1 reply; 28+ messages in thread
From: Joonyoung Shim @ 2015-04-07  7:22 UTC (permalink / raw)
  To: Gustavo Padovan, Inki Dae, linux-samsung-soc, Gustavo Padovan,
	DRI mailing list

Hi,

On 04/07/2015 03:26 AM, Gustavo Padovan wrote:
> Hi Inki,
> 
> 2015-04-05 Inki Dae <inki.dae@samsung.com>:
> 
>> Hi,
>>
>> 2015-04-04 3:09 GMT+09:00 Gustavo Padovan <gustavo@padovan.org>:
>>> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>>>
>>> Run dpms operations through the atomic intefaces. This basically removes
>>> the .dpms() callback from econders and crtcs and use .disable() and
>>> .enable() to turn the crtc on and off.
>>>
>>> v2: Address comments by Joonyoung:
>>>         - make hdmi code call ->disable() instead of ->dpms()
>>>         - do not use WARN_ON on crtc enable/disable
>>>
>>> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>>> ---
>>>  drivers/gpu/drm/exynos/exynos_dp_core.c       |  2 +-
>>>  drivers/gpu/drm/exynos/exynos_drm_connector.c |  2 +-
>>>  drivers/gpu/drm/exynos/exynos_drm_crtc.c      | 99 +++++++++++++++------------
>>>  drivers/gpu/drm/exynos/exynos_drm_dpi.c       |  2 +-
>>>  drivers/gpu/drm/exynos/exynos_drm_drv.h       |  4 +-
>>>  drivers/gpu/drm/exynos/exynos_drm_dsi.c       |  2 +-
>>>  drivers/gpu/drm/exynos/exynos_drm_encoder.c   | 27 ++------
>>>  drivers/gpu/drm/exynos/exynos_drm_vidi.c      |  2 +-
>>>  drivers/gpu/drm/exynos/exynos_hdmi.c          |  6 +-
>>>  9 files changed, 70 insertions(+), 76 deletions(-)
>>>
>>
>> ...snip...
>>
>>> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
>>> index 5b597bc..2ea7d01 100644
>>> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
>>> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
>>> @@ -1051,7 +1051,7 @@ static void hdmi_connector_destroy(struct drm_connector *connector)
>>>  }
>>>
>>>  static struct drm_connector_funcs hdmi_connector_funcs = {
>>> -       .dpms = drm_helper_connector_dpms,
>>> +       .dpms = drm_atomic_helper_connector_dpms,
>>>         .fill_modes = drm_helper_probe_single_connector_modes,
>>>         .detect = hdmi_detect,
>>>         .destroy = hdmi_connector_destroy,
>>> @@ -2127,8 +2127,8 @@ static void hdmi_dpms(struct exynos_drm_display *display, int mode)
>>>                  */
>>>                 if (crtc)
>>>                         funcs = crtc->helper_private;
>>> -               if (funcs && funcs->dpms)
>>> -                       (*funcs->dpms)(crtc, mode);
>>> +               if (funcs && funcs->disable)
>>> +                       (*funcs->disable)(crtc, mode);
>>
>> This patch makes funcs->disable callback to be called instead of
>> funcs->dpms callback. However, funcs->disable callback isn't required
>> for second argument so the build is failed like below,
>>
>> drivers/gpu/drm/exynos/exynos_hdmi.c: In function 'hdmi_dpms':
>> drivers/gpu/drm/exynos/exynos_hdmi.c:2131:4: error: too many arguments
>> to function 'funcs->disable'
>>

You needs to rebase patchset from latest repository of Inki Dae with
this fix because i got some conflict to apply this patchset.

Anyway, i just tested it from hdmi output part on odroid-xu3 board.

Tested-by: Joonyoung Shim <jy0922.shim@samsung.com>

Thanks.

>> Please, keep in mind that you should build it and at least have a
>> basic test before posting.
> 
> Sure, I think this happened because I've been using exynos_defconfig to test
> my kernels and HDMI is not there. Maybe should we add the EXYNOS_DRM_HDMI to
> defconfig? What do you think?
> 
> 	Gustavo
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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

* Re: [PATCH -v3 00/11] drm/exynos: Add atomic modesetting support
  2015-04-07  7:06     ` Inki Dae
@ 2015-04-07 11:14       ` Inki Dae
  2015-04-07 17:24         ` Gustavo Padovan
  2015-04-07 18:39       ` Gustavo Padovan
  1 sibling, 1 reply; 28+ messages in thread
From: Inki Dae @ 2015-04-07 11:14 UTC (permalink / raw)
  To: Gustavo Padovan; +Cc: linux-samsung-soc, Gustavo Padovan, dri-devel

On 2015년 04월 07일 16:06, Inki Dae wrote:
> On 2015년 04월 07일 00:44, Inki Dae wrote:
>> 2015-04-06 19:46 GMT+09:00 Inki Dae <inki.dae@samsung.com>:
>>> On 2015년 04월 04일 03:09, Gustavo Padovan wrote:
>>>> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>>>>
>>>> Hi,
>>>>
>>>> Here goes the full support for atomic modesetting on exynos. I've
>>>> split the patches in the various phases of atomic support.
>>>>
>>>> These patches sits on top of the clean up patches I've sent yesterday
>>>> to this mailing list[1].
>>>>
>>>> v2: fixes comments by Joonyoung
>>>>         - remove unused var in patch 09
>>>>         - use ->disable instead of outdated ->dpms in hdmi code
>>>>         - remove WARN_ON from crtc enable/disable
>>>>
>>>> v3: fixes comment by Joonyoung
>>>>       - move the removal of drm_helper_disable_unused_functions() to
>>>>       separated patch
>>>
>>> With this patch series, Kernel booting is halted at end of kernel
>>> booting. I tested this patch series on Trats2 board based on Exynos4412 SoC.
>>>
>>> Below is a part of full booting logs, which was halted,
>>> [    1.992015] exynos-drm-ipp exynos-drm-ipp: drm ipp registered
>>> successfully.
>>> [    1.993009] exynos-drm exynos-drm: bound exynos-drm-vidi (ops
>>> vidi_component_ops)
>>> [    1.993036] exynos-drm exynos-drm: bound 11c00000.fimd (ops
>>> fimd_component_ops)
>>> [    1.993385] exynos-drm exynos-drm: bound 11c80000.dsi (ops
>>> exynos_dsi_component_ops)
>>> [    1.993390] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
>>> [    1.993393] [drm] No driver support for vblank timestamp query.
>>> [    1.993442] [drm] Initialized exynos 1.0.0 20110530 on minor 0
>>> [    2.043358] WARNING: CPU: 2 PID: 1209 at drivers/clk/clk.c:898
>>> clk_unprepare+0x24/0x2c()
>>> [    2.051412] Modules linked in:
>>> [    2.054422] CPU: 2 PID: 1209 Comm: kworker/2:1 Tainted: G        W
>>>     4.0.0-rc6-00526-gc49d7de-dirty #1278
>>> [    2.064337] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
>>> [    2.070428] Workqueue: pm pm_runtime_work>
>>>
>>> After that, I tested it again without FIMD and the booting is ok. So I
>>> guess that this atomic feature has a bug to FIMD driver.
>>>
>>
>> More information,
>>
>> The reason the booting is halted is that a deadlock occurs at fbcon
>> module when register_framebuffer() is called.
>>
>> Below are our test results,
>> - with only cleanup series, FIMD and HDMI work well.
>> - with cleanup and atomic series, HDMI works well but FIMD doesn't
>> work - a deadlock occurs.
>>
>> Could anyone test it with the atomic series on trats2 board? You can
>> test it on top of exynos-drm-next-todo branch which contains all
>> relevant patches,
>> https://git.kernel.org/cgit/linux/kernel/git/daeinki/drm-exynos.git/log/?h=exynos-drm-next-todo
>>
>> Anyway, we will continue to take a look at the this issue why the
>> deadlock occurs.
> 
> In addition,
> 
> I added some codes temporarily to fbmem module which mitigates the
> deadlock issue. After that, I see below panic log,
> 
> [    3.254840] Unable to handle kernel NULL pointer dereference at
> virtual address 000000a4
> [    3.262870] pgd = c0004000
> [    3.265539] [000000a4] *pgd=00000000
> [    3.269102] Internal error: Oops: 5 [#1] PREEMPT SMP ARM
> [    3.274392] Modules linked in:
> [    3.277435] CPU: 2 PID: 1 Comm: swapper/0 Tainted: G        W
> 4.0.0-rc6-00526-gc49d7de-dirty #1308
> [    3.286892] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
> [    3.292970] task: ee878000 ti: ee880000 task.ti: ee880000
> [    3.298356] PC is at exynos_plane_atomic_update+0x24/0x1d4
> [    3.303824] LR is at drm_atomic_helper_commit_planes+0xa4/0x18c
> [    3.309723] pc : [<c028bff4>]    lr : [<c0265308>]    psr: 60000113
> [    3.309723] sp : ee881b38  ip : 00000020  fp : 00000000
> [    3.321179] r10: c04cfc00  r9 : 00000008  r8 : eebfb9c0
> [    3.326387] r7 : 00000002  r6 : 00000000  r5 : 00000000  r4 : ee925308
> [    3.332897] r3 : ee329fc0  r2 : 00000000  r1 : 00000000  r0 : ee925308
> [    3.339409] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM
> Segment kernel
> [    3.346699] Control: 10c5387d  Table: 4000404a  DAC: 00000015
> [    3.352427] Process swapper/0 (pid: 1, stack limit = 0xee880210)
> [    3.358416] Stack: (0xee881b38 to 0xee882000)
> [    3.362757] 1b20:
>    c0726794 00000008
> [    3.370919] 1b40: 00000002 ee925308 00000000 ee329e00 00000002
> eebfb9c0 00000008 c04cfc00
> [    3.379078] 1b60: 00000000 c0265308 00000008 00000000 ee329e00
> ee0a8000 00000008 00000000
> [    3.387237] 1b80: 00000000 c0267304 ee329e00 ee8efe00 ee914c00
> 00000002 00000000 00000002
> [    3.395396] 1ba0: 00000000 c026609c c0265ef0 00000000 ee914c00
> 00000028 ee8eff00 00000001
> [    3.403555] 1bc0: 00000000 c06c8380 00000000 c02770d0 ee8efe00
> 00000000 00000028 ee8eff00
> [    3.411714] 1be0: 00000001 c0267a2c ee0a8000 c0286214 ee8eff00
> ee8eff00 ee0a8000 00000000
> [    3.419874] 1c00: 00000000 c0722ad4 ee35e000 c0269900 00000000
> ee915400 00000000 c0269958
> [    3.428033] 1c20: ee808c00 c020cc8c c0248620 c05d5448 ee808c00
> ee808c00 ee808d34 00000000
> [    3.436192] 1c40: 00000000 00000001 00000066 c0724acc c0724fd4
> 0000005b 00000066 0000005b
> [    3.444351] 1c60: c05b28cc ee808c00 ee808d74 00000000 00000000
> 00000001 ee808c00 00000000
> [    3.452511] 1c80: 00000001 c0246564 c04b4950 00000000 c0724fdc
> c07250f0 00000001 c0248568
> [    3.460670] 1ca0: c049cc58 c06ce2e4 00000000 0000003e c070da2c
> c05d09ec 00000000 c0724fcc
> [    3.468829] 1cc0: 00000000 c04b4950 c0724fe8 00000000 00000000
> 00000000 0000003e 00000000
> [    3.476988] 1ce0: c0725604 c0248de0 c05d54ac 00000001 ee074780
> 00000001 c0724920 c06c8380
> [    3.485148] 1d00: c0724acc 00008380 00000005 00000000 00000000
> 01d00000 00000000 c020cd5c
> [    3.493306] 1d20: c06c8754 ffffffff ee881d88 c0039890 c06c8754
> 00000005 ee881d88 ffffffff
> [    3.501466] 1d40: ee915644 ee91540c 01d00000 c0039bec 00000000
> 00000000 ee915644 c06badb8
> [    3.509625] 1d60: ee915400 c06badb8 00000000 c0039c1c 00000000
> ee915400 c06badb8 c0215980
> [    3.517784] 1d80: c05d101c 00000000 ee915400 00000000 00000000
> 00000000 000002d0 00000500
> [    3.525943] 1da0: 00000000 00000000 00000000 00000000 00000000
> 00000000 00000000 00000000
> [    3.534103] 1dc0: 00000000 00000020 ee8efe50 ee8eff00 ee915400
> 00000001 ee8efe50 c0726794
> [    3.542262] 1de0: 00000002 c0269bc4 000002d0 00000500 000002d0
> 00000500 00000020 00000018
> [    3.550421] 1e00: ee0a8000 00000000 eebfbdc0 ee8eff00 ee0a8190
> c028a374 ee0a8288 00000001
> [    3.558580] 1e20: ee0a8294 ee0a8000 ee0a8190 c025ff20 00000000
> c0491308 c06933e0 c0492b3c
> [    3.566740] 1e40: ee08b374 ee914428 ee9000d4 ee08b200 ee08b208
> 00000000 00000098 c06933e0
> [    3.574899] 1e60: 00000000 c028e764 ee08b200 c0288088 ee9000d0
> ee9000d4 ee08b200 c029c5bc
> [    3.583058] 1e80: c0726874 ee08b208 c06d42a4 00000000 00000000
> c02a2504 ee08b208 c06d42a4
> [    3.591217] 1ea0: ee08b23c c06d2b7c eebf83c0 c02a2708 00000000
> c06d42a4 c02a267c c02a0ad8
> [    3.599376] 1ec0: ee9bf674 ee06db40 c06d42a4 ee06df00 00000000
> c02a1d2c c05dee34 c06bcbe0
> [    3.607535] 1ee0: c0681fc8 c06d42a4 c06bcbe0 c0681fc8 00000000
> c02a2d04 c06bcbe0 c06bcbe0
> [    3.615695] 1f00: c0681fc8 c0008990 ee855980 c04971d0 00000025
> 00000000 60000100 c06c066c
> [    3.623854] 1f20: 00000000 c06c066c 60000113 00000003 ef7fc9ed
> ef7fc9de c04a96e8 c00384d0
> [    3.632013] 1f40: c05f26cc ef7fc9fc 00000006 00000006 c06c0648
> ef7fc940 c06b3f98 00000006
> [    3.640172] 1f60: c06933d8 c06eabc0 c06eabc0 00000098 c06933e0
> c0668dac 00000006 00000006
> [    3.648331] 1f80: c0668594 c003c944 0000abc0 c048bed0 00000000
> 00000000 00000000 00000000
> [    3.656490] 1fa0: 00000000 c048bedc 00000000 c000e7c0 00000000
> 00000000 00000000 00000000
> [    3.664649] 1fc0: 00000000 00000000 00000000 00000000 00000000
> 00000000 00000000 00000000
> [    3.672809] 1fe0: 00000000 00000000 00000000 00000000 00000013
> 00000000 ffffffff ffffffff
> [    3.680977] [<c028bff4>] (exynos_plane_atomic_update) from
> [<c0265308>] (drm_atomic_helper_commit_planes+0xa4/0x18c)
> [    3.691475] [<c0265308>] (drm_atomic_helper_commit_planes) from
> [<c0267304>] (drm_atomic_helper_commit+0xec/0x144)
> [    3.701804] [<c0267304>] (drm_atomic_helper_commit) from [<c026609c>]
> (drm_atomic_helper_set_config+0x1ac/0x3d0)
> [    3.711962] [<c026609c>] (drm_atomic_helper_set_config) from
> [<c02770d0>] (drm_mode_set_config_internal+0x58/0xd4)
> [    3.722288] [<c02770d0>] (drm_mode_set_config_internal) from
> [<c0267a2c>] (restore_fbdev_mode+0xd4/0xf4)
> [    3.731749] [<c0267a2c>] (restore_fbdev_mode) from [<c0269900>]
> (drm_fb_helper_restore_fbdev_mode_unlocked+0x1c/0x5c)
> [    3.742338] [<c0269900>] (drm_fb_helper_restore_fbdev_mode_unlocked)
> from [<c0269958>] (drm_fb_helper_set_par+0x18/0x34)
> [    3.753191] [<c0269958>] (drm_fb_helper_set_par) from [<c020cc8c>]
> (fbcon_init+0x5c8/0x614)
> [    3.761525] [<c020cc8c>] (fbcon_init) from [<c0246564>]
> (visual_init+0xa4/0xec)
> 
> exynos_plane_atomic_update function calls internally
> exynos_plane_mode_set function, and this call incurs a panic because
> exynos_plane_mode_set function is called with null argument -
> state->crtc is null.
> 
> 
> And below is the place where the deadlock occurs,
> 
>                                             actual_w =
> exynos_plane_get_size(crtc_x, crtc_w, crtc->mode.hdisplay);
> NSR:C028BFF4 E595E0A4                  ldr    r14,[r5,%0xA4]
> 

Ok,

I have tested several times since that. However, I'm not sure that your
atomic series are tested and safe enough.

Only in case of one among several tests, FIMD worked well. That was a
case that it enabled only FIMD driver except for other crtc drivers.
However even this it's not stable because I faced with kernel panic.
Below are the test cases I did,

#modetest -v -s 25@23:720x1280
-> it works well.

#modetest -s 25@23:720x1280 -P 23:100x100+0+0
-> it works well.

#modetest -s 25@23:720x1280 -P 23:100x100+0+0 -P 23:100x100+0+100
-> it works well.

#modetest -v -s 25@23:720x1280 -P 23:100x100+0+0
-> it doesn't work. See the below error logs,

# modetest -v -s 25@23:720x1280 -P 23:100x100+0+0
trying to open device 'i915'...failed.
trying to open device 'radeon'...failed.
trying to open device 'nouveau'...failed.
trying to open device 'vmwgfx'...failed.
trying to open device 'omapdrm'...failed.
trying to open device 'exynos'...success.
setting mode 720x1280-60Hz@XR24 on connectors 25, crtc 23
testing 100x100@XR24 overlay plane 18
freq: 59.99Hz

[   38.297557] Unable to handle kernel NULL pointer dereference at
virtual address 000000a4
[   38.304189] pgd = c0004000
[   38.306859] [000000a4] *pgd=00000000
[   38.310422] Internal error: Oops: 17 [#1] PREEMPT SMP ARM
[   38.315799] Modules linked in:
[   38.318842] CPU: 0 PID: 1462 Comm: modetest Not tainted
4.0.0-rc6-00526-gc49d7de-dirty #1311
[   38.327256] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[   38.333334] task: ee23fb40 ti: ee382000 task.ti: ee382000
[   38.338728] PC is at exynos_plane_atomic_update+0x24/0x1d4
[   38.344193] LR is at drm_atomic_helper_commit_planes+0xa4/0x18c
[   38.350088] pc : [<c028bfd8>]    lr : [<c0265314>]    psr: 60000013
[   38.350088] sp : ee383de8  ip : ee24a680  fp : 00100100
[   38.361543] r10: c04c6bf0  r9 : 00000005  r8 : ee24a740
[   38.366751] r7 : 00000001  r6 : 00000000  r5 : 00000000  r4 : ee926228
[   38.373261] r3 : ee24a680  r2 : 00000000  r1 : 00000000  r0 : ee926228
[   38.379773] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM
Segment user
[   38.386889] Control: 10c5387d  Table: 6dca004a  DAC: 00000015
[   38.392618] Process modetest (pid: 1462, stack limit = 0xee382210)
[   38.398781] Stack: (0xee383de8 to 0xee384000)
[   38.403124] 3de0:                   c0719c54 00000005 00000001
ee926228 00000001 ee24a2c0
[   38.411283] 3e00: 00000001 ee24a740 00000005 c04c6bf0 00100100
c0265314 00000005 00000000
[   38.419442] 3e20: ee24a2c0 ee1a8000 00000005 00000000 ee1a8000
c0267310 00000000 ee24a680
[   38.427602] 3e40: ee926228 ee24a2c0 ee1a8000 ee1a8260 ee1a8000
c0265ed0 ee926228 ee004900
[   38.435761] 3e60: ee1a8000 ee1a82b0 ee1a8000 c027717c ee926228
ee004900 ee1a8000 c02772a4
[   38.443920] 3e80: ee1a81ec ee1a81ec ee1a81ec c0700eec 60000013
c0487500 ee1a8260 c0700eec
[   38.452079] 3ea0: 60000013 ee004900 ee32f840 ee32f840 eeac0064
c027c180 eeac00a8 eeac0000
[   38.460238] 3ec0: 00200200 ee1a8000 ee1a8034 eeac00a4 ee1a8000
c026d51c ee64d850 00000001
[   38.468397] 3ee0: ee203080 ee1a8154 60000013 00000000 ee64d850
eeac0100 ee2fd768 00000000
[   38.476557] 3f00: eeb5f410 ee6f55f0 00000008 eeac0108 00000000
c00cd6a8 00000000 00000000
[   38.484716] 3f20: ee23feb4 00000000 c06dfc80 ee23fb40 ee23fec4
ee382000 00000000 c0037594
[   38.492875] 3f40: ee23fb40 edcb01c0 00000001 ee383f60 ee23fec4
c00222d8 0001d008 c00ccb30
[   38.501034] 3f60: 00000000 00000000 0001d008 eeb6d180 00000000
b6f38750 000000f8 c000e8a4
[   38.509193] 3f80: ee382000 00000000 00000000 c002378c 0006560a
00000000 b6f38750 c0023814
[   38.517353] 3fa0: 0006560a c000e720 0006560a 00000000 00000000
000655f0 00000000 b6f934c0
[   38.525512] 3fc0: 0006560a 00000000 b6f38750 000000f8 00000000
00000000 b6f97000 00000000
[   38.533671] 3fe0: 000000f8 bea78a7c b6ed4af7 b6e87946 60000030
00000000 6f7fd821 6f7fdc21
[   38.541846] [<c028bfd8>] (exynos_plane_atomic_update) from
[<c0265314>] (drm_atomic_helper_commit_planes+0xa4/0x18c)
[   38.552339] [<c0265314>] (drm_atomic_helper_commit_planes) from
[<c0267310>] (drm_atomic_helper_commit+0xec/0x144)
[   38.562666] [<c0267310>] (drm_atomic_helper_commit) from [<c0265ed0>]
(drm_atomic_helper_disable_plane+0xcc/0xf8)
[   38.572911] [<c0265ed0>] (drm_atomic_helper_disable_plane) from
[<c027717c>] (drm_plane_force_disable+0x24/0x5c)
[   38.583063] [<c027717c>] (drm_plane_force_disable) from [<c02772a4>]
(drm_framebuffer_remove+0xf0/0x108)
[   38.592524] [<c02772a4>] (drm_framebuffer_remove) from [<c027c180>]
(drm_fb_release+0x70/0x88)
[   38.601119] [<c027c180>] (drm_fb_release) from [<c026d51c>]
(drm_release+0x41c/0x4c8)
[   38.608932] [<c026d51c>] (drm_release) from [<c00cd6a8>]
(__fput+0x80/0x1c8)
[   38.615966] [<c00cd6a8>] (__fput) from [<c0037594>]
(task_work_run+0xac/0xe4)
[   38.623085] [<c0037594>] (task_work_run) from [<c00222d8>]
(do_exit+0x2e8/0x980)
[   38.630456] [<c00222d8>] (do_exit) from [<c002378c>]
(do_group_exit+0x4c/0xc4)
[   38.637658] [<c002378c>] (do_group_exit) from [<c0023814>]
(__wake_up_parent+0x0/0x18)
[   38.645557] Code: e5935004 e5931008 e3560000 e1a02006 (e595e0a4)
[   38.651703] ---[ end trace f80c6df7633b0861 ]---
[   38.656248] Fixing recursive fault but reboot is needed!

Above log would be same as one I commented already at previous email.
I'd like to have enough times for review.

I will have pull-request except for the atomic series. After that, let's
have more review for the atomic series. For this, I will merge the
atomic series to exynos-drm-next to stabilize it after this cycle.

Thanks,
Inki Dae

> 
> Thanks,
> Inki Dae
> 
>>
>> Thanks,
>> Inki Dae
>>
>>> Thanks,
>>> Inki Dae
>>>
>>>>
>>>>       Gustavo
>>>> ---
>>>>
>>>> Gustavo Padovan (11):
>>>>   drm/exynos: atomic phase 1: use drm_plane_helper_update()
>>>>   drm/exynos: atomic phase 1: use drm_plane_helper_disable()
>>>>   drm/exynos: atomic phase 1: add .mode_set_nofb() callback
>>>>   drm/exynos: atomic phase 2: wire up state reset(), duplicate() and
>>>>     destroy()
>>>>   drm/exynos: atomic phase 2: keep track of framebuffer pointer
>>>>   drm/exynos: atomic phase 3: atomic updates of planes
>>>>   drm/exynos: atomic phase 3: use atomic .set_config helper
>>>>   drm/exynos: atomic phase 3: convert page flips
>>>>   drm/exynos: remove exported functions from exynos_drm_plane
>>>>   drm/exynos: don't disable unused functions at init
>>>>   drm/exynos: atomic dpms support
>>>>
>>>>  drivers/gpu/drm/bridge/ptn3460.c              |   4 +
>>>>  drivers/gpu/drm/exynos/exynos_dp_core.c       |   6 +-
>>>>  drivers/gpu/drm/exynos/exynos_drm_connector.c |   6 +-
>>>>  drivers/gpu/drm/exynos/exynos_drm_crtc.c      | 226 ++++++++------------------
>>>>  drivers/gpu/drm/exynos/exynos_drm_dpi.c       |   6 +-
>>>>  drivers/gpu/drm/exynos/exynos_drm_drv.c       |   2 +
>>>>  drivers/gpu/drm/exynos/exynos_drm_drv.h       |   4 +-
>>>>  drivers/gpu/drm/exynos/exynos_drm_dsi.c       |   6 +-
>>>>  drivers/gpu/drm/exynos/exynos_drm_encoder.c   |  27 +--
>>>>  drivers/gpu/drm/exynos/exynos_drm_fb.c        |  12 +-
>>>>  drivers/gpu/drm/exynos/exynos_drm_fbdev.c     |   3 -
>>>>  drivers/gpu/drm/exynos/exynos_drm_plane.c     | 113 +++++++------
>>>>  drivers/gpu/drm/exynos/exynos_drm_plane.h     |  11 --
>>>>  drivers/gpu/drm/exynos/exynos_drm_vidi.c      |   6 +-
>>>>  drivers/gpu/drm/exynos/exynos_hdmi.c          |  10 +-
>>>>  15 files changed, 187 insertions(+), 255 deletions(-)
>>>>
>>>
>>> _______________________________________________
>>> dri-devel mailing list
>>> dri-devel@lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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

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

* Re: [PATCH -v3 00/11] drm/exynos: Add atomic modesetting support
  2015-04-07 11:14       ` Inki Dae
@ 2015-04-07 17:24         ` Gustavo Padovan
  0 siblings, 0 replies; 28+ messages in thread
From: Gustavo Padovan @ 2015-04-07 17:24 UTC (permalink / raw)
  To: Inki Dae; +Cc: linux-samsung-soc, Gustavo Padovan, dri-devel

Hi Inki,

2015-04-07 Inki Dae <inki.dae@samsung.com>:

> On 2015년 04월 07일 16:06, Inki Dae wrote:
> > On 2015년 04월 07일 00:44, Inki Dae wrote:
> >> 2015-04-06 19:46 GMT+09:00 Inki Dae <inki.dae@samsung.com>:
> >>> On 2015년 04월 04일 03:09, Gustavo Padovan wrote:
> >>>> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> >>>>
> >>>> Hi,
> >>>>
> >>>> Here goes the full support for atomic modesetting on exynos. I've
> >>>> split the patches in the various phases of atomic support.
> >>>>
> >>>> These patches sits on top of the clean up patches I've sent yesterday
> >>>> to this mailing list[1].
> >>>>
> >>>> v2: fixes comments by Joonyoung
> >>>>         - remove unused var in patch 09
> >>>>         - use ->disable instead of outdated ->dpms in hdmi code
> >>>>         - remove WARN_ON from crtc enable/disable
> >>>>
> >>>> v3: fixes comment by Joonyoung
> >>>>       - move the removal of drm_helper_disable_unused_functions() to
> >>>>       separated patch
> >>>
> >>> With this patch series, Kernel booting is halted at end of kernel
> >>> booting. I tested this patch series on Trats2 board based on Exynos4412 SoC.
> >>>
> >>> Below is a part of full booting logs, which was halted,
> >>> [    1.992015] exynos-drm-ipp exynos-drm-ipp: drm ipp registered
> >>> successfully.
> >>> [    1.993009] exynos-drm exynos-drm: bound exynos-drm-vidi (ops
> >>> vidi_component_ops)
> >>> [    1.993036] exynos-drm exynos-drm: bound 11c00000.fimd (ops
> >>> fimd_component_ops)
> >>> [    1.993385] exynos-drm exynos-drm: bound 11c80000.dsi (ops
> >>> exynos_dsi_component_ops)
> >>> [    1.993390] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
> >>> [    1.993393] [drm] No driver support for vblank timestamp query.
> >>> [    1.993442] [drm] Initialized exynos 1.0.0 20110530 on minor 0
> >>> [    2.043358] WARNING: CPU: 2 PID: 1209 at drivers/clk/clk.c:898
> >>> clk_unprepare+0x24/0x2c()
> >>> [    2.051412] Modules linked in:
> >>> [    2.054422] CPU: 2 PID: 1209 Comm: kworker/2:1 Tainted: G        W
> >>>     4.0.0-rc6-00526-gc49d7de-dirty #1278
> >>> [    2.064337] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
> >>> [    2.070428] Workqueue: pm pm_runtime_work>
> >>>
> >>> After that, I tested it again without FIMD and the booting is ok. So I
> >>> guess that this atomic feature has a bug to FIMD driver.
> >>>
> >>
> >> More information,
> >>
> >> The reason the booting is halted is that a deadlock occurs at fbcon
> >> module when register_framebuffer() is called.
> >>
> >> Below are our test results,
> >> - with only cleanup series, FIMD and HDMI work well.
> >> - with cleanup and atomic series, HDMI works well but FIMD doesn't
> >> work - a deadlock occurs.
> >>
> >> Could anyone test it with the atomic series on trats2 board? You can
> >> test it on top of exynos-drm-next-todo branch which contains all
> >> relevant patches,
> >> https://git.kernel.org/cgit/linux/kernel/git/daeinki/drm-exynos.git/log/?h=exynos-drm-next-todo
> >>
> >> Anyway, we will continue to take a look at the this issue why the
> >> deadlock occurs.
> >
> > In addition,
> >
> > I added some codes temporarily to fbmem module which mitigates the
> > deadlock issue. After that, I see below panic log,
> >
> > [    3.254840] Unable to handle kernel NULL pointer dereference at
> > virtual address 000000a4
> > [    3.262870] pgd = c0004000
> > [    3.265539] [000000a4] *pgd=00000000
> > [    3.269102] Internal error: Oops: 5 [#1] PREEMPT SMP ARM
> > [    3.274392] Modules linked in:
> > [    3.277435] CPU: 2 PID: 1 Comm: swapper/0 Tainted: G        W
> > 4.0.0-rc6-00526-gc49d7de-dirty #1308
> > [    3.286892] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
> > [    3.292970] task: ee878000 ti: ee880000 task.ti: ee880000
> > [    3.298356] PC is at exynos_plane_atomic_update+0x24/0x1d4
> > [    3.303824] LR is at drm_atomic_helper_commit_planes+0xa4/0x18c
> > [    3.309723] pc : [<c028bff4>]    lr : [<c0265308>]    psr: 60000113
> > [    3.309723] sp : ee881b38  ip : 00000020  fp : 00000000
> > [    3.321179] r10: c04cfc00  r9 : 00000008  r8 : eebfb9c0
> > [    3.326387] r7 : 00000002  r6 : 00000000  r5 : 00000000  r4 : ee925308
> > [    3.332897] r3 : ee329fc0  r2 : 00000000  r1 : 00000000  r0 : ee925308
> > [    3.339409] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM
> > Segment kernel
> > [    3.346699] Control: 10c5387d  Table: 4000404a  DAC: 00000015
> > [    3.352427] Process swapper/0 (pid: 1, stack limit = 0xee880210)
> > [    3.358416] Stack: (0xee881b38 to 0xee882000)
> > [    3.362757] 1b20:
> >    c0726794 00000008
> > [    3.370919] 1b40: 00000002 ee925308 00000000 ee329e00 00000002
> > eebfb9c0 00000008 c04cfc00
> > [    3.379078] 1b60: 00000000 c0265308 00000008 00000000 ee329e00
> > ee0a8000 00000008 00000000
> > [    3.387237] 1b80: 00000000 c0267304 ee329e00 ee8efe00 ee914c00
> > 00000002 00000000 00000002
> > [    3.395396] 1ba0: 00000000 c026609c c0265ef0 00000000 ee914c00
> > 00000028 ee8eff00 00000001
> > [    3.403555] 1bc0: 00000000 c06c8380 00000000 c02770d0 ee8efe00
> > 00000000 00000028 ee8eff00
> > [    3.411714] 1be0: 00000001 c0267a2c ee0a8000 c0286214 ee8eff00
> > ee8eff00 ee0a8000 00000000
> > [    3.419874] 1c00: 00000000 c0722ad4 ee35e000 c0269900 00000000
> > ee915400 00000000 c0269958
> > [    3.428033] 1c20: ee808c00 c020cc8c c0248620 c05d5448 ee808c00
> > ee808c00 ee808d34 00000000
> > [    3.436192] 1c40: 00000000 00000001 00000066 c0724acc c0724fd4
> > 0000005b 00000066 0000005b
> > [    3.444351] 1c60: c05b28cc ee808c00 ee808d74 00000000 00000000
> > 00000001 ee808c00 00000000
> > [    3.452511] 1c80: 00000001 c0246564 c04b4950 00000000 c0724fdc
> > c07250f0 00000001 c0248568
> > [    3.460670] 1ca0: c049cc58 c06ce2e4 00000000 0000003e c070da2c
> > c05d09ec 00000000 c0724fcc
> > [    3.468829] 1cc0: 00000000 c04b4950 c0724fe8 00000000 00000000
> > 00000000 0000003e 00000000
> > [    3.476988] 1ce0: c0725604 c0248de0 c05d54ac 00000001 ee074780
> > 00000001 c0724920 c06c8380
> > [    3.485148] 1d00: c0724acc 00008380 00000005 00000000 00000000
> > 01d00000 00000000 c020cd5c
> > [    3.493306] 1d20: c06c8754 ffffffff ee881d88 c0039890 c06c8754
> > 00000005 ee881d88 ffffffff
> > [    3.501466] 1d40: ee915644 ee91540c 01d00000 c0039bec 00000000
> > 00000000 ee915644 c06badb8
> > [    3.509625] 1d60: ee915400 c06badb8 00000000 c0039c1c 00000000
> > ee915400 c06badb8 c0215980
> > [    3.517784] 1d80: c05d101c 00000000 ee915400 00000000 00000000
> > 00000000 000002d0 00000500
> > [    3.525943] 1da0: 00000000 00000000 00000000 00000000 00000000
> > 00000000 00000000 00000000
> > [    3.534103] 1dc0: 00000000 00000020 ee8efe50 ee8eff00 ee915400
> > 00000001 ee8efe50 c0726794
> > [    3.542262] 1de0: 00000002 c0269bc4 000002d0 00000500 000002d0
> > 00000500 00000020 00000018
> > [    3.550421] 1e00: ee0a8000 00000000 eebfbdc0 ee8eff00 ee0a8190
> > c028a374 ee0a8288 00000001
> > [    3.558580] 1e20: ee0a8294 ee0a8000 ee0a8190 c025ff20 00000000
> > c0491308 c06933e0 c0492b3c
> > [    3.566740] 1e40: ee08b374 ee914428 ee9000d4 ee08b200 ee08b208
> > 00000000 00000098 c06933e0
> > [    3.574899] 1e60: 00000000 c028e764 ee08b200 c0288088 ee9000d0
> > ee9000d4 ee08b200 c029c5bc
> > [    3.583058] 1e80: c0726874 ee08b208 c06d42a4 00000000 00000000
> > c02a2504 ee08b208 c06d42a4
> > [    3.591217] 1ea0: ee08b23c c06d2b7c eebf83c0 c02a2708 00000000
> > c06d42a4 c02a267c c02a0ad8
> > [    3.599376] 1ec0: ee9bf674 ee06db40 c06d42a4 ee06df00 00000000
> > c02a1d2c c05dee34 c06bcbe0
> > [    3.607535] 1ee0: c0681fc8 c06d42a4 c06bcbe0 c0681fc8 00000000
> > c02a2d04 c06bcbe0 c06bcbe0
> > [    3.615695] 1f00: c0681fc8 c0008990 ee855980 c04971d0 00000025
> > 00000000 60000100 c06c066c
> > [    3.623854] 1f20: 00000000 c06c066c 60000113 00000003 ef7fc9ed
> > ef7fc9de c04a96e8 c00384d0
> > [    3.632013] 1f40: c05f26cc ef7fc9fc 00000006 00000006 c06c0648
> > ef7fc940 c06b3f98 00000006
> > [    3.640172] 1f60: c06933d8 c06eabc0 c06eabc0 00000098 c06933e0
> > c0668dac 00000006 00000006
> > [    3.648331] 1f80: c0668594 c003c944 0000abc0 c048bed0 00000000
> > 00000000 00000000 00000000
> > [    3.656490] 1fa0: 00000000 c048bedc 00000000 c000e7c0 00000000
> > 00000000 00000000 00000000
> > [    3.664649] 1fc0: 00000000 00000000 00000000 00000000 00000000
> > 00000000 00000000 00000000
> > [    3.672809] 1fe0: 00000000 00000000 00000000 00000000 00000013
> > 00000000 ffffffff ffffffff
> > [    3.680977] [<c028bff4>] (exynos_plane_atomic_update) from
> > [<c0265308>] (drm_atomic_helper_commit_planes+0xa4/0x18c)
> > [    3.691475] [<c0265308>] (drm_atomic_helper_commit_planes) from
> > [<c0267304>] (drm_atomic_helper_commit+0xec/0x144)
> > [    3.701804] [<c0267304>] (drm_atomic_helper_commit) from [<c026609c>]
> > (drm_atomic_helper_set_config+0x1ac/0x3d0)
> > [    3.711962] [<c026609c>] (drm_atomic_helper_set_config) from
> > [<c02770d0>] (drm_mode_set_config_internal+0x58/0xd4)
> > [    3.722288] [<c02770d0>] (drm_mode_set_config_internal) from
> > [<c0267a2c>] (restore_fbdev_mode+0xd4/0xf4)
> > [    3.731749] [<c0267a2c>] (restore_fbdev_mode) from [<c0269900>]
> > (drm_fb_helper_restore_fbdev_mode_unlocked+0x1c/0x5c)
> > [    3.742338] [<c0269900>] (drm_fb_helper_restore_fbdev_mode_unlocked)
> > from [<c0269958>] (drm_fb_helper_set_par+0x18/0x34)
> > [    3.753191] [<c0269958>] (drm_fb_helper_set_par) from [<c020cc8c>]
> > (fbcon_init+0x5c8/0x614)
> > [    3.761525] [<c020cc8c>] (fbcon_init) from [<c0246564>]
> > (visual_init+0xa4/0xec)
> >
> > exynos_plane_atomic_update function calls internally
> > exynos_plane_mode_set function, and this call incurs a panic because
> > exynos_plane_mode_set function is called with null argument -
> > state->crtc is null.
> >
> >
> > And below is the place where the deadlock occurs,
> >
> >                                             actual_w =
> > exynos_plane_get_size(crtc_x, crtc_w, crtc->mode.hdisplay);
> > NSR:C028BFF4 E595E0A4                  ldr    r14,[r5,%0xA4]
> >
> 
> Ok,
> 
> I have tested several times since that. However, I'm not sure that your
> atomic series are tested and safe enough.
> 
> Only in case of one among several tests, FIMD worked well. That was a
> case that it enabled only FIMD driver except for other crtc drivers.
> However even this it's not stable because I faced with kernel panic.
> Below are the test cases I did,
> 
> #modetest -v -s 25@23:720x1280
> -> it works well.
> 
> #modetest -s 25@23:720x1280 -P 23:100x100+0+0
> -> it works well.
> 
> #modetest -s 25@23:720x1280 -P 23:100x100+0+0 -P 23:100x100+0+100
> -> it works well.
> 
> #modetest -v -s 25@23:720x1280 -P 23:100x100+0+0
> -> it doesn't work. See the below error logs,

If I got this right you are testing only with FIMD enabled and for me
my patches are fully working on my snow hardware. I'll check what might
be causing this for yours.

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

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

* Re: [PATCH -v3 00/11] drm/exynos: Add atomic modesetting support
  2015-04-07  7:06     ` Inki Dae
  2015-04-07 11:14       ` Inki Dae
@ 2015-04-07 18:39       ` Gustavo Padovan
  2015-04-07 19:14         ` Tobias Jakobi
  2015-04-08 15:14         ` Inki Dae
  1 sibling, 2 replies; 28+ messages in thread
From: Gustavo Padovan @ 2015-04-07 18:39 UTC (permalink / raw)
  To: Inki Dae; +Cc: Gustavo Padovan, linux-samsung-soc, dri-devel

Hi Inki,

2015-04-07 Inki Dae <inki.dae@samsung.com>:

> On 2015년 04월 07일 00:44, Inki Dae wrote:
> > 2015-04-06 19:46 GMT+09:00 Inki Dae <inki.dae@samsung.com>:
> >> On 2015년 04월 04일 03:09, Gustavo Padovan wrote:
> >>> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> >>>
> >>> Hi,
> >>>
> >>> Here goes the full support for atomic modesetting on exynos. I've
> >>> split the patches in the various phases of atomic support.
> >>>
> >>> These patches sits on top of the clean up patches I've sent yesterday
> >>> to this mailing list[1].
> >>>
> >>> v2: fixes comments by Joonyoung
> >>>         - remove unused var in patch 09
> >>>         - use ->disable instead of outdated ->dpms in hdmi code
> >>>         - remove WARN_ON from crtc enable/disable
> >>>
> >>> v3: fixes comment by Joonyoung
> >>>       - move the removal of drm_helper_disable_unused_functions() to
> >>>       separated patch
> >>
> >> With this patch series, Kernel booting is halted at end of kernel
> >> booting. I tested this patch series on Trats2 board based on Exynos4412 SoC.
> >>
> >> Below is a part of full booting logs, which was halted,
> >> [    1.992015] exynos-drm-ipp exynos-drm-ipp: drm ipp registered
> >> successfully.
> >> [    1.993009] exynos-drm exynos-drm: bound exynos-drm-vidi (ops
> >> vidi_component_ops)
> >> [    1.993036] exynos-drm exynos-drm: bound 11c00000.fimd (ops
> >> fimd_component_ops)
> >> [    1.993385] exynos-drm exynos-drm: bound 11c80000.dsi (ops
> >> exynos_dsi_component_ops)
> >> [    1.993390] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
> >> [    1.993393] [drm] No driver support for vblank timestamp query.
> >> [    1.993442] [drm] Initialized exynos 1.0.0 20110530 on minor 0
> >> [    2.043358] WARNING: CPU: 2 PID: 1209 at drivers/clk/clk.c:898
> >> clk_unprepare+0x24/0x2c()
> >> [    2.051412] Modules linked in:
> >> [    2.054422] CPU: 2 PID: 1209 Comm: kworker/2:1 Tainted: G        W
> >>     4.0.0-rc6-00526-gc49d7de-dirty #1278
> >> [    2.064337] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
> >> [    2.070428] Workqueue: pm pm_runtime_work>
> >>
> >> After that, I tested it again without FIMD and the booting is ok. So I
> >> guess that this atomic feature has a bug to FIMD driver.
> >>
> > 
> > More information,
> > 
> > The reason the booting is halted is that a deadlock occurs at fbcon
> > module when register_framebuffer() is called.
> > 
> > Below are our test results,
> > - with only cleanup series, FIMD and HDMI work well.
> > - with cleanup and atomic series, HDMI works well but FIMD doesn't
> > work - a deadlock occurs.
> > 
> > Could anyone test it with the atomic series on trats2 board? You can
> > test it on top of exynos-drm-next-todo branch which contains all
> > relevant patches,
> > https://git.kernel.org/cgit/linux/kernel/git/daeinki/drm-exynos.git/log/?h=exynos-drm-next-todo
> > 
> > Anyway, we will continue to take a look at the this issue why the
> > deadlock occurs.
> 
> In addition,
> 
> I added some codes temporarily to fbmem module which mitigates the
> deadlock issue. After that, I see below panic log,
> 
> [    3.254840] Unable to handle kernel NULL pointer dereference at
> virtual address 000000a4
> [    3.262870] pgd = c0004000
> [    3.265539] [000000a4] *pgd=00000000
> [    3.269102] Internal error: Oops: 5 [#1] PREEMPT SMP ARM
> [    3.274392] Modules linked in:
> [    3.277435] CPU: 2 PID: 1 Comm: swapper/0 Tainted: G        W
> 4.0.0-rc6-00526-gc49d7de-dirty #1308
> [    3.286892] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
> [    3.292970] task: ee878000 ti: ee880000 task.ti: ee880000
> [    3.298356] PC is at exynos_plane_atomic_update+0x24/0x1d4
> [    3.303824] LR is at drm_atomic_helper_commit_planes+0xa4/0x18c
> [    3.309723] pc : [<c028bff4>]    lr : [<c0265308>]    psr: 60000113
> [    3.309723] sp : ee881b38  ip : 00000020  fp : 00000000
> [    3.321179] r10: c04cfc00  r9 : 00000008  r8 : eebfb9c0
> [    3.326387] r7 : 00000002  r6 : 00000000  r5 : 00000000  r4 : ee925308
> [    3.332897] r3 : ee329fc0  r2 : 00000000  r1 : 00000000  r0 : ee925308
> [    3.339409] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM
> Segment kernel
> [    3.346699] Control: 10c5387d  Table: 4000404a  DAC: 00000015
> [    3.352427] Process swapper/0 (pid: 1, stack limit = 0xee880210)
> [    3.358416] Stack: (0xee881b38 to 0xee882000)
> [    3.362757] 1b20:
>    c0726794 00000008
> [    3.370919] 1b40: 00000002 ee925308 00000000 ee329e00 00000002
> eebfb9c0 00000008 c04cfc00
> [    3.379078] 1b60: 00000000 c0265308 00000008 00000000 ee329e00
> ee0a8000 00000008 00000000
> [    3.387237] 1b80: 00000000 c0267304 ee329e00 ee8efe00 ee914c00
> 00000002 00000000 00000002
> [    3.395396] 1ba0: 00000000 c026609c c0265ef0 00000000 ee914c00
> 00000028 ee8eff00 00000001
> [    3.403555] 1bc0: 00000000 c06c8380 00000000 c02770d0 ee8efe00
> 00000000 00000028 ee8eff00
> [    3.411714] 1be0: 00000001 c0267a2c ee0a8000 c0286214 ee8eff00
> ee8eff00 ee0a8000 00000000
> [    3.419874] 1c00: 00000000 c0722ad4 ee35e000 c0269900 00000000
> ee915400 00000000 c0269958
> [    3.428033] 1c20: ee808c00 c020cc8c c0248620 c05d5448 ee808c00
> ee808c00 ee808d34 00000000
> [    3.436192] 1c40: 00000000 00000001 00000066 c0724acc c0724fd4
> 0000005b 00000066 0000005b
> [    3.444351] 1c60: c05b28cc ee808c00 ee808d74 00000000 00000000
> 00000001 ee808c00 00000000
> [    3.452511] 1c80: 00000001 c0246564 c04b4950 00000000 c0724fdc
> c07250f0 00000001 c0248568
> [    3.460670] 1ca0: c049cc58 c06ce2e4 00000000 0000003e c070da2c
> c05d09ec 00000000 c0724fcc
> [    3.468829] 1cc0: 00000000 c04b4950 c0724fe8 00000000 00000000
> 00000000 0000003e 00000000
> [    3.476988] 1ce0: c0725604 c0248de0 c05d54ac 00000001 ee074780
> 00000001 c0724920 c06c8380
> [    3.485148] 1d00: c0724acc 00008380 00000005 00000000 00000000
> 01d00000 00000000 c020cd5c
> [    3.493306] 1d20: c06c8754 ffffffff ee881d88 c0039890 c06c8754
> 00000005 ee881d88 ffffffff
> [    3.501466] 1d40: ee915644 ee91540c 01d00000 c0039bec 00000000
> 00000000 ee915644 c06badb8
> [    3.509625] 1d60: ee915400 c06badb8 00000000 c0039c1c 00000000
> ee915400 c06badb8 c0215980
> [    3.517784] 1d80: c05d101c 00000000 ee915400 00000000 00000000
> 00000000 000002d0 00000500
> [    3.525943] 1da0: 00000000 00000000 00000000 00000000 00000000
> 00000000 00000000 00000000
> [    3.534103] 1dc0: 00000000 00000020 ee8efe50 ee8eff00 ee915400
> 00000001 ee8efe50 c0726794
> [    3.542262] 1de0: 00000002 c0269bc4 000002d0 00000500 000002d0
> 00000500 00000020 00000018
> [    3.550421] 1e00: ee0a8000 00000000 eebfbdc0 ee8eff00 ee0a8190
> c028a374 ee0a8288 00000001
> [    3.558580] 1e20: ee0a8294 ee0a8000 ee0a8190 c025ff20 00000000
> c0491308 c06933e0 c0492b3c
> [    3.566740] 1e40: ee08b374 ee914428 ee9000d4 ee08b200 ee08b208
> 00000000 00000098 c06933e0
> [    3.574899] 1e60: 00000000 c028e764 ee08b200 c0288088 ee9000d0
> ee9000d4 ee08b200 c029c5bc
> [    3.583058] 1e80: c0726874 ee08b208 c06d42a4 00000000 00000000
> c02a2504 ee08b208 c06d42a4
> [    3.591217] 1ea0: ee08b23c c06d2b7c eebf83c0 c02a2708 00000000
> c06d42a4 c02a267c c02a0ad8
> [    3.599376] 1ec0: ee9bf674 ee06db40 c06d42a4 ee06df00 00000000
> c02a1d2c c05dee34 c06bcbe0
> [    3.607535] 1ee0: c0681fc8 c06d42a4 c06bcbe0 c0681fc8 00000000
> c02a2d04 c06bcbe0 c06bcbe0
> [    3.615695] 1f00: c0681fc8 c0008990 ee855980 c04971d0 00000025
> 00000000 60000100 c06c066c
> [    3.623854] 1f20: 00000000 c06c066c 60000113 00000003 ef7fc9ed
> ef7fc9de c04a96e8 c00384d0
> [    3.632013] 1f40: c05f26cc ef7fc9fc 00000006 00000006 c06c0648
> ef7fc940 c06b3f98 00000006
> [    3.640172] 1f60: c06933d8 c06eabc0 c06eabc0 00000098 c06933e0
> c0668dac 00000006 00000006
> [    3.648331] 1f80: c0668594 c003c944 0000abc0 c048bed0 00000000
> 00000000 00000000 00000000
> [    3.656490] 1fa0: 00000000 c048bedc 00000000 c000e7c0 00000000
> 00000000 00000000 00000000
> [    3.664649] 1fc0: 00000000 00000000 00000000 00000000 00000000
> 00000000 00000000 00000000
> [    3.672809] 1fe0: 00000000 00000000 00000000 00000000 00000013
> 00000000 ffffffff ffffffff
> [    3.680977] [<c028bff4>] (exynos_plane_atomic_update) from
> [<c0265308>] (drm_atomic_helper_commit_planes+0xa4/0x18c)
> [    3.691475] [<c0265308>] (drm_atomic_helper_commit_planes) from
> [<c0267304>] (drm_atomic_helper_commit+0xec/0x144)
> [    3.701804] [<c0267304>] (drm_atomic_helper_commit) from [<c026609c>]
> (drm_atomic_helper_set_config+0x1ac/0x3d0)
> [    3.711962] [<c026609c>] (drm_atomic_helper_set_config) from
> [<c02770d0>] (drm_mode_set_config_internal+0x58/0xd4)
> [    3.722288] [<c02770d0>] (drm_mode_set_config_internal) from
> [<c0267a2c>] (restore_fbdev_mode+0xd4/0xf4)
> [    3.731749] [<c0267a2c>] (restore_fbdev_mode) from [<c0269900>]
> (drm_fb_helper_restore_fbdev_mode_unlocked+0x1c/0x5c)
> [    3.742338] [<c0269900>] (drm_fb_helper_restore_fbdev_mode_unlocked)
> from [<c0269958>] (drm_fb_helper_set_par+0x18/0x34)
> [    3.753191] [<c0269958>] (drm_fb_helper_set_par) from [<c020cc8c>]
> (fbcon_init+0x5c8/0x614)
> [    3.761525] [<c020cc8c>] (fbcon_init) from [<c0246564>]
> (visual_init+0xa4/0xec)
> 
> exynos_plane_atomic_update function calls internally
> exynos_plane_mode_set function, and this call incurs a panic because
> exynos_plane_mode_set function is called with null argument -
> state->crtc is null.

I just checked the value of state->crtc for me at this point of the flow
and it is not NULL. I wonder why this works differently for your board.
Could you check if state is null or if state->crtc is null?

	Gustavo

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

* Re: [PATCH -v3 00/11] drm/exynos: Add atomic modesetting support
  2015-04-07 18:39       ` Gustavo Padovan
@ 2015-04-07 19:14         ` Tobias Jakobi
  2015-04-08 15:14         ` Inki Dae
  1 sibling, 0 replies; 28+ messages in thread
From: Tobias Jakobi @ 2015-04-07 19:14 UTC (permalink / raw)
  To: Gustavo Padovan, Inki Dae; +Cc: linux-samsung-soc, dri-devel

I don't know if I can really help with this, but I'm going to try to
reproduce this on my board tomorrow.

With best wishes,
Tobias


Gustavo Padovan wrote:
> Hi Inki,
> 
> 2015-04-07 Inki Dae <inki.dae@samsung.com>:
> 
>> On 2015년 04월 07일 00:44, Inki Dae wrote:
>>> 2015-04-06 19:46 GMT+09:00 Inki Dae <inki.dae@samsung.com>:
>>>> On 2015년 04월 04일 03:09, Gustavo Padovan wrote:
>>>>> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>>>>>
>>>>> Hi,
>>>>>
>>>>> Here goes the full support for atomic modesetting on exynos. I've
>>>>> split the patches in the various phases of atomic support.
>>>>>
>>>>> These patches sits on top of the clean up patches I've sent yesterday
>>>>> to this mailing list[1].
>>>>>
>>>>> v2: fixes comments by Joonyoung
>>>>>         - remove unused var in patch 09
>>>>>         - use ->disable instead of outdated ->dpms in hdmi code
>>>>>         - remove WARN_ON from crtc enable/disable
>>>>>
>>>>> v3: fixes comment by Joonyoung
>>>>>       - move the removal of drm_helper_disable_unused_functions() to
>>>>>       separated patch
>>>>
>>>> With this patch series, Kernel booting is halted at end of kernel
>>>> booting. I tested this patch series on Trats2 board based on Exynos4412 SoC.
>>>>
>>>> Below is a part of full booting logs, which was halted,
>>>> [    1.992015] exynos-drm-ipp exynos-drm-ipp: drm ipp registered
>>>> successfully.
>>>> [    1.993009] exynos-drm exynos-drm: bound exynos-drm-vidi (ops
>>>> vidi_component_ops)
>>>> [    1.993036] exynos-drm exynos-drm: bound 11c00000.fimd (ops
>>>> fimd_component_ops)
>>>> [    1.993385] exynos-drm exynos-drm: bound 11c80000.dsi (ops
>>>> exynos_dsi_component_ops)
>>>> [    1.993390] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
>>>> [    1.993393] [drm] No driver support for vblank timestamp query.
>>>> [    1.993442] [drm] Initialized exynos 1.0.0 20110530 on minor 0
>>>> [    2.043358] WARNING: CPU: 2 PID: 1209 at drivers/clk/clk.c:898
>>>> clk_unprepare+0x24/0x2c()
>>>> [    2.051412] Modules linked in:
>>>> [    2.054422] CPU: 2 PID: 1209 Comm: kworker/2:1 Tainted: G        W
>>>>     4.0.0-rc6-00526-gc49d7de-dirty #1278
>>>> [    2.064337] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
>>>> [    2.070428] Workqueue: pm pm_runtime_work>
>>>>
>>>> After that, I tested it again without FIMD and the booting is ok. So I
>>>> guess that this atomic feature has a bug to FIMD driver.
>>>>
>>>
>>> More information,
>>>
>>> The reason the booting is halted is that a deadlock occurs at fbcon
>>> module when register_framebuffer() is called.
>>>
>>> Below are our test results,
>>> - with only cleanup series, FIMD and HDMI work well.
>>> - with cleanup and atomic series, HDMI works well but FIMD doesn't
>>> work - a deadlock occurs.
>>>
>>> Could anyone test it with the atomic series on trats2 board? You can
>>> test it on top of exynos-drm-next-todo branch which contains all
>>> relevant patches,
>>> https://git.kernel.org/cgit/linux/kernel/git/daeinki/drm-exynos.git/log/?h=ynos-drm-next-todo
>>>
>>> Anyway, we will continue to take a look at the this issue why the
>>> deadlock occurs.
>>
>> In addition,
>>
>> I added some codes temporarily to fbmem module which mitigates the
>> deadlock issue. After that, I see below panic log,
>>
>> [    3.254840] Unable to handle kernel NULL pointer dereference at
>> virtual address 000000a4
>> [    3.262870] pgd =0004000
>> [    3.265539] [000000a4] *pgd[    3.269102] Internal error: Oops: 5 [#1] PREEMPT SMP ARM
>> [    3.274392] Modules linked in:
>> [    3.277435] CPU: 2 PID: 1 Comm: swapper/0 Tainted: G        W
>> 4.0.0-rc6-00526-gc49d7de-dirty #1308
>> [    3.286892] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
>> [    3.292970] task: ee878000 ti: ee880000 task.ti: ee880000
>> [    3.298356] PC is at exynos_plane_atomic_update+0x24/0x1d4
>> [    3.303824] LR is at drm_atomic_helper_commit_planes+0xa4/0x18c
>> [    3.309723] pc : [<c028bff4>]    lr : [<c0265308>]    psr: 60000113
>> [    3.309723] sp : ee881b38  ip : 00000020  fp : 00000000
>> [    3.321179] r10: c04cfc00  r9 : 00000008  r8 : eebfb9c0
>> [    3.326387] r7 : 00000002  r6 : 00000000  r5 : 00000000  r4 : ee925308
>> [    3.332897] r3 : ee329fc0  r2 : 00000000  r1 : 00000000  r0 : ee925308
>> [    3.339409] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM
>> Segment kernel
>> [    3.346699] Control: 10c5387d  Table: 4000404a  DAC: 00000015
>> [    3.352427] Process swapper/0 (pid: 1, stack limit =xee880210)
>> [    3.358416] Stack: (0xee881b38 to 0xee882000)
>> [    3.362757] 1b20:
>>    c0726794 00000008
>> [    3.370919] 1b40: 00000002 ee925308 00000000 ee329e00 00000002
>> eebfb9c0 00000008 c04cfc00
>> [    3.379078] 1b60: 00000000 c0265308 00000008 00000000 ee329e00
>> ee0a8000 00000008 00000000
>> [    3.387237] 1b80: 00000000 c0267304 ee329e00 ee8efe00 ee914c00
>> 00000002 00000000 00000002
>> [    3.395396] 1ba0: 00000000 c026609c c0265ef0 00000000 ee914c00
>> 00000028 ee8eff00 00000001
>> [    3.403555] 1bc0: 00000000 c06c8380 00000000 c02770d0 ee8efe00
>> 00000000 00000028 ee8eff00
>> [    3.411714] 1be0: 00000001 c0267a2c ee0a8000 c0286214 ee8eff00
>> ee8eff00 ee0a8000 00000000
>> [    3.419874] 1c00: 00000000 c0722ad4 ee35e000 c0269900 00000000
>> ee915400 00000000 c0269958
>> [    3.428033] 1c20: ee808c00 c020cc8c c0248620 c05d5448 ee808c00
>> ee808c00 ee808d34 00000000
>> [    3.436192] 1c40: 00000000 00000001 00000066 c0724acc c0724fd4
>> 0000005b 00000066 0000005b
>> [    3.444351] 1c60: c05b28cc ee808c00 ee808d74 00000000 00000000
>> 00000001 ee808c00 00000000
>> [    3.452511] 1c80: 00000001 c0246564 c04b4950 00000000 c0724fdc
>> c07250f0 00000001 c0248568
>> [    3.460670] 1ca0: c049cc58 c06ce2e4 00000000 0000003e c070da2c
>> c05d09ec 00000000 c0724fcc
>> [    3.468829] 1cc0: 00000000 c04b4950 c0724fe8 00000000 00000000
>> 00000000 0000003e 00000000
>> [    3.476988] 1ce0: c0725604 c0248de0 c05d54ac 00000001 ee074780
>> 00000001 c0724920 c06c8380
>> [    3.485148] 1d00: c0724acc 00008380 00000005 00000000 00000000
>> 01d00000 00000000 c020cd5c
>> [    3.493306] 1d20: c06c8754 ffffffff ee881d88 c0039890 c06c8754
>> 00000005 ee881d88 ffffffff
>> [    3.501466] 1d40: ee915644 ee91540c 01d00000 c0039bec 00000000
>> 00000000 ee915644 c06badb8
>> [    3.509625] 1d60: ee915400 c06badb8 00000000 c0039c1c 00000000
>> ee915400 c06badb8 c0215980
>> [    3.517784] 1d80: c05d101c 00000000 ee915400 00000000 00000000
>> 00000000 000002d0 00000500
>> [    3.525943] 1da0: 00000000 00000000 00000000 00000000 00000000
>> 00000000 00000000 00000000
>> [    3.534103] 1dc0: 00000000 00000020 ee8efe50 ee8eff00 ee915400
>> 00000001 ee8efe50 c0726794
>> [    3.542262] 1de0: 00000002 c0269bc4 000002d0 00000500 000002d0
>> 00000500 00000020 00000018
>> [    3.550421] 1e00: ee0a8000 00000000 eebfbdc0 ee8eff00 ee0a8190
>> c028a374 ee0a8288 00000001
>> [    3.558580] 1e20: ee0a8294 ee0a8000 ee0a8190 c025ff20 00000000
>> c0491308 c06933e0 c0492b3c
>> [    3.566740] 1e40: ee08b374 ee914428 ee9000d4 ee08b200 ee08b208
>> 00000000 00000098 c06933e0
>> [    3.574899] 1e60: 00000000 c028e764 ee08b200 c0288088 ee9000d0
>> ee9000d4 ee08b200 c029c5bc
>> [    3.583058] 1e80: c0726874 ee08b208 c06d42a4 00000000 00000000
>> c02a2504 ee08b208 c06d42a4
>> [    3.591217] 1ea0: ee08b23c c06d2b7c eebf83c0 c02a2708 00000000
>> c06d42a4 c02a267c c02a0ad8
>> [    3.599376] 1ec0: ee9bf674 ee06db40 c06d42a4 ee06df00 00000000
>> c02a1d2c c05dee34 c06bcbe0
>> [    3.607535] 1ee0: c0681fc8 c06d42a4 c06bcbe0 c0681fc8 00000000
>> c02a2d04 c06bcbe0 c06bcbe0
>> [    3.615695] 1f00: c0681fc8 c0008990 ee855980 c04971d0 00000025
>> 00000000 60000100 c06c066c
>> [    3.623854] 1f20: 00000000 c06c066c 60000113 00000003 ef7fc9ed
>> ef7fc9de c04a96e8 c00384d0
>> [    3.632013] 1f40: c05f26cc ef7fc9fc 00000006 00000006 c06c0648
>> ef7fc940 c06b3f98 00000006
>> [    3.640172] 1f60: c06933d8 c06eabc0 c06eabc0 00000098 c06933e0
>> c0668dac 00000006 00000006
>> [    3.648331] 1f80: c0668594 c003c944 0000abc0 c048bed0 00000000
>> 00000000 00000000 00000000
>> [    3.656490] 1fa0: 00000000 c048bedc 00000000 c000e7c0 00000000
>> 00000000 00000000 00000000
>> [    3.664649] 1fc0: 00000000 00000000 00000000 00000000 00000000
>> 00000000 00000000 00000000
>> [    3.672809] 1fe0: 00000000 00000000 00000000 00000000 00000013
>> 00000000 ffffffff ffffffff
>> [    3.680977] [<c028bff4>] (exynos_plane_atomic_update) from
>> [<c0265308>] (drm_atomic_helper_commit_planes+0xa4/0x18c)
>> [    3.691475] [<c0265308>] (drm_atomic_helper_commit_planes) from
>> [<c0267304>] (drm_atomic_helper_commit+0xec/0x144)
>> [    3.701804] [<c0267304>] (drm_atomic_helper_commit) from [<c026609c>]
>> (drm_atomic_helper_set_config+0x1ac/0x3d0)
>> [    3.711962] [<c026609c>] (drm_atomic_helper_set_config) from
>> [<c02770d0>] (drm_mode_set_config_internal+0x58/0xd4)
>> [    3.722288] [<c02770d0>] (drm_mode_set_config_internal) from
>> [<c0267a2c>] (restore_fbdev_mode+0xd4/0xf4)
>> [    3.731749] [<c0267a2c>] (restore_fbdev_mode) from [<c0269900>]
>> (drm_fb_helper_restore_fbdev_mode_unlocked+0x1c/0x5c)
>> [    3.742338] [<c0269900>] (drm_fb_helper_restore_fbdev_mode_unlocked)
>> from [<c0269958>] (drm_fb_helper_set_par+0x18/0x34)
>> [    3.753191] [<c0269958>] (drm_fb_helper_set_par) from [<c020cc8c>]
>> (fbcon_init+0x5c8/0x614)
>> [    3.761525] [<c020cc8c>] (fbcon_init) from [<c0246564>]
>> (visual_init+0xa4/0xec)
>>
>> exynos_plane_atomic_update function calls internally
>> exynos_plane_mode_set function, and this call incurs a panic because
>> exynos_plane_mode_set function is called with null argument -
>> state->crtc is null.
> 
> I just checked the value of state->crtc for me at this point of the flow
> and it is not NULL. I wonder why this works differently for your board.
> Could you check if state is null or if state->crtc is null?
> 
> 	Gustavo
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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

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

* [PATCH v4] drm/exynos: atomic dpms support
  2015-04-07  7:22       ` Joonyoung Shim
@ 2015-04-07 19:56         ` Gustavo Padovan
  0 siblings, 0 replies; 28+ messages in thread
From: Gustavo Padovan @ 2015-04-07 19:56 UTC (permalink / raw)
  To: linux-samsung-soc; +Cc: Gustavo Padovan, dri-devel

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

Run dpms operations through the atomic intefaces. This basically removes
the .dpms() callback from econders and crtcs and use .disable() and
.enable() to turn the crtc on and off.

v2: Address comments by Joonyoung:
	- make hdmi code call ->disable() instead of ->dpms()
	- do not use WARN_ON on crtc enable/disable

v3: - Fix build failure after the hdmi change in v2
    - Change dpms helper of ptn3460 bridge

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/gpu/drm/bridge/ptn3460.c            |  2 +-
 drivers/gpu/drm/exynos/exynos_dp_core.c     |  2 +-
 drivers/gpu/drm/exynos/exynos_drm_crtc.c    | 99 ++++++++++++++++-------------
 drivers/gpu/drm/exynos/exynos_drm_dpi.c     |  2 +-
 drivers/gpu/drm/exynos/exynos_drm_drv.h     |  4 +-
 drivers/gpu/drm/exynos/exynos_drm_dsi.c     |  2 +-
 drivers/gpu/drm/exynos/exynos_drm_encoder.c | 27 ++------
 drivers/gpu/drm/exynos/exynos_drm_vidi.c    |  2 +-
 drivers/gpu/drm/exynos/exynos_hdmi.c        |  6 +-
 9 files changed, 70 insertions(+), 76 deletions(-)

diff --git a/drivers/gpu/drm/bridge/ptn3460.c b/drivers/gpu/drm/bridge/ptn3460.c
index 30da10c..4d49454 100644
--- a/drivers/gpu/drm/bridge/ptn3460.c
+++ b/drivers/gpu/drm/bridge/ptn3460.c
@@ -260,7 +260,7 @@ static void ptn3460_connector_destroy(struct drm_connector *connector)
 }
 
 static struct drm_connector_funcs ptn3460_connector_funcs = {
-	.dpms = drm_helper_connector_dpms,
+	.dpms = drm_atomic_helper_connector_dpms,
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.detect = ptn3460_detect,
 	.destroy = ptn3460_connector_destroy,
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c
index 59f2ca5..d468637 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -955,7 +955,7 @@ static void exynos_dp_connector_destroy(struct drm_connector *connector)
 }
 
 static struct drm_connector_funcs exynos_dp_connector_funcs = {
-	.dpms = drm_helper_connector_dpms,
+	.dpms = drm_atomic_helper_connector_dpms,
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.detect = exynos_dp_detect,
 	.destroy = exynos_dp_connector_destroy,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 0db7b91..519c569 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -22,51 +22,57 @@
 #include "exynos_drm_encoder.h"
 #include "exynos_drm_plane.h"
 
-static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode)
+static void exynos_drm_crtc_enable(struct drm_crtc *crtc)
 {
 	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
+	struct exynos_drm_plane *exynos_plane = to_exynos_plane(crtc->primary);
 
-	DRM_DEBUG_KMS("crtc[%d] mode[%d]\n", crtc->base.id, mode);
-
-	if (exynos_crtc->dpms == mode) {
-		DRM_DEBUG_KMS("desired dpms mode is same as previous one.\n");
+	if (exynos_crtc->enabled)
 		return;
-	}
-
-	if (mode > DRM_MODE_DPMS_ON) {
-		/* wait for the completion of page flip. */
-		if (!wait_event_timeout(exynos_crtc->pending_flip_queue,
-				(exynos_crtc->event == NULL), HZ/20))
-			exynos_crtc->event = NULL;
-		drm_crtc_vblank_off(crtc);
-	}
 
 	if (exynos_crtc->ops->dpms)
-		exynos_crtc->ops->dpms(exynos_crtc, mode);
+		exynos_crtc->ops->dpms(exynos_crtc, DRM_MODE_DPMS_ON);
 
-	exynos_crtc->dpms = mode;
+	exynos_crtc->enabled = true;
 
-	if (mode == DRM_MODE_DPMS_ON)
-		drm_crtc_vblank_on(crtc);
-}
+	drm_crtc_vblank_on(crtc);
 
-static void exynos_drm_crtc_prepare(struct drm_crtc *crtc)
-{
-	/* drm framework doesn't check NULL. */
+	if (exynos_crtc->ops->win_commit)
+		exynos_crtc->ops->win_commit(exynos_crtc, exynos_plane->zpos);
+
+	if (exynos_crtc->ops->commit)
+		exynos_crtc->ops->commit(exynos_crtc);
 }
 
-static void exynos_drm_crtc_commit(struct drm_crtc *crtc)
+static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
 {
 	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
-	struct exynos_drm_plane *exynos_plane = to_exynos_plane(crtc->primary);
+	struct drm_plane *plane;
+	int ret;
+
+	if (!exynos_crtc->enabled)
+		return;
 
-	exynos_drm_crtc_dpms(crtc, DRM_MODE_DPMS_ON);
+	/* wait for the completion of page flip. */
+	if (!wait_event_timeout(exynos_crtc->pending_flip_queue,
+				(exynos_crtc->event == NULL), HZ/20))
+		exynos_crtc->event = NULL;
 
-	if (exynos_crtc->ops->win_commit)
-		exynos_crtc->ops->win_commit(exynos_crtc, exynos_plane->zpos);
+	drm_crtc_vblank_off(crtc);
 
-	if (exynos_crtc->ops->commit)
-		exynos_crtc->ops->commit(exynos_crtc);
+	if (exynos_crtc->ops->dpms)
+		exynos_crtc->ops->dpms(exynos_crtc, DRM_MODE_DPMS_OFF);
+
+	exynos_crtc->enabled = false;
+
+	drm_for_each_legacy_plane(plane, &crtc->dev->mode_config.plane_list) {
+		if (plane->crtc != crtc)
+			continue;
+
+		ret = plane->funcs->disable_plane(plane);
+		if (ret)
+			DRM_ERROR("Failed to disable plane %d\n", ret);
+	}
 }
 
 static bool
@@ -95,32 +101,36 @@ exynos_drm_crtc_mode_set_nofb(struct drm_crtc *crtc)
 		exynos_crtc->ops->commit(exynos_crtc);
 }
 
-static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
+static int exynos_crtc_atomic_check(struct drm_crtc *crtc,
+				     struct drm_crtc_state *state)
 {
-	struct drm_plane *plane;
+	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
 	int ret;
 
-	exynos_drm_crtc_dpms(crtc, DRM_MODE_DPMS_OFF);
+	if (exynos_crtc->event)
+		return -EBUSY;
 
-	drm_for_each_legacy_plane(plane, &crtc->dev->mode_config.plane_list) {
-		if (plane->crtc != crtc)
-			continue;
+	if (state->event) {
+		ret = drm_vblank_get(crtc->dev, exynos_crtc->pipe);
+		if (ret) {
+			DRM_ERROR("failed to acquire vblank counter\n");
+			return ret;
+		}
 
-		ret = plane->funcs->disable_plane(plane);
-		if (ret)
-			DRM_ERROR("Failed to disable plane %d\n", ret);
+		exynos_crtc->event = state->event;
 	}
+
+	return 0;
 }
 
 static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
-	.dpms		= exynos_drm_crtc_dpms,
-	.prepare	= exynos_drm_crtc_prepare,
-	.commit		= exynos_drm_crtc_commit,
+	.enable		= exynos_drm_crtc_enable,
+	.disable	= exynos_drm_crtc_disable,
 	.mode_fixup	= exynos_drm_crtc_mode_fixup,
 	.mode_set	= drm_helper_crtc_mode_set,
 	.mode_set_nofb	= exynos_drm_crtc_mode_set_nofb,
 	.mode_set_base	= drm_helper_crtc_mode_set_base,
-	.disable	= exynos_drm_crtc_disable,
+	.atomic_check	= exynos_crtc_atomic_check,
 };
 
 static void exynos_drm_crtc_destroy(struct drm_crtc *crtc)
@@ -162,7 +172,6 @@ struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev,
 
 	init_waitqueue_head(&exynos_crtc->pending_flip_queue);
 
-	exynos_crtc->dpms = DRM_MODE_DPMS_OFF;
 	exynos_crtc->pipe = pipe;
 	exynos_crtc->type = type;
 	exynos_crtc->ops = ops;
@@ -193,7 +202,7 @@ int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int pipe)
 	struct exynos_drm_crtc *exynos_crtc =
 		to_exynos_crtc(private->crtc[pipe]);
 
-	if (exynos_crtc->dpms != DRM_MODE_DPMS_ON)
+	if (!exynos_crtc->enabled)
 		return -EPERM;
 
 	if (exynos_crtc->ops->enable_vblank)
@@ -208,7 +217,7 @@ void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int pipe)
 	struct exynos_drm_crtc *exynos_crtc =
 		to_exynos_crtc(private->crtc[pipe]);
 
-	if (exynos_crtc->dpms != DRM_MODE_DPMS_ON)
+	if (!exynos_crtc->enabled)
 		return;
 
 	if (exynos_crtc->ops->disable_vblank)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
index ced5c23..6dc328e 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
@@ -60,7 +60,7 @@ static void exynos_dpi_connector_destroy(struct drm_connector *connector)
 }
 
 static struct drm_connector_funcs exynos_dpi_connector_funcs = {
-	.dpms = drm_helper_connector_dpms,
+	.dpms = drm_atomic_helper_connector_dpms,
 	.detect = exynos_dpi_detect,
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.destroy = exynos_dpi_connector_destroy,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index e12ecb5..4702ce8 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -209,7 +209,7 @@ struct exynos_drm_crtc_ops {
  *	drm framework doesn't support multiple irq yet.
  *	we can refer to the crtc to current hardware interrupt occurred through
  *	this pipe value.
- * @dpms: store the crtc dpms value
+ * @enabled: if the crtc is enabled or not
  * @event: vblank event that is currently queued for flip
  * @ops: pointer to callbacks for exynos drm specific functionality
  * @ctx: A pointer to the crtc's implementation specific context
@@ -218,7 +218,7 @@ struct exynos_drm_crtc {
 	struct drm_crtc			base;
 	enum exynos_drm_output_type	type;
 	unsigned int			pipe;
-	unsigned int			dpms;
+	bool				enabled;
 	wait_queue_head_t		pending_flip_queue;
 	struct drm_pending_vblank_event	*event;
 	struct exynos_drm_crtc_ops	*ops;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
index e4e7f74..190f3b3 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
@@ -1458,7 +1458,7 @@ static void exynos_dsi_connector_destroy(struct drm_connector *connector)
 }
 
 static struct drm_connector_funcs exynos_dsi_connector_funcs = {
-	.dpms = drm_helper_connector_dpms,
+	.dpms = drm_atomic_helper_connector_dpms,
 	.detect = exynos_dsi_detect,
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.destroy = exynos_dsi_connector_destroy,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
index 57de0bd..0648ba4 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
@@ -32,17 +32,6 @@ struct exynos_drm_encoder {
 	struct exynos_drm_display	*display;
 };
 
-static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode)
-{
-	struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder);
-	struct exynos_drm_display *display = exynos_encoder->display;
-
-	DRM_DEBUG_KMS("encoder dpms: %d\n", mode);
-
-	if (display->ops->dpms)
-		display->ops->dpms(display, mode);
-}
-
 static bool
 exynos_drm_encoder_mode_fixup(struct drm_encoder *encoder,
 			       const struct drm_display_mode *mode,
@@ -76,12 +65,7 @@ static void exynos_drm_encoder_mode_set(struct drm_encoder *encoder,
 		display->ops->mode_set(display, adjusted_mode);
 }
 
-static void exynos_drm_encoder_prepare(struct drm_encoder *encoder)
-{
-	/* drm framework doesn't check NULL. */
-}
-
-static void exynos_drm_encoder_commit(struct drm_encoder *encoder)
+static void exynos_drm_encoder_enable(struct drm_encoder *encoder)
 {
 	struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder);
 	struct exynos_drm_display *display = exynos_encoder->display;
@@ -95,10 +79,13 @@ static void exynos_drm_encoder_commit(struct drm_encoder *encoder)
 
 static void exynos_drm_encoder_disable(struct drm_encoder *encoder)
 {
+	struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder);
+	struct exynos_drm_display *display = exynos_encoder->display;
 	struct drm_plane *plane;
 	struct drm_device *dev = encoder->dev;
 
-	exynos_drm_encoder_dpms(encoder, DRM_MODE_DPMS_OFF);
+	if (display->ops->dpms)
+		display->ops->dpms(display, DRM_MODE_DPMS_OFF);
 
 	/* all planes connected to this encoder should be also disabled. */
 	drm_for_each_legacy_plane(plane, &dev->mode_config.plane_list) {
@@ -108,11 +95,9 @@ static void exynos_drm_encoder_disable(struct drm_encoder *encoder)
 }
 
 static struct drm_encoder_helper_funcs exynos_encoder_helper_funcs = {
-	.dpms		= exynos_drm_encoder_dpms,
 	.mode_fixup	= exynos_drm_encoder_mode_fixup,
 	.mode_set	= exynos_drm_encoder_mode_set,
-	.prepare	= exynos_drm_encoder_prepare,
-	.commit		= exynos_drm_encoder_commit,
+	.enable		= exynos_drm_encoder_enable,
 	.disable	= exynos_drm_encoder_disable,
 };
 
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
index ee842c0..5e4c181 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
@@ -385,7 +385,7 @@ static void vidi_connector_destroy(struct drm_connector *connector)
 }
 
 static struct drm_connector_funcs vidi_connector_funcs = {
-	.dpms = drm_helper_connector_dpms,
+	.dpms = drm_atomic_helper_connector_dpms,
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.detect = vidi_detect,
 	.destroy = vidi_connector_destroy,
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 0543e41..c2ff5be 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -1051,7 +1051,7 @@ static void hdmi_connector_destroy(struct drm_connector *connector)
 }
 
 static struct drm_connector_funcs hdmi_connector_funcs = {
-	.dpms = drm_helper_connector_dpms,
+	.dpms = drm_atomic_helper_connector_dpms,
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.detect = hdmi_detect,
 	.destroy = hdmi_connector_destroy,
@@ -2127,8 +2127,8 @@ static void hdmi_dpms(struct exynos_drm_display *display, int mode)
 		 */
 		if (crtc)
 			funcs = crtc->helper_private;
-		if (funcs && funcs->dpms)
-			(*funcs->dpms)(crtc, mode);
+		if (funcs && funcs->disable)
+			(*funcs->disable)(crtc);
 
 		hdmi_poweroff(hdata);
 		break;
-- 
2.1.0

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

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

* Re: [PATCH -v3 00/11] drm/exynos: Add atomic modesetting support
  2015-04-07 18:39       ` Gustavo Padovan
  2015-04-07 19:14         ` Tobias Jakobi
@ 2015-04-08 15:14         ` Inki Dae
  2015-04-09  7:04           ` Joonyoung Shim
  1 sibling, 1 reply; 28+ messages in thread
From: Inki Dae @ 2015-04-08 15:14 UTC (permalink / raw)
  To: Gustavo Padovan; +Cc: linux-samsung-soc, dri-devel

On 2015년 04월 08일 03:39, Gustavo Padovan wrote:
> Hi Inki,
> 
> 2015-04-07 Inki Dae <inki.dae@samsung.com>:
> 
>> On 2015년 04월 07일 00:44, Inki Dae wrote:
>>> 2015-04-06 19:46 GMT+09:00 Inki Dae <inki.dae@samsung.com>:
>>>> On 2015년 04월 04일 03:09, Gustavo Padovan wrote:
>>>>> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>>>>>
>>>>> Hi,
>>>>>
>>>>> Here goes the full support for atomic modesetting on exynos. I've
>>>>> split the patches in the various phases of atomic support.
>>>>>
>>>>> These patches sits on top of the clean up patches I've sent yesterday
>>>>> to this mailing list[1].
>>>>>
>>>>> v2: fixes comments by Joonyoung
>>>>>         - remove unused var in patch 09
>>>>>         - use ->disable instead of outdated ->dpms in hdmi code
>>>>>         - remove WARN_ON from crtc enable/disable
>>>>>
>>>>> v3: fixes comment by Joonyoung
>>>>>       - move the removal of drm_helper_disable_unused_functions() to
>>>>>       separated patch
>>>>
>>>> With this patch series, Kernel booting is halted at end of kernel
>>>> booting. I tested this patch series on Trats2 board based on Exynos4412 SoC.
>>>>
>>>> Below is a part of full booting logs, which was halted,
>>>> [    1.992015] exynos-drm-ipp exynos-drm-ipp: drm ipp registered
>>>> successfully.
>>>> [    1.993009] exynos-drm exynos-drm: bound exynos-drm-vidi (ops
>>>> vidi_component_ops)
>>>> [    1.993036] exynos-drm exynos-drm: bound 11c00000.fimd (ops
>>>> fimd_component_ops)
>>>> [    1.993385] exynos-drm exynos-drm: bound 11c80000.dsi (ops
>>>> exynos_dsi_component_ops)
>>>> [    1.993390] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
>>>> [    1.993393] [drm] No driver support for vblank timestamp query.
>>>> [    1.993442] [drm] Initialized exynos 1.0.0 20110530 on minor 0
>>>> [    2.043358] WARNING: CPU: 2 PID: 1209 at drivers/clk/clk.c:898
>>>> clk_unprepare+0x24/0x2c()
>>>> [    2.051412] Modules linked in:
>>>> [    2.054422] CPU: 2 PID: 1209 Comm: kworker/2:1 Tainted: G        W
>>>>     4.0.0-rc6-00526-gc49d7de-dirty #1278
>>>> [    2.064337] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
>>>> [    2.070428] Workqueue: pm pm_runtime_work>
>>>>
>>>> After that, I tested it again without FIMD and the booting is ok. So I
>>>> guess that this atomic feature has a bug to FIMD driver.
>>>>
>>>
>>> More information,
>>>
>>> The reason the booting is halted is that a deadlock occurs at fbcon
>>> module when register_framebuffer() is called.
>>>
>>> Below are our test results,
>>> - with only cleanup series, FIMD and HDMI work well.
>>> - with cleanup and atomic series, HDMI works well but FIMD doesn't
>>> work - a deadlock occurs.
>>>
>>> Could anyone test it with the atomic series on trats2 board? You can
>>> test it on top of exynos-drm-next-todo branch which contains all
>>> relevant patches,
>>> https://git.kernel.org/cgit/linux/kernel/git/daeinki/drm-exynos.git/log/?h=exynos-drm-next-todo
>>>
>>> Anyway, we will continue to take a look at the this issue why the
>>> deadlock occurs.
>>
>> In addition,
>>
>> I added some codes temporarily to fbmem module which mitigates the
>> deadlock issue. After that, I see below panic log,
>>
>> [    3.254840] Unable to handle kernel NULL pointer dereference at
>> virtual address 000000a4
>> [    3.262870] pgd = c0004000
>> [    3.265539] [000000a4] *pgd=00000000
>> [    3.269102] Internal error: Oops: 5 [#1] PREEMPT SMP ARM
>> [    3.274392] Modules linked in:
>> [    3.277435] CPU: 2 PID: 1 Comm: swapper/0 Tainted: G        W
>> 4.0.0-rc6-00526-gc49d7de-dirty #1308
>> [    3.286892] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
>> [    3.292970] task: ee878000 ti: ee880000 task.ti: ee880000
>> [    3.298356] PC is at exynos_plane_atomic_update+0x24/0x1d4
>> [    3.303824] LR is at drm_atomic_helper_commit_planes+0xa4/0x18c
>> [    3.309723] pc : [<c028bff4>]    lr : [<c0265308>]    psr: 60000113
>> [    3.309723] sp : ee881b38  ip : 00000020  fp : 00000000
>> [    3.321179] r10: c04cfc00  r9 : 00000008  r8 : eebfb9c0
>> [    3.326387] r7 : 00000002  r6 : 00000000  r5 : 00000000  r4 : ee925308
>> [    3.332897] r3 : ee329fc0  r2 : 00000000  r1 : 00000000  r0 : ee925308
>> [    3.339409] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM
>> Segment kernel
>> [    3.346699] Control: 10c5387d  Table: 4000404a  DAC: 00000015
>> [    3.352427] Process swapper/0 (pid: 1, stack limit = 0xee880210)
>> [    3.358416] Stack: (0xee881b38 to 0xee882000)
>> [    3.362757] 1b20:
>>    c0726794 00000008
>> [    3.370919] 1b40: 00000002 ee925308 00000000 ee329e00 00000002
>> eebfb9c0 00000008 c04cfc00
>> [    3.379078] 1b60: 00000000 c0265308 00000008 00000000 ee329e00
>> ee0a8000 00000008 00000000
>> [    3.387237] 1b80: 00000000 c0267304 ee329e00 ee8efe00 ee914c00
>> 00000002 00000000 00000002
>> [    3.395396] 1ba0: 00000000 c026609c c0265ef0 00000000 ee914c00
>> 00000028 ee8eff00 00000001
>> [    3.403555] 1bc0: 00000000 c06c8380 00000000 c02770d0 ee8efe00
>> 00000000 00000028 ee8eff00
>> [    3.411714] 1be0: 00000001 c0267a2c ee0a8000 c0286214 ee8eff00
>> ee8eff00 ee0a8000 00000000
>> [    3.419874] 1c00: 00000000 c0722ad4 ee35e000 c0269900 00000000
>> ee915400 00000000 c0269958
>> [    3.428033] 1c20: ee808c00 c020cc8c c0248620 c05d5448 ee808c00
>> ee808c00 ee808d34 00000000
>> [    3.436192] 1c40: 00000000 00000001 00000066 c0724acc c0724fd4
>> 0000005b 00000066 0000005b
>> [    3.444351] 1c60: c05b28cc ee808c00 ee808d74 00000000 00000000
>> 00000001 ee808c00 00000000
>> [    3.452511] 1c80: 00000001 c0246564 c04b4950 00000000 c0724fdc
>> c07250f0 00000001 c0248568
>> [    3.460670] 1ca0: c049cc58 c06ce2e4 00000000 0000003e c070da2c
>> c05d09ec 00000000 c0724fcc
>> [    3.468829] 1cc0: 00000000 c04b4950 c0724fe8 00000000 00000000
>> 00000000 0000003e 00000000
>> [    3.476988] 1ce0: c0725604 c0248de0 c05d54ac 00000001 ee074780
>> 00000001 c0724920 c06c8380
>> [    3.485148] 1d00: c0724acc 00008380 00000005 00000000 00000000
>> 01d00000 00000000 c020cd5c
>> [    3.493306] 1d20: c06c8754 ffffffff ee881d88 c0039890 c06c8754
>> 00000005 ee881d88 ffffffff
>> [    3.501466] 1d40: ee915644 ee91540c 01d00000 c0039bec 00000000
>> 00000000 ee915644 c06badb8
>> [    3.509625] 1d60: ee915400 c06badb8 00000000 c0039c1c 00000000
>> ee915400 c06badb8 c0215980
>> [    3.517784] 1d80: c05d101c 00000000 ee915400 00000000 00000000
>> 00000000 000002d0 00000500
>> [    3.525943] 1da0: 00000000 00000000 00000000 00000000 00000000
>> 00000000 00000000 00000000
>> [    3.534103] 1dc0: 00000000 00000020 ee8efe50 ee8eff00 ee915400
>> 00000001 ee8efe50 c0726794
>> [    3.542262] 1de0: 00000002 c0269bc4 000002d0 00000500 000002d0
>> 00000500 00000020 00000018
>> [    3.550421] 1e00: ee0a8000 00000000 eebfbdc0 ee8eff00 ee0a8190
>> c028a374 ee0a8288 00000001
>> [    3.558580] 1e20: ee0a8294 ee0a8000 ee0a8190 c025ff20 00000000
>> c0491308 c06933e0 c0492b3c
>> [    3.566740] 1e40: ee08b374 ee914428 ee9000d4 ee08b200 ee08b208
>> 00000000 00000098 c06933e0
>> [    3.574899] 1e60: 00000000 c028e764 ee08b200 c0288088 ee9000d0
>> ee9000d4 ee08b200 c029c5bc
>> [    3.583058] 1e80: c0726874 ee08b208 c06d42a4 00000000 00000000
>> c02a2504 ee08b208 c06d42a4
>> [    3.591217] 1ea0: ee08b23c c06d2b7c eebf83c0 c02a2708 00000000
>> c06d42a4 c02a267c c02a0ad8
>> [    3.599376] 1ec0: ee9bf674 ee06db40 c06d42a4 ee06df00 00000000
>> c02a1d2c c05dee34 c06bcbe0
>> [    3.607535] 1ee0: c0681fc8 c06d42a4 c06bcbe0 c0681fc8 00000000
>> c02a2d04 c06bcbe0 c06bcbe0
>> [    3.615695] 1f00: c0681fc8 c0008990 ee855980 c04971d0 00000025
>> 00000000 60000100 c06c066c
>> [    3.623854] 1f20: 00000000 c06c066c 60000113 00000003 ef7fc9ed
>> ef7fc9de c04a96e8 c00384d0
>> [    3.632013] 1f40: c05f26cc ef7fc9fc 00000006 00000006 c06c0648
>> ef7fc940 c06b3f98 00000006
>> [    3.640172] 1f60: c06933d8 c06eabc0 c06eabc0 00000098 c06933e0
>> c0668dac 00000006 00000006
>> [    3.648331] 1f80: c0668594 c003c944 0000abc0 c048bed0 00000000
>> 00000000 00000000 00000000
>> [    3.656490] 1fa0: 00000000 c048bedc 00000000 c000e7c0 00000000
>> 00000000 00000000 00000000
>> [    3.664649] 1fc0: 00000000 00000000 00000000 00000000 00000000
>> 00000000 00000000 00000000
>> [    3.672809] 1fe0: 00000000 00000000 00000000 00000000 00000013
>> 00000000 ffffffff ffffffff
>> [    3.680977] [<c028bff4>] (exynos_plane_atomic_update) from
>> [<c0265308>] (drm_atomic_helper_commit_planes+0xa4/0x18c)
>> [    3.691475] [<c0265308>] (drm_atomic_helper_commit_planes) from
>> [<c0267304>] (drm_atomic_helper_commit+0xec/0x144)
>> [    3.701804] [<c0267304>] (drm_atomic_helper_commit) from [<c026609c>]
>> (drm_atomic_helper_set_config+0x1ac/0x3d0)
>> [    3.711962] [<c026609c>] (drm_atomic_helper_set_config) from
>> [<c02770d0>] (drm_mode_set_config_internal+0x58/0xd4)
>> [    3.722288] [<c02770d0>] (drm_mode_set_config_internal) from
>> [<c0267a2c>] (restore_fbdev_mode+0xd4/0xf4)
>> [    3.731749] [<c0267a2c>] (restore_fbdev_mode) from [<c0269900>]
>> (drm_fb_helper_restore_fbdev_mode_unlocked+0x1c/0x5c)
>> [    3.742338] [<c0269900>] (drm_fb_helper_restore_fbdev_mode_unlocked)
>> from [<c0269958>] (drm_fb_helper_set_par+0x18/0x34)
>> [    3.753191] [<c0269958>] (drm_fb_helper_set_par) from [<c020cc8c>]
>> (fbcon_init+0x5c8/0x614)
>> [    3.761525] [<c020cc8c>] (fbcon_init) from [<c0246564>]
>> (visual_init+0xa4/0xec)
>>
>> exynos_plane_atomic_update function calls internally
>> exynos_plane_mode_set function, and this call incurs a panic because
>> exynos_plane_mode_set function is called with null argument -
>> state->crtc is null.
> 
> I just checked the value of state->crtc for me at this point of the flow
> and it is not NULL. I wonder why this works differently for your board.
> Could you check if state is null or if state->crtc is null?

state->crtc is null. For the test, I added printk - which prints out
address values of state and state->crtc address - to
exynos_plane_atomic_update function.

Below is the test result,
# modetest -v -s 25@23:720x1280 -P 23:100x100+0+0
[    5.457989] exynos_plane_atomic_update: state = eea11880, state->crtc
= ee914c00
...snip...
[    7.005817] exynos_plane_atomic_update: state = ee265b40, state->crtc
= ee914c00
[    7.089881] exynos_plane_atomic_update: state = ee265780, state->crtc
=   (null)
[    7.095823] Unable to handle kernel NULL pointer dereference at
virtual address 000000a4
[    7.103884] pgd = c0004000
[    7.106581] [000000a4] *pgd=00000000
[    7.110120] Internal error: Oops: 17 [#1] PREEMPT SMP ARM
[    7.115497] Modules linked in:
[    7.118540] CPU: 0 PID: 1458 Comm: modetest Not tainted
4.0.0-rc6-00526-gc49d7de-dirty #1329
[    7.126955] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[    7.133033] task: ee1eee80 ti: ee1be000 task.ti: ee1be000
[    7.138426] PC is at exynos_plane_atomic_update+0x60/0x200
[    7.143882] LR is at 0x0
[    7.146401] pc : [<c028c014>]    lr : [<00000000>]    psr: 60000013
[    7.146401] sp : ee1bfde0  ip : 00000000  fp : 00000000
[    7.157856] r10: 00000000  r9 : 00000000  r8 : 00000000
[    7.163065] r7 : 00000000  r6 : 00000000  r5 : 00000000  r4 : ee926228
[    7.169574] r3 : 00000004  r2 : 00000000  r1 : 00000000  r0 : 00000000
[    7.176086] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM
Segment user
[    7.183202] Control: 10c5387d  Table: 6dc2004a  DAC: 00000015
[    7.188932] Process modetest (pid: 1458, stack limit = 0xee1be210)
[    7.195094] Stack: (0xee1bfde0 to 0xee1c0000)
[    7.199438] fde0: 00000000 ee265740 c071dd14 00000005 00000001
ee926228 00000001 ee265740
[    7.207597] fe00: 00000001 ee265c80 00000005 c04c9c18 00100100
c0265314 00000005 00000000
[    7.215755] fe20: ee265740 ee350000 00000005 00000000 ee350000
c0267310 00000000 ee265780
[    7.223915] fe40: ee926228 ee265740 ee350000 ee350260 ee350000
c0265ed0 ee926228 eeafb840
[    7.232074] fe60: ee350000 ee3502b0 ee350000 c027717c ee926228
eeafb840 ee350000 c02772a4
[    7.240233] fe80: ee3501ec ee3501ec ee3501ec c0704fac 60000013
c048acd0 ee350260 c0704fac
[    7.248392] fea0: 60000013 eeafb840 ee369b40 ee369b40 edcd4c64
c027c180 edcd4ca8 edcd4c00
[    7.256551] fec0: 00200200 ee350000 ee350034 edcd4ca4 ee350000
c026d51c ee419558 00000001
[    7.264711] fee0: ee17bf00 ee350154 60000013 00000000 ee419558
edcd4300 edc50598 00000000
[    7.272869] ff00: ee8ee510 ee6b3428 00000008 edcd4308 00000000
c00cd6a8 00000000 00000000
[    7.281029] ff20: ee1ef1f4 00000000 c06e3d40 ee1eee80 ee1ef204
ee1be000 00000000 c0037594
[    7.289188] ff40: ee1eee80 edc561c0 00000001 ee1bff60 ee1ef204
c00222d8 0001d008 c00ccb30
[    7.297348] ff60: 00000000 00000000 0001d008 eebd8c80 00000000
b6ef2750 000000f8 c000e8a4
[    7.305506] ff80: ee1be000 00000000 00000000 c002378c 0006560a
00000000 b6ef2750 c0023814
[    7.313666] ffa0: 0006560a c000e720 0006560a 00000000 00000000
000655f0 00000000 b6f4d4c0
[    7.321825] ffc0: 0006560a 00000000 b6ef2750 000000f8 00000000
00000000 b6f51000 00000000
[    7.329984] ffe0: 000000f8 beac7a7c b6e8eaf7 b6e41946 60000030
00000000 6f7fd821 6f7fdc21
[    7.338162] [<c028c014>] (exynos_plane_atomic_update) from
[<c0265314>] (drm_atomic_helper_commit_planes+0xa4/0x18c)
[    7.348652] [<c0265314>] (drm_atomic_helper_commit_planes) from
[<c0267310>] (drm_atomic_helper_commit+0xec/0x144)
[    7.358979] [<c0267310>] (drm_atomic_helper_commit) from [<c0265ed0>]
(drm_atomic_helper_disable_plane+0xcc/0xf8)
[    7.369224] [<c0265ed0>] (drm_atomic_helper_disable_plane) from
[<c027717c>] (drm_plane_force_disable+0x24/0x5c)
[    7.379376] [<c027717c>] (drm_plane_force_disable) from [<c02772a4>]
(drm_framebuffer_remove+0xf0/0x108)
[    7.388838] [<c02772a4>] (drm_framebuffer_remove) from [<c027c180>]
(drm_fb_release+0x70/0x88)
[    7.397432] [<c027c180>] (drm_fb_release) from [<c026d51c>]
(drm_release+0x41c/0x4c8)
[    7.405245] [<c026d51c>] (drm_release) from [<c00cd6a8>]
(__fput+0x80/0x1c8)
[    7.412279] [<c00cd6a8>] (__fput) from [<c0037594>]
(task_work_run+0xac/0xe4)
[    7.419398] [<c0037594>] (task_work_run) from [<c00222d8>]
(do_exit+0x2e8/0x980)
[    7.426769] [<c00222d8>] (do_exit) from [<c002378c>]
(do_group_exit+0x4c/0xc4)
[    7.433971] [<c002378c>] (do_group_exit) from [<c0023814>]
(__wake_up_parent+0x0/0x18)
[    7.441870] Code: e1d592b2 e1d502b6 e1d5a2be e1d552ba (e59630a4)
[    7.447990] ---[ end trace 3cb27f1bd07f8c05 ]---
[    7.452561] Fixing recursive fault but reboot is needed!

However, please know that I disabled other crtc drivers for the test
because with only fimd enabled, kernel booting was ok and at least I
could test modetest app although I faced with a kernel panic. As I
mentioned already, with crtc drivers more than two, kernel booting is
halted.

P.s. I tested it on exynos-drm-next-todo branch. If you tried to test it
on other branch, then please test it on same branch, exynos-drm-next-todo.

Thanks,
Inki Dae

> 
> 	Gustavo
> 

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

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

* Re: [PATCH -v3 00/11] drm/exynos: Add atomic modesetting support
  2015-04-08 15:14         ` Inki Dae
@ 2015-04-09  7:04           ` Joonyoung Shim
  0 siblings, 0 replies; 28+ messages in thread
From: Joonyoung Shim @ 2015-04-09  7:04 UTC (permalink / raw)
  To: Inki Dae, Gustavo Padovan; +Cc: linux-samsung-soc, dri-devel

Hi,

On 04/09/2015 12:14 AM, Inki Dae wrote:
> On 2015년 04월 08일 03:39, Gustavo Padovan wrote:
>> Hi Inki,
>>
>> 2015-04-07 Inki Dae <inki.dae@samsung.com>:
>>
>>> On 2015년 04월 07일 00:44, Inki Dae wrote:
>>>> 2015-04-06 19:46 GMT+09:00 Inki Dae <inki.dae@samsung.com>:
>>>>> On 2015년 04월 04일 03:09, Gustavo Padovan wrote:
>>>>>> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> Here goes the full support for atomic modesetting on exynos. I've
>>>>>> split the patches in the various phases of atomic support.
>>>>>>
>>>>>> These patches sits on top of the clean up patches I've sent yesterday
>>>>>> to this mailing list[1].
>>>>>>
>>>>>> v2: fixes comments by Joonyoung
>>>>>>         - remove unused var in patch 09
>>>>>>         - use ->disable instead of outdated ->dpms in hdmi code
>>>>>>         - remove WARN_ON from crtc enable/disable
>>>>>>
>>>>>> v3: fixes comment by Joonyoung
>>>>>>       - move the removal of drm_helper_disable_unused_functions() to
>>>>>>       separated patch
>>>>>
>>>>> With this patch series, Kernel booting is halted at end of kernel
>>>>> booting. I tested this patch series on Trats2 board based on Exynos4412 SoC.
>>>>>
>>>>> Below is a part of full booting logs, which was halted,
>>>>> [    1.992015] exynos-drm-ipp exynos-drm-ipp: drm ipp registered
>>>>> successfully.
>>>>> [    1.993009] exynos-drm exynos-drm: bound exynos-drm-vidi (ops
>>>>> vidi_component_ops)
>>>>> [    1.993036] exynos-drm exynos-drm: bound 11c00000.fimd (ops
>>>>> fimd_component_ops)
>>>>> [    1.993385] exynos-drm exynos-drm: bound 11c80000.dsi (ops
>>>>> exynos_dsi_component_ops)
>>>>> [    1.993390] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
>>>>> [    1.993393] [drm] No driver support for vblank timestamp query.
>>>>> [    1.993442] [drm] Initialized exynos 1.0.0 20110530 on minor 0
>>>>> [    2.043358] WARNING: CPU: 2 PID: 1209 at drivers/clk/clk.c:898
>>>>> clk_unprepare+0x24/0x2c()
>>>>> [    2.051412] Modules linked in:
>>>>> [    2.054422] CPU: 2 PID: 1209 Comm: kworker/2:1 Tainted: G        W
>>>>>     4.0.0-rc6-00526-gc49d7de-dirty #1278
>>>>> [    2.064337] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
>>>>> [    2.070428] Workqueue: pm pm_runtime_work>
>>>>>
>>>>> After that, I tested it again without FIMD and the booting is ok. So I
>>>>> guess that this atomic feature has a bug to FIMD driver.
>>>>>
>>>>
>>>> More information,
>>>>
>>>> The reason the booting is halted is that a deadlock occurs at fbcon
>>>> module when register_framebuffer() is called.
>>>>
>>>> Below are our test results,
>>>> - with only cleanup series, FIMD and HDMI work well.
>>>> - with cleanup and atomic series, HDMI works well but FIMD doesn't
>>>> work - a deadlock occurs.
>>>>
>>>> Could anyone test it with the atomic series on trats2 board? You can
>>>> test it on top of exynos-drm-next-todo branch which contains all
>>>> relevant patches,
>>>> https://git.kernel.org/cgit/linux/kernel/git/daeinki/drm-exynos.git/log/?h=exynos-drm-next-todo
>>>>
>>>> Anyway, we will continue to take a look at the this issue why the
>>>> deadlock occurs.
>>>
>>> In addition,
>>>
>>> I added some codes temporarily to fbmem module which mitigates the
>>> deadlock issue. After that, I see below panic log,
>>>
>>> [    3.254840] Unable to handle kernel NULL pointer dereference at
>>> virtual address 000000a4
>>> [    3.262870] pgd = c0004000
>>> [    3.265539] [000000a4] *pgd=00000000
>>> [    3.269102] Internal error: Oops: 5 [#1] PREEMPT SMP ARM
>>> [    3.274392] Modules linked in:
>>> [    3.277435] CPU: 2 PID: 1 Comm: swapper/0 Tainted: G        W
>>> 4.0.0-rc6-00526-gc49d7de-dirty #1308
>>> [    3.286892] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
>>> [    3.292970] task: ee878000 ti: ee880000 task.ti: ee880000
>>> [    3.298356] PC is at exynos_plane_atomic_update+0x24/0x1d4
>>> [    3.303824] LR is at drm_atomic_helper_commit_planes+0xa4/0x18c
>>> [    3.309723] pc : [<c028bff4>]    lr : [<c0265308>]    psr: 60000113
>>> [    3.309723] sp : ee881b38  ip : 00000020  fp : 00000000
>>> [    3.321179] r10: c04cfc00  r9 : 00000008  r8 : eebfb9c0
>>> [    3.326387] r7 : 00000002  r6 : 00000000  r5 : 00000000  r4 : ee925308
>>> [    3.332897] r3 : ee329fc0  r2 : 00000000  r1 : 00000000  r0 : ee925308
>>> [    3.339409] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM
>>> Segment kernel
>>> [    3.346699] Control: 10c5387d  Table: 4000404a  DAC: 00000015
>>> [    3.352427] Process swapper/0 (pid: 1, stack limit = 0xee880210)
>>> [    3.358416] Stack: (0xee881b38 to 0xee882000)
>>> [    3.362757] 1b20:
>>>    c0726794 00000008
>>> [    3.370919] 1b40: 00000002 ee925308 00000000 ee329e00 00000002
>>> eebfb9c0 00000008 c04cfc00
>>> [    3.379078] 1b60: 00000000 c0265308 00000008 00000000 ee329e00
>>> ee0a8000 00000008 00000000
>>> [    3.387237] 1b80: 00000000 c0267304 ee329e00 ee8efe00 ee914c00
>>> 00000002 00000000 00000002
>>> [    3.395396] 1ba0: 00000000 c026609c c0265ef0 00000000 ee914c00
>>> 00000028 ee8eff00 00000001
>>> [    3.403555] 1bc0: 00000000 c06c8380 00000000 c02770d0 ee8efe00
>>> 00000000 00000028 ee8eff00
>>> [    3.411714] 1be0: 00000001 c0267a2c ee0a8000 c0286214 ee8eff00
>>> ee8eff00 ee0a8000 00000000
>>> [    3.419874] 1c00: 00000000 c0722ad4 ee35e000 c0269900 00000000
>>> ee915400 00000000 c0269958
>>> [    3.428033] 1c20: ee808c00 c020cc8c c0248620 c05d5448 ee808c00
>>> ee808c00 ee808d34 00000000
>>> [    3.436192] 1c40: 00000000 00000001 00000066 c0724acc c0724fd4
>>> 0000005b 00000066 0000005b
>>> [    3.444351] 1c60: c05b28cc ee808c00 ee808d74 00000000 00000000
>>> 00000001 ee808c00 00000000
>>> [    3.452511] 1c80: 00000001 c0246564 c04b4950 00000000 c0724fdc
>>> c07250f0 00000001 c0248568
>>> [    3.460670] 1ca0: c049cc58 c06ce2e4 00000000 0000003e c070da2c
>>> c05d09ec 00000000 c0724fcc
>>> [    3.468829] 1cc0: 00000000 c04b4950 c0724fe8 00000000 00000000
>>> 00000000 0000003e 00000000
>>> [    3.476988] 1ce0: c0725604 c0248de0 c05d54ac 00000001 ee074780
>>> 00000001 c0724920 c06c8380
>>> [    3.485148] 1d00: c0724acc 00008380 00000005 00000000 00000000
>>> 01d00000 00000000 c020cd5c
>>> [    3.493306] 1d20: c06c8754 ffffffff ee881d88 c0039890 c06c8754
>>> 00000005 ee881d88 ffffffff
>>> [    3.501466] 1d40: ee915644 ee91540c 01d00000 c0039bec 00000000
>>> 00000000 ee915644 c06badb8
>>> [    3.509625] 1d60: ee915400 c06badb8 00000000 c0039c1c 00000000
>>> ee915400 c06badb8 c0215980
>>> [    3.517784] 1d80: c05d101c 00000000 ee915400 00000000 00000000
>>> 00000000 000002d0 00000500
>>> [    3.525943] 1da0: 00000000 00000000 00000000 00000000 00000000
>>> 00000000 00000000 00000000
>>> [    3.534103] 1dc0: 00000000 00000020 ee8efe50 ee8eff00 ee915400
>>> 00000001 ee8efe50 c0726794
>>> [    3.542262] 1de0: 00000002 c0269bc4 000002d0 00000500 000002d0
>>> 00000500 00000020 00000018
>>> [    3.550421] 1e00: ee0a8000 00000000 eebfbdc0 ee8eff00 ee0a8190
>>> c028a374 ee0a8288 00000001
>>> [    3.558580] 1e20: ee0a8294 ee0a8000 ee0a8190 c025ff20 00000000
>>> c0491308 c06933e0 c0492b3c
>>> [    3.566740] 1e40: ee08b374 ee914428 ee9000d4 ee08b200 ee08b208
>>> 00000000 00000098 c06933e0
>>> [    3.574899] 1e60: 00000000 c028e764 ee08b200 c0288088 ee9000d0
>>> ee9000d4 ee08b200 c029c5bc
>>> [    3.583058] 1e80: c0726874 ee08b208 c06d42a4 00000000 00000000
>>> c02a2504 ee08b208 c06d42a4
>>> [    3.591217] 1ea0: ee08b23c c06d2b7c eebf83c0 c02a2708 00000000
>>> c06d42a4 c02a267c c02a0ad8
>>> [    3.599376] 1ec0: ee9bf674 ee06db40 c06d42a4 ee06df00 00000000
>>> c02a1d2c c05dee34 c06bcbe0
>>> [    3.607535] 1ee0: c0681fc8 c06d42a4 c06bcbe0 c0681fc8 00000000
>>> c02a2d04 c06bcbe0 c06bcbe0
>>> [    3.615695] 1f00: c0681fc8 c0008990 ee855980 c04971d0 00000025
>>> 00000000 60000100 c06c066c
>>> [    3.623854] 1f20: 00000000 c06c066c 60000113 00000003 ef7fc9ed
>>> ef7fc9de c04a96e8 c00384d0
>>> [    3.632013] 1f40: c05f26cc ef7fc9fc 00000006 00000006 c06c0648
>>> ef7fc940 c06b3f98 00000006
>>> [    3.640172] 1f60: c06933d8 c06eabc0 c06eabc0 00000098 c06933e0
>>> c0668dac 00000006 00000006
>>> [    3.648331] 1f80: c0668594 c003c944 0000abc0 c048bed0 00000000
>>> 00000000 00000000 00000000
>>> [    3.656490] 1fa0: 00000000 c048bedc 00000000 c000e7c0 00000000
>>> 00000000 00000000 00000000
>>> [    3.664649] 1fc0: 00000000 00000000 00000000 00000000 00000000
>>> 00000000 00000000 00000000
>>> [    3.672809] 1fe0: 00000000 00000000 00000000 00000000 00000013
>>> 00000000 ffffffff ffffffff
>>> [    3.680977] [<c028bff4>] (exynos_plane_atomic_update) from
>>> [<c0265308>] (drm_atomic_helper_commit_planes+0xa4/0x18c)
>>> [    3.691475] [<c0265308>] (drm_atomic_helper_commit_planes) from
>>> [<c0267304>] (drm_atomic_helper_commit+0xec/0x144)
>>> [    3.701804] [<c0267304>] (drm_atomic_helper_commit) from [<c026609c>]
>>> (drm_atomic_helper_set_config+0x1ac/0x3d0)
>>> [    3.711962] [<c026609c>] (drm_atomic_helper_set_config) from
>>> [<c02770d0>] (drm_mode_set_config_internal+0x58/0xd4)
>>> [    3.722288] [<c02770d0>] (drm_mode_set_config_internal) from
>>> [<c0267a2c>] (restore_fbdev_mode+0xd4/0xf4)
>>> [    3.731749] [<c0267a2c>] (restore_fbdev_mode) from [<c0269900>]
>>> (drm_fb_helper_restore_fbdev_mode_unlocked+0x1c/0x5c)
>>> [    3.742338] [<c0269900>] (drm_fb_helper_restore_fbdev_mode_unlocked)
>>> from [<c0269958>] (drm_fb_helper_set_par+0x18/0x34)
>>> [    3.753191] [<c0269958>] (drm_fb_helper_set_par) from [<c020cc8c>]
>>> (fbcon_init+0x5c8/0x614)
>>> [    3.761525] [<c020cc8c>] (fbcon_init) from [<c0246564>]
>>> (visual_init+0xa4/0xec)
>>>
>>> exynos_plane_atomic_update function calls internally
>>> exynos_plane_mode_set function, and this call incurs a panic because
>>> exynos_plane_mode_set function is called with null argument -
>>> state->crtc is null.
>>
>> I just checked the value of state->crtc for me at this point of the flow
>> and it is not NULL. I wonder why this works differently for your board.
>> Could you check if state is null or if state->crtc is null?
> 
> state->crtc is null. For the test, I added printk - which prints out
> address values of state and state->crtc address - to
> exynos_plane_atomic_update function.
> 
> Below is the test result,
> # modetest -v -s 25@23:720x1280 -P 23:100x100+0+0
> [    5.457989] exynos_plane_atomic_update: state = eea11880, state->crtc
> = ee914c00
> ...snip...
> [    7.005817] exynos_plane_atomic_update: state = ee265b40, state->crtc
> = ee914c00
> [    7.089881] exynos_plane_atomic_update: state = ee265780, state->crtc
> =   (null)
> [    7.095823] Unable to handle kernel NULL pointer dereference at
> virtual address 000000a4
> [    7.103884] pgd = c0004000
> [    7.106581] [000000a4] *pgd=00000000
> [    7.110120] Internal error: Oops: 17 [#1] PREEMPT SMP ARM
> [    7.115497] Modules linked in:
> [    7.118540] CPU: 0 PID: 1458 Comm: modetest Not tainted
> 4.0.0-rc6-00526-gc49d7de-dirty #1329
> [    7.126955] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
> [    7.133033] task: ee1eee80 ti: ee1be000 task.ti: ee1be000
> [    7.138426] PC is at exynos_plane_atomic_update+0x60/0x200
> [    7.143882] LR is at 0x0
> [    7.146401] pc : [<c028c014>]    lr : [<00000000>]    psr: 60000013
> [    7.146401] sp : ee1bfde0  ip : 00000000  fp : 00000000
> [    7.157856] r10: 00000000  r9 : 00000000  r8 : 00000000
> [    7.163065] r7 : 00000000  r6 : 00000000  r5 : 00000000  r4 : ee926228
> [    7.169574] r3 : 00000004  r2 : 00000000  r1 : 00000000  r0 : 00000000
> [    7.176086] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM
> Segment user
> [    7.183202] Control: 10c5387d  Table: 6dc2004a  DAC: 00000015
> [    7.188932] Process modetest (pid: 1458, stack limit = 0xee1be210)
> [    7.195094] Stack: (0xee1bfde0 to 0xee1c0000)
> [    7.199438] fde0: 00000000 ee265740 c071dd14 00000005 00000001
> ee926228 00000001 ee265740
> [    7.207597] fe00: 00000001 ee265c80 00000005 c04c9c18 00100100
> c0265314 00000005 00000000
> [    7.215755] fe20: ee265740 ee350000 00000005 00000000 ee350000
> c0267310 00000000 ee265780
> [    7.223915] fe40: ee926228 ee265740 ee350000 ee350260 ee350000
> c0265ed0 ee926228 eeafb840
> [    7.232074] fe60: ee350000 ee3502b0 ee350000 c027717c ee926228
> eeafb840 ee350000 c02772a4
> [    7.240233] fe80: ee3501ec ee3501ec ee3501ec c0704fac 60000013
> c048acd0 ee350260 c0704fac
> [    7.248392] fea0: 60000013 eeafb840 ee369b40 ee369b40 edcd4c64
> c027c180 edcd4ca8 edcd4c00
> [    7.256551] fec0: 00200200 ee350000 ee350034 edcd4ca4 ee350000
> c026d51c ee419558 00000001
> [    7.264711] fee0: ee17bf00 ee350154 60000013 00000000 ee419558
> edcd4300 edc50598 00000000
> [    7.272869] ff00: ee8ee510 ee6b3428 00000008 edcd4308 00000000
> c00cd6a8 00000000 00000000
> [    7.281029] ff20: ee1ef1f4 00000000 c06e3d40 ee1eee80 ee1ef204
> ee1be000 00000000 c0037594
> [    7.289188] ff40: ee1eee80 edc561c0 00000001 ee1bff60 ee1ef204
> c00222d8 0001d008 c00ccb30
> [    7.297348] ff60: 00000000 00000000 0001d008 eebd8c80 00000000
> b6ef2750 000000f8 c000e8a4
> [    7.305506] ff80: ee1be000 00000000 00000000 c002378c 0006560a
> 00000000 b6ef2750 c0023814
> [    7.313666] ffa0: 0006560a c000e720 0006560a 00000000 00000000
> 000655f0 00000000 b6f4d4c0
> [    7.321825] ffc0: 0006560a 00000000 b6ef2750 000000f8 00000000
> 00000000 b6f51000 00000000
> [    7.329984] ffe0: 000000f8 beac7a7c b6e8eaf7 b6e41946 60000030
> 00000000 6f7fd821 6f7fdc21
> [    7.338162] [<c028c014>] (exynos_plane_atomic_update) from
> [<c0265314>] (drm_atomic_helper_commit_planes+0xa4/0x18c)
> [    7.348652] [<c0265314>] (drm_atomic_helper_commit_planes) from
> [<c0267310>] (drm_atomic_helper_commit+0xec/0x144)
> [    7.358979] [<c0267310>] (drm_atomic_helper_commit) from [<c0265ed0>]
> (drm_atomic_helper_disable_plane+0xcc/0xf8)
> [    7.369224] [<c0265ed0>] (drm_atomic_helper_disable_plane) from
> [<c027717c>] (drm_plane_force_disable+0x24/0x5c)
> [    7.379376] [<c027717c>] (drm_plane_force_disable) from [<c02772a4>]
> (drm_framebuffer_remove+0xf0/0x108)
> [    7.388838] [<c02772a4>] (drm_framebuffer_remove) from [<c027c180>]
> (drm_fb_release+0x70/0x88)
> [    7.397432] [<c027c180>] (drm_fb_release) from [<c026d51c>]
> (drm_release+0x41c/0x4c8)
> [    7.405245] [<c026d51c>] (drm_release) from [<c00cd6a8>]
> (__fput+0x80/0x1c8)
> [    7.412279] [<c00cd6a8>] (__fput) from [<c0037594>]
> (task_work_run+0xac/0xe4)
> [    7.419398] [<c0037594>] (task_work_run) from [<c00222d8>]
> (do_exit+0x2e8/0x980)
> [    7.426769] [<c00222d8>] (do_exit) from [<c002378c>]
> (do_group_exit+0x4c/0xc4)
> [    7.433971] [<c002378c>] (do_group_exit) from [<c0023814>]
> (__wake_up_parent+0x0/0x18)
> [    7.441870] Code: e1d592b2 e1d502b6 e1d5a2be e1d552ba (e59630a4)
> [    7.447990] ---[ end trace 3cb27f1bd07f8c05 ]---
> [    7.452561] Fixing recursive fault but reboot is needed!
> 

This problem occurs when try to disable again the plane disabled
already.

Please see below codes of drm_atomic_helper_commit_planes function.

		/*
		 * Special-case disabling the plane if drivers support it.
		 */
		if (drm_atomic_plane_disabling(plane, old_plane_state) &&
		    funcs->atomic_disable)
			funcs->atomic_disable(plane, old_plane_state);
		else
			funcs->atomic_update(plane, old_plane_state);

Now funcs->atomic_update is called even though we try to disable plane
because already the plane was disabled.

I posted a patch to fix this problem.
Please refer "drm/exynos: use drm_plane_force_disable" patch.

Thanks.

> However, please know that I disabled other crtc drivers for the test
> because with only fimd enabled, kernel booting was ok and at least I
> could test modetest app although I faced with a kernel panic. As I
> mentioned already, with crtc drivers more than two, kernel booting is
> halted.
> 
> P.s. I tested it on exynos-drm-next-todo branch. If you tried to test it
> on other branch, then please test it on same branch, exynos-drm-next-todo.
> 
> Thanks,
> Inki Dae
> 
>>
>> 	Gustavo
>>
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
> 

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

* [PATCH] drm/exynos: remove unnecessary calls to disable_plane()
  2015-04-03 18:09 ` [PATCH -v3 11/11] drm/exynos: atomic dpms support Gustavo Padovan
  2015-04-05 14:42   ` Inki Dae
@ 2015-04-10 18:57   ` Gustavo Padovan
  2015-04-13  6:32     ` Joonyoung Shim
  1 sibling, 1 reply; 28+ messages in thread
From: Gustavo Padovan @ 2015-04-10 18:57 UTC (permalink / raw)
  To: linux-samsung-soc; +Cc: dri-devel, inki.dae, jy0922.shim, Gustavo Padovan

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

The planes are already disabled by the drm_atomic_helper_commit() code
so we don't need to disable the in these two places.

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_encoder.c |  8 --------
 2 files changed, 19 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 519c569..9bf25ff 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -47,8 +47,6 @@ static void exynos_drm_crtc_enable(struct drm_crtc *crtc)
 static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
 {
 	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
-	struct drm_plane *plane;
-	int ret;
 
 	if (!exynos_crtc->enabled)
 		return;
@@ -64,15 +62,6 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
 		exynos_crtc->ops->dpms(exynos_crtc, DRM_MODE_DPMS_OFF);
 
 	exynos_crtc->enabled = false;
-
-	drm_for_each_legacy_plane(plane, &crtc->dev->mode_config.plane_list) {
-		if (plane->crtc != crtc)
-			continue;
-
-		ret = plane->funcs->disable_plane(plane);
-		if (ret)
-			DRM_ERROR("Failed to disable plane %d\n", ret);
-	}
 }
 
 static bool
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
index 0648ba4..7b89fd5 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
@@ -81,17 +81,9 @@ static void exynos_drm_encoder_disable(struct drm_encoder *encoder)
 {
 	struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder);
 	struct exynos_drm_display *display = exynos_encoder->display;
-	struct drm_plane *plane;
-	struct drm_device *dev = encoder->dev;
 
 	if (display->ops->dpms)
 		display->ops->dpms(display, DRM_MODE_DPMS_OFF);
-
-	/* all planes connected to this encoder should be also disabled. */
-	drm_for_each_legacy_plane(plane, &dev->mode_config.plane_list) {
-		if (plane->crtc && (plane->crtc == encoder->crtc))
-			plane->funcs->disable_plane(plane);
-	}
 }
 
 static struct drm_encoder_helper_funcs exynos_encoder_helper_funcs = {
-- 
2.1.0

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

* Re: [PATCH] drm/exynos: remove unnecessary calls to disable_plane()
  2015-04-10 18:57   ` [PATCH] drm/exynos: remove unnecessary calls to disable_plane() Gustavo Padovan
@ 2015-04-13  6:32     ` Joonyoung Shim
  2015-04-13 17:35       ` Gustavo Padovan
  0 siblings, 1 reply; 28+ messages in thread
From: Joonyoung Shim @ 2015-04-13  6:32 UTC (permalink / raw)
  To: Gustavo Padovan, linux-samsung-soc; +Cc: Gustavo Padovan, dri-devel

Hi,

On 04/11/2015 03:57 AM, Gustavo Padovan wrote:
> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> 
> The planes are already disabled by the drm_atomic_helper_commit() code
> so we don't need to disable the in these two places.
> 
> 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_encoder.c |  8 --------
>  2 files changed, 19 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> index 519c569..9bf25ff 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> @@ -47,8 +47,6 @@ static void exynos_drm_crtc_enable(struct drm_crtc *crtc)
>  static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
>  {
>  	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
> -	struct drm_plane *plane;
> -	int ret;
>  
>  	if (!exynos_crtc->enabled)
>  		return;
> @@ -64,15 +62,6 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
>  		exynos_crtc->ops->dpms(exynos_crtc, DRM_MODE_DPMS_OFF);
>  
>  	exynos_crtc->enabled = false;
> -
> -	drm_for_each_legacy_plane(plane, &crtc->dev->mode_config.plane_list) {
> -		if (plane->crtc != crtc)
> -			continue;
> -
> -		ret = plane->funcs->disable_plane(plane);
> -		if (ret)
> -			DRM_ERROR("Failed to disable plane %d\n", ret);
> -	}

If remove here disable codes, when crtc is disabled, enabled overlay
planes may not be disabled.

E.g, user can remove fb of crtc via DRM_IOCTL_MODE_RMFB ioctl, then crtc
is disabled but overlay planes no.

Thanks.

>  }
>  
>  static bool
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
> index 0648ba4..7b89fd5 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
> @@ -81,17 +81,9 @@ static void exynos_drm_encoder_disable(struct drm_encoder *encoder)
>  {
>  	struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder);
>  	struct exynos_drm_display *display = exynos_encoder->display;
> -	struct drm_plane *plane;
> -	struct drm_device *dev = encoder->dev;
>  
>  	if (display->ops->dpms)
>  		display->ops->dpms(display, DRM_MODE_DPMS_OFF);
> -
> -	/* all planes connected to this encoder should be also disabled. */
> -	drm_for_each_legacy_plane(plane, &dev->mode_config.plane_list) {
> -		if (plane->crtc && (plane->crtc == encoder->crtc))
> -			plane->funcs->disable_plane(plane);
> -	}
>  }
>  
>  static struct drm_encoder_helper_funcs exynos_encoder_helper_funcs = {
> 

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

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

* Re: [PATCH] drm/exynos: remove unnecessary calls to disable_plane()
  2015-04-13  6:32     ` Joonyoung Shim
@ 2015-04-13 17:35       ` Gustavo Padovan
  0 siblings, 0 replies; 28+ messages in thread
From: Gustavo Padovan @ 2015-04-13 17:35 UTC (permalink / raw)
  To: Joonyoung Shim; +Cc: linux-samsung-soc, dri-devel, inki.dae, Gustavo Padovan

2015-04-13 Joonyoung Shim <jy0922.shim@samsung.com>:

> Hi,
> 
> On 04/11/2015 03:57 AM, Gustavo Padovan wrote:
> > From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> > 
> > The planes are already disabled by the drm_atomic_helper_commit() code
> > so we don't need to disable the in these two places.
> > 
> > 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_encoder.c |  8 --------
> >  2 files changed, 19 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> > index 519c569..9bf25ff 100644
> > --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> > +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> > @@ -47,8 +47,6 @@ static void exynos_drm_crtc_enable(struct drm_crtc *crtc)
> >  static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
> >  {
> >  	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
> > -	struct drm_plane *plane;
> > -	int ret;
> >  
> >  	if (!exynos_crtc->enabled)
> >  		return;
> > @@ -64,15 +62,6 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
> >  		exynos_crtc->ops->dpms(exynos_crtc, DRM_MODE_DPMS_OFF);
> >  
> >  	exynos_crtc->enabled = false;
> > -
> > -	drm_for_each_legacy_plane(plane, &crtc->dev->mode_config.plane_list) {
> > -		if (plane->crtc != crtc)
> > -			continue;
> > -
> > -		ret = plane->funcs->disable_plane(plane);
> > -		if (ret)
> > -			DRM_ERROR("Failed to disable plane %d\n", ret);
> > -	}
> 
> If remove here disable codes, when crtc is disabled, enabled overlay
> planes may not be disabled.
> 
> E.g, user can remove fb of crtc via DRM_IOCTL_MODE_RMFB ioctl, then crtc
> is disabled but overlay planes no.

That not true anymore with atomic modesetting, the overlay planes are also
disabled, so we should let the atomic core solve this and remove these pieces
of code from here.

	Gustavo

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

end of thread, other threads:[~2015-04-13 17:35 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-03 18:09 [PATCH -v3 00/11] drm/exynos: Add atomic modesetting support Gustavo Padovan
2015-04-03 18:09 ` [PATCH -v3 01/11] drm/exynos: atomic phase 1: use drm_plane_helper_update() Gustavo Padovan
2015-04-03 18:09 ` [PATCH -v3 02/11] drm/exynos: atomic phase 1: use drm_plane_helper_disable() Gustavo Padovan
2015-04-03 18:09 ` [PATCH -v3 03/11] drm/exynos: atomic phase 1: add .mode_set_nofb() callback Gustavo Padovan
2015-04-03 18:09 ` [PATCH -v3 04/11] drm/exynos: atomic phase 2: wire up state reset(), duplicate() and destroy() Gustavo Padovan
2015-04-03 18:09 ` [PATCH -v3 05/11] drm/exynos: atomic phase 2: keep track of framebuffer pointer Gustavo Padovan
2015-04-03 18:09 ` [PATCH -v3 06/11] drm/exynos: atomic phase 3: atomic updates of planes Gustavo Padovan
2015-04-03 18:09 ` [PATCH -v3 07/11] drm/exynos: atomic phase 3: use atomic .set_config helper Gustavo Padovan
2015-04-03 18:09 ` [PATCH -v3 08/11] drm/exynos: atomic phase 3: convert page flips Gustavo Padovan
2015-04-03 18:09 ` [PATCH -v3 09/11] drm/exynos: remove exported functions from exynos_drm_plane Gustavo Padovan
2015-04-03 18:09 ` [PATCH -v3 10/11] drm/exynos: don't disable unused functions at init Gustavo Padovan
2015-04-03 18:09 ` [PATCH -v3 11/11] drm/exynos: atomic dpms support Gustavo Padovan
2015-04-05 14:42   ` Inki Dae
2015-04-06 18:26     ` Gustavo Padovan
2015-04-07  7:22       ` Joonyoung Shim
2015-04-07 19:56         ` [PATCH v4] " Gustavo Padovan
2015-04-10 18:57   ` [PATCH] drm/exynos: remove unnecessary calls to disable_plane() Gustavo Padovan
2015-04-13  6:32     ` Joonyoung Shim
2015-04-13 17:35       ` Gustavo Padovan
2015-04-06 10:46 ` [PATCH -v3 00/11] drm/exynos: Add atomic modesetting support Inki Dae
2015-04-06 15:44   ` Inki Dae
2015-04-07  7:06     ` Inki Dae
2015-04-07 11:14       ` Inki Dae
2015-04-07 17:24         ` Gustavo Padovan
2015-04-07 18:39       ` Gustavo Padovan
2015-04-07 19:14         ` Tobias Jakobi
2015-04-08 15:14         ` Inki Dae
2015-04-09  7:04           ` Joonyoung Shim

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.