All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers
@ 2018-03-22 15:22 Ville Syrjala
  2018-03-22 15:22 ` [PATCH 01/23] Revert "drm/atomic-helper: Fix leak in disable_all" Ville Syrjala
                   ` (34 more replies)
  0 siblings, 35 replies; 74+ messages in thread
From: Ville Syrjala @ 2018-03-22 15:22 UTC (permalink / raw)
  To: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: David Airlie, Daniel Vetter,
	chris-Y6uKTt2uX1cEflXRtASbqLVCufUGDwFn, Eric Anholt,
	Gerd Hoffmann, Benjamin Gaignard, Dave Airlie, Boris Brezillon,
	Thomas Hellstrom, Joonyoung Shim, Sinclair Yeh, Rob Clark,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	martin.peres-GANU6spQydw, VMware Graphics, Harry Wentland,
	David (ChunMing) Zhou, linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Maarten Lankhorst,
	Inki Dae,
	virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	Vincent Abriou

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

I really just wanted to fix i915 to re-enable its planes afer load
detection (a two line patch). This is what I actually ended up with
after I ran into a framebuffer refcount leak with said two line patch.

I've tested this on a few i915 boxes and so far it's looking
good. Everything else is just compile tested.

Entire series available here:
git://github.com/vsyrjala/linux.git plane_fb_crtc_nuke

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
Cc: chris@chris-wilson.co.uk
Cc: "Christian König" <christian.koenig@amd.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Dave Airlie <airlied@gmail.com>
Cc: David Airlie <airlied@linux.ie>
Cc: "David (ChunMing) Zhou" <David1.Zhou@amd.com>
Cc: Eric Anholt <eric@anholt.net>
Cc: freedreno@lists.freedesktop.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Inki Dae <inki.dae@samsung.com>
Cc: Joonyoung Shim <jy0922.shim@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: linux-arm-msm@vger.kernel.org
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: martin.peres@free.fr
Cc: Rob Clark <robdclark@gmail.com>
Cc: Seung-Woo Kim <sw0312.kim@samsung.com>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sinclair Yeh <syeh@vmware.com>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Cc: Vincent Abriou <vincent.abriou@st.com>
Cc: virtualization@lists.linux-foundation.org
Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>

Ville Syrjälä (23):
  Revert "drm/atomic-helper: Fix leak in disable_all"
  drm/atomic-helper: Make drm_atomic_helper_disable_all() update the
    plane->fb pointers
  drm: Clear crtc->primary->crtc when disabling the crtc via setcrtc()
  drm/atomic-helper: WARN if legacy plane fb pointers are bogus when
    committing duplicated state
  drm: Add local 'plane' variable for primary/cursor planes
  drm: Adjust whitespace for legibility
  drm: Make the fb refcount handover less magic
  drm: Use plane->state->fb over plane->fb
  drm/i915: Stop consulting plane->fb
  drm/msm: Stop consulting plane->fb
  drm/sti: Stop consulting plane->fb
  drm/vmwgfx: Stop consulting plane->fb
  drm/zte: Stop consulting plane->fb
  drm/atmel-hlcdc: Stop using plane->fb
  drm: Stop updating plane->crtc/fb/old_fb on atomic drivers
  drm/amdgpu/dc: Stop updating plane->fb
  drm/i915: Stop updating plane->fb/crtc
  drm/exynos: Stop updating plane->crtc
  drm/msm: Stop updating plane->fb/crtc
  drm/virtio: Stop updating plane->fb
  drm/vc4: Stop updating plane->fb/crtc
  drm/i915: Restore planes after load detection
  drm/i915: Make force_load_detect effective even w/ DMI quirks/hotplug

 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  2 -
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c   | 12 +---
 drivers/gpu/drm/drm_atomic.c                      | 55 ++--------------
 drivers/gpu/drm/drm_atomic_helper.c               | 79 ++++++++++-------------
 drivers/gpu/drm/drm_crtc.c                        | 51 ++++++++++-----
 drivers/gpu/drm/drm_fb_helper.c                   |  7 --
 drivers/gpu/drm/drm_framebuffer.c                 |  5 --
 drivers/gpu/drm/drm_plane.c                       | 64 +++++++++++-------
 drivers/gpu/drm/drm_plane_helper.c                |  4 +-
 drivers/gpu/drm/exynos/exynos_drm_plane.c         |  2 -
 drivers/gpu/drm/i915/intel_crt.c                  |  6 ++
 drivers/gpu/drm/i915/intel_display.c              |  9 +--
 drivers/gpu/drm/i915/intel_fbdev.c                |  2 +-
 drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c         |  3 +-
 drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c        |  2 -
 drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c        |  2 -
 drivers/gpu/drm/sti/sti_plane.c                   |  9 +--
 drivers/gpu/drm/vc4/vc4_crtc.c                    |  3 -
 drivers/gpu/drm/virtio/virtgpu_display.c          |  2 -
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c               |  6 +-
 drivers/gpu/drm/zte/zx_vou.c                      |  2 +-
 include/drm/drm_atomic.h                          |  3 -
 22 files changed, 143 insertions(+), 187 deletions(-)

-- 
2.16.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* [PATCH 01/23] Revert "drm/atomic-helper: Fix leak in disable_all"
  2018-03-22 15:22 [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Ville Syrjala
@ 2018-03-22 15:22 ` Ville Syrjala
  2018-03-22 15:22 ` [PATCH 02/23] drm/atomic-helper: Make drm_atomic_helper_disable_all() update the plane->fb pointers Ville Syrjala
                   ` (33 subsequent siblings)
  34 siblings, 0 replies; 74+ messages in thread
From: Ville Syrjala @ 2018-03-22 15:22 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter, intel-gfx, martin.peres

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Currently we're leaking fbs on load detect on account of nothing setting
up plane->old_fb for the drm_atomic_clean_old_fb() call in
drm_atomic_helper_commit_duplicated_state(). Removing the
drm_atomic_clean_old_fb() call seems like the right call to me here.
This does mean we end up leaking something via
drm_atomic_helper_shutdown() though, but we'll fix that up in a
different way.

This reverts commit 49d70aeaeca8f62b72b7712ecd1e29619a445866.

Cc: martin.peres@free.fr
Cc: chris@chris-wilson.co.uk
Cc: Dave Airlie <airlied@gmail.com> (v1)
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
CC: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_atomic_helper.c | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index c35654591c12..c48f187d08de 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -2914,7 +2914,6 @@ int drm_atomic_helper_disable_all(struct drm_device *dev,
 	struct drm_plane *plane;
 	struct drm_crtc_state *crtc_state;
 	struct drm_crtc *crtc;
-	unsigned plane_mask = 0;
 	int ret, i;
 
 	state = drm_atomic_state_alloc(dev);
@@ -2957,14 +2956,10 @@ int drm_atomic_helper_disable_all(struct drm_device *dev,
 			goto free;
 
 		drm_atomic_set_fb_for_plane(plane_state, NULL);
-		plane_mask |= BIT(drm_plane_index(plane));
-		plane->old_fb = plane->fb;
 	}
 
 	ret = drm_atomic_commit(state);
 free:
-	if (plane_mask)
-		drm_atomic_clean_old_fb(dev, plane_mask, ret);
 	drm_atomic_state_put(state);
 	return ret;
 }
@@ -3095,16 +3090,11 @@ int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state,
 	struct drm_connector_state *new_conn_state;
 	struct drm_crtc *crtc;
 	struct drm_crtc_state *new_crtc_state;
-	unsigned plane_mask = 0;
-	struct drm_device *dev = state->dev;
-	int ret;
 
 	state->acquire_ctx = ctx;
 
-	for_each_new_plane_in_state(state, plane, new_plane_state, i) {
-		plane_mask |= BIT(drm_plane_index(plane));
+	for_each_new_plane_in_state(state, plane, new_plane_state, i)
 		state->planes[i].old_state = plane->state;
-	}
 
 	for_each_new_crtc_in_state(state, crtc, new_crtc_state, i)
 		state->crtcs[i].old_state = crtc->state;
@@ -3112,11 +3102,7 @@ int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state,
 	for_each_new_connector_in_state(state, connector, new_conn_state, i)
 		state->connectors[i].old_state = connector->state;
 
-	ret = drm_atomic_commit(state);
-	if (plane_mask)
-		drm_atomic_clean_old_fb(dev, plane_mask, ret);
-
-	return ret;
+	return drm_atomic_commit(state);
 }
 EXPORT_SYMBOL(drm_atomic_helper_commit_duplicated_state);
 
-- 
2.16.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH 02/23] drm/atomic-helper: Make drm_atomic_helper_disable_all() update the plane->fb pointers
  2018-03-22 15:22 [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Ville Syrjala
  2018-03-22 15:22 ` [PATCH 01/23] Revert "drm/atomic-helper: Fix leak in disable_all" Ville Syrjala
@ 2018-03-22 15:22 ` Ville Syrjala
  2018-03-26 20:28   ` Daniel Vetter
  2018-03-26 20:43   ` Daniel Vetter
  2018-03-22 15:22 ` [PATCH 03/23] drm: Clear crtc->primary->crtc when disabling the crtc via setcrtc() Ville Syrjala
                   ` (32 subsequent siblings)
  34 siblings, 2 replies; 74+ messages in thread
From: Ville Syrjala @ 2018-03-22 15:22 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter, intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

drm_atomic_helper_shutdown() needs to release the reference held by
plane->fb, so we want to use drm_atomic_clean_old_fb() in
drm_atomic_helper_disable_all(). However during suspend/resume, gpu
reset and load detection we should probably leave that stuff alone,
as otherwise we'd have to make sure we put them back again when
we restore the duplicated state to the device. Seems simpler to me
to not touch any of it anyway.

v2: Don't inflict the clean_old_fbs bool to drivers (Daniel)

Cc: martin.peres@free.fr
Cc: chris@chris-wilson.co.uk
Cc: Dave Airlie <airlied@gmail.com> (v1)
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_atomic_helper.c | 67 ++++++++++++++++++++++---------------
 1 file changed, 40 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index c48f187d08de..39a69508d8c9 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -2881,31 +2881,9 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set,
 	return 0;
 }
 
-/**
- * drm_atomic_helper_disable_all - disable all currently active outputs
- * @dev: DRM device
- * @ctx: lock acquisition context
- *
- * Loops through all connectors, finding those that aren't turned off and then
- * turns them off by setting their DPMS mode to OFF and deactivating the CRTC
- * that they are connected to.
- *
- * This is used for example in suspend/resume to disable all currently active
- * functions when suspending. If you just want to shut down everything at e.g.
- * driver unload, look at drm_atomic_helper_shutdown().
- *
- * Note that if callers haven't already acquired all modeset locks this might
- * return -EDEADLK, which must be handled by calling drm_modeset_backoff().
- *
- * Returns:
- * 0 on success or a negative error code on failure.
- *
- * See also:
- * drm_atomic_helper_suspend(), drm_atomic_helper_resume() and
- * drm_atomic_helper_shutdown().
- */
-int drm_atomic_helper_disable_all(struct drm_device *dev,
-				  struct drm_modeset_acquire_ctx *ctx)
+static int __drm_atomic_helper_disable_all(struct drm_device *dev,
+					   struct drm_modeset_acquire_ctx *ctx,
+					   bool clean_old_fbs)
 {
 	struct drm_atomic_state *state;
 	struct drm_connector_state *conn_state;
@@ -2914,6 +2892,7 @@ int drm_atomic_helper_disable_all(struct drm_device *dev,
 	struct drm_plane *plane;
 	struct drm_crtc_state *crtc_state;
 	struct drm_crtc *crtc;
+	unsigned int plane_mask = 0;
 	int ret, i;
 
 	state = drm_atomic_state_alloc(dev);
@@ -2956,14 +2935,48 @@ int drm_atomic_helper_disable_all(struct drm_device *dev,
 			goto free;
 
 		drm_atomic_set_fb_for_plane(plane_state, NULL);
+
+		if (clean_old_fbs) {
+			plane->old_fb = plane->fb;
+			plane_mask |= BIT(drm_plane_index(plane));
+		}
 	}
 
 	ret = drm_atomic_commit(state);
 free:
+	drm_atomic_clean_old_fb(dev, plane_mask, ret);
+
 	drm_atomic_state_put(state);
 	return ret;
 }
-
+/**
+ * drm_atomic_helper_disable_all - disable all currently active outputs
+ * @dev: DRM device
+ * @ctx: lock acquisition context
+ *
+ * Loops through all connectors, finding those that aren't turned off and then
+ * turns them off by setting their DPMS mode to OFF and deactivating the CRTC
+ * that they are connected to.
+ *
+ * This is used for example in suspend/resume to disable all currently active
+ * functions when suspending. If you just want to shut down everything at e.g.
+ * driver unload, look at drm_atomic_helper_shutdown().
+ *
+ * Note that if callers haven't already acquired all modeset locks this might
+ * return -EDEADLK, which must be handled by calling drm_modeset_backoff().
+ *
+ * Returns:
+ * 0 on success or a negative error code on failure.
+ *
+ * See also:
+ * drm_atomic_helper_suspend(), drm_atomic_helper_resume() and
+ * drm_atomic_helper_shutdown().
+ */
+int drm_atomic_helper_disable_all(struct drm_device *dev,
+				  struct drm_modeset_acquire_ctx *ctx)
+{
+	return __drm_atomic_helper_disable_all(dev, ctx, false);
+}
 EXPORT_SYMBOL(drm_atomic_helper_disable_all);
 
 /**
@@ -2986,7 +2999,7 @@ void drm_atomic_helper_shutdown(struct drm_device *dev)
 	while (1) {
 		ret = drm_modeset_lock_all_ctx(dev, &ctx);
 		if (!ret)
-			ret = drm_atomic_helper_disable_all(dev, &ctx);
+			ret = __drm_atomic_helper_disable_all(dev, &ctx, true);
 
 		if (ret != -EDEADLK)
 			break;
-- 
2.16.1

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

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

* [PATCH 03/23] drm: Clear crtc->primary->crtc when disabling the crtc via setcrtc()
  2018-03-22 15:22 [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Ville Syrjala
  2018-03-22 15:22 ` [PATCH 01/23] Revert "drm/atomic-helper: Fix leak in disable_all" Ville Syrjala
  2018-03-22 15:22 ` [PATCH 02/23] drm/atomic-helper: Make drm_atomic_helper_disable_all() update the plane->fb pointers Ville Syrjala
@ 2018-03-22 15:22 ` Ville Syrjala
  2018-03-26 20:41   ` Daniel Vetter
  2018-03-22 15:22 ` [PATCH 04/23] drm/atomic-helper: WARN if legacy plane fb pointers are bogus when committing duplicated state Ville Syrjala
                   ` (31 subsequent siblings)
  34 siblings, 1 reply; 74+ messages in thread
From: Ville Syrjala @ 2018-03-22 15:22 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Keep the primary->crtc in sync with the state->crtc (also with
primary->fb and state->fb) when disabling the crtc (and thus also
the primary) via setcrtc().

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_crtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 03583887cfec..7a973ada7195 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -471,7 +471,7 @@ static int __drm_mode_set_config_internal(struct drm_mode_set *set,
 
 	ret = crtc->funcs->set_config(set, ctx);
 	if (ret == 0) {
-		crtc->primary->crtc = crtc;
+		crtc->primary->crtc = fb ? crtc : NULL;
 		crtc->primary->fb = fb;
 	}
 
-- 
2.16.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH 04/23] drm/atomic-helper: WARN if legacy plane fb pointers are bogus when committing duplicated state
  2018-03-22 15:22 [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Ville Syrjala
                   ` (2 preceding siblings ...)
  2018-03-22 15:22 ` [PATCH 03/23] drm: Clear crtc->primary->crtc when disabling the crtc via setcrtc() Ville Syrjala
@ 2018-03-22 15:22 ` Ville Syrjala
  2018-03-26 20:42   ` [Intel-gfx] " Daniel Vetter
  2018-03-22 15:22 ` [PATCH 05/23] drm: Add local 'plane' variable for primary/cursor planes Ville Syrjala
                   ` (30 subsequent siblings)
  34 siblings, 1 reply; 74+ messages in thread
From: Ville Syrjala @ 2018-03-22 15:22 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx, martin.peres, Daniel Vetter

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

drm_atomic_helper_commit_duplicated_state() should only be called
resume/reset/load_detect paths where plane->old_fb should always be
NULL and plane->fb should be equal to the new_plane_state->fb.
Assert that is indeed the case.

Cc: martin.peres@free.fr
Cc: chris@chris-wilson.co.uk
Cc: Dave Airlie <airlied@gmail.com> (v1)
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_atomic_helper.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 39a69508d8c9..1b39ebf2be2e 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -3106,8 +3106,13 @@ int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state,
 
 	state->acquire_ctx = ctx;
 
-	for_each_new_plane_in_state(state, plane, new_plane_state, i)
+	for_each_new_plane_in_state(state, plane, new_plane_state, i) {
+		WARN_ON(plane->crtc != new_plane_state->crtc);
+		WARN_ON(plane->fb != new_plane_state->fb);
+		WARN_ON(plane->old_fb);
+
 		state->planes[i].old_state = plane->state;
+	}
 
 	for_each_new_crtc_in_state(state, crtc, new_crtc_state, i)
 		state->crtcs[i].old_state = crtc->state;
-- 
2.16.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH 05/23] drm: Add local 'plane' variable for primary/cursor planes
  2018-03-22 15:22 [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Ville Syrjala
                   ` (3 preceding siblings ...)
  2018-03-22 15:22 ` [PATCH 04/23] drm/atomic-helper: WARN if legacy plane fb pointers are bogus when committing duplicated state Ville Syrjala
@ 2018-03-22 15:22 ` Ville Syrjala
  2018-03-26 20:49   ` Daniel Vetter
  2018-03-22 15:22 ` [PATCH 06/23] drm: Adjust whitespace for legibility Ville Syrjala
                   ` (29 subsequent siblings)
  34 siblings, 1 reply; 74+ messages in thread
From: Ville Syrjala @ 2018-03-22 15:22 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Make the code a bit more readable by storing the plane pointer in a
local variable rather than having to do crtc->{primary,cursor} all the
time.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_crtc.c  | 32 +++++++++++++++++++-------------
 drivers/gpu/drm/drm_plane.c | 32 ++++++++++++++++++--------------
 2 files changed, 37 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 7a973ada7195..8552ed419056 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -402,6 +402,7 @@ int drm_mode_getcrtc(struct drm_device *dev,
 {
 	struct drm_mode_crtc *crtc_resp = data;
 	struct drm_crtc *crtc;
+	struct drm_plane *plane;
 
 	if (!drm_core_check_feature(dev, DRIVER_MODESET))
 		return -EINVAL;
@@ -410,21 +411,23 @@ int drm_mode_getcrtc(struct drm_device *dev,
 	if (!crtc)
 		return -ENOENT;
 
+	plane = crtc->primary;
+
 	crtc_resp->gamma_size = crtc->gamma_size;
 
-	drm_modeset_lock(&crtc->primary->mutex, NULL);
-	if (crtc->primary->state && crtc->primary->state->fb)
-		crtc_resp->fb_id = crtc->primary->state->fb->base.id;
-	else if (!crtc->primary->state && crtc->primary->fb)
-		crtc_resp->fb_id = crtc->primary->fb->base.id;
+	drm_modeset_lock(&plane->mutex, NULL);
+	if (plane->state && plane->state->fb)
+		crtc_resp->fb_id = plane->state->fb->base.id;
+	else if (!plane->state && plane->fb)
+		crtc_resp->fb_id = plane->fb->base.id;
 	else
 		crtc_resp->fb_id = 0;
 
-	if (crtc->primary->state) {
-		crtc_resp->x = crtc->primary->state->src_x >> 16;
-		crtc_resp->y = crtc->primary->state->src_y >> 16;
+	if (plane->state) {
+		crtc_resp->x = plane->state->src_x >> 16;
+		crtc_resp->y = plane->state->src_y >> 16;
 	}
-	drm_modeset_unlock(&crtc->primary->mutex);
+	drm_modeset_unlock(&plane->mutex);
 
 	drm_modeset_lock(&crtc->mutex, NULL);
 	if (crtc->state) {
@@ -554,6 +557,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
 	struct drm_mode_config *config = &dev->mode_config;
 	struct drm_mode_crtc *crtc_req = data;
 	struct drm_crtc *crtc;
+	struct drm_plane *plane;
 	struct drm_connector **connector_set = NULL, *connector;
 	struct drm_framebuffer *fb = NULL;
 	struct drm_display_mode *mode = NULL;
@@ -580,6 +584,8 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
 	}
 	DRM_DEBUG_KMS("[CRTC:%d:%s]\n", crtc->base.id, crtc->name);
 
+	plane = crtc->primary;
+
 	mutex_lock(&crtc->dev->mode_config.mutex);
 	drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE);
 retry:
@@ -590,12 +596,12 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
 		/* If we have a mode we need a framebuffer. */
 		/* If we pass -1, set the mode with the currently bound fb */
 		if (crtc_req->fb_id == -1) {
-			if (!crtc->primary->fb) {
+			if (!plane->fb) {
 				DRM_DEBUG_KMS("CRTC doesn't have current FB\n");
 				ret = -EINVAL;
 				goto out;
 			}
-			fb = crtc->primary->fb;
+			fb = plane->fb;
 			/* Make refcounting symmetric with the lookup path. */
 			drm_framebuffer_get(fb);
 		} else {
@@ -627,8 +633,8 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
 		 * match real hardware capabilities. Skip the check in that
 		 * case.
 		 */
-		if (!crtc->primary->format_default) {
-			ret = drm_plane_check_pixel_format(crtc->primary,
+		if (!plane->format_default) {
+			ret = drm_plane_check_pixel_format(plane,
 							   fb->format->format,
 							   fb->modifier);
 			if (ret) {
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 6d2a6e428a3e..38e2a628bfa2 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -756,6 +756,7 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc,
 				     struct drm_modeset_acquire_ctx *ctx)
 {
 	struct drm_device *dev = crtc->dev;
+	struct drm_plane *plane = crtc->cursor;
 	struct drm_framebuffer *fb = NULL;
 	struct drm_mode_fb_cmd2 fbreq = {
 		.width = req->width,
@@ -769,8 +770,8 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc,
 	uint32_t src_w = 0, src_h = 0;
 	int ret = 0;
 
-	BUG_ON(!crtc->cursor);
-	WARN_ON(crtc->cursor->crtc != crtc && crtc->cursor->crtc != NULL);
+	BUG_ON(!plane);
+	WARN_ON(plane->crtc != crtc && plane->crtc != NULL);
 
 	/*
 	 * Obtain fb we'll be using (either new or existing) and take an extra
@@ -790,7 +791,7 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc,
 			fb = NULL;
 		}
 	} else {
-		fb = crtc->cursor->fb;
+		fb = plane->fb;
 		if (fb)
 			drm_framebuffer_get(fb);
 	}
@@ -810,7 +811,7 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc,
 		src_h = fb->height << 16;
 	}
 
-	ret = __setplane_internal(crtc->cursor, crtc, fb,
+	ret = __setplane_internal(plane, crtc, fb,
 				  crtc_x, crtc_y, crtc_w, crtc_h,
 				  0, 0, src_w, src_h, ctx);
 
@@ -931,6 +932,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 {
 	struct drm_mode_crtc_page_flip_target *page_flip = data;
 	struct drm_crtc *crtc;
+	struct drm_plane *plane;
 	struct drm_framebuffer *fb = NULL;
 	struct drm_pending_vblank_event *e = NULL;
 	u32 target_vblank = page_flip->sequence;
@@ -959,6 +961,8 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 	if (!crtc)
 		return -ENOENT;
 
+	plane = crtc->primary;
+
 	if (crtc->funcs->page_flip_target) {
 		u32 current_vblank;
 		int r;
@@ -1003,11 +1007,11 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 	ret = drm_modeset_lock(&crtc->mutex, &ctx);
 	if (ret)
 		goto out;
-	ret = drm_modeset_lock(&crtc->primary->mutex, &ctx);
+	ret = drm_modeset_lock(&plane->mutex, &ctx);
 	if (ret)
 		goto out;
 
-	if (crtc->primary->fb == NULL) {
+	if (plane->fb == NULL) {
 		/* The framebuffer is currently unbound, presumably
 		 * due to a hotplug event, that userspace has not
 		 * yet discovered.
@@ -1023,7 +1027,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 	}
 
 	if (crtc->state) {
-		const struct drm_plane_state *state = crtc->primary->state;
+		const struct drm_plane_state *state = plane->state;
 
 		ret = drm_framebuffer_check_src_coords(state->src_x,
 						       state->src_y,
@@ -1036,7 +1040,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 	if (ret)
 		goto out;
 
-	if (crtc->primary->fb->format != fb->format) {
+	if (plane->fb->format != fb->format) {
 		DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
 		ret = -EINVAL;
 		goto out;
@@ -1060,7 +1064,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 		}
 	}
 
-	crtc->primary->old_fb = crtc->primary->fb;
+	plane->old_fb = plane->fb;
 	if (crtc->funcs->page_flip_target)
 		ret = crtc->funcs->page_flip_target(crtc, fb, e,
 						    page_flip->flags,
@@ -1073,9 +1077,9 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 		if (page_flip->flags & DRM_MODE_PAGE_FLIP_EVENT)
 			drm_event_cancel_free(dev, &e->base);
 		/* Keep the old fb, don't unref it. */
-		crtc->primary->old_fb = NULL;
+		plane->old_fb = NULL;
 	} else {
-		crtc->primary->fb = fb;
+		plane->fb = fb;
 		/* Unref only the old framebuffer. */
 		fb = NULL;
 	}
@@ -1083,9 +1087,9 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 out:
 	if (fb)
 		drm_framebuffer_put(fb);
-	if (crtc->primary->old_fb)
-		drm_framebuffer_put(crtc->primary->old_fb);
-	crtc->primary->old_fb = NULL;
+	if (plane->old_fb)
+		drm_framebuffer_put(plane->old_fb);
+	plane->old_fb = NULL;
 
 	if (ret == -EDEADLK) {
 		ret = drm_modeset_backoff(&ctx);
-- 
2.16.1

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

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

* [PATCH 06/23] drm: Adjust whitespace for legibility
  2018-03-22 15:22 [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Ville Syrjala
                   ` (4 preceding siblings ...)
  2018-03-22 15:22 ` [PATCH 05/23] drm: Add local 'plane' variable for primary/cursor planes Ville Syrjala
@ 2018-03-22 15:22 ` Ville Syrjala
  2018-03-26 20:49   ` Daniel Vetter
  2018-03-22 15:22 ` [PATCH 07/23] drm: Make the fb refcount handover less magic Ville Syrjala
                   ` (28 subsequent siblings)
  34 siblings, 1 reply; 74+ messages in thread
From: Ville Syrjala @ 2018-03-22 15:22 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Add a bit of whitespace here and there to make the code look a bit
more structured.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_crtc.c  | 4 +++-
 drivers/gpu/drm/drm_plane.c | 6 +++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 8552ed419056..537ffaab855c 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -434,13 +434,13 @@ int drm_mode_getcrtc(struct drm_device *dev,
 		if (crtc->state->enable) {
 			drm_mode_convert_to_umode(&crtc_resp->mode, &crtc->state->mode);
 			crtc_resp->mode_valid = 1;
-
 		} else {
 			crtc_resp->mode_valid = 0;
 		}
 	} else {
 		crtc_resp->x = crtc->x;
 		crtc_resp->y = crtc->y;
+
 		if (crtc->enabled) {
 			drm_mode_convert_to_umode(&crtc_resp->mode, &crtc->mode);
 			crtc_resp->mode_valid = 1;
@@ -592,6 +592,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
 	ret = drm_modeset_lock_all_ctx(crtc->dev, &ctx);
 	if (ret)
 		goto out;
+
 	if (crtc_req->mode_valid) {
 		/* If we have a mode we need a framebuffer. */
 		/* If we pass -1, set the mode with the currently bound fb */
@@ -601,6 +602,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
 				ret = -EINVAL;
 				goto out;
 			}
+
 			fb = plane->fb;
 			/* Make refcounting symmetric with the lookup path. */
 			drm_framebuffer_get(fb);
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 38e2a628bfa2..bedceca7dd06 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -785,6 +785,7 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc,
 				DRM_DEBUG_KMS("failed to wrap cursor buffer in drm framebuffer\n");
 				return PTR_ERR(fb);
 			}
+
 			fb->hot_x = req->hot_x;
 			fb->hot_y = req->hot_y;
 		} else {
@@ -1035,7 +1036,8 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 						       state->src_h,
 						       fb);
 	} else {
-		ret = drm_crtc_check_viewport(crtc, crtc->x, crtc->y, &crtc->mode, fb);
+		ret = drm_crtc_check_viewport(crtc, crtc->x, crtc->y,
+					      &crtc->mode, fb);
 	}
 	if (ret)
 		goto out;
@@ -1052,10 +1054,12 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 			ret = -ENOMEM;
 			goto out;
 		}
+
 		e->event.base.type = DRM_EVENT_FLIP_COMPLETE;
 		e->event.base.length = sizeof(e->event);
 		e->event.vbl.user_data = page_flip->user_data;
 		e->event.vbl.crtc_id = crtc->base.id;
+
 		ret = drm_event_reserve_init(dev, file_priv, &e->base, &e->event.base);
 		if (ret) {
 			kfree(e);
-- 
2.16.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH 07/23] drm: Make the fb refcount handover less magic
  2018-03-22 15:22 [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Ville Syrjala
                   ` (5 preceding siblings ...)
  2018-03-22 15:22 ` [PATCH 06/23] drm: Adjust whitespace for legibility Ville Syrjala
@ 2018-03-22 15:22 ` Ville Syrjala
  2018-03-27  7:49   ` Daniel Vetter
  2018-03-22 15:22 ` [PATCH 08/23] drm: Use plane->state->fb over plane->fb Ville Syrjala
                   ` (27 subsequent siblings)
  34 siblings, 1 reply; 74+ messages in thread
From: Ville Syrjala @ 2018-03-22 15:22 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Instead of assigning the plane->fb pointer and clearing the fb pointer
to hand over the reference, let's just do it by grabbing another
referece for plane->fb and let fb keep its original one.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_plane.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index bedceca7dd06..008f9456a5e8 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -1084,8 +1084,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 		plane->old_fb = NULL;
 	} else {
 		plane->fb = fb;
-		/* Unref only the old framebuffer. */
-		fb = NULL;
+		drm_framebuffer_get(fb);
 	}
 
 out:
-- 
2.16.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH 08/23] drm: Use plane->state->fb over plane->fb
  2018-03-22 15:22 [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Ville Syrjala
                   ` (6 preceding siblings ...)
  2018-03-22 15:22 ` [PATCH 07/23] drm: Make the fb refcount handover less magic Ville Syrjala
@ 2018-03-22 15:22 ` Ville Syrjala
  2018-03-27  8:10   ` Daniel Vetter
  2018-03-22 15:22 ` [PATCH 09/23] drm/i915: Stop consulting plane->fb Ville Syrjala
                   ` (26 subsequent siblings)
  34 siblings, 1 reply; 74+ messages in thread
From: Ville Syrjala @ 2018-03-22 15:22 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Stop looking at plane->fb on atomic drivers. Use plane->state->fb
instead.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_atomic_helper.c |  2 +-
 drivers/gpu/drm/drm_crtc.c          | 11 +++++++++--
 drivers/gpu/drm/drm_plane.c         | 19 ++++++++++++++-----
 3 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 1b39ebf2be2e..0e806f070d00 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -2659,7 +2659,7 @@ int drm_atomic_helper_disable_plane(struct drm_plane *plane,
 		goto fail;
 	}
 
-	if (plane_state->crtc && (plane == plane->crtc->cursor))
+	if (plane_state->crtc && plane_state->crtc->cursor == plane)
 		plane_state->state->legacy_cursor_update = true;
 
 	ret = __drm_atomic_helper_disable_plane(plane, plane_state);
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 537ffaab855c..a231dd5dce16 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -597,13 +597,20 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
 		/* If we have a mode we need a framebuffer. */
 		/* If we pass -1, set the mode with the currently bound fb */
 		if (crtc_req->fb_id == -1) {
-			if (!plane->fb) {
+			struct drm_framebuffer *old_fb;
+
+			if (plane->state)
+				old_fb = plane->state->fb;
+			else
+				old_fb = plane->fb;
+
+			if (!old_fb) {
 				DRM_DEBUG_KMS("CRTC doesn't have current FB\n");
 				ret = -EINVAL;
 				goto out;
 			}
 
-			fb = plane->fb;
+			fb = old_fb;
 			/* Make refcounting symmetric with the lookup path. */
 			drm_framebuffer_get(fb);
 		} else {
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 008f9456a5e8..035054455301 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -792,7 +792,11 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc,
 			fb = NULL;
 		}
 	} else {
-		fb = plane->fb;
+		if (plane->state)
+			fb = plane->state->fb;
+		else
+			fb = plane->fb;
+
 		if (fb)
 			drm_framebuffer_get(fb);
 	}
@@ -934,7 +938,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 	struct drm_mode_crtc_page_flip_target *page_flip = data;
 	struct drm_crtc *crtc;
 	struct drm_plane *plane;
-	struct drm_framebuffer *fb = NULL;
+	struct drm_framebuffer *fb = NULL, *old_fb;
 	struct drm_pending_vblank_event *e = NULL;
 	u32 target_vblank = page_flip->sequence;
 	struct drm_modeset_acquire_ctx ctx;
@@ -1012,7 +1016,12 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 	if (ret)
 		goto out;
 
-	if (plane->fb == NULL) {
+	if (plane->state)
+		old_fb = plane->state->fb;
+	else
+		old_fb = plane->fb;
+
+	if (old_fb == NULL) {
 		/* The framebuffer is currently unbound, presumably
 		 * due to a hotplug event, that userspace has not
 		 * yet discovered.
@@ -1027,7 +1036,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 		goto out;
 	}
 
-	if (crtc->state) {
+	if (plane->state) {
 		const struct drm_plane_state *state = plane->state;
 
 		ret = drm_framebuffer_check_src_coords(state->src_x,
@@ -1042,7 +1051,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 	if (ret)
 		goto out;
 
-	if (plane->fb->format != fb->format) {
+	if (old_fb->format != fb->format) {
 		DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
 		ret = -EINVAL;
 		goto out;
-- 
2.16.1

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

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

* [PATCH 09/23] drm/i915: Stop consulting plane->fb
  2018-03-22 15:22 [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Ville Syrjala
                   ` (7 preceding siblings ...)
  2018-03-22 15:22 ` [PATCH 08/23] drm: Use plane->state->fb over plane->fb Ville Syrjala
@ 2018-03-22 15:22 ` Ville Syrjala
  2018-03-22 15:23 ` [PATCH 11/23] drm/sti: " Ville Syrjala
                   ` (25 subsequent siblings)
  34 siblings, 0 replies; 74+ messages in thread
From: Ville Syrjala @ 2018-03-22 15:22 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

We want to get rid of plane->fb on atomic drivers. Stop looking at it.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 2 +-
 drivers/gpu/drm/i915/intel_fbdev.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 3e7ab75e1b41..df2653e004a8 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2824,7 +2824,7 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
 			continue;
 
 		if (intel_plane_ggtt_offset(state) == plane_config->base) {
-			fb = c->primary->fb;
+			fb = state->base.fb;
 			drm_framebuffer_get(fb);
 			goto valid_fb;
 		}
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
index 65a3313723c9..7d41d139341b 100644
--- a/drivers/gpu/drm/i915/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/intel_fbdev.c
@@ -641,7 +641,7 @@ static bool intel_fbdev_init_bios(struct drm_device *dev,
 		if (!crtc->state->active)
 			continue;
 
-		WARN(!crtc->primary->fb,
+		WARN(!crtc->primary->state->fb,
 		     "re-used BIOS config but lost an fb on crtc %d\n",
 		     crtc->base.id);
 	}
-- 
2.16.1

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

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

* [PATCH 10/23] drm/msm: Stop consulting plane->fb
       [not found] ` <20180322152313.6561-1-ville.syrjala-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
@ 2018-03-22 15:23   ` Ville Syrjala
  2018-03-22 15:23   ` [PATCH 19/23] drm/msm: Stop updating plane->fb/crtc Ville Syrjala
  2018-03-27  8:21   ` [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Daniel Vetter
  2 siblings, 0 replies; 74+ messages in thread
From: Ville Syrjala @ 2018-03-22 15:23 UTC (permalink / raw)
  To: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Rob Clark

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

We want to get rid of plane->fb on atomic drivers. Stop looking at it.

Cc: Rob Clark <robdclark@gmail.com>
Cc: linux-arm-msm@vger.kernel.org
Cc: freedreno@lists.freedesktop.org
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c
index 6e5e1aa54ce1..99ead8e37c72 100644
--- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c
+++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c
@@ -201,7 +201,7 @@ static void blend_setup(struct drm_crtc *crtc)
 		int idx = idxs[pipe_id];
 		if (idx > 0) {
 			const struct mdp_format *format =
-					to_mdp_format(msm_framebuffer_format(plane->fb));
+					to_mdp_format(msm_framebuffer_format(plane->state->fb));
 			alpha[idx-1] = format->alpha_enable;
 		}
 	}
-- 
2.16.1

_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

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

* [PATCH 11/23] drm/sti: Stop consulting plane->fb
  2018-03-22 15:22 [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Ville Syrjala
                   ` (8 preceding siblings ...)
  2018-03-22 15:22 ` [PATCH 09/23] drm/i915: Stop consulting plane->fb Ville Syrjala
@ 2018-03-22 15:23 ` Ville Syrjala
  2018-03-22 16:25   ` Benjamin Gaignard
  2018-03-22 15:23 ` [PATCH 12/23] drm/vmwgfx: " Ville Syrjala
                   ` (24 subsequent siblings)
  34 siblings, 1 reply; 74+ messages in thread
From: Ville Syrjala @ 2018-03-22 15:23 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx, Vincent Abriou

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

We want to get rid of plane->fb on atomic drivers. Stop looking at it.

Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Cc: Vincent Abriou <vincent.abriou@st.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/sti/sti_plane.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_plane.c b/drivers/gpu/drm/sti/sti_plane.c
index b074609c960a..b48cd86e0250 100644
--- a/drivers/gpu/drm/sti/sti_plane.c
+++ b/drivers/gpu/drm/sti/sti_plane.c
@@ -40,6 +40,7 @@ void sti_plane_update_fps(struct sti_plane *plane,
 			  bool new_frame,
 			  bool new_field)
 {
+	struct drm_plane_state *state = plane->drm_plane.state;
 	ktime_t now;
 	struct sti_fps_info *fps;
 	int fpks, fipks, ms_since_last, num_frames, num_fields;
@@ -66,14 +67,14 @@ void sti_plane_update_fps(struct sti_plane *plane,
 	fps->last_timestamp = now;
 	fps->last_frame_counter = fps->curr_frame_counter;
 
-	if (plane->drm_plane.fb) {
+	if (state->fb) {
 		fpks = (num_frames * 1000000) / ms_since_last;
 		snprintf(plane->fps_info.fps_str, FPS_LENGTH,
 			 "%-8s %4dx%-4d %.4s @ %3d.%-3.3d fps (%s)",
 			 plane->drm_plane.name,
-			 plane->drm_plane.fb->width,
-			 plane->drm_plane.fb->height,
-			 (char *)&plane->drm_plane.fb->format->format,
+			 state->fb->width,
+			 state->fb->height,
+			 (char *)&state->fb->format->format,
 			 fpks / 1000, fpks % 1000,
 			 sti_plane_to_str(plane));
 	}
-- 
2.16.1

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

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

* [PATCH 12/23] drm/vmwgfx: Stop consulting plane->fb
  2018-03-22 15:22 [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Ville Syrjala
                   ` (9 preceding siblings ...)
  2018-03-22 15:23 ` [PATCH 11/23] drm/sti: " Ville Syrjala
@ 2018-03-22 15:23 ` Ville Syrjala
  2018-03-22 15:53   ` Thomas Hellstrom
  2018-03-22 15:23 ` [PATCH 13/23] drm/zte: " Ville Syrjala
                   ` (23 subsequent siblings)
  34 siblings, 1 reply; 74+ messages in thread
From: Ville Syrjala @ 2018-03-22 15:23 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx, VMware Graphics, Thomas Hellstrom, Sinclair Yeh

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

We want to get rid of plane->fb on atomic drivers. Stop looking at it.

Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>
Cc: Sinclair Yeh <syeh@vmware.com>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index 34ecc27fc30a..9fdb3ec9b4c4 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -385,9 +385,9 @@ vmw_du_cursor_plane_atomic_update(struct drm_plane *plane,
 	hotspot_x = du->hotspot_x;
 	hotspot_y = du->hotspot_y;
 
-	if (plane->fb) {
-		hotspot_x += plane->fb->hot_x;
-		hotspot_y += plane->fb->hot_y;
+	if (plane->state->fb) {
+		hotspot_x += plane->state->fb->hot_x;
+		hotspot_y += plane->state->fb->hot_y;
 	}
 
 	du->cursor_surface = vps->surf;
-- 
2.16.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH 13/23] drm/zte: Stop consulting plane->fb
  2018-03-22 15:22 [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Ville Syrjala
                   ` (10 preceding siblings ...)
  2018-03-22 15:23 ` [PATCH 12/23] drm/vmwgfx: " Ville Syrjala
@ 2018-03-22 15:23 ` Ville Syrjala
  2018-03-22 16:12   ` Maarten Lankhorst
                     ` (2 more replies)
  2018-03-22 15:23 ` [PATCH 14/23] drm/atmel-hlcdc: Stop using plane->fb Ville Syrjala
                   ` (22 subsequent siblings)
  34 siblings, 3 replies; 74+ messages in thread
From: Ville Syrjala @ 2018-03-22 15:23 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx, Shawn Guo

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

We want to get rid of plane->fb on atomic drivers. Stop looking at it.

Cc: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/zte/zx_vou.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/zte/zx_vou.c b/drivers/gpu/drm/zte/zx_vou.c
index 7491813131f3..57aae2e490f4 100644
--- a/drivers/gpu/drm/zte/zx_vou.c
+++ b/drivers/gpu/drm/zte/zx_vou.c
@@ -629,7 +629,7 @@ void zx_vou_layer_enable(struct drm_plane *plane)
 
 void zx_vou_layer_disable(struct drm_plane *plane)
 {
-	struct zx_crtc *zcrtc = to_zx_crtc(plane->crtc);
+	struct zx_crtc *zcrtc = to_zx_crtc(plane->state->crtc);
 	struct zx_vou_hw *vou = zcrtc->vou;
 	struct zx_plane *zplane = to_zx_plane(plane);
 	const struct vou_layer_bits *bits = zplane->bits;
-- 
2.16.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH 14/23] drm/atmel-hlcdc: Stop using plane->fb
  2018-03-22 15:22 [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Ville Syrjala
                   ` (11 preceding siblings ...)
  2018-03-22 15:23 ` [PATCH 13/23] drm/zte: " Ville Syrjala
@ 2018-03-22 15:23 ` Ville Syrjala
  2018-03-22 16:14   ` Maarten Lankhorst
  2018-03-27  8:13   ` Daniel Vetter
  2018-03-22 15:23 ` [PATCH 15/23] drm: Stop updating plane->crtc/fb/old_fb on atomic drivers Ville Syrjala
                   ` (21 subsequent siblings)
  34 siblings, 2 replies; 74+ messages in thread
From: Ville Syrjala @ 2018-03-22 15:23 UTC (permalink / raw)
  To: dri-devel; +Cc: Boris Brezillon, intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

We want to get rid of plane->fb on atomic drivers. Stop looking at it.

Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
index e18800ed7cd1..0dd9fb617c28 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
@@ -819,16 +819,6 @@ static void atmel_hlcdc_plane_atomic_disable(struct drm_plane *p,
 	atmel_hlcdc_layer_read_reg(&plane->layer, ATMEL_HLCDC_LAYER_ISR);
 }
 
-static void atmel_hlcdc_plane_destroy(struct drm_plane *p)
-{
-	struct atmel_hlcdc_plane *plane = drm_plane_to_atmel_hlcdc_plane(p);
-
-	if (plane->base.fb)
-		drm_framebuffer_put(plane->base.fb);
-
-	drm_plane_cleanup(p);
-}
-
 static int atmel_hlcdc_plane_atomic_set_property(struct drm_plane *p,
 						 struct drm_plane_state *s,
 						 struct drm_property *property,
@@ -1038,7 +1028,7 @@ static void atmel_hlcdc_plane_atomic_destroy_state(struct drm_plane *p,
 static const struct drm_plane_funcs layer_plane_funcs = {
 	.update_plane = drm_atomic_helper_update_plane,
 	.disable_plane = drm_atomic_helper_disable_plane,
-	.destroy = atmel_hlcdc_plane_destroy,
+	.destroy = drm_plane_cleanup,
 	.reset = atmel_hlcdc_plane_reset,
 	.atomic_duplicate_state = atmel_hlcdc_plane_atomic_duplicate_state,
 	.atomic_destroy_state = atmel_hlcdc_plane_atomic_destroy_state,
-- 
2.16.1

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

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

* [PATCH 15/23] drm: Stop updating plane->crtc/fb/old_fb on atomic drivers
  2018-03-22 15:22 [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Ville Syrjala
                   ` (12 preceding siblings ...)
  2018-03-22 15:23 ` [PATCH 14/23] drm/atmel-hlcdc: Stop using plane->fb Ville Syrjala
@ 2018-03-22 15:23 ` Ville Syrjala
  2018-03-26 20:52   ` Daniel Vetter
  2018-03-27  7:57   ` Daniel Vetter
  2018-03-22 15:23 ` [PATCH 16/23] drm/amdgpu/dc: Stop updating plane->fb Ville Syrjala
                   ` (20 subsequent siblings)
  34 siblings, 2 replies; 74+ messages in thread
From: Ville Syrjala @ 2018-03-22 15:23 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Stop playing around with plane->crtc/fb/old_fb with atomic
drivers. Make life a lot simpler when we don't have to do the
magic old_fb vs. fb dance around plane updates. That way we
can't risk plane->fb getting out of sync with plane->state->fb
and we're less likely to leak any refcounts as well.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_atomic.c        | 55 ++++---------------------------------
 drivers/gpu/drm/drm_atomic_helper.c | 15 +---------
 drivers/gpu/drm/drm_crtc.c          |  8 ++++--
 drivers/gpu/drm/drm_fb_helper.c     |  7 -----
 drivers/gpu/drm/drm_framebuffer.c   |  5 ----
 drivers/gpu/drm/drm_plane.c         | 14 ++++++----
 drivers/gpu/drm/drm_plane_helper.c  |  4 ++-
 include/drm/drm_atomic.h            |  3 --
 8 files changed, 24 insertions(+), 87 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 7d25c42f22db..b16cc37e2adf 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -692,6 +692,11 @@ drm_atomic_get_plane_state(struct drm_atomic_state *state,
 
 	WARN_ON(!state->acquire_ctx);
 
+	/* the legacy pointers should never be set */
+	WARN_ON(plane->fb);
+	WARN_ON(plane->old_fb);
+	WARN_ON(plane->crtc);
+
 	plane_state = drm_atomic_get_existing_plane_state(state, plane);
 	if (plane_state)
 		return plane_state;
@@ -2021,45 +2026,6 @@ int drm_atomic_set_property(struct drm_atomic_state *state,
 	return ret;
 }
 
-/**
- * drm_atomic_clean_old_fb -- Unset old_fb pointers and set plane->fb pointers.
- *
- * @dev: drm device to check.
- * @plane_mask: plane mask for planes that were updated.
- * @ret: return value, can be -EDEADLK for a retry.
- *
- * Before doing an update &drm_plane.old_fb is set to &drm_plane.fb, but before
- * dropping the locks old_fb needs to be set to NULL and plane->fb updated. This
- * is a common operation for each atomic update, so this call is split off as a
- * helper.
- */
-void drm_atomic_clean_old_fb(struct drm_device *dev,
-			     unsigned plane_mask,
-			     int ret)
-{
-	struct drm_plane *plane;
-
-	/* if succeeded, fixup legacy plane crtc/fb ptrs before dropping
-	 * locks (ie. while it is still safe to deref plane->state).  We
-	 * need to do this here because the driver entry points cannot
-	 * distinguish between legacy and atomic ioctls.
-	 */
-	drm_for_each_plane_mask(plane, dev, plane_mask) {
-		if (ret == 0) {
-			struct drm_framebuffer *new_fb = plane->state->fb;
-			if (new_fb)
-				drm_framebuffer_get(new_fb);
-			plane->fb = new_fb;
-			plane->crtc = plane->state->crtc;
-
-			if (plane->old_fb)
-				drm_framebuffer_put(plane->old_fb);
-		}
-		plane->old_fb = NULL;
-	}
-}
-EXPORT_SYMBOL(drm_atomic_clean_old_fb);
-
 /**
  * DOC: explicit fencing properties
  *
@@ -2280,9 +2246,7 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
 	unsigned int copied_objs, copied_props;
 	struct drm_atomic_state *state;
 	struct drm_modeset_acquire_ctx ctx;
-	struct drm_plane *plane;
 	struct drm_out_fence_state *fence_state;
-	unsigned plane_mask;
 	int ret = 0;
 	unsigned int i, j, num_fences;
 
@@ -2322,7 +2286,6 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
 	state->allow_modeset = !!(arg->flags & DRM_MODE_ATOMIC_ALLOW_MODESET);
 
 retry:
-	plane_mask = 0;
 	copied_objs = 0;
 	copied_props = 0;
 	fence_state = NULL;
@@ -2393,12 +2356,6 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
 			copied_props++;
 		}
 
-		if (obj->type == DRM_MODE_OBJECT_PLANE && count_props &&
-		    !(arg->flags & DRM_MODE_ATOMIC_TEST_ONLY)) {
-			plane = obj_to_plane(obj);
-			plane_mask |= (1 << drm_plane_index(plane));
-			plane->old_fb = plane->fb;
-		}
 		drm_mode_object_put(obj);
 	}
 
@@ -2419,8 +2376,6 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
 	}
 
 out:
-	drm_atomic_clean_old_fb(dev, plane_mask, ret);
-
 	complete_crtc_signaling(dev, state, fence_state, num_fences, !ret);
 
 	if (ret == -EDEADLK) {
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 0e806f070d00..d42d88b97396 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -2892,7 +2892,6 @@ static int __drm_atomic_helper_disable_all(struct drm_device *dev,
 	struct drm_plane *plane;
 	struct drm_crtc_state *crtc_state;
 	struct drm_crtc *crtc;
-	unsigned int plane_mask = 0;
 	int ret, i;
 
 	state = drm_atomic_state_alloc(dev);
@@ -2935,17 +2934,10 @@ static int __drm_atomic_helper_disable_all(struct drm_device *dev,
 			goto free;
 
 		drm_atomic_set_fb_for_plane(plane_state, NULL);
-
-		if (clean_old_fbs) {
-			plane->old_fb = plane->fb;
-			plane_mask |= BIT(drm_plane_index(plane));
-		}
 	}
 
 	ret = drm_atomic_commit(state);
 free:
-	drm_atomic_clean_old_fb(dev, plane_mask, ret);
-
 	drm_atomic_state_put(state);
 	return ret;
 }
@@ -3106,13 +3098,8 @@ int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state,
 
 	state->acquire_ctx = ctx;
 
-	for_each_new_plane_in_state(state, plane, new_plane_state, i) {
-		WARN_ON(plane->crtc != new_plane_state->crtc);
-		WARN_ON(plane->fb != new_plane_state->fb);
-		WARN_ON(plane->old_fb);
-
+	for_each_new_plane_in_state(state, plane, new_plane_state, i)
 		state->planes[i].old_state = plane->state;
-	}
 
 	for_each_new_crtc_in_state(state, crtc, new_crtc_state, i)
 		state->crtcs[i].old_state = crtc->state;
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index a231dd5dce16..4e3c1a8d118a 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -474,8 +474,12 @@ static int __drm_mode_set_config_internal(struct drm_mode_set *set,
 
 	ret = crtc->funcs->set_config(set, ctx);
 	if (ret == 0) {
-		crtc->primary->crtc = fb ? crtc : NULL;
-		crtc->primary->fb = fb;
+		struct drm_plane *plane = crtc->primary;
+
+		if (!plane->state) {
+			plane->crtc = fb ? crtc : NULL;
+			plane->fb = fb;
+		}
 	}
 
 	drm_for_each_crtc(tmp, crtc->dev) {
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 0646b108030b..5639e804a0cd 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -368,7 +368,6 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper *fb_helper, bool activ
 	struct drm_plane *plane;
 	struct drm_atomic_state *state;
 	int i, ret;
-	unsigned int plane_mask;
 	struct drm_modeset_acquire_ctx ctx;
 
 	drm_modeset_acquire_init(&ctx, 0);
@@ -381,7 +380,6 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper *fb_helper, bool activ
 
 	state->acquire_ctx = &ctx;
 retry:
-	plane_mask = 0;
 	drm_for_each_plane(plane, dev) {
 		plane_state = drm_atomic_get_plane_state(state, plane);
 		if (IS_ERR(plane_state)) {
@@ -391,9 +389,6 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper *fb_helper, bool activ
 
 		plane_state->rotation = DRM_MODE_ROTATE_0;
 
-		plane->old_fb = plane->fb;
-		plane_mask |= 1 << drm_plane_index(plane);
-
 		/* disable non-primary: */
 		if (plane->type == DRM_PLANE_TYPE_PRIMARY)
 			continue;
@@ -430,8 +425,6 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper *fb_helper, bool activ
 	ret = drm_atomic_commit(state);
 
 out_state:
-	drm_atomic_clean_old_fb(dev, plane_mask, ret);
-
 	if (ret == -EDEADLK)
 		goto backoff;
 
diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
index ad67203de715..421a77c2a4ac 100644
--- a/drivers/gpu/drm/drm_framebuffer.c
+++ b/drivers/gpu/drm/drm_framebuffer.c
@@ -835,8 +835,6 @@ static int atomic_remove_fb(struct drm_framebuffer *fb)
 			goto unlock;
 
 		plane_mask |= BIT(drm_plane_index(plane));
-
-		plane->old_fb = plane->fb;
 	}
 
 	/* This list is only filled when disable_crtcs is set. */
@@ -851,9 +849,6 @@ static int atomic_remove_fb(struct drm_framebuffer *fb)
 		ret = drm_atomic_commit(state);
 
 unlock:
-	if (plane_mask)
-		drm_atomic_clean_old_fb(dev, plane_mask, ret);
-
 	if (ret == -EDEADLK) {
 		drm_atomic_state_clear(state);
 		drm_modeset_backoff(&ctx);
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 035054455301..143041666096 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -650,9 +650,11 @@ static int __setplane_internal(struct drm_plane *plane,
 					 crtc_x, crtc_y, crtc_w, crtc_h,
 					 src_x, src_y, src_w, src_h, ctx);
 	if (!ret) {
-		plane->crtc = crtc;
-		plane->fb = fb;
-		drm_framebuffer_get(plane->fb);
+		if (!plane->state) {
+			plane->crtc = crtc;
+			plane->fb = fb;
+			drm_framebuffer_get(plane->fb);
+		}
 	} else {
 		plane->old_fb = NULL;
 	}
@@ -1092,8 +1094,10 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 		/* Keep the old fb, don't unref it. */
 		plane->old_fb = NULL;
 	} else {
-		plane->fb = fb;
-		drm_framebuffer_get(fb);
+		if (!plane->state) {
+			plane->fb = fb;
+			drm_framebuffer_get(fb);
+		}
 	}
 
 out:
diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
index f88f68161519..2010794943bc 100644
--- a/drivers/gpu/drm/drm_plane_helper.c
+++ b/drivers/gpu/drm/drm_plane_helper.c
@@ -502,6 +502,7 @@ EXPORT_SYMBOL(drm_plane_helper_update);
 int drm_plane_helper_disable(struct drm_plane *plane)
 {
 	struct drm_plane_state *plane_state;
+	struct drm_framebuffer *old_fb;
 
 	/* crtc helpers love to call disable functions for already disabled hw
 	 * functions. So cope with that. */
@@ -521,8 +522,9 @@ int drm_plane_helper_disable(struct drm_plane *plane)
 	plane_state->plane = plane;
 
 	plane_state->crtc = NULL;
+	old_fb = plane_state->fb;
 	drm_atomic_set_fb_for_plane(plane_state, NULL);
 
-	return drm_plane_helper_commit(plane, plane_state, plane->fb);
+	return drm_plane_helper_commit(plane, plane_state, old_fb);
 }
 EXPORT_SYMBOL(drm_plane_helper_disable);
diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
index a57a8aa90ffb..ca461b6cf71f 100644
--- a/include/drm/drm_atomic.h
+++ b/include/drm/drm_atomic.h
@@ -601,9 +601,6 @@ int __must_check
 drm_atomic_add_affected_planes(struct drm_atomic_state *state,
 			       struct drm_crtc *crtc);
 
-void
-drm_atomic_clean_old_fb(struct drm_device *dev, unsigned plane_mask, int ret);
-
 int __must_check drm_atomic_check_only(struct drm_atomic_state *state);
 int __must_check drm_atomic_commit(struct drm_atomic_state *state);
 int __must_check drm_atomic_nonblocking_commit(struct drm_atomic_state *state);
-- 
2.16.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH 16/23] drm/amdgpu/dc: Stop updating plane->fb
  2018-03-22 15:22 [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Ville Syrjala
                   ` (13 preceding siblings ...)
  2018-03-22 15:23 ` [PATCH 15/23] drm: Stop updating plane->crtc/fb/old_fb on atomic drivers Ville Syrjala
@ 2018-03-22 15:23 ` Ville Syrjala
  2018-03-23 20:23   ` Harry Wentland
  2018-03-22 15:23 ` [PATCH 17/23] drm/i915: Stop updating plane->fb/crtc Ville Syrjala
                   ` (19 subsequent siblings)
  34 siblings, 1 reply; 74+ messages in thread
From: Ville Syrjala @ 2018-03-22 15:23 UTC (permalink / raw)
  To: dri-devel
  Cc: David (ChunMing) Zhou, intel-gfx, amd-gfx, Alex Deucher,
	Harry Wentland, Christian König

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

We want to get rid of plane->fb on atomic drivers. Stop setting it.

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: "David (ChunMing) Zhou" <David1.Zhou@amd.com>
Cc: Harry Wentland <harry.wentland@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index ae512ecb65ee..a8129eca6e6d 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -3941,8 +3941,6 @@ static void amdgpu_dm_do_flip(struct drm_crtc *crtc,
 
 	/* Flip */
 	spin_lock_irqsave(&crtc->dev->event_lock, flags);
-	/* update crtc fb */
-	crtc->primary->fb = fb;
 
 	WARN_ON(acrtc->pflip_status != AMDGPU_FLIP_NONE);
 	WARN_ON(!acrtc_state->stream);
-- 
2.16.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH 17/23] drm/i915: Stop updating plane->fb/crtc
  2018-03-22 15:22 [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Ville Syrjala
                   ` (14 preceding siblings ...)
  2018-03-22 15:23 ` [PATCH 16/23] drm/amdgpu/dc: Stop updating plane->fb Ville Syrjala
@ 2018-03-22 15:23 ` Ville Syrjala
  2018-03-22 15:23 ` [PATCH 18/23] drm/exynos: Stop updating plane->crtc Ville Syrjala
                   ` (18 subsequent siblings)
  34 siblings, 0 replies; 74+ messages in thread
From: Ville Syrjala @ 2018-03-22 15:23 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

We want to get rid of plane->fb/crtc on atomic drivers. Stop setting
them.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index df2653e004a8..fcd755fe1b4e 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2877,9 +2877,8 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
 	if (i915_gem_object_is_tiled(obj))
 		dev_priv->preserve_bios_swizzle = true;
 
-	drm_framebuffer_get(fb);
-	primary->fb = primary->state->fb = fb;
-	primary->crtc = primary->state->crtc = &intel_crtc->base;
+	plane_state->fb = fb;
+	plane_state->crtc = &intel_crtc->base;
 
 	intel_set_plane_visible(to_intel_crtc_state(crtc_state),
 				to_intel_plane_state(plane_state),
-- 
2.16.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH 18/23] drm/exynos: Stop updating plane->crtc
  2018-03-22 15:22 [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Ville Syrjala
                   ` (15 preceding siblings ...)
  2018-03-22 15:23 ` [PATCH 17/23] drm/i915: Stop updating plane->fb/crtc Ville Syrjala
@ 2018-03-22 15:23 ` Ville Syrjala
  2018-03-22 15:23 ` [PATCH 20/23] drm/virtio: Stop updating plane->fb Ville Syrjala
                   ` (17 subsequent siblings)
  34 siblings, 0 replies; 74+ messages in thread
From: Ville Syrjala @ 2018-03-22 15:23 UTC (permalink / raw)
  To: dri-devel; +Cc: Kyungmin Park, intel-gfx, Seung-Woo Kim

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

We want to get rid of plane->crtc on atomic drivers. Stop setting it.

Cc: Inki Dae <inki.dae@samsung.com>
Cc: Joonyoung Shim <jy0922.shim@samsung.com>
Cc: Seung-Woo Kim <sw0312.kim@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/exynos/exynos_drm_plane.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index d2a90dae5c71..1b1af359c303 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
@@ -263,8 +263,6 @@ static void exynos_plane_atomic_update(struct drm_plane *plane,
 	if (!state->crtc)
 		return;
 
-	plane->crtc = state->crtc;
-
 	if (exynos_crtc->ops->update_plane)
 		exynos_crtc->ops->update_plane(exynos_crtc, exynos_plane);
 }
-- 
2.16.1

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

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

* [PATCH 19/23] drm/msm: Stop updating plane->fb/crtc
       [not found] ` <20180322152313.6561-1-ville.syrjala-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
  2018-03-22 15:23   ` [PATCH 10/23] drm/msm: Stop consulting plane->fb Ville Syrjala
@ 2018-03-22 15:23   ` Ville Syrjala
  2018-03-27  8:21   ` [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Daniel Vetter
  2 siblings, 0 replies; 74+ messages in thread
From: Ville Syrjala @ 2018-03-22 15:23 UTC (permalink / raw)
  To: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Rob Clark

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

We want to get rid of plane->fb/crtc on atomic drivers. Stop setting
them.

Cc: Rob Clark <robdclark@gmail.com>
Cc: linux-arm-msm@vger.kernel.org
Cc: freedreno@lists.freedesktop.org
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c  | 1 -
 drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c | 2 --
 drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c | 2 --
 3 files changed, 5 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c
index 99ead8e37c72..13f3f155dc67 100644
--- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c
+++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c
@@ -664,7 +664,6 @@ struct drm_crtc *mdp4_crtc_init(struct drm_device *dev,
 	drm_crtc_init_with_planes(dev, crtc, plane, NULL, &mdp4_crtc_funcs,
 				  NULL);
 	drm_crtc_helper_add(crtc, &mdp4_crtc_helper_funcs);
-	plane->crtc = crtc;
 
 	return crtc;
 }
diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c
index 7a1ad3af08e3..782b1e27f040 100644
--- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c
+++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c
@@ -182,8 +182,6 @@ static void mdp4_plane_set_scanout(struct drm_plane *plane,
 			msm_framebuffer_iova(fb, kms->aspace, 2));
 	mdp4_write(mdp4_kms, REG_MDP4_PIPE_SRCP3_BASE(pipe),
 			msm_framebuffer_iova(fb, kms->aspace, 3));
-
-	plane->fb = fb;
 }
 
 static void mdp4_write_csc_config(struct mdp4_kms *mdp4_kms,
diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c
index a9f31da7d45a..29c2988e8104 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c
@@ -1043,8 +1043,6 @@ static int mdp5_plane_mode_set(struct drm_plane *plane,
 				     src_img_w, src_img_h,
 				     src_x + src_w, src_y, src_w, src_h);
 
-	plane->fb = fb;
-
 	return ret;
 }
 
-- 
2.16.1

_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

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

* [PATCH 20/23] drm/virtio: Stop updating plane->fb
  2018-03-22 15:22 [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Ville Syrjala
                   ` (16 preceding siblings ...)
  2018-03-22 15:23 ` [PATCH 18/23] drm/exynos: Stop updating plane->crtc Ville Syrjala
@ 2018-03-22 15:23 ` Ville Syrjala
  2018-03-22 16:11   ` Gerd Hoffmann
                     ` (3 more replies)
  2018-03-22 15:23 ` [PATCH 21/23] drm/vc4: Stop updating plane->fb/crtc Ville Syrjala
                   ` (16 subsequent siblings)
  34 siblings, 4 replies; 74+ messages in thread
From: Ville Syrjala @ 2018-03-22 15:23 UTC (permalink / raw)
  To: dri-devel; +Cc: David Airlie, intel-gfx, virtualization

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

We want to get rid of plane->fb on atomic drivers. Stop setting it.

Cc: David Airlie <airlied@linux.ie>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: virtualization@lists.linux-foundation.org
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/virtio/virtgpu_display.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c
index 8cc8c34d67f5..42e842ceb53c 100644
--- a/drivers/gpu/drm/virtio/virtgpu_display.c
+++ b/drivers/gpu/drm/virtio/virtgpu_display.c
@@ -302,8 +302,6 @@ static int vgdev_output_init(struct virtio_gpu_device *vgdev, int index)
 	drm_crtc_init_with_planes(dev, crtc, primary, cursor,
 				  &virtio_gpu_crtc_funcs, NULL);
 	drm_crtc_helper_add(crtc, &virtio_gpu_crtc_helper_funcs);
-	primary->crtc = crtc;
-	cursor->crtc = crtc;
 
 	drm_connector_init(dev, connector, &virtio_gpu_connector_funcs,
 			   DRM_MODE_CONNECTOR_VIRTUAL);
-- 
2.16.1

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

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

* [PATCH 21/23] drm/vc4: Stop updating plane->fb/crtc
  2018-03-22 15:22 [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Ville Syrjala
                   ` (17 preceding siblings ...)
  2018-03-22 15:23 ` [PATCH 20/23] drm/virtio: Stop updating plane->fb Ville Syrjala
@ 2018-03-22 15:23 ` Ville Syrjala
  2018-03-22 16:50   ` Maarten Lankhorst
  2018-03-22 15:23 ` [PATCH 22/23] drm/i915: Restore planes after load detection Ville Syrjala
                   ` (15 subsequent siblings)
  34 siblings, 1 reply; 74+ messages in thread
From: Ville Syrjala @ 2018-03-22 15:23 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

We want to get rid of plane->fb/crtc on atomic drivers. Stop setting
them.

Cc: Eric Anholt <eric@anholt.net>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/vc4/vc4_crtc.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
index bf4667481935..a9f65e15889d 100644
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -837,7 +837,6 @@ static int vc4_async_page_flip(struct drm_crtc *crtc,
 	 * is released.
 	 */
 	drm_atomic_set_fb_for_plane(plane->state, fb);
-	plane->fb = fb;
 
 	vc4_queue_seqno_cb(dev, &flip_state->cb, bo->seqno,
 			   vc4_async_page_flip_complete);
@@ -1032,7 +1031,6 @@ static int vc4_crtc_bind(struct device *dev, struct device *master, void *data)
 	drm_crtc_init_with_planes(drm, crtc, primary_plane, NULL,
 				  &vc4_crtc_funcs, NULL);
 	drm_crtc_helper_add(crtc, &vc4_crtc_helper_funcs);
-	primary_plane->crtc = crtc;
 	vc4_crtc->channel = vc4_crtc->data->hvs_channel;
 	drm_mode_crtc_set_gamma_size(crtc, ARRAY_SIZE(vc4_crtc->lut_r));
 
@@ -1062,7 +1060,6 @@ static int vc4_crtc_bind(struct device *dev, struct device *master, void *data)
 	cursor_plane = vc4_plane_init(drm, DRM_PLANE_TYPE_CURSOR);
 	if (!IS_ERR(cursor_plane)) {
 		cursor_plane->possible_crtcs = 1 << drm_crtc_index(crtc);
-		cursor_plane->crtc = crtc;
 		crtc->cursor = cursor_plane;
 	}
 
-- 
2.16.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH 22/23] drm/i915: Restore planes after load detection
  2018-03-22 15:22 [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Ville Syrjala
                   ` (18 preceding siblings ...)
  2018-03-22 15:23 ` [PATCH 21/23] drm/vc4: Stop updating plane->fb/crtc Ville Syrjala
@ 2018-03-22 15:23 ` Ville Syrjala
  2018-03-22 15:23 ` [PATCH 23/23] drm/i915: Make force_load_detect effective even w/ DMI quirks/hotplug Ville Syrjala
                   ` (14 subsequent siblings)
  34 siblings, 0 replies; 74+ messages in thread
From: Ville Syrjala @ 2018-03-22 15:23 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter, intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Actually turn the planes back on after were done with
the load detection.

Fixes: 20bdc112bbe4 ("drm/i915: Disable all planes for load detection, v2.")
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index fcd755fe1b4e..8450ee742947 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -9975,6 +9975,8 @@ int intel_get_load_detect_pipe(struct drm_connector *connector,
 	ret = PTR_ERR_OR_ZERO(drm_atomic_get_connector_state(restore_state, connector));
 	if (!ret)
 		ret = PTR_ERR_OR_ZERO(drm_atomic_get_crtc_state(restore_state, crtc));
+	if (!ret)
+		ret = drm_atomic_add_affected_planes(restore_state, crtc);
 	if (ret) {
 		DRM_DEBUG_KMS("Failed to create a copy of old state to restore: %i\n", ret);
 		goto fail;
-- 
2.16.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH 23/23] drm/i915: Make force_load_detect effective even w/ DMI quirks/hotplug
  2018-03-22 15:22 [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Ville Syrjala
                   ` (19 preceding siblings ...)
  2018-03-22 15:23 ` [PATCH 22/23] drm/i915: Restore planes after load detection Ville Syrjala
@ 2018-03-22 15:23 ` Ville Syrjala
  2018-03-22 16:49   ` Maarten Lankhorst
  2018-03-22 17:41   ` [PATCH v2 " Ville Syrjala
  2018-03-22 16:38 ` ✗ Fi.CI.CHECKPATCH: warning for drm: Eliminate plane->fb/crtc usage for atomic drivers Patchwork
                   ` (13 subsequent siblings)
  34 siblings, 2 replies; 74+ messages in thread
From: Ville Syrjala @ 2018-03-22 15:23 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

When doing forced load detection testing we should totally ignore any
hotplug status for the connector. This is mostly relevant for machines
where we already ignore the hotplug status based on the DMI quirks. On
other machines we would currently skip the force load detection tests
on account of the connector already being connected.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_crt.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index c0a8805b277f..ee2324bba82e 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -748,6 +748,11 @@ intel_crt_detect(struct drm_connector *connector,
 		      connector->base.id, connector->name,
 		      force);
 
+	if (i915_modparams.load_detect_test) {
+		intel_display_power_get(dev_priv, intel_encoder->power_domain);
+		goto load_detect;
+	}
+
 	/* Skip machines without VGA that falsely report hotplug events */
 	if (dmi_check_system(intel_spurious_crt_detect))
 		return connector_status_disconnected;
@@ -781,6 +786,7 @@ intel_crt_detect(struct drm_connector *connector,
 		goto out;
 	}
 
+load_detect:
 	if (!force) {
 		status = connector->status;
 		goto out;
-- 
2.16.1

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

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

* Re: [PATCH 12/23] drm/vmwgfx: Stop consulting plane->fb
  2018-03-22 15:23 ` [PATCH 12/23] drm/vmwgfx: " Ville Syrjala
@ 2018-03-22 15:53   ` Thomas Hellstrom
  0 siblings, 0 replies; 74+ messages in thread
From: Thomas Hellstrom @ 2018-03-22 15:53 UTC (permalink / raw)
  To: Ville Syrjala, dri-devel; +Cc: intel-gfx, VMware Graphics, Sinclair Yeh

On 03/22/2018 04:23 PM, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> We want to get rid of plane->fb on atomic drivers. Stop looking at it.
>
> Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>
> Cc: Sinclair Yeh <syeh@vmware.com>
> Cc: Thomas Hellstrom <thellstrom@vmware.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>   drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> index 34ecc27fc30a..9fdb3ec9b4c4 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> @@ -385,9 +385,9 @@ vmw_du_cursor_plane_atomic_update(struct drm_plane *plane,
>   	hotspot_x = du->hotspot_x;
>   	hotspot_y = du->hotspot_y;
>   
> -	if (plane->fb) {
> -		hotspot_x += plane->fb->hot_x;
> -		hotspot_y += plane->fb->hot_y;
> +	if (plane->state->fb) {
> +		hotspot_x += plane->state->fb->hot_x;
> +		hotspot_y += plane->state->fb->hot_y;
>   	}
>   
>   	du->cursor_surface = vps->surf;
LGTM.

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>



_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH 20/23] drm/virtio: Stop updating plane->fb
  2018-03-22 15:23 ` [PATCH 20/23] drm/virtio: Stop updating plane->fb Ville Syrjala
@ 2018-03-22 16:11   ` Gerd Hoffmann
  2018-03-22 16:11   ` Gerd Hoffmann
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 74+ messages in thread
From: Gerd Hoffmann @ 2018-03-22 16:11 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: David Airlie, intel-gfx, dri-devel, virtualization

> We want to get rid of plane->fb on atomic drivers. Stop setting it.

> -	primary->crtc = crtc;
> -	cursor->crtc = crtc;

commit msg vs. patch content mismatch here ...

cheers,
  Gerd

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

* Re: [PATCH 20/23] drm/virtio: Stop updating plane->fb
  2018-03-22 15:23 ` [PATCH 20/23] drm/virtio: Stop updating plane->fb Ville Syrjala
  2018-03-22 16:11   ` Gerd Hoffmann
@ 2018-03-22 16:11   ` Gerd Hoffmann
  2018-03-22 17:40   ` [PATCH v2 20/23] drm/virtio: Stop updating plane->crtc Ville Syrjala
  2018-03-22 17:40   ` Ville Syrjala
  3 siblings, 0 replies; 74+ messages in thread
From: Gerd Hoffmann @ 2018-03-22 16:11 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: David Airlie, intel-gfx, dri-devel, virtualization

> We want to get rid of plane->fb on atomic drivers. Stop setting it.

> -	primary->crtc = crtc;
> -	cursor->crtc = crtc;

commit msg vs. patch content mismatch here ...

cheers,
  Gerd

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH 13/23] drm/zte: Stop consulting plane->fb
  2018-03-22 15:23 ` [PATCH 13/23] drm/zte: " Ville Syrjala
@ 2018-03-22 16:12   ` Maarten Lankhorst
  2018-03-22 17:40   ` [PATCH v2 " Ville Syrjala
  2018-03-26 12:14   ` [PATCH v3 13/23] drm/zte: Stop consulting plane->crtc Ville Syrjala
  2 siblings, 0 replies; 74+ messages in thread
From: Maarten Lankhorst @ 2018-03-22 16:12 UTC (permalink / raw)
  To: Ville Syrjala, dri-devel; +Cc: intel-gfx, Shawn Guo

Op 22-03-18 om 16:23 schreef Ville Syrjala:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> We want to get rid of plane->fb on atomic drivers. Stop looking at it.
>
> Cc: Shawn Guo <shawnguo@kernel.org>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/zte/zx_vou.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/zte/zx_vou.c b/drivers/gpu/drm/zte/zx_vou.c
> index 7491813131f3..57aae2e490f4 100644
> --- a/drivers/gpu/drm/zte/zx_vou.c
> +++ b/drivers/gpu/drm/zte/zx_vou.c
> @@ -629,7 +629,7 @@ void zx_vou_layer_enable(struct drm_plane *plane)
>  
>  void zx_vou_layer_disable(struct drm_plane *plane)
>  {
> -	struct zx_crtc *zcrtc = to_zx_crtc(plane->crtc);
> +	struct zx_crtc *zcrtc = to_zx_crtc(plane->state->crtc);
>  	struct zx_vou_hw *vou = zcrtc->vou;
>  	struct zx_plane *zplane = to_zx_plane(plane);
>  	const struct vou_layer_bits *bits = zplane->bits;

This function was not called with old_plane_state, which was ok when we still looked
at plane->crtc. But with the changes it seems that this will likely cause a null
pointer deref because when zx_plane_atomic_disable() is called, new_state->crtc is
probably NULL when disabling. I would look at old_state to be sure.

~Maarten

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

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

* Re: [PATCH 14/23] drm/atmel-hlcdc: Stop using plane->fb
  2018-03-22 15:23 ` [PATCH 14/23] drm/atmel-hlcdc: Stop using plane->fb Ville Syrjala
@ 2018-03-22 16:14   ` Maarten Lankhorst
  2018-03-22 17:30     ` Ville Syrjälä
  2018-03-27  8:13   ` Daniel Vetter
  1 sibling, 1 reply; 74+ messages in thread
From: Maarten Lankhorst @ 2018-03-22 16:14 UTC (permalink / raw)
  To: Ville Syrjala, dri-devel; +Cc: Boris Brezillon, intel-gfx

Op 22-03-18 om 16:23 schreef Ville Syrjala:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> We want to get rid of plane->fb on atomic drivers. Stop looking at it.
>
> Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 12 +-----------
>  1 file changed, 1 insertion(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> index e18800ed7cd1..0dd9fb617c28 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> @@ -819,16 +819,6 @@ static void atmel_hlcdc_plane_atomic_disable(struct drm_plane *p,
>  	atmel_hlcdc_layer_read_reg(&plane->layer, ATMEL_HLCDC_LAYER_ISR);
>  }
>  
> -static void atmel_hlcdc_plane_destroy(struct drm_plane *p)
> -{
> -	struct atmel_hlcdc_plane *plane = drm_plane_to_atmel_hlcdc_plane(p);
> -
> -	if (plane->base.fb)
> -		drm_framebuffer_put(plane->base.fb);
> -
> -	drm_plane_cleanup(p);
> -}
> -
>  static int atmel_hlcdc_plane_atomic_set_property(struct drm_plane *p,
>  						 struct drm_plane_state *s,
>  						 struct drm_property *property,
> @@ -1038,7 +1028,7 @@ static void atmel_hlcdc_plane_atomic_destroy_state(struct drm_plane *p,
>  static const struct drm_plane_funcs layer_plane_funcs = {
>  	.update_plane = drm_atomic_helper_update_plane,
>  	.disable_plane = drm_atomic_helper_disable_plane,
> -	.destroy = atmel_hlcdc_plane_destroy,
> +	.destroy = drm_plane_cleanup,
>  	.reset = atmel_hlcdc_plane_reset,
>  	.atomic_duplicate_state = atmel_hlcdc_plane_atomic_duplicate_state,
>  	.atomic_destroy_state = atmel_hlcdc_plane_atomic_destroy_state,

This patch should probably be after 'drm: Stop updating plane->crtc/fb/old_fb on atomic drivers'?

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH 11/23] drm/sti: Stop consulting plane->fb
  2018-03-22 15:23 ` [PATCH 11/23] drm/sti: " Ville Syrjala
@ 2018-03-22 16:25   ` Benjamin Gaignard
  0 siblings, 0 replies; 74+ messages in thread
From: Benjamin Gaignard @ 2018-03-22 16:25 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: Intel Graphics Development, Vincent Abriou, dri-devel

2018-03-22 16:23 GMT+01:00 Ville Syrjala <ville.syrjala@linux.intel.com>:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> We want to get rid of plane->fb on atomic drivers. Stop looking at it.
>
> Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
> Cc: Vincent Abriou <vincent.abriou@st.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Ack-ed by: Benjamin Gaignard <benjamin.gaignard@linaro.org>

> ---
>  drivers/gpu/drm/sti/sti_plane.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_plane.c b/drivers/gpu/drm/sti/sti_plane.c
> index b074609c960a..b48cd86e0250 100644
> --- a/drivers/gpu/drm/sti/sti_plane.c
> +++ b/drivers/gpu/drm/sti/sti_plane.c
> @@ -40,6 +40,7 @@ void sti_plane_update_fps(struct sti_plane *plane,
>                           bool new_frame,
>                           bool new_field)
>  {
> +       struct drm_plane_state *state = plane->drm_plane.state;
>         ktime_t now;
>         struct sti_fps_info *fps;
>         int fpks, fipks, ms_since_last, num_frames, num_fields;
> @@ -66,14 +67,14 @@ void sti_plane_update_fps(struct sti_plane *plane,
>         fps->last_timestamp = now;
>         fps->last_frame_counter = fps->curr_frame_counter;
>
> -       if (plane->drm_plane.fb) {
> +       if (state->fb) {
>                 fpks = (num_frames * 1000000) / ms_since_last;
>                 snprintf(plane->fps_info.fps_str, FPS_LENGTH,
>                          "%-8s %4dx%-4d %.4s @ %3d.%-3.3d fps (%s)",
>                          plane->drm_plane.name,
> -                        plane->drm_plane.fb->width,
> -                        plane->drm_plane.fb->height,
> -                        (char *)&plane->drm_plane.fb->format->format,
> +                        state->fb->width,
> +                        state->fb->height,
> +                        (char *)&state->fb->format->format,
>                          fpks / 1000, fpks % 1000,
>                          sti_plane_to_str(plane));
>         }
> --
> 2.16.1
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* ✗ Fi.CI.CHECKPATCH: warning for drm: Eliminate plane->fb/crtc usage for atomic drivers
  2018-03-22 15:22 [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Ville Syrjala
                   ` (20 preceding siblings ...)
  2018-03-22 15:23 ` [PATCH 23/23] drm/i915: Make force_load_detect effective even w/ DMI quirks/hotplug Ville Syrjala
@ 2018-03-22 16:38 ` Patchwork
  2018-03-22 16:51 ` [PATCH 00/23] " Noralf Trønnes
                   ` (12 subsequent siblings)
  34 siblings, 0 replies; 74+ messages in thread
From: Patchwork @ 2018-03-22 16:38 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: intel-gfx

== Series Details ==

Series: drm: Eliminate plane->fb/crtc usage for atomic drivers
URL   : https://patchwork.freedesktop.org/series/40478/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
8af098617121 Revert "drm/atomic-helper: Fix leak in disable_all"
03876a233cc7 drm/atomic-helper: Make drm_atomic_helper_disable_all() update the plane->fb pointers
-:93: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations
#93: FILE: drivers/gpu/drm/drm_atomic_helper.c:2952:
 }
+/**

total: 0 errors, 0 warnings, 1 checks, 98 lines checked
224a3f4b99a5 drm: Clear crtc->primary->crtc when disabling the crtc via setcrtc()
c3954d83df2f drm/atomic-helper: WARN if legacy plane fb pointers are bogus when committing duplicated state
6580440ce62b drm: Add local 'plane' variable for primary/cursor planes
-:121: WARNING:AVOID_BUG: Avoid crashing the kernel - try using WARN_ON & recovery code rather than BUG() or BUG_ON()
#121: FILE: drivers/gpu/drm/drm_plane.c:773:
+	BUG_ON(!plane);

-:122: CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written "plane->crtc"
#122: FILE: drivers/gpu/drm/drm_plane.c:774:
+	WARN_ON(plane->crtc != crtc && plane->crtc != NULL);

-:171: CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written "!plane->fb"
#171: FILE: drivers/gpu/drm/drm_plane.c:1014:
+	if (plane->fb == NULL) {

total: 0 errors, 1 warnings, 2 checks, 186 lines checked
c5f62380d076 drm: Adjust whitespace for legibility
a7e79ff637c5 drm: Make the fb refcount handover less magic
b3b47d829071 drm: Use plane->state->fb over plane->fb
-:90: CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written "!old_fb"
#90: FILE: drivers/gpu/drm/drm_plane.c:1024:
+	if (old_fb == NULL) {

total: 0 errors, 0 warnings, 1 checks, 79 lines checked
8ea5e6add2d4 drm/i915: Stop consulting plane->fb
ae87bf410783 drm/msm: Stop consulting plane->fb
7c4e668f28fa drm/sti: Stop consulting plane->fb
610d46292088 drm/vmwgfx: Stop consulting plane->fb
9be6d164afc9 drm/zte: Stop consulting plane->fb
bfa847ae0a04 drm/atmel-hlcdc: Stop using plane->fb
44c1635bfc7d drm: Stop updating plane->crtc/fb/old_fb on atomic drivers
54454e18424d drm/amdgpu/dc: Stop updating plane->fb
b2817ab02542 drm/i915: Stop updating plane->fb/crtc
12ec4c91178b drm/exynos: Stop updating plane->crtc
d79a0cea6333 drm/msm: Stop updating plane->fb/crtc
39c3be848eb9 drm/virtio: Stop updating plane->fb
6994f330dc05 drm/vc4: Stop updating plane->fb/crtc
ea19ce070e91 drm/i915: Restore planes after load detection
9ed8bc3b37c4 drm/i915: Make force_load_detect effective even w/ DMI quirks/hotplug

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH 23/23] drm/i915: Make force_load_detect effective even w/ DMI quirks/hotplug
  2018-03-22 15:23 ` [PATCH 23/23] drm/i915: Make force_load_detect effective even w/ DMI quirks/hotplug Ville Syrjala
@ 2018-03-22 16:49   ` Maarten Lankhorst
  2018-03-22 17:41   ` [PATCH v2 " Ville Syrjala
  1 sibling, 0 replies; 74+ messages in thread
From: Maarten Lankhorst @ 2018-03-22 16:49 UTC (permalink / raw)
  To: Ville Syrjala, dri-devel; +Cc: intel-gfx

Op 22-03-18 om 16:23 schreef Ville Syrjala:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> When doing forced load detection testing we should totally ignore any
> hotplug status for the connector. This is mostly relevant for machines
> where we already ignore the hotplug status based on the DMI quirks. On
> other machines we would currently skip the force load detection tests
> on account of the connector already being connected.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_crt.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
> index c0a8805b277f..ee2324bba82e 100644
> --- a/drivers/gpu/drm/i915/intel_crt.c
> +++ b/drivers/gpu/drm/i915/intel_crt.c
> @@ -748,6 +748,11 @@ intel_crt_detect(struct drm_connector *connector,
>  		      connector->base.id, connector->name,
>  		      force);
>  
> +	if (i915_modparams.load_detect_test) {
> +		intel_display_power_get(dev_priv, intel_encoder->power_domain);
> +		goto load_detect;
> +	}
> +
>  	/* Skip machines without VGA that falsely report hotplug events */
>  	if (dmi_check_system(intel_spurious_crt_detect))
>  		return connector_status_disconnected;
> @@ -781,6 +786,7 @@ intel_crt_detect(struct drm_connector *connector,
>  		goto out;
>  	}
>  
> +load_detect:
>  	if (!force) {
>  		status = connector->status;
>  		goto out;

This makes another reference to load_detect_test obsolete, the other one should be removed since its unreachable now. :)

~Maarten

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH 21/23] drm/vc4: Stop updating plane->fb/crtc
  2018-03-22 15:23 ` [PATCH 21/23] drm/vc4: Stop updating plane->fb/crtc Ville Syrjala
@ 2018-03-22 16:50   ` Maarten Lankhorst
  0 siblings, 0 replies; 74+ messages in thread
From: Maarten Lankhorst @ 2018-03-22 16:50 UTC (permalink / raw)
  To: Ville Syrjala, dri-devel; +Cc: intel-gfx

Op 22-03-18 om 16:23 schreef Ville Syrjala:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> We want to get rid of plane->fb/crtc on atomic drivers. Stop setting
> them.
>
> Cc: Eric Anholt <eric@anholt.net>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/vc4/vc4_crtc.c | 3 ---
>  1 file changed, 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
> index bf4667481935..a9f65e15889d 100644
> --- a/drivers/gpu/drm/vc4/vc4_crtc.c
> +++ b/drivers/gpu/drm/vc4/vc4_crtc.c
> @@ -837,7 +837,6 @@ static int vc4_async_page_flip(struct drm_crtc *crtc,
>  	 * is released.
>  	 */
>  	drm_atomic_set_fb_for_plane(plane->state, fb);
> -	plane->fb = fb;
>  
>  	vc4_queue_seqno_cb(dev, &flip_state->cb, bo->seqno,
>  			   vc4_async_page_flip_complete);
> @@ -1032,7 +1031,6 @@ static int vc4_crtc_bind(struct device *dev, struct device *master, void *data)
>  	drm_crtc_init_with_planes(drm, crtc, primary_plane, NULL,
>  				  &vc4_crtc_funcs, NULL);
>  	drm_crtc_helper_add(crtc, &vc4_crtc_helper_funcs);
> -	primary_plane->crtc = crtc;
>  	vc4_crtc->channel = vc4_crtc->data->hvs_channel;
>  	drm_mode_crtc_set_gamma_size(crtc, ARRAY_SIZE(vc4_crtc->lut_r));
>  
> @@ -1062,7 +1060,6 @@ static int vc4_crtc_bind(struct device *dev, struct device *master, void *data)
>  	cursor_plane = vc4_plane_init(drm, DRM_PLANE_TYPE_CURSOR);
>  	if (!IS_ERR(cursor_plane)) {
>  		cursor_plane->possible_crtcs = 1 << drm_crtc_index(crtc);
> -		cursor_plane->crtc = crtc;
>  		crtc->cursor = cursor_plane;
>  	}
>  

With all my comments fixed, for the whole series:

Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers
  2018-03-22 15:22 [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Ville Syrjala
                   ` (21 preceding siblings ...)
  2018-03-22 16:38 ` ✗ Fi.CI.CHECKPATCH: warning for drm: Eliminate plane->fb/crtc usage for atomic drivers Patchwork
@ 2018-03-22 16:51 ` Noralf Trønnes
       [not found]   ` <b92fe986-295c-fecb-dca1-82cb9bf7b7b1-L59+Z2yzLopAfugRpC6u6w@public.gmane.org>
  2018-03-22 18:49   ` Ville Syrjälä
  2018-03-22 16:51 ` Noralf Trønnes
                   ` (11 subsequent siblings)
  34 siblings, 2 replies; 74+ messages in thread
From: Noralf Trønnes @ 2018-03-22 16:51 UTC (permalink / raw)
  To: Ville Syrjala, dri-devel
  Cc: Boris Brezillon, Thomas Hellstrom, David Airlie, Daniel Vetter,
	intel-gfx, Seung-Woo Kim, amd-gfx, virtualization, Kyungmin Park,
	VMware Graphics, Gerd Hoffmann, linux-arm-msm, Alex Deucher,
	Shawn Guo, freedreno, Vincent Abriou, Christian König


Den 22.03.2018 16.22, skrev Ville Syrjala:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> I really just wanted to fix i915 to re-enable its planes afer load
> detection (a two line patch). This is what I actually ended up with
> after I ran into a framebuffer refcount leak with said two line patch.
>
> I've tested this on a few i915 boxes and so far it's looking
> good. Everything else is just compile tested.
>
> Entire series available here:
> git://github.com/vsyrjala/linux.git plane_fb_crtc_nuke
>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
> Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
> Cc: chris@chris-wilson.co.uk
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Dave Airlie <airlied@gmail.com>
> Cc: David Airlie <airlied@linux.ie>
> Cc: "David (ChunMing) Zhou" <David1.Zhou@amd.com>
> Cc: Eric Anholt <eric@anholt.net>
> Cc: freedreno@lists.freedesktop.org
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Harry Wentland <harry.wentland@amd.com>
> Cc: Inki Dae <inki.dae@samsung.com>
> Cc: Joonyoung Shim <jy0922.shim@samsung.com>
> Cc: Kyungmin Park <kyungmin.park@samsung.com>
> Cc: linux-arm-msm@vger.kernel.org
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: martin.peres@free.fr
> Cc: Rob Clark <robdclark@gmail.com>
> Cc: Seung-Woo Kim <sw0312.kim@samsung.com>
> Cc: Shawn Guo <shawnguo@kernel.org>
> Cc: Sinclair Yeh <syeh@vmware.com>
> Cc: Thomas Hellstrom <thellstrom@vmware.com>
> Cc: Vincent Abriou <vincent.abriou@st.com>
> Cc: virtualization@lists.linux-foundation.org
> Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>
>
> Ville Syrjälä (23):
>    Revert "drm/atomic-helper: Fix leak in disable_all"
>    drm/atomic-helper: Make drm_atomic_helper_disable_all() update the
>      plane->fb pointers
>    drm: Clear crtc->primary->crtc when disabling the crtc via setcrtc()
>    drm/atomic-helper: WARN if legacy plane fb pointers are bogus when
>      committing duplicated state
>    drm: Add local 'plane' variable for primary/cursor planes
>    drm: Adjust whitespace for legibility
>    drm: Make the fb refcount handover less magic
>    drm: Use plane->state->fb over plane->fb
>    drm/i915: Stop consulting plane->fb
>    drm/msm: Stop consulting plane->fb
>    drm/sti: Stop consulting plane->fb
>    drm/vmwgfx: Stop consulting plane->fb
>    drm/zte: Stop consulting plane->fb
>    drm/atmel-hlcdc: Stop using plane->fb
>    drm: Stop updating plane->crtc/fb/old_fb on atomic drivers
>    drm/amdgpu/dc: Stop updating plane->fb
>    drm/i915: Stop updating plane->fb/crtc
>    drm/exynos: Stop updating plane->crtc
>    drm/msm: Stop updating plane->fb/crtc
>    drm/virtio: Stop updating plane->fb
>    drm/vc4: Stop updating plane->fb/crtc
>    drm/i915: Restore planes after load detection
>    drm/i915: Make force_load_detect effective even w/ DMI quirks/hotplug

tinydrm is also using plane->fb:

$ grep -r "plane\.fb" drivers/gpu/drm/tinydrm/
drivers/gpu/drm/tinydrm/repaper.c:      if (tdev->pipe.plane.fb != fb)
drivers/gpu/drm/tinydrm/mipi-dbi.c:     if (tdev->pipe.plane.fb != fb)
drivers/gpu/drm/tinydrm/mipi-dbi.c:     struct drm_framebuffer *fb = 
mipi->tinydrm.pipe.plane.fb;
drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c: pipe->plane.fb = fb;
drivers/gpu/drm/tinydrm/ili9225.c:      if (tdev->pipe.plane.fb != fb)
drivers/gpu/drm/tinydrm/st7586.c:       if (tdev->pipe.plane.fb != fb)

Noralf.

>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  2 -
>   drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c   | 12 +---
>   drivers/gpu/drm/drm_atomic.c                      | 55 ++--------------
>   drivers/gpu/drm/drm_atomic_helper.c               | 79 ++++++++++-------------
>   drivers/gpu/drm/drm_crtc.c                        | 51 ++++++++++-----
>   drivers/gpu/drm/drm_fb_helper.c                   |  7 --
>   drivers/gpu/drm/drm_framebuffer.c                 |  5 --
>   drivers/gpu/drm/drm_plane.c                       | 64 +++++++++++-------
>   drivers/gpu/drm/drm_plane_helper.c                |  4 +-
>   drivers/gpu/drm/exynos/exynos_drm_plane.c         |  2 -
>   drivers/gpu/drm/i915/intel_crt.c                  |  6 ++
>   drivers/gpu/drm/i915/intel_display.c              |  9 +--
>   drivers/gpu/drm/i915/intel_fbdev.c                |  2 +-
>   drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c         |  3 +-
>   drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c        |  2 -
>   drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c        |  2 -
>   drivers/gpu/drm/sti/sti_plane.c                   |  9 +--
>   drivers/gpu/drm/vc4/vc4_crtc.c                    |  3 -
>   drivers/gpu/drm/virtio/virtgpu_display.c          |  2 -
>   drivers/gpu/drm/vmwgfx/vmwgfx_kms.c               |  6 +-
>   drivers/gpu/drm/zte/zx_vou.c                      |  2 +-
>   include/drm/drm_atomic.h                          |  3 -
>   22 files changed, 143 insertions(+), 187 deletions(-)
>

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers
  2018-03-22 15:22 [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Ville Syrjala
                   ` (22 preceding siblings ...)
  2018-03-22 16:51 ` [PATCH 00/23] " Noralf Trønnes
@ 2018-03-22 16:51 ` Noralf Trønnes
  2018-03-22 16:52 ` ✗ Fi.CI.BAT: failure for " Patchwork
                   ` (10 subsequent siblings)
  34 siblings, 0 replies; 74+ messages in thread
From: Noralf Trønnes @ 2018-03-22 16:51 UTC (permalink / raw)
  To: Ville Syrjala, dri-devel
  Cc: Boris Brezillon, Thomas Hellstrom, David Airlie, Daniel Vetter,
	intel-gfx, Seung-Woo Kim, amd-gfx, virtualization, Kyungmin Park,
	VMware Graphics, linux-arm-msm, Alex Deucher, Shawn Guo,
	freedreno, Vincent Abriou, Christian König


Den 22.03.2018 16.22, skrev Ville Syrjala:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> I really just wanted to fix i915 to re-enable its planes afer load
> detection (a two line patch). This is what I actually ended up with
> after I ran into a framebuffer refcount leak with said two line patch.
>
> I've tested this on a few i915 boxes and so far it's looking
> good. Everything else is just compile tested.
>
> Entire series available here:
> git://github.com/vsyrjala/linux.git plane_fb_crtc_nuke
>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
> Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
> Cc: chris@chris-wilson.co.uk
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Dave Airlie <airlied@gmail.com>
> Cc: David Airlie <airlied@linux.ie>
> Cc: "David (ChunMing) Zhou" <David1.Zhou@amd.com>
> Cc: Eric Anholt <eric@anholt.net>
> Cc: freedreno@lists.freedesktop.org
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Harry Wentland <harry.wentland@amd.com>
> Cc: Inki Dae <inki.dae@samsung.com>
> Cc: Joonyoung Shim <jy0922.shim@samsung.com>
> Cc: Kyungmin Park <kyungmin.park@samsung.com>
> Cc: linux-arm-msm@vger.kernel.org
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: martin.peres@free.fr
> Cc: Rob Clark <robdclark@gmail.com>
> Cc: Seung-Woo Kim <sw0312.kim@samsung.com>
> Cc: Shawn Guo <shawnguo@kernel.org>
> Cc: Sinclair Yeh <syeh@vmware.com>
> Cc: Thomas Hellstrom <thellstrom@vmware.com>
> Cc: Vincent Abriou <vincent.abriou@st.com>
> Cc: virtualization@lists.linux-foundation.org
> Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>
>
> Ville Syrjälä (23):
>    Revert "drm/atomic-helper: Fix leak in disable_all"
>    drm/atomic-helper: Make drm_atomic_helper_disable_all() update the
>      plane->fb pointers
>    drm: Clear crtc->primary->crtc when disabling the crtc via setcrtc()
>    drm/atomic-helper: WARN if legacy plane fb pointers are bogus when
>      committing duplicated state
>    drm: Add local 'plane' variable for primary/cursor planes
>    drm: Adjust whitespace for legibility
>    drm: Make the fb refcount handover less magic
>    drm: Use plane->state->fb over plane->fb
>    drm/i915: Stop consulting plane->fb
>    drm/msm: Stop consulting plane->fb
>    drm/sti: Stop consulting plane->fb
>    drm/vmwgfx: Stop consulting plane->fb
>    drm/zte: Stop consulting plane->fb
>    drm/atmel-hlcdc: Stop using plane->fb
>    drm: Stop updating plane->crtc/fb/old_fb on atomic drivers
>    drm/amdgpu/dc: Stop updating plane->fb
>    drm/i915: Stop updating plane->fb/crtc
>    drm/exynos: Stop updating plane->crtc
>    drm/msm: Stop updating plane->fb/crtc
>    drm/virtio: Stop updating plane->fb
>    drm/vc4: Stop updating plane->fb/crtc
>    drm/i915: Restore planes after load detection
>    drm/i915: Make force_load_detect effective even w/ DMI quirks/hotplug

tinydrm is also using plane->fb:

$ grep -r "plane\.fb" drivers/gpu/drm/tinydrm/
drivers/gpu/drm/tinydrm/repaper.c:      if (tdev->pipe.plane.fb != fb)
drivers/gpu/drm/tinydrm/mipi-dbi.c:     if (tdev->pipe.plane.fb != fb)
drivers/gpu/drm/tinydrm/mipi-dbi.c:     struct drm_framebuffer *fb = 
mipi->tinydrm.pipe.plane.fb;
drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c: pipe->plane.fb = fb;
drivers/gpu/drm/tinydrm/ili9225.c:      if (tdev->pipe.plane.fb != fb)
drivers/gpu/drm/tinydrm/st7586.c:       if (tdev->pipe.plane.fb != fb)

Noralf.

>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  2 -
>   drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c   | 12 +---
>   drivers/gpu/drm/drm_atomic.c                      | 55 ++--------------
>   drivers/gpu/drm/drm_atomic_helper.c               | 79 ++++++++++-------------
>   drivers/gpu/drm/drm_crtc.c                        | 51 ++++++++++-----
>   drivers/gpu/drm/drm_fb_helper.c                   |  7 --
>   drivers/gpu/drm/drm_framebuffer.c                 |  5 --
>   drivers/gpu/drm/drm_plane.c                       | 64 +++++++++++-------
>   drivers/gpu/drm/drm_plane_helper.c                |  4 +-
>   drivers/gpu/drm/exynos/exynos_drm_plane.c         |  2 -
>   drivers/gpu/drm/i915/intel_crt.c                  |  6 ++
>   drivers/gpu/drm/i915/intel_display.c              |  9 +--
>   drivers/gpu/drm/i915/intel_fbdev.c                |  2 +-
>   drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c         |  3 +-
>   drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c        |  2 -
>   drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c        |  2 -
>   drivers/gpu/drm/sti/sti_plane.c                   |  9 +--
>   drivers/gpu/drm/vc4/vc4_crtc.c                    |  3 -
>   drivers/gpu/drm/virtio/virtgpu_display.c          |  2 -
>   drivers/gpu/drm/vmwgfx/vmwgfx_kms.c               |  6 +-
>   drivers/gpu/drm/zte/zx_vou.c                      |  2 +-
>   include/drm/drm_atomic.h                          |  3 -
>   22 files changed, 143 insertions(+), 187 deletions(-)
>

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

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

* ✗ Fi.CI.BAT: failure for drm: Eliminate plane->fb/crtc usage for atomic drivers
  2018-03-22 15:22 [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Ville Syrjala
                   ` (23 preceding siblings ...)
  2018-03-22 16:51 ` Noralf Trønnes
@ 2018-03-22 16:52 ` Patchwork
  2018-03-22 17:54 ` [PATCH 00/23] " Emil Velikov
                   ` (9 subsequent siblings)
  34 siblings, 0 replies; 74+ messages in thread
From: Patchwork @ 2018-03-22 16:52 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: intel-gfx

== Series Details ==

Series: drm: Eliminate plane->fb/crtc usage for atomic drivers
URL   : https://patchwork.freedesktop.org/series/40478/
State : failure

== Summary ==

Series 40478v1 drm: Eliminate plane->fb/crtc usage for atomic drivers
https://patchwork.freedesktop.org/api/1.0/series/40478/revisions/1/mbox/

---- Possible new issues:

Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-a:
                pass       -> INCOMPLETE (fi-glk-1)

---- Known issues:

Test debugfs_test:
        Subgroup read_all_entries:
                incomplete -> PASS       (fi-snb-2520m) fdo#103713
Test gem_mmap_gtt:
        Subgroup basic-small-bo-tiledx:
                fail       -> PASS       (fi-gdg-551) fdo#102575
Test kms_pipe_crc_basic:
        Subgroup nonblocking-crc-pipe-b-frame-sequence:
                incomplete -> PASS       (fi-cnl-y3) fdo#103191

fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
fdo#102575 https://bugs.freedesktop.org/show_bug.cgi?id=102575
fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191

fi-bdw-5557u     total:285  pass:264  dwarn:0   dfail:0   fail:0   skip:21  time:430s
fi-bdw-gvtdvm    total:285  pass:261  dwarn:0   dfail:0   fail:0   skip:24  time:440s
fi-blb-e6850     total:285  pass:220  dwarn:1   dfail:0   fail:0   skip:64  time:385s
fi-bsw-n3050     total:285  pass:239  dwarn:0   dfail:0   fail:0   skip:46  time:543s
fi-bwr-2160      total:285  pass:180  dwarn:0   dfail:0   fail:0   skip:105 time:297s
fi-bxt-dsi       total:285  pass:255  dwarn:0   dfail:0   fail:0   skip:30  time:510s
fi-bxt-j4205     total:285  pass:256  dwarn:0   dfail:0   fail:0   skip:29  time:515s
fi-byt-j1900     total:285  pass:250  dwarn:0   dfail:0   fail:0   skip:35  time:517s
fi-byt-n2820     total:285  pass:246  dwarn:0   dfail:0   fail:0   skip:39  time:504s
fi-cfl-8700k     total:285  pass:257  dwarn:0   dfail:0   fail:0   skip:28  time:407s
fi-cfl-u         total:285  pass:259  dwarn:0   dfail:0   fail:0   skip:26  time:513s
fi-cnl-drrs      total:285  pass:254  dwarn:3   dfail:0   fail:0   skip:28  time:525s
fi-cnl-y3        total:285  pass:259  dwarn:0   dfail:0   fail:0   skip:26  time:580s
fi-elk-e7500     total:285  pass:225  dwarn:1   dfail:0   fail:0   skip:59  time:425s
fi-gdg-551       total:285  pass:177  dwarn:0   dfail:0   fail:0   skip:108 time:317s
fi-glk-1         total:241  pass:214  dwarn:0   dfail:0   fail:0   skip:26 
fi-hsw-4770      total:285  pass:258  dwarn:0   dfail:0   fail:0   skip:27  time:402s
fi-ilk-650       total:285  pass:225  dwarn:0   dfail:0   fail:0   skip:60  time:422s
fi-ivb-3520m     total:285  pass:256  dwarn:0   dfail:0   fail:0   skip:29  time:468s
fi-ivb-3770      total:285  pass:252  dwarn:0   dfail:0   fail:0   skip:33  time:431s
fi-kbl-7500u     total:285  pass:260  dwarn:1   dfail:0   fail:0   skip:24  time:481s
fi-kbl-7567u     total:285  pass:265  dwarn:0   dfail:0   fail:0   skip:20  time:467s
fi-kbl-r         total:285  pass:258  dwarn:0   dfail:0   fail:0   skip:27  time:514s
fi-pnv-d510      total:285  pass:219  dwarn:1   dfail:0   fail:0   skip:65  time:653s
fi-skl-6260u     total:285  pass:265  dwarn:0   dfail:0   fail:0   skip:20  time:441s
fi-skl-6600u     total:285  pass:258  dwarn:0   dfail:0   fail:0   skip:27  time:537s
fi-skl-6700k2    total:285  pass:261  dwarn:0   dfail:0   fail:0   skip:24  time:501s
fi-skl-6770hq    total:285  pass:265  dwarn:0   dfail:0   fail:0   skip:20  time:511s
fi-skl-guc       total:285  pass:257  dwarn:0   dfail:0   fail:0   skip:28  time:429s
fi-skl-gvtdvm    total:285  pass:262  dwarn:0   dfail:0   fail:0   skip:23  time:445s
fi-snb-2520m     total:285  pass:245  dwarn:0   dfail:0   fail:0   skip:40  time:587s
fi-snb-2600      total:285  pass:245  dwarn:0   dfail:0   fail:0   skip:40  time:400s
fi-cfl-s3 failed to connect after reboot

40fcdd23bec787a5913496f2b11c5d26bdff985a drm-tip: 2018y-03m-22d-15h-28m-32s UTC integration manifest
9ed8bc3b37c4 drm/i915: Make force_load_detect effective even w/ DMI quirks/hotplug
ea19ce070e91 drm/i915: Restore planes after load detection
6994f330dc05 drm/vc4: Stop updating plane->fb/crtc
39c3be848eb9 drm/virtio: Stop updating plane->fb
d79a0cea6333 drm/msm: Stop updating plane->fb/crtc
12ec4c91178b drm/exynos: Stop updating plane->crtc
b2817ab02542 drm/i915: Stop updating plane->fb/crtc
54454e18424d drm/amdgpu/dc: Stop updating plane->fb
44c1635bfc7d drm: Stop updating plane->crtc/fb/old_fb on atomic drivers
bfa847ae0a04 drm/atmel-hlcdc: Stop using plane->fb
9be6d164afc9 drm/zte: Stop consulting plane->fb
610d46292088 drm/vmwgfx: Stop consulting plane->fb
7c4e668f28fa drm/sti: Stop consulting plane->fb
ae87bf410783 drm/msm: Stop consulting plane->fb
8ea5e6add2d4 drm/i915: Stop consulting plane->fb
b3b47d829071 drm: Use plane->state->fb over plane->fb
a7e79ff637c5 drm: Make the fb refcount handover less magic
c5f62380d076 drm: Adjust whitespace for legibility
6580440ce62b drm: Add local 'plane' variable for primary/cursor planes
c3954d83df2f drm/atomic-helper: WARN if legacy plane fb pointers are bogus when committing duplicated state
224a3f4b99a5 drm: Clear crtc->primary->crtc when disabling the crtc via setcrtc()
03876a233cc7 drm/atomic-helper: Make drm_atomic_helper_disable_all() update the plane->fb pointers
8af098617121 Revert "drm/atomic-helper: Fix leak in disable_all"

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8452/issues.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH 14/23] drm/atmel-hlcdc: Stop using plane->fb
  2018-03-22 16:14   ` Maarten Lankhorst
@ 2018-03-22 17:30     ` Ville Syrjälä
  0 siblings, 0 replies; 74+ messages in thread
From: Ville Syrjälä @ 2018-03-22 17:30 UTC (permalink / raw)
  To: Maarten Lankhorst; +Cc: Boris Brezillon, intel-gfx, dri-devel

On Thu, Mar 22, 2018 at 05:14:08PM +0100, Maarten Lankhorst wrote:
> Op 22-03-18 om 16:23 schreef Ville Syrjala:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > We want to get rid of plane->fb on atomic drivers. Stop looking at it.
> >
> > Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 12 +-----------
> >  1 file changed, 1 insertion(+), 11 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> > index e18800ed7cd1..0dd9fb617c28 100644
> > --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> > +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> > @@ -819,16 +819,6 @@ static void atmel_hlcdc_plane_atomic_disable(struct drm_plane *p,
> >  	atmel_hlcdc_layer_read_reg(&plane->layer, ATMEL_HLCDC_LAYER_ISR);
> >  }
> >  
> > -static void atmel_hlcdc_plane_destroy(struct drm_plane *p)
> > -{
> > -	struct atmel_hlcdc_plane *plane = drm_plane_to_atmel_hlcdc_plane(p);
> > -
> > -	if (plane->base.fb)
> > -		drm_framebuffer_put(plane->base.fb);
> > -
> > -	drm_plane_cleanup(p);
> > -}
> > -
> >  static int atmel_hlcdc_plane_atomic_set_property(struct drm_plane *p,
> >  						 struct drm_plane_state *s,
> >  						 struct drm_property *property,
> > @@ -1038,7 +1028,7 @@ static void atmel_hlcdc_plane_atomic_destroy_state(struct drm_plane *p,
> >  static const struct drm_plane_funcs layer_plane_funcs = {
> >  	.update_plane = drm_atomic_helper_update_plane,
> >  	.disable_plane = drm_atomic_helper_disable_plane,
> > -	.destroy = atmel_hlcdc_plane_destroy,
> > +	.destroy = drm_plane_cleanup,
> >  	.reset = atmel_hlcdc_plane_reset,
> >  	.atomic_duplicate_state = atmel_hlcdc_plane_atomic_duplicate_state,
> >  	.atomic_destroy_state = atmel_hlcdc_plane_atomic_destroy_state,
> 
> This patch should probably be after 'drm: Stop updating plane->crtc/fb/old_fb on atomic drivers'?

Yeah, that does seem like a better order.

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v2 13/23] drm/zte: Stop consulting plane->fb
  2018-03-22 15:23 ` [PATCH 13/23] drm/zte: " Ville Syrjala
  2018-03-22 16:12   ` Maarten Lankhorst
@ 2018-03-22 17:40   ` Ville Syrjala
  2018-03-26  7:25     ` Shawn Guo
  2018-03-26 12:14   ` [PATCH v3 13/23] drm/zte: Stop consulting plane->crtc Ville Syrjala
  2 siblings, 1 reply; 74+ messages in thread
From: Ville Syrjala @ 2018-03-22 17:40 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx, Shawn Guo

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

We want to get rid of plane->fb on atomic drivers. Stop looking at it.

v2: Use old_state->crtc (Maarten)

Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/zte/zx_plane.c | 2 +-
 drivers/gpu/drm/zte/zx_vou.c   | 5 +++--
 drivers/gpu/drm/zte/zx_vou.h   | 3 ++-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/zte/zx_plane.c b/drivers/gpu/drm/zte/zx_plane.c
index 94545adac50d..d1931f5ea0b2 100644
--- a/drivers/gpu/drm/zte/zx_plane.c
+++ b/drivers/gpu/drm/zte/zx_plane.c
@@ -268,7 +268,7 @@ static void zx_plane_atomic_disable(struct drm_plane *plane,
 	struct zx_plane *zplane = to_zx_plane(plane);
 	void __iomem *hbsc = zplane->hbsc;
 
-	zx_vou_layer_disable(plane);
+	zx_vou_layer_disable(plane, old_state);
 
 	/* Disable HBSC block */
 	zx_writel_mask(hbsc + HBSC_CTRL0, HBSC_CTRL_EN, 0);
diff --git a/drivers/gpu/drm/zte/zx_vou.c b/drivers/gpu/drm/zte/zx_vou.c
index 7491813131f3..442311d31110 100644
--- a/drivers/gpu/drm/zte/zx_vou.c
+++ b/drivers/gpu/drm/zte/zx_vou.c
@@ -627,9 +627,10 @@ void zx_vou_layer_enable(struct drm_plane *plane)
 	zx_writel_mask(vou->osd + OSD_CTRL0, bits->enable, bits->enable);
 }
 
-void zx_vou_layer_disable(struct drm_plane *plane)
+void zx_vou_layer_disable(struct drm_plane *plane,
+			  struct drm_plane_state *old_state)
 {
-	struct zx_crtc *zcrtc = to_zx_crtc(plane->crtc);
+	struct zx_crtc *zcrtc = to_zx_crtc(old_state->crtc);
 	struct zx_vou_hw *vou = zcrtc->vou;
 	struct zx_plane *zplane = to_zx_plane(plane);
 	const struct vou_layer_bits *bits = zplane->bits;
diff --git a/drivers/gpu/drm/zte/zx_vou.h b/drivers/gpu/drm/zte/zx_vou.h
index 97d72bfce982..5b7f84fbb112 100644
--- a/drivers/gpu/drm/zte/zx_vou.h
+++ b/drivers/gpu/drm/zte/zx_vou.h
@@ -62,6 +62,7 @@ void zx_vou_config_dividers(struct drm_crtc *crtc,
 			    struct vou_div_config *configs, int num);
 
 void zx_vou_layer_enable(struct drm_plane *plane);
-void zx_vou_layer_disable(struct drm_plane *plane);
+void zx_vou_layer_disable(struct drm_plane *plane,
+			  struct drm_plane_state *old_state);
 
 #endif /* __ZX_VOU_H__ */
-- 
2.16.1

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

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

* [PATCH v2 20/23] drm/virtio: Stop updating plane->crtc
  2018-03-22 15:23 ` [PATCH 20/23] drm/virtio: Stop updating plane->fb Ville Syrjala
  2018-03-22 16:11   ` Gerd Hoffmann
  2018-03-22 16:11   ` Gerd Hoffmann
@ 2018-03-22 17:40   ` Ville Syrjala
  2018-03-22 17:40   ` Ville Syrjala
  3 siblings, 0 replies; 74+ messages in thread
From: Ville Syrjala @ 2018-03-22 17:40 UTC (permalink / raw)
  To: dri-devel; +Cc: David Airlie, intel-gfx, virtualization

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

We want to get rid of plane->crtc on atomic drivers. Stop setting it.

v2: s/fb/crtc/ in the commit message (Gerd)

Cc: David Airlie <airlied@linux.ie>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: virtualization@lists.linux-foundation.org
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/virtio/virtgpu_display.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c
index 8cc8c34d67f5..42e842ceb53c 100644
--- a/drivers/gpu/drm/virtio/virtgpu_display.c
+++ b/drivers/gpu/drm/virtio/virtgpu_display.c
@@ -302,8 +302,6 @@ static int vgdev_output_init(struct virtio_gpu_device *vgdev, int index)
 	drm_crtc_init_with_planes(dev, crtc, primary, cursor,
 				  &virtio_gpu_crtc_funcs, NULL);
 	drm_crtc_helper_add(crtc, &virtio_gpu_crtc_helper_funcs);
-	primary->crtc = crtc;
-	cursor->crtc = crtc;
 
 	drm_connector_init(dev, connector, &virtio_gpu_connector_funcs,
 			   DRM_MODE_CONNECTOR_VIRTUAL);
-- 
2.16.1

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

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

* [PATCH v2 20/23] drm/virtio: Stop updating plane->crtc
  2018-03-22 15:23 ` [PATCH 20/23] drm/virtio: Stop updating plane->fb Ville Syrjala
                     ` (2 preceding siblings ...)
  2018-03-22 17:40   ` [PATCH v2 20/23] drm/virtio: Stop updating plane->crtc Ville Syrjala
@ 2018-03-22 17:40   ` Ville Syrjala
  3 siblings, 0 replies; 74+ messages in thread
From: Ville Syrjala @ 2018-03-22 17:40 UTC (permalink / raw)
  To: dri-devel; +Cc: David Airlie, intel-gfx, Gerd Hoffmann, virtualization

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

We want to get rid of plane->crtc on atomic drivers. Stop setting it.

v2: s/fb/crtc/ in the commit message (Gerd)

Cc: David Airlie <airlied@linux.ie>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: virtualization@lists.linux-foundation.org
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/virtio/virtgpu_display.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c
index 8cc8c34d67f5..42e842ceb53c 100644
--- a/drivers/gpu/drm/virtio/virtgpu_display.c
+++ b/drivers/gpu/drm/virtio/virtgpu_display.c
@@ -302,8 +302,6 @@ static int vgdev_output_init(struct virtio_gpu_device *vgdev, int index)
 	drm_crtc_init_with_planes(dev, crtc, primary, cursor,
 				  &virtio_gpu_crtc_funcs, NULL);
 	drm_crtc_helper_add(crtc, &virtio_gpu_crtc_helper_funcs);
-	primary->crtc = crtc;
-	cursor->crtc = crtc;
 
 	drm_connector_init(dev, connector, &virtio_gpu_connector_funcs,
 			   DRM_MODE_CONNECTOR_VIRTUAL);
-- 
2.16.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH v2 23/23] drm/i915: Make force_load_detect effective even w/ DMI quirks/hotplug
  2018-03-22 15:23 ` [PATCH 23/23] drm/i915: Make force_load_detect effective even w/ DMI quirks/hotplug Ville Syrjala
  2018-03-22 16:49   ` Maarten Lankhorst
@ 2018-03-22 17:41   ` Ville Syrjala
  1 sibling, 0 replies; 74+ messages in thread
From: Ville Syrjala @ 2018-03-22 17:41 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

When doing forced load detection testing we should totally ignore any
hotplug status for the connector. This is mostly relevant for machines
where we already ignore the hotplug status based on the DMI quirks. On
other machines we would currently skip the force load detection tests
on account of the connector already being connected.

v2: Drop the other force_load_detect check since it's useless now (Maarten)

Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_crt.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index c0a8805b277f..de0e22322c76 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -748,6 +748,11 @@ intel_crt_detect(struct drm_connector *connector,
 		      connector->base.id, connector->name,
 		      force);
 
+	if (i915_modparams.load_detect_test) {
+		intel_display_power_get(dev_priv, intel_encoder->power_domain);
+		goto load_detect;
+	}
+
 	/* Skip machines without VGA that falsely report hotplug events */
 	if (dmi_check_system(intel_spurious_crt_detect))
 		return connector_status_disconnected;
@@ -776,11 +781,12 @@ intel_crt_detect(struct drm_connector *connector,
 	 * broken monitor (without edid) to work behind a broken kvm (that fails
 	 * to have the right resistors for HP detection) needs to fix this up.
 	 * For now just bail out. */
-	if (I915_HAS_HOTPLUG(dev_priv) && !i915_modparams.load_detect_test) {
+	if (I915_HAS_HOTPLUG(dev_priv)) {
 		status = connector_status_disconnected;
 		goto out;
 	}
 
+load_detect:
 	if (!force) {
 		status = connector->status;
 		goto out;
-- 
2.16.1

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

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

* Re: [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers
  2018-03-22 15:22 [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Ville Syrjala
                   ` (25 preceding siblings ...)
  2018-03-22 17:54 ` [PATCH 00/23] " Emil Velikov
@ 2018-03-22 17:54 ` Emil Velikov
       [not found]   ` <CACvgo53B4zLLUqw9y18skpjacmjt-iAYBcG19HkmE=jFwcb4+w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2018-03-22 17:56 ` ✗ Fi.CI.CHECKPATCH: warning for drm: Eliminate plane->fb/crtc usage for atomic drivers (rev4) Patchwork
                   ` (7 subsequent siblings)
  34 siblings, 1 reply; 74+ messages in thread
From: Emil Velikov @ 2018-03-22 17:54 UTC (permalink / raw)
  To: Ville Syrjala
  Cc: Boris Brezillon, Thomas Hellstrom, amd-gfx mailing list,
	David Airlie, Daniel Vetter, intel-gfx, Seung-Woo Kim,
	ML dri-devel, open list:VIRTIO GPU DRIVER, Kyungmin Park,
	VMware Graphics, Gerd Hoffmann, linux-arm-msm, Alex Deucher,
	Shawn Guo, freedreno, Vincent Abriou, Christian König

Hi Ville,

On 22 March 2018 at 15:22, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> I really just wanted to fix i915 to re-enable its planes afer load
> detection (a two line patch). This is what I actually ended up with
> after I ran into a framebuffer refcount leak with said two line patch.
>
> I've tested this on a few i915 boxes and so far it's looking
> good. Everything else is just compile tested.
>
Mostly thinking out loud:

Wondering if one cannot somehow (re)move plane->fb/crtc altogether.
Otherwise drivers will reintroduce similar code, despite the WARNs and
beefy documentation :-\

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

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

* Re: [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers
  2018-03-22 15:22 [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Ville Syrjala
                   ` (24 preceding siblings ...)
  2018-03-22 16:52 ` ✗ Fi.CI.BAT: failure for " Patchwork
@ 2018-03-22 17:54 ` Emil Velikov
  2018-03-22 17:54 ` Emil Velikov
                   ` (8 subsequent siblings)
  34 siblings, 0 replies; 74+ messages in thread
From: Emil Velikov @ 2018-03-22 17:54 UTC (permalink / raw)
  To: Ville Syrjala
  Cc: Boris Brezillon, Thomas Hellstrom, amd-gfx mailing list,
	David Airlie, Daniel Vetter, intel-gfx, Seung-Woo Kim,
	ML dri-devel, open list:VIRTIO GPU DRIVER, Kyungmin Park,
	VMware Graphics, linux-arm-msm, Alex Deucher, Shawn Guo,
	freedreno, Vincent Abriou, Christian König

Hi Ville,

On 22 March 2018 at 15:22, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> I really just wanted to fix i915 to re-enable its planes afer load
> detection (a two line patch). This is what I actually ended up with
> after I ran into a framebuffer refcount leak with said two line patch.
>
> I've tested this on a few i915 boxes and so far it's looking
> good. Everything else is just compile tested.
>
Mostly thinking out loud:

Wondering if one cannot somehow (re)move plane->fb/crtc altogether.
Otherwise drivers will reintroduce similar code, despite the WARNs and
beefy documentation :-\

HTH
Emil
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

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

* ✗ Fi.CI.CHECKPATCH: warning for drm: Eliminate plane->fb/crtc usage for atomic drivers (rev4)
  2018-03-22 15:22 [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Ville Syrjala
                   ` (26 preceding siblings ...)
  2018-03-22 17:54 ` Emil Velikov
@ 2018-03-22 17:56 ` Patchwork
  2018-03-22 18:12 ` ✓ Fi.CI.BAT: success " Patchwork
                   ` (6 subsequent siblings)
  34 siblings, 0 replies; 74+ messages in thread
From: Patchwork @ 2018-03-22 17:56 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx

== Series Details ==

Series: drm: Eliminate plane->fb/crtc usage for atomic drivers (rev4)
URL   : https://patchwork.freedesktop.org/series/40478/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
c15222c5376f Revert "drm/atomic-helper: Fix leak in disable_all"
e1c1c0c2616b drm/atomic-helper: Make drm_atomic_helper_disable_all() update the plane->fb pointers
-:93: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations
#93: FILE: drivers/gpu/drm/drm_atomic_helper.c:2952:
 }
+/**

total: 0 errors, 0 warnings, 1 checks, 98 lines checked
83ae766ecf59 drm: Clear crtc->primary->crtc when disabling the crtc via setcrtc()
7a9501d57103 drm/atomic-helper: WARN if legacy plane fb pointers are bogus when committing duplicated state
591ea3185c8b drm: Add local 'plane' variable for primary/cursor planes
-:121: WARNING:AVOID_BUG: Avoid crashing the kernel - try using WARN_ON & recovery code rather than BUG() or BUG_ON()
#121: FILE: drivers/gpu/drm/drm_plane.c:773:
+	BUG_ON(!plane);

-:122: CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written "plane->crtc"
#122: FILE: drivers/gpu/drm/drm_plane.c:774:
+	WARN_ON(plane->crtc != crtc && plane->crtc != NULL);

-:171: CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written "!plane->fb"
#171: FILE: drivers/gpu/drm/drm_plane.c:1014:
+	if (plane->fb == NULL) {

total: 0 errors, 1 warnings, 2 checks, 186 lines checked
1c416abc1569 drm: Adjust whitespace for legibility
5725ad36f927 drm: Make the fb refcount handover less magic
0c86fdf2fc0a drm: Use plane->state->fb over plane->fb
-:90: CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written "!old_fb"
#90: FILE: drivers/gpu/drm/drm_plane.c:1024:
+	if (old_fb == NULL) {

total: 0 errors, 0 warnings, 1 checks, 79 lines checked
973ef243f6f2 drm/i915: Stop consulting plane->fb
8725c9242cc1 drm/msm: Stop consulting plane->fb
935907ed7ad6 drm/sti: Stop consulting plane->fb
9f0e4d0b9e42 drm/vmwgfx: Stop consulting plane->fb
a3badb58385a drm/zte: Stop consulting plane->fb
588e4c26248d drm/atmel-hlcdc: Stop using plane->fb
1163ef51d4d6 drm: Stop updating plane->crtc/fb/old_fb on atomic drivers
8f452e9c6e6d drm/amdgpu/dc: Stop updating plane->fb
337b7212bf2c drm/i915: Stop updating plane->fb/crtc
e20bc30e5a6b drm/exynos: Stop updating plane->crtc
38ee91954b33 drm/msm: Stop updating plane->fb/crtc
8c80fa662591 drm/virtio: Stop updating plane->crtc
32af98aba537 drm/vc4: Stop updating plane->fb/crtc
b4e5a00d654e drm/i915: Restore planes after load detection
ad0944dbaf79 drm/i915: Make force_load_detect effective even w/ DMI quirks/hotplug

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers
       [not found]   ` <CACvgo53B4zLLUqw9y18skpjacmjt-iAYBcG19HkmE=jFwcb4+w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2018-03-22 18:03     ` Harry Wentland
  2018-03-22 18:34       ` Emil Velikov
       [not found]       ` <a0d3ec32-be68-c96e-607c-0af4a97a3dd6-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 2 replies; 74+ messages in thread
From: Harry Wentland @ 2018-03-22 18:03 UTC (permalink / raw)
  To: Emil Velikov, Ville Syrjala
  Cc: Boris Brezillon, Thomas Hellstrom, David Airlie, Daniel Vetter,
	intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Seung-Woo Kim,
	amd-gfx mailing list, open list:VIRTIO GPU DRIVER,
	Vincent Abriou, Kyungmin Park, VMware Graphics, ML dri-devel,
	linux-arm-msm, Alex Deucher,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Shawn Guo,
	Christian König, Gerd Hoffmann

On 2018-03-22 01:54 PM, Emil Velikov wrote:
> Hi Ville,
> 
> On 22 March 2018 at 15:22, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
>> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>>
>> I really just wanted to fix i915 to re-enable its planes afer load
>> detection (a two line patch). This is what I actually ended up with
>> after I ran into a framebuffer refcount leak with said two line patch.
>>
>> I've tested this on a few i915 boxes and so far it's looking
>> good. Everything else is just compile tested.
>>
> Mostly thinking out loud:
> 
> Wondering if one cannot somehow (re)move plane->fb/crtc altogether.
> Otherwise drivers will reintroduce similar code, despite the WARNs and
> beefy documentation :-\

Wouldn't that require an atomic conversion of all remaining drivers?

Harry

> 
> HTH
> Emil
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* ✓ Fi.CI.BAT: success for drm: Eliminate plane->fb/crtc usage for atomic drivers (rev4)
  2018-03-22 15:22 [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Ville Syrjala
                   ` (27 preceding siblings ...)
  2018-03-22 17:56 ` ✗ Fi.CI.CHECKPATCH: warning for drm: Eliminate plane->fb/crtc usage for atomic drivers (rev4) Patchwork
@ 2018-03-22 18:12 ` Patchwork
  2018-03-22 19:59 ` ✗ Fi.CI.IGT: failure " Patchwork
                   ` (5 subsequent siblings)
  34 siblings, 0 replies; 74+ messages in thread
From: Patchwork @ 2018-03-22 18:12 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx

== Series Details ==

Series: drm: Eliminate plane->fb/crtc usage for atomic drivers (rev4)
URL   : https://patchwork.freedesktop.org/series/40478/
State : success

== Summary ==

Series 40478v4 drm: Eliminate plane->fb/crtc usage for atomic drivers
https://patchwork.freedesktop.org/api/1.0/series/40478/revisions/4/mbox/

---- Known issues:

Test debugfs_test:
        Subgroup read_all_entries:
                incomplete -> PASS       (fi-snb-2520m) fdo#103713
Test kms_pipe_crc_basic:
        Subgroup nonblocking-crc-pipe-b-frame-sequence:
                incomplete -> PASS       (fi-cnl-y3) fdo#103191

fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191

fi-bdw-5557u     total:285  pass:264  dwarn:0   dfail:0   fail:0   skip:21  time:432s
fi-bdw-gvtdvm    total:285  pass:261  dwarn:0   dfail:0   fail:0   skip:24  time:440s
fi-blb-e6850     total:285  pass:220  dwarn:1   dfail:0   fail:0   skip:64  time:382s
fi-bsw-n3050     total:285  pass:239  dwarn:0   dfail:0   fail:0   skip:46  time:539s
fi-bwr-2160      total:285  pass:180  dwarn:0   dfail:0   fail:0   skip:105 time:299s
fi-bxt-dsi       total:285  pass:255  dwarn:0   dfail:0   fail:0   skip:30  time:514s
fi-bxt-j4205     total:285  pass:256  dwarn:0   dfail:0   fail:0   skip:29  time:512s
fi-byt-j1900     total:285  pass:250  dwarn:0   dfail:0   fail:0   skip:35  time:521s
fi-byt-n2820     total:285  pass:246  dwarn:0   dfail:0   fail:0   skip:39  time:505s
fi-cfl-8700k     total:285  pass:257  dwarn:0   dfail:0   fail:0   skip:28  time:410s
fi-cfl-u         total:285  pass:259  dwarn:0   dfail:0   fail:0   skip:26  time:510s
fi-cnl-drrs      total:285  pass:254  dwarn:3   dfail:0   fail:0   skip:28  time:538s
fi-cnl-y3        total:285  pass:259  dwarn:0   dfail:0   fail:0   skip:26  time:587s
fi-elk-e7500     total:285  pass:225  dwarn:1   dfail:0   fail:0   skip:59  time:424s
fi-gdg-551       total:285  pass:176  dwarn:0   dfail:0   fail:1   skip:108 time:319s
fi-glk-1         total:285  pass:257  dwarn:0   dfail:0   fail:0   skip:28  time:542s
fi-hsw-4770      total:285  pass:258  dwarn:0   dfail:0   fail:0   skip:27  time:401s
fi-ilk-650       total:285  pass:225  dwarn:0   dfail:0   fail:0   skip:60  time:418s
fi-ivb-3520m     total:285  pass:256  dwarn:0   dfail:0   fail:0   skip:29  time:474s
fi-ivb-3770      total:285  pass:252  dwarn:0   dfail:0   fail:0   skip:33  time:432s
fi-kbl-7500u     total:285  pass:260  dwarn:1   dfail:0   fail:0   skip:24  time:475s
fi-kbl-7567u     total:285  pass:265  dwarn:0   dfail:0   fail:0   skip:20  time:469s
fi-kbl-r         total:285  pass:258  dwarn:0   dfail:0   fail:0   skip:27  time:520s
fi-pnv-d510      total:285  pass:219  dwarn:1   dfail:0   fail:0   skip:65  time:659s
fi-skl-6260u     total:285  pass:265  dwarn:0   dfail:0   fail:0   skip:20  time:443s
fi-skl-6600u     total:285  pass:258  dwarn:0   dfail:0   fail:0   skip:27  time:539s
fi-skl-6700k2    total:285  pass:261  dwarn:0   dfail:0   fail:0   skip:24  time:502s
fi-skl-6770hq    total:285  pass:265  dwarn:0   dfail:0   fail:0   skip:20  time:489s
fi-skl-guc       total:285  pass:257  dwarn:0   dfail:0   fail:0   skip:28  time:428s
fi-skl-gvtdvm    total:285  pass:262  dwarn:0   dfail:0   fail:0   skip:23  time:443s
fi-snb-2520m     total:285  pass:245  dwarn:0   dfail:0   fail:0   skip:40  time:589s
fi-snb-2600      total:285  pass:245  dwarn:0   dfail:0   fail:0   skip:40  time:414s
fi-cfl-s3 failed to connect after reboot

40fcdd23bec787a5913496f2b11c5d26bdff985a drm-tip: 2018y-03m-22d-15h-28m-32s UTC integration manifest
ad0944dbaf79 drm/i915: Make force_load_detect effective even w/ DMI quirks/hotplug
b4e5a00d654e drm/i915: Restore planes after load detection
32af98aba537 drm/vc4: Stop updating plane->fb/crtc
8c80fa662591 drm/virtio: Stop updating plane->crtc
38ee91954b33 drm/msm: Stop updating plane->fb/crtc
e20bc30e5a6b drm/exynos: Stop updating plane->crtc
337b7212bf2c drm/i915: Stop updating plane->fb/crtc
8f452e9c6e6d drm/amdgpu/dc: Stop updating plane->fb
1163ef51d4d6 drm: Stop updating plane->crtc/fb/old_fb on atomic drivers
588e4c26248d drm/atmel-hlcdc: Stop using plane->fb
a3badb58385a drm/zte: Stop consulting plane->fb
9f0e4d0b9e42 drm/vmwgfx: Stop consulting plane->fb
935907ed7ad6 drm/sti: Stop consulting plane->fb
8725c9242cc1 drm/msm: Stop consulting plane->fb
973ef243f6f2 drm/i915: Stop consulting plane->fb
0c86fdf2fc0a drm: Use plane->state->fb over plane->fb
5725ad36f927 drm: Make the fb refcount handover less magic
1c416abc1569 drm: Adjust whitespace for legibility
591ea3185c8b drm: Add local 'plane' variable for primary/cursor planes
7a9501d57103 drm/atomic-helper: WARN if legacy plane fb pointers are bogus when committing duplicated state
83ae766ecf59 drm: Clear crtc->primary->crtc when disabling the crtc via setcrtc()
e1c1c0c2616b drm/atomic-helper: Make drm_atomic_helper_disable_all() update the plane->fb pointers
c15222c5376f Revert "drm/atomic-helper: Fix leak in disable_all"

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8456/issues.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers
       [not found]       ` <a0d3ec32-be68-c96e-607c-0af4a97a3dd6-5C7GfCeVMHo@public.gmane.org>
@ 2018-03-22 18:34         ` Emil Velikov
  0 siblings, 0 replies; 74+ messages in thread
From: Emil Velikov @ 2018-03-22 18:34 UTC (permalink / raw)
  To: Harry Wentland
  Cc: Boris Brezillon, Thomas Hellstrom, David Airlie, Daniel Vetter,
	intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Seung-Woo Kim,
	amd-gfx mailing list, open list:VIRTIO GPU DRIVER,
	Vincent Abriou, Kyungmin Park, VMware Graphics, ML dri-devel,
	linux-arm-msm, Alex Deucher,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Shawn Guo,
	Christian König, Ville Syrjala, Gerd Hoffmann

On 22 March 2018 at 18:03, Harry Wentland <harry.wentland@amd.com> wrote:
> On 2018-03-22 01:54 PM, Emil Velikov wrote:
>> Hi Ville,
>>
>> On 22 March 2018 at 15:22, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
>>> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>>>
>>> I really just wanted to fix i915 to re-enable its planes afer load
>>> detection (a two line patch). This is what I actually ended up with
>>> after I ran into a framebuffer refcount leak with said two line patch.
>>>
>>> I've tested this on a few i915 boxes and so far it's looking
>>> good. Everything else is just compile tested.
>>>
>> Mostly thinking out loud:
>>
>> Wondering if one cannot somehow (re)move plane->fb/crtc altogether.
>> Otherwise drivers will reintroduce similar code, despite the WARNs and
>> beefy documentation :-\
>
> Wouldn't that require an atomic conversion of all remaining drivers?
>
That or maybe move into plane->legacy->{fb,crtc}. Feel free to swap
'legacy' with flashier name.

Hmm back in 2015 we had a GSoC that updated BOCHS and CIRRUS drivers,
but they never got merged.
Don't recall the details - from memory the conversion seemed fine, but
there was either shortage on review/other.

Might be worth reviving that... regardless it's getting a bit off-topic.
-Emil

[1] https://www.google-melange.com/archive/gsoc/2015/orgs/xorg/projects/johnhunter.html
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* Re: [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers
  2018-03-22 18:03     ` Harry Wentland
@ 2018-03-22 18:34       ` Emil Velikov
       [not found]       ` <a0d3ec32-be68-c96e-607c-0af4a97a3dd6-5C7GfCeVMHo@public.gmane.org>
  1 sibling, 0 replies; 74+ messages in thread
From: Emil Velikov @ 2018-03-22 18:34 UTC (permalink / raw)
  To: Harry Wentland
  Cc: Boris Brezillon, Thomas Hellstrom, David Airlie, Daniel Vetter,
	intel-gfx, Seung-Woo Kim, amd-gfx mailing list,
	open list:VIRTIO GPU DRIVER, Vincent Abriou, Kyungmin Park,
	VMware Graphics, ML dri-devel, linux-arm-msm, Alex Deucher,
	freedreno, Shawn Guo, Christian König, Ville Syrjala

On 22 March 2018 at 18:03, Harry Wentland <harry.wentland@amd.com> wrote:
> On 2018-03-22 01:54 PM, Emil Velikov wrote:
>> Hi Ville,
>>
>> On 22 March 2018 at 15:22, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
>>> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>>>
>>> I really just wanted to fix i915 to re-enable its planes afer load
>>> detection (a two line patch). This is what I actually ended up with
>>> after I ran into a framebuffer refcount leak with said two line patch.
>>>
>>> I've tested this on a few i915 boxes and so far it's looking
>>> good. Everything else is just compile tested.
>>>
>> Mostly thinking out loud:
>>
>> Wondering if one cannot somehow (re)move plane->fb/crtc altogether.
>> Otherwise drivers will reintroduce similar code, despite the WARNs and
>> beefy documentation :-\
>
> Wouldn't that require an atomic conversion of all remaining drivers?
>
That or maybe move into plane->legacy->{fb,crtc}. Feel free to swap
'legacy' with flashier name.

Hmm back in 2015 we had a GSoC that updated BOCHS and CIRRUS drivers,
but they never got merged.
Don't recall the details - from memory the conversion seemed fine, but
there was either shortage on review/other.

Might be worth reviving that... regardless it's getting a bit off-topic.
-Emil

[1] https://www.google-melange.com/archive/gsoc/2015/orgs/xorg/projects/johnhunter.html
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

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

* Re: [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers
       [not found]   ` <b92fe986-295c-fecb-dca1-82cb9bf7b7b1-L59+Z2yzLopAfugRpC6u6w@public.gmane.org>
@ 2018-03-22 18:49     ` Ville Syrjälä
  2018-03-22 23:28       ` Noralf Trønnes
  0 siblings, 1 reply; 74+ messages in thread
From: Ville Syrjälä @ 2018-03-22 18:49 UTC (permalink / raw)
  To: Noralf Trønnes
  Cc: Boris Brezillon, Thomas Hellstrom,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, David Airlie,
	Daniel Vetter, intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	Seung-Woo Kim, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	Kyungmin Park, VMware Graphics, Gerd Hoffmann,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, Alex Deucher, Shawn Guo,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Vincent Abriou,
	Christian König

On Thu, Mar 22, 2018 at 05:51:35PM +0100, Noralf Trønnes wrote:
> tinydrm is also using plane->fb:
> 
> $ grep -r "plane\.fb" drivers/gpu/drm/tinydrm/
> drivers/gpu/drm/tinydrm/repaper.c:      if (tdev->pipe.plane.fb != fb)
> drivers/gpu/drm/tinydrm/mipi-dbi.c:     if (tdev->pipe.plane.fb != fb)
> drivers/gpu/drm/tinydrm/mipi-dbi.c:     struct drm_framebuffer *fb = 
> mipi->tinydrm.pipe.plane.fb;

Oh dear, and naturally it's the most annoying one of the bunch. So we
want to take the plane lock in the fb.dirty() hook to look at the fb,
but mipi-dbi.c calls that directly from the bowels of its
.atomic_enable() hook. So that would deadlock pretty neatly if the
commit happens while already holding the lock.

So we'd either need to plumb an acquire context into fb.dirty(),
or maybe have tinydrm provide a lower level lockless dirty() hook
that gets called by both (there are just too many layers in this
particular cake to immediately see where such a hook would be best
placed). Or maybe there's some other solution I didn't think of.

Looking at this I'm also left wondering how this is supposed
handle fb.dirty() getting called concurrently with a modeset.
The dirty_mutex only seems to offer any protection for
fb.dirty() against another fb.dirty()...

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* Re: [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers
  2018-03-22 16:51 ` [PATCH 00/23] " Noralf Trønnes
       [not found]   ` <b92fe986-295c-fecb-dca1-82cb9bf7b7b1-L59+Z2yzLopAfugRpC6u6w@public.gmane.org>
@ 2018-03-22 18:49   ` Ville Syrjälä
  1 sibling, 0 replies; 74+ messages in thread
From: Ville Syrjälä @ 2018-03-22 18:49 UTC (permalink / raw)
  To: Noralf Trønnes
  Cc: Boris Brezillon, Thomas Hellstrom, amd-gfx, David Airlie,
	Daniel Vetter, intel-gfx, Seung-Woo Kim, dri-devel,
	virtualization, Kyungmin Park, VMware Graphics, linux-arm-msm,
	Alex Deucher, Shawn Guo, freedreno, Vincent Abriou,
	Christian König

On Thu, Mar 22, 2018 at 05:51:35PM +0100, Noralf Trønnes wrote:
> tinydrm is also using plane->fb:
> 
> $ grep -r "plane\.fb" drivers/gpu/drm/tinydrm/
> drivers/gpu/drm/tinydrm/repaper.c:      if (tdev->pipe.plane.fb != fb)
> drivers/gpu/drm/tinydrm/mipi-dbi.c:     if (tdev->pipe.plane.fb != fb)
> drivers/gpu/drm/tinydrm/mipi-dbi.c:     struct drm_framebuffer *fb = 
> mipi->tinydrm.pipe.plane.fb;

Oh dear, and naturally it's the most annoying one of the bunch. So we
want to take the plane lock in the fb.dirty() hook to look at the fb,
but mipi-dbi.c calls that directly from the bowels of its
.atomic_enable() hook. So that would deadlock pretty neatly if the
commit happens while already holding the lock.

So we'd either need to plumb an acquire context into fb.dirty(),
or maybe have tinydrm provide a lower level lockless dirty() hook
that gets called by both (there are just too many layers in this
particular cake to immediately see where such a hook would be best
placed). Or maybe there's some other solution I didn't think of.

Looking at this I'm also left wondering how this is supposed
handle fb.dirty() getting called concurrently with a modeset.
The dirty_mutex only seems to offer any protection for
fb.dirty() against another fb.dirty()...

-- 
Ville Syrjälä
Intel OTC

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

* ✗ Fi.CI.IGT: failure for drm: Eliminate plane->fb/crtc usage for atomic drivers (rev4)
  2018-03-22 15:22 [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Ville Syrjala
                   ` (28 preceding siblings ...)
  2018-03-22 18:12 ` ✓ Fi.CI.BAT: success " Patchwork
@ 2018-03-22 19:59 ` Patchwork
  2018-03-26 12:28 ` ✗ Fi.CI.CHECKPATCH: warning for drm: Eliminate plane->fb/crtc usage for atomic drivers (rev5) Patchwork
                   ` (4 subsequent siblings)
  34 siblings, 0 replies; 74+ messages in thread
From: Patchwork @ 2018-03-22 19:59 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx

== Series Details ==

Series: drm: Eliminate plane->fb/crtc usage for atomic drivers (rev4)
URL   : https://patchwork.freedesktop.org/series/40478/
State : failure

== Summary ==

---- Possible new issues:

Test kms_cursor_legacy:
        Subgroup flip-vs-cursor-legacy:
                pass       -> FAIL       (shard-hsw)

---- Known issues:

Test kms_flip:
        Subgroup dpms-vs-vblank-race:
                fail       -> PASS       (shard-hsw) fdo#103060 +1
        Subgroup plain-flip-fb-recreate:
                pass       -> FAIL       (shard-hsw) fdo#100368 +1

fdo#103060 https://bugs.freedesktop.org/show_bug.cgi?id=103060
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368

shard-apl        total:3484 pass:1820 dwarn:1   dfail:0   fail:7   skip:1655 time:13121s
shard-hsw        total:3484 pass:1771 dwarn:1   dfail:0   fail:4   skip:1707 time:11775s
shard-snb        total:3484 pass:1363 dwarn:1   dfail:0   fail:3   skip:2117 time:7300s
Blacklisted hosts:
shard-kbl        total:3484 pass:1944 dwarn:1   dfail:0   fail:10  skip:1529 time:9956s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8456/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers
  2018-03-22 18:49     ` Ville Syrjälä
@ 2018-03-22 23:28       ` Noralf Trønnes
  0 siblings, 0 replies; 74+ messages in thread
From: Noralf Trønnes @ 2018-03-22 23:28 UTC (permalink / raw)
  To: Ville Syrjälä
  Cc: Boris Brezillon, Thomas Hellstrom, amd-gfx, David Airlie,
	Daniel Vetter, intel-gfx, Seung-Woo Kim, dri-devel,
	virtualization, Kyungmin Park, VMware Graphics, linux-arm-msm,
	Alex Deucher, Shawn Guo, freedreno, Vincent Abriou,
	Christian König


Den 22.03.2018 19.49, skrev Ville Syrjälä:
> On Thu, Mar 22, 2018 at 05:51:35PM +0100, Noralf Trønnes wrote:
>> tinydrm is also using plane->fb:
>>
>> $ grep -r "plane\.fb" drivers/gpu/drm/tinydrm/
>> drivers/gpu/drm/tinydrm/repaper.c:      if (tdev->pipe.plane.fb != fb)
>> drivers/gpu/drm/tinydrm/mipi-dbi.c:     if (tdev->pipe.plane.fb != fb)
>> drivers/gpu/drm/tinydrm/mipi-dbi.c:     struct drm_framebuffer *fb =
>> mipi->tinydrm.pipe.plane.fb;
> Oh dear, and naturally it's the most annoying one of the bunch. So we
> want to take the plane lock in the fb.dirty() hook to look at the fb,
> but mipi-dbi.c calls that directly from the bowels of its
> .atomic_enable() hook. So that would deadlock pretty neatly if the
> commit happens while already holding the lock.
>
> So we'd either need to plumb an acquire context into fb.dirty(),
> or maybe have tinydrm provide a lower level lockless dirty() hook
> that gets called by both (there are just too many layers in this
> particular cake to immediately see where such a hook would be best
> placed). Or maybe there's some other solution I didn't think of.
>
> Looking at this I'm also left wondering how this is supposed
> handle fb.dirty() getting called concurrently with a modeset.
> The dirty_mutex only seems to offer any protection for
> fb.dirty() against another fb.dirty()...
>

I have been waiting for the 'page-flip with damage'[1] work to come to
fruition so I could handle all flushing during atomic commit.
The idea is to use the same damage rect for a generic dirtyfb callback.

Maybe a temporary tinydrm specific solution is possible until that work
lands, but I don't know enough about how to implement such a dirtyfb
callback.

I imagine it could look something like this:

  struct tinydrm_device {
+    struct drm_clip_rect dirtyfb_rect;
  };

static int tinydrm_fb_dirty(struct drm_framebuffer *fb,
                 struct drm_file *file_priv,
                 unsigned int flags, unsigned int color,
                 struct drm_clip_rect *clips,
                 unsigned int num_clips)
{
     struct tinydrm_device *tdev = fb->dev->dev_private;
     struct drm_framebuffer *planefb;

     /* Grab whatever lock needed to check this */
     planefb = tdev->pipe.plane.state->fb;

     /* fbdev can flush even when we're not interested */
     if (fb != planefb)
         return 0;

     /* Protect dirtyfb_rect with a lock */
     tinydrm_merge_clips(&tdev->dirty_rectfb, clips, num_clips, flags,
                 fb->width, fb->height);

     /*
      * Somehow do an atomic commit that results in the atomic update
      * callback being called
      */
     ret = drm_atomic_commit(state);
...
}

static void mipi_dbi_flush(struct drm_framebuffer *fb,
                struct drm_clip_rect *clip)
{
     /* Flush out framebuffer */
}

void mipi_dbi_pipe_update(struct drm_simple_display_pipe *pipe,
               struct drm_plane_state *old_state)
{
     struct tinydrm_device *tdev = pipe_to_tinydrm(pipe);
     struct mipi_dbi *mipi = mipi_dbi_from_tinydrm(tdev);
     struct drm_framebuffer *fb = pipe->plane.state->fb;
     struct drm_crtc *crtc = &tdev->pipe.crtc;

     if (!fb || (fb == old_state->fb && !tdev->dirty_rect.x2))
         goto out_vblank;

     /* Don't flush if the controller isn't initialized yet */
     if (!mipi->enabled)
         goto out_vblank;

     if (fb != old_state->fb) { /* Page flip or new, flush all */
         mipi_dbi_flush(fb, NULL);
     } else { /* dirtyfb ioctl */
         mipi_dbi_flush(fb, &tdev->dirtyfb_rect);
         memset(&tdev->dirtyfb_rect, 0, sizeof(tdev->dirtyfb_rect));
     }

out_vblank:
     if (crtc->state->event) {
         spin_lock_irq(&crtc->dev->event_lock);
         drm_crtc_send_vblank_event(crtc, crtc->state->event);
         spin_unlock_irq(&crtc->dev->event_lock);
         crtc->state->event = NULL;
     }
}

This is called from the driver pipe enable callback after the controller
has been initialized:

  void mipi_dbi_pipe_enable(struct drm_simple_display_pipe *pipe,
                struct drm_crtc_state *crtc_state)
  {
      struct tinydrm_device *tdev = pipe_to_tinydrm(pipe);
      struct mipi_dbi *mipi = mipi_dbi_from_tinydrm(tdev);
-     struct drm_framebuffer *fb = pipe->plane.fb;
+    struct drm_framebuffer *fb = pipe->plane.state->fb;

      DRM_DEBUG_KMS("\n");

      mipi->enabled = true;
-     if (fb)
-         fb->funcs->dirty(fb, NULL, 0, 0, NULL, 0);
+    mipi_dbi_flush(fb, NULL);
      tinydrm_enable_backlight(mipi->backlight);
  }

I can make patches if this makes any sense and you can help me with the
dirtyfb implementation.

Noralf.

[1] 
https://lists.freedesktop.org/archives/dri-devel/2017-December/161003.html

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

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

* Re: [PATCH 16/23] drm/amdgpu/dc: Stop updating plane->fb
  2018-03-22 15:23 ` [PATCH 16/23] drm/amdgpu/dc: Stop updating plane->fb Ville Syrjala
@ 2018-03-23 20:23   ` Harry Wentland
  0 siblings, 0 replies; 74+ messages in thread
From: Harry Wentland @ 2018-03-23 20:23 UTC (permalink / raw)
  To: Ville Syrjala, dri-devel
  Cc: Alex Deucher, intel-gfx, Christian König, amd-gfx

On 2018-03-22 11:23 AM, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> We want to get rid of plane->fb on atomic drivers. Stop setting it.
> 
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: "David (ChunMing) Zhou" <David1.Zhou@amd.com>
> Cc: Harry Wentland <harry.wentland@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Harry Wentland <harry.wentland@amd.com>

Patches 1-8 & 15 also look reasonable to me, but I'm not an expert on this. Feel free to add my
Acked-by: Harry Wentland <harry.wentland@amd.com>

Harry

> ---
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index ae512ecb65ee..a8129eca6e6d 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -3941,8 +3941,6 @@ static void amdgpu_dm_do_flip(struct drm_crtc *crtc,
>  
>  	/* Flip */
>  	spin_lock_irqsave(&crtc->dev->event_lock, flags);
> -	/* update crtc fb */
> -	crtc->primary->fb = fb;
>  
>  	WARN_ON(acrtc->pflip_status != AMDGPU_FLIP_NONE);
>  	WARN_ON(!acrtc_state->stream);
> 
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v2 13/23] drm/zte: Stop consulting plane->fb
  2018-03-22 17:40   ` [PATCH v2 " Ville Syrjala
@ 2018-03-26  7:25     ` Shawn Guo
  0 siblings, 0 replies; 74+ messages in thread
From: Shawn Guo @ 2018-03-26  7:25 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: intel-gfx, dri-devel

On Thu, Mar 22, 2018 at 07:40:03PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> We want to get rid of plane->fb on atomic drivers. Stop looking at it.

Would it be more precise to use "plane->crtc" in both subject and commit
log?  Other than that:

Acked-by: Shawn Guo <shawnguo@kernel.org>

> 
> v2: Use old_state->crtc (Maarten)
> 
> Cc: Shawn Guo <shawnguo@kernel.org>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/zte/zx_plane.c | 2 +-
>  drivers/gpu/drm/zte/zx_vou.c   | 5 +++--
>  drivers/gpu/drm/zte/zx_vou.h   | 3 ++-
>  3 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/zte/zx_plane.c b/drivers/gpu/drm/zte/zx_plane.c
> index 94545adac50d..d1931f5ea0b2 100644
> --- a/drivers/gpu/drm/zte/zx_plane.c
> +++ b/drivers/gpu/drm/zte/zx_plane.c
> @@ -268,7 +268,7 @@ static void zx_plane_atomic_disable(struct drm_plane *plane,
>  	struct zx_plane *zplane = to_zx_plane(plane);
>  	void __iomem *hbsc = zplane->hbsc;
>  
> -	zx_vou_layer_disable(plane);
> +	zx_vou_layer_disable(plane, old_state);
>  
>  	/* Disable HBSC block */
>  	zx_writel_mask(hbsc + HBSC_CTRL0, HBSC_CTRL_EN, 0);
> diff --git a/drivers/gpu/drm/zte/zx_vou.c b/drivers/gpu/drm/zte/zx_vou.c
> index 7491813131f3..442311d31110 100644
> --- a/drivers/gpu/drm/zte/zx_vou.c
> +++ b/drivers/gpu/drm/zte/zx_vou.c
> @@ -627,9 +627,10 @@ void zx_vou_layer_enable(struct drm_plane *plane)
>  	zx_writel_mask(vou->osd + OSD_CTRL0, bits->enable, bits->enable);
>  }
>  
> -void zx_vou_layer_disable(struct drm_plane *plane)
> +void zx_vou_layer_disable(struct drm_plane *plane,
> +			  struct drm_plane_state *old_state)
>  {
> -	struct zx_crtc *zcrtc = to_zx_crtc(plane->crtc);
> +	struct zx_crtc *zcrtc = to_zx_crtc(old_state->crtc);
>  	struct zx_vou_hw *vou = zcrtc->vou;
>  	struct zx_plane *zplane = to_zx_plane(plane);
>  	const struct vou_layer_bits *bits = zplane->bits;
> diff --git a/drivers/gpu/drm/zte/zx_vou.h b/drivers/gpu/drm/zte/zx_vou.h
> index 97d72bfce982..5b7f84fbb112 100644
> --- a/drivers/gpu/drm/zte/zx_vou.h
> +++ b/drivers/gpu/drm/zte/zx_vou.h
> @@ -62,6 +62,7 @@ void zx_vou_config_dividers(struct drm_crtc *crtc,
>  			    struct vou_div_config *configs, int num);
>  
>  void zx_vou_layer_enable(struct drm_plane *plane);
> -void zx_vou_layer_disable(struct drm_plane *plane);
> +void zx_vou_layer_disable(struct drm_plane *plane,
> +			  struct drm_plane_state *old_state);
>  
>  #endif /* __ZX_VOU_H__ */
> -- 
> 2.16.1
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH v3 13/23] drm/zte: Stop consulting plane->crtc
  2018-03-22 15:23 ` [PATCH 13/23] drm/zte: " Ville Syrjala
  2018-03-22 16:12   ` Maarten Lankhorst
  2018-03-22 17:40   ` [PATCH v2 " Ville Syrjala
@ 2018-03-26 12:14   ` Ville Syrjala
  2 siblings, 0 replies; 74+ messages in thread
From: Ville Syrjala @ 2018-03-26 12:14 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx, Shawn Guo

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

We want to get rid of plane->crtc on atomic drivers. Stop looking at it.

v2: Use old_state->crtc (Maarten)
v3: s/fb/crtc/ in commit message to actually match the patch (Shawn)

Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Shawn Guo <shawnguo@kernel.org>
---
 drivers/gpu/drm/zte/zx_plane.c | 2 +-
 drivers/gpu/drm/zte/zx_vou.c   | 5 +++--
 drivers/gpu/drm/zte/zx_vou.h   | 3 ++-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/zte/zx_plane.c b/drivers/gpu/drm/zte/zx_plane.c
index 94545adac50d..d1931f5ea0b2 100644
--- a/drivers/gpu/drm/zte/zx_plane.c
+++ b/drivers/gpu/drm/zte/zx_plane.c
@@ -268,7 +268,7 @@ static void zx_plane_atomic_disable(struct drm_plane *plane,
 	struct zx_plane *zplane = to_zx_plane(plane);
 	void __iomem *hbsc = zplane->hbsc;
 
-	zx_vou_layer_disable(plane);
+	zx_vou_layer_disable(plane, old_state);
 
 	/* Disable HBSC block */
 	zx_writel_mask(hbsc + HBSC_CTRL0, HBSC_CTRL_EN, 0);
diff --git a/drivers/gpu/drm/zte/zx_vou.c b/drivers/gpu/drm/zte/zx_vou.c
index 7491813131f3..442311d31110 100644
--- a/drivers/gpu/drm/zte/zx_vou.c
+++ b/drivers/gpu/drm/zte/zx_vou.c
@@ -627,9 +627,10 @@ void zx_vou_layer_enable(struct drm_plane *plane)
 	zx_writel_mask(vou->osd + OSD_CTRL0, bits->enable, bits->enable);
 }
 
-void zx_vou_layer_disable(struct drm_plane *plane)
+void zx_vou_layer_disable(struct drm_plane *plane,
+			  struct drm_plane_state *old_state)
 {
-	struct zx_crtc *zcrtc = to_zx_crtc(plane->crtc);
+	struct zx_crtc *zcrtc = to_zx_crtc(old_state->crtc);
 	struct zx_vou_hw *vou = zcrtc->vou;
 	struct zx_plane *zplane = to_zx_plane(plane);
 	const struct vou_layer_bits *bits = zplane->bits;
diff --git a/drivers/gpu/drm/zte/zx_vou.h b/drivers/gpu/drm/zte/zx_vou.h
index 97d72bfce982..5b7f84fbb112 100644
--- a/drivers/gpu/drm/zte/zx_vou.h
+++ b/drivers/gpu/drm/zte/zx_vou.h
@@ -62,6 +62,7 @@ void zx_vou_config_dividers(struct drm_crtc *crtc,
 			    struct vou_div_config *configs, int num);
 
 void zx_vou_layer_enable(struct drm_plane *plane);
-void zx_vou_layer_disable(struct drm_plane *plane);
+void zx_vou_layer_disable(struct drm_plane *plane,
+			  struct drm_plane_state *old_state);
 
 #endif /* __ZX_VOU_H__ */
-- 
2.16.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* ✗ Fi.CI.CHECKPATCH: warning for drm: Eliminate plane->fb/crtc usage for atomic drivers (rev5)
  2018-03-22 15:22 [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Ville Syrjala
                   ` (29 preceding siblings ...)
  2018-03-22 19:59 ` ✗ Fi.CI.IGT: failure " Patchwork
@ 2018-03-26 12:28 ` Patchwork
  2018-03-26 12:43 ` ✓ Fi.CI.BAT: success " Patchwork
                   ` (3 subsequent siblings)
  34 siblings, 0 replies; 74+ messages in thread
From: Patchwork @ 2018-03-26 12:28 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: intel-gfx

== Series Details ==

Series: drm: Eliminate plane->fb/crtc usage for atomic drivers (rev5)
URL   : https://patchwork.freedesktop.org/series/40478/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
eec2e4920fa9 Revert "drm/atomic-helper: Fix leak in disable_all"
885b9185b11c drm/atomic-helper: Make drm_atomic_helper_disable_all() update the plane->fb pointers
-:93: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations
#93: FILE: drivers/gpu/drm/drm_atomic_helper.c:2952:
 }
+/**

total: 0 errors, 0 warnings, 1 checks, 98 lines checked
565952128dd5 drm: Clear crtc->primary->crtc when disabling the crtc via setcrtc()
9847962e92bf drm/atomic-helper: WARN if legacy plane fb pointers are bogus when committing duplicated state
c82dc4275c43 drm: Add local 'plane' variable for primary/cursor planes
-:121: WARNING:AVOID_BUG: Avoid crashing the kernel - try using WARN_ON & recovery code rather than BUG() or BUG_ON()
#121: FILE: drivers/gpu/drm/drm_plane.c:773:
+	BUG_ON(!plane);

-:122: CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written "plane->crtc"
#122: FILE: drivers/gpu/drm/drm_plane.c:774:
+	WARN_ON(plane->crtc != crtc && plane->crtc != NULL);

-:171: CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written "!plane->fb"
#171: FILE: drivers/gpu/drm/drm_plane.c:1014:
+	if (plane->fb == NULL) {

total: 0 errors, 1 warnings, 2 checks, 186 lines checked
755974d48345 drm: Adjust whitespace for legibility
f3e2f2d38a43 drm: Make the fb refcount handover less magic
9fd23bc1fc50 drm: Use plane->state->fb over plane->fb
-:90: CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written "!old_fb"
#90: FILE: drivers/gpu/drm/drm_plane.c:1024:
+	if (old_fb == NULL) {

total: 0 errors, 0 warnings, 1 checks, 79 lines checked
7fe441e1f443 drm/i915: Stop consulting plane->fb
c63ecc6320ad drm/msm: Stop consulting plane->fb
9aee2233a34a drm/sti: Stop consulting plane->fb
260aa997ef90 drm/vmwgfx: Stop consulting plane->fb
213b45d96872 drm/zte: Stop consulting plane->crtc
ab4d18f860a9 drm/atmel-hlcdc: Stop using plane->fb
9295b76b993d drm: Stop updating plane->crtc/fb/old_fb on atomic drivers
98c28044ce49 drm/amdgpu/dc: Stop updating plane->fb
9eb46f68d697 drm/i915: Stop updating plane->fb/crtc
dd5198a96fab drm/exynos: Stop updating plane->crtc
5c81f06359a0 drm/msm: Stop updating plane->fb/crtc
7ea33fb4ffda drm/virtio: Stop updating plane->crtc
af0596d92fc4 drm/vc4: Stop updating plane->fb/crtc
d8e5f287c232 drm/i915: Restore planes after load detection
5b47761e238f drm/i915: Make force_load_detect effective even w/ DMI quirks/hotplug

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* ✓ Fi.CI.BAT: success for drm: Eliminate plane->fb/crtc usage for atomic drivers (rev5)
  2018-03-22 15:22 [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Ville Syrjala
                   ` (30 preceding siblings ...)
  2018-03-26 12:28 ` ✗ Fi.CI.CHECKPATCH: warning for drm: Eliminate plane->fb/crtc usage for atomic drivers (rev5) Patchwork
@ 2018-03-26 12:43 ` Patchwork
  2018-03-26 15:36 ` ✓ Fi.CI.IGT: " Patchwork
                   ` (2 subsequent siblings)
  34 siblings, 0 replies; 74+ messages in thread
From: Patchwork @ 2018-03-26 12:43 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: intel-gfx

== Series Details ==

Series: drm: Eliminate plane->fb/crtc usage for atomic drivers (rev5)
URL   : https://patchwork.freedesktop.org/series/40478/
State : success

== Summary ==

Series 40478v5 drm: Eliminate plane->fb/crtc usage for atomic drivers
https://patchwork.freedesktop.org/api/1.0/series/40478/revisions/5/mbox/

---- Known issues:

Test gem_mmap_gtt:
        Subgroup basic-small-bo-tiledx:
                pass       -> FAIL       (fi-gdg-551) fdo#102575
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-c:
                incomplete -> PASS       (fi-bxt-dsi) fdo#103927
                incomplete -> PASS       (fi-hsw-4770) fdo#104944

fdo#102575 https://bugs.freedesktop.org/show_bug.cgi?id=102575
fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927
fdo#104944 https://bugs.freedesktop.org/show_bug.cgi?id=104944

fi-bdw-5557u     total:285  pass:264  dwarn:0   dfail:0   fail:0   skip:21  time:433s
fi-bdw-gvtdvm    total:285  pass:261  dwarn:0   dfail:0   fail:0   skip:24  time:449s
fi-blb-e6850     total:285  pass:220  dwarn:1   dfail:0   fail:0   skip:64  time:380s
fi-bsw-n3050     total:285  pass:239  dwarn:0   dfail:0   fail:0   skip:46  time:537s
fi-bwr-2160      total:285  pass:180  dwarn:0   dfail:0   fail:0   skip:105 time:298s
fi-bxt-dsi       total:285  pass:255  dwarn:0   dfail:0   fail:0   skip:30  time:511s
fi-bxt-j4205     total:285  pass:256  dwarn:0   dfail:0   fail:0   skip:29  time:514s
fi-byt-j1900     total:285  pass:250  dwarn:0   dfail:0   fail:0   skip:35  time:519s
fi-byt-n2820     total:285  pass:246  dwarn:0   dfail:0   fail:0   skip:39  time:507s
fi-cfl-8700k     total:285  pass:257  dwarn:0   dfail:0   fail:0   skip:28  time:409s
fi-cfl-u         total:285  pass:259  dwarn:0   dfail:0   fail:0   skip:26  time:512s
fi-elk-e7500     total:285  pass:225  dwarn:1   dfail:0   fail:0   skip:59  time:428s
fi-gdg-551       total:285  pass:176  dwarn:0   dfail:0   fail:1   skip:108 time:317s
fi-glk-1         total:285  pass:257  dwarn:0   dfail:0   fail:0   skip:28  time:535s
fi-hsw-4770      total:285  pass:258  dwarn:0   dfail:0   fail:0   skip:27  time:408s
fi-ilk-650       total:285  pass:225  dwarn:0   dfail:0   fail:0   skip:60  time:425s
fi-ivb-3520m     total:285  pass:256  dwarn:0   dfail:0   fail:0   skip:29  time:472s
fi-ivb-3770      total:285  pass:252  dwarn:0   dfail:0   fail:0   skip:33  time:428s
fi-kbl-7500u     total:285  pass:260  dwarn:1   dfail:0   fail:0   skip:24  time:478s
fi-kbl-7567u     total:285  pass:265  dwarn:0   dfail:0   fail:0   skip:20  time:468s
fi-kbl-r         total:285  pass:258  dwarn:0   dfail:0   fail:0   skip:27  time:516s
fi-pnv-d510      total:285  pass:219  dwarn:1   dfail:0   fail:0   skip:65  time:651s
fi-skl-6260u     total:285  pass:265  dwarn:0   dfail:0   fail:0   skip:20  time:438s
fi-skl-6600u     total:285  pass:258  dwarn:0   dfail:0   fail:0   skip:27  time:532s
fi-skl-6700k2    total:285  pass:261  dwarn:0   dfail:0   fail:0   skip:24  time:506s
fi-skl-6770hq    total:285  pass:265  dwarn:0   dfail:0   fail:0   skip:20  time:508s
fi-skl-guc       total:285  pass:257  dwarn:0   dfail:0   fail:0   skip:28  time:428s
fi-skl-gvtdvm    total:285  pass:262  dwarn:0   dfail:0   fail:0   skip:23  time:444s
fi-snb-2520m     total:285  pass:245  dwarn:0   dfail:0   fail:0   skip:40  time:584s
fi-snb-2600      total:285  pass:245  dwarn:0   dfail:0   fail:0   skip:40  time:399s
Blacklisted hosts:
fi-cfl-s3        total:285  pass:259  dwarn:0   dfail:0   fail:0   skip:26  time:566s
fi-cnl-psr       total:224  pass:198  dwarn:0   dfail:0   fail:1   skip:24 
fi-glk-j4005     total:285  pass:256  dwarn:0   dfail:0   fail:0   skip:29  time:484s

94f5d9189e61055e246c31106b3810dc17ddee9c drm-tip: 2018y-03m-23d-23h-41m-40s UTC integration manifest
5b47761e238f drm/i915: Make force_load_detect effective even w/ DMI quirks/hotplug
d8e5f287c232 drm/i915: Restore planes after load detection
af0596d92fc4 drm/vc4: Stop updating plane->fb/crtc
7ea33fb4ffda drm/virtio: Stop updating plane->crtc
5c81f06359a0 drm/msm: Stop updating plane->fb/crtc
dd5198a96fab drm/exynos: Stop updating plane->crtc
9eb46f68d697 drm/i915: Stop updating plane->fb/crtc
98c28044ce49 drm/amdgpu/dc: Stop updating plane->fb
9295b76b993d drm: Stop updating plane->crtc/fb/old_fb on atomic drivers
ab4d18f860a9 drm/atmel-hlcdc: Stop using plane->fb
213b45d96872 drm/zte: Stop consulting plane->crtc
260aa997ef90 drm/vmwgfx: Stop consulting plane->fb
9aee2233a34a drm/sti: Stop consulting plane->fb
c63ecc6320ad drm/msm: Stop consulting plane->fb
7fe441e1f443 drm/i915: Stop consulting plane->fb
9fd23bc1fc50 drm: Use plane->state->fb over plane->fb
f3e2f2d38a43 drm: Make the fb refcount handover less magic
755974d48345 drm: Adjust whitespace for legibility
c82dc4275c43 drm: Add local 'plane' variable for primary/cursor planes
9847962e92bf drm/atomic-helper: WARN if legacy plane fb pointers are bogus when committing duplicated state
565952128dd5 drm: Clear crtc->primary->crtc when disabling the crtc via setcrtc()
885b9185b11c drm/atomic-helper: Make drm_atomic_helper_disable_all() update the plane->fb pointers
eec2e4920fa9 Revert "drm/atomic-helper: Fix leak in disable_all"

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8490/issues.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* ✓ Fi.CI.IGT: success for drm: Eliminate plane->fb/crtc usage for atomic drivers (rev5)
  2018-03-22 15:22 [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Ville Syrjala
                   ` (31 preceding siblings ...)
  2018-03-26 12:43 ` ✓ Fi.CI.BAT: success " Patchwork
@ 2018-03-26 15:36 ` Patchwork
       [not found] ` <20180322152313.6561-1-ville.syrjala-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
  2018-03-27  8:21 ` Daniel Vetter
  34 siblings, 0 replies; 74+ messages in thread
From: Patchwork @ 2018-03-26 15:36 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: intel-gfx

== Series Details ==

Series: drm: Eliminate plane->fb/crtc usage for atomic drivers (rev5)
URL   : https://patchwork.freedesktop.org/series/40478/
State : success

== Summary ==

---- Known issues:

Test kms_flip:
        Subgroup 2x-dpms-vs-vblank-race:
                fail       -> PASS       (shard-hsw) fdo#103060 +1
        Subgroup 2x-flip-vs-expired-vblank-interruptible:
                fail       -> PASS       (shard-hsw) fdo#102887
        Subgroup plain-flip-ts-check:
                pass       -> FAIL       (shard-hsw) fdo#100368 +1
Test kms_rotation_crc:
        Subgroup sprite-rotation-180:
                fail       -> PASS       (shard-snb) fdo#103925
Test kms_setmode:
        Subgroup basic:
                pass       -> FAIL       (shard-apl) fdo#99912
Test kms_vblank:
        Subgroup pipe-a-accuracy-idle:
                pass       -> FAIL       (shard-hsw) fdo#102583

fdo#103060 https://bugs.freedesktop.org/show_bug.cgi?id=103060
fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#103925 https://bugs.freedesktop.org/show_bug.cgi?id=103925
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
fdo#102583 https://bugs.freedesktop.org/show_bug.cgi?id=102583

shard-apl        total:3386 pass:1767 dwarn:1   dfail:0   fail:6   skip:1611 time:12568s
shard-hsw        total:3484 pass:1771 dwarn:1   dfail:0   fail:4   skip:1707 time:11784s
shard-snb        total:3484 pass:1363 dwarn:1   dfail:0   fail:3   skip:2117 time:7030s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8490/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH 02/23] drm/atomic-helper: Make drm_atomic_helper_disable_all() update the plane->fb pointers
  2018-03-22 15:22 ` [PATCH 02/23] drm/atomic-helper: Make drm_atomic_helper_disable_all() update the plane->fb pointers Ville Syrjala
@ 2018-03-26 20:28   ` Daniel Vetter
  2018-03-29 16:32     ` Ville Syrjälä
  2018-03-26 20:43   ` Daniel Vetter
  1 sibling, 1 reply; 74+ messages in thread
From: Daniel Vetter @ 2018-03-26 20:28 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: Daniel Vetter, intel-gfx, dri-devel

On Thu, Mar 22, 2018 at 05:22:52PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> drm_atomic_helper_shutdown() needs to release the reference held by
> plane->fb, so we want to use drm_atomic_clean_old_fb() in
> drm_atomic_helper_disable_all(). However during suspend/resume, gpu
> reset and load detection we should probably leave that stuff alone,
> as otherwise we'd have to make sure we put them back again when
> we restore the duplicated state to the device. Seems simpler to me
> to not touch any of it anyway.
> 
> v2: Don't inflict the clean_old_fbs bool to drivers (Daniel)
> 
> Cc: martin.peres@free.fr
> Cc: chris@chris-wilson.co.uk
> Cc: Dave Airlie <airlied@gmail.com> (v1)
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

I think this would be cleaner diff to read if you squash the first 2
patches together. Also avoids the bisect fail. With that (and I trust you
to come up with a suitably merged commit message):

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

I reviewed this by re-reading the analysis from 49d70aeaeca8f62b72b77 and
trusting my former self :-)

Cheers, Daniel

> ---
>  drivers/gpu/drm/drm_atomic_helper.c | 67 ++++++++++++++++++++++---------------
>  1 file changed, 40 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index c48f187d08de..39a69508d8c9 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -2881,31 +2881,9 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set,
>  	return 0;
>  }
>  
> -/**
> - * drm_atomic_helper_disable_all - disable all currently active outputs
> - * @dev: DRM device
> - * @ctx: lock acquisition context
> - *
> - * Loops through all connectors, finding those that aren't turned off and then
> - * turns them off by setting their DPMS mode to OFF and deactivating the CRTC
> - * that they are connected to.
> - *
> - * This is used for example in suspend/resume to disable all currently active
> - * functions when suspending. If you just want to shut down everything at e.g.
> - * driver unload, look at drm_atomic_helper_shutdown().
> - *
> - * Note that if callers haven't already acquired all modeset locks this might
> - * return -EDEADLK, which must be handled by calling drm_modeset_backoff().
> - *
> - * Returns:
> - * 0 on success or a negative error code on failure.
> - *
> - * See also:
> - * drm_atomic_helper_suspend(), drm_atomic_helper_resume() and
> - * drm_atomic_helper_shutdown().
> - */
> -int drm_atomic_helper_disable_all(struct drm_device *dev,
> -				  struct drm_modeset_acquire_ctx *ctx)
> +static int __drm_atomic_helper_disable_all(struct drm_device *dev,
> +					   struct drm_modeset_acquire_ctx *ctx,
> +					   bool clean_old_fbs)
>  {
>  	struct drm_atomic_state *state;
>  	struct drm_connector_state *conn_state;
> @@ -2914,6 +2892,7 @@ int drm_atomic_helper_disable_all(struct drm_device *dev,
>  	struct drm_plane *plane;
>  	struct drm_crtc_state *crtc_state;
>  	struct drm_crtc *crtc;
> +	unsigned int plane_mask = 0;
>  	int ret, i;
>  
>  	state = drm_atomic_state_alloc(dev);
> @@ -2956,14 +2935,48 @@ int drm_atomic_helper_disable_all(struct drm_device *dev,
>  			goto free;
>  
>  		drm_atomic_set_fb_for_plane(plane_state, NULL);
> +
> +		if (clean_old_fbs) {
> +			plane->old_fb = plane->fb;
> +			plane_mask |= BIT(drm_plane_index(plane));
> +		}
>  	}
>  
>  	ret = drm_atomic_commit(state);
>  free:
> +	drm_atomic_clean_old_fb(dev, plane_mask, ret);
> +
>  	drm_atomic_state_put(state);
>  	return ret;
>  }
> -
> +/**
> + * drm_atomic_helper_disable_all - disable all currently active outputs
> + * @dev: DRM device
> + * @ctx: lock acquisition context
> + *
> + * Loops through all connectors, finding those that aren't turned off and then
> + * turns them off by setting their DPMS mode to OFF and deactivating the CRTC
> + * that they are connected to.
> + *
> + * This is used for example in suspend/resume to disable all currently active
> + * functions when suspending. If you just want to shut down everything at e.g.
> + * driver unload, look at drm_atomic_helper_shutdown().
> + *
> + * Note that if callers haven't already acquired all modeset locks this might
> + * return -EDEADLK, which must be handled by calling drm_modeset_backoff().
> + *
> + * Returns:
> + * 0 on success or a negative error code on failure.
> + *
> + * See also:
> + * drm_atomic_helper_suspend(), drm_atomic_helper_resume() and
> + * drm_atomic_helper_shutdown().
> + */
> +int drm_atomic_helper_disable_all(struct drm_device *dev,
> +				  struct drm_modeset_acquire_ctx *ctx)
> +{
> +	return __drm_atomic_helper_disable_all(dev, ctx, false);
> +}
>  EXPORT_SYMBOL(drm_atomic_helper_disable_all);
>  
>  /**
> @@ -2986,7 +2999,7 @@ void drm_atomic_helper_shutdown(struct drm_device *dev)
>  	while (1) {
>  		ret = drm_modeset_lock_all_ctx(dev, &ctx);
>  		if (!ret)
> -			ret = drm_atomic_helper_disable_all(dev, &ctx);
> +			ret = __drm_atomic_helper_disable_all(dev, &ctx, true);
>  
>  		if (ret != -EDEADLK)
>  			break;
> -- 
> 2.16.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 03/23] drm: Clear crtc->primary->crtc when disabling the crtc via setcrtc()
  2018-03-22 15:22 ` [PATCH 03/23] drm: Clear crtc->primary->crtc when disabling the crtc via setcrtc() Ville Syrjala
@ 2018-03-26 20:41   ` Daniel Vetter
  0 siblings, 0 replies; 74+ messages in thread
From: Daniel Vetter @ 2018-03-26 20:41 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: intel-gfx, dri-devel

On Thu, Mar 22, 2018 at 05:22:53PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Keep the primary->crtc in sync with the state->crtc (also with
> primary->fb and state->fb) when disabling the crtc (and thus also
> the primary) via setcrtc().
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Yeah seems more consistent, and we do the same for atomic already. Only 2
legacy drivers seem to look at this (armada and shmob), and I think both
should be fine.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
>  drivers/gpu/drm/drm_crtc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 03583887cfec..7a973ada7195 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -471,7 +471,7 @@ static int __drm_mode_set_config_internal(struct drm_mode_set *set,
>  
>  	ret = crtc->funcs->set_config(set, ctx);
>  	if (ret == 0) {
> -		crtc->primary->crtc = crtc;
> +		crtc->primary->crtc = fb ? crtc : NULL;
>  		crtc->primary->fb = fb;
>  	}
>  
> -- 
> 2.16.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [Intel-gfx] [PATCH 04/23] drm/atomic-helper: WARN if legacy plane fb pointers are bogus when committing duplicated state
  2018-03-22 15:22 ` [PATCH 04/23] drm/atomic-helper: WARN if legacy plane fb pointers are bogus when committing duplicated state Ville Syrjala
@ 2018-03-26 20:42   ` Daniel Vetter
  0 siblings, 0 replies; 74+ messages in thread
From: Daniel Vetter @ 2018-03-26 20:42 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: Daniel Vetter, intel-gfx, dri-devel

On Thu, Mar 22, 2018 at 05:22:54PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> drm_atomic_helper_commit_duplicated_state() should only be called
> resume/reset/load_detect paths where plane->old_fb should always be
> NULL and plane->fb should be equal to the new_plane_state->fb.
> Assert that is indeed the case.
> 
> Cc: martin.peres@free.fr
> Cc: chris@chris-wilson.co.uk
> Cc: Dave Airlie <airlied@gmail.com> (v1)

The (v1) here looks funny. dim add-missing-cc not working?

> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Daniel Vetter <daniel.vetter@intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/drm_atomic_helper.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index 39a69508d8c9..1b39ebf2be2e 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -3106,8 +3106,13 @@ int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state,
>  
>  	state->acquire_ctx = ctx;
>  
> -	for_each_new_plane_in_state(state, plane, new_plane_state, i)
> +	for_each_new_plane_in_state(state, plane, new_plane_state, i) {
> +		WARN_ON(plane->crtc != new_plane_state->crtc);
> +		WARN_ON(plane->fb != new_plane_state->fb);
> +		WARN_ON(plane->old_fb);

Yeah I think with your rework of how this works this holds true now.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> +
>  		state->planes[i].old_state = plane->state;
> +	}
>  
>  	for_each_new_crtc_in_state(state, crtc, new_crtc_state, i)
>  		state->crtcs[i].old_state = crtc->state;
> -- 
> 2.16.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 02/23] drm/atomic-helper: Make drm_atomic_helper_disable_all() update the plane->fb pointers
  2018-03-22 15:22 ` [PATCH 02/23] drm/atomic-helper: Make drm_atomic_helper_disable_all() update the plane->fb pointers Ville Syrjala
  2018-03-26 20:28   ` Daniel Vetter
@ 2018-03-26 20:43   ` Daniel Vetter
  1 sibling, 0 replies; 74+ messages in thread
From: Daniel Vetter @ 2018-03-26 20:43 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: Daniel Vetter, intel-gfx, dri-devel, martin.peres

On Thu, Mar 22, 2018 at 05:22:52PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> drm_atomic_helper_shutdown() needs to release the reference held by
> plane->fb, so we want to use drm_atomic_clean_old_fb() in
> drm_atomic_helper_disable_all(). However during suspend/resume, gpu
> reset and load detection we should probably leave that stuff alone,
> as otherwise we'd have to make sure we put them back again when
> we restore the duplicated state to the device. Seems simpler to me
> to not touch any of it anyway.
> 
> v2: Don't inflict the clean_old_fbs bool to drivers (Daniel)
> 
> Cc: martin.peres@free.fr
> Cc: chris@chris-wilson.co.uk
> Cc: Dave Airlie <airlied@gmail.com> (v1)

More funny (v1) I just noticed ...
-Daniel

> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/drm_atomic_helper.c | 67 ++++++++++++++++++++++---------------
>  1 file changed, 40 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index c48f187d08de..39a69508d8c9 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -2881,31 +2881,9 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set,
>  	return 0;
>  }
>  
> -/**
> - * drm_atomic_helper_disable_all - disable all currently active outputs
> - * @dev: DRM device
> - * @ctx: lock acquisition context
> - *
> - * Loops through all connectors, finding those that aren't turned off and then
> - * turns them off by setting their DPMS mode to OFF and deactivating the CRTC
> - * that they are connected to.
> - *
> - * This is used for example in suspend/resume to disable all currently active
> - * functions when suspending. If you just want to shut down everything at e.g.
> - * driver unload, look at drm_atomic_helper_shutdown().
> - *
> - * Note that if callers haven't already acquired all modeset locks this might
> - * return -EDEADLK, which must be handled by calling drm_modeset_backoff().
> - *
> - * Returns:
> - * 0 on success or a negative error code on failure.
> - *
> - * See also:
> - * drm_atomic_helper_suspend(), drm_atomic_helper_resume() and
> - * drm_atomic_helper_shutdown().
> - */
> -int drm_atomic_helper_disable_all(struct drm_device *dev,
> -				  struct drm_modeset_acquire_ctx *ctx)
> +static int __drm_atomic_helper_disable_all(struct drm_device *dev,
> +					   struct drm_modeset_acquire_ctx *ctx,
> +					   bool clean_old_fbs)
>  {
>  	struct drm_atomic_state *state;
>  	struct drm_connector_state *conn_state;
> @@ -2914,6 +2892,7 @@ int drm_atomic_helper_disable_all(struct drm_device *dev,
>  	struct drm_plane *plane;
>  	struct drm_crtc_state *crtc_state;
>  	struct drm_crtc *crtc;
> +	unsigned int plane_mask = 0;
>  	int ret, i;
>  
>  	state = drm_atomic_state_alloc(dev);
> @@ -2956,14 +2935,48 @@ int drm_atomic_helper_disable_all(struct drm_device *dev,
>  			goto free;
>  
>  		drm_atomic_set_fb_for_plane(plane_state, NULL);
> +
> +		if (clean_old_fbs) {
> +			plane->old_fb = plane->fb;
> +			plane_mask |= BIT(drm_plane_index(plane));
> +		}
>  	}
>  
>  	ret = drm_atomic_commit(state);
>  free:
> +	drm_atomic_clean_old_fb(dev, plane_mask, ret);
> +
>  	drm_atomic_state_put(state);
>  	return ret;
>  }
> -
> +/**
> + * drm_atomic_helper_disable_all - disable all currently active outputs
> + * @dev: DRM device
> + * @ctx: lock acquisition context
> + *
> + * Loops through all connectors, finding those that aren't turned off and then
> + * turns them off by setting their DPMS mode to OFF and deactivating the CRTC
> + * that they are connected to.
> + *
> + * This is used for example in suspend/resume to disable all currently active
> + * functions when suspending. If you just want to shut down everything at e.g.
> + * driver unload, look at drm_atomic_helper_shutdown().
> + *
> + * Note that if callers haven't already acquired all modeset locks this might
> + * return -EDEADLK, which must be handled by calling drm_modeset_backoff().
> + *
> + * Returns:
> + * 0 on success or a negative error code on failure.
> + *
> + * See also:
> + * drm_atomic_helper_suspend(), drm_atomic_helper_resume() and
> + * drm_atomic_helper_shutdown().
> + */
> +int drm_atomic_helper_disable_all(struct drm_device *dev,
> +				  struct drm_modeset_acquire_ctx *ctx)
> +{
> +	return __drm_atomic_helper_disable_all(dev, ctx, false);
> +}
>  EXPORT_SYMBOL(drm_atomic_helper_disable_all);
>  
>  /**
> @@ -2986,7 +2999,7 @@ void drm_atomic_helper_shutdown(struct drm_device *dev)
>  	while (1) {
>  		ret = drm_modeset_lock_all_ctx(dev, &ctx);
>  		if (!ret)
> -			ret = drm_atomic_helper_disable_all(dev, &ctx);
> +			ret = __drm_atomic_helper_disable_all(dev, &ctx, true);
>  
>  		if (ret != -EDEADLK)
>  			break;
> -- 
> 2.16.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH 05/23] drm: Add local 'plane' variable for primary/cursor planes
  2018-03-22 15:22 ` [PATCH 05/23] drm: Add local 'plane' variable for primary/cursor planes Ville Syrjala
@ 2018-03-26 20:49   ` Daniel Vetter
  0 siblings, 0 replies; 74+ messages in thread
From: Daniel Vetter @ 2018-03-26 20:49 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: intel-gfx, dri-devel

On Thu, Mar 22, 2018 at 05:22:55PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Make the code a bit more readable by storing the plane pointer in a
> local variable rather than having to do crtc->{primary,cursor} all the
> time.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/drm_crtc.c  | 32 +++++++++++++++++++-------------
>  drivers/gpu/drm/drm_plane.c | 32 ++++++++++++++++++--------------
>  2 files changed, 37 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 7a973ada7195..8552ed419056 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -402,6 +402,7 @@ int drm_mode_getcrtc(struct drm_device *dev,
>  {
>  	struct drm_mode_crtc *crtc_resp = data;
>  	struct drm_crtc *crtc;
> +	struct drm_plane *plane;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_MODESET))
>  		return -EINVAL;
> @@ -410,21 +411,23 @@ int drm_mode_getcrtc(struct drm_device *dev,
>  	if (!crtc)
>  		return -ENOENT;
>  
> +	plane = crtc->primary;
> +
>  	crtc_resp->gamma_size = crtc->gamma_size;
>  
> -	drm_modeset_lock(&crtc->primary->mutex, NULL);
> -	if (crtc->primary->state && crtc->primary->state->fb)
> -		crtc_resp->fb_id = crtc->primary->state->fb->base.id;
> -	else if (!crtc->primary->state && crtc->primary->fb)
> -		crtc_resp->fb_id = crtc->primary->fb->base.id;
> +	drm_modeset_lock(&plane->mutex, NULL);
> +	if (plane->state && plane->state->fb)
> +		crtc_resp->fb_id = plane->state->fb->base.id;
> +	else if (!plane->state && plane->fb)
> +		crtc_resp->fb_id = plane->fb->base.id;
>  	else
>  		crtc_resp->fb_id = 0;
>  
> -	if (crtc->primary->state) {
> -		crtc_resp->x = crtc->primary->state->src_x >> 16;
> -		crtc_resp->y = crtc->primary->state->src_y >> 16;
> +	if (plane->state) {
> +		crtc_resp->x = plane->state->src_x >> 16;
> +		crtc_resp->y = plane->state->src_y >> 16;
>  	}
> -	drm_modeset_unlock(&crtc->primary->mutex);
> +	drm_modeset_unlock(&plane->mutex);
>  
>  	drm_modeset_lock(&crtc->mutex, NULL);
>  	if (crtc->state) {
> @@ -554,6 +557,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
>  	struct drm_mode_config *config = &dev->mode_config;
>  	struct drm_mode_crtc *crtc_req = data;
>  	struct drm_crtc *crtc;
> +	struct drm_plane *plane;
>  	struct drm_connector **connector_set = NULL, *connector;
>  	struct drm_framebuffer *fb = NULL;
>  	struct drm_display_mode *mode = NULL;
> @@ -580,6 +584,8 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,

Could do the same for setconfig_internal's tmp->primary, if you're bored.

>  	}
>  	DRM_DEBUG_KMS("[CRTC:%d:%s]\n", crtc->base.id, crtc->name);
>  
> +	plane = crtc->primary;
> +
>  	mutex_lock(&crtc->dev->mode_config.mutex);
>  	drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE);
>  retry:
> @@ -590,12 +596,12 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
>  		/* If we have a mode we need a framebuffer. */
>  		/* If we pass -1, set the mode with the currently bound fb */
>  		if (crtc_req->fb_id == -1) {
> -			if (!crtc->primary->fb) {
> +			if (!plane->fb) {
>  				DRM_DEBUG_KMS("CRTC doesn't have current FB\n");
>  				ret = -EINVAL;
>  				goto out;
>  			}
> -			fb = crtc->primary->fb;
> +			fb = plane->fb;
>  			/* Make refcounting symmetric with the lookup path. */
>  			drm_framebuffer_get(fb);
>  		} else {
> @@ -627,8 +633,8 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
>  		 * match real hardware capabilities. Skip the check in that
>  		 * case.
>  		 */
> -		if (!crtc->primary->format_default) {
> -			ret = drm_plane_check_pixel_format(crtc->primary,
> +		if (!plane->format_default) {
> +			ret = drm_plane_check_pixel_format(plane,
>  							   fb->format->format,
>  							   fb->modifier);
>  			if (ret) {
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index 6d2a6e428a3e..38e2a628bfa2 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -756,6 +756,7 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc,
>  				     struct drm_modeset_acquire_ctx *ctx)
>  {
>  	struct drm_device *dev = crtc->dev;
> +	struct drm_plane *plane = crtc->cursor;
>  	struct drm_framebuffer *fb = NULL;
>  	struct drm_mode_fb_cmd2 fbreq = {
>  		.width = req->width,
> @@ -769,8 +770,8 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc,
>  	uint32_t src_w = 0, src_h = 0;
>  	int ret = 0;
>  
> -	BUG_ON(!crtc->cursor);
> -	WARN_ON(crtc->cursor->crtc != crtc && crtc->cursor->crtc != NULL);
> +	BUG_ON(!plane);
> +	WARN_ON(plane->crtc != crtc && plane->crtc != NULL);
>  
>  	/*
>  	 * Obtain fb we'll be using (either new or existing) and take an extra
> @@ -790,7 +791,7 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc,
>  			fb = NULL;
>  		}
>  	} else {
> -		fb = crtc->cursor->fb;
> +		fb = plane->fb;
>  		if (fb)
>  			drm_framebuffer_get(fb);
>  	}
> @@ -810,7 +811,7 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc,
>  		src_h = fb->height << 16;
>  	}
>  
> -	ret = __setplane_internal(crtc->cursor, crtc, fb,
> +	ret = __setplane_internal(plane, crtc, fb,
>  				  crtc_x, crtc_y, crtc_w, crtc_h,
>  				  0, 0, src_w, src_h, ctx);
>  
> @@ -931,6 +932,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
>  {
>  	struct drm_mode_crtc_page_flip_target *page_flip = data;
>  	struct drm_crtc *crtc;
> +	struct drm_plane *plane;
>  	struct drm_framebuffer *fb = NULL;
>  	struct drm_pending_vblank_event *e = NULL;
>  	u32 target_vblank = page_flip->sequence;
> @@ -959,6 +961,8 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
>  	if (!crtc)
>  		return -ENOENT;
>  
> +	plane = crtc->primary;
> +
>  	if (crtc->funcs->page_flip_target) {
>  		u32 current_vblank;
>  		int r;
> @@ -1003,11 +1007,11 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
>  	ret = drm_modeset_lock(&crtc->mutex, &ctx);
>  	if (ret)
>  		goto out;
> -	ret = drm_modeset_lock(&crtc->primary->mutex, &ctx);
> +	ret = drm_modeset_lock(&plane->mutex, &ctx);
>  	if (ret)
>  		goto out;
>  
> -	if (crtc->primary->fb == NULL) {
> +	if (plane->fb == NULL) {
>  		/* The framebuffer is currently unbound, presumably
>  		 * due to a hotplug event, that userspace has not
>  		 * yet discovered.
> @@ -1023,7 +1027,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
>  	}
>  
>  	if (crtc->state) {
> -		const struct drm_plane_state *state = crtc->primary->state;
> +		const struct drm_plane_state *state = plane->state;
>  
>  		ret = drm_framebuffer_check_src_coords(state->src_x,
>  						       state->src_y,
> @@ -1036,7 +1040,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
>  	if (ret)
>  		goto out;
>  
> -	if (crtc->primary->fb->format != fb->format) {
> +	if (plane->fb->format != fb->format) {
>  		DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
>  		ret = -EINVAL;
>  		goto out;
> @@ -1060,7 +1064,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
>  		}
>  	}
>  
> -	crtc->primary->old_fb = crtc->primary->fb;
> +	plane->old_fb = plane->fb;
>  	if (crtc->funcs->page_flip_target)
>  		ret = crtc->funcs->page_flip_target(crtc, fb, e,
>  						    page_flip->flags,
> @@ -1073,9 +1077,9 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
>  		if (page_flip->flags & DRM_MODE_PAGE_FLIP_EVENT)
>  			drm_event_cancel_free(dev, &e->base);
>  		/* Keep the old fb, don't unref it. */
> -		crtc->primary->old_fb = NULL;
> +		plane->old_fb = NULL;
>  	} else {
> -		crtc->primary->fb = fb;
> +		plane->fb = fb;
>  		/* Unref only the old framebuffer. */
>  		fb = NULL;
>  	}
> @@ -1083,9 +1087,9 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
>  out:
>  	if (fb)
>  		drm_framebuffer_put(fb);
> -	if (crtc->primary->old_fb)
> -		drm_framebuffer_put(crtc->primary->old_fb);
> -	crtc->primary->old_fb = NULL;
> +	if (plane->old_fb)
> +		drm_framebuffer_put(plane->old_fb);
> +	plane->old_fb = NULL;
>  

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

>  	if (ret == -EDEADLK) {
>  		ret = drm_modeset_backoff(&ctx);
> -- 
> 2.16.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 06/23] drm: Adjust whitespace for legibility
  2018-03-22 15:22 ` [PATCH 06/23] drm: Adjust whitespace for legibility Ville Syrjala
@ 2018-03-26 20:49   ` Daniel Vetter
  0 siblings, 0 replies; 74+ messages in thread
From: Daniel Vetter @ 2018-03-26 20:49 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: intel-gfx, dri-devel

On Thu, Mar 22, 2018 at 05:22:56PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Add a bit of whitespace here and there to make the code look a bit
> more structured.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Too lazy to grow a real opinion on whitespace :-)

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/drm_crtc.c  | 4 +++-
>  drivers/gpu/drm/drm_plane.c | 6 +++++-
>  2 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 8552ed419056..537ffaab855c 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -434,13 +434,13 @@ int drm_mode_getcrtc(struct drm_device *dev,
>  		if (crtc->state->enable) {
>  			drm_mode_convert_to_umode(&crtc_resp->mode, &crtc->state->mode);
>  			crtc_resp->mode_valid = 1;
> -
>  		} else {
>  			crtc_resp->mode_valid = 0;
>  		}
>  	} else {
>  		crtc_resp->x = crtc->x;
>  		crtc_resp->y = crtc->y;
> +
>  		if (crtc->enabled) {
>  			drm_mode_convert_to_umode(&crtc_resp->mode, &crtc->mode);
>  			crtc_resp->mode_valid = 1;
> @@ -592,6 +592,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
>  	ret = drm_modeset_lock_all_ctx(crtc->dev, &ctx);
>  	if (ret)
>  		goto out;
> +
>  	if (crtc_req->mode_valid) {
>  		/* If we have a mode we need a framebuffer. */
>  		/* If we pass -1, set the mode with the currently bound fb */
> @@ -601,6 +602,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
>  				ret = -EINVAL;
>  				goto out;
>  			}
> +
>  			fb = plane->fb;
>  			/* Make refcounting symmetric with the lookup path. */
>  			drm_framebuffer_get(fb);
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index 38e2a628bfa2..bedceca7dd06 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -785,6 +785,7 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc,
>  				DRM_DEBUG_KMS("failed to wrap cursor buffer in drm framebuffer\n");
>  				return PTR_ERR(fb);
>  			}
> +
>  			fb->hot_x = req->hot_x;
>  			fb->hot_y = req->hot_y;
>  		} else {
> @@ -1035,7 +1036,8 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
>  						       state->src_h,
>  						       fb);
>  	} else {
> -		ret = drm_crtc_check_viewport(crtc, crtc->x, crtc->y, &crtc->mode, fb);
> +		ret = drm_crtc_check_viewport(crtc, crtc->x, crtc->y,
> +					      &crtc->mode, fb);
>  	}
>  	if (ret)
>  		goto out;
> @@ -1052,10 +1054,12 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
>  			ret = -ENOMEM;
>  			goto out;
>  		}
> +
>  		e->event.base.type = DRM_EVENT_FLIP_COMPLETE;
>  		e->event.base.length = sizeof(e->event);
>  		e->event.vbl.user_data = page_flip->user_data;
>  		e->event.vbl.crtc_id = crtc->base.id;
> +
>  		ret = drm_event_reserve_init(dev, file_priv, &e->base, &e->event.base);
>  		if (ret) {
>  			kfree(e);
> -- 
> 2.16.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH 15/23] drm: Stop updating plane->crtc/fb/old_fb on atomic drivers
  2018-03-22 15:23 ` [PATCH 15/23] drm: Stop updating plane->crtc/fb/old_fb on atomic drivers Ville Syrjala
@ 2018-03-26 20:52   ` Daniel Vetter
  2018-03-26 20:56     ` [Intel-gfx] " Daniel Vetter
  2018-03-27  7:57   ` Daniel Vetter
  1 sibling, 1 reply; 74+ messages in thread
From: Daniel Vetter @ 2018-03-26 20:52 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: intel-gfx, dri-devel

On Thu, Mar 22, 2018 at 05:23:05PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Stop playing around with plane->crtc/fb/old_fb with atomic
> drivers. Make life a lot simpler when we don't have to do the
> magic old_fb vs. fb dance around plane updates. That way we
> can't risk plane->fb getting out of sync with plane->state->fb
> and we're less likely to leak any refcounts as well.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/drm_atomic.c        | 55 ++++---------------------------------
>  drivers/gpu/drm/drm_atomic_helper.c | 15 +---------
>  drivers/gpu/drm/drm_crtc.c          |  8 ++++--
>  drivers/gpu/drm/drm_fb_helper.c     |  7 -----
>  drivers/gpu/drm/drm_framebuffer.c   |  5 ----
>  drivers/gpu/drm/drm_plane.c         | 14 ++++++----
>  drivers/gpu/drm/drm_plane_helper.c  |  4 ++-
>  include/drm/drm_atomic.h            |  3 --
>  8 files changed, 24 insertions(+), 87 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 7d25c42f22db..b16cc37e2adf 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -692,6 +692,11 @@ drm_atomic_get_plane_state(struct drm_atomic_state *state,
>  
>  	WARN_ON(!state->acquire_ctx);
>  
> +	/* the legacy pointers should never be set */
> +	WARN_ON(plane->fb);
> +	WARN_ON(plane->old_fb);
> +	WARN_ON(plane->crtc);

I did already review all the users for plane->crtc and found:

armada + shmob: not atomic, should be fine

But there's also exynos, msm/mdp5, sti and vc4 doing various silly things
with setting plane->crtc. I think before you can add this WARN_ON we need
to clean up that cruft (it looks like 100% cargo culting, so should be
quit).

Going to think about the other patches tomorrow.
-Daniel

> +
>  	plane_state = drm_atomic_get_existing_plane_state(state, plane);
>  	if (plane_state)
>  		return plane_state;
> @@ -2021,45 +2026,6 @@ int drm_atomic_set_property(struct drm_atomic_state *state,
>  	return ret;
>  }
>  
> -/**
> - * drm_atomic_clean_old_fb -- Unset old_fb pointers and set plane->fb pointers.
> - *
> - * @dev: drm device to check.
> - * @plane_mask: plane mask for planes that were updated.
> - * @ret: return value, can be -EDEADLK for a retry.
> - *
> - * Before doing an update &drm_plane.old_fb is set to &drm_plane.fb, but before
> - * dropping the locks old_fb needs to be set to NULL and plane->fb updated. This
> - * is a common operation for each atomic update, so this call is split off as a
> - * helper.
> - */
> -void drm_atomic_clean_old_fb(struct drm_device *dev,
> -			     unsigned plane_mask,
> -			     int ret)
> -{
> -	struct drm_plane *plane;
> -
> -	/* if succeeded, fixup legacy plane crtc/fb ptrs before dropping
> -	 * locks (ie. while it is still safe to deref plane->state).  We
> -	 * need to do this here because the driver entry points cannot
> -	 * distinguish between legacy and atomic ioctls.
> -	 */
> -	drm_for_each_plane_mask(plane, dev, plane_mask) {
> -		if (ret == 0) {
> -			struct drm_framebuffer *new_fb = plane->state->fb;
> -			if (new_fb)
> -				drm_framebuffer_get(new_fb);
> -			plane->fb = new_fb;
> -			plane->crtc = plane->state->crtc;
> -
> -			if (plane->old_fb)
> -				drm_framebuffer_put(plane->old_fb);
> -		}
> -		plane->old_fb = NULL;
> -	}
> -}
> -EXPORT_SYMBOL(drm_atomic_clean_old_fb);
> -
>  /**
>   * DOC: explicit fencing properties
>   *
> @@ -2280,9 +2246,7 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
>  	unsigned int copied_objs, copied_props;
>  	struct drm_atomic_state *state;
>  	struct drm_modeset_acquire_ctx ctx;
> -	struct drm_plane *plane;
>  	struct drm_out_fence_state *fence_state;
> -	unsigned plane_mask;
>  	int ret = 0;
>  	unsigned int i, j, num_fences;
>  
> @@ -2322,7 +2286,6 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
>  	state->allow_modeset = !!(arg->flags & DRM_MODE_ATOMIC_ALLOW_MODESET);
>  
>  retry:
> -	plane_mask = 0;
>  	copied_objs = 0;
>  	copied_props = 0;
>  	fence_state = NULL;
> @@ -2393,12 +2356,6 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
>  			copied_props++;
>  		}
>  
> -		if (obj->type == DRM_MODE_OBJECT_PLANE && count_props &&
> -		    !(arg->flags & DRM_MODE_ATOMIC_TEST_ONLY)) {
> -			plane = obj_to_plane(obj);
> -			plane_mask |= (1 << drm_plane_index(plane));
> -			plane->old_fb = plane->fb;
> -		}
>  		drm_mode_object_put(obj);
>  	}
>  
> @@ -2419,8 +2376,6 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
>  	}
>  
>  out:
> -	drm_atomic_clean_old_fb(dev, plane_mask, ret);
> -
>  	complete_crtc_signaling(dev, state, fence_state, num_fences, !ret);
>  
>  	if (ret == -EDEADLK) {
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index 0e806f070d00..d42d88b97396 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -2892,7 +2892,6 @@ static int __drm_atomic_helper_disable_all(struct drm_device *dev,
>  	struct drm_plane *plane;
>  	struct drm_crtc_state *crtc_state;
>  	struct drm_crtc *crtc;
> -	unsigned int plane_mask = 0;
>  	int ret, i;
>  
>  	state = drm_atomic_state_alloc(dev);
> @@ -2935,17 +2934,10 @@ static int __drm_atomic_helper_disable_all(struct drm_device *dev,
>  			goto free;
>  
>  		drm_atomic_set_fb_for_plane(plane_state, NULL);
> -
> -		if (clean_old_fbs) {
> -			plane->old_fb = plane->fb;
> -			plane_mask |= BIT(drm_plane_index(plane));
> -		}
>  	}
>  
>  	ret = drm_atomic_commit(state);
>  free:
> -	drm_atomic_clean_old_fb(dev, plane_mask, ret);
> -
>  	drm_atomic_state_put(state);
>  	return ret;
>  }
> @@ -3106,13 +3098,8 @@ int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state,
>  
>  	state->acquire_ctx = ctx;
>  
> -	for_each_new_plane_in_state(state, plane, new_plane_state, i) {
> -		WARN_ON(plane->crtc != new_plane_state->crtc);
> -		WARN_ON(plane->fb != new_plane_state->fb);
> -		WARN_ON(plane->old_fb);
> -
> +	for_each_new_plane_in_state(state, plane, new_plane_state, i)
>  		state->planes[i].old_state = plane->state;
> -	}
>  
>  	for_each_new_crtc_in_state(state, crtc, new_crtc_state, i)
>  		state->crtcs[i].old_state = crtc->state;
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index a231dd5dce16..4e3c1a8d118a 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -474,8 +474,12 @@ static int __drm_mode_set_config_internal(struct drm_mode_set *set,
>  
>  	ret = crtc->funcs->set_config(set, ctx);
>  	if (ret == 0) {
> -		crtc->primary->crtc = fb ? crtc : NULL;
> -		crtc->primary->fb = fb;
> +		struct drm_plane *plane = crtc->primary;
> +
> +		if (!plane->state) {
> +			plane->crtc = fb ? crtc : NULL;
> +			plane->fb = fb;
> +		}
>  	}
>  
>  	drm_for_each_crtc(tmp, crtc->dev) {
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index 0646b108030b..5639e804a0cd 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -368,7 +368,6 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper *fb_helper, bool activ
>  	struct drm_plane *plane;
>  	struct drm_atomic_state *state;
>  	int i, ret;
> -	unsigned int plane_mask;
>  	struct drm_modeset_acquire_ctx ctx;
>  
>  	drm_modeset_acquire_init(&ctx, 0);
> @@ -381,7 +380,6 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper *fb_helper, bool activ
>  
>  	state->acquire_ctx = &ctx;
>  retry:
> -	plane_mask = 0;
>  	drm_for_each_plane(plane, dev) {
>  		plane_state = drm_atomic_get_plane_state(state, plane);
>  		if (IS_ERR(plane_state)) {
> @@ -391,9 +389,6 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper *fb_helper, bool activ
>  
>  		plane_state->rotation = DRM_MODE_ROTATE_0;
>  
> -		plane->old_fb = plane->fb;
> -		plane_mask |= 1 << drm_plane_index(plane);
> -
>  		/* disable non-primary: */
>  		if (plane->type == DRM_PLANE_TYPE_PRIMARY)
>  			continue;
> @@ -430,8 +425,6 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper *fb_helper, bool activ
>  	ret = drm_atomic_commit(state);
>  
>  out_state:
> -	drm_atomic_clean_old_fb(dev, plane_mask, ret);
> -
>  	if (ret == -EDEADLK)
>  		goto backoff;
>  
> diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
> index ad67203de715..421a77c2a4ac 100644
> --- a/drivers/gpu/drm/drm_framebuffer.c
> +++ b/drivers/gpu/drm/drm_framebuffer.c
> @@ -835,8 +835,6 @@ static int atomic_remove_fb(struct drm_framebuffer *fb)
>  			goto unlock;
>  
>  		plane_mask |= BIT(drm_plane_index(plane));
> -
> -		plane->old_fb = plane->fb;
>  	}
>  
>  	/* This list is only filled when disable_crtcs is set. */
> @@ -851,9 +849,6 @@ static int atomic_remove_fb(struct drm_framebuffer *fb)
>  		ret = drm_atomic_commit(state);
>  
>  unlock:
> -	if (plane_mask)
> -		drm_atomic_clean_old_fb(dev, plane_mask, ret);
> -
>  	if (ret == -EDEADLK) {
>  		drm_atomic_state_clear(state);
>  		drm_modeset_backoff(&ctx);
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index 035054455301..143041666096 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -650,9 +650,11 @@ static int __setplane_internal(struct drm_plane *plane,
>  					 crtc_x, crtc_y, crtc_w, crtc_h,
>  					 src_x, src_y, src_w, src_h, ctx);
>  	if (!ret) {
> -		plane->crtc = crtc;
> -		plane->fb = fb;
> -		drm_framebuffer_get(plane->fb);
> +		if (!plane->state) {
> +			plane->crtc = crtc;
> +			plane->fb = fb;
> +			drm_framebuffer_get(plane->fb);
> +		}
>  	} else {
>  		plane->old_fb = NULL;
>  	}
> @@ -1092,8 +1094,10 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
>  		/* Keep the old fb, don't unref it. */
>  		plane->old_fb = NULL;
>  	} else {
> -		plane->fb = fb;
> -		drm_framebuffer_get(fb);
> +		if (!plane->state) {
> +			plane->fb = fb;
> +			drm_framebuffer_get(fb);
> +		}
>  	}
>  
>  out:
> diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
> index f88f68161519..2010794943bc 100644
> --- a/drivers/gpu/drm/drm_plane_helper.c
> +++ b/drivers/gpu/drm/drm_plane_helper.c
> @@ -502,6 +502,7 @@ EXPORT_SYMBOL(drm_plane_helper_update);
>  int drm_plane_helper_disable(struct drm_plane *plane)
>  {
>  	struct drm_plane_state *plane_state;
> +	struct drm_framebuffer *old_fb;
>  
>  	/* crtc helpers love to call disable functions for already disabled hw
>  	 * functions. So cope with that. */
> @@ -521,8 +522,9 @@ int drm_plane_helper_disable(struct drm_plane *plane)
>  	plane_state->plane = plane;
>  
>  	plane_state->crtc = NULL;
> +	old_fb = plane_state->fb;
>  	drm_atomic_set_fb_for_plane(plane_state, NULL);
>  
> -	return drm_plane_helper_commit(plane, plane_state, plane->fb);
> +	return drm_plane_helper_commit(plane, plane_state, old_fb);
>  }
>  EXPORT_SYMBOL(drm_plane_helper_disable);
> diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
> index a57a8aa90ffb..ca461b6cf71f 100644
> --- a/include/drm/drm_atomic.h
> +++ b/include/drm/drm_atomic.h
> @@ -601,9 +601,6 @@ int __must_check
>  drm_atomic_add_affected_planes(struct drm_atomic_state *state,
>  			       struct drm_crtc *crtc);
>  
> -void
> -drm_atomic_clean_old_fb(struct drm_device *dev, unsigned plane_mask, int ret);
> -
>  int __must_check drm_atomic_check_only(struct drm_atomic_state *state);
>  int __must_check drm_atomic_commit(struct drm_atomic_state *state);
>  int __must_check drm_atomic_nonblocking_commit(struct drm_atomic_state *state);
> -- 
> 2.16.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [Intel-gfx] [PATCH 15/23] drm: Stop updating plane->crtc/fb/old_fb on atomic drivers
  2018-03-26 20:52   ` Daniel Vetter
@ 2018-03-26 20:56     ` Daniel Vetter
  0 siblings, 0 replies; 74+ messages in thread
From: Daniel Vetter @ 2018-03-26 20:56 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: intel-gfx, dri-devel

On Mon, Mar 26, 2018 at 10:52:58PM +0200, Daniel Vetter wrote:
> On Thu, Mar 22, 2018 at 05:23:05PM +0200, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Stop playing around with plane->crtc/fb/old_fb with atomic
> > drivers. Make life a lot simpler when we don't have to do the
> > magic old_fb vs. fb dance around plane updates. That way we
> > can't risk plane->fb getting out of sync with plane->state->fb
> > and we're less likely to leak any refcounts as well.
> > 
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/drm_atomic.c        | 55 ++++---------------------------------
> >  drivers/gpu/drm/drm_atomic_helper.c | 15 +---------
> >  drivers/gpu/drm/drm_crtc.c          |  8 ++++--
> >  drivers/gpu/drm/drm_fb_helper.c     |  7 -----
> >  drivers/gpu/drm/drm_framebuffer.c   |  5 ----
> >  drivers/gpu/drm/drm_plane.c         | 14 ++++++----
> >  drivers/gpu/drm/drm_plane_helper.c  |  4 ++-
> >  include/drm/drm_atomic.h            |  3 --
> >  8 files changed, 24 insertions(+), 87 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> > index 7d25c42f22db..b16cc37e2adf 100644
> > --- a/drivers/gpu/drm/drm_atomic.c
> > +++ b/drivers/gpu/drm/drm_atomic.c
> > @@ -692,6 +692,11 @@ drm_atomic_get_plane_state(struct drm_atomic_state *state,
> >  
> >  	WARN_ON(!state->acquire_ctx);
> >  
> > +	/* the legacy pointers should never be set */
> > +	WARN_ON(plane->fb);
> > +	WARN_ON(plane->old_fb);
> > +	WARN_ON(plane->crtc);
> 
> I did already review all the users for plane->crtc and found:
> 
> armada + shmob: not atomic, should be fine
> 
> But there's also exynos, msm/mdp5, sti and vc4 doing various silly things
> with setting plane->crtc. I think before you can add this WARN_ON we need
> to clean up that cruft (it looks like 100% cargo culting, so should be
> quit).

Ah, follow-up patches take care of most of this. But note that msm sets
plane->crtc in its _init function, so will trip over your WARN_ON here.

And you seem to have missed sti, which looks at plane->crtc instead of
plane->state->crtc (and appropriate locking) in its debugfs code.
-Daniel

> 
> Going to think about the other patches tomorrow.
> -Daniel
> 
> > +
> >  	plane_state = drm_atomic_get_existing_plane_state(state, plane);
> >  	if (plane_state)
> >  		return plane_state;
> > @@ -2021,45 +2026,6 @@ int drm_atomic_set_property(struct drm_atomic_state *state,
> >  	return ret;
> >  }
> >  
> > -/**
> > - * drm_atomic_clean_old_fb -- Unset old_fb pointers and set plane->fb pointers.
> > - *
> > - * @dev: drm device to check.
> > - * @plane_mask: plane mask for planes that were updated.
> > - * @ret: return value, can be -EDEADLK for a retry.
> > - *
> > - * Before doing an update &drm_plane.old_fb is set to &drm_plane.fb, but before
> > - * dropping the locks old_fb needs to be set to NULL and plane->fb updated. This
> > - * is a common operation for each atomic update, so this call is split off as a
> > - * helper.
> > - */
> > -void drm_atomic_clean_old_fb(struct drm_device *dev,
> > -			     unsigned plane_mask,
> > -			     int ret)
> > -{
> > -	struct drm_plane *plane;
> > -
> > -	/* if succeeded, fixup legacy plane crtc/fb ptrs before dropping
> > -	 * locks (ie. while it is still safe to deref plane->state).  We
> > -	 * need to do this here because the driver entry points cannot
> > -	 * distinguish between legacy and atomic ioctls.
> > -	 */
> > -	drm_for_each_plane_mask(plane, dev, plane_mask) {
> > -		if (ret == 0) {
> > -			struct drm_framebuffer *new_fb = plane->state->fb;
> > -			if (new_fb)
> > -				drm_framebuffer_get(new_fb);
> > -			plane->fb = new_fb;
> > -			plane->crtc = plane->state->crtc;
> > -
> > -			if (plane->old_fb)
> > -				drm_framebuffer_put(plane->old_fb);
> > -		}
> > -		plane->old_fb = NULL;
> > -	}
> > -}
> > -EXPORT_SYMBOL(drm_atomic_clean_old_fb);
> > -
> >  /**
> >   * DOC: explicit fencing properties
> >   *
> > @@ -2280,9 +2246,7 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
> >  	unsigned int copied_objs, copied_props;
> >  	struct drm_atomic_state *state;
> >  	struct drm_modeset_acquire_ctx ctx;
> > -	struct drm_plane *plane;
> >  	struct drm_out_fence_state *fence_state;
> > -	unsigned plane_mask;
> >  	int ret = 0;
> >  	unsigned int i, j, num_fences;
> >  
> > @@ -2322,7 +2286,6 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
> >  	state->allow_modeset = !!(arg->flags & DRM_MODE_ATOMIC_ALLOW_MODESET);
> >  
> >  retry:
> > -	plane_mask = 0;
> >  	copied_objs = 0;
> >  	copied_props = 0;
> >  	fence_state = NULL;
> > @@ -2393,12 +2356,6 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
> >  			copied_props++;
> >  		}
> >  
> > -		if (obj->type == DRM_MODE_OBJECT_PLANE && count_props &&
> > -		    !(arg->flags & DRM_MODE_ATOMIC_TEST_ONLY)) {
> > -			plane = obj_to_plane(obj);
> > -			plane_mask |= (1 << drm_plane_index(plane));
> > -			plane->old_fb = plane->fb;
> > -		}
> >  		drm_mode_object_put(obj);
> >  	}
> >  
> > @@ -2419,8 +2376,6 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
> >  	}
> >  
> >  out:
> > -	drm_atomic_clean_old_fb(dev, plane_mask, ret);
> > -
> >  	complete_crtc_signaling(dev, state, fence_state, num_fences, !ret);
> >  
> >  	if (ret == -EDEADLK) {
> > diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> > index 0e806f070d00..d42d88b97396 100644
> > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > @@ -2892,7 +2892,6 @@ static int __drm_atomic_helper_disable_all(struct drm_device *dev,
> >  	struct drm_plane *plane;
> >  	struct drm_crtc_state *crtc_state;
> >  	struct drm_crtc *crtc;
> > -	unsigned int plane_mask = 0;
> >  	int ret, i;
> >  
> >  	state = drm_atomic_state_alloc(dev);
> > @@ -2935,17 +2934,10 @@ static int __drm_atomic_helper_disable_all(struct drm_device *dev,
> >  			goto free;
> >  
> >  		drm_atomic_set_fb_for_plane(plane_state, NULL);
> > -
> > -		if (clean_old_fbs) {
> > -			plane->old_fb = plane->fb;
> > -			plane_mask |= BIT(drm_plane_index(plane));
> > -		}
> >  	}
> >  
> >  	ret = drm_atomic_commit(state);
> >  free:
> > -	drm_atomic_clean_old_fb(dev, plane_mask, ret);
> > -
> >  	drm_atomic_state_put(state);
> >  	return ret;
> >  }
> > @@ -3106,13 +3098,8 @@ int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state,
> >  
> >  	state->acquire_ctx = ctx;
> >  
> > -	for_each_new_plane_in_state(state, plane, new_plane_state, i) {
> > -		WARN_ON(plane->crtc != new_plane_state->crtc);
> > -		WARN_ON(plane->fb != new_plane_state->fb);
> > -		WARN_ON(plane->old_fb);
> > -
> > +	for_each_new_plane_in_state(state, plane, new_plane_state, i)
> >  		state->planes[i].old_state = plane->state;
> > -	}
> >  
> >  	for_each_new_crtc_in_state(state, crtc, new_crtc_state, i)
> >  		state->crtcs[i].old_state = crtc->state;
> > diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> > index a231dd5dce16..4e3c1a8d118a 100644
> > --- a/drivers/gpu/drm/drm_crtc.c
> > +++ b/drivers/gpu/drm/drm_crtc.c
> > @@ -474,8 +474,12 @@ static int __drm_mode_set_config_internal(struct drm_mode_set *set,
> >  
> >  	ret = crtc->funcs->set_config(set, ctx);
> >  	if (ret == 0) {
> > -		crtc->primary->crtc = fb ? crtc : NULL;
> > -		crtc->primary->fb = fb;
> > +		struct drm_plane *plane = crtc->primary;
> > +
> > +		if (!plane->state) {
> > +			plane->crtc = fb ? crtc : NULL;
> > +			plane->fb = fb;
> > +		}
> >  	}
> >  
> >  	drm_for_each_crtc(tmp, crtc->dev) {
> > diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> > index 0646b108030b..5639e804a0cd 100644
> > --- a/drivers/gpu/drm/drm_fb_helper.c
> > +++ b/drivers/gpu/drm/drm_fb_helper.c
> > @@ -368,7 +368,6 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper *fb_helper, bool activ
> >  	struct drm_plane *plane;
> >  	struct drm_atomic_state *state;
> >  	int i, ret;
> > -	unsigned int plane_mask;
> >  	struct drm_modeset_acquire_ctx ctx;
> >  
> >  	drm_modeset_acquire_init(&ctx, 0);
> > @@ -381,7 +380,6 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper *fb_helper, bool activ
> >  
> >  	state->acquire_ctx = &ctx;
> >  retry:
> > -	plane_mask = 0;
> >  	drm_for_each_plane(plane, dev) {
> >  		plane_state = drm_atomic_get_plane_state(state, plane);
> >  		if (IS_ERR(plane_state)) {
> > @@ -391,9 +389,6 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper *fb_helper, bool activ
> >  
> >  		plane_state->rotation = DRM_MODE_ROTATE_0;
> >  
> > -		plane->old_fb = plane->fb;
> > -		plane_mask |= 1 << drm_plane_index(plane);
> > -
> >  		/* disable non-primary: */
> >  		if (plane->type == DRM_PLANE_TYPE_PRIMARY)
> >  			continue;
> > @@ -430,8 +425,6 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper *fb_helper, bool activ
> >  	ret = drm_atomic_commit(state);
> >  
> >  out_state:
> > -	drm_atomic_clean_old_fb(dev, plane_mask, ret);
> > -
> >  	if (ret == -EDEADLK)
> >  		goto backoff;
> >  
> > diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
> > index ad67203de715..421a77c2a4ac 100644
> > --- a/drivers/gpu/drm/drm_framebuffer.c
> > +++ b/drivers/gpu/drm/drm_framebuffer.c
> > @@ -835,8 +835,6 @@ static int atomic_remove_fb(struct drm_framebuffer *fb)
> >  			goto unlock;
> >  
> >  		plane_mask |= BIT(drm_plane_index(plane));
> > -
> > -		plane->old_fb = plane->fb;
> >  	}
> >  
> >  	/* This list is only filled when disable_crtcs is set. */
> > @@ -851,9 +849,6 @@ static int atomic_remove_fb(struct drm_framebuffer *fb)
> >  		ret = drm_atomic_commit(state);
> >  
> >  unlock:
> > -	if (plane_mask)
> > -		drm_atomic_clean_old_fb(dev, plane_mask, ret);
> > -
> >  	if (ret == -EDEADLK) {
> >  		drm_atomic_state_clear(state);
> >  		drm_modeset_backoff(&ctx);
> > diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> > index 035054455301..143041666096 100644
> > --- a/drivers/gpu/drm/drm_plane.c
> > +++ b/drivers/gpu/drm/drm_plane.c
> > @@ -650,9 +650,11 @@ static int __setplane_internal(struct drm_plane *plane,
> >  					 crtc_x, crtc_y, crtc_w, crtc_h,
> >  					 src_x, src_y, src_w, src_h, ctx);
> >  	if (!ret) {
> > -		plane->crtc = crtc;
> > -		plane->fb = fb;
> > -		drm_framebuffer_get(plane->fb);
> > +		if (!plane->state) {
> > +			plane->crtc = crtc;
> > +			plane->fb = fb;
> > +			drm_framebuffer_get(plane->fb);
> > +		}
> >  	} else {
> >  		plane->old_fb = NULL;
> >  	}
> > @@ -1092,8 +1094,10 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
> >  		/* Keep the old fb, don't unref it. */
> >  		plane->old_fb = NULL;
> >  	} else {
> > -		plane->fb = fb;
> > -		drm_framebuffer_get(fb);
> > +		if (!plane->state) {
> > +			plane->fb = fb;
> > +			drm_framebuffer_get(fb);
> > +		}
> >  	}
> >  
> >  out:
> > diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
> > index f88f68161519..2010794943bc 100644
> > --- a/drivers/gpu/drm/drm_plane_helper.c
> > +++ b/drivers/gpu/drm/drm_plane_helper.c
> > @@ -502,6 +502,7 @@ EXPORT_SYMBOL(drm_plane_helper_update);
> >  int drm_plane_helper_disable(struct drm_plane *plane)
> >  {
> >  	struct drm_plane_state *plane_state;
> > +	struct drm_framebuffer *old_fb;
> >  
> >  	/* crtc helpers love to call disable functions for already disabled hw
> >  	 * functions. So cope with that. */
> > @@ -521,8 +522,9 @@ int drm_plane_helper_disable(struct drm_plane *plane)
> >  	plane_state->plane = plane;
> >  
> >  	plane_state->crtc = NULL;
> > +	old_fb = plane_state->fb;
> >  	drm_atomic_set_fb_for_plane(plane_state, NULL);
> >  
> > -	return drm_plane_helper_commit(plane, plane_state, plane->fb);
> > +	return drm_plane_helper_commit(plane, plane_state, old_fb);
> >  }
> >  EXPORT_SYMBOL(drm_plane_helper_disable);
> > diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
> > index a57a8aa90ffb..ca461b6cf71f 100644
> > --- a/include/drm/drm_atomic.h
> > +++ b/include/drm/drm_atomic.h
> > @@ -601,9 +601,6 @@ int __must_check
> >  drm_atomic_add_affected_planes(struct drm_atomic_state *state,
> >  			       struct drm_crtc *crtc);
> >  
> > -void
> > -drm_atomic_clean_old_fb(struct drm_device *dev, unsigned plane_mask, int ret);
> > -
> >  int __must_check drm_atomic_check_only(struct drm_atomic_state *state);
> >  int __must_check drm_atomic_commit(struct drm_atomic_state *state);
> >  int __must_check drm_atomic_nonblocking_commit(struct drm_atomic_state *state);
> > -- 
> > 2.16.1
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 07/23] drm: Make the fb refcount handover less magic
  2018-03-22 15:22 ` [PATCH 07/23] drm: Make the fb refcount handover less magic Ville Syrjala
@ 2018-03-27  7:49   ` Daniel Vetter
  0 siblings, 0 replies; 74+ messages in thread
From: Daniel Vetter @ 2018-03-27  7:49 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: intel-gfx, dri-devel

On Thu, Mar 22, 2018 at 05:22:57PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Instead of assigning the plane->fb pointer and clearing the fb pointer
> to hand over the reference, let's just do it by grabbing another
> referece for plane->fb and let fb keep its original one.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
>  drivers/gpu/drm/drm_plane.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index bedceca7dd06..008f9456a5e8 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -1084,8 +1084,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
>  		plane->old_fb = NULL;
>  	} else {
>  		plane->fb = fb;
> -		/* Unref only the old framebuffer. */
> -		fb = NULL;
> +		drm_framebuffer_get(fb);
>  	}
>  
>  out:
> -- 
> 2.16.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH 15/23] drm: Stop updating plane->crtc/fb/old_fb on atomic drivers
  2018-03-22 15:23 ` [PATCH 15/23] drm: Stop updating plane->crtc/fb/old_fb on atomic drivers Ville Syrjala
  2018-03-26 20:52   ` Daniel Vetter
@ 2018-03-27  7:57   ` Daniel Vetter
  2018-03-27  9:44     ` [Intel-gfx] " Ville Syrjälä
  1 sibling, 1 reply; 74+ messages in thread
From: Daniel Vetter @ 2018-03-27  7:57 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: intel-gfx, dri-devel

On Thu, Mar 22, 2018 at 05:23:05PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Stop playing around with plane->crtc/fb/old_fb with atomic
> drivers. Make life a lot simpler when we don't have to do the
> magic old_fb vs. fb dance around plane updates. That way we
> can't risk plane->fb getting out of sync with plane->state->fb
> and we're less likely to leak any refcounts as well.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

What's the reason for this patch being in the middle of the patch series?
I figured it's savest if we put this at the end? If you need parts of this
here, we definitely need to split out the WARN_ON hunk, since you haven't
fixed up everything yet at this point here.
-Daniel

> ---
>  drivers/gpu/drm/drm_atomic.c        | 55 ++++---------------------------------
>  drivers/gpu/drm/drm_atomic_helper.c | 15 +---------
>  drivers/gpu/drm/drm_crtc.c          |  8 ++++--
>  drivers/gpu/drm/drm_fb_helper.c     |  7 -----
>  drivers/gpu/drm/drm_framebuffer.c   |  5 ----
>  drivers/gpu/drm/drm_plane.c         | 14 ++++++----
>  drivers/gpu/drm/drm_plane_helper.c  |  4 ++-
>  include/drm/drm_atomic.h            |  3 --
>  8 files changed, 24 insertions(+), 87 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 7d25c42f22db..b16cc37e2adf 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -692,6 +692,11 @@ drm_atomic_get_plane_state(struct drm_atomic_state *state,
>  
>  	WARN_ON(!state->acquire_ctx);
>  
> +	/* the legacy pointers should never be set */
> +	WARN_ON(plane->fb);
> +	WARN_ON(plane->old_fb);
> +	WARN_ON(plane->crtc);
> +
>  	plane_state = drm_atomic_get_existing_plane_state(state, plane);
>  	if (plane_state)
>  		return plane_state;
> @@ -2021,45 +2026,6 @@ int drm_atomic_set_property(struct drm_atomic_state *state,
>  	return ret;
>  }
>  
> -/**
> - * drm_atomic_clean_old_fb -- Unset old_fb pointers and set plane->fb pointers.
> - *
> - * @dev: drm device to check.
> - * @plane_mask: plane mask for planes that were updated.
> - * @ret: return value, can be -EDEADLK for a retry.
> - *
> - * Before doing an update &drm_plane.old_fb is set to &drm_plane.fb, but before
> - * dropping the locks old_fb needs to be set to NULL and plane->fb updated. This
> - * is a common operation for each atomic update, so this call is split off as a
> - * helper.
> - */
> -void drm_atomic_clean_old_fb(struct drm_device *dev,
> -			     unsigned plane_mask,
> -			     int ret)
> -{
> -	struct drm_plane *plane;
> -
> -	/* if succeeded, fixup legacy plane crtc/fb ptrs before dropping
> -	 * locks (ie. while it is still safe to deref plane->state).  We
> -	 * need to do this here because the driver entry points cannot
> -	 * distinguish between legacy and atomic ioctls.
> -	 */
> -	drm_for_each_plane_mask(plane, dev, plane_mask) {
> -		if (ret == 0) {
> -			struct drm_framebuffer *new_fb = plane->state->fb;
> -			if (new_fb)
> -				drm_framebuffer_get(new_fb);
> -			plane->fb = new_fb;
> -			plane->crtc = plane->state->crtc;
> -
> -			if (plane->old_fb)
> -				drm_framebuffer_put(plane->old_fb);
> -		}
> -		plane->old_fb = NULL;
> -	}
> -}
> -EXPORT_SYMBOL(drm_atomic_clean_old_fb);
> -
>  /**
>   * DOC: explicit fencing properties
>   *
> @@ -2280,9 +2246,7 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
>  	unsigned int copied_objs, copied_props;
>  	struct drm_atomic_state *state;
>  	struct drm_modeset_acquire_ctx ctx;
> -	struct drm_plane *plane;
>  	struct drm_out_fence_state *fence_state;
> -	unsigned plane_mask;
>  	int ret = 0;
>  	unsigned int i, j, num_fences;
>  
> @@ -2322,7 +2286,6 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
>  	state->allow_modeset = !!(arg->flags & DRM_MODE_ATOMIC_ALLOW_MODESET);
>  
>  retry:
> -	plane_mask = 0;
>  	copied_objs = 0;
>  	copied_props = 0;
>  	fence_state = NULL;
> @@ -2393,12 +2356,6 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
>  			copied_props++;
>  		}
>  
> -		if (obj->type == DRM_MODE_OBJECT_PLANE && count_props &&
> -		    !(arg->flags & DRM_MODE_ATOMIC_TEST_ONLY)) {
> -			plane = obj_to_plane(obj);
> -			plane_mask |= (1 << drm_plane_index(plane));
> -			plane->old_fb = plane->fb;
> -		}
>  		drm_mode_object_put(obj);
>  	}
>  
> @@ -2419,8 +2376,6 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
>  	}
>  
>  out:
> -	drm_atomic_clean_old_fb(dev, plane_mask, ret);
> -
>  	complete_crtc_signaling(dev, state, fence_state, num_fences, !ret);
>  
>  	if (ret == -EDEADLK) {
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index 0e806f070d00..d42d88b97396 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -2892,7 +2892,6 @@ static int __drm_atomic_helper_disable_all(struct drm_device *dev,
>  	struct drm_plane *plane;
>  	struct drm_crtc_state *crtc_state;
>  	struct drm_crtc *crtc;
> -	unsigned int plane_mask = 0;
>  	int ret, i;
>  
>  	state = drm_atomic_state_alloc(dev);
> @@ -2935,17 +2934,10 @@ static int __drm_atomic_helper_disable_all(struct drm_device *dev,
>  			goto free;
>  
>  		drm_atomic_set_fb_for_plane(plane_state, NULL);
> -
> -		if (clean_old_fbs) {
> -			plane->old_fb = plane->fb;
> -			plane_mask |= BIT(drm_plane_index(plane));
> -		}
>  	}
>  
>  	ret = drm_atomic_commit(state);
>  free:
> -	drm_atomic_clean_old_fb(dev, plane_mask, ret);
> -
>  	drm_atomic_state_put(state);
>  	return ret;
>  }
> @@ -3106,13 +3098,8 @@ int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state,
>  
>  	state->acquire_ctx = ctx;
>  
> -	for_each_new_plane_in_state(state, plane, new_plane_state, i) {
> -		WARN_ON(plane->crtc != new_plane_state->crtc);
> -		WARN_ON(plane->fb != new_plane_state->fb);
> -		WARN_ON(plane->old_fb);
> -
> +	for_each_new_plane_in_state(state, plane, new_plane_state, i)
>  		state->planes[i].old_state = plane->state;
> -	}
>  
>  	for_each_new_crtc_in_state(state, crtc, new_crtc_state, i)
>  		state->crtcs[i].old_state = crtc->state;
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index a231dd5dce16..4e3c1a8d118a 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -474,8 +474,12 @@ static int __drm_mode_set_config_internal(struct drm_mode_set *set,
>  
>  	ret = crtc->funcs->set_config(set, ctx);
>  	if (ret == 0) {
> -		crtc->primary->crtc = fb ? crtc : NULL;
> -		crtc->primary->fb = fb;
> +		struct drm_plane *plane = crtc->primary;
> +
> +		if (!plane->state) {
> +			plane->crtc = fb ? crtc : NULL;
> +			plane->fb = fb;
> +		}
>  	}
>  
>  	drm_for_each_crtc(tmp, crtc->dev) {
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index 0646b108030b..5639e804a0cd 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -368,7 +368,6 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper *fb_helper, bool activ
>  	struct drm_plane *plane;
>  	struct drm_atomic_state *state;
>  	int i, ret;
> -	unsigned int plane_mask;
>  	struct drm_modeset_acquire_ctx ctx;
>  
>  	drm_modeset_acquire_init(&ctx, 0);
> @@ -381,7 +380,6 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper *fb_helper, bool activ
>  
>  	state->acquire_ctx = &ctx;
>  retry:
> -	plane_mask = 0;
>  	drm_for_each_plane(plane, dev) {
>  		plane_state = drm_atomic_get_plane_state(state, plane);
>  		if (IS_ERR(plane_state)) {
> @@ -391,9 +389,6 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper *fb_helper, bool activ
>  
>  		plane_state->rotation = DRM_MODE_ROTATE_0;
>  
> -		plane->old_fb = plane->fb;
> -		plane_mask |= 1 << drm_plane_index(plane);
> -
>  		/* disable non-primary: */
>  		if (plane->type == DRM_PLANE_TYPE_PRIMARY)
>  			continue;
> @@ -430,8 +425,6 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper *fb_helper, bool activ
>  	ret = drm_atomic_commit(state);
>  
>  out_state:
> -	drm_atomic_clean_old_fb(dev, plane_mask, ret);
> -
>  	if (ret == -EDEADLK)
>  		goto backoff;
>  
> diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
> index ad67203de715..421a77c2a4ac 100644
> --- a/drivers/gpu/drm/drm_framebuffer.c
> +++ b/drivers/gpu/drm/drm_framebuffer.c
> @@ -835,8 +835,6 @@ static int atomic_remove_fb(struct drm_framebuffer *fb)
>  			goto unlock;
>  
>  		plane_mask |= BIT(drm_plane_index(plane));
> -
> -		plane->old_fb = plane->fb;
>  	}
>  
>  	/* This list is only filled when disable_crtcs is set. */
> @@ -851,9 +849,6 @@ static int atomic_remove_fb(struct drm_framebuffer *fb)
>  		ret = drm_atomic_commit(state);
>  
>  unlock:
> -	if (plane_mask)
> -		drm_atomic_clean_old_fb(dev, plane_mask, ret);
> -
>  	if (ret == -EDEADLK) {
>  		drm_atomic_state_clear(state);
>  		drm_modeset_backoff(&ctx);
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index 035054455301..143041666096 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -650,9 +650,11 @@ static int __setplane_internal(struct drm_plane *plane,
>  					 crtc_x, crtc_y, crtc_w, crtc_h,
>  					 src_x, src_y, src_w, src_h, ctx);
>  	if (!ret) {
> -		plane->crtc = crtc;
> -		plane->fb = fb;
> -		drm_framebuffer_get(plane->fb);
> +		if (!plane->state) {
> +			plane->crtc = crtc;
> +			plane->fb = fb;
> +			drm_framebuffer_get(plane->fb);
> +		}
>  	} else {
>  		plane->old_fb = NULL;
>  	}
> @@ -1092,8 +1094,10 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
>  		/* Keep the old fb, don't unref it. */
>  		plane->old_fb = NULL;
>  	} else {
> -		plane->fb = fb;
> -		drm_framebuffer_get(fb);
> +		if (!plane->state) {
> +			plane->fb = fb;
> +			drm_framebuffer_get(fb);
> +		}
>  	}
>  
>  out:
> diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
> index f88f68161519..2010794943bc 100644
> --- a/drivers/gpu/drm/drm_plane_helper.c
> +++ b/drivers/gpu/drm/drm_plane_helper.c
> @@ -502,6 +502,7 @@ EXPORT_SYMBOL(drm_plane_helper_update);
>  int drm_plane_helper_disable(struct drm_plane *plane)
>  {
>  	struct drm_plane_state *plane_state;
> +	struct drm_framebuffer *old_fb;
>  
>  	/* crtc helpers love to call disable functions for already disabled hw
>  	 * functions. So cope with that. */
> @@ -521,8 +522,9 @@ int drm_plane_helper_disable(struct drm_plane *plane)
>  	plane_state->plane = plane;
>  
>  	plane_state->crtc = NULL;
> +	old_fb = plane_state->fb;
>  	drm_atomic_set_fb_for_plane(plane_state, NULL);
>  
> -	return drm_plane_helper_commit(plane, plane_state, plane->fb);
> +	return drm_plane_helper_commit(plane, plane_state, old_fb);
>  }
>  EXPORT_SYMBOL(drm_plane_helper_disable);
> diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
> index a57a8aa90ffb..ca461b6cf71f 100644
> --- a/include/drm/drm_atomic.h
> +++ b/include/drm/drm_atomic.h
> @@ -601,9 +601,6 @@ int __must_check
>  drm_atomic_add_affected_planes(struct drm_atomic_state *state,
>  			       struct drm_crtc *crtc);
>  
> -void
> -drm_atomic_clean_old_fb(struct drm_device *dev, unsigned plane_mask, int ret);
> -
>  int __must_check drm_atomic_check_only(struct drm_atomic_state *state);
>  int __must_check drm_atomic_commit(struct drm_atomic_state *state);
>  int __must_check drm_atomic_nonblocking_commit(struct drm_atomic_state *state);
> -- 
> 2.16.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH 08/23] drm: Use plane->state->fb over plane->fb
  2018-03-22 15:22 ` [PATCH 08/23] drm: Use plane->state->fb over plane->fb Ville Syrjala
@ 2018-03-27  8:10   ` Daniel Vetter
  0 siblings, 0 replies; 74+ messages in thread
From: Daniel Vetter @ 2018-03-27  8:10 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: intel-gfx, dri-devel

On Thu, Mar 22, 2018 at 05:22:58PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Stop looking at plane->fb on atomic drivers. Use plane->state->fb
> instead.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
>  drivers/gpu/drm/drm_atomic_helper.c |  2 +-
>  drivers/gpu/drm/drm_crtc.c          | 11 +++++++++--
>  drivers/gpu/drm/drm_plane.c         | 19 ++++++++++++++-----
>  3 files changed, 24 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index 1b39ebf2be2e..0e806f070d00 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -2659,7 +2659,7 @@ int drm_atomic_helper_disable_plane(struct drm_plane *plane,
>  		goto fail;
>  	}
>  
> -	if (plane_state->crtc && (plane == plane->crtc->cursor))
> +	if (plane_state->crtc && plane_state->crtc->cursor == plane)
>  		plane_state->state->legacy_cursor_update = true;
>  
>  	ret = __drm_atomic_helper_disable_plane(plane, plane_state);
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 537ffaab855c..a231dd5dce16 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -597,13 +597,20 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
>  		/* If we have a mode we need a framebuffer. */
>  		/* If we pass -1, set the mode with the currently bound fb */
>  		if (crtc_req->fb_id == -1) {
> -			if (!plane->fb) {
> +			struct drm_framebuffer *old_fb;
> +
> +			if (plane->state)
> +				old_fb = plane->state->fb;
> +			else
> +				old_fb = plane->fb;
> +
> +			if (!old_fb) {
>  				DRM_DEBUG_KMS("CRTC doesn't have current FB\n");
>  				ret = -EINVAL;
>  				goto out;
>  			}
>  
> -			fb = plane->fb;
> +			fb = old_fb;
>  			/* Make refcounting symmetric with the lookup path. */
>  			drm_framebuffer_get(fb);
>  		} else {
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index 008f9456a5e8..035054455301 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -792,7 +792,11 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc,
>  			fb = NULL;
>  		}
>  	} else {
> -		fb = plane->fb;
> +		if (plane->state)
> +			fb = plane->state->fb;
> +		else
> +			fb = plane->fb;
> +
>  		if (fb)
>  			drm_framebuffer_get(fb);
>  	}
> @@ -934,7 +938,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
>  	struct drm_mode_crtc_page_flip_target *page_flip = data;
>  	struct drm_crtc *crtc;
>  	struct drm_plane *plane;
> -	struct drm_framebuffer *fb = NULL;
> +	struct drm_framebuffer *fb = NULL, *old_fb;
>  	struct drm_pending_vblank_event *e = NULL;
>  	u32 target_vblank = page_flip->sequence;
>  	struct drm_modeset_acquire_ctx ctx;
> @@ -1012,7 +1016,12 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
>  	if (ret)
>  		goto out;
>  
> -	if (plane->fb == NULL) {
> +	if (plane->state)
> +		old_fb = plane->state->fb;
> +	else
> +		old_fb = plane->fb;
> +
> +	if (old_fb == NULL) {
>  		/* The framebuffer is currently unbound, presumably
>  		 * due to a hotplug event, that userspace has not
>  		 * yet discovered.
> @@ -1027,7 +1036,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
>  		goto out;
>  	}
>  
> -	if (crtc->state) {
> +	if (plane->state) {
>  		const struct drm_plane_state *state = plane->state;
>  
>  		ret = drm_framebuffer_check_src_coords(state->src_x,
> @@ -1042,7 +1051,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
>  	if (ret)
>  		goto out;
>  
> -	if (plane->fb->format != fb->format) {
> +	if (old_fb->format != fb->format) {
>  		DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
>  		ret = -EINVAL;
>  		goto out;
> -- 
> 2.16.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH 14/23] drm/atmel-hlcdc: Stop using plane->fb
  2018-03-22 15:23 ` [PATCH 14/23] drm/atmel-hlcdc: Stop using plane->fb Ville Syrjala
  2018-03-22 16:14   ` Maarten Lankhorst
@ 2018-03-27  8:13   ` Daniel Vetter
  1 sibling, 0 replies; 74+ messages in thread
From: Daniel Vetter @ 2018-03-27  8:13 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: Boris Brezillon, intel-gfx, dri-devel

On Thu, Mar 22, 2018 at 05:23:04PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> We want to get rid of plane->fb on atomic drivers. Stop looking at it.
> 
> Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 12 +-----------
>  1 file changed, 1 insertion(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> index e18800ed7cd1..0dd9fb617c28 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> @@ -819,16 +819,6 @@ static void atmel_hlcdc_plane_atomic_disable(struct drm_plane *p,
>  	atmel_hlcdc_layer_read_reg(&plane->layer, ATMEL_HLCDC_LAYER_ISR);
>  }
>  
> -static void atmel_hlcdc_plane_destroy(struct drm_plane *p)
> -{
> -	struct atmel_hlcdc_plane *plane = drm_plane_to_atmel_hlcdc_plane(p);
> -
> -	if (plane->base.fb)
> -		drm_framebuffer_put(plane->base.fb);
> -
> -	drm_plane_cleanup(p);
> -}

This looks like refcount leak duct-tape due to lack of
drm_atomic_helper_shutdown() in atmel. If you just apply this I think
you'll start leaking.

We need a patch here to add the shutdown call instead.
-Daniel

> -
>  static int atmel_hlcdc_plane_atomic_set_property(struct drm_plane *p,
>  						 struct drm_plane_state *s,
>  						 struct drm_property *property,
> @@ -1038,7 +1028,7 @@ static void atmel_hlcdc_plane_atomic_destroy_state(struct drm_plane *p,
>  static const struct drm_plane_funcs layer_plane_funcs = {
>  	.update_plane = drm_atomic_helper_update_plane,
>  	.disable_plane = drm_atomic_helper_disable_plane,
> -	.destroy = atmel_hlcdc_plane_destroy,
> +	.destroy = drm_plane_cleanup,
>  	.reset = atmel_hlcdc_plane_reset,
>  	.atomic_duplicate_state = atmel_hlcdc_plane_atomic_duplicate_state,
>  	.atomic_destroy_state = atmel_hlcdc_plane_atomic_destroy_state,
> -- 
> 2.16.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers
       [not found] ` <20180322152313.6561-1-ville.syrjala-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
  2018-03-22 15:23   ` [PATCH 10/23] drm/msm: Stop consulting plane->fb Ville Syrjala
  2018-03-22 15:23   ` [PATCH 19/23] drm/msm: Stop updating plane->fb/crtc Ville Syrjala
@ 2018-03-27  8:21   ` Daniel Vetter
  2 siblings, 0 replies; 74+ messages in thread
From: Daniel Vetter @ 2018-03-27  8:21 UTC (permalink / raw)
  To: Ville Syrjala
  Cc: David Airlie, Daniel Vetter,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	chris-Y6uKTt2uX1cEflXRtASbqLVCufUGDwFn, Eric Anholt,
	Gerd Hoffmann, Benjamin Gaignard, Dave Airlie, Boris Brezillon,
	Thomas Hellstrom, Joonyoung Shim, Sinclair Yeh, Rob Clark,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	martin.peres-GANU6spQydw, VMware Graphics, Harry Wentland,
	David (ChunMing) Zhou, linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Maarten Lankhorst,
	Inki Dae,
	virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA, Vin

On Thu, Mar 22, 2018 at 05:22:50PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> I really just wanted to fix i915 to re-enable its planes afer load
> detection (a two line patch). This is what I actually ended up with
> after I ran into a framebuffer refcount leak with said two line patch.
> 
> I've tested this on a few i915 boxes and so far it's looking
> good. Everything else is just compile tested.
> 
> Entire series available here:
> git://github.com/vsyrjala/linux.git plane_fb_crtc_nuke
> 
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
> Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
> Cc: chris@chris-wilson.co.uk
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Dave Airlie <airlied@gmail.com>
> Cc: David Airlie <airlied@linux.ie>
> Cc: "David (ChunMing) Zhou" <David1.Zhou@amd.com>
> Cc: Eric Anholt <eric@anholt.net>
> Cc: freedreno@lists.freedesktop.org
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Harry Wentland <harry.wentland@amd.com>
> Cc: Inki Dae <inki.dae@samsung.com>
> Cc: Joonyoung Shim <jy0922.shim@samsung.com>
> Cc: Kyungmin Park <kyungmin.park@samsung.com>
> Cc: linux-arm-msm@vger.kernel.org
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: martin.peres@free.fr
> Cc: Rob Clark <robdclark@gmail.com>
> Cc: Seung-Woo Kim <sw0312.kim@samsung.com>
> Cc: Shawn Guo <shawnguo@kernel.org>
> Cc: Sinclair Yeh <syeh@vmware.com>
> Cc: Thomas Hellstrom <thellstrom@vmware.com>
> Cc: Vincent Abriou <vincent.abriou@st.com>
> Cc: virtualization@lists.linux-foundation.org
> Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>
> 
> Ville Syrjälä (23):
>   Revert "drm/atomic-helper: Fix leak in disable_all"
>   drm/atomic-helper: Make drm_atomic_helper_disable_all() update the
>     plane->fb pointers
>   drm: Clear crtc->primary->crtc when disabling the crtc via setcrtc()
>   drm/atomic-helper: WARN if legacy plane fb pointers are bogus when
>     committing duplicated state
>   drm: Add local 'plane' variable for primary/cursor planes
>   drm: Adjust whitespace for legibility
>   drm: Make the fb refcount handover less magic
>   drm: Use plane->state->fb over plane->fb
>   drm/i915: Stop consulting plane->fb
>   drm/msm: Stop consulting plane->fb
>   drm/sti: Stop consulting plane->fb
>   drm/vmwgfx: Stop consulting plane->fb
>   drm/zte: Stop consulting plane->fb
>   drm/atmel-hlcdc: Stop using plane->fb
>   drm: Stop updating plane->crtc/fb/old_fb on atomic drivers
>   drm/amdgpu/dc: Stop updating plane->fb
>   drm/i915: Stop updating plane->fb/crtc
>   drm/exynos: Stop updating plane->crtc
>   drm/msm: Stop updating plane->fb/crtc
>   drm/virtio: Stop updating plane->fb
>   drm/vc4: Stop updating plane->fb/crtc
>   drm/i915: Restore planes after load detection
>   drm/i915: Make force_load_detect effective even w/ DMI quirks/hotplug

Ok, I reviewed the core patches, looks all good.

Also starting auditing all the drivers. I think there's some small
oversights in there, and I need to update my grep foo a bit, but by and
large looks all reasonable.

Imo we should start merging, that will also make the auditing easier.
-Daniel

> 
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  2 -
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c   | 12 +---
>  drivers/gpu/drm/drm_atomic.c                      | 55 ++--------------
>  drivers/gpu/drm/drm_atomic_helper.c               | 79 ++++++++++-------------
>  drivers/gpu/drm/drm_crtc.c                        | 51 ++++++++++-----
>  drivers/gpu/drm/drm_fb_helper.c                   |  7 --
>  drivers/gpu/drm/drm_framebuffer.c                 |  5 --
>  drivers/gpu/drm/drm_plane.c                       | 64 +++++++++++-------
>  drivers/gpu/drm/drm_plane_helper.c                |  4 +-
>  drivers/gpu/drm/exynos/exynos_drm_plane.c         |  2 -
>  drivers/gpu/drm/i915/intel_crt.c                  |  6 ++
>  drivers/gpu/drm/i915/intel_display.c              |  9 +--
>  drivers/gpu/drm/i915/intel_fbdev.c                |  2 +-
>  drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c         |  3 +-
>  drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c        |  2 -
>  drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c        |  2 -
>  drivers/gpu/drm/sti/sti_plane.c                   |  9 +--
>  drivers/gpu/drm/vc4/vc4_crtc.c                    |  3 -
>  drivers/gpu/drm/virtio/virtgpu_display.c          |  2 -
>  drivers/gpu/drm/vmwgfx/vmwgfx_kms.c               |  6 +-
>  drivers/gpu/drm/zte/zx_vou.c                      |  2 +-
>  include/drm/drm_atomic.h                          |  3 -
>  22 files changed, 143 insertions(+), 187 deletions(-)
> 
> -- 
> 2.16.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

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

* Re: [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers
  2018-03-22 15:22 [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Ville Syrjala
                   ` (33 preceding siblings ...)
       [not found] ` <20180322152313.6561-1-ville.syrjala-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
@ 2018-03-27  8:21 ` Daniel Vetter
  34 siblings, 0 replies; 74+ messages in thread
From: Daniel Vetter @ 2018-03-27  8:21 UTC (permalink / raw)
  To: Ville Syrjala
  Cc: David Airlie, Daniel Vetter, dri-devel, chris, Eric Anholt,
	Benjamin Gaignard, Dave Airlie, Boris Brezillon,
	Thomas Hellstrom, Joonyoung Shim, Sinclair Yeh, Rob Clark,
	amd-gfx, martin.peres, VMware Graphics, Harry Wentland,
	David (ChunMing) Zhou, linux-arm-msm, intel-gfx,
	Maarten Lankhorst, Inki Dae, virtualization, Vincent Abriou

On Thu, Mar 22, 2018 at 05:22:50PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> I really just wanted to fix i915 to re-enable its planes afer load
> detection (a two line patch). This is what I actually ended up with
> after I ran into a framebuffer refcount leak with said two line patch.
> 
> I've tested this on a few i915 boxes and so far it's looking
> good. Everything else is just compile tested.
> 
> Entire series available here:
> git://github.com/vsyrjala/linux.git plane_fb_crtc_nuke
> 
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
> Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
> Cc: chris@chris-wilson.co.uk
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Dave Airlie <airlied@gmail.com>
> Cc: David Airlie <airlied@linux.ie>
> Cc: "David (ChunMing) Zhou" <David1.Zhou@amd.com>
> Cc: Eric Anholt <eric@anholt.net>
> Cc: freedreno@lists.freedesktop.org
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Harry Wentland <harry.wentland@amd.com>
> Cc: Inki Dae <inki.dae@samsung.com>
> Cc: Joonyoung Shim <jy0922.shim@samsung.com>
> Cc: Kyungmin Park <kyungmin.park@samsung.com>
> Cc: linux-arm-msm@vger.kernel.org
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: martin.peres@free.fr
> Cc: Rob Clark <robdclark@gmail.com>
> Cc: Seung-Woo Kim <sw0312.kim@samsung.com>
> Cc: Shawn Guo <shawnguo@kernel.org>
> Cc: Sinclair Yeh <syeh@vmware.com>
> Cc: Thomas Hellstrom <thellstrom@vmware.com>
> Cc: Vincent Abriou <vincent.abriou@st.com>
> Cc: virtualization@lists.linux-foundation.org
> Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>
> 
> Ville Syrjälä (23):
>   Revert "drm/atomic-helper: Fix leak in disable_all"
>   drm/atomic-helper: Make drm_atomic_helper_disable_all() update the
>     plane->fb pointers
>   drm: Clear crtc->primary->crtc when disabling the crtc via setcrtc()
>   drm/atomic-helper: WARN if legacy plane fb pointers are bogus when
>     committing duplicated state
>   drm: Add local 'plane' variable for primary/cursor planes
>   drm: Adjust whitespace for legibility
>   drm: Make the fb refcount handover less magic
>   drm: Use plane->state->fb over plane->fb
>   drm/i915: Stop consulting plane->fb
>   drm/msm: Stop consulting plane->fb
>   drm/sti: Stop consulting plane->fb
>   drm/vmwgfx: Stop consulting plane->fb
>   drm/zte: Stop consulting plane->fb
>   drm/atmel-hlcdc: Stop using plane->fb
>   drm: Stop updating plane->crtc/fb/old_fb on atomic drivers
>   drm/amdgpu/dc: Stop updating plane->fb
>   drm/i915: Stop updating plane->fb/crtc
>   drm/exynos: Stop updating plane->crtc
>   drm/msm: Stop updating plane->fb/crtc
>   drm/virtio: Stop updating plane->fb
>   drm/vc4: Stop updating plane->fb/crtc
>   drm/i915: Restore planes after load detection
>   drm/i915: Make force_load_detect effective even w/ DMI quirks/hotplug

Ok, I reviewed the core patches, looks all good.

Also starting auditing all the drivers. I think there's some small
oversights in there, and I need to update my grep foo a bit, but by and
large looks all reasonable.

Imo we should start merging, that will also make the auditing easier.
-Daniel

> 
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  2 -
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c   | 12 +---
>  drivers/gpu/drm/drm_atomic.c                      | 55 ++--------------
>  drivers/gpu/drm/drm_atomic_helper.c               | 79 ++++++++++-------------
>  drivers/gpu/drm/drm_crtc.c                        | 51 ++++++++++-----
>  drivers/gpu/drm/drm_fb_helper.c                   |  7 --
>  drivers/gpu/drm/drm_framebuffer.c                 |  5 --
>  drivers/gpu/drm/drm_plane.c                       | 64 +++++++++++-------
>  drivers/gpu/drm/drm_plane_helper.c                |  4 +-
>  drivers/gpu/drm/exynos/exynos_drm_plane.c         |  2 -
>  drivers/gpu/drm/i915/intel_crt.c                  |  6 ++
>  drivers/gpu/drm/i915/intel_display.c              |  9 +--
>  drivers/gpu/drm/i915/intel_fbdev.c                |  2 +-
>  drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c         |  3 +-
>  drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c        |  2 -
>  drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c        |  2 -
>  drivers/gpu/drm/sti/sti_plane.c                   |  9 +--
>  drivers/gpu/drm/vc4/vc4_crtc.c                    |  3 -
>  drivers/gpu/drm/virtio/virtgpu_display.c          |  2 -
>  drivers/gpu/drm/vmwgfx/vmwgfx_kms.c               |  6 +-
>  drivers/gpu/drm/zte/zx_vou.c                      |  2 +-
>  include/drm/drm_atomic.h                          |  3 -
>  22 files changed, 143 insertions(+), 187 deletions(-)
> 
> -- 
> 2.16.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

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

* Re: [Intel-gfx] [PATCH 15/23] drm: Stop updating plane->crtc/fb/old_fb on atomic drivers
  2018-03-27  7:57   ` Daniel Vetter
@ 2018-03-27  9:44     ` Ville Syrjälä
  0 siblings, 0 replies; 74+ messages in thread
From: Ville Syrjälä @ 2018-03-27  9:44 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: intel-gfx, dri-devel

On Tue, Mar 27, 2018 at 09:57:41AM +0200, Daniel Vetter wrote:
> On Thu, Mar 22, 2018 at 05:23:05PM +0200, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Stop playing around with plane->crtc/fb/old_fb with atomic
> > drivers. Make life a lot simpler when we don't have to do the
> > magic old_fb vs. fb dance around plane updates. That way we
> > can't risk plane->fb getting out of sync with plane->state->fb
> > and we're less likely to leak any refcounts as well.
> > 
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> What's the reason for this patch being in the middle of the patch series?
> I figured it's savest if we put this at the end? If you need parts of this
> here, we definitely need to split out the WARN_ON hunk, since you haven't
> fixed up everything yet at this point here.

Yeah, the ordering is probably not great. I think I had some idea why
I had to do "cleanup drivers a bit, do core/helper stuff, cleanup some
more drivers, do other core/helper stuff". But I can't even recall that
reason now. Most likely I had just managed to confuse myself by that
time.

> -Daniel
> 
> > ---
> >  drivers/gpu/drm/drm_atomic.c        | 55 ++++---------------------------------
> >  drivers/gpu/drm/drm_atomic_helper.c | 15 +---------
> >  drivers/gpu/drm/drm_crtc.c          |  8 ++++--
> >  drivers/gpu/drm/drm_fb_helper.c     |  7 -----
> >  drivers/gpu/drm/drm_framebuffer.c   |  5 ----
> >  drivers/gpu/drm/drm_plane.c         | 14 ++++++----
> >  drivers/gpu/drm/drm_plane_helper.c  |  4 ++-
> >  include/drm/drm_atomic.h            |  3 --
> >  8 files changed, 24 insertions(+), 87 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> > index 7d25c42f22db..b16cc37e2adf 100644
> > --- a/drivers/gpu/drm/drm_atomic.c
> > +++ b/drivers/gpu/drm/drm_atomic.c
> > @@ -692,6 +692,11 @@ drm_atomic_get_plane_state(struct drm_atomic_state *state,
> >  
> >  	WARN_ON(!state->acquire_ctx);
> >  
> > +	/* the legacy pointers should never be set */
> > +	WARN_ON(plane->fb);
> > +	WARN_ON(plane->old_fb);
> > +	WARN_ON(plane->crtc);
> > +
> >  	plane_state = drm_atomic_get_existing_plane_state(state, plane);
> >  	if (plane_state)
> >  		return plane_state;
> > @@ -2021,45 +2026,6 @@ int drm_atomic_set_property(struct drm_atomic_state *state,
> >  	return ret;
> >  }
> >  
> > -/**
> > - * drm_atomic_clean_old_fb -- Unset old_fb pointers and set plane->fb pointers.
> > - *
> > - * @dev: drm device to check.
> > - * @plane_mask: plane mask for planes that were updated.
> > - * @ret: return value, can be -EDEADLK for a retry.
> > - *
> > - * Before doing an update &drm_plane.old_fb is set to &drm_plane.fb, but before
> > - * dropping the locks old_fb needs to be set to NULL and plane->fb updated. This
> > - * is a common operation for each atomic update, so this call is split off as a
> > - * helper.
> > - */
> > -void drm_atomic_clean_old_fb(struct drm_device *dev,
> > -			     unsigned plane_mask,
> > -			     int ret)
> > -{
> > -	struct drm_plane *plane;
> > -
> > -	/* if succeeded, fixup legacy plane crtc/fb ptrs before dropping
> > -	 * locks (ie. while it is still safe to deref plane->state).  We
> > -	 * need to do this here because the driver entry points cannot
> > -	 * distinguish between legacy and atomic ioctls.
> > -	 */
> > -	drm_for_each_plane_mask(plane, dev, plane_mask) {
> > -		if (ret == 0) {
> > -			struct drm_framebuffer *new_fb = plane->state->fb;
> > -			if (new_fb)
> > -				drm_framebuffer_get(new_fb);
> > -			plane->fb = new_fb;
> > -			plane->crtc = plane->state->crtc;
> > -
> > -			if (plane->old_fb)
> > -				drm_framebuffer_put(plane->old_fb);
> > -		}
> > -		plane->old_fb = NULL;
> > -	}
> > -}
> > -EXPORT_SYMBOL(drm_atomic_clean_old_fb);
> > -
> >  /**
> >   * DOC: explicit fencing properties
> >   *
> > @@ -2280,9 +2246,7 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
> >  	unsigned int copied_objs, copied_props;
> >  	struct drm_atomic_state *state;
> >  	struct drm_modeset_acquire_ctx ctx;
> > -	struct drm_plane *plane;
> >  	struct drm_out_fence_state *fence_state;
> > -	unsigned plane_mask;
> >  	int ret = 0;
> >  	unsigned int i, j, num_fences;
> >  
> > @@ -2322,7 +2286,6 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
> >  	state->allow_modeset = !!(arg->flags & DRM_MODE_ATOMIC_ALLOW_MODESET);
> >  
> >  retry:
> > -	plane_mask = 0;
> >  	copied_objs = 0;
> >  	copied_props = 0;
> >  	fence_state = NULL;
> > @@ -2393,12 +2356,6 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
> >  			copied_props++;
> >  		}
> >  
> > -		if (obj->type == DRM_MODE_OBJECT_PLANE && count_props &&
> > -		    !(arg->flags & DRM_MODE_ATOMIC_TEST_ONLY)) {
> > -			plane = obj_to_plane(obj);
> > -			plane_mask |= (1 << drm_plane_index(plane));
> > -			plane->old_fb = plane->fb;
> > -		}
> >  		drm_mode_object_put(obj);
> >  	}
> >  
> > @@ -2419,8 +2376,6 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
> >  	}
> >  
> >  out:
> > -	drm_atomic_clean_old_fb(dev, plane_mask, ret);
> > -
> >  	complete_crtc_signaling(dev, state, fence_state, num_fences, !ret);
> >  
> >  	if (ret == -EDEADLK) {
> > diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> > index 0e806f070d00..d42d88b97396 100644
> > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > @@ -2892,7 +2892,6 @@ static int __drm_atomic_helper_disable_all(struct drm_device *dev,
> >  	struct drm_plane *plane;
> >  	struct drm_crtc_state *crtc_state;
> >  	struct drm_crtc *crtc;
> > -	unsigned int plane_mask = 0;
> >  	int ret, i;
> >  
> >  	state = drm_atomic_state_alloc(dev);
> > @@ -2935,17 +2934,10 @@ static int __drm_atomic_helper_disable_all(struct drm_device *dev,
> >  			goto free;
> >  
> >  		drm_atomic_set_fb_for_plane(plane_state, NULL);
> > -
> > -		if (clean_old_fbs) {
> > -			plane->old_fb = plane->fb;
> > -			plane_mask |= BIT(drm_plane_index(plane));
> > -		}
> >  	}
> >  
> >  	ret = drm_atomic_commit(state);
> >  free:
> > -	drm_atomic_clean_old_fb(dev, plane_mask, ret);
> > -
> >  	drm_atomic_state_put(state);
> >  	return ret;
> >  }
> > @@ -3106,13 +3098,8 @@ int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state,
> >  
> >  	state->acquire_ctx = ctx;
> >  
> > -	for_each_new_plane_in_state(state, plane, new_plane_state, i) {
> > -		WARN_ON(plane->crtc != new_plane_state->crtc);
> > -		WARN_ON(plane->fb != new_plane_state->fb);
> > -		WARN_ON(plane->old_fb);
> > -
> > +	for_each_new_plane_in_state(state, plane, new_plane_state, i)
> >  		state->planes[i].old_state = plane->state;
> > -	}
> >  
> >  	for_each_new_crtc_in_state(state, crtc, new_crtc_state, i)
> >  		state->crtcs[i].old_state = crtc->state;
> > diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> > index a231dd5dce16..4e3c1a8d118a 100644
> > --- a/drivers/gpu/drm/drm_crtc.c
> > +++ b/drivers/gpu/drm/drm_crtc.c
> > @@ -474,8 +474,12 @@ static int __drm_mode_set_config_internal(struct drm_mode_set *set,
> >  
> >  	ret = crtc->funcs->set_config(set, ctx);
> >  	if (ret == 0) {
> > -		crtc->primary->crtc = fb ? crtc : NULL;
> > -		crtc->primary->fb = fb;
> > +		struct drm_plane *plane = crtc->primary;
> > +
> > +		if (!plane->state) {
> > +			plane->crtc = fb ? crtc : NULL;
> > +			plane->fb = fb;
> > +		}
> >  	}
> >  
> >  	drm_for_each_crtc(tmp, crtc->dev) {
> > diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> > index 0646b108030b..5639e804a0cd 100644
> > --- a/drivers/gpu/drm/drm_fb_helper.c
> > +++ b/drivers/gpu/drm/drm_fb_helper.c
> > @@ -368,7 +368,6 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper *fb_helper, bool activ
> >  	struct drm_plane *plane;
> >  	struct drm_atomic_state *state;
> >  	int i, ret;
> > -	unsigned int plane_mask;
> >  	struct drm_modeset_acquire_ctx ctx;
> >  
> >  	drm_modeset_acquire_init(&ctx, 0);
> > @@ -381,7 +380,6 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper *fb_helper, bool activ
> >  
> >  	state->acquire_ctx = &ctx;
> >  retry:
> > -	plane_mask = 0;
> >  	drm_for_each_plane(plane, dev) {
> >  		plane_state = drm_atomic_get_plane_state(state, plane);
> >  		if (IS_ERR(plane_state)) {
> > @@ -391,9 +389,6 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper *fb_helper, bool activ
> >  
> >  		plane_state->rotation = DRM_MODE_ROTATE_0;
> >  
> > -		plane->old_fb = plane->fb;
> > -		plane_mask |= 1 << drm_plane_index(plane);
> > -
> >  		/* disable non-primary: */
> >  		if (plane->type == DRM_PLANE_TYPE_PRIMARY)
> >  			continue;
> > @@ -430,8 +425,6 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper *fb_helper, bool activ
> >  	ret = drm_atomic_commit(state);
> >  
> >  out_state:
> > -	drm_atomic_clean_old_fb(dev, plane_mask, ret);
> > -
> >  	if (ret == -EDEADLK)
> >  		goto backoff;
> >  
> > diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
> > index ad67203de715..421a77c2a4ac 100644
> > --- a/drivers/gpu/drm/drm_framebuffer.c
> > +++ b/drivers/gpu/drm/drm_framebuffer.c
> > @@ -835,8 +835,6 @@ static int atomic_remove_fb(struct drm_framebuffer *fb)
> >  			goto unlock;
> >  
> >  		plane_mask |= BIT(drm_plane_index(plane));
> > -
> > -		plane->old_fb = plane->fb;
> >  	}
> >  
> >  	/* This list is only filled when disable_crtcs is set. */
> > @@ -851,9 +849,6 @@ static int atomic_remove_fb(struct drm_framebuffer *fb)
> >  		ret = drm_atomic_commit(state);
> >  
> >  unlock:
> > -	if (plane_mask)
> > -		drm_atomic_clean_old_fb(dev, plane_mask, ret);
> > -
> >  	if (ret == -EDEADLK) {
> >  		drm_atomic_state_clear(state);
> >  		drm_modeset_backoff(&ctx);
> > diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> > index 035054455301..143041666096 100644
> > --- a/drivers/gpu/drm/drm_plane.c
> > +++ b/drivers/gpu/drm/drm_plane.c
> > @@ -650,9 +650,11 @@ static int __setplane_internal(struct drm_plane *plane,
> >  					 crtc_x, crtc_y, crtc_w, crtc_h,
> >  					 src_x, src_y, src_w, src_h, ctx);
> >  	if (!ret) {
> > -		plane->crtc = crtc;
> > -		plane->fb = fb;
> > -		drm_framebuffer_get(plane->fb);
> > +		if (!plane->state) {
> > +			plane->crtc = crtc;
> > +			plane->fb = fb;
> > +			drm_framebuffer_get(plane->fb);
> > +		}
> >  	} else {
> >  		plane->old_fb = NULL;
> >  	}
> > @@ -1092,8 +1094,10 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
> >  		/* Keep the old fb, don't unref it. */
> >  		plane->old_fb = NULL;
> >  	} else {
> > -		plane->fb = fb;
> > -		drm_framebuffer_get(fb);
> > +		if (!plane->state) {
> > +			plane->fb = fb;
> > +			drm_framebuffer_get(fb);
> > +		}
> >  	}
> >  
> >  out:
> > diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
> > index f88f68161519..2010794943bc 100644
> > --- a/drivers/gpu/drm/drm_plane_helper.c
> > +++ b/drivers/gpu/drm/drm_plane_helper.c
> > @@ -502,6 +502,7 @@ EXPORT_SYMBOL(drm_plane_helper_update);
> >  int drm_plane_helper_disable(struct drm_plane *plane)
> >  {
> >  	struct drm_plane_state *plane_state;
> > +	struct drm_framebuffer *old_fb;
> >  
> >  	/* crtc helpers love to call disable functions for already disabled hw
> >  	 * functions. So cope with that. */
> > @@ -521,8 +522,9 @@ int drm_plane_helper_disable(struct drm_plane *plane)
> >  	plane_state->plane = plane;
> >  
> >  	plane_state->crtc = NULL;
> > +	old_fb = plane_state->fb;
> >  	drm_atomic_set_fb_for_plane(plane_state, NULL);
> >  
> > -	return drm_plane_helper_commit(plane, plane_state, plane->fb);
> > +	return drm_plane_helper_commit(plane, plane_state, old_fb);
> >  }
> >  EXPORT_SYMBOL(drm_plane_helper_disable);
> > diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
> > index a57a8aa90ffb..ca461b6cf71f 100644
> > --- a/include/drm/drm_atomic.h
> > +++ b/include/drm/drm_atomic.h
> > @@ -601,9 +601,6 @@ int __must_check
> >  drm_atomic_add_affected_planes(struct drm_atomic_state *state,
> >  			       struct drm_crtc *crtc);
> >  
> > -void
> > -drm_atomic_clean_old_fb(struct drm_device *dev, unsigned plane_mask, int ret);
> > -
> >  int __must_check drm_atomic_check_only(struct drm_atomic_state *state);
> >  int __must_check drm_atomic_commit(struct drm_atomic_state *state);
> >  int __must_check drm_atomic_nonblocking_commit(struct drm_atomic_state *state);
> > -- 
> > 2.16.1
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 02/23] drm/atomic-helper: Make drm_atomic_helper_disable_all() update the plane->fb pointers
  2018-03-26 20:28   ` Daniel Vetter
@ 2018-03-29 16:32     ` Ville Syrjälä
  0 siblings, 0 replies; 74+ messages in thread
From: Ville Syrjälä @ 2018-03-29 16:32 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: Daniel Vetter, intel-gfx, dri-devel, martin.peres

On Mon, Mar 26, 2018 at 10:28:06PM +0200, Daniel Vetter wrote:
> On Thu, Mar 22, 2018 at 05:22:52PM +0200, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > drm_atomic_helper_shutdown() needs to release the reference held by
> > plane->fb, so we want to use drm_atomic_clean_old_fb() in
> > drm_atomic_helper_disable_all(). However during suspend/resume, gpu
> > reset and load detection we should probably leave that stuff alone,
> > as otherwise we'd have to make sure we put them back again when
> > we restore the duplicated state to the device. Seems simpler to me
> > to not touch any of it anyway.
> > 
> > v2: Don't inflict the clean_old_fbs bool to drivers (Daniel)
> > 
> > Cc: martin.peres@free.fr
> > Cc: chris@chris-wilson.co.uk
> > Cc: Dave Airlie <airlied@gmail.com> (v1)
> > Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> > Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> I think this would be cleaner diff to read if you squash the first 2
> patches together. Also avoids the bisect fail. With that (and I trust you
> to come up with a suitably merged commit message):
> 
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Squashed, and commit message rescribbeled. And with sufficient confidence
from a local smoke test I proceeded to push the easy ones 1-13 (except msm), 
and 22-23 (the load detect stuff for i915). I'll have to figure out the
correct merge order for the rest next week.

Thanks for the reviews.

> 
> I reviewed this by re-reading the analysis from 49d70aeaeca8f62b72b77 and
> trusting my former self :-)
> 
> Cheers, Daniel
> 
> > ---
> >  drivers/gpu/drm/drm_atomic_helper.c | 67 ++++++++++++++++++++++---------------
> >  1 file changed, 40 insertions(+), 27 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> > index c48f187d08de..39a69508d8c9 100644
> > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > @@ -2881,31 +2881,9 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set,
> >  	return 0;
> >  }
> >  
> > -/**
> > - * drm_atomic_helper_disable_all - disable all currently active outputs
> > - * @dev: DRM device
> > - * @ctx: lock acquisition context
> > - *
> > - * Loops through all connectors, finding those that aren't turned off and then
> > - * turns them off by setting their DPMS mode to OFF and deactivating the CRTC
> > - * that they are connected to.
> > - *
> > - * This is used for example in suspend/resume to disable all currently active
> > - * functions when suspending. If you just want to shut down everything at e.g.
> > - * driver unload, look at drm_atomic_helper_shutdown().
> > - *
> > - * Note that if callers haven't already acquired all modeset locks this might
> > - * return -EDEADLK, which must be handled by calling drm_modeset_backoff().
> > - *
> > - * Returns:
> > - * 0 on success or a negative error code on failure.
> > - *
> > - * See also:
> > - * drm_atomic_helper_suspend(), drm_atomic_helper_resume() and
> > - * drm_atomic_helper_shutdown().
> > - */
> > -int drm_atomic_helper_disable_all(struct drm_device *dev,
> > -				  struct drm_modeset_acquire_ctx *ctx)
> > +static int __drm_atomic_helper_disable_all(struct drm_device *dev,
> > +					   struct drm_modeset_acquire_ctx *ctx,
> > +					   bool clean_old_fbs)
> >  {
> >  	struct drm_atomic_state *state;
> >  	struct drm_connector_state *conn_state;
> > @@ -2914,6 +2892,7 @@ int drm_atomic_helper_disable_all(struct drm_device *dev,
> >  	struct drm_plane *plane;
> >  	struct drm_crtc_state *crtc_state;
> >  	struct drm_crtc *crtc;
> > +	unsigned int plane_mask = 0;
> >  	int ret, i;
> >  
> >  	state = drm_atomic_state_alloc(dev);
> > @@ -2956,14 +2935,48 @@ int drm_atomic_helper_disable_all(struct drm_device *dev,
> >  			goto free;
> >  
> >  		drm_atomic_set_fb_for_plane(plane_state, NULL);
> > +
> > +		if (clean_old_fbs) {
> > +			plane->old_fb = plane->fb;
> > +			plane_mask |= BIT(drm_plane_index(plane));
> > +		}
> >  	}
> >  
> >  	ret = drm_atomic_commit(state);
> >  free:
> > +	drm_atomic_clean_old_fb(dev, plane_mask, ret);
> > +
> >  	drm_atomic_state_put(state);
> >  	return ret;
> >  }
> > -
> > +/**
> > + * drm_atomic_helper_disable_all - disable all currently active outputs
> > + * @dev: DRM device
> > + * @ctx: lock acquisition context
> > + *
> > + * Loops through all connectors, finding those that aren't turned off and then
> > + * turns them off by setting their DPMS mode to OFF and deactivating the CRTC
> > + * that they are connected to.
> > + *
> > + * This is used for example in suspend/resume to disable all currently active
> > + * functions when suspending. If you just want to shut down everything at e.g.
> > + * driver unload, look at drm_atomic_helper_shutdown().
> > + *
> > + * Note that if callers haven't already acquired all modeset locks this might
> > + * return -EDEADLK, which must be handled by calling drm_modeset_backoff().
> > + *
> > + * Returns:
> > + * 0 on success or a negative error code on failure.
> > + *
> > + * See also:
> > + * drm_atomic_helper_suspend(), drm_atomic_helper_resume() and
> > + * drm_atomic_helper_shutdown().
> > + */
> > +int drm_atomic_helper_disable_all(struct drm_device *dev,
> > +				  struct drm_modeset_acquire_ctx *ctx)
> > +{
> > +	return __drm_atomic_helper_disable_all(dev, ctx, false);
> > +}
> >  EXPORT_SYMBOL(drm_atomic_helper_disable_all);
> >  
> >  /**
> > @@ -2986,7 +2999,7 @@ void drm_atomic_helper_shutdown(struct drm_device *dev)
> >  	while (1) {
> >  		ret = drm_modeset_lock_all_ctx(dev, &ctx);
> >  		if (!ret)
> > -			ret = drm_atomic_helper_disable_all(dev, &ctx);
> > +			ret = __drm_atomic_helper_disable_all(dev, &ctx, true);
> >  
> >  		if (ret != -EDEADLK)
> >  			break;
> > -- 
> > 2.16.1
> > 
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2018-03-29 16:32 UTC | newest]

Thread overview: 74+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-22 15:22 [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Ville Syrjala
2018-03-22 15:22 ` [PATCH 01/23] Revert "drm/atomic-helper: Fix leak in disable_all" Ville Syrjala
2018-03-22 15:22 ` [PATCH 02/23] drm/atomic-helper: Make drm_atomic_helper_disable_all() update the plane->fb pointers Ville Syrjala
2018-03-26 20:28   ` Daniel Vetter
2018-03-29 16:32     ` Ville Syrjälä
2018-03-26 20:43   ` Daniel Vetter
2018-03-22 15:22 ` [PATCH 03/23] drm: Clear crtc->primary->crtc when disabling the crtc via setcrtc() Ville Syrjala
2018-03-26 20:41   ` Daniel Vetter
2018-03-22 15:22 ` [PATCH 04/23] drm/atomic-helper: WARN if legacy plane fb pointers are bogus when committing duplicated state Ville Syrjala
2018-03-26 20:42   ` [Intel-gfx] " Daniel Vetter
2018-03-22 15:22 ` [PATCH 05/23] drm: Add local 'plane' variable for primary/cursor planes Ville Syrjala
2018-03-26 20:49   ` Daniel Vetter
2018-03-22 15:22 ` [PATCH 06/23] drm: Adjust whitespace for legibility Ville Syrjala
2018-03-26 20:49   ` Daniel Vetter
2018-03-22 15:22 ` [PATCH 07/23] drm: Make the fb refcount handover less magic Ville Syrjala
2018-03-27  7:49   ` Daniel Vetter
2018-03-22 15:22 ` [PATCH 08/23] drm: Use plane->state->fb over plane->fb Ville Syrjala
2018-03-27  8:10   ` Daniel Vetter
2018-03-22 15:22 ` [PATCH 09/23] drm/i915: Stop consulting plane->fb Ville Syrjala
2018-03-22 15:23 ` [PATCH 11/23] drm/sti: " Ville Syrjala
2018-03-22 16:25   ` Benjamin Gaignard
2018-03-22 15:23 ` [PATCH 12/23] drm/vmwgfx: " Ville Syrjala
2018-03-22 15:53   ` Thomas Hellstrom
2018-03-22 15:23 ` [PATCH 13/23] drm/zte: " Ville Syrjala
2018-03-22 16:12   ` Maarten Lankhorst
2018-03-22 17:40   ` [PATCH v2 " Ville Syrjala
2018-03-26  7:25     ` Shawn Guo
2018-03-26 12:14   ` [PATCH v3 13/23] drm/zte: Stop consulting plane->crtc Ville Syrjala
2018-03-22 15:23 ` [PATCH 14/23] drm/atmel-hlcdc: Stop using plane->fb Ville Syrjala
2018-03-22 16:14   ` Maarten Lankhorst
2018-03-22 17:30     ` Ville Syrjälä
2018-03-27  8:13   ` Daniel Vetter
2018-03-22 15:23 ` [PATCH 15/23] drm: Stop updating plane->crtc/fb/old_fb on atomic drivers Ville Syrjala
2018-03-26 20:52   ` Daniel Vetter
2018-03-26 20:56     ` [Intel-gfx] " Daniel Vetter
2018-03-27  7:57   ` Daniel Vetter
2018-03-27  9:44     ` [Intel-gfx] " Ville Syrjälä
2018-03-22 15:23 ` [PATCH 16/23] drm/amdgpu/dc: Stop updating plane->fb Ville Syrjala
2018-03-23 20:23   ` Harry Wentland
2018-03-22 15:23 ` [PATCH 17/23] drm/i915: Stop updating plane->fb/crtc Ville Syrjala
2018-03-22 15:23 ` [PATCH 18/23] drm/exynos: Stop updating plane->crtc Ville Syrjala
2018-03-22 15:23 ` [PATCH 20/23] drm/virtio: Stop updating plane->fb Ville Syrjala
2018-03-22 16:11   ` Gerd Hoffmann
2018-03-22 16:11   ` Gerd Hoffmann
2018-03-22 17:40   ` [PATCH v2 20/23] drm/virtio: Stop updating plane->crtc Ville Syrjala
2018-03-22 17:40   ` Ville Syrjala
2018-03-22 15:23 ` [PATCH 21/23] drm/vc4: Stop updating plane->fb/crtc Ville Syrjala
2018-03-22 16:50   ` Maarten Lankhorst
2018-03-22 15:23 ` [PATCH 22/23] drm/i915: Restore planes after load detection Ville Syrjala
2018-03-22 15:23 ` [PATCH 23/23] drm/i915: Make force_load_detect effective even w/ DMI quirks/hotplug Ville Syrjala
2018-03-22 16:49   ` Maarten Lankhorst
2018-03-22 17:41   ` [PATCH v2 " Ville Syrjala
2018-03-22 16:38 ` ✗ Fi.CI.CHECKPATCH: warning for drm: Eliminate plane->fb/crtc usage for atomic drivers Patchwork
2018-03-22 16:51 ` [PATCH 00/23] " Noralf Trønnes
     [not found]   ` <b92fe986-295c-fecb-dca1-82cb9bf7b7b1-L59+Z2yzLopAfugRpC6u6w@public.gmane.org>
2018-03-22 18:49     ` Ville Syrjälä
2018-03-22 23:28       ` Noralf Trønnes
2018-03-22 18:49   ` Ville Syrjälä
2018-03-22 16:51 ` Noralf Trønnes
2018-03-22 16:52 ` ✗ Fi.CI.BAT: failure for " Patchwork
2018-03-22 17:54 ` [PATCH 00/23] " Emil Velikov
2018-03-22 17:54 ` Emil Velikov
     [not found]   ` <CACvgo53B4zLLUqw9y18skpjacmjt-iAYBcG19HkmE=jFwcb4+w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-03-22 18:03     ` Harry Wentland
2018-03-22 18:34       ` Emil Velikov
     [not found]       ` <a0d3ec32-be68-c96e-607c-0af4a97a3dd6-5C7GfCeVMHo@public.gmane.org>
2018-03-22 18:34         ` Emil Velikov
2018-03-22 17:56 ` ✗ Fi.CI.CHECKPATCH: warning for drm: Eliminate plane->fb/crtc usage for atomic drivers (rev4) Patchwork
2018-03-22 18:12 ` ✓ Fi.CI.BAT: success " Patchwork
2018-03-22 19:59 ` ✗ Fi.CI.IGT: failure " Patchwork
2018-03-26 12:28 ` ✗ Fi.CI.CHECKPATCH: warning for drm: Eliminate plane->fb/crtc usage for atomic drivers (rev5) Patchwork
2018-03-26 12:43 ` ✓ Fi.CI.BAT: success " Patchwork
2018-03-26 15:36 ` ✓ Fi.CI.IGT: " Patchwork
     [not found] ` <20180322152313.6561-1-ville.syrjala-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2018-03-22 15:23   ` [PATCH 10/23] drm/msm: Stop consulting plane->fb Ville Syrjala
2018-03-22 15:23   ` [PATCH 19/23] drm/msm: Stop updating plane->fb/crtc Ville Syrjala
2018-03-27  8:21   ` [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Daniel Vetter
2018-03-27  8:21 ` Daniel Vetter

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.