All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/16] drm/atomic: Remove deprecated atomic iterator macros.
@ 2017-07-12  8:13 Maarten Lankhorst
  2017-07-12  8:13 ` [PATCH 01/16] drm/simple-kms-helper: Fix the check for the mismatch between plane and CRTC enabled Maarten Lankhorst
                   ` (16 more replies)
  0 siblings, 17 replies; 59+ messages in thread
From: Maarten Lankhorst @ 2017-07-12  8:13 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

It's time to kill off for_each_obj_in_state, and convert
the remainder to for_each_(old/new/both)_obj_in_state.

Maarten Lankhorst (16):
  drm/simple-kms-helper: Fix the check for the mismatch between plane
    and CRTC enabled.
  drm/atomic: Use the correct iterator macro in atomic_remove_fb
  drm/atomic: Use the new helpers in drm_atomic_helper_disable_all()
  drm/atomic: Use new iterator macros in
    drm_atomic_helper_wait_for_flip_done
  drm/vmwgfx: Make check_modeset() use the new atomic iterator macros.
  drm/i915: Use correct iterator macro
  drm/rcar-du: Use new iterator macros
  drm/atmel-hlcdec: Use for_each_new_connector_in_state
  drm/rockchip: Use for_each_oldnew_plane_in_state in
    vop_crtc_atomic_flush
  drm/omapdrm: Fix omap_atomic_wait_for_completion
  drm/mali: Use new atomic iterator macros
  drm/imx: Use atomic iterator macros
  drm/mediatek: Convert to new iterator macros
  drm/msm: Convert to use new iterator macros
  drm/nouveau: Convert nouveau to use new iterator macros
  drm/atomic: Remove deprecated accessor macros

 drivers/gpu/drm/arm/malidp_drv.c               |  2 +-
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c |  2 +-
 drivers/gpu/drm/drm_atomic_helper.c            |  8 +--
 drivers/gpu/drm/drm_framebuffer.c              |  2 +-
 drivers/gpu/drm/drm_simple_kms_helper.c        | 10 ++--
 drivers/gpu/drm/i915/intel_hdmi.c              |  2 +-
 drivers/gpu/drm/imx/imx-drm-core.c             |  8 +--
 drivers/gpu/drm/imx/ipuv3-plane.c              |  2 +-
 drivers/gpu/drm/mediatek/mtk_drm_drv.c         |  6 +--
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c        |  4 +-
 drivers/gpu/drm/msm/msm_atomic.c               | 16 +++---
 drivers/gpu/drm/nouveau/nv50_display.c         | 71 ++++++++++++------------
 drivers/gpu/drm/omapdrm/omap_drv.c             |  6 +--
 drivers/gpu/drm/rcar-du/rcar_du_plane.c        | 41 +++++++-------
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c    |  7 +--
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c            |  3 +-
 include/drm/drm_atomic.h                       | 75 --------------------------
 include/drm/drm_connector.h                    |  3 +-
 include/drm/drm_crtc.h                         |  8 +--
 include/drm/drm_plane.h                        |  8 +--
 20 files changed, 106 insertions(+), 178 deletions(-)

-- 
2.11.0

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

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

* [PATCH 01/16] drm/simple-kms-helper: Fix the check for the mismatch between plane and CRTC enabled.
  2017-07-12  8:13 [PATCH 00/16] drm/atomic: Remove deprecated atomic iterator macros Maarten Lankhorst
@ 2017-07-12  8:13 ` Maarten Lankhorst
  2017-07-12  9:01   ` Daniel Vetter
  2017-07-12  8:13 ` [PATCH 02/16] drm/atomic: Use the correct iterator macro in atomic_remove_fb Maarten Lankhorst
                   ` (15 subsequent siblings)
  16 siblings, 1 reply; 59+ messages in thread
From: Maarten Lankhorst @ 2017-07-12  8:13 UTC (permalink / raw)
  To: dri-devel; +Cc: David Airlie, intel-gfx, Daniel Vetter

You can enable the CRTC and without adding the plane to the state and
it will succeed. This should be prevented in the crtc check instead of
the plane check, because the plane check may never run for atomic
enable, but the crtc check always will.

This is based on a similar check in vmwgfx.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: David Airlie <airlied@linux.ie>
---
 drivers/gpu/drm/drm_simple_kms_helper.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c b/drivers/gpu/drm/drm_simple_kms_helper.c
index 98250854af75..39c203ad59db 100644
--- a/drivers/gpu/drm/drm_simple_kms_helper.c
+++ b/drivers/gpu/drm/drm_simple_kms_helper.c
@@ -37,6 +37,13 @@ static const struct drm_encoder_funcs drm_simple_kms_encoder_funcs = {
 static int drm_simple_kms_crtc_check(struct drm_crtc *crtc,
 				     struct drm_crtc_state *state)
 {
+	bool has_primary = state->plane_mask &
+			   BIT(drm_plane_index(crtc->primary));
+
+	/* We always want to have an active plane with an active CRTC */
+	if (has_primary != state->enable)
+		return -EINVAL;
+
 	return drm_atomic_add_affected_planes(state->state, crtc);
 }
 
@@ -90,9 +97,6 @@ static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane,
 	pipe = container_of(plane, struct drm_simple_display_pipe, plane);
 	crtc_state = drm_atomic_get_new_crtc_state(plane_state->state,
 						   &pipe->crtc);
-	if (crtc_state->enable != !!plane_state->crtc)
-		return -EINVAL; /* plane must match crtc enable state */
-
 	if (!crtc_state->enable)
 		return 0; /* nothing to check when disabling or disabled */
 
-- 
2.11.0

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

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

* [PATCH 02/16] drm/atomic: Use the correct iterator macro in atomic_remove_fb
  2017-07-12  8:13 [PATCH 00/16] drm/atomic: Remove deprecated atomic iterator macros Maarten Lankhorst
  2017-07-12  8:13 ` [PATCH 01/16] drm/simple-kms-helper: Fix the check for the mismatch between plane and CRTC enabled Maarten Lankhorst
@ 2017-07-12  8:13 ` Maarten Lankhorst
  2017-07-12  9:01   ` Daniel Vetter
  2017-07-12  8:13 ` [PATCH 03/16] drm/atomic: Use the new helpers in drm_atomic_helper_disable_all() Maarten Lankhorst
                   ` (14 subsequent siblings)
  16 siblings, 1 reply; 59+ messages in thread
From: Maarten Lankhorst @ 2017-07-12  8:13 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx, Daniel Vetter

for_each_obj_in_state will be removed, so use the new state here.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: David Airlie <airlied@linux.ie>
---
 drivers/gpu/drm/drm_framebuffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
index fc8ef42203ec..607ef3a97c42 100644
--- a/drivers/gpu/drm/drm_framebuffer.c
+++ b/drivers/gpu/drm/drm_framebuffer.c
@@ -817,7 +817,7 @@ static int atomic_remove_fb(struct drm_framebuffer *fb)
 		plane->old_fb = plane->fb;
 	}
 
-	for_each_connector_in_state(state, conn, conn_state, i) {
+	for_each_new_connector_in_state(state, conn, conn_state, i) {
 		ret = drm_atomic_set_crtc_for_connector(conn_state, NULL);
 
 		if (ret)
-- 
2.11.0

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

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

* [PATCH 03/16] drm/atomic: Use the new helpers in drm_atomic_helper_disable_all()
  2017-07-12  8:13 [PATCH 00/16] drm/atomic: Remove deprecated atomic iterator macros Maarten Lankhorst
  2017-07-12  8:13 ` [PATCH 01/16] drm/simple-kms-helper: Fix the check for the mismatch between plane and CRTC enabled Maarten Lankhorst
  2017-07-12  8:13 ` [PATCH 02/16] drm/atomic: Use the correct iterator macro in atomic_remove_fb Maarten Lankhorst
@ 2017-07-12  8:13 ` Maarten Lankhorst
  2017-07-12  9:03   ` Daniel Vetter
  2017-07-12  8:13 ` [PATCH 04/16] drm/atomic: Use new iterator macros in drm_atomic_helper_wait_for_flip_done Maarten Lankhorst
                   ` (13 subsequent siblings)
  16 siblings, 1 reply; 59+ messages in thread
From: Maarten Lankhorst @ 2017-07-12  8:13 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx, Daniel Vetter

for_each_obj_in_state will be removed, so don't use it here.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: David Airlie <airlied@linux.ie>
---
 drivers/gpu/drm/drm_atomic_helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 667ec97d4efb..391cd887f922 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -2715,13 +2715,13 @@ int drm_atomic_helper_disable_all(struct drm_device *dev,
 			goto free;
 	}
 
-	for_each_connector_in_state(state, conn, conn_state, i) {
+	for_each_new_connector_in_state(state, conn, conn_state, i) {
 		ret = drm_atomic_set_crtc_for_connector(conn_state, NULL);
 		if (ret < 0)
 			goto free;
 	}
 
-	for_each_plane_in_state(state, plane, plane_state, i) {
+	for_each_new_plane_in_state(state, plane, plane_state, i) {
 		ret = drm_atomic_set_crtc_for_plane(plane_state, NULL);
 		if (ret < 0)
 			goto free;
-- 
2.11.0

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

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

* [PATCH 04/16] drm/atomic: Use new iterator macros in drm_atomic_helper_wait_for_flip_done
  2017-07-12  8:13 [PATCH 00/16] drm/atomic: Remove deprecated atomic iterator macros Maarten Lankhorst
                   ` (2 preceding siblings ...)
  2017-07-12  8:13 ` [PATCH 03/16] drm/atomic: Use the new helpers in drm_atomic_helper_disable_all() Maarten Lankhorst
@ 2017-07-12  8:13 ` Maarten Lankhorst
  2017-07-12  9:07   ` [Intel-gfx] " Daniel Vetter
  2017-07-12  8:13 ` [PATCH 05/16] drm/vmwgfx: Make check_modeset() use the new atomic iterator macros Maarten Lankhorst
                   ` (12 subsequent siblings)
  16 siblings, 1 reply; 59+ messages in thread
From: Maarten Lankhorst @ 2017-07-12  8:13 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx, Daniel Vetter

for_each_obj_in_state is about to be removed, so use the correct new
iterator macro.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: David Airlie <airlied@linux.ie>
---
 drivers/gpu/drm/drm_atomic_helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 391cd887f922..29a8098d3ca7 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -1270,7 +1270,7 @@ void drm_atomic_helper_wait_for_flip_done(struct drm_device *dev,
 	struct drm_crtc *crtc;
 	int i;
 
-	for_each_crtc_in_state(old_state, crtc, crtc_state, i) {
+	for_each_new_crtc_in_state(old_state, crtc, crtc_state, i) {
 		struct drm_crtc_commit *commit = old_state->crtcs[i].commit;
 		int ret;
 
@@ -1426,7 +1426,7 @@ int drm_atomic_helper_async_check(struct drm_device *dev,
 		if (!crtc->state->state)
 			continue;
 
-		for_each_plane_in_state(crtc->state->state, __plane,
+		for_each_new_plane_in_state(crtc->state->state, __plane,
 					__plane_state, j) {
 			if (__plane == plane)
 				return -EINVAL;
-- 
2.11.0

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

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

* [PATCH 05/16] drm/vmwgfx: Make check_modeset() use the new atomic iterator macros.
  2017-07-12  8:13 [PATCH 00/16] drm/atomic: Remove deprecated atomic iterator macros Maarten Lankhorst
                   ` (3 preceding siblings ...)
  2017-07-12  8:13 ` [PATCH 04/16] drm/atomic: Use new iterator macros in drm_atomic_helper_wait_for_flip_done Maarten Lankhorst
@ 2017-07-12  8:13 ` Maarten Lankhorst
  2017-07-12  8:33   ` Sinclair Yeh
  2017-07-12  9:09   ` [Intel-gfx] " Daniel Vetter
  2017-07-12  8:13 ` [PATCH 06/16] drm/i915: Use correct iterator macro Maarten Lankhorst
                   ` (11 subsequent siblings)
  16 siblings, 2 replies; 59+ messages in thread
From: Maarten Lankhorst @ 2017-07-12  8:13 UTC (permalink / raw)
  To: dri-devel; +Cc: VMware Graphics, intel-gfx, Thomas Hellstrom

I don't think the checking of resources in this function is very
atomic-like, but it should definitely not use a macro that's about
to be removed.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>
Cc: Sinclair Yeh <syeh@vmware.com>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index 1cd67b10a0d9..64f66ff97fab 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -1536,8 +1536,7 @@ vmw_kms_atomic_check_modeset(struct drm_device *dev,
 	struct vmw_private *dev_priv = vmw_priv(dev);
 	int i;
 
-
-	for_each_crtc_in_state(state, crtc, crtc_state, i) {
+	for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
 		unsigned long requested_bb_mem = 0;
 
 		if (dev_priv->active_display_unit == vmw_du_screen_target) {
-- 
2.11.0

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

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

* [PATCH 06/16] drm/i915: Use correct iterator macro
  2017-07-12  8:13 [PATCH 00/16] drm/atomic: Remove deprecated atomic iterator macros Maarten Lankhorst
                   ` (4 preceding siblings ...)
  2017-07-12  8:13 ` [PATCH 05/16] drm/vmwgfx: Make check_modeset() use the new atomic iterator macros Maarten Lankhorst
@ 2017-07-12  8:13 ` Maarten Lankhorst
  2017-07-12  9:10   ` Daniel Vetter
  2017-07-12  8:13   ` Maarten Lankhorst
                   ` (10 subsequent siblings)
  16 siblings, 1 reply; 59+ messages in thread
From: Maarten Lankhorst @ 2017-07-12  8:13 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter, intel-gfx

for_each_cnonector_in_state will be removed, so use the right state
here.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
---
 drivers/gpu/drm/i915/intel_hdmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index ec0779a52d53..916340f03882 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -1321,7 +1321,7 @@ static bool hdmi_12bpc_possible(struct intel_crtc_state *crtc_state)
 	if (crtc_state->output_types != 1 << INTEL_OUTPUT_HDMI)
 		return false;
 
-	for_each_connector_in_state(state, connector, connector_state, i) {
+	for_each_new_connector_in_state(state, connector, connector_state, i) {
 		const struct drm_display_info *info = &connector->display_info;
 
 		if (connector_state->crtc != crtc_state->base.crtc)
-- 
2.11.0

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

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

* [PATCH 07/16] drm/rcar-du: Use new iterator macros
  2017-07-12  8:13 [PATCH 00/16] drm/atomic: Remove deprecated atomic iterator macros Maarten Lankhorst
@ 2017-07-12  8:13   ` Maarten Lankhorst
  2017-07-12  8:13 ` [PATCH 02/16] drm/atomic: Use the correct iterator macro in atomic_remove_fb Maarten Lankhorst
                     ` (15 subsequent siblings)
  16 siblings, 0 replies; 59+ messages in thread
From: Maarten Lankhorst @ 2017-07-12  8:13 UTC (permalink / raw)
  To: dri-devel
  Cc: intel-gfx, Maarten Lankhorst, Laurent Pinchart, linux-renesas-soc

for_each_obj_in_state is about to be removed, so use the correct new
iterator macros.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: linux-renesas-soc@vger.kernel.org
---
 drivers/gpu/drm/rcar-du/rcar_du_plane.c | 41 ++++++++++++++++-----------------
 1 file changed, 20 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
index dcde6288da6c..dfd84e3c8c25 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
@@ -51,12 +51,9 @@
  */
 
 static bool rcar_du_plane_needs_realloc(struct rcar_du_plane *plane,
+					const struct rcar_du_plane_state *cur_state,
 					struct rcar_du_plane_state *new_state)
 {
-	struct rcar_du_plane_state *cur_state;
-
-	cur_state = to_rcar_plane_state(plane->plane.state);
-
 	/* Lowering the number of planes doesn't strictly require reallocation
 	 * as the extra hardware plane will be freed when committing, but doing
 	 * so could lead to more fragmentation.
@@ -141,16 +138,17 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
 	unsigned int groups = 0;
 	unsigned int i;
 	struct drm_plane *drm_plane;
-	struct drm_plane_state *drm_plane_state;
+	struct drm_plane_state *old_drm_plane_state, *new_drm_plane_state;
 
 	/* Check if hardware planes need to be reallocated. */
-	for_each_plane_in_state(state, drm_plane, drm_plane_state, i) {
-		struct rcar_du_plane_state *plane_state;
+	for_each_oldnew_plane_in_state(state, drm_plane, old_drm_plane_state, new_drm_plane_state, i) {
+		struct rcar_du_plane_state *old_plane_state, *new_plane_state;
 		struct rcar_du_plane *plane;
 		unsigned int index;
 
 		plane = to_rcar_plane(drm_plane);
-		plane_state = to_rcar_plane_state(drm_plane_state);
+		old_plane_state = to_rcar_plane_state(old_drm_plane_state);
+		new_plane_state = to_rcar_plane_state(new_drm_plane_state);
 
 		dev_dbg(rcdu->dev, "%s: checking plane (%u,%tu)\n", __func__,
 			plane->group->index, plane - plane->group->planes);
@@ -159,19 +157,19 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
 		 * the full reallocation procedure. Just mark the hardware
 		 * plane(s) as freed.
 		 */
-		if (!plane_state->format) {
+		if (!new_plane_state->format) {
 			dev_dbg(rcdu->dev, "%s: plane is being disabled\n",
 				__func__);
 			index = plane - plane->group->planes;
 			group_freed_planes[plane->group->index] |= 1 << index;
-			plane_state->hwindex = -1;
+			new_plane_state->hwindex = -1;
 			continue;
 		}
 
 		/* If the plane needs to be reallocated mark it as such, and
 		 * mark the hardware plane(s) as free.
 		 */
-		if (rcar_du_plane_needs_realloc(plane, plane_state)) {
+		if (rcar_du_plane_needs_realloc(plane, old_plane_state, new_plane_state)) {
 			dev_dbg(rcdu->dev, "%s: plane needs reallocation\n",
 				__func__);
 			groups |= 1 << plane->group->index;
@@ -179,7 +177,7 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
 
 			index = plane - plane->group->planes;
 			group_freed_planes[plane->group->index] |= 1 << index;
-			plane_state->hwindex = -1;
+			new_plane_state->hwindex = -1;
 		}
 	}
 
@@ -226,16 +224,16 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
 				continue;
 			}
 
-			plane_state = to_rcar_plane_state(plane->plane.state);
+			new_plane_state = to_rcar_plane_state(plane->plane.state);
 			used_planes |= rcar_du_plane_hwmask(plane_state);
 
 			dev_dbg(rcdu->dev,
 				"%s: plane (%u,%tu) uses %u hwplanes (index %d)\n",
 				__func__, plane->group->index,
 				plane - plane->group->planes,
-				plane_state->format ?
-				plane_state->format->planes : 0,
-				plane_state->hwindex);
+				new_plane_state->format ?
+				new_plane_state->format->planes : 0,
+				new_plane_state->hwindex);
 		}
 
 		group_free_planes[index] = 0xff & ~used_planes;
@@ -246,15 +244,16 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
 	}
 
 	/* Reallocate hardware planes for each plane that needs it. */
-	for_each_plane_in_state(state, drm_plane, drm_plane_state, i) {
-		struct rcar_du_plane_state *plane_state;
+	for_each_oldnew_plane_in_state(state, drm_plane, old_drm_plane_state, new_drm_plane_state, i) {
+		struct rcar_du_plane_state *old_plane_state, *new_plane_state;
 		struct rcar_du_plane *plane;
 		unsigned int crtc_planes;
 		unsigned int free;
 		int idx;
 
 		plane = to_rcar_plane(drm_plane);
-		plane_state = to_rcar_plane_state(drm_plane_state);
+		old_plane_state = to_rcar_plane_state(old_drm_plane_state);
+		new_plane_state = to_rcar_plane_state(new_drm_plane_state);
 
 		dev_dbg(rcdu->dev, "%s: allocating plane (%u,%tu)\n", __func__,
 			plane->group->index, plane - plane->group->planes);
@@ -263,7 +262,7 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
 		 * reallocated.
 		 */
 		if (!plane_state->format ||
-		    !rcar_du_plane_needs_realloc(plane, plane_state))
+		    !rcar_du_plane_needs_realloc(plane, old_plane_state, new_plane_state))
 			continue;
 
 		/* Try to allocate the plane from the free planes currently
@@ -279,7 +278,7 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
 		idx = rcar_du_plane_hwalloc(plane, plane_state,
 					    free & crtc_planes);
 		if (idx < 0)
-			idx = rcar_du_plane_hwalloc(plane, plane_state,
+			idx = rcar_du_plane_hwalloc(plane, new_plane_state,
 						    free);
 		if (idx < 0) {
 			dev_dbg(rcdu->dev, "%s: no available hardware plane\n",
-- 
2.11.0

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

* [PATCH 07/16] drm/rcar-du: Use new iterator macros
@ 2017-07-12  8:13   ` Maarten Lankhorst
  0 siblings, 0 replies; 59+ messages in thread
From: Maarten Lankhorst @ 2017-07-12  8:13 UTC (permalink / raw)
  To: dri-devel; +Cc: linux-renesas-soc, intel-gfx, Laurent Pinchart

for_each_obj_in_state is about to be removed, so use the correct new
iterator macros.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: linux-renesas-soc@vger.kernel.org
---
 drivers/gpu/drm/rcar-du/rcar_du_plane.c | 41 ++++++++++++++++-----------------
 1 file changed, 20 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
index dcde6288da6c..dfd84e3c8c25 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
@@ -51,12 +51,9 @@
  */
 
 static bool rcar_du_plane_needs_realloc(struct rcar_du_plane *plane,
+					const struct rcar_du_plane_state *cur_state,
 					struct rcar_du_plane_state *new_state)
 {
-	struct rcar_du_plane_state *cur_state;
-
-	cur_state = to_rcar_plane_state(plane->plane.state);
-
 	/* Lowering the number of planes doesn't strictly require reallocation
 	 * as the extra hardware plane will be freed when committing, but doing
 	 * so could lead to more fragmentation.
@@ -141,16 +138,17 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
 	unsigned int groups = 0;
 	unsigned int i;
 	struct drm_plane *drm_plane;
-	struct drm_plane_state *drm_plane_state;
+	struct drm_plane_state *old_drm_plane_state, *new_drm_plane_state;
 
 	/* Check if hardware planes need to be reallocated. */
-	for_each_plane_in_state(state, drm_plane, drm_plane_state, i) {
-		struct rcar_du_plane_state *plane_state;
+	for_each_oldnew_plane_in_state(state, drm_plane, old_drm_plane_state, new_drm_plane_state, i) {
+		struct rcar_du_plane_state *old_plane_state, *new_plane_state;
 		struct rcar_du_plane *plane;
 		unsigned int index;
 
 		plane = to_rcar_plane(drm_plane);
-		plane_state = to_rcar_plane_state(drm_plane_state);
+		old_plane_state = to_rcar_plane_state(old_drm_plane_state);
+		new_plane_state = to_rcar_plane_state(new_drm_plane_state);
 
 		dev_dbg(rcdu->dev, "%s: checking plane (%u,%tu)\n", __func__,
 			plane->group->index, plane - plane->group->planes);
@@ -159,19 +157,19 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
 		 * the full reallocation procedure. Just mark the hardware
 		 * plane(s) as freed.
 		 */
-		if (!plane_state->format) {
+		if (!new_plane_state->format) {
 			dev_dbg(rcdu->dev, "%s: plane is being disabled\n",
 				__func__);
 			index = plane - plane->group->planes;
 			group_freed_planes[plane->group->index] |= 1 << index;
-			plane_state->hwindex = -1;
+			new_plane_state->hwindex = -1;
 			continue;
 		}
 
 		/* If the plane needs to be reallocated mark it as such, and
 		 * mark the hardware plane(s) as free.
 		 */
-		if (rcar_du_plane_needs_realloc(plane, plane_state)) {
+		if (rcar_du_plane_needs_realloc(plane, old_plane_state, new_plane_state)) {
 			dev_dbg(rcdu->dev, "%s: plane needs reallocation\n",
 				__func__);
 			groups |= 1 << plane->group->index;
@@ -179,7 +177,7 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
 
 			index = plane - plane->group->planes;
 			group_freed_planes[plane->group->index] |= 1 << index;
-			plane_state->hwindex = -1;
+			new_plane_state->hwindex = -1;
 		}
 	}
 
@@ -226,16 +224,16 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
 				continue;
 			}
 
-			plane_state = to_rcar_plane_state(plane->plane.state);
+			new_plane_state = to_rcar_plane_state(plane->plane.state);
 			used_planes |= rcar_du_plane_hwmask(plane_state);
 
 			dev_dbg(rcdu->dev,
 				"%s: plane (%u,%tu) uses %u hwplanes (index %d)\n",
 				__func__, plane->group->index,
 				plane - plane->group->planes,
-				plane_state->format ?
-				plane_state->format->planes : 0,
-				plane_state->hwindex);
+				new_plane_state->format ?
+				new_plane_state->format->planes : 0,
+				new_plane_state->hwindex);
 		}
 
 		group_free_planes[index] = 0xff & ~used_planes;
@@ -246,15 +244,16 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
 	}
 
 	/* Reallocate hardware planes for each plane that needs it. */
-	for_each_plane_in_state(state, drm_plane, drm_plane_state, i) {
-		struct rcar_du_plane_state *plane_state;
+	for_each_oldnew_plane_in_state(state, drm_plane, old_drm_plane_state, new_drm_plane_state, i) {
+		struct rcar_du_plane_state *old_plane_state, *new_plane_state;
 		struct rcar_du_plane *plane;
 		unsigned int crtc_planes;
 		unsigned int free;
 		int idx;
 
 		plane = to_rcar_plane(drm_plane);
-		plane_state = to_rcar_plane_state(drm_plane_state);
+		old_plane_state = to_rcar_plane_state(old_drm_plane_state);
+		new_plane_state = to_rcar_plane_state(new_drm_plane_state);
 
 		dev_dbg(rcdu->dev, "%s: allocating plane (%u,%tu)\n", __func__,
 			plane->group->index, plane - plane->group->planes);
@@ -263,7 +262,7 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
 		 * reallocated.
 		 */
 		if (!plane_state->format ||
-		    !rcar_du_plane_needs_realloc(plane, plane_state))
+		    !rcar_du_plane_needs_realloc(plane, old_plane_state, new_plane_state))
 			continue;
 
 		/* Try to allocate the plane from the free planes currently
@@ -279,7 +278,7 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
 		idx = rcar_du_plane_hwalloc(plane, plane_state,
 					    free & crtc_planes);
 		if (idx < 0)
-			idx = rcar_du_plane_hwalloc(plane, plane_state,
+			idx = rcar_du_plane_hwalloc(plane, new_plane_state,
 						    free);
 		if (idx < 0) {
 			dev_dbg(rcdu->dev, "%s: no available hardware plane\n",
-- 
2.11.0

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

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

* [PATCH 08/16] drm/atmel-hlcdec: Use for_each_new_connector_in_state
  2017-07-12  8:13 [PATCH 00/16] drm/atomic: Remove deprecated atomic iterator macros Maarten Lankhorst
                   ` (6 preceding siblings ...)
  2017-07-12  8:13   ` Maarten Lankhorst
@ 2017-07-12  8:13 ` Maarten Lankhorst
  2017-07-12  9:17   ` Daniel Vetter
  2017-07-12  9:22   ` Boris Brezillon
  2017-07-12  8:13   ` Maarten Lankhorst
                   ` (8 subsequent siblings)
  16 siblings, 2 replies; 59+ messages in thread
From: Maarten Lankhorst @ 2017-07-12  8:13 UTC (permalink / raw)
  To: dri-devel; +Cc: Boris Brezillon, intel-gfx

for_each_obj_in_state is about to be removed, so use the new iterator
macros.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
index 441769c5bcd4..4fbbeab5c5d4 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
@@ -237,7 +237,7 @@ static int atmel_hlcdc_crtc_select_output_mode(struct drm_crtc_state *state)
 
 	crtc = drm_crtc_to_atmel_hlcdc_crtc(state->crtc);
 
-	for_each_connector_in_state(state->state, connector, cstate, i) {
+	for_each_new_connector_in_state(state->state, connector, cstate, i) {
 		struct drm_display_info *info = &connector->display_info;
 		unsigned int supported_fmts = 0;
 		int j;
-- 
2.11.0

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

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

* [PATCH 09/16] drm/rockchip: Use for_each_oldnew_plane_in_state in vop_crtc_atomic_flush
  2017-07-12  8:13 [PATCH 00/16] drm/atomic: Remove deprecated atomic iterator macros Maarten Lankhorst
@ 2017-07-12  8:13   ` Maarten Lankhorst
  2017-07-12  8:13 ` [PATCH 02/16] drm/atomic: Use the correct iterator macro in atomic_remove_fb Maarten Lankhorst
                     ` (15 subsequent siblings)
  16 siblings, 0 replies; 59+ messages in thread
From: Maarten Lankhorst @ 2017-07-12  8:13 UTC (permalink / raw)
  To: dri-devel
  Cc: Heiko Stuebner, intel-gfx, Maarten Lankhorst, linux-rockchip,
	linux-arm-kernel, Mark Yao

for_each_obj_in_state is about to be removed, so use the new atomic
iterator macros.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Mark Yao <mark.yao@rock-chips.com>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-rockchip@lists.infradead.org
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index ee876a9631f0..f90088b1a247 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -1029,7 +1029,7 @@ static void vop_crtc_atomic_flush(struct drm_crtc *crtc,
 				  struct drm_crtc_state *old_crtc_state)
 {
 	struct drm_atomic_state *old_state = old_crtc_state->state;
-	struct drm_plane_state *old_plane_state;
+	struct drm_plane_state *old_plane_state, *new_plane_state;
 	struct vop *vop = to_vop(crtc);
 	struct drm_plane *plane;
 	int i;
@@ -1060,11 +1060,12 @@ static void vop_crtc_atomic_flush(struct drm_crtc *crtc,
 	}
 	spin_unlock_irq(&crtc->dev->event_lock);
 
-	for_each_plane_in_state(old_state, plane, old_plane_state, i) {
+	for_each_oldnew_plane_in_state(old_state, plane, old_plane_state,
+				       new_plane_state, i) {
 		if (!old_plane_state->fb)
 			continue;
 
-		if (old_plane_state->fb == plane->state->fb)
+		if (old_plane_state->fb == new_plane_state->fb)
 			continue;
 
 		drm_framebuffer_reference(old_plane_state->fb);
-- 
2.11.0

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

* [PATCH 09/16] drm/rockchip: Use for_each_oldnew_plane_in_state in vop_crtc_atomic_flush
@ 2017-07-12  8:13   ` Maarten Lankhorst
  0 siblings, 0 replies; 59+ messages in thread
From: Maarten Lankhorst @ 2017-07-12  8:13 UTC (permalink / raw)
  To: linux-arm-kernel

for_each_obj_in_state is about to be removed, so use the new atomic
iterator macros.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Mark Yao <mark.yao@rock-chips.com>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: linux-arm-kernel at lists.infradead.org
Cc: linux-rockchip at lists.infradead.org
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index ee876a9631f0..f90088b1a247 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -1029,7 +1029,7 @@ static void vop_crtc_atomic_flush(struct drm_crtc *crtc,
 				  struct drm_crtc_state *old_crtc_state)
 {
 	struct drm_atomic_state *old_state = old_crtc_state->state;
-	struct drm_plane_state *old_plane_state;
+	struct drm_plane_state *old_plane_state, *new_plane_state;
 	struct vop *vop = to_vop(crtc);
 	struct drm_plane *plane;
 	int i;
@@ -1060,11 +1060,12 @@ static void vop_crtc_atomic_flush(struct drm_crtc *crtc,
 	}
 	spin_unlock_irq(&crtc->dev->event_lock);
 
-	for_each_plane_in_state(old_state, plane, old_plane_state, i) {
+	for_each_oldnew_plane_in_state(old_state, plane, old_plane_state,
+				       new_plane_state, i) {
 		if (!old_plane_state->fb)
 			continue;
 
-		if (old_plane_state->fb == plane->state->fb)
+		if (old_plane_state->fb == new_plane_state->fb)
 			continue;
 
 		drm_framebuffer_reference(old_plane_state->fb);
-- 
2.11.0

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

* [PATCH 10/16] drm/omapdrm: Fix omap_atomic_wait_for_completion
  2017-07-12  8:13 [PATCH 00/16] drm/atomic: Remove deprecated atomic iterator macros Maarten Lankhorst
                   ` (8 preceding siblings ...)
  2017-07-12  8:13   ` Maarten Lankhorst
@ 2017-07-12  8:13 ` Maarten Lankhorst
  2017-07-12  9:23   ` Daniel Vetter
  2017-07-12  8:13 ` [PATCH 11/16] drm/mali: Use new atomic iterator macros Maarten Lankhorst
                   ` (6 subsequent siblings)
  16 siblings, 1 reply; 59+ messages in thread
From: Maarten Lankhorst @ 2017-07-12  8:13 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx, Tomi Valkeinen

Use the new iterator macro and look for crtc_state->active instead of
enable, only crtc_state->enable implies that vblanks will happen.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/omap_drv.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index 022029ea6972..66d3c6bfd6a8 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -57,13 +57,13 @@ static void omap_fb_output_poll_changed(struct drm_device *dev)
 static void omap_atomic_wait_for_completion(struct drm_device *dev,
 					    struct drm_atomic_state *old_state)
 {
-	struct drm_crtc_state *old_crtc_state;
+	struct drm_crtc_state *new_crtc_state;
 	struct drm_crtc *crtc;
 	unsigned int i;
 	int ret;
 
-	for_each_crtc_in_state(old_state, crtc, old_crtc_state, i) {
-		if (!crtc->state->enable)
+	for_each_new_crtc_in_state(old_state, crtc, new_crtc_state, i) {
+		if (!new_crtc_state->active)
 			continue;
 
 		ret = omap_crtc_wait_pending(crtc);
-- 
2.11.0

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

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

* [PATCH 11/16] drm/mali: Use new atomic iterator macros
  2017-07-12  8:13 [PATCH 00/16] drm/atomic: Remove deprecated atomic iterator macros Maarten Lankhorst
                   ` (9 preceding siblings ...)
  2017-07-12  8:13 ` [PATCH 10/16] drm/omapdrm: Fix omap_atomic_wait_for_completion Maarten Lankhorst
@ 2017-07-12  8:13 ` Maarten Lankhorst
  2017-07-12  9:25   ` [Intel-gfx] " Daniel Vetter
  2017-07-12  9:44   ` Liviu Dudau
  2017-07-12  8:13 ` [PATCH 12/16] drm/imx: Use " Maarten Lankhorst
                   ` (5 subsequent siblings)
  16 siblings, 2 replies; 59+ messages in thread
From: Maarten Lankhorst @ 2017-07-12  8:13 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx, Mali DP Maintainers

for_each_obj_in_state is about to be removed, so use the new iterator
macros.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Brian Starkey <brian.starkey@arm.com>
Cc: Mali DP Maintainers <malidp@foss.arm.com>
---
 drivers/gpu/drm/arm/malidp_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
index 01b13d219917..a6a05a768dd1 100644
--- a/drivers/gpu/drm/arm/malidp_drv.c
+++ b/drivers/gpu/drm/arm/malidp_drv.c
@@ -225,7 +225,7 @@ static void malidp_atomic_commit_tail(struct drm_atomic_state *state)
 
 	drm_atomic_helper_commit_modeset_disables(drm, state);
 
-	for_each_crtc_in_state(state, crtc, old_crtc_state, i) {
+	for_each_old_crtc_in_state(state, crtc, old_crtc_state, i) {
 		malidp_atomic_commit_update_gamma(crtc, old_crtc_state);
 		malidp_atomic_commit_update_coloradj(crtc, old_crtc_state);
 		malidp_atomic_commit_se_config(crtc, old_crtc_state);
-- 
2.11.0

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

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

* [PATCH 12/16] drm/imx: Use atomic iterator macros
  2017-07-12  8:13 [PATCH 00/16] drm/atomic: Remove deprecated atomic iterator macros Maarten Lankhorst
                   ` (10 preceding siblings ...)
  2017-07-12  8:13 ` [PATCH 11/16] drm/mali: Use new atomic iterator macros Maarten Lankhorst
@ 2017-07-12  8:13 ` Maarten Lankhorst
  2017-07-12  9:26   ` Daniel Vetter
  2017-07-12 10:00   ` Philipp Zabel
  2017-07-12  8:13   ` Maarten Lankhorst
                   ` (4 subsequent siblings)
  16 siblings, 2 replies; 59+ messages in thread
From: Maarten Lankhorst @ 2017-07-12  8:13 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx, Philipp Zabel

for_each_obj_in_state is about to be removed, so use the new atomic
iterator macros.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
---
 drivers/gpu/drm/imx/imx-drm-core.c | 8 ++++----
 drivers/gpu/drm/imx/ipuv3-plane.c  | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
index 95e2181963d9..f5c621219113 100644
--- a/drivers/gpu/drm/imx/imx-drm-core.c
+++ b/drivers/gpu/drm/imx/imx-drm-core.c
@@ -115,7 +115,7 @@ static void imx_drm_atomic_commit_tail(struct drm_atomic_state *state)
 {
 	struct drm_device *dev = state->dev;
 	struct drm_plane *plane;
-	struct drm_plane_state *old_plane_state;
+	struct drm_plane_state *old_plane_state, *new_plane_state;
 	bool plane_disabling = false;
 	int i;
 
@@ -127,15 +127,15 @@ static void imx_drm_atomic_commit_tail(struct drm_atomic_state *state)
 
 	drm_atomic_helper_commit_modeset_enables(dev, state);
 
-	for_each_plane_in_state(state, plane, old_plane_state, i) {
-		if (drm_atomic_plane_disabling(old_plane_state, plane->state))
+	for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) {
+		if (drm_atomic_plane_disabling(old_plane_state, new_plane_state))
 			plane_disabling = true;
 	}
 
 	if (plane_disabling) {
 		drm_atomic_helper_wait_for_vblanks(dev, state);
 
-		for_each_plane_in_state(state, plane, old_plane_state, i)
+		for_each_old_plane_in_state(state, plane, old_plane_state, i)
 			ipu_plane_disable_deferred(plane);
 
 	}
diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3-plane.c
index 49546222c6d3..ff53c8dec633 100644
--- a/drivers/gpu/drm/imx/ipuv3-plane.c
+++ b/drivers/gpu/drm/imx/ipuv3-plane.c
@@ -675,7 +675,7 @@ int ipu_planes_assign_pre(struct drm_device *dev,
 	int available_pres = ipu_prg_max_active_channels();
 	int i;
 
-	for_each_plane_in_state(state, plane, plane_state, i) {
+	for_each_new_plane_in_state(state, plane, plane_state, i) {
 		struct ipu_plane_state *ipu_state =
 				to_ipu_plane_state(plane_state);
 		struct ipu_plane *ipu_plane = to_ipu_plane(plane);
-- 
2.11.0

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

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

* [PATCH 13/16] drm/mediatek: Convert to new iterator macros
  2017-07-12  8:13 [PATCH 00/16] drm/atomic: Remove deprecated atomic iterator macros Maarten Lankhorst
@ 2017-07-12  8:13   ` Maarten Lankhorst
  2017-07-12  8:13 ` [PATCH 02/16] drm/atomic: Use the correct iterator macro in atomic_remove_fb Maarten Lankhorst
                     ` (15 subsequent siblings)
  16 siblings, 0 replies; 59+ messages in thread
From: Maarten Lankhorst @ 2017-07-12  8:13 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx, Matthias Brugger, linux-mediatek, linux-arm-kernel

for_each_obj_in_state is about to be removed, so use the new atomic
iterator macros.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: CK Hu <ck.hu@mediatek.com>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-mediatek@lists.infradead.org
---
 drivers/gpu/drm/mediatek/mtk_drm_drv.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index 56f802d0a51c..be0741638f94 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -48,11 +48,11 @@ static void mtk_atomic_schedule(struct mtk_drm_private *private,
 static void mtk_atomic_wait_for_fences(struct drm_atomic_state *state)
 {
 	struct drm_plane *plane;
-	struct drm_plane_state *plane_state;
+	struct drm_plane_state *new_plane_state;
 	int i;
 
-	for_each_plane_in_state(state, plane, plane_state, i)
-		mtk_fb_wait(plane->state->fb);
+	for_each_new_plane_in_state(state, plane, new_plane_state, i)
+		mtk_fb_wait(new_plane_state->fb);
 }
 
 static void mtk_atomic_complete(struct mtk_drm_private *private,
-- 
2.11.0

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

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

* [PATCH 13/16] drm/mediatek: Convert to new iterator macros
@ 2017-07-12  8:13   ` Maarten Lankhorst
  0 siblings, 0 replies; 59+ messages in thread
From: Maarten Lankhorst @ 2017-07-12  8:13 UTC (permalink / raw)
  To: linux-arm-kernel

for_each_obj_in_state is about to be removed, so use the new atomic
iterator macros.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: CK Hu <ck.hu@mediatek.com>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: linux-arm-kernel at lists.infradead.org
Cc: linux-mediatek at lists.infradead.org
---
 drivers/gpu/drm/mediatek/mtk_drm_drv.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index 56f802d0a51c..be0741638f94 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -48,11 +48,11 @@ static void mtk_atomic_schedule(struct mtk_drm_private *private,
 static void mtk_atomic_wait_for_fences(struct drm_atomic_state *state)
 {
 	struct drm_plane *plane;
-	struct drm_plane_state *plane_state;
+	struct drm_plane_state *new_plane_state;
 	int i;
 
-	for_each_plane_in_state(state, plane, plane_state, i)
-		mtk_fb_wait(plane->state->fb);
+	for_each_new_plane_in_state(state, plane, new_plane_state, i)
+		mtk_fb_wait(new_plane_state->fb);
 }
 
 static void mtk_atomic_complete(struct mtk_drm_private *private,
-- 
2.11.0

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

* [PATCH 14/16] drm/msm: Convert to use new iterator macros
       [not found] ` <20170712081344.25495-1-maarten.lankhorst-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
@ 2017-07-12  8:13   ` Maarten Lankhorst
  2017-07-12  9:48     ` [Intel-gfx] " Daniel Vetter
  0 siblings, 1 reply; 59+ messages in thread
From: Maarten Lankhorst @ 2017-07-12  8:13 UTC (permalink / raw)
  To: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Rob Herring, Archit Taneja, linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Maarten Lankhorst,
	Rob Clark, Sushmita Susheelendra, Russell King,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Vincent Abriou,
	Markus Elfring

for_each_obj_in_state is about to be removed, so convert
to the new iterator macros.

Just like in omap, use crtc_state->active instead of
crtc_state->enable when waiting for completion.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Archit Taneja <architt@codeaurora.org>
Cc: Vincent Abriou <vincent.abriou@st.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Russell King <rmk+kernel@armlinux.org.uk>
Cc: Rob Herring <robh@kernel.org>
Cc: Markus Elfring <elfring@users.sourceforge.net>
Cc: Sushmita Susheelendra <ssusheel@codeaurora.org>
Cc: linux-arm-msm@vger.kernel.org
Cc: freedreno@lists.freedesktop.org
---
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c |  4 ++--
 drivers/gpu/drm/msm/msm_atomic.c        | 16 ++++++++--------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
index bcd1f5cac72c..f7f087419ed8 100644
--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
+++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
@@ -114,7 +114,7 @@ static void mdp4_prepare_commit(struct msm_kms *kms, struct drm_atomic_state *st
 	mdp4_enable(mdp4_kms);
 
 	/* see 119ecb7fd */
-	for_each_crtc_in_state(state, crtc, crtc_state, i)
+	for_each_new_crtc_in_state(state, crtc, crtc_state, i)
 		drm_crtc_vblank_get(crtc);
 }
 
@@ -126,7 +126,7 @@ static void mdp4_complete_commit(struct msm_kms *kms, struct drm_atomic_state *s
 	struct drm_crtc_state *crtc_state;
 
 	/* see 119ecb7fd */
-	for_each_crtc_in_state(state, crtc, crtc_state, i)
+	for_each_new_crtc_in_state(state, crtc, crtc_state, i)
 		drm_crtc_vblank_put(crtc);
 
 	mdp4_disable(mdp4_kms);
diff --git a/drivers/gpu/drm/msm/msm_atomic.c b/drivers/gpu/drm/msm/msm_atomic.c
index 9633a68b14d7..9d3cc1f5e31a 100644
--- a/drivers/gpu/drm/msm/msm_atomic.c
+++ b/drivers/gpu/drm/msm/msm_atomic.c
@@ -84,13 +84,13 @@ static void msm_atomic_wait_for_commit_done(struct drm_device *dev,
 		struct drm_atomic_state *old_state)
 {
 	struct drm_crtc *crtc;
-	struct drm_crtc_state *crtc_state;
+	struct drm_crtc_state *new_crtc_state;
 	struct msm_drm_private *priv = old_state->dev->dev_private;
 	struct msm_kms *kms = priv->kms;
 	int i;
 
-	for_each_crtc_in_state(old_state, crtc, crtc_state, i) {
-		if (!crtc->state->enable)
+	for_each_new_crtc_in_state(old_state, crtc, new_crtc_state, i) {
+		if (!new_crtc_state->active)
 			continue;
 
 		kms->funcs->wait_for_crtc_commit_done(kms, crtc);
@@ -195,7 +195,7 @@ int msm_atomic_commit(struct drm_device *dev,
 	struct drm_crtc *crtc;
 	struct drm_crtc_state *crtc_state;
 	struct drm_plane *plane;
-	struct drm_plane_state *plane_state;
+	struct drm_plane_state *old_plane_state, *new_plane_state;
 	int i, ret;
 
 	ret = drm_atomic_helper_prepare_planes(dev, state);
@@ -211,15 +211,15 @@ int msm_atomic_commit(struct drm_device *dev,
 	/*
 	 * Figure out what crtcs we have:
 	 */
-	for_each_crtc_in_state(state, crtc, crtc_state, i)
+	for_each_new_crtc_in_state(state, crtc, crtc_state, i)
 		c->crtc_mask |= drm_crtc_mask(crtc);
 
 	/*
 	 * Figure out what fence to wait for:
 	 */
-	for_each_plane_in_state(state, plane, plane_state, i) {
-		if ((plane->state->fb != plane_state->fb) && plane_state->fb) {
-			struct drm_gem_object *obj = msm_framebuffer_bo(plane_state->fb, 0);
+	for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) {
+		if ((new_plane_state->fb != old_plane_state->fb) && new_plane_state->fb) {
+			struct drm_gem_object *obj = msm_framebuffer_bo(new_plane_state->fb, 0);
 			struct msm_gem_object *msm_obj = to_msm_bo(obj);
 			struct dma_fence *fence = reservation_object_get_excl_rcu(msm_obj->resv);
 
-- 
2.11.0

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

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

* [PATCH 15/16] drm/nouveau: Convert nouveau to use new iterator macros
  2017-07-12  8:13 [PATCH 00/16] drm/atomic: Remove deprecated atomic iterator macros Maarten Lankhorst
                   ` (13 preceding siblings ...)
       [not found] ` <20170712081344.25495-1-maarten.lankhorst-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
@ 2017-07-12  8:13 ` Maarten Lankhorst
  2017-07-13 12:33   ` [Intel-gfx] " Daniel Vetter
  2017-07-12  8:13 ` [PATCH 16/16] drm/atomic: Remove deprecated accessor macros Maarten Lankhorst
  2017-07-12  8:33 ` ✓ Fi.CI.BAT: success for drm/atomic: Remove deprecated atomic iterator macros Patchwork
  16 siblings, 1 reply; 59+ messages in thread
From: Maarten Lankhorst @ 2017-07-12  8:13 UTC (permalink / raw)
  To: dri-devel; +Cc: nouveau, intel-gfx, Ben Skeggs

Use the new atomic iterator macros, the old ones are about to be
removed. With the new macros, it's more easy to get old and new state so
get them from the macros instead of from obj->state.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: nouveau@lists.freedesktop.org
---
 drivers/gpu/drm/nouveau/nv50_display.c | 71 +++++++++++++++++-----------------
 1 file changed, 36 insertions(+), 35 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index 42a85c14aea0..b1ce8f1f58dc 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -2103,7 +2103,7 @@ nv50_head_atomic_check(struct drm_crtc *crtc, struct drm_crtc_state *state)
 
 	NV_ATOMIC(drm, "%s atomic_check %d\n", crtc->name, asyh->state.active);
 	if (asyh->state.active) {
-		for_each_connector_in_state(asyh->state.state, conn, conns, i) {
+		for_each_new_connector_in_state(asyh->state.state, conn, conns, i) {
 			if (conns->crtc == crtc) {
 				asyc = nouveau_conn_atom(conns);
 				break;
@@ -3904,9 +3904,9 @@ static void
 nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
 {
 	struct drm_device *dev = state->dev;
-	struct drm_crtc_state *crtc_state;
+	struct drm_crtc_state *new_crtc_state;
 	struct drm_crtc *crtc;
-	struct drm_plane_state *plane_state;
+	struct drm_plane_state *new_plane_state;
 	struct drm_plane *plane;
 	struct nouveau_drm *drm = nouveau_drm(dev);
 	struct nv50_disp *disp = nv50_disp(dev);
@@ -3925,8 +3925,8 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
 		mutex_lock(&disp->mutex);
 
 	/* Disable head(s). */
-	for_each_crtc_in_state(state, crtc, crtc_state, i) {
-		struct nv50_head_atom *asyh = nv50_head_atom(crtc->state);
+	for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
+		struct nv50_head_atom *asyh = nv50_head_atom(new_crtc_state);
 		struct nv50_head *head = nv50_head(crtc);
 
 		NV_ATOMIC(drm, "%s: clr %04x (set %04x)\n", crtc->name,
@@ -3939,8 +3939,8 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
 	}
 
 	/* Disable plane(s). */
-	for_each_plane_in_state(state, plane, plane_state, i) {
-		struct nv50_wndw_atom *asyw = nv50_wndw_atom(plane->state);
+	for_each_new_plane_in_state(state, plane, new_plane_state, i) {
+		struct nv50_wndw_atom *asyw = nv50_wndw_atom(new_plane_state);
 		struct nv50_wndw *wndw = nv50_wndw(plane);
 
 		NV_ATOMIC(drm, "%s: clr %02x (set %02x)\n", plane->name,
@@ -4005,8 +4005,8 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
 	}
 
 	/* Update head(s). */
-	for_each_crtc_in_state(state, crtc, crtc_state, i) {
-		struct nv50_head_atom *asyh = nv50_head_atom(crtc->state);
+	for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
+		struct nv50_head_atom *asyh = nv50_head_atom(new_crtc_state);
 		struct nv50_head *head = nv50_head(crtc);
 
 		NV_ATOMIC(drm, "%s: set %04x (clr %04x)\n", crtc->name,
@@ -4018,14 +4018,14 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
 		}
 	}
 
-	for_each_crtc_in_state(state, crtc, crtc_state, i) {
-		if (crtc->state->event)
+	for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
+		if (new_crtc_state->event)
 			drm_crtc_vblank_get(crtc);
 	}
 
 	/* Update plane(s). */
-	for_each_plane_in_state(state, plane, plane_state, i) {
-		struct nv50_wndw_atom *asyw = nv50_wndw_atom(plane->state);
+	for_each_new_plane_in_state(state, plane, new_plane_state, i) {
+		struct nv50_wndw_atom *asyw = nv50_wndw_atom(new_plane_state);
 		struct nv50_wndw *wndw = nv50_wndw(plane);
 
 		NV_ATOMIC(drm, "%s: set %02x (clr %02x)\n", plane->name,
@@ -4055,23 +4055,23 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
 		mutex_unlock(&disp->mutex);
 
 	/* Wait for HW to signal completion. */
-	for_each_plane_in_state(state, plane, plane_state, i) {
-		struct nv50_wndw_atom *asyw = nv50_wndw_atom(plane->state);
+	for_each_new_plane_in_state(state, plane, new_plane_state, i) {
+		struct nv50_wndw_atom *asyw = nv50_wndw_atom(new_plane_state);
 		struct nv50_wndw *wndw = nv50_wndw(plane);
 		int ret = nv50_wndw_wait_armed(wndw, asyw);
 		if (ret)
 			NV_ERROR(drm, "%s: timeout\n", plane->name);
 	}
 
-	for_each_crtc_in_state(state, crtc, crtc_state, i) {
-		if (crtc->state->event) {
+	for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
+		if (new_crtc_state->event) {
 			unsigned long flags;
 			/* Get correct count/ts if racing with vblank irq */
 			drm_crtc_accurate_vblank_count(crtc);
 			spin_lock_irqsave(&crtc->dev->event_lock, flags);
-			drm_crtc_send_vblank_event(crtc, crtc->state->event);
+			drm_crtc_send_vblank_event(crtc, new_crtc_state->event);
 			spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
-			crtc->state->event = NULL;
+			new_crtc_state->event = NULL;
 			drm_crtc_vblank_put(crtc);
 		}
 	}
@@ -4096,7 +4096,7 @@ nv50_disp_atomic_commit(struct drm_device *dev,
 {
 	struct nouveau_drm *drm = nouveau_drm(dev);
 	struct nv50_disp *disp = nv50_disp(dev);
-	struct drm_plane_state *plane_state;
+	struct drm_plane_state *old_plane_state;
 	struct drm_plane *plane;
 	struct drm_crtc *crtc;
 	bool active = false;
@@ -4122,8 +4122,8 @@ nv50_disp_atomic_commit(struct drm_device *dev,
 			goto done;
 	}
 
-	for_each_plane_in_state(state, plane, plane_state, i) {
-		struct nv50_wndw_atom *asyw = nv50_wndw_atom(plane_state);
+	for_each_old_plane_in_state(state, plane, old_plane_state, i) {
+		struct nv50_wndw_atom *asyw = nv50_wndw_atom(old_plane_state);
 		struct nv50_wndw *wndw = nv50_wndw(plane);
 		if (asyw->set.image) {
 			asyw->ntfy.handle = wndw->dmac->sync.handle;
@@ -4185,18 +4185,19 @@ nv50_disp_outp_atomic_add(struct nv50_atom *atom, struct drm_encoder *encoder)
 
 static int
 nv50_disp_outp_atomic_check_clr(struct nv50_atom *atom,
-				struct drm_connector *connector)
+				struct drm_connector_state *old_connector_state)
 {
-	struct drm_encoder *encoder = connector->state->best_encoder;
-	struct drm_crtc_state *crtc_state;
+	struct drm_encoder *encoder = old_connector_state->best_encoder;
+	struct drm_crtc_state *old_crtc_state, *new_crtc_state;
 	struct drm_crtc *crtc;
 	struct nv50_outp_atom *outp;
 
-	if (!(crtc = connector->state->crtc))
+	if (!(crtc = old_connector_state->crtc))
 		return 0;
 
-	crtc_state = drm_atomic_get_existing_crtc_state(&atom->state, crtc);
-	if (crtc->state->active && drm_atomic_crtc_needs_modeset(crtc_state)) {
+	old_crtc_state = drm_atomic_get_new_crtc_state(&atom->state, crtc);
+	new_crtc_state = drm_atomic_get_new_crtc_state(&atom->state, crtc);
+	if (old_crtc_state->active && drm_atomic_crtc_needs_modeset(new_crtc_state)) {
 		outp = nv50_disp_outp_atomic_add(atom, encoder);
 		if (IS_ERR(outp))
 			return PTR_ERR(outp);
@@ -4217,15 +4218,15 @@ nv50_disp_outp_atomic_check_set(struct nv50_atom *atom,
 				struct drm_connector_state *connector_state)
 {
 	struct drm_encoder *encoder = connector_state->best_encoder;
-	struct drm_crtc_state *crtc_state;
+	struct drm_crtc_state *new_crtc_state;
 	struct drm_crtc *crtc;
 	struct nv50_outp_atom *outp;
 
 	if (!(crtc = connector_state->crtc))
 		return 0;
 
-	crtc_state = drm_atomic_get_existing_crtc_state(&atom->state, crtc);
-	if (crtc_state->active && drm_atomic_crtc_needs_modeset(crtc_state)) {
+	new_crtc_state = drm_atomic_get_new_crtc_state(&atom->state, crtc);
+	if (new_crtc_state->active && drm_atomic_crtc_needs_modeset(new_crtc_state)) {
 		outp = nv50_disp_outp_atomic_add(atom, encoder);
 		if (IS_ERR(outp))
 			return PTR_ERR(outp);
@@ -4241,7 +4242,7 @@ static int
 nv50_disp_atomic_check(struct drm_device *dev, struct drm_atomic_state *state)
 {
 	struct nv50_atom *atom = nv50_atom(state);
-	struct drm_connector_state *connector_state;
+	struct drm_connector_state *old_connector_state, *new_connector_state;
 	struct drm_connector *connector;
 	int ret, i;
 
@@ -4249,12 +4250,12 @@ nv50_disp_atomic_check(struct drm_device *dev, struct drm_atomic_state *state)
 	if (ret)
 		return ret;
 
-	for_each_connector_in_state(state, connector, connector_state, i) {
-		ret = nv50_disp_outp_atomic_check_clr(atom, connector);
+	for_each_oldnew_connector_in_state(state, connector, old_connector_state, new_connector_state, i) {
+		ret = nv50_disp_outp_atomic_check_clr(atom, old_connector_state);
 		if (ret)
 			return ret;
 
-		ret = nv50_disp_outp_atomic_check_set(atom, connector_state);
+		ret = nv50_disp_outp_atomic_check_set(atom, new_connector_state);
 		if (ret)
 			return ret;
 	}
-- 
2.11.0

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

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

* [PATCH 16/16] drm/atomic: Remove deprecated accessor macros
  2017-07-12  8:13 [PATCH 00/16] drm/atomic: Remove deprecated atomic iterator macros Maarten Lankhorst
                   ` (14 preceding siblings ...)
  2017-07-12  8:13 ` [PATCH 15/16] drm/nouveau: Convert nouveau to use new iterator macros Maarten Lankhorst
@ 2017-07-12  8:13 ` Maarten Lankhorst
  2017-07-12  9:50   ` Daniel Vetter
  2017-07-12  8:33 ` ✓ Fi.CI.BAT: success for drm/atomic: Remove deprecated atomic iterator macros Patchwork
  16 siblings, 1 reply; 59+ messages in thread
From: Maarten Lankhorst @ 2017-07-12  8:13 UTC (permalink / raw)
  To: dri-devel; +Cc: David Airlie, intel-gfx, Daniel Vetter

Now that the last users have been converted, we can finally get rid of
for_each_obj_in_state, we have better macros to replace them with.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: David Airlie <airlied@linux.ie>
---
 include/drm/drm_atomic.h    | 75 ---------------------------------------------
 include/drm/drm_connector.h |  3 +-
 include/drm/drm_crtc.h      |  8 ++---
 include/drm/drm_plane.h     |  8 ++---
 4 files changed, 9 insertions(+), 85 deletions(-)

diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
index dcc8e0cdb7ff..9f484d0ebcb6 100644
--- a/include/drm/drm_atomic.h
+++ b/include/drm/drm_atomic.h
@@ -555,31 +555,6 @@ int __must_check drm_atomic_nonblocking_commit(struct drm_atomic_state *state);
 void drm_state_dump(struct drm_device *dev, struct drm_printer *p);
 
 /**
- * for_each_connector_in_state - iterate over all connectors in an atomic update
- * @__state: &struct drm_atomic_state pointer
- * @connector: &struct drm_connector iteration cursor
- * @connector_state: &struct drm_connector_state iteration cursor
- * @__i: int iteration cursor, for macro-internal use
- *
- * This iterates over all connectors in an atomic update. Note that before the
- * software state is committed (by calling drm_atomic_helper_swap_state(), this
- * points to the new state, while afterwards it points to the old state. Due to
- * this tricky confusion this macro is deprecated.
- *
- * FIXME:
- *
- * Replace all usage of this with one of the explicit iterators below and then
- * remove this macro.
- */
-#define for_each_connector_in_state(__state, connector, connector_state, __i) \
-	for ((__i) = 0;							\
-	     (__i) < (__state)->num_connector &&				\
-	     ((connector) = (__state)->connectors[__i].ptr,			\
-	     (connector_state) = (__state)->connectors[__i].state, 1); 	\
-	     (__i)++)							\
-		for_each_if (connector)
-
-/**
  * for_each_oldnew_connector_in_state - iterate over all connectors in an atomic update
  * @__state: &struct drm_atomic_state pointer
  * @connector: &struct drm_connector iteration cursor
@@ -643,31 +618,6 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p);
 		for_each_if (connector)
 
 /**
- * for_each_crtc_in_state - iterate over all connectors in an atomic update
- * @__state: &struct drm_atomic_state pointer
- * @crtc: &struct drm_crtc iteration cursor
- * @crtc_state: &struct drm_crtc_state iteration cursor
- * @__i: int iteration cursor, for macro-internal use
- *
- * This iterates over all CRTCs in an atomic update. Note that before the
- * software state is committed (by calling drm_atomic_helper_swap_state(), this
- * points to the new state, while afterwards it points to the old state. Due to
- * this tricky confusion this macro is deprecated.
- *
- * FIXME:
- *
- * Replace all usage of this with one of the explicit iterators below and then
- * remove this macro.
- */
-#define for_each_crtc_in_state(__state, crtc, crtc_state, __i)	\
-	for ((__i) = 0;						\
-	     (__i) < (__state)->dev->mode_config.num_crtc &&	\
-	     ((crtc) = (__state)->crtcs[__i].ptr,			\
-	     (crtc_state) = (__state)->crtcs[__i].state, 1);	\
-	     (__i)++)						\
-		for_each_if (crtc_state)
-
-/**
  * for_each_oldnew_crtc_in_state - iterate over all CRTCs in an atomic update
  * @__state: &struct drm_atomic_state pointer
  * @crtc: &struct drm_crtc iteration cursor
@@ -727,31 +677,6 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p);
 		for_each_if (crtc)
 
 /**
- * for_each_plane_in_state - iterate over all planes in an atomic update
- * @__state: &struct drm_atomic_state pointer
- * @plane: &struct drm_plane iteration cursor
- * @plane_state: &struct drm_plane_state iteration cursor
- * @__i: int iteration cursor, for macro-internal use
- *
- * This iterates over all planes in an atomic update. Note that before the
- * software state is committed (by calling drm_atomic_helper_swap_state(), this
- * points to the new state, while afterwards it points to the old state. Due to
- * this tricky confusion this macro is deprecated.
- *
- * FIXME:
- *
- * Replace all usage of this with one of the explicit iterators below and then
- * remove this macro.
- */
-#define for_each_plane_in_state(__state, plane, plane_state, __i)		\
-	for ((__i) = 0;							\
-	     (__i) < (__state)->dev->mode_config.num_total_plane &&	\
-	     ((plane) = (__state)->planes[__i].ptr,				\
-	     (plane_state) = (__state)->planes[__i].state, 1);		\
-	     (__i)++)							\
-		for_each_if (plane_state)
-
-/**
  * for_each_oldnew_plane_in_state - iterate over all planes in an atomic update
  * @__state: &struct drm_atomic_state pointer
  * @plane: &struct drm_plane iteration cursor
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index ae5b7dc316c8..4878007103e2 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -858,8 +858,7 @@ struct drm_connector {
 	 * This is protected by @drm_mode_config.connection_mutex. Note that
 	 * nonblocking atomic commits access the current connector state without
 	 * taking locks. Either by going through the &struct drm_atomic_state
-	 * pointers, see for_each_connector_in_state(),
-	 * for_each_oldnew_connector_in_state(),
+	 * pointers, see for_each_oldnew_connector_in_state(),
 	 * for_each_old_connector_in_state() and
 	 * for_each_new_connector_in_state(). Or through careful ordering of
 	 * atomic commit operations as implemented in the atomic helpers, see
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 3a911a64c257..c4c949ea20da 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -807,10 +807,10 @@ struct drm_crtc {
 	 * This is protected by @mutex. Note that nonblocking atomic commits
 	 * access the current CRTC state without taking locks. Either by going
 	 * through the &struct drm_atomic_state pointers, see
-	 * for_each_crtc_in_state(), for_each_oldnew_crtc_in_state(),
-	 * for_each_old_crtc_in_state() and for_each_new_crtc_in_state(). Or
-	 * through careful ordering of atomic commit operations as implemented
-	 * in the atomic helpers, see &struct drm_crtc_commit.
+	 * for_each_oldnew_crtc_in_state(), for_each_old_crtc_in_state() and
+	 * for_each_new_crtc_in_state(). Or through careful ordering of atomic
+	 * commit operations as implemented in the atomic helpers, see
+	 * &struct drm_crtc_commit.
 	 */
 	struct drm_crtc_state *state;
 
diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
index 9ab3e7044812..a1b3aa5d1223 100644
--- a/include/drm/drm_plane.h
+++ b/include/drm/drm_plane.h
@@ -514,10 +514,10 @@ struct drm_plane {
 	 * This is protected by @mutex. Note that nonblocking atomic commits
 	 * access the current plane state without taking locks. Either by going
 	 * through the &struct drm_atomic_state pointers, see
-	 * for_each_plane_in_state(), for_each_oldnew_plane_in_state(),
-	 * for_each_old_plane_in_state() and for_each_new_plane_in_state(). Or
-	 * through careful ordering of atomic commit operations as implemented
-	 * in the atomic helpers, see &struct drm_crtc_commit.
+	 * for_each_oldnew_plane_in_state(), for_each_old_plane_in_state() and
+	 * for_each_new_plane_in_state(). Or through careful ordering of atomic
+	 * commit operations as implemented in the atomic helpers, see
+	 * &struct drm_crtc_commit.
 	 */
 	struct drm_plane_state *state;
 
-- 
2.11.0

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

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

* ✓ Fi.CI.BAT: success for drm/atomic: Remove deprecated atomic iterator macros.
  2017-07-12  8:13 [PATCH 00/16] drm/atomic: Remove deprecated atomic iterator macros Maarten Lankhorst
                   ` (15 preceding siblings ...)
  2017-07-12  8:13 ` [PATCH 16/16] drm/atomic: Remove deprecated accessor macros Maarten Lankhorst
@ 2017-07-12  8:33 ` Patchwork
  16 siblings, 0 replies; 59+ messages in thread
From: Patchwork @ 2017-07-12  8:33 UTC (permalink / raw)
  To: Maarten Lankhorst; +Cc: intel-gfx

== Series Details ==

Series: drm/atomic: Remove deprecated atomic iterator macros.
URL   : https://patchwork.freedesktop.org/series/27167/
State : success

== Summary ==

Series 27167v1 drm/atomic: Remove deprecated atomic iterator macros.
https://patchwork.freedesktop.org/api/1.0/series/27167/revisions/1/mbox/

Test kms_pipe_crc_basic:
        Subgroup hang-read-crc-pipe-b:
                dmesg-warn -> PASS       (fi-pnv-d510) fdo#101597
        Subgroup suspend-read-crc-pipe-b:
                dmesg-warn -> PASS       (fi-byt-n2820) fdo#101705

fdo#101597 https://bugs.freedesktop.org/show_bug.cgi?id=101597
fdo#101705 https://bugs.freedesktop.org/show_bug.cgi?id=101705

fi-bdw-5557u     total:279  pass:268  dwarn:0   dfail:0   fail:0   skip:11  time:442s
fi-bdw-gvtdvm    total:279  pass:265  dwarn:0   dfail:0   fail:0   skip:14  time:428s
fi-blb-e6850     total:279  pass:224  dwarn:1   dfail:0   fail:0   skip:54  time:360s
fi-bsw-n3050     total:279  pass:243  dwarn:0   dfail:0   fail:0   skip:36  time:539s
fi-bxt-j4205     total:279  pass:260  dwarn:0   dfail:0   fail:0   skip:19  time:505s
fi-byt-j1900     total:279  pass:254  dwarn:1   dfail:0   fail:0   skip:24  time:477s
fi-byt-n2820     total:279  pass:251  dwarn:0   dfail:0   fail:0   skip:28  time:487s
fi-glk-2a        total:279  pass:260  dwarn:0   dfail:0   fail:0   skip:19  time:598s
fi-hsw-4770      total:279  pass:263  dwarn:0   dfail:0   fail:0   skip:16  time:431s
fi-hsw-4770r     total:279  pass:263  dwarn:0   dfail:0   fail:0   skip:16  time:414s
fi-ilk-650       total:279  pass:229  dwarn:0   dfail:0   fail:0   skip:50  time:415s
fi-ivb-3520m     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:501s
fi-ivb-3770      total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:467s
fi-kbl-7500u     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:462s
fi-kbl-7560u     total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:572s
fi-kbl-r         total:279  pass:260  dwarn:1   dfail:0   fail:0   skip:18  time:576s
fi-pnv-d510      total:279  pass:223  dwarn:1   dfail:0   fail:0   skip:55  time:561s
fi-skl-6260u     total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:461s
fi-skl-6700hq    total:279  pass:262  dwarn:0   dfail:0   fail:0   skip:17  time:590s
fi-skl-6700k     total:279  pass:257  dwarn:4   dfail:0   fail:0   skip:18  time:471s
fi-skl-6770hq    total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:471s
fi-skl-gvtdvm    total:279  pass:266  dwarn:0   dfail:0   fail:0   skip:13  time:436s
fi-skl-x1585l    total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:487s
fi-snb-2520m     total:279  pass:251  dwarn:0   dfail:0   fail:0   skip:28  time:539s
fi-snb-2600      total:279  pass:250  dwarn:0   dfail:0   fail:0   skip:29  time:401s

8ad9e19aafea47c272163c2cbf554e06ff7f9857 drm-tip: 2017y-07m-11d-19h-08m-20s UTC integration manifest
22b3ac7 drm/atomic: Remove deprecated accessor macros
a19a1ab drm/nouveau: Convert nouveau to use new iterator macros
e091ae9 drm/msm: Convert to use new iterator macros
370f2d6 drm/mediatek: Convert to new iterator macros
79eb2eb drm/imx: Use atomic iterator macros
82c6cee drm/mali: Use new atomic iterator macros
6cd575f drm/omapdrm: Fix omap_atomic_wait_for_completion
d83e858 drm/rockchip: Use for_each_oldnew_plane_in_state in vop_crtc_atomic_flush
2932a08 drm/atmel-hlcdec: Use for_each_new_connector_in_state
d1d8e27 drm/rcar-du: Use new iterator macros
490b345 drm/i915: Use correct iterator macro
656329b drm/vmwgfx: Make check_modeset() use the new atomic iterator macros.
3e42258 drm/atomic: Use new iterator macros in drm_atomic_helper_wait_for_flip_done
641dc6d drm/atomic: Use the new helpers in drm_atomic_helper_disable_all()
bbfc4ec drm/atomic: Use the correct iterator macro in atomic_remove_fb
a495fa3 drm/simple-kms-helper: Fix the check for the mismatch between plane and CRTC enabled.

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_5171/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH 05/16] drm/vmwgfx: Make check_modeset() use the new atomic iterator macros.
  2017-07-12  8:13 ` [PATCH 05/16] drm/vmwgfx: Make check_modeset() use the new atomic iterator macros Maarten Lankhorst
@ 2017-07-12  8:33   ` Sinclair Yeh
  2017-07-12  9:09   ` [Intel-gfx] " Daniel Vetter
  1 sibling, 0 replies; 59+ messages in thread
From: Sinclair Yeh @ 2017-07-12  8:33 UTC (permalink / raw)
  To: Maarten Lankhorst; +Cc: intel-gfx, VMware Graphics, Thomas Hellstrom, dri-devel

Reviewed-by: Sinclair Yeh <syeh@vmware.com>

On Wed, Jul 12, 2017 at 10:13:33AM +0200, Maarten Lankhorst wrote:
> I don't think the checking of resources in this function is very
> atomic-like, but it should definitely not use a macro that's about
> to be removed.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>
> Cc: Sinclair Yeh <syeh@vmware.com>
> Cc: Thomas Hellstrom <thellstrom@vmware.com>
> ---
>  drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> index 1cd67b10a0d9..64f66ff97fab 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> @@ -1536,8 +1536,7 @@ vmw_kms_atomic_check_modeset(struct drm_device *dev,
>  	struct vmw_private *dev_priv = vmw_priv(dev);
>  	int i;
>  
> -
> -	for_each_crtc_in_state(state, crtc, crtc_state, i) {
> +	for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
>  		unsigned long requested_bb_mem = 0;
>  
>  		if (dev_priv->active_display_unit == vmw_du_screen_target) {
> -- 
> 2.11.0
> 
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 01/16] drm/simple-kms-helper: Fix the check for the mismatch between plane and CRTC enabled.
  2017-07-12  8:13 ` [PATCH 01/16] drm/simple-kms-helper: Fix the check for the mismatch between plane and CRTC enabled Maarten Lankhorst
@ 2017-07-12  9:01   ` Daniel Vetter
  0 siblings, 0 replies; 59+ messages in thread
From: Daniel Vetter @ 2017-07-12  9:01 UTC (permalink / raw)
  To: Maarten Lankhorst; +Cc: David Airlie, Daniel Vetter, intel-gfx, dri-devel

On Wed, Jul 12, 2017 at 10:13:29AM +0200, Maarten Lankhorst wrote:
> You can enable the CRTC and without adding the plane to the state and
> it will succeed. This should be prevented in the crtc check instead of
> the plane check, because the plane check may never run for atomic
> enable, but the crtc check always will.
> 
> This is based on a similar check in vmwgfx.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Sean Paul <seanpaul@chromium.org>
> Cc: David Airlie <airlied@linux.ie>

Somehow this missed to cc: Noralf ... I guess get_maintainers is not quite
smart enough.

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

> ---
>  drivers/gpu/drm/drm_simple_kms_helper.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c b/drivers/gpu/drm/drm_simple_kms_helper.c
> index 98250854af75..39c203ad59db 100644
> --- a/drivers/gpu/drm/drm_simple_kms_helper.c
> +++ b/drivers/gpu/drm/drm_simple_kms_helper.c
> @@ -37,6 +37,13 @@ static const struct drm_encoder_funcs drm_simple_kms_encoder_funcs = {
>  static int drm_simple_kms_crtc_check(struct drm_crtc *crtc,
>  				     struct drm_crtc_state *state)
>  {
> +	bool has_primary = state->plane_mask &
> +			   BIT(drm_plane_index(crtc->primary));
> +
> +	/* We always want to have an active plane with an active CRTC */
> +	if (has_primary != state->enable)
> +		return -EINVAL;
> +
>  	return drm_atomic_add_affected_planes(state->state, crtc);
>  }
>  
> @@ -90,9 +97,6 @@ static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane,
>  	pipe = container_of(plane, struct drm_simple_display_pipe, plane);
>  	crtc_state = drm_atomic_get_new_crtc_state(plane_state->state,
>  						   &pipe->crtc);
> -	if (crtc_state->enable != !!plane_state->crtc)
> -		return -EINVAL; /* plane must match crtc enable state */
> -
>  	if (!crtc_state->enable)
>  		return 0; /* nothing to check when disabling or disabled */
>  
> -- 
> 2.11.0
> 
> _______________________________________________
> 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] 59+ messages in thread

* Re: [PATCH 02/16] drm/atomic: Use the correct iterator macro in atomic_remove_fb
  2017-07-12  8:13 ` [PATCH 02/16] drm/atomic: Use the correct iterator macro in atomic_remove_fb Maarten Lankhorst
@ 2017-07-12  9:01   ` Daniel Vetter
  0 siblings, 0 replies; 59+ messages in thread
From: Daniel Vetter @ 2017-07-12  9:01 UTC (permalink / raw)
  To: Maarten Lankhorst; +Cc: Daniel Vetter, intel-gfx, dri-devel

On Wed, Jul 12, 2017 at 10:13:30AM +0200, Maarten Lankhorst wrote:
> for_each_obj_in_state will be removed, so use the new state here.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Sean Paul <seanpaul@chromium.org>
> Cc: David Airlie <airlied@linux.ie>

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

> ---
>  drivers/gpu/drm/drm_framebuffer.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
> index fc8ef42203ec..607ef3a97c42 100644
> --- a/drivers/gpu/drm/drm_framebuffer.c
> +++ b/drivers/gpu/drm/drm_framebuffer.c
> @@ -817,7 +817,7 @@ static int atomic_remove_fb(struct drm_framebuffer *fb)
>  		plane->old_fb = plane->fb;
>  	}
>  
> -	for_each_connector_in_state(state, conn, conn_state, i) {
> +	for_each_new_connector_in_state(state, conn, conn_state, i) {
>  		ret = drm_atomic_set_crtc_for_connector(conn_state, NULL);
>  
>  		if (ret)
> -- 
> 2.11.0
> 
> _______________________________________________
> 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] 59+ messages in thread

* Re: [PATCH 03/16] drm/atomic: Use the new helpers in drm_atomic_helper_disable_all()
  2017-07-12  8:13 ` [PATCH 03/16] drm/atomic: Use the new helpers in drm_atomic_helper_disable_all() Maarten Lankhorst
@ 2017-07-12  9:03   ` Daniel Vetter
  0 siblings, 0 replies; 59+ messages in thread
From: Daniel Vetter @ 2017-07-12  9:03 UTC (permalink / raw)
  To: Maarten Lankhorst; +Cc: Daniel Vetter, intel-gfx, dri-devel

On Wed, Jul 12, 2017 at 10:13:31AM +0200, Maarten Lankhorst wrote:
> for_each_obj_in_state will be removed, so don't use it here.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Sean Paul <seanpaul@chromium.org>
> Cc: David Airlie <airlied@linux.ie>

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

> ---
>  drivers/gpu/drm/drm_atomic_helper.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index 667ec97d4efb..391cd887f922 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -2715,13 +2715,13 @@ int drm_atomic_helper_disable_all(struct drm_device *dev,
>  			goto free;
>  	}
>  
> -	for_each_connector_in_state(state, conn, conn_state, i) {
> +	for_each_new_connector_in_state(state, conn, conn_state, i) {
>  		ret = drm_atomic_set_crtc_for_connector(conn_state, NULL);
>  		if (ret < 0)
>  			goto free;
>  	}
>  
> -	for_each_plane_in_state(state, plane, plane_state, i) {
> +	for_each_new_plane_in_state(state, plane, plane_state, i) {
>  		ret = drm_atomic_set_crtc_for_plane(plane_state, NULL);
>  		if (ret < 0)
>  			goto free;
> -- 
> 2.11.0
> 
> _______________________________________________
> 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] 59+ messages in thread

* Re: [Intel-gfx] [PATCH 04/16] drm/atomic: Use new iterator macros in drm_atomic_helper_wait_for_flip_done
  2017-07-12  8:13 ` [PATCH 04/16] drm/atomic: Use new iterator macros in drm_atomic_helper_wait_for_flip_done Maarten Lankhorst
@ 2017-07-12  9:07   ` Daniel Vetter
  0 siblings, 0 replies; 59+ messages in thread
From: Daniel Vetter @ 2017-07-12  9:07 UTC (permalink / raw)
  To: Maarten Lankhorst; +Cc: Daniel Vetter, intel-gfx, dri-devel

On Wed, Jul 12, 2017 at 10:13:32AM +0200, Maarten Lankhorst wrote:
> for_each_obj_in_state is about to be removed, so use the correct new
> iterator macro.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Sean Paul <seanpaul@chromium.org>
> Cc: David Airlie <airlied@linux.ie>
> ---
>  drivers/gpu/drm/drm_atomic_helper.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index 391cd887f922..29a8098d3ca7 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -1270,7 +1270,7 @@ void drm_atomic_helper_wait_for_flip_done(struct drm_device *dev,
>  	struct drm_crtc *crtc;
>  	int i;
>  
> -	for_each_crtc_in_state(old_state, crtc, crtc_state, i) {
> +	for_each_new_crtc_in_state(old_state, crtc, crtc_state, i) {

Hm, should we do an s/crtc_state/unused/ here, this is a bit confusing
since we don't really care about whether we get the new or old state.

>  		struct drm_crtc_commit *commit = old_state->crtcs[i].commit;
>  		int ret;
>  
> @@ -1426,7 +1426,7 @@ int drm_atomic_helper_async_check(struct drm_device *dev,
>  		if (!crtc->state->state)
>  			continue;
>  
> -		for_each_plane_in_state(crtc->state->state, __plane,

s/crtc->state->state/state/ ... somehow didn't spot that. And maybe split
this hunk here out and Cc: Gustavo.

> +		for_each_new_plane_in_state(crtc->state->state, __plane,
>  					__plane_state, j) {
>  			if (__plane == plane)
>  				return -EINVAL;

Thinking about this some more, this doesn't do anything at all, because
crtc->state->state is always NULL once committed. I think this needs an
entirely different patch, we probably need to check for
crtc_commit->hw_done. This here doesn't do the right thing I think.

Anyway, on the first hunk only, with the bikeshed to rename the unused
variable to "unused" applied:

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

> -- 
> 2.11.0
> 
> _______________________________________________
> 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] 59+ messages in thread

* Re: [Intel-gfx] [PATCH 05/16] drm/vmwgfx: Make check_modeset() use the new atomic iterator macros.
  2017-07-12  8:13 ` [PATCH 05/16] drm/vmwgfx: Make check_modeset() use the new atomic iterator macros Maarten Lankhorst
  2017-07-12  8:33   ` Sinclair Yeh
@ 2017-07-12  9:09   ` Daniel Vetter
  2017-07-12  9:11     ` Sinclair Yeh
  1 sibling, 1 reply; 59+ messages in thread
From: Daniel Vetter @ 2017-07-12  9:09 UTC (permalink / raw)
  To: Maarten Lankhorst; +Cc: intel-gfx, VMware Graphics, Thomas Hellstrom, dri-devel

On Wed, Jul 12, 2017 at 10:13:33AM +0200, Maarten Lankhorst wrote:
> I don't think the checking of resources in this function is very
> atomic-like, but it should definitely not use a macro that's about
> to be removed.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>
> Cc: Sinclair Yeh <syeh@vmware.com>
> Cc: Thomas Hellstrom <thellstrom@vmware.com>
> ---
>  drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> index 1cd67b10a0d9..64f66ff97fab 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> @@ -1536,8 +1536,7 @@ vmw_kms_atomic_check_modeset(struct drm_device *dev,

Afaics vmw_kms_atomic_check_modeset should be static. Feel free to include
or not include that bikeshed.

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

>  	struct vmw_private *dev_priv = vmw_priv(dev);
>  	int i;
>  
> -
> -	for_each_crtc_in_state(state, crtc, crtc_state, i) {
> +	for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
>  		unsigned long requested_bb_mem = 0;
>  
>  		if (dev_priv->active_display_unit == vmw_du_screen_target) {
> -- 
> 2.11.0
> 
> _______________________________________________
> 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] 59+ messages in thread

* Re: [PATCH 06/16] drm/i915: Use correct iterator macro
  2017-07-12  8:13 ` [PATCH 06/16] drm/i915: Use correct iterator macro Maarten Lankhorst
@ 2017-07-12  9:10   ` Daniel Vetter
  0 siblings, 0 replies; 59+ messages in thread
From: Daniel Vetter @ 2017-07-12  9:10 UTC (permalink / raw)
  To: Maarten Lankhorst; +Cc: Daniel Vetter, intel-gfx, dri-devel

On Wed, Jul 12, 2017 at 10:13:34AM +0200, Maarten Lankhorst wrote:
> for_each_cnonector_in_state will be removed, so use the right state
> here.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: intel-gfx@lists.freedesktop.org

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

> ---
>  drivers/gpu/drm/i915/intel_hdmi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index ec0779a52d53..916340f03882 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -1321,7 +1321,7 @@ static bool hdmi_12bpc_possible(struct intel_crtc_state *crtc_state)
>  	if (crtc_state->output_types != 1 << INTEL_OUTPUT_HDMI)
>  		return false;
>  
> -	for_each_connector_in_state(state, connector, connector_state, i) {
> +	for_each_new_connector_in_state(state, connector, connector_state, i) {
>  		const struct drm_display_info *info = &connector->display_info;
>  
>  		if (connector_state->crtc != crtc_state->base.crtc)
> -- 
> 2.11.0
> 
> _______________________________________________
> 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] 59+ messages in thread

* Re: [Intel-gfx] [PATCH 05/16] drm/vmwgfx: Make check_modeset() use the new atomic iterator macros.
  2017-07-12  9:09   ` [Intel-gfx] " Daniel Vetter
@ 2017-07-12  9:11     ` Sinclair Yeh
  0 siblings, 0 replies; 59+ messages in thread
From: Sinclair Yeh @ 2017-07-12  9:11 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: VMware Graphics, intel-gfx, Thomas Hellstrom, dri-devel

On Wed, Jul 12, 2017 at 11:09:16AM +0200, Daniel Vetter wrote:
> On Wed, Jul 12, 2017 at 10:13:33AM +0200, Maarten Lankhorst wrote:
> > I don't think the checking of resources in this function is very
> > atomic-like, but it should definitely not use a macro that's about
> > to be removed.
> > 
> > Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> > Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>
> > Cc: Sinclair Yeh <syeh@vmware.com>
> > Cc: Thomas Hellstrom <thellstrom@vmware.com>
> > ---
> >  drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> > index 1cd67b10a0d9..64f66ff97fab 100644
> > --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> > +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> > @@ -1536,8 +1536,7 @@ vmw_kms_atomic_check_modeset(struct drm_device *dev,
> 
> Afaics vmw_kms_atomic_check_modeset should be static. Feel free to include
> or not include that bikeshed.
> 
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Yeah, good point.

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

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

* Re: [PATCH 07/16] drm/rcar-du: Use new iterator macros
  2017-07-12  8:13   ` Maarten Lankhorst
@ 2017-07-12  9:15     ` Daniel Vetter
  -1 siblings, 0 replies; 59+ messages in thread
From: Daniel Vetter @ 2017-07-12  9:15 UTC (permalink / raw)
  To: Maarten Lankhorst
  Cc: dri-devel, linux-renesas-soc, intel-gfx, Laurent Pinchart

On Wed, Jul 12, 2017 at 10:13:35AM +0200, Maarten Lankhorst wrote:
> for_each_obj_in_state is about to be removed, so use the correct new
> iterator macros.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: linux-renesas-soc@vger.kernel.org

Looks correct, but I think Laurent has a patch to rework/remove this.
Found something below anyway.

> ---
>  drivers/gpu/drm/rcar-du/rcar_du_plane.c | 41 ++++++++++++++++-----------------
>  1 file changed, 20 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
> index dcde6288da6c..dfd84e3c8c25 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
> @@ -51,12 +51,9 @@
>   */
>  
>  static bool rcar_du_plane_needs_realloc(struct rcar_du_plane *plane,
> +					const struct rcar_du_plane_state *cur_state,
>  					struct rcar_du_plane_state *new_state)
>  {
> -	struct rcar_du_plane_state *cur_state;
> -
> -	cur_state = to_rcar_plane_state(plane->plane.state);
> -
>  	/* Lowering the number of planes doesn't strictly require reallocation
>  	 * as the extra hardware plane will be freed when committing, but doing
>  	 * so could lead to more fragmentation.
> @@ -141,16 +138,17 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
>  	unsigned int groups = 0;
>  	unsigned int i;
>  	struct drm_plane *drm_plane;
> -	struct drm_plane_state *drm_plane_state;
> +	struct drm_plane_state *old_drm_plane_state, *new_drm_plane_state;
>  
>  	/* Check if hardware planes need to be reallocated. */
> -	for_each_plane_in_state(state, drm_plane, drm_plane_state, i) {
> -		struct rcar_du_plane_state *plane_state;
> +	for_each_oldnew_plane_in_state(state, drm_plane, old_drm_plane_state, new_drm_plane_state, i) {
> +		struct rcar_du_plane_state *old_plane_state, *new_plane_state;
>  		struct rcar_du_plane *plane;
>  		unsigned int index;
>  
>  		plane = to_rcar_plane(drm_plane);
> -		plane_state = to_rcar_plane_state(drm_plane_state);
> +		old_plane_state = to_rcar_plane_state(old_drm_plane_state);
> +		new_plane_state = to_rcar_plane_state(new_drm_plane_state);
>  
>  		dev_dbg(rcdu->dev, "%s: checking plane (%u,%tu)\n", __func__,
>  			plane->group->index, plane - plane->group->planes);
> @@ -159,19 +157,19 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
>  		 * the full reallocation procedure. Just mark the hardware
>  		 * plane(s) as freed.
>  		 */
> -		if (!plane_state->format) {
> +		if (!new_plane_state->format) {
>  			dev_dbg(rcdu->dev, "%s: plane is being disabled\n",
>  				__func__);
>  			index = plane - plane->group->planes;
>  			group_freed_planes[plane->group->index] |= 1 << index;
> -			plane_state->hwindex = -1;
> +			new_plane_state->hwindex = -1;
>  			continue;
>  		}
>  
>  		/* If the plane needs to be reallocated mark it as such, and
>  		 * mark the hardware plane(s) as free.
>  		 */
> -		if (rcar_du_plane_needs_realloc(plane, plane_state)) {
> +		if (rcar_du_plane_needs_realloc(plane, old_plane_state, new_plane_state)) {
>  			dev_dbg(rcdu->dev, "%s: plane needs reallocation\n",
>  				__func__);
>  			groups |= 1 << plane->group->index;
> @@ -179,7 +177,7 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
>  
>  			index = plane - plane->group->planes;
>  			group_freed_planes[plane->group->index] |= 1 << index;
> -			plane_state->hwindex = -1;
> +			new_plane_state->hwindex = -1;
>  		}
>  	}
>  
> @@ -226,16 +224,16 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
>  				continue;
>  			}
>  
> -			plane_state = to_rcar_plane_state(plane->plane.state);
> +			new_plane_state = to_rcar_plane_state(plane->plane.state);
>  			used_planes |= rcar_du_plane_hwmask(plane_state);
>  
>  			dev_dbg(rcdu->dev,
>  				"%s: plane (%u,%tu) uses %u hwplanes (index %d)\n",
>  				__func__, plane->group->index,
>  				plane - plane->group->planes,
> -				plane_state->format ?
> -				plane_state->format->planes : 0,
> -				plane_state->hwindex);
> +				new_plane_state->format ?
> +				new_plane_state->format->planes : 0,
> +				new_plane_state->hwindex);
>  		}
>  
>  		group_free_planes[index] = 0xff & ~used_planes;
> @@ -246,15 +244,16 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
>  	}
>  
>  	/* Reallocate hardware planes for each plane that needs it. */
> -	for_each_plane_in_state(state, drm_plane, drm_plane_state, i) {
> -		struct rcar_du_plane_state *plane_state;
> +	for_each_oldnew_plane_in_state(state, drm_plane, old_drm_plane_state, new_drm_plane_state, i) {
> +		struct rcar_du_plane_state *old_plane_state, *new_plane_state;
>  		struct rcar_du_plane *plane;
>  		unsigned int crtc_planes;
>  		unsigned int free;
>  		int idx;
>  
>  		plane = to_rcar_plane(drm_plane);
> -		plane_state = to_rcar_plane_state(drm_plane_state);
> +		old_plane_state = to_rcar_plane_state(old_drm_plane_state);
> +		new_plane_state = to_rcar_plane_state(new_drm_plane_state);
>  
>  		dev_dbg(rcdu->dev, "%s: allocating plane (%u,%tu)\n", __func__,
>  			plane->group->index, plane - plane->group->planes);
> @@ -263,7 +262,7 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
>  		 * reallocated.
>  		 */
>  		if (!plane_state->format ||

I think you missed a few cases of replacing plane_state here. Does this
compile?
-Daniel

> -		    !rcar_du_plane_needs_realloc(plane, plane_state))
> +		    !rcar_du_plane_needs_realloc(plane, old_plane_state, new_plane_state))
>  			continue;
>  
>  		/* Try to allocate the plane from the free planes currently
> @@ -279,7 +278,7 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
>  		idx = rcar_du_plane_hwalloc(plane, plane_state,
>  					    free & crtc_planes);
>  		if (idx < 0)
> -			idx = rcar_du_plane_hwalloc(plane, plane_state,
> +			idx = rcar_du_plane_hwalloc(plane, new_plane_state,
>  						    free);
>  		if (idx < 0) {
>  			dev_dbg(rcdu->dev, "%s: no available hardware plane\n",
> -- 
> 2.11.0
> 
> _______________________________________________
> 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

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

* Re: [PATCH 07/16] drm/rcar-du: Use new iterator macros
@ 2017-07-12  9:15     ` Daniel Vetter
  0 siblings, 0 replies; 59+ messages in thread
From: Daniel Vetter @ 2017-07-12  9:15 UTC (permalink / raw)
  To: Maarten Lankhorst
  Cc: linux-renesas-soc, intel-gfx, Laurent Pinchart, dri-devel

On Wed, Jul 12, 2017 at 10:13:35AM +0200, Maarten Lankhorst wrote:
> for_each_obj_in_state is about to be removed, so use the correct new
> iterator macros.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: linux-renesas-soc@vger.kernel.org

Looks correct, but I think Laurent has a patch to rework/remove this.
Found something below anyway.

> ---
>  drivers/gpu/drm/rcar-du/rcar_du_plane.c | 41 ++++++++++++++++-----------------
>  1 file changed, 20 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
> index dcde6288da6c..dfd84e3c8c25 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
> @@ -51,12 +51,9 @@
>   */
>  
>  static bool rcar_du_plane_needs_realloc(struct rcar_du_plane *plane,
> +					const struct rcar_du_plane_state *cur_state,
>  					struct rcar_du_plane_state *new_state)
>  {
> -	struct rcar_du_plane_state *cur_state;
> -
> -	cur_state = to_rcar_plane_state(plane->plane.state);
> -
>  	/* Lowering the number of planes doesn't strictly require reallocation
>  	 * as the extra hardware plane will be freed when committing, but doing
>  	 * so could lead to more fragmentation.
> @@ -141,16 +138,17 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
>  	unsigned int groups = 0;
>  	unsigned int i;
>  	struct drm_plane *drm_plane;
> -	struct drm_plane_state *drm_plane_state;
> +	struct drm_plane_state *old_drm_plane_state, *new_drm_plane_state;
>  
>  	/* Check if hardware planes need to be reallocated. */
> -	for_each_plane_in_state(state, drm_plane, drm_plane_state, i) {
> -		struct rcar_du_plane_state *plane_state;
> +	for_each_oldnew_plane_in_state(state, drm_plane, old_drm_plane_state, new_drm_plane_state, i) {
> +		struct rcar_du_plane_state *old_plane_state, *new_plane_state;
>  		struct rcar_du_plane *plane;
>  		unsigned int index;
>  
>  		plane = to_rcar_plane(drm_plane);
> -		plane_state = to_rcar_plane_state(drm_plane_state);
> +		old_plane_state = to_rcar_plane_state(old_drm_plane_state);
> +		new_plane_state = to_rcar_plane_state(new_drm_plane_state);
>  
>  		dev_dbg(rcdu->dev, "%s: checking plane (%u,%tu)\n", __func__,
>  			plane->group->index, plane - plane->group->planes);
> @@ -159,19 +157,19 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
>  		 * the full reallocation procedure. Just mark the hardware
>  		 * plane(s) as freed.
>  		 */
> -		if (!plane_state->format) {
> +		if (!new_plane_state->format) {
>  			dev_dbg(rcdu->dev, "%s: plane is being disabled\n",
>  				__func__);
>  			index = plane - plane->group->planes;
>  			group_freed_planes[plane->group->index] |= 1 << index;
> -			plane_state->hwindex = -1;
> +			new_plane_state->hwindex = -1;
>  			continue;
>  		}
>  
>  		/* If the plane needs to be reallocated mark it as such, and
>  		 * mark the hardware plane(s) as free.
>  		 */
> -		if (rcar_du_plane_needs_realloc(plane, plane_state)) {
> +		if (rcar_du_plane_needs_realloc(plane, old_plane_state, new_plane_state)) {
>  			dev_dbg(rcdu->dev, "%s: plane needs reallocation\n",
>  				__func__);
>  			groups |= 1 << plane->group->index;
> @@ -179,7 +177,7 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
>  
>  			index = plane - plane->group->planes;
>  			group_freed_planes[plane->group->index] |= 1 << index;
> -			plane_state->hwindex = -1;
> +			new_plane_state->hwindex = -1;
>  		}
>  	}
>  
> @@ -226,16 +224,16 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
>  				continue;
>  			}
>  
> -			plane_state = to_rcar_plane_state(plane->plane.state);
> +			new_plane_state = to_rcar_plane_state(plane->plane.state);
>  			used_planes |= rcar_du_plane_hwmask(plane_state);
>  
>  			dev_dbg(rcdu->dev,
>  				"%s: plane (%u,%tu) uses %u hwplanes (index %d)\n",
>  				__func__, plane->group->index,
>  				plane - plane->group->planes,
> -				plane_state->format ?
> -				plane_state->format->planes : 0,
> -				plane_state->hwindex);
> +				new_plane_state->format ?
> +				new_plane_state->format->planes : 0,
> +				new_plane_state->hwindex);
>  		}
>  
>  		group_free_planes[index] = 0xff & ~used_planes;
> @@ -246,15 +244,16 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
>  	}
>  
>  	/* Reallocate hardware planes for each plane that needs it. */
> -	for_each_plane_in_state(state, drm_plane, drm_plane_state, i) {
> -		struct rcar_du_plane_state *plane_state;
> +	for_each_oldnew_plane_in_state(state, drm_plane, old_drm_plane_state, new_drm_plane_state, i) {
> +		struct rcar_du_plane_state *old_plane_state, *new_plane_state;
>  		struct rcar_du_plane *plane;
>  		unsigned int crtc_planes;
>  		unsigned int free;
>  		int idx;
>  
>  		plane = to_rcar_plane(drm_plane);
> -		plane_state = to_rcar_plane_state(drm_plane_state);
> +		old_plane_state = to_rcar_plane_state(old_drm_plane_state);
> +		new_plane_state = to_rcar_plane_state(new_drm_plane_state);
>  
>  		dev_dbg(rcdu->dev, "%s: allocating plane (%u,%tu)\n", __func__,
>  			plane->group->index, plane - plane->group->planes);
> @@ -263,7 +262,7 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
>  		 * reallocated.
>  		 */
>  		if (!plane_state->format ||

I think you missed a few cases of replacing plane_state here. Does this
compile?
-Daniel

> -		    !rcar_du_plane_needs_realloc(plane, plane_state))
> +		    !rcar_du_plane_needs_realloc(plane, old_plane_state, new_plane_state))
>  			continue;
>  
>  		/* Try to allocate the plane from the free planes currently
> @@ -279,7 +278,7 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
>  		idx = rcar_du_plane_hwalloc(plane, plane_state,
>  					    free & crtc_planes);
>  		if (idx < 0)
> -			idx = rcar_du_plane_hwalloc(plane, plane_state,
> +			idx = rcar_du_plane_hwalloc(plane, new_plane_state,
>  						    free);
>  		if (idx < 0) {
>  			dev_dbg(rcdu->dev, "%s: no available hardware plane\n",
> -- 
> 2.11.0
> 
> _______________________________________________
> 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] 59+ messages in thread

* Re: [PATCH 08/16] drm/atmel-hlcdec: Use for_each_new_connector_in_state
  2017-07-12  8:13 ` [PATCH 08/16] drm/atmel-hlcdec: Use for_each_new_connector_in_state Maarten Lankhorst
@ 2017-07-12  9:17   ` Daniel Vetter
  2017-07-12  9:22   ` Boris Brezillon
  1 sibling, 0 replies; 59+ messages in thread
From: Daniel Vetter @ 2017-07-12  9:17 UTC (permalink / raw)
  To: Maarten Lankhorst; +Cc: Boris Brezillon, intel-gfx, dri-devel

On Wed, Jul 12, 2017 at 10:13:36AM +0200, Maarten Lankhorst wrote:
> for_each_obj_in_state is about to be removed, so use the new iterator
> macros.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
> ---
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
> index 441769c5bcd4..4fbbeab5c5d4 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
> @@ -237,7 +237,7 @@ static int atmel_hlcdc_crtc_select_output_mode(struct drm_crtc_state *state)
>  
>  	crtc = drm_crtc_to_atmel_hlcdc_crtc(state->crtc);
>  
> -	for_each_connector_in_state(state->state, connector, cstate, i) {
> +	for_each_new_connector_in_state(state->state, connector, cstate, i) {

The code herein looks like the perfect thing to stuff into
encoder->atomic_check, since that can fill out the crtc state too. But
this works too.

Patch itself looks good.

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

>  		struct drm_display_info *info = &connector->display_info;
>  		unsigned int supported_fmts = 0;
>  		int j;
> -- 
> 2.11.0
> 
> _______________________________________________
> 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] 59+ messages in thread

* Re: [PATCH 09/16] drm/rockchip: Use for_each_oldnew_plane_in_state in vop_crtc_atomic_flush
  2017-07-12  8:13   ` Maarten Lankhorst
@ 2017-07-12  9:21     ` Daniel Vetter
  -1 siblings, 0 replies; 59+ messages in thread
From: Daniel Vetter @ 2017-07-12  9:21 UTC (permalink / raw)
  To: Maarten Lankhorst; +Cc: linux-rockchip, intel-gfx, linux-arm-kernel, dri-devel

On Wed, Jul 12, 2017 at 10:13:37AM +0200, Maarten Lankhorst wrote:
> for_each_obj_in_state is about to be removed, so use the new atomic
> iterator macros.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Mark Yao <mark.yao@rock-chips.com>
> Cc: Heiko Stuebner <heiko@sntech.de>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-rockchip@lists.infradead.org
> ---
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> index ee876a9631f0..f90088b1a247 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> @@ -1029,7 +1029,7 @@ static void vop_crtc_atomic_flush(struct drm_crtc *crtc,
>  				  struct drm_crtc_state *old_crtc_state)
>  {
>  	struct drm_atomic_state *old_state = old_crtc_state->state;
> -	struct drm_plane_state *old_plane_state;
> +	struct drm_plane_state *old_plane_state, *new_plane_state;
>  	struct vop *vop = to_vop(crtc);
>  	struct drm_plane *plane;
>  	int i;
> @@ -1060,11 +1060,12 @@ static void vop_crtc_atomic_flush(struct drm_crtc *crtc,
>  	}
>  	spin_unlock_irq(&crtc->dev->event_lock);
>  
> -	for_each_plane_in_state(old_state, plane, old_plane_state, i) {
> +	for_each_oldnew_plane_in_state(old_state, plane, old_plane_state,
> +				       new_plane_state, i) {
>  		if (!old_plane_state->fb)
>  			continue;
>  
> -		if (old_plane_state->fb == plane->state->fb)
> +		if (old_plane_state->fb == new_plane_state->fb)
>  			continue;

This entire machinery here seems to be the perfect candidate for Boris'
wait_for_flip_done work.

Patch itself looks good.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>  
>  		drm_framebuffer_reference(old_plane_state->fb);
> -- 
> 2.11.0
> 
> _______________________________________________
> 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] 59+ messages in thread

* [PATCH 09/16] drm/rockchip: Use for_each_oldnew_plane_in_state in vop_crtc_atomic_flush
@ 2017-07-12  9:21     ` Daniel Vetter
  0 siblings, 0 replies; 59+ messages in thread
From: Daniel Vetter @ 2017-07-12  9:21 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jul 12, 2017 at 10:13:37AM +0200, Maarten Lankhorst wrote:
> for_each_obj_in_state is about to be removed, so use the new atomic
> iterator macros.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Mark Yao <mark.yao@rock-chips.com>
> Cc: Heiko Stuebner <heiko@sntech.de>
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: linux-rockchip at lists.infradead.org
> ---
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> index ee876a9631f0..f90088b1a247 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> @@ -1029,7 +1029,7 @@ static void vop_crtc_atomic_flush(struct drm_crtc *crtc,
>  				  struct drm_crtc_state *old_crtc_state)
>  {
>  	struct drm_atomic_state *old_state = old_crtc_state->state;
> -	struct drm_plane_state *old_plane_state;
> +	struct drm_plane_state *old_plane_state, *new_plane_state;
>  	struct vop *vop = to_vop(crtc);
>  	struct drm_plane *plane;
>  	int i;
> @@ -1060,11 +1060,12 @@ static void vop_crtc_atomic_flush(struct drm_crtc *crtc,
>  	}
>  	spin_unlock_irq(&crtc->dev->event_lock);
>  
> -	for_each_plane_in_state(old_state, plane, old_plane_state, i) {
> +	for_each_oldnew_plane_in_state(old_state, plane, old_plane_state,
> +				       new_plane_state, i) {
>  		if (!old_plane_state->fb)
>  			continue;
>  
> -		if (old_plane_state->fb == plane->state->fb)
> +		if (old_plane_state->fb == new_plane_state->fb)
>  			continue;

This entire machinery here seems to be the perfect candidate for Boris'
wait_for_flip_done work.

Patch itself looks good.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>  
>  		drm_framebuffer_reference(old_plane_state->fb);
> -- 
> 2.11.0
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

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

* Re: [PATCH 08/16] drm/atmel-hlcdec: Use for_each_new_connector_in_state
  2017-07-12  8:13 ` [PATCH 08/16] drm/atmel-hlcdec: Use for_each_new_connector_in_state Maarten Lankhorst
  2017-07-12  9:17   ` Daniel Vetter
@ 2017-07-12  9:22   ` Boris Brezillon
  1 sibling, 0 replies; 59+ messages in thread
From: Boris Brezillon @ 2017-07-12  9:22 UTC (permalink / raw)
  To: Maarten Lankhorst; +Cc: intel-gfx, dri-devel

On Wed, 12 Jul 2017 10:13:36 +0200
Maarten Lankhorst <maarten.lankhorst@linux.intel.com> wrote:

> for_each_obj_in_state is about to be removed, so use the new iterator
> macros.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Boris Brezillon <boris.brezillon@free-electrons.com>

Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>

> ---
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
> index 441769c5bcd4..4fbbeab5c5d4 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
> @@ -237,7 +237,7 @@ static int atmel_hlcdc_crtc_select_output_mode(struct drm_crtc_state *state)
>  
>  	crtc = drm_crtc_to_atmel_hlcdc_crtc(state->crtc);
>  
> -	for_each_connector_in_state(state->state, connector, cstate, i) {
> +	for_each_new_connector_in_state(state->state, connector, cstate, i) {
>  		struct drm_display_info *info = &connector->display_info;
>  		unsigned int supported_fmts = 0;
>  		int j;

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

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

* Re: [PATCH 10/16] drm/omapdrm: Fix omap_atomic_wait_for_completion
  2017-07-12  8:13 ` [PATCH 10/16] drm/omapdrm: Fix omap_atomic_wait_for_completion Maarten Lankhorst
@ 2017-07-12  9:23   ` Daniel Vetter
  0 siblings, 0 replies; 59+ messages in thread
From: Daniel Vetter @ 2017-07-12  9:23 UTC (permalink / raw)
  To: Maarten Lankhorst; +Cc: intel-gfx, Tomi Valkeinen, dri-devel

On Wed, Jul 12, 2017 at 10:13:38AM +0200, Maarten Lankhorst wrote:
> Use the new iterator macro and look for crtc_state->active instead of
> enable, only crtc_state->enable implies that vblanks will happen.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  drivers/gpu/drm/omapdrm/omap_drv.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
> index 022029ea6972..66d3c6bfd6a8 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -57,13 +57,13 @@ static void omap_fb_output_poll_changed(struct drm_device *dev)
>  static void omap_atomic_wait_for_completion(struct drm_device *dev,
>  					    struct drm_atomic_state *old_state)
>  {
> -	struct drm_crtc_state *old_crtc_state;
> +	struct drm_crtc_state *new_crtc_state;
>  	struct drm_crtc *crtc;
>  	unsigned int i;
>  	int ret;
>  
> -	for_each_crtc_in_state(old_state, crtc, old_crtc_state, i) {
> -		if (!crtc->state->enable)
> +	for_each_new_crtc_in_state(old_state, crtc, new_crtc_state, i) {
> +		if (!new_crtc_state->active)
>  			continue;
>  
>  		ret = omap_crtc_wait_pending(crtc);
> -- 
> 2.11.0
> 
> _______________________________________________
> 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] 59+ messages in thread

* Re: [Intel-gfx] [PATCH 11/16] drm/mali: Use new atomic iterator macros
  2017-07-12  8:13 ` [PATCH 11/16] drm/mali: Use new atomic iterator macros Maarten Lankhorst
@ 2017-07-12  9:25   ` Daniel Vetter
  2017-07-12  9:44   ` Liviu Dudau
  1 sibling, 0 replies; 59+ messages in thread
From: Daniel Vetter @ 2017-07-12  9:25 UTC (permalink / raw)
  To: Maarten Lankhorst; +Cc: intel-gfx, Mali DP Maintainers, dri-devel

On Wed, Jul 12, 2017 at 10:13:39AM +0200, Maarten Lankhorst wrote:
> for_each_obj_in_state is about to be removed, so use the new iterator
> macros.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Liviu Dudau <liviu.dudau@arm.com>
> Cc: Brian Starkey <brian.starkey@arm.com>
> Cc: Mali DP Maintainers <malidp@foss.arm.com>

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

> ---
>  drivers/gpu/drm/arm/malidp_drv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
> index 01b13d219917..a6a05a768dd1 100644
> --- a/drivers/gpu/drm/arm/malidp_drv.c
> +++ b/drivers/gpu/drm/arm/malidp_drv.c
> @@ -225,7 +225,7 @@ static void malidp_atomic_commit_tail(struct drm_atomic_state *state)
>  
>  	drm_atomic_helper_commit_modeset_disables(drm, state);
>  
> -	for_each_crtc_in_state(state, crtc, old_crtc_state, i) {
> +	for_each_old_crtc_in_state(state, crtc, old_crtc_state, i) {
>  		malidp_atomic_commit_update_gamma(crtc, old_crtc_state);
>  		malidp_atomic_commit_update_coloradj(crtc, old_crtc_state);
>  		malidp_atomic_commit_se_config(crtc, old_crtc_state);
> -- 
> 2.11.0
> 
> _______________________________________________
> 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] 59+ messages in thread

* Re: [PATCH 12/16] drm/imx: Use atomic iterator macros
  2017-07-12  8:13 ` [PATCH 12/16] drm/imx: Use " Maarten Lankhorst
@ 2017-07-12  9:26   ` Daniel Vetter
  2017-07-12 10:00   ` Philipp Zabel
  1 sibling, 0 replies; 59+ messages in thread
From: Daniel Vetter @ 2017-07-12  9:26 UTC (permalink / raw)
  To: Maarten Lankhorst; +Cc: intel-gfx, Philipp Zabel, dri-devel

On Wed, Jul 12, 2017 at 10:13:40AM +0200, Maarten Lankhorst wrote:
> for_each_obj_in_state is about to be removed, so use the new atomic
> iterator macros.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Philipp Zabel <p.zabel@pengutronix.de>

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

> ---
>  drivers/gpu/drm/imx/imx-drm-core.c | 8 ++++----
>  drivers/gpu/drm/imx/ipuv3-plane.c  | 2 +-
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
> index 95e2181963d9..f5c621219113 100644
> --- a/drivers/gpu/drm/imx/imx-drm-core.c
> +++ b/drivers/gpu/drm/imx/imx-drm-core.c
> @@ -115,7 +115,7 @@ static void imx_drm_atomic_commit_tail(struct drm_atomic_state *state)
>  {
>  	struct drm_device *dev = state->dev;
>  	struct drm_plane *plane;
> -	struct drm_plane_state *old_plane_state;
> +	struct drm_plane_state *old_plane_state, *new_plane_state;
>  	bool plane_disabling = false;
>  	int i;
>  
> @@ -127,15 +127,15 @@ static void imx_drm_atomic_commit_tail(struct drm_atomic_state *state)
>  
>  	drm_atomic_helper_commit_modeset_enables(dev, state);
>  
> -	for_each_plane_in_state(state, plane, old_plane_state, i) {
> -		if (drm_atomic_plane_disabling(old_plane_state, plane->state))
> +	for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) {
> +		if (drm_atomic_plane_disabling(old_plane_state, new_plane_state))
>  			plane_disabling = true;
>  	}
>  
>  	if (plane_disabling) {
>  		drm_atomic_helper_wait_for_vblanks(dev, state);
>  
> -		for_each_plane_in_state(state, plane, old_plane_state, i)
> +		for_each_old_plane_in_state(state, plane, old_plane_state, i)
>  			ipu_plane_disable_deferred(plane);
>  
>  	}
> diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3-plane.c
> index 49546222c6d3..ff53c8dec633 100644
> --- a/drivers/gpu/drm/imx/ipuv3-plane.c
> +++ b/drivers/gpu/drm/imx/ipuv3-plane.c
> @@ -675,7 +675,7 @@ int ipu_planes_assign_pre(struct drm_device *dev,
>  	int available_pres = ipu_prg_max_active_channels();
>  	int i;
>  
> -	for_each_plane_in_state(state, plane, plane_state, i) {
> +	for_each_new_plane_in_state(state, plane, plane_state, i) {
>  		struct ipu_plane_state *ipu_state =
>  				to_ipu_plane_state(plane_state);
>  		struct ipu_plane *ipu_plane = to_ipu_plane(plane);
> -- 
> 2.11.0
> 
> _______________________________________________
> 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] 59+ messages in thread

* Re: [PATCH 09/16] drm/rockchip: Use for_each_oldnew_plane_in_state in vop_crtc_atomic_flush
  2017-07-12  8:13   ` Maarten Lankhorst
@ 2017-07-12  9:41     ` Mark yao
  -1 siblings, 0 replies; 59+ messages in thread
From: Mark yao @ 2017-07-12  9:41 UTC (permalink / raw)
  To: Maarten Lankhorst, dri-devel; +Cc: linux-rockchip, intel-gfx, linux-arm-kernel

On 2017年07月12日 16:13, Maarten Lankhorst wrote:
> for_each_obj_in_state is about to be removed, so use the new atomic
> iterator macros.
>
> Signed-off-by: Maarten Lankhorst<maarten.lankhorst@linux.intel.com>
> Cc: Mark Yao<mark.yao@rock-chips.com>
> Cc: Heiko Stuebner<heiko@sntech.de>
> Cc:linux-arm-kernel@lists.infradead.org
> Cc:linux-rockchip@lists.infradead.org

Looks good for me:

Acked-by: Mark Yao <mark.yao@rock-chips.com>

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

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

* [PATCH 09/16] drm/rockchip: Use for_each_oldnew_plane_in_state in vop_crtc_atomic_flush
@ 2017-07-12  9:41     ` Mark yao
  0 siblings, 0 replies; 59+ messages in thread
From: Mark yao @ 2017-07-12  9:41 UTC (permalink / raw)
  To: linux-arm-kernel

On 2017?07?12? 16:13, Maarten Lankhorst wrote:
> for_each_obj_in_state is about to be removed, so use the new atomic
> iterator macros.
>
> Signed-off-by: Maarten Lankhorst<maarten.lankhorst@linux.intel.com>
> Cc: Mark Yao<mark.yao@rock-chips.com>
> Cc: Heiko Stuebner<heiko@sntech.de>
> Cc:linux-arm-kernel at lists.infradead.org
> Cc:linux-rockchip at lists.infradead.org

Looks good for me:

Acked-by: Mark Yao <mark.yao@rock-chips.com>

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

* Re: [PATCH 11/16] drm/mali: Use new atomic iterator macros
  2017-07-12  8:13 ` [PATCH 11/16] drm/mali: Use new atomic iterator macros Maarten Lankhorst
  2017-07-12  9:25   ` [Intel-gfx] " Daniel Vetter
@ 2017-07-12  9:44   ` Liviu Dudau
  2017-07-12 10:00     ` Maarten Lankhorst
  1 sibling, 1 reply; 59+ messages in thread
From: Liviu Dudau @ 2017-07-12  9:44 UTC (permalink / raw)
  To: Maarten Lankhorst; +Cc: intel-gfx, Mali DP Maintainers, dri-devel

On Wed, Jul 12, 2017 at 10:13:39AM +0200, Maarten Lankhorst wrote:
> for_each_obj_in_state is about to be removed, so use the new iterator
> macros.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Liviu Dudau <liviu.dudau@arm.com>
> Cc: Brian Starkey <brian.starkey@arm.com>
> Cc: Mali DP Maintainers <malidp@foss.arm.com>

Hi Maarten,

Acked-by: Liviu Dudau <liviu.dudau@arm.com>

Are you going to take the whole series through drm-misc or you want me
to pull this patch into mali-dp tree?

Best regards,
Liviu

> ---
>  drivers/gpu/drm/arm/malidp_drv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
> index 01b13d219917..a6a05a768dd1 100644
> --- a/drivers/gpu/drm/arm/malidp_drv.c
> +++ b/drivers/gpu/drm/arm/malidp_drv.c
> @@ -225,7 +225,7 @@ static void malidp_atomic_commit_tail(struct drm_atomic_state *state)
>  
>  	drm_atomic_helper_commit_modeset_disables(drm, state);
>  
> -	for_each_crtc_in_state(state, crtc, old_crtc_state, i) {
> +	for_each_old_crtc_in_state(state, crtc, old_crtc_state, i) {
>  		malidp_atomic_commit_update_gamma(crtc, old_crtc_state);
>  		malidp_atomic_commit_update_coloradj(crtc, old_crtc_state);
>  		malidp_atomic_commit_se_config(crtc, old_crtc_state);
> -- 
> 2.11.0
> 

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 13/16] drm/mediatek: Convert to new iterator macros
  2017-07-12  8:13   ` Maarten Lankhorst
@ 2017-07-12  9:45     ` Daniel Vetter
  -1 siblings, 0 replies; 59+ messages in thread
From: Daniel Vetter @ 2017-07-12  9:45 UTC (permalink / raw)
  To: Maarten Lankhorst
  Cc: Matthias Brugger, intel-gfx, linux-mediatek, linux-arm-kernel, dri-devel

On Wed, Jul 12, 2017 at 10:13:41AM +0200, Maarten Lankhorst wrote:
> for_each_obj_in_state is about to be removed, so use the new atomic
> iterator macros.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: CK Hu <ck.hu@mediatek.com>
> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> Cc: Matthias Brugger <matthias.bgg@gmail.com>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-mediatek@lists.infradead.org
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_drv.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index 56f802d0a51c..be0741638f94 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -48,11 +48,11 @@ static void mtk_atomic_schedule(struct mtk_drm_private *private,
>  static void mtk_atomic_wait_for_fences(struct drm_atomic_state *state)
>  {
>  	struct drm_plane *plane;
> -	struct drm_plane_state *plane_state;
> +	struct drm_plane_state *new_plane_state;
>  	int i;
>  
> -	for_each_plane_in_state(state, plane, plane_state, i)
> -		mtk_fb_wait(plane->state->fb);
> +	for_each_new_plane_in_state(state, plane, new_plane_state, i)
> +		mtk_fb_wait(new_plane_state->fb);
>  }

I think a variant of drm_atomic_set_fence_for_plane, which takes a
reservation obj (or a dma-buf and then derefs dma_buf->resv itself) would
be nice, so that drivers don't have to hand-roll sub-par fence waiting
code like this (it's e.g. not interruptible for blocking commits).

Anyway, patch itself looks good.

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

>  
>  static void mtk_atomic_complete(struct mtk_drm_private *private,
> -- 
> 2.11.0
> 
> _______________________________________________
> 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] 59+ messages in thread

* [PATCH 13/16] drm/mediatek: Convert to new iterator macros
@ 2017-07-12  9:45     ` Daniel Vetter
  0 siblings, 0 replies; 59+ messages in thread
From: Daniel Vetter @ 2017-07-12  9:45 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jul 12, 2017 at 10:13:41AM +0200, Maarten Lankhorst wrote:
> for_each_obj_in_state is about to be removed, so use the new atomic
> iterator macros.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: CK Hu <ck.hu@mediatek.com>
> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> Cc: Matthias Brugger <matthias.bgg@gmail.com>
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: linux-mediatek at lists.infradead.org
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_drv.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index 56f802d0a51c..be0741638f94 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -48,11 +48,11 @@ static void mtk_atomic_schedule(struct mtk_drm_private *private,
>  static void mtk_atomic_wait_for_fences(struct drm_atomic_state *state)
>  {
>  	struct drm_plane *plane;
> -	struct drm_plane_state *plane_state;
> +	struct drm_plane_state *new_plane_state;
>  	int i;
>  
> -	for_each_plane_in_state(state, plane, plane_state, i)
> -		mtk_fb_wait(plane->state->fb);
> +	for_each_new_plane_in_state(state, plane, new_plane_state, i)
> +		mtk_fb_wait(new_plane_state->fb);
>  }

I think a variant of drm_atomic_set_fence_for_plane, which takes a
reservation obj (or a dma-buf and then derefs dma_buf->resv itself) would
be nice, so that drivers don't have to hand-roll sub-par fence waiting
code like this (it's e.g. not interruptible for blocking commits).

Anyway, patch itself looks good.

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

>  
>  static void mtk_atomic_complete(struct mtk_drm_private *private,
> -- 
> 2.11.0
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

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

* Re: [Intel-gfx] [PATCH 14/16] drm/msm: Convert to use new iterator macros
  2017-07-12  8:13   ` [PATCH 14/16] drm/msm: Convert to use " Maarten Lankhorst
@ 2017-07-12  9:48     ` Daniel Vetter
       [not found]       ` <20170712094823.2akjrev3v7ckxb7b-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
  0 siblings, 1 reply; 59+ messages in thread
From: Daniel Vetter @ 2017-07-12  9:48 UTC (permalink / raw)
  To: Maarten Lankhorst
  Cc: linux-arm-msm, intel-gfx, dri-devel, Sushmita Susheelendra,
	Russell King, Vincent Abriou, freedreno, Markus Elfring

On Wed, Jul 12, 2017 at 10:13:42AM +0200, Maarten Lankhorst wrote:
> for_each_obj_in_state is about to be removed, so convert
> to the new iterator macros.
> 
> Just like in omap, use crtc_state->active instead of
> crtc_state->enable when waiting for completion.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Rob Clark <robdclark@gmail.com>
> Cc: Archit Taneja <architt@codeaurora.org>
> Cc: Vincent Abriou <vincent.abriou@st.com>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Russell King <rmk+kernel@armlinux.org.uk>
> Cc: Rob Herring <robh@kernel.org>
> Cc: Markus Elfring <elfring@users.sourceforge.net>
> Cc: Sushmita Susheelendra <ssusheel@codeaurora.org>
> Cc: linux-arm-msm@vger.kernel.org
> Cc: freedreno@lists.freedesktop.org
> ---
>  drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c |  4 ++--
>  drivers/gpu/drm/msm/msm_atomic.c        | 16 ++++++++--------
>  2 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
> index bcd1f5cac72c..f7f087419ed8 100644
> --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
> +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
> @@ -114,7 +114,7 @@ static void mdp4_prepare_commit(struct msm_kms *kms, struct drm_atomic_state *st
>  	mdp4_enable(mdp4_kms);
>  
>  	/* see 119ecb7fd */
> -	for_each_crtc_in_state(state, crtc, crtc_state, i)
> +	for_each_new_crtc_in_state(state, crtc, crtc_state, i)
>  		drm_crtc_vblank_get(crtc);
>  }
>  
> @@ -126,7 +126,7 @@ static void mdp4_complete_commit(struct msm_kms *kms, struct drm_atomic_state *s
>  	struct drm_crtc_state *crtc_state;
>  
>  	/* see 119ecb7fd */
> -	for_each_crtc_in_state(state, crtc, crtc_state, i)
> +	for_each_new_crtc_in_state(state, crtc, crtc_state, i)
>  		drm_crtc_vblank_put(crtc);
>  
>  	mdp4_disable(mdp4_kms);
> diff --git a/drivers/gpu/drm/msm/msm_atomic.c b/drivers/gpu/drm/msm/msm_atomic.c
> index 9633a68b14d7..9d3cc1f5e31a 100644
> --- a/drivers/gpu/drm/msm/msm_atomic.c
> +++ b/drivers/gpu/drm/msm/msm_atomic.c
> @@ -84,13 +84,13 @@ static void msm_atomic_wait_for_commit_done(struct drm_device *dev,
>  		struct drm_atomic_state *old_state)
>  {
>  	struct drm_crtc *crtc;
> -	struct drm_crtc_state *crtc_state;
> +	struct drm_crtc_state *new_crtc_state;
>  	struct msm_drm_private *priv = old_state->dev->dev_private;
>  	struct msm_kms *kms = priv->kms;
>  	int i;
>  
> -	for_each_crtc_in_state(old_state, crtc, crtc_state, i) {
> -		if (!crtc->state->enable)
> +	for_each_new_crtc_in_state(old_state, crtc, new_crtc_state, i) {
> +		if (!new_crtc_state->active)
>  			continue;
>  
>  		kms->funcs->wait_for_crtc_commit_done(kms, crtc);
> @@ -195,7 +195,7 @@ int msm_atomic_commit(struct drm_device *dev,
>  	struct drm_crtc *crtc;
>  	struct drm_crtc_state *crtc_state;
>  	struct drm_plane *plane;
> -	struct drm_plane_state *plane_state;
> +	struct drm_plane_state *old_plane_state, *new_plane_state;
>  	int i, ret;
>  
>  	ret = drm_atomic_helper_prepare_planes(dev, state);
> @@ -211,15 +211,15 @@ int msm_atomic_commit(struct drm_device *dev,
>  	/*
>  	 * Figure out what crtcs we have:
>  	 */
> -	for_each_crtc_in_state(state, crtc, crtc_state, i)
> +	for_each_new_crtc_in_state(state, crtc, crtc_state, i)
>  		c->crtc_mask |= drm_crtc_mask(crtc);
>  
>  	/*
>  	 * Figure out what fence to wait for:
>  	 */
> -	for_each_plane_in_state(state, plane, plane_state, i) {
> -		if ((plane->state->fb != plane_state->fb) && plane_state->fb) {
> -			struct drm_gem_object *obj = msm_framebuffer_bo(plane_state->fb, 0);
> +	for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) {
> +		if ((new_plane_state->fb != old_plane_state->fb) && new_plane_state->fb) {
> +			struct drm_gem_object *obj = msm_framebuffer_bo(new_plane_state->fb, 0);
>  			struct msm_gem_object *msm_obj = to_msm_bo(obj);
>  			struct dma_fence *fence = reservation_object_get_excl_rcu(msm_obj->resv);

Pretty sure this fails to compile, you've forgotten to do one more
s/plane_state/new_plane_state/.

With that fixed:

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

>  
> -- 
> 2.11.0
> 
> _______________________________________________
> 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] 59+ messages in thread

* Re: [PATCH 16/16] drm/atomic: Remove deprecated accessor macros
  2017-07-12  8:13 ` [PATCH 16/16] drm/atomic: Remove deprecated accessor macros Maarten Lankhorst
@ 2017-07-12  9:50   ` Daniel Vetter
  2017-07-12 11:48     ` Maarten Lankhorst
  0 siblings, 1 reply; 59+ messages in thread
From: Daniel Vetter @ 2017-07-12  9:50 UTC (permalink / raw)
  To: Maarten Lankhorst; +Cc: David Airlie, Daniel Vetter, intel-gfx, dri-devel

On Wed, Jul 12, 2017 at 10:13:44AM +0200, Maarten Lankhorst wrote:
> Now that the last users have been converted, we can finally get rid of
> for_each_obj_in_state, we have better macros to replace them with.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Sean Paul <seanpaul@chromium.org>
> Cc: David Airlie <airlied@linux.ie>

Lgtm, but please make sure you do compile test with all three drm-misc
defconfigs. Two of the patches looked like they didn't see a compiler, so
there might be more lurking.
-Daniel

> ---
>  include/drm/drm_atomic.h    | 75 ---------------------------------------------
>  include/drm/drm_connector.h |  3 +-
>  include/drm/drm_crtc.h      |  8 ++---
>  include/drm/drm_plane.h     |  8 ++---
>  4 files changed, 9 insertions(+), 85 deletions(-)
> 
> diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
> index dcc8e0cdb7ff..9f484d0ebcb6 100644
> --- a/include/drm/drm_atomic.h
> +++ b/include/drm/drm_atomic.h
> @@ -555,31 +555,6 @@ int __must_check drm_atomic_nonblocking_commit(struct drm_atomic_state *state);
>  void drm_state_dump(struct drm_device *dev, struct drm_printer *p);
>  
>  /**
> - * for_each_connector_in_state - iterate over all connectors in an atomic update
> - * @__state: &struct drm_atomic_state pointer
> - * @connector: &struct drm_connector iteration cursor
> - * @connector_state: &struct drm_connector_state iteration cursor
> - * @__i: int iteration cursor, for macro-internal use
> - *
> - * This iterates over all connectors in an atomic update. Note that before the
> - * software state is committed (by calling drm_atomic_helper_swap_state(), this
> - * points to the new state, while afterwards it points to the old state. Due to
> - * this tricky confusion this macro is deprecated.
> - *
> - * FIXME:
> - *
> - * Replace all usage of this with one of the explicit iterators below and then
> - * remove this macro.
> - */
> -#define for_each_connector_in_state(__state, connector, connector_state, __i) \
> -	for ((__i) = 0;							\
> -	     (__i) < (__state)->num_connector &&				\
> -	     ((connector) = (__state)->connectors[__i].ptr,			\
> -	     (connector_state) = (__state)->connectors[__i].state, 1); 	\
> -	     (__i)++)							\
> -		for_each_if (connector)
> -
> -/**
>   * for_each_oldnew_connector_in_state - iterate over all connectors in an atomic update
>   * @__state: &struct drm_atomic_state pointer
>   * @connector: &struct drm_connector iteration cursor
> @@ -643,31 +618,6 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p);
>  		for_each_if (connector)
>  
>  /**
> - * for_each_crtc_in_state - iterate over all connectors in an atomic update
> - * @__state: &struct drm_atomic_state pointer
> - * @crtc: &struct drm_crtc iteration cursor
> - * @crtc_state: &struct drm_crtc_state iteration cursor
> - * @__i: int iteration cursor, for macro-internal use
> - *
> - * This iterates over all CRTCs in an atomic update. Note that before the
> - * software state is committed (by calling drm_atomic_helper_swap_state(), this
> - * points to the new state, while afterwards it points to the old state. Due to
> - * this tricky confusion this macro is deprecated.
> - *
> - * FIXME:
> - *
> - * Replace all usage of this with one of the explicit iterators below and then
> - * remove this macro.
> - */
> -#define for_each_crtc_in_state(__state, crtc, crtc_state, __i)	\
> -	for ((__i) = 0;						\
> -	     (__i) < (__state)->dev->mode_config.num_crtc &&	\
> -	     ((crtc) = (__state)->crtcs[__i].ptr,			\
> -	     (crtc_state) = (__state)->crtcs[__i].state, 1);	\
> -	     (__i)++)						\
> -		for_each_if (crtc_state)
> -
> -/**
>   * for_each_oldnew_crtc_in_state - iterate over all CRTCs in an atomic update
>   * @__state: &struct drm_atomic_state pointer
>   * @crtc: &struct drm_crtc iteration cursor
> @@ -727,31 +677,6 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p);
>  		for_each_if (crtc)
>  
>  /**
> - * for_each_plane_in_state - iterate over all planes in an atomic update
> - * @__state: &struct drm_atomic_state pointer
> - * @plane: &struct drm_plane iteration cursor
> - * @plane_state: &struct drm_plane_state iteration cursor
> - * @__i: int iteration cursor, for macro-internal use
> - *
> - * This iterates over all planes in an atomic update. Note that before the
> - * software state is committed (by calling drm_atomic_helper_swap_state(), this
> - * points to the new state, while afterwards it points to the old state. Due to
> - * this tricky confusion this macro is deprecated.
> - *
> - * FIXME:
> - *
> - * Replace all usage of this with one of the explicit iterators below and then
> - * remove this macro.
> - */
> -#define for_each_plane_in_state(__state, plane, plane_state, __i)		\
> -	for ((__i) = 0;							\
> -	     (__i) < (__state)->dev->mode_config.num_total_plane &&	\
> -	     ((plane) = (__state)->planes[__i].ptr,				\
> -	     (plane_state) = (__state)->planes[__i].state, 1);		\
> -	     (__i)++)							\
> -		for_each_if (plane_state)
> -
> -/**
>   * for_each_oldnew_plane_in_state - iterate over all planes in an atomic update
>   * @__state: &struct drm_atomic_state pointer
>   * @plane: &struct drm_plane iteration cursor
> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
> index ae5b7dc316c8..4878007103e2 100644
> --- a/include/drm/drm_connector.h
> +++ b/include/drm/drm_connector.h
> @@ -858,8 +858,7 @@ struct drm_connector {
>  	 * This is protected by @drm_mode_config.connection_mutex. Note that
>  	 * nonblocking atomic commits access the current connector state without
>  	 * taking locks. Either by going through the &struct drm_atomic_state
> -	 * pointers, see for_each_connector_in_state(),
> -	 * for_each_oldnew_connector_in_state(),
> +	 * pointers, see for_each_oldnew_connector_in_state(),
>  	 * for_each_old_connector_in_state() and
>  	 * for_each_new_connector_in_state(). Or through careful ordering of
>  	 * atomic commit operations as implemented in the atomic helpers, see
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index 3a911a64c257..c4c949ea20da 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -807,10 +807,10 @@ struct drm_crtc {
>  	 * This is protected by @mutex. Note that nonblocking atomic commits
>  	 * access the current CRTC state without taking locks. Either by going
>  	 * through the &struct drm_atomic_state pointers, see
> -	 * for_each_crtc_in_state(), for_each_oldnew_crtc_in_state(),
> -	 * for_each_old_crtc_in_state() and for_each_new_crtc_in_state(). Or
> -	 * through careful ordering of atomic commit operations as implemented
> -	 * in the atomic helpers, see &struct drm_crtc_commit.
> +	 * for_each_oldnew_crtc_in_state(), for_each_old_crtc_in_state() and
> +	 * for_each_new_crtc_in_state(). Or through careful ordering of atomic
> +	 * commit operations as implemented in the atomic helpers, see
> +	 * &struct drm_crtc_commit.
>  	 */
>  	struct drm_crtc_state *state;
>  
> diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
> index 9ab3e7044812..a1b3aa5d1223 100644
> --- a/include/drm/drm_plane.h
> +++ b/include/drm/drm_plane.h
> @@ -514,10 +514,10 @@ struct drm_plane {
>  	 * This is protected by @mutex. Note that nonblocking atomic commits
>  	 * access the current plane state without taking locks. Either by going
>  	 * through the &struct drm_atomic_state pointers, see
> -	 * for_each_plane_in_state(), for_each_oldnew_plane_in_state(),
> -	 * for_each_old_plane_in_state() and for_each_new_plane_in_state(). Or
> -	 * through careful ordering of atomic commit operations as implemented
> -	 * in the atomic helpers, see &struct drm_crtc_commit.
> +	 * for_each_oldnew_plane_in_state(), for_each_old_plane_in_state() and
> +	 * for_each_new_plane_in_state(). Or through careful ordering of atomic
> +	 * commit operations as implemented in the atomic helpers, see
> +	 * &struct drm_crtc_commit.
>  	 */
>  	struct drm_plane_state *state;
>  
> -- 
> 2.11.0
> 
> _______________________________________________
> 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] 59+ messages in thread

* Re: [PATCH 12/16] drm/imx: Use atomic iterator macros
  2017-07-12  8:13 ` [PATCH 12/16] drm/imx: Use " Maarten Lankhorst
  2017-07-12  9:26   ` Daniel Vetter
@ 2017-07-12 10:00   ` Philipp Zabel
  1 sibling, 0 replies; 59+ messages in thread
From: Philipp Zabel @ 2017-07-12 10:00 UTC (permalink / raw)
  To: Maarten Lankhorst; +Cc: intel-gfx, dri-devel

On Wed, 2017-07-12 at 10:13 +0200, Maarten Lankhorst wrote:
> for_each_obj_in_state is about to be removed, so use the new atomic
> iterator macros.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> ---
>  drivers/gpu/drm/imx/imx-drm-core.c | 8 ++++----
>  drivers/gpu/drm/imx/ipuv3-plane.c  | 2 +-
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
> index 95e2181963d9..f5c621219113 100644
> --- a/drivers/gpu/drm/imx/imx-drm-core.c
> +++ b/drivers/gpu/drm/imx/imx-drm-core.c
> @@ -115,7 +115,7 @@ static void imx_drm_atomic_commit_tail(struct drm_atomic_state *state)
>  {
>  	struct drm_device *dev = state->dev;
>  	struct drm_plane *plane;
> -	struct drm_plane_state *old_plane_state;
> +	struct drm_plane_state *old_plane_state, *new_plane_state;
>  	bool plane_disabling = false;
>  	int i;
>  
> @@ -127,15 +127,15 @@ static void imx_drm_atomic_commit_tail(struct drm_atomic_state *state)
>  
>  	drm_atomic_helper_commit_modeset_enables(dev, state);
>  
> -	for_each_plane_in_state(state, plane, old_plane_state, i) {
> -		if (drm_atomic_plane_disabling(old_plane_state, plane->state))
> +	for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) {
> +		if (drm_atomic_plane_disabling(old_plane_state, new_plane_state))
>  			plane_disabling = true;
>  	}
>  
>  	if (plane_disabling) {
>  		drm_atomic_helper_wait_for_vblanks(dev, state);
>  
> -		for_each_plane_in_state(state, plane, old_plane_state, i)
> +		for_each_old_plane_in_state(state, plane, old_plane_state, i)
>  			ipu_plane_disable_deferred(plane);
>  
>  	}
> diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3-plane.c
> index 49546222c6d3..ff53c8dec633 100644
> --- a/drivers/gpu/drm/imx/ipuv3-plane.c
> +++ b/drivers/gpu/drm/imx/ipuv3-plane.c
> @@ -675,7 +675,7 @@ int ipu_planes_assign_pre(struct drm_device *dev,
>  	int available_pres = ipu_prg_max_active_channels();
>  	int i;
>  
> -	for_each_plane_in_state(state, plane, plane_state, i) {
> +	for_each_new_plane_in_state(state, plane, plane_state, i) {
>  		struct ipu_plane_state *ipu_state =
>  				to_ipu_plane_state(plane_state);
>  		struct ipu_plane *ipu_plane = to_ipu_plane(plane);

Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Tested-by: Philipp Zabel <p.zabel@pengutronix.de>

regards
Philipp

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

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

* Re: [PATCH 11/16] drm/mali: Use new atomic iterator macros
  2017-07-12  9:44   ` Liviu Dudau
@ 2017-07-12 10:00     ` Maarten Lankhorst
  2017-07-12 10:06       ` Liviu Dudau
  0 siblings, 1 reply; 59+ messages in thread
From: Maarten Lankhorst @ 2017-07-12 10:00 UTC (permalink / raw)
  To: Liviu Dudau; +Cc: intel-gfx, Mali DP Maintainers, dri-devel

Op 12-07-17 om 11:44 schreef Liviu Dudau:
> On Wed, Jul 12, 2017 at 10:13:39AM +0200, Maarten Lankhorst wrote:
>> for_each_obj_in_state is about to be removed, so use the new iterator
>> macros.
>>
>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>> Cc: Liviu Dudau <liviu.dudau@arm.com>
>> Cc: Brian Starkey <brian.starkey@arm.com>
>> Cc: Mali DP Maintainers <malidp@foss.arm.com>
> Hi Maarten,
>
> Acked-by: Liviu Dudau <liviu.dudau@arm.com>
>
> Are you going to take the whole series through drm-misc or you want me
> to pull this patch into mali-dp tree?

I'm planning to put it all through drm-misc if possible, so I can immediately
remove the old macros so they will never be used again. :)

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

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

* Re: [PATCH 13/16] drm/mediatek: Convert to new iterator macros
  2017-07-12  8:13   ` Maarten Lankhorst
@ 2017-07-12 10:01     ` Philipp Zabel
  -1 siblings, 0 replies; 59+ messages in thread
From: Philipp Zabel @ 2017-07-12 10:01 UTC (permalink / raw)
  To: Maarten Lankhorst
  Cc: intel-gfx, dri-devel, Matthias Brugger, linux-mediatek, CK Hu,
	linux-arm-kernel

On Wed, 2017-07-12 at 10:13 +0200, Maarten Lankhorst wrote:
> for_each_obj_in_state is about to be removed, so use the new atomic
> iterator macros.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: CK Hu <ck.hu@mediatek.com>
> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> Cc: Matthias Brugger <matthias.bgg@gmail.com>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-mediatek@lists.infradead.org
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_drv.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index 56f802d0a51c..be0741638f94 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -48,11 +48,11 @@ static void mtk_atomic_schedule(struct mtk_drm_private *private,
>  static void mtk_atomic_wait_for_fences(struct drm_atomic_state *state)
>  {
>  	struct drm_plane *plane;
> -	struct drm_plane_state *plane_state;
> +	struct drm_plane_state *new_plane_state;
>  	int i;
>  
> -	for_each_plane_in_state(state, plane, plane_state, i)
> -		mtk_fb_wait(plane->state->fb);
> +	for_each_new_plane_in_state(state, plane, new_plane_state, i)
> +		mtk_fb_wait(new_plane_state->fb);
>  }
>  
>  static void mtk_atomic_complete(struct mtk_drm_private *private,

Acked-by: Philipp Zabel <p.zabel@pengutronix.de>

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

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

* [PATCH 13/16] drm/mediatek: Convert to new iterator macros
@ 2017-07-12 10:01     ` Philipp Zabel
  0 siblings, 0 replies; 59+ messages in thread
From: Philipp Zabel @ 2017-07-12 10:01 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 2017-07-12 at 10:13 +0200, Maarten Lankhorst wrote:
> for_each_obj_in_state is about to be removed, so use the new atomic
> iterator macros.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: CK Hu <ck.hu@mediatek.com>
> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> Cc: Matthias Brugger <matthias.bgg@gmail.com>
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: linux-mediatek at lists.infradead.org
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_drv.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index 56f802d0a51c..be0741638f94 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -48,11 +48,11 @@ static void mtk_atomic_schedule(struct mtk_drm_private *private,
>  static void mtk_atomic_wait_for_fences(struct drm_atomic_state *state)
>  {
>  	struct drm_plane *plane;
> -	struct drm_plane_state *plane_state;
> +	struct drm_plane_state *new_plane_state;
>  	int i;
>  
> -	for_each_plane_in_state(state, plane, plane_state, i)
> -		mtk_fb_wait(plane->state->fb);
> +	for_each_new_plane_in_state(state, plane, new_plane_state, i)
> +		mtk_fb_wait(new_plane_state->fb);
>  }
>  
>  static void mtk_atomic_complete(struct mtk_drm_private *private,

Acked-by: Philipp Zabel <p.zabel@pengutronix.de>

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

* Re: [PATCH 11/16] drm/mali: Use new atomic iterator macros
  2017-07-12 10:00     ` Maarten Lankhorst
@ 2017-07-12 10:06       ` Liviu Dudau
  0 siblings, 0 replies; 59+ messages in thread
From: Liviu Dudau @ 2017-07-12 10:06 UTC (permalink / raw)
  To: Maarten Lankhorst; +Cc: intel-gfx, Mali DP Maintainers, dri-devel

On Wed, Jul 12, 2017 at 12:00:40PM +0200, Maarten Lankhorst wrote:
> Op 12-07-17 om 11:44 schreef Liviu Dudau:
> > On Wed, Jul 12, 2017 at 10:13:39AM +0200, Maarten Lankhorst wrote:
> >> for_each_obj_in_state is about to be removed, so use the new iterator
> >> macros.
> >>
> >> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> >> Cc: Liviu Dudau <liviu.dudau@arm.com>
> >> Cc: Brian Starkey <brian.starkey@arm.com>
> >> Cc: Mali DP Maintainers <malidp@foss.arm.com>
> > Hi Maarten,
> >
> > Acked-by: Liviu Dudau <liviu.dudau@arm.com>
> >
> > Are you going to take the whole series through drm-misc or you want me
> > to pull this patch into mali-dp tree?
> 
> I'm planning to put it all through drm-misc if possible, so I can immediately
> remove the old macros so they will never be used again. :)

Fine by me. Thanks for the patch!

Best regards,
Liviu

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

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH v2 07/16] drm/rcar-du: Use new iterator macros, v2.
  2017-07-12  9:15     ` Daniel Vetter
@ 2017-07-12 10:43       ` Maarten Lankhorst
  -1 siblings, 0 replies; 59+ messages in thread
From: Maarten Lankhorst @ 2017-07-12 10:43 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: dri-devel, linux-renesas-soc, intel-gfx, Laurent Pinchart

Op 12-07-17 om 11:15 schreef Daniel Vetter:
> On Wed, Jul 12, 2017 at 10:13:35AM +0200, Maarten Lankhorst wrote:
>> for_each_obj_in_state is about to be removed, so use the correct new
>> iterator macros.
>>
>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>> Cc: linux-renesas-soc@vger.kernel.org
> Looks correct, but I think Laurent has a patch to rework/remove this.
> Found something below anyway.
>
>> ---
>>  drivers/gpu/drm/rcar-du/rcar_du_plane.c | 41 ++++++++++++++++-----------------
>>  1 file changed, 20 insertions(+), 21 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
>> index dcde6288da6c..dfd84e3c8c25 100644
>> --- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
>> +++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
>> @@ -51,12 +51,9 @@
>>   */
>>  
>>  static bool rcar_du_plane_needs_realloc(struct rcar_du_plane *plane,
>> +					const struct rcar_du_plane_state *cur_state,
>>  					struct rcar_du_plane_state *new_state)
>>  {
>> -	struct rcar_du_plane_state *cur_state;
>> -
>> -	cur_state = to_rcar_plane_state(plane->plane.state);
>> -
>>  	/* Lowering the number of planes doesn't strictly require reallocation
>>  	 * as the extra hardware plane will be freed when committing, but doing
>>  	 * so could lead to more fragmentation.
>> @@ -141,16 +138,17 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
>>  	unsigned int groups = 0;
>>  	unsigned int i;
>>  	struct drm_plane *drm_plane;
>> -	struct drm_plane_state *drm_plane_state;
>> +	struct drm_plane_state *old_drm_plane_state, *new_drm_plane_state;
>>  
>>  	/* Check if hardware planes need to be reallocated. */
>> -	for_each_plane_in_state(state, drm_plane, drm_plane_state, i) {
>> -		struct rcar_du_plane_state *plane_state;
>> +	for_each_oldnew_plane_in_state(state, drm_plane, old_drm_plane_state, new_drm_plane_state, i) {
>> +		struct rcar_du_plane_state *old_plane_state, *new_plane_state;
>>  		struct rcar_du_plane *plane;
>>  		unsigned int index;
>>  
>>  		plane = to_rcar_plane(drm_plane);
>> -		plane_state = to_rcar_plane_state(drm_plane_state);
>> +		old_plane_state = to_rcar_plane_state(old_drm_plane_state);
>> +		new_plane_state = to_rcar_plane_state(new_drm_plane_state);
>>  
>>  		dev_dbg(rcdu->dev, "%s: checking plane (%u,%tu)\n", __func__,
>>  			plane->group->index, plane - plane->group->planes);
>> @@ -159,19 +157,19 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
>>  		 * the full reallocation procedure. Just mark the hardware
>>  		 * plane(s) as freed.
>>  		 */
>> -		if (!plane_state->format) {
>> +		if (!new_plane_state->format) {
>>  			dev_dbg(rcdu->dev, "%s: plane is being disabled\n",
>>  				__func__);
>>  			index = plane - plane->group->planes;
>>  			group_freed_planes[plane->group->index] |= 1 << index;
>> -			plane_state->hwindex = -1;
>> +			new_plane_state->hwindex = -1;
>>  			continue;
>>  		}
>>  
>>  		/* If the plane needs to be reallocated mark it as such, and
>>  		 * mark the hardware plane(s) as free.
>>  		 */
>> -		if (rcar_du_plane_needs_realloc(plane, plane_state)) {
>> +		if (rcar_du_plane_needs_realloc(plane, old_plane_state, new_plane_state)) {
>>  			dev_dbg(rcdu->dev, "%s: plane needs reallocation\n",
>>  				__func__);
>>  			groups |= 1 << plane->group->index;
>> @@ -179,7 +177,7 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
>>  
>>  			index = plane - plane->group->planes;
>>  			group_freed_planes[plane->group->index] |= 1 << index;
>> -			plane_state->hwindex = -1;
>> +			new_plane_state->hwindex = -1;
>>  		}
>>  	}
>>  
>> @@ -226,16 +224,16 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
>>  				continue;
>>  			}
>>  
>> -			plane_state = to_rcar_plane_state(plane->plane.state);
>> +			new_plane_state = to_rcar_plane_state(plane->plane.state);
>>  			used_planes |= rcar_du_plane_hwmask(plane_state);
>>  
>>  			dev_dbg(rcdu->dev,
>>  				"%s: plane (%u,%tu) uses %u hwplanes (index %d)\n",
>>  				__func__, plane->group->index,
>>  				plane - plane->group->planes,
>> -				plane_state->format ?
>> -				plane_state->format->planes : 0,
>> -				plane_state->hwindex);
>> +				new_plane_state->format ?
>> +				new_plane_state->format->planes : 0,
>> +				new_plane_state->hwindex);
>>  		}
>>  
>>  		group_free_planes[index] = 0xff & ~used_planes;
>> @@ -246,15 +244,16 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
>>  	}
>>  
>>  	/* Reallocate hardware planes for each plane that needs it. */
>> -	for_each_plane_in_state(state, drm_plane, drm_plane_state, i) {
>> -		struct rcar_du_plane_state *plane_state;
>> +	for_each_oldnew_plane_in_state(state, drm_plane, old_drm_plane_state, new_drm_plane_state, i) {
>> +		struct rcar_du_plane_state *old_plane_state, *new_plane_state;
>>  		struct rcar_du_plane *plane;
>>  		unsigned int crtc_planes;
>>  		unsigned int free;
>>  		int idx;
>>  
>>  		plane = to_rcar_plane(drm_plane);
>> -		plane_state = to_rcar_plane_state(drm_plane_state);
>> +		old_plane_state = to_rcar_plane_state(old_drm_plane_state);
>> +		new_plane_state = to_rcar_plane_state(new_drm_plane_state);
>>  
>>  		dev_dbg(rcdu->dev, "%s: allocating plane (%u,%tu)\n", __func__,
>>  			plane->group->index, plane - plane->group->planes);
>> @@ -263,7 +262,7 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
>>  		 * reallocated.
>>  		 */
>>  		if (!plane_state->format ||
> I think you missed a few cases of replacing plane_state here. Does this
> compile?
I fear not..

Have a working patch below. :)

----8<------
for_each_obj_in_state is about to be removed, so use the correct new
iterator macros.

Also look at new_plane_state instead of plane->state when looking up
the hw planes in use. They should be the same except when reallocating,
(in which case this code is skipped) and we should really stop looking
at obj->state whenever possible.

Changes since v1:
- Actually compile correctly.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: linux-renesas-soc@vger.kernel.org
---
 drivers/gpu/drm/rcar-du/rcar_du_plane.c | 57 ++++++++++++++++-----------------
 1 file changed, 28 insertions(+), 29 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
index dcde6288da6c..50fd793c38d1 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
@@ -51,12 +51,9 @@
  */
 
 static bool rcar_du_plane_needs_realloc(struct rcar_du_plane *plane,
+					const struct rcar_du_plane_state *cur_state,
 					struct rcar_du_plane_state *new_state)
 {
-	struct rcar_du_plane_state *cur_state;
-
-	cur_state = to_rcar_plane_state(plane->plane.state);
-
 	/* Lowering the number of planes doesn't strictly require reallocation
 	 * as the extra hardware plane will be freed when committing, but doing
 	 * so could lead to more fragmentation.
@@ -141,16 +138,17 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
 	unsigned int groups = 0;
 	unsigned int i;
 	struct drm_plane *drm_plane;
-	struct drm_plane_state *drm_plane_state;
+	struct drm_plane_state *old_drm_plane_state, *new_drm_plane_state;
 
 	/* Check if hardware planes need to be reallocated. */
-	for_each_plane_in_state(state, drm_plane, drm_plane_state, i) {
-		struct rcar_du_plane_state *plane_state;
+	for_each_oldnew_plane_in_state(state, drm_plane, old_drm_plane_state, new_drm_plane_state, i) {
+		struct rcar_du_plane_state *old_plane_state, *new_plane_state;
 		struct rcar_du_plane *plane;
 		unsigned int index;
 
 		plane = to_rcar_plane(drm_plane);
-		plane_state = to_rcar_plane_state(drm_plane_state);
+		old_plane_state = to_rcar_plane_state(old_drm_plane_state);
+		new_plane_state = to_rcar_plane_state(new_drm_plane_state);
 
 		dev_dbg(rcdu->dev, "%s: checking plane (%u,%tu)\n", __func__,
 			plane->group->index, plane - plane->group->planes);
@@ -159,19 +157,19 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
 		 * the full reallocation procedure. Just mark the hardware
 		 * plane(s) as freed.
 		 */
-		if (!plane_state->format) {
+		if (!new_plane_state->format) {
 			dev_dbg(rcdu->dev, "%s: plane is being disabled\n",
 				__func__);
 			index = plane - plane->group->planes;
 			group_freed_planes[plane->group->index] |= 1 << index;
-			plane_state->hwindex = -1;
+			new_plane_state->hwindex = -1;
 			continue;
 		}
 
 		/* If the plane needs to be reallocated mark it as such, and
 		 * mark the hardware plane(s) as free.
 		 */
-		if (rcar_du_plane_needs_realloc(plane, plane_state)) {
+		if (rcar_du_plane_needs_realloc(plane, old_plane_state, new_plane_state)) {
 			dev_dbg(rcdu->dev, "%s: plane needs reallocation\n",
 				__func__);
 			groups |= 1 << plane->group->index;
@@ -179,7 +177,7 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
 
 			index = plane - plane->group->planes;
 			group_freed_planes[plane->group->index] |= 1 << index;
-			plane_state->hwindex = -1;
+			new_plane_state->hwindex = -1;
 		}
 	}
 
@@ -204,7 +202,7 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
 
 		for (i = 0; i < group->num_planes; ++i) {
 			struct rcar_du_plane *plane = &group->planes[i];
-			struct rcar_du_plane_state *plane_state;
+			struct rcar_du_plane_state *new_plane_state;
 			struct drm_plane_state *s;
 
 			s = drm_atomic_get_plane_state(state, &plane->plane);
@@ -226,16 +224,16 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
 				continue;
 			}
 
-			plane_state = to_rcar_plane_state(plane->plane.state);
-			used_planes |= rcar_du_plane_hwmask(plane_state);
+			new_plane_state = to_rcar_plane_state(s);
+			used_planes |= rcar_du_plane_hwmask(new_plane_state);
 
 			dev_dbg(rcdu->dev,
 				"%s: plane (%u,%tu) uses %u hwplanes (index %d)\n",
 				__func__, plane->group->index,
 				plane - plane->group->planes,
-				plane_state->format ?
-				plane_state->format->planes : 0,
-				plane_state->hwindex);
+				new_plane_state->format ?
+				new_plane_state->format->planes : 0,
+				new_plane_state->hwindex);
 		}
 
 		group_free_planes[index] = 0xff & ~used_planes;
@@ -246,15 +244,16 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
 	}
 
 	/* Reallocate hardware planes for each plane that needs it. */
-	for_each_plane_in_state(state, drm_plane, drm_plane_state, i) {
-		struct rcar_du_plane_state *plane_state;
+	for_each_oldnew_plane_in_state(state, drm_plane, old_drm_plane_state, new_drm_plane_state, i) {
+		struct rcar_du_plane_state *old_plane_state, *new_plane_state;
 		struct rcar_du_plane *plane;
 		unsigned int crtc_planes;
 		unsigned int free;
 		int idx;
 
 		plane = to_rcar_plane(drm_plane);
-		plane_state = to_rcar_plane_state(drm_plane_state);
+		old_plane_state = to_rcar_plane_state(old_drm_plane_state);
+		new_plane_state = to_rcar_plane_state(new_drm_plane_state);
 
 		dev_dbg(rcdu->dev, "%s: allocating plane (%u,%tu)\n", __func__,
 			plane->group->index, plane - plane->group->planes);
@@ -262,8 +261,8 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
 		/* Skip planes that are being disabled or don't need to be
 		 * reallocated.
 		 */
-		if (!plane_state->format ||
-		    !rcar_du_plane_needs_realloc(plane, plane_state))
+		if (!new_plane_state->format ||
+		    !rcar_du_plane_needs_realloc(plane, old_plane_state, new_plane_state))
 			continue;
 
 		/* Try to allocate the plane from the free planes currently
@@ -271,15 +270,15 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
 		 * group and thus minimize flicker. If it fails fall back to
 		 * allocating from all free planes.
 		 */
-		crtc_planes = to_rcar_crtc(plane_state->state.crtc)->index % 2
+		crtc_planes = to_rcar_crtc(new_plane_state->state.crtc)->index % 2
 			    ? plane->group->dptsr_planes
 			    : ~plane->group->dptsr_planes;
 		free = group_free_planes[plane->group->index];
 
-		idx = rcar_du_plane_hwalloc(plane, plane_state,
+		idx = rcar_du_plane_hwalloc(plane, new_plane_state,
 					    free & crtc_planes);
 		if (idx < 0)
-			idx = rcar_du_plane_hwalloc(plane, plane_state,
+			idx = rcar_du_plane_hwalloc(plane, new_plane_state,
 						    free);
 		if (idx < 0) {
 			dev_dbg(rcdu->dev, "%s: no available hardware plane\n",
@@ -288,12 +287,12 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
 		}
 
 		dev_dbg(rcdu->dev, "%s: allocated %u hwplanes (index %u)\n",
-			__func__, plane_state->format->planes, idx);
+			__func__, new_plane_state->format->planes, idx);
 
-		plane_state->hwindex = idx;
+		new_plane_state->hwindex = idx;
 
 		group_free_planes[plane->group->index] &=
-			~rcar_du_plane_hwmask(plane_state);
+			~rcar_du_plane_hwmask(new_plane_state);
 
 		dev_dbg(rcdu->dev, "%s: group %u free planes mask 0x%02x\n",
 			__func__, plane->group->index,
-- 
2.11.0

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

* [PATCH v2 07/16] drm/rcar-du: Use new iterator macros, v2.
@ 2017-07-12 10:43       ` Maarten Lankhorst
  0 siblings, 0 replies; 59+ messages in thread
From: Maarten Lankhorst @ 2017-07-12 10:43 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: linux-renesas-soc, intel-gfx, Laurent Pinchart, dri-devel

Op 12-07-17 om 11:15 schreef Daniel Vetter:
> On Wed, Jul 12, 2017 at 10:13:35AM +0200, Maarten Lankhorst wrote:
>> for_each_obj_in_state is about to be removed, so use the correct new
>> iterator macros.
>>
>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>> Cc: linux-renesas-soc@vger.kernel.org
> Looks correct, but I think Laurent has a patch to rework/remove this.
> Found something below anyway.
>
>> ---
>>  drivers/gpu/drm/rcar-du/rcar_du_plane.c | 41 ++++++++++++++++-----------------
>>  1 file changed, 20 insertions(+), 21 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
>> index dcde6288da6c..dfd84e3c8c25 100644
>> --- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
>> +++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
>> @@ -51,12 +51,9 @@
>>   */
>>  
>>  static bool rcar_du_plane_needs_realloc(struct rcar_du_plane *plane,
>> +					const struct rcar_du_plane_state *cur_state,
>>  					struct rcar_du_plane_state *new_state)
>>  {
>> -	struct rcar_du_plane_state *cur_state;
>> -
>> -	cur_state = to_rcar_plane_state(plane->plane.state);
>> -
>>  	/* Lowering the number of planes doesn't strictly require reallocation
>>  	 * as the extra hardware plane will be freed when committing, but doing
>>  	 * so could lead to more fragmentation.
>> @@ -141,16 +138,17 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
>>  	unsigned int groups = 0;
>>  	unsigned int i;
>>  	struct drm_plane *drm_plane;
>> -	struct drm_plane_state *drm_plane_state;
>> +	struct drm_plane_state *old_drm_plane_state, *new_drm_plane_state;
>>  
>>  	/* Check if hardware planes need to be reallocated. */
>> -	for_each_plane_in_state(state, drm_plane, drm_plane_state, i) {
>> -		struct rcar_du_plane_state *plane_state;
>> +	for_each_oldnew_plane_in_state(state, drm_plane, old_drm_plane_state, new_drm_plane_state, i) {
>> +		struct rcar_du_plane_state *old_plane_state, *new_plane_state;
>>  		struct rcar_du_plane *plane;
>>  		unsigned int index;
>>  
>>  		plane = to_rcar_plane(drm_plane);
>> -		plane_state = to_rcar_plane_state(drm_plane_state);
>> +		old_plane_state = to_rcar_plane_state(old_drm_plane_state);
>> +		new_plane_state = to_rcar_plane_state(new_drm_plane_state);
>>  
>>  		dev_dbg(rcdu->dev, "%s: checking plane (%u,%tu)\n", __func__,
>>  			plane->group->index, plane - plane->group->planes);
>> @@ -159,19 +157,19 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
>>  		 * the full reallocation procedure. Just mark the hardware
>>  		 * plane(s) as freed.
>>  		 */
>> -		if (!plane_state->format) {
>> +		if (!new_plane_state->format) {
>>  			dev_dbg(rcdu->dev, "%s: plane is being disabled\n",
>>  				__func__);
>>  			index = plane - plane->group->planes;
>>  			group_freed_planes[plane->group->index] |= 1 << index;
>> -			plane_state->hwindex = -1;
>> +			new_plane_state->hwindex = -1;
>>  			continue;
>>  		}
>>  
>>  		/* If the plane needs to be reallocated mark it as such, and
>>  		 * mark the hardware plane(s) as free.
>>  		 */
>> -		if (rcar_du_plane_needs_realloc(plane, plane_state)) {
>> +		if (rcar_du_plane_needs_realloc(plane, old_plane_state, new_plane_state)) {
>>  			dev_dbg(rcdu->dev, "%s: plane needs reallocation\n",
>>  				__func__);
>>  			groups |= 1 << plane->group->index;
>> @@ -179,7 +177,7 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
>>  
>>  			index = plane - plane->group->planes;
>>  			group_freed_planes[plane->group->index] |= 1 << index;
>> -			plane_state->hwindex = -1;
>> +			new_plane_state->hwindex = -1;
>>  		}
>>  	}
>>  
>> @@ -226,16 +224,16 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
>>  				continue;
>>  			}
>>  
>> -			plane_state = to_rcar_plane_state(plane->plane.state);
>> +			new_plane_state = to_rcar_plane_state(plane->plane.state);
>>  			used_planes |= rcar_du_plane_hwmask(plane_state);
>>  
>>  			dev_dbg(rcdu->dev,
>>  				"%s: plane (%u,%tu) uses %u hwplanes (index %d)\n",
>>  				__func__, plane->group->index,
>>  				plane - plane->group->planes,
>> -				plane_state->format ?
>> -				plane_state->format->planes : 0,
>> -				plane_state->hwindex);
>> +				new_plane_state->format ?
>> +				new_plane_state->format->planes : 0,
>> +				new_plane_state->hwindex);
>>  		}
>>  
>>  		group_free_planes[index] = 0xff & ~used_planes;
>> @@ -246,15 +244,16 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
>>  	}
>>  
>>  	/* Reallocate hardware planes for each plane that needs it. */
>> -	for_each_plane_in_state(state, drm_plane, drm_plane_state, i) {
>> -		struct rcar_du_plane_state *plane_state;
>> +	for_each_oldnew_plane_in_state(state, drm_plane, old_drm_plane_state, new_drm_plane_state, i) {
>> +		struct rcar_du_plane_state *old_plane_state, *new_plane_state;
>>  		struct rcar_du_plane *plane;
>>  		unsigned int crtc_planes;
>>  		unsigned int free;
>>  		int idx;
>>  
>>  		plane = to_rcar_plane(drm_plane);
>> -		plane_state = to_rcar_plane_state(drm_plane_state);
>> +		old_plane_state = to_rcar_plane_state(old_drm_plane_state);
>> +		new_plane_state = to_rcar_plane_state(new_drm_plane_state);
>>  
>>  		dev_dbg(rcdu->dev, "%s: allocating plane (%u,%tu)\n", __func__,
>>  			plane->group->index, plane - plane->group->planes);
>> @@ -263,7 +262,7 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
>>  		 * reallocated.
>>  		 */
>>  		if (!plane_state->format ||
> I think you missed a few cases of replacing plane_state here. Does this
> compile?
I fear not..

Have a working patch below. :)

----8<------
for_each_obj_in_state is about to be removed, so use the correct new
iterator macros.

Also look at new_plane_state instead of plane->state when looking up
the hw planes in use. They should be the same except when reallocating,
(in which case this code is skipped) and we should really stop looking
at obj->state whenever possible.

Changes since v1:
- Actually compile correctly.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: linux-renesas-soc@vger.kernel.org
---
 drivers/gpu/drm/rcar-du/rcar_du_plane.c | 57 ++++++++++++++++-----------------
 1 file changed, 28 insertions(+), 29 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
index dcde6288da6c..50fd793c38d1 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
@@ -51,12 +51,9 @@
  */
 
 static bool rcar_du_plane_needs_realloc(struct rcar_du_plane *plane,
+					const struct rcar_du_plane_state *cur_state,
 					struct rcar_du_plane_state *new_state)
 {
-	struct rcar_du_plane_state *cur_state;
-
-	cur_state = to_rcar_plane_state(plane->plane.state);
-
 	/* Lowering the number of planes doesn't strictly require reallocation
 	 * as the extra hardware plane will be freed when committing, but doing
 	 * so could lead to more fragmentation.
@@ -141,16 +138,17 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
 	unsigned int groups = 0;
 	unsigned int i;
 	struct drm_plane *drm_plane;
-	struct drm_plane_state *drm_plane_state;
+	struct drm_plane_state *old_drm_plane_state, *new_drm_plane_state;
 
 	/* Check if hardware planes need to be reallocated. */
-	for_each_plane_in_state(state, drm_plane, drm_plane_state, i) {
-		struct rcar_du_plane_state *plane_state;
+	for_each_oldnew_plane_in_state(state, drm_plane, old_drm_plane_state, new_drm_plane_state, i) {
+		struct rcar_du_plane_state *old_plane_state, *new_plane_state;
 		struct rcar_du_plane *plane;
 		unsigned int index;
 
 		plane = to_rcar_plane(drm_plane);
-		plane_state = to_rcar_plane_state(drm_plane_state);
+		old_plane_state = to_rcar_plane_state(old_drm_plane_state);
+		new_plane_state = to_rcar_plane_state(new_drm_plane_state);
 
 		dev_dbg(rcdu->dev, "%s: checking plane (%u,%tu)\n", __func__,
 			plane->group->index, plane - plane->group->planes);
@@ -159,19 +157,19 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
 		 * the full reallocation procedure. Just mark the hardware
 		 * plane(s) as freed.
 		 */
-		if (!plane_state->format) {
+		if (!new_plane_state->format) {
 			dev_dbg(rcdu->dev, "%s: plane is being disabled\n",
 				__func__);
 			index = plane - plane->group->planes;
 			group_freed_planes[plane->group->index] |= 1 << index;
-			plane_state->hwindex = -1;
+			new_plane_state->hwindex = -1;
 			continue;
 		}
 
 		/* If the plane needs to be reallocated mark it as such, and
 		 * mark the hardware plane(s) as free.
 		 */
-		if (rcar_du_plane_needs_realloc(plane, plane_state)) {
+		if (rcar_du_plane_needs_realloc(plane, old_plane_state, new_plane_state)) {
 			dev_dbg(rcdu->dev, "%s: plane needs reallocation\n",
 				__func__);
 			groups |= 1 << plane->group->index;
@@ -179,7 +177,7 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
 
 			index = plane - plane->group->planes;
 			group_freed_planes[plane->group->index] |= 1 << index;
-			plane_state->hwindex = -1;
+			new_plane_state->hwindex = -1;
 		}
 	}
 
@@ -204,7 +202,7 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
 
 		for (i = 0; i < group->num_planes; ++i) {
 			struct rcar_du_plane *plane = &group->planes[i];
-			struct rcar_du_plane_state *plane_state;
+			struct rcar_du_plane_state *new_plane_state;
 			struct drm_plane_state *s;
 
 			s = drm_atomic_get_plane_state(state, &plane->plane);
@@ -226,16 +224,16 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
 				continue;
 			}
 
-			plane_state = to_rcar_plane_state(plane->plane.state);
-			used_planes |= rcar_du_plane_hwmask(plane_state);
+			new_plane_state = to_rcar_plane_state(s);
+			used_planes |= rcar_du_plane_hwmask(new_plane_state);
 
 			dev_dbg(rcdu->dev,
 				"%s: plane (%u,%tu) uses %u hwplanes (index %d)\n",
 				__func__, plane->group->index,
 				plane - plane->group->planes,
-				plane_state->format ?
-				plane_state->format->planes : 0,
-				plane_state->hwindex);
+				new_plane_state->format ?
+				new_plane_state->format->planes : 0,
+				new_plane_state->hwindex);
 		}
 
 		group_free_planes[index] = 0xff & ~used_planes;
@@ -246,15 +244,16 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
 	}
 
 	/* Reallocate hardware planes for each plane that needs it. */
-	for_each_plane_in_state(state, drm_plane, drm_plane_state, i) {
-		struct rcar_du_plane_state *plane_state;
+	for_each_oldnew_plane_in_state(state, drm_plane, old_drm_plane_state, new_drm_plane_state, i) {
+		struct rcar_du_plane_state *old_plane_state, *new_plane_state;
 		struct rcar_du_plane *plane;
 		unsigned int crtc_planes;
 		unsigned int free;
 		int idx;
 
 		plane = to_rcar_plane(drm_plane);
-		plane_state = to_rcar_plane_state(drm_plane_state);
+		old_plane_state = to_rcar_plane_state(old_drm_plane_state);
+		new_plane_state = to_rcar_plane_state(new_drm_plane_state);
 
 		dev_dbg(rcdu->dev, "%s: allocating plane (%u,%tu)\n", __func__,
 			plane->group->index, plane - plane->group->planes);
@@ -262,8 +261,8 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
 		/* Skip planes that are being disabled or don't need to be
 		 * reallocated.
 		 */
-		if (!plane_state->format ||
-		    !rcar_du_plane_needs_realloc(plane, plane_state))
+		if (!new_plane_state->format ||
+		    !rcar_du_plane_needs_realloc(plane, old_plane_state, new_plane_state))
 			continue;
 
 		/* Try to allocate the plane from the free planes currently
@@ -271,15 +270,15 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
 		 * group and thus minimize flicker. If it fails fall back to
 		 * allocating from all free planes.
 		 */
-		crtc_planes = to_rcar_crtc(plane_state->state.crtc)->index % 2
+		crtc_planes = to_rcar_crtc(new_plane_state->state.crtc)->index % 2
 			    ? plane->group->dptsr_planes
 			    : ~plane->group->dptsr_planes;
 		free = group_free_planes[plane->group->index];
 
-		idx = rcar_du_plane_hwalloc(plane, plane_state,
+		idx = rcar_du_plane_hwalloc(plane, new_plane_state,
 					    free & crtc_planes);
 		if (idx < 0)
-			idx = rcar_du_plane_hwalloc(plane, plane_state,
+			idx = rcar_du_plane_hwalloc(plane, new_plane_state,
 						    free);
 		if (idx < 0) {
 			dev_dbg(rcdu->dev, "%s: no available hardware plane\n",
@@ -288,12 +287,12 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
 		}
 
 		dev_dbg(rcdu->dev, "%s: allocated %u hwplanes (index %u)\n",
-			__func__, plane_state->format->planes, idx);
+			__func__, new_plane_state->format->planes, idx);
 
-		plane_state->hwindex = idx;
+		new_plane_state->hwindex = idx;
 
 		group_free_planes[plane->group->index] &=
-			~rcar_du_plane_hwmask(plane_state);
+			~rcar_du_plane_hwmask(new_plane_state);
 
 		dev_dbg(rcdu->dev, "%s: group %u free planes mask 0x%02x\n",
 			__func__, plane->group->index,
-- 
2.11.0


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

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

* [PATCH 14/16] drm/msm: Convert to use new iterator macros, v2.
       [not found]       ` <20170712094823.2akjrev3v7ckxb7b-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
@ 2017-07-12 10:45         ` Maarten Lankhorst
       [not found]           ` <de5e7892-71a0-d160-6619-e8267d793897-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
  0 siblings, 1 reply; 59+ messages in thread
From: Maarten Lankhorst @ 2017-07-12 10:45 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Rob Herring, Archit Taneja, linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	Sushmita Susheelendra, Russell King, Vincent Abriou,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Markus Elfring

Op 12-07-17 om 11:48 schreef Daniel Vetter:
> On Wed, Jul 12, 2017 at 10:13:42AM +0200, Maarten Lankhorst wrote:
>> for_each_obj_in_state is about to be removed, so convert
>> to the new iterator macros.
>>
>> Just like in omap, use crtc_state->active instead of
>> crtc_state->enable when waiting for completion.
>>
>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>> Cc: Rob Clark <robdclark@gmail.com>
>> Cc: Archit Taneja <architt@codeaurora.org>
>> Cc: Vincent Abriou <vincent.abriou@st.com>
>> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>> Cc: Russell King <rmk+kernel@armlinux.org.uk>
>> Cc: Rob Herring <robh@kernel.org>
>> Cc: Markus Elfring <elfring@users.sourceforge.net>
>> Cc: Sushmita Susheelendra <ssusheel@codeaurora.org>
>> Cc: linux-arm-msm@vger.kernel.org
>> Cc: freedreno@lists.freedesktop.org
>> ---
>>  drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c |  4 ++--
>>  drivers/gpu/drm/msm/msm_atomic.c        | 16 ++++++++--------
>>  2 files changed, 10 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
>> index bcd1f5cac72c..f7f087419ed8 100644
>> --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
>> +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
>> @@ -114,7 +114,7 @@ static void mdp4_prepare_commit(struct msm_kms *kms, struct drm_atomic_state *st
>>  	mdp4_enable(mdp4_kms);
>>  
>>  	/* see 119ecb7fd */
>> -	for_each_crtc_in_state(state, crtc, crtc_state, i)
>> +	for_each_new_crtc_in_state(state, crtc, crtc_state, i)
>>  		drm_crtc_vblank_get(crtc);
>>  }
>>  
>> @@ -126,7 +126,7 @@ static void mdp4_complete_commit(struct msm_kms *kms, struct drm_atomic_state *s
>>  	struct drm_crtc_state *crtc_state;
>>  
>>  	/* see 119ecb7fd */
>> -	for_each_crtc_in_state(state, crtc, crtc_state, i)
>> +	for_each_new_crtc_in_state(state, crtc, crtc_state, i)
>>  		drm_crtc_vblank_put(crtc);
>>  
>>  	mdp4_disable(mdp4_kms);
>> diff --git a/drivers/gpu/drm/msm/msm_atomic.c b/drivers/gpu/drm/msm/msm_atomic.c
>> index 9633a68b14d7..9d3cc1f5e31a 100644
>> --- a/drivers/gpu/drm/msm/msm_atomic.c
>> +++ b/drivers/gpu/drm/msm/msm_atomic.c
>> @@ -84,13 +84,13 @@ static void msm_atomic_wait_for_commit_done(struct drm_device *dev,
>>  		struct drm_atomic_state *old_state)
>>  {
>>  	struct drm_crtc *crtc;
>> -	struct drm_crtc_state *crtc_state;
>> +	struct drm_crtc_state *new_crtc_state;
>>  	struct msm_drm_private *priv = old_state->dev->dev_private;
>>  	struct msm_kms *kms = priv->kms;
>>  	int i;
>>  
>> -	for_each_crtc_in_state(old_state, crtc, crtc_state, i) {
>> -		if (!crtc->state->enable)
>> +	for_each_new_crtc_in_state(old_state, crtc, new_crtc_state, i) {
>> +		if (!new_crtc_state->active)
>>  			continue;
>>  
>>  		kms->funcs->wait_for_crtc_commit_done(kms, crtc);
>> @@ -195,7 +195,7 @@ int msm_atomic_commit(struct drm_device *dev,
>>  	struct drm_crtc *crtc;
>>  	struct drm_crtc_state *crtc_state;
>>  	struct drm_plane *plane;
>> -	struct drm_plane_state *plane_state;
>> +	struct drm_plane_state *old_plane_state, *new_plane_state;
>>  	int i, ret;
>>  
>>  	ret = drm_atomic_helper_prepare_planes(dev, state);
>> @@ -211,15 +211,15 @@ int msm_atomic_commit(struct drm_device *dev,
>>  	/*
>>  	 * Figure out what crtcs we have:
>>  	 */
>> -	for_each_crtc_in_state(state, crtc, crtc_state, i)
>> +	for_each_new_crtc_in_state(state, crtc, crtc_state, i)
>>  		c->crtc_mask |= drm_crtc_mask(crtc);
>>  
>>  	/*
>>  	 * Figure out what fence to wait for:
>>  	 */
>> -	for_each_plane_in_state(state, plane, plane_state, i) {
>> -		if ((plane->state->fb != plane_state->fb) && plane_state->fb) {
>> -			struct drm_gem_object *obj = msm_framebuffer_bo(plane_state->fb, 0);
>> +	for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) {
>> +		if ((new_plane_state->fb != old_plane_state->fb) && new_plane_state->fb) {
>> +			struct drm_gem_object *obj = msm_framebuffer_bo(new_plane_state->fb, 0);
>>  			struct msm_gem_object *msm_obj = to_msm_bo(obj);
>>  			struct dma_fence *fence = reservation_object_get_excl_rcu(msm_obj->resv);
> Pretty sure this fails to compile, you've forgotten to do one more
> s/plane_state/new_plane_state/.
>
> With that fixed:
>
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

--->8---
for_each_obj_in_state is about to be removed, so convert
to the new iterator macros.

Just like in omap, use crtc_state->active instead of
crtc_state->enable when waiting for completion.

Changes since v1:
- Fix compilation.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Archit Taneja <architt@codeaurora.org>
Cc: Vincent Abriou <vincent.abriou@st.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Russell King <rmk+kernel@armlinux.org.uk>
Cc: Rob Herring <robh@kernel.org>
Cc: Markus Elfring <elfring@users.sourceforge.net>
Cc: Sushmita Susheelendra <ssusheel@codeaurora.org>
Cc: linux-arm-msm@vger.kernel.org
Cc: freedreno@lists.freedesktop.org
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c |  4 ++--
 drivers/gpu/drm/msm/msm_atomic.c        | 18 +++++++++---------
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
index bcd1f5cac72c..f7f087419ed8 100644
--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
+++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
@@ -114,7 +114,7 @@ static void mdp4_prepare_commit(struct msm_kms *kms, struct drm_atomic_state *st
 	mdp4_enable(mdp4_kms);
 
 	/* see 119ecb7fd */
-	for_each_crtc_in_state(state, crtc, crtc_state, i)
+	for_each_new_crtc_in_state(state, crtc, crtc_state, i)
 		drm_crtc_vblank_get(crtc);
 }
 
@@ -126,7 +126,7 @@ static void mdp4_complete_commit(struct msm_kms *kms, struct drm_atomic_state *s
 	struct drm_crtc_state *crtc_state;
 
 	/* see 119ecb7fd */
-	for_each_crtc_in_state(state, crtc, crtc_state, i)
+	for_each_new_crtc_in_state(state, crtc, crtc_state, i)
 		drm_crtc_vblank_put(crtc);
 
 	mdp4_disable(mdp4_kms);
diff --git a/drivers/gpu/drm/msm/msm_atomic.c b/drivers/gpu/drm/msm/msm_atomic.c
index 9633a68b14d7..2728794a7142 100644
--- a/drivers/gpu/drm/msm/msm_atomic.c
+++ b/drivers/gpu/drm/msm/msm_atomic.c
@@ -84,13 +84,13 @@ static void msm_atomic_wait_for_commit_done(struct drm_device *dev,
 		struct drm_atomic_state *old_state)
 {
 	struct drm_crtc *crtc;
-	struct drm_crtc_state *crtc_state;
+	struct drm_crtc_state *new_crtc_state;
 	struct msm_drm_private *priv = old_state->dev->dev_private;
 	struct msm_kms *kms = priv->kms;
 	int i;
 
-	for_each_crtc_in_state(old_state, crtc, crtc_state, i) {
-		if (!crtc->state->enable)
+	for_each_new_crtc_in_state(old_state, crtc, new_crtc_state, i) {
+		if (!new_crtc_state->active)
 			continue;
 
 		kms->funcs->wait_for_crtc_commit_done(kms, crtc);
@@ -195,7 +195,7 @@ int msm_atomic_commit(struct drm_device *dev,
 	struct drm_crtc *crtc;
 	struct drm_crtc_state *crtc_state;
 	struct drm_plane *plane;
-	struct drm_plane_state *plane_state;
+	struct drm_plane_state *old_plane_state, *new_plane_state;
 	int i, ret;
 
 	ret = drm_atomic_helper_prepare_planes(dev, state);
@@ -211,19 +211,19 @@ int msm_atomic_commit(struct drm_device *dev,
 	/*
 	 * Figure out what crtcs we have:
 	 */
-	for_each_crtc_in_state(state, crtc, crtc_state, i)
+	for_each_new_crtc_in_state(state, crtc, crtc_state, i)
 		c->crtc_mask |= drm_crtc_mask(crtc);
 
 	/*
 	 * Figure out what fence to wait for:
 	 */
-	for_each_plane_in_state(state, plane, plane_state, i) {
-		if ((plane->state->fb != plane_state->fb) && plane_state->fb) {
-			struct drm_gem_object *obj = msm_framebuffer_bo(plane_state->fb, 0);
+	for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) {
+		if ((new_plane_state->fb != old_plane_state->fb) && new_plane_state->fb) {
+			struct drm_gem_object *obj = msm_framebuffer_bo(new_plane_state->fb, 0);
 			struct msm_gem_object *msm_obj = to_msm_bo(obj);
 			struct dma_fence *fence = reservation_object_get_excl_rcu(msm_obj->resv);
 
-			drm_atomic_set_fence_for_plane(plane_state, fence);
+			drm_atomic_set_fence_for_plane(new_plane_state, fence);
 		}
 	}
 
-- 
2.11.0


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

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

* Re: [PATCH 16/16] drm/atomic: Remove deprecated accessor macros
  2017-07-12  9:50   ` Daniel Vetter
@ 2017-07-12 11:48     ` Maarten Lankhorst
  0 siblings, 0 replies; 59+ messages in thread
From: Maarten Lankhorst @ 2017-07-12 11:48 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: David Airlie, Daniel Vetter, intel-gfx, dri-devel

Op 12-07-17 om 11:50 schreef Daniel Vetter:
> On Wed, Jul 12, 2017 at 10:13:44AM +0200, Maarten Lankhorst wrote:
>> Now that the last users have been converted, we can finally get rid of
>> for_each_obj_in_state, we have better macros to replace them with.
>>
>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>> Cc: Daniel Vetter <daniel.vetter@intel.com>
>> Cc: Jani Nikula <jani.nikula@linux.intel.com>
>> Cc: Sean Paul <seanpaul@chromium.org>
>> Cc: David Airlie <airlied@linux.ie>
> Lgtm, but please make sure you do compile test with all three drm-misc
> defconfigs. Two of the patches looked like they didn't see a compiler, so
> there might be more lurking.
Tested with all 3 configs, seems to compile now. :)
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [Intel-gfx] [PATCH 15/16] drm/nouveau: Convert nouveau to use new iterator macros
  2017-07-12  8:13 ` [PATCH 15/16] drm/nouveau: Convert nouveau to use new iterator macros Maarten Lankhorst
@ 2017-07-13 12:33   ` Daniel Vetter
  2017-07-13 13:51     ` Maarten Lankhorst
  0 siblings, 1 reply; 59+ messages in thread
From: Daniel Vetter @ 2017-07-13 12:33 UTC (permalink / raw)
  To: Maarten Lankhorst; +Cc: nouveau, intel-gfx, Ben Skeggs, dri-devel

On Wed, Jul 12, 2017 at 10:13:43AM +0200, Maarten Lankhorst wrote:
> Use the new atomic iterator macros, the old ones are about to be
> removed. With the new macros, it's more easy to get old and new state so
> get them from the macros instead of from obj->state.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: nouveau@lists.freedesktop.org
> ---
>  drivers/gpu/drm/nouveau/nv50_display.c | 71 +++++++++++++++++-----------------
>  1 file changed, 36 insertions(+), 35 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
> index 42a85c14aea0..b1ce8f1f58dc 100644
> --- a/drivers/gpu/drm/nouveau/nv50_display.c
> +++ b/drivers/gpu/drm/nouveau/nv50_display.c
> @@ -2103,7 +2103,7 @@ nv50_head_atomic_check(struct drm_crtc *crtc, struct drm_crtc_state *state)
>  
>  	NV_ATOMIC(drm, "%s atomic_check %d\n", crtc->name, asyh->state.active);
>  	if (asyh->state.active) {
> -		for_each_connector_in_state(asyh->state.state, conn, conns, i) {
> +		for_each_new_connector_in_state(asyh->state.state, conn, conns, i) {
>  			if (conns->crtc == crtc) {
>  				asyc = nouveau_conn_atom(conns);
>  				break;
> @@ -3904,9 +3904,9 @@ static void
>  nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
>  {
>  	struct drm_device *dev = state->dev;
> -	struct drm_crtc_state *crtc_state;
> +	struct drm_crtc_state *new_crtc_state;
>  	struct drm_crtc *crtc;
> -	struct drm_plane_state *plane_state;
> +	struct drm_plane_state *new_plane_state;
>  	struct drm_plane *plane;
>  	struct nouveau_drm *drm = nouveau_drm(dev);
>  	struct nv50_disp *disp = nv50_disp(dev);
> @@ -3925,8 +3925,8 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
>  		mutex_lock(&disp->mutex);
>  
>  	/* Disable head(s). */
> -	for_each_crtc_in_state(state, crtc, crtc_state, i) {
> -		struct nv50_head_atom *asyh = nv50_head_atom(crtc->state);
> +	for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
> +		struct nv50_head_atom *asyh = nv50_head_atom(new_crtc_state);
>  		struct nv50_head *head = nv50_head(crtc);
>  
>  		NV_ATOMIC(drm, "%s: clr %04x (set %04x)\n", crtc->name,
> @@ -3939,8 +3939,8 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
>  	}
>  
>  	/* Disable plane(s). */
> -	for_each_plane_in_state(state, plane, plane_state, i) {
> -		struct nv50_wndw_atom *asyw = nv50_wndw_atom(plane->state);
> +	for_each_new_plane_in_state(state, plane, new_plane_state, i) {
> +		struct nv50_wndw_atom *asyw = nv50_wndw_atom(new_plane_state);
>  		struct nv50_wndw *wndw = nv50_wndw(plane);
>  
>  		NV_ATOMIC(drm, "%s: clr %02x (set %02x)\n", plane->name,
> @@ -4005,8 +4005,8 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
>  	}
>  
>  	/* Update head(s). */
> -	for_each_crtc_in_state(state, crtc, crtc_state, i) {
> -		struct nv50_head_atom *asyh = nv50_head_atom(crtc->state);
> +	for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
> +		struct nv50_head_atom *asyh = nv50_head_atom(new_crtc_state);
>  		struct nv50_head *head = nv50_head(crtc);
>  
>  		NV_ATOMIC(drm, "%s: set %04x (clr %04x)\n", crtc->name,
> @@ -4018,14 +4018,14 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
>  		}
>  	}
>  
> -	for_each_crtc_in_state(state, crtc, crtc_state, i) {
> -		if (crtc->state->event)
> +	for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
> +		if (new_crtc_state->event)
>  			drm_crtc_vblank_get(crtc);
>  	}
>  
>  	/* Update plane(s). */
> -	for_each_plane_in_state(state, plane, plane_state, i) {
> -		struct nv50_wndw_atom *asyw = nv50_wndw_atom(plane->state);
> +	for_each_new_plane_in_state(state, plane, new_plane_state, i) {
> +		struct nv50_wndw_atom *asyw = nv50_wndw_atom(new_plane_state);
>  		struct nv50_wndw *wndw = nv50_wndw(plane);
>  
>  		NV_ATOMIC(drm, "%s: set %02x (clr %02x)\n", plane->name,
> @@ -4055,23 +4055,23 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
>  		mutex_unlock(&disp->mutex);
>  
>  	/* Wait for HW to signal completion. */
> -	for_each_plane_in_state(state, plane, plane_state, i) {
> -		struct nv50_wndw_atom *asyw = nv50_wndw_atom(plane->state);
> +	for_each_new_plane_in_state(state, plane, new_plane_state, i) {
> +		struct nv50_wndw_atom *asyw = nv50_wndw_atom(new_plane_state);
>  		struct nv50_wndw *wndw = nv50_wndw(plane);
>  		int ret = nv50_wndw_wait_armed(wndw, asyw);
>  		if (ret)
>  			NV_ERROR(drm, "%s: timeout\n", plane->name);
>  	}
>  
> -	for_each_crtc_in_state(state, crtc, crtc_state, i) {
> -		if (crtc->state->event) {
> +	for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
> +		if (new_crtc_state->event) {
>  			unsigned long flags;
>  			/* Get correct count/ts if racing with vblank irq */
>  			drm_crtc_accurate_vblank_count(crtc);
>  			spin_lock_irqsave(&crtc->dev->event_lock, flags);
> -			drm_crtc_send_vblank_event(crtc, crtc->state->event);
> +			drm_crtc_send_vblank_event(crtc, new_crtc_state->event);
>  			spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
> -			crtc->state->event = NULL;
> +			new_crtc_state->event = NULL;
>  			drm_crtc_vblank_put(crtc);
>  		}
>  	}
> @@ -4096,7 +4096,7 @@ nv50_disp_atomic_commit(struct drm_device *dev,
>  {
>  	struct nouveau_drm *drm = nouveau_drm(dev);
>  	struct nv50_disp *disp = nv50_disp(dev);
> -	struct drm_plane_state *plane_state;
> +	struct drm_plane_state *old_plane_state;
>  	struct drm_plane *plane;
>  	struct drm_crtc *crtc;
>  	bool active = false;
> @@ -4122,8 +4122,8 @@ nv50_disp_atomic_commit(struct drm_device *dev,
>  			goto done;
>  	}
>  
> -	for_each_plane_in_state(state, plane, plane_state, i) {
> -		struct nv50_wndw_atom *asyw = nv50_wndw_atom(plane_state);
> +	for_each_old_plane_in_state(state, plane, old_plane_state, i) {
> +		struct nv50_wndw_atom *asyw = nv50_wndw_atom(old_plane_state);
>  		struct nv50_wndw *wndw = nv50_wndw(plane);
>  		if (asyw->set.image) {
>  			asyw->ntfy.handle = wndw->dmac->sync.handle;
> @@ -4185,18 +4185,19 @@ nv50_disp_outp_atomic_add(struct nv50_atom *atom, struct drm_encoder *encoder)
>  
>  static int
>  nv50_disp_outp_atomic_check_clr(struct nv50_atom *atom,
> -				struct drm_connector *connector)
> +				struct drm_connector_state *old_connector_state)
>  {
> -	struct drm_encoder *encoder = connector->state->best_encoder;
> -	struct drm_crtc_state *crtc_state;
> +	struct drm_encoder *encoder = old_connector_state->best_encoder;
> +	struct drm_crtc_state *old_crtc_state, *new_crtc_state;
>  	struct drm_crtc *crtc;
>  	struct nv50_outp_atom *outp;
>  
> -	if (!(crtc = connector->state->crtc))
> +	if (!(crtc = old_connector_state->crtc))
>  		return 0;
>  
> -	crtc_state = drm_atomic_get_existing_crtc_state(&atom->state, crtc);
> -	if (crtc->state->active && drm_atomic_crtc_needs_modeset(crtc_state)) {
> +	old_crtc_state = drm_atomic_get_new_crtc_state(&atom->state, crtc);
> +	new_crtc_state = drm_atomic_get_new_crtc_state(&atom->state, crtc);

I think you have a mixup here of the crtc states for old and new crtc,
both are get_new_crtc_state.

Otherwise lgtm.
-Daniel

> +	if (old_crtc_state->active && drm_atomic_crtc_needs_modeset(new_crtc_state)) {
>  		outp = nv50_disp_outp_atomic_add(atom, encoder);
>  		if (IS_ERR(outp))
>  			return PTR_ERR(outp);
> @@ -4217,15 +4218,15 @@ nv50_disp_outp_atomic_check_set(struct nv50_atom *atom,
>  				struct drm_connector_state *connector_state)
>  {
>  	struct drm_encoder *encoder = connector_state->best_encoder;
> -	struct drm_crtc_state *crtc_state;
> +	struct drm_crtc_state *new_crtc_state;
>  	struct drm_crtc *crtc;
>  	struct nv50_outp_atom *outp;
>  
>  	if (!(crtc = connector_state->crtc))
>  		return 0;
>  
> -	crtc_state = drm_atomic_get_existing_crtc_state(&atom->state, crtc);
> -	if (crtc_state->active && drm_atomic_crtc_needs_modeset(crtc_state)) {
> +	new_crtc_state = drm_atomic_get_new_crtc_state(&atom->state, crtc);
> +	if (new_crtc_state->active && drm_atomic_crtc_needs_modeset(new_crtc_state)) {
>  		outp = nv50_disp_outp_atomic_add(atom, encoder);
>  		if (IS_ERR(outp))
>  			return PTR_ERR(outp);
> @@ -4241,7 +4242,7 @@ static int
>  nv50_disp_atomic_check(struct drm_device *dev, struct drm_atomic_state *state)
>  {
>  	struct nv50_atom *atom = nv50_atom(state);
> -	struct drm_connector_state *connector_state;
> +	struct drm_connector_state *old_connector_state, *new_connector_state;
>  	struct drm_connector *connector;
>  	int ret, i;
>  
> @@ -4249,12 +4250,12 @@ nv50_disp_atomic_check(struct drm_device *dev, struct drm_atomic_state *state)
>  	if (ret)
>  		return ret;
>  
> -	for_each_connector_in_state(state, connector, connector_state, i) {
> -		ret = nv50_disp_outp_atomic_check_clr(atom, connector);
> +	for_each_oldnew_connector_in_state(state, connector, old_connector_state, new_connector_state, i) {
> +		ret = nv50_disp_outp_atomic_check_clr(atom, old_connector_state);
>  		if (ret)
>  			return ret;
>  
> -		ret = nv50_disp_outp_atomic_check_set(atom, connector_state);
> +		ret = nv50_disp_outp_atomic_check_set(atom, new_connector_state);
>  		if (ret)
>  			return ret;
>  	}
> -- 
> 2.11.0
> 
> _______________________________________________
> 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] 59+ messages in thread

* Re: [PATCH 15/16] drm/nouveau: Convert nouveau to use new iterator macros
  2017-07-13 12:33   ` [Intel-gfx] " Daniel Vetter
@ 2017-07-13 13:51     ` Maarten Lankhorst
  0 siblings, 0 replies; 59+ messages in thread
From: Maarten Lankhorst @ 2017-07-13 13:51 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: nouveau, intel-gfx, Ben Skeggs, dri-devel

Op 13-07-17 om 14:33 schreef Daniel Vetter:
> On Wed, Jul 12, 2017 at 10:13:43AM +0200, Maarten Lankhorst wrote:
>> Use the new atomic iterator macros, the old ones are about to be
>> removed. With the new macros, it's more easy to get old and new state so
>> get them from the macros instead of from obj->state.
>>
>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>> Cc: Ben Skeggs <bskeggs@redhat.com>
>> Cc: nouveau@lists.freedesktop.org
>> ---
>>  drivers/gpu/drm/nouveau/nv50_display.c | 71 +++++++++++++++++-----------------
>>  1 file changed, 36 insertions(+), 35 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
>> index 42a85c14aea0..b1ce8f1f58dc 100644
>> --- a/drivers/gpu/drm/nouveau/nv50_display.c
>> +++ b/drivers/gpu/drm/nouveau/nv50_display.c
>> @@ -2103,7 +2103,7 @@ nv50_head_atomic_check(struct drm_crtc *crtc, struct drm_crtc_state *state)
>>  
>>  	NV_ATOMIC(drm, "%s atomic_check %d\n", crtc->name, asyh->state.active);
>>  	if (asyh->state.active) {
>> -		for_each_connector_in_state(asyh->state.state, conn, conns, i) {
>> +		for_each_new_connector_in_state(asyh->state.state, conn, conns, i) {
>>  			if (conns->crtc == crtc) {
>>  				asyc = nouveau_conn_atom(conns);
>>  				break;
>> @@ -3904,9 +3904,9 @@ static void
>>  nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
>>  {
>>  	struct drm_device *dev = state->dev;
>> -	struct drm_crtc_state *crtc_state;
>> +	struct drm_crtc_state *new_crtc_state;
>>  	struct drm_crtc *crtc;
>> -	struct drm_plane_state *plane_state;
>> +	struct drm_plane_state *new_plane_state;
>>  	struct drm_plane *plane;
>>  	struct nouveau_drm *drm = nouveau_drm(dev);
>>  	struct nv50_disp *disp = nv50_disp(dev);
>> @@ -3925,8 +3925,8 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
>>  		mutex_lock(&disp->mutex);
>>  
>>  	/* Disable head(s). */
>> -	for_each_crtc_in_state(state, crtc, crtc_state, i) {
>> -		struct nv50_head_atom *asyh = nv50_head_atom(crtc->state);
>> +	for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
>> +		struct nv50_head_atom *asyh = nv50_head_atom(new_crtc_state);
>>  		struct nv50_head *head = nv50_head(crtc);
>>  
>>  		NV_ATOMIC(drm, "%s: clr %04x (set %04x)\n", crtc->name,
>> @@ -3939,8 +3939,8 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
>>  	}
>>  
>>  	/* Disable plane(s). */
>> -	for_each_plane_in_state(state, plane, plane_state, i) {
>> -		struct nv50_wndw_atom *asyw = nv50_wndw_atom(plane->state);
>> +	for_each_new_plane_in_state(state, plane, new_plane_state, i) {
>> +		struct nv50_wndw_atom *asyw = nv50_wndw_atom(new_plane_state);
>>  		struct nv50_wndw *wndw = nv50_wndw(plane);
>>  
>>  		NV_ATOMIC(drm, "%s: clr %02x (set %02x)\n", plane->name,
>> @@ -4005,8 +4005,8 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
>>  	}
>>  
>>  	/* Update head(s). */
>> -	for_each_crtc_in_state(state, crtc, crtc_state, i) {
>> -		struct nv50_head_atom *asyh = nv50_head_atom(crtc->state);
>> +	for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
>> +		struct nv50_head_atom *asyh = nv50_head_atom(new_crtc_state);
>>  		struct nv50_head *head = nv50_head(crtc);
>>  
>>  		NV_ATOMIC(drm, "%s: set %04x (clr %04x)\n", crtc->name,
>> @@ -4018,14 +4018,14 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
>>  		}
>>  	}
>>  
>> -	for_each_crtc_in_state(state, crtc, crtc_state, i) {
>> -		if (crtc->state->event)
>> +	for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
>> +		if (new_crtc_state->event)
>>  			drm_crtc_vblank_get(crtc);
>>  	}
>>  
>>  	/* Update plane(s). */
>> -	for_each_plane_in_state(state, plane, plane_state, i) {
>> -		struct nv50_wndw_atom *asyw = nv50_wndw_atom(plane->state);
>> +	for_each_new_plane_in_state(state, plane, new_plane_state, i) {
>> +		struct nv50_wndw_atom *asyw = nv50_wndw_atom(new_plane_state);
>>  		struct nv50_wndw *wndw = nv50_wndw(plane);
>>  
>>  		NV_ATOMIC(drm, "%s: set %02x (clr %02x)\n", plane->name,
>> @@ -4055,23 +4055,23 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
>>  		mutex_unlock(&disp->mutex);
>>  
>>  	/* Wait for HW to signal completion. */
>> -	for_each_plane_in_state(state, plane, plane_state, i) {
>> -		struct nv50_wndw_atom *asyw = nv50_wndw_atom(plane->state);
>> +	for_each_new_plane_in_state(state, plane, new_plane_state, i) {
>> +		struct nv50_wndw_atom *asyw = nv50_wndw_atom(new_plane_state);
>>  		struct nv50_wndw *wndw = nv50_wndw(plane);
>>  		int ret = nv50_wndw_wait_armed(wndw, asyw);
>>  		if (ret)
>>  			NV_ERROR(drm, "%s: timeout\n", plane->name);
>>  	}
>>  
>> -	for_each_crtc_in_state(state, crtc, crtc_state, i) {
>> -		if (crtc->state->event) {
>> +	for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
>> +		if (new_crtc_state->event) {
>>  			unsigned long flags;
>>  			/* Get correct count/ts if racing with vblank irq */
>>  			drm_crtc_accurate_vblank_count(crtc);
>>  			spin_lock_irqsave(&crtc->dev->event_lock, flags);
>> -			drm_crtc_send_vblank_event(crtc, crtc->state->event);
>> +			drm_crtc_send_vblank_event(crtc, new_crtc_state->event);
>>  			spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
>> -			crtc->state->event = NULL;
>> +			new_crtc_state->event = NULL;
>>  			drm_crtc_vblank_put(crtc);
>>  		}
>>  	}
>> @@ -4096,7 +4096,7 @@ nv50_disp_atomic_commit(struct drm_device *dev,
>>  {
>>  	struct nouveau_drm *drm = nouveau_drm(dev);
>>  	struct nv50_disp *disp = nv50_disp(dev);
>> -	struct drm_plane_state *plane_state;
>> +	struct drm_plane_state *old_plane_state;
>>  	struct drm_plane *plane;
>>  	struct drm_crtc *crtc;
>>  	bool active = false;
>> @@ -4122,8 +4122,8 @@ nv50_disp_atomic_commit(struct drm_device *dev,
>>  			goto done;
>>  	}
>>  
>> -	for_each_plane_in_state(state, plane, plane_state, i) {
>> -		struct nv50_wndw_atom *asyw = nv50_wndw_atom(plane_state);
>> +	for_each_old_plane_in_state(state, plane, old_plane_state, i) {
>> +		struct nv50_wndw_atom *asyw = nv50_wndw_atom(old_plane_state);
>>  		struct nv50_wndw *wndw = nv50_wndw(plane);
>>  		if (asyw->set.image) {
>>  			asyw->ntfy.handle = wndw->dmac->sync.handle;
>> @@ -4185,18 +4185,19 @@ nv50_disp_outp_atomic_add(struct nv50_atom *atom, struct drm_encoder *encoder)
>>  
>>  static int
>>  nv50_disp_outp_atomic_check_clr(struct nv50_atom *atom,
>> -				struct drm_connector *connector)
>> +				struct drm_connector_state *old_connector_state)
>>  {
>> -	struct drm_encoder *encoder = connector->state->best_encoder;
>> -	struct drm_crtc_state *crtc_state;
>> +	struct drm_encoder *encoder = old_connector_state->best_encoder;
>> +	struct drm_crtc_state *old_crtc_state, *new_crtc_state;
>>  	struct drm_crtc *crtc;
>>  	struct nv50_outp_atom *outp;
>>  
>> -	if (!(crtc = connector->state->crtc))
>> +	if (!(crtc = old_connector_state->crtc))
>>  		return 0;
>>  
>> -	crtc_state = drm_atomic_get_existing_crtc_state(&atom->state, crtc);
>> -	if (crtc->state->active && drm_atomic_crtc_needs_modeset(crtc_state)) {
>> +	old_crtc_state = drm_atomic_get_new_crtc_state(&atom->state, crtc);
>> +	new_crtc_state = drm_atomic_get_new_crtc_state(&atom->state, crtc);
> I think you have a mixup here of the crtc states for old and new crtc,
> both are get_new_crtc_state.
Ah indeed, thanks for catching. :)
> Otherwise lgtm.
> -Daniel
>
>> +	if (old_crtc_state->active && drm_atomic_crtc_needs_modeset(new_crtc_state)) {
>>  		outp = nv50_disp_outp_atomic_add(atom, encoder);
>>  		if (IS_ERR(outp))
>>  			return PTR_ERR(outp);
>> @@ -4217,15 +4218,15 @@ nv50_disp_outp_atomic_check_set(struct nv50_atom *atom,
>>  				struct drm_connector_state *connector_state)
>>  {
>>  	struct drm_encoder *encoder = connector_state->best_encoder;
>> -	struct drm_crtc_state *crtc_state;
>> +	struct drm_crtc_state *new_crtc_state;
>>  	struct drm_crtc *crtc;
>>  	struct nv50_outp_atom *outp;
>>  
>>  	if (!(crtc = connector_state->crtc))
>>  		return 0;
>>  
>> -	crtc_state = drm_atomic_get_existing_crtc_state(&atom->state, crtc);
>> -	if (crtc_state->active && drm_atomic_crtc_needs_modeset(crtc_state)) {
>> +	new_crtc_state = drm_atomic_get_new_crtc_state(&atom->state, crtc);
>> +	if (new_crtc_state->active && drm_atomic_crtc_needs_modeset(new_crtc_state)) {
>>  		outp = nv50_disp_outp_atomic_add(atom, encoder);
>>  		if (IS_ERR(outp))
>>  			return PTR_ERR(outp);
>> @@ -4241,7 +4242,7 @@ static int
>>  nv50_disp_atomic_check(struct drm_device *dev, struct drm_atomic_state *state)
>>  {
>>  	struct nv50_atom *atom = nv50_atom(state);
>> -	struct drm_connector_state *connector_state;
>> +	struct drm_connector_state *old_connector_state, *new_connector_state;
>>  	struct drm_connector *connector;
>>  	int ret, i;
>>  
>> @@ -4249,12 +4250,12 @@ nv50_disp_atomic_check(struct drm_device *dev, struct drm_atomic_state *state)
>>  	if (ret)
>>  		return ret;
>>  
>> -	for_each_connector_in_state(state, connector, connector_state, i) {
>> -		ret = nv50_disp_outp_atomic_check_clr(atom, connector);
>> +	for_each_oldnew_connector_in_state(state, connector, old_connector_state, new_connector_state, i) {
>> +		ret = nv50_disp_outp_atomic_check_clr(atom, old_connector_state);
>>  		if (ret)
>>  			return ret;
>>  
>> -		ret = nv50_disp_outp_atomic_check_set(atom, connector_state);
>> +		ret = nv50_disp_outp_atomic_check_set(atom, new_connector_state);
>>  		if (ret)
>>  			return ret;
>>  	}
>> -- 
>> 2.11.0
>>
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/intel-gfx


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

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

* Re: [PATCH 13/16] drm/mediatek: Convert to new iterator macros
  2017-07-12  9:45     ` Daniel Vetter
@ 2017-07-13 16:00       ` Maarten Lankhorst
  -1 siblings, 0 replies; 59+ messages in thread
From: Maarten Lankhorst @ 2017-07-13 16:00 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Matthias Brugger, intel-gfx, linux-mediatek, linux-arm-kernel, dri-devel

Op 12-07-17 om 11:45 schreef Daniel Vetter:
> On Wed, Jul 12, 2017 at 10:13:41AM +0200, Maarten Lankhorst wrote:
>> for_each_obj_in_state is about to be removed, so use the new atomic
>> iterator macros.
>>
>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>> Cc: CK Hu <ck.hu@mediatek.com>
>> Cc: Philipp Zabel <p.zabel@pengutronix.de>
>> Cc: Matthias Brugger <matthias.bgg@gmail.com>
>> Cc: linux-arm-kernel@lists.infradead.org
>> Cc: linux-mediatek@lists.infradead.org
>> ---
>>  drivers/gpu/drm/mediatek/mtk_drm_drv.c | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
>> index 56f802d0a51c..be0741638f94 100644
>> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
>> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
>> @@ -48,11 +48,11 @@ static void mtk_atomic_schedule(struct mtk_drm_private *private,
>>  static void mtk_atomic_wait_for_fences(struct drm_atomic_state *state)
>>  {
>>  	struct drm_plane *plane;
>> -	struct drm_plane_state *plane_state;
>> +	struct drm_plane_state *new_plane_state;
>>  	int i;
>>  
>> -	for_each_plane_in_state(state, plane, plane_state, i)
>> -		mtk_fb_wait(plane->state->fb);
>> +	for_each_new_plane_in_state(state, plane, new_plane_state, i)
>> +		mtk_fb_wait(new_plane_state->fb);
>>  }
> I think a variant of drm_atomic_set_fence_for_plane, which takes a
> reservation obj (or a dma-buf and then derefs dma_buf->resv itself) would
> be nice, so that drivers don't have to hand-roll sub-par fence waiting
> code like this (it's e.g. not interruptible for blocking commits).
>
> Anyway, patch itself looks good.
>
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>

Thanks.

Pushed patch 1-3, 4 (first hunk only), 5 (with static fix), 6, 8, 9, 11-13.

Still hoping for ack from driver maintainers on patch 7 (v2), 10, 14 (v2) and 15 (with the fix daniel spotted).

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

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

* [PATCH 13/16] drm/mediatek: Convert to new iterator macros
@ 2017-07-13 16:00       ` Maarten Lankhorst
  0 siblings, 0 replies; 59+ messages in thread
From: Maarten Lankhorst @ 2017-07-13 16:00 UTC (permalink / raw)
  To: linux-arm-kernel

Op 12-07-17 om 11:45 schreef Daniel Vetter:
> On Wed, Jul 12, 2017 at 10:13:41AM +0200, Maarten Lankhorst wrote:
>> for_each_obj_in_state is about to be removed, so use the new atomic
>> iterator macros.
>>
>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>> Cc: CK Hu <ck.hu@mediatek.com>
>> Cc: Philipp Zabel <p.zabel@pengutronix.de>
>> Cc: Matthias Brugger <matthias.bgg@gmail.com>
>> Cc: linux-arm-kernel at lists.infradead.org
>> Cc: linux-mediatek at lists.infradead.org
>> ---
>>  drivers/gpu/drm/mediatek/mtk_drm_drv.c | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
>> index 56f802d0a51c..be0741638f94 100644
>> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
>> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
>> @@ -48,11 +48,11 @@ static void mtk_atomic_schedule(struct mtk_drm_private *private,
>>  static void mtk_atomic_wait_for_fences(struct drm_atomic_state *state)
>>  {
>>  	struct drm_plane *plane;
>> -	struct drm_plane_state *plane_state;
>> +	struct drm_plane_state *new_plane_state;
>>  	int i;
>>  
>> -	for_each_plane_in_state(state, plane, plane_state, i)
>> -		mtk_fb_wait(plane->state->fb);
>> +	for_each_new_plane_in_state(state, plane, new_plane_state, i)
>> +		mtk_fb_wait(new_plane_state->fb);
>>  }
> I think a variant of drm_atomic_set_fence_for_plane, which takes a
> reservation obj (or a dma-buf and then derefs dma_buf->resv itself) would
> be nice, so that drivers don't have to hand-roll sub-par fence waiting
> code like this (it's e.g. not interruptible for blocking commits).
>
> Anyway, patch itself looks good.
>
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>

Thanks.

Pushed patch 1-3, 4 (first hunk only), 5 (with static fix), 6, 8, 9, 11-13.

Still hoping for ack from driver maintainers on patch 7 (v2), 10, 14 (v2) and 15 (with the fix daniel spotted).

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

* Re: [PATCH 14/16] drm/msm: Convert to use new iterator macros, v2.
       [not found]           ` <de5e7892-71a0-d160-6619-e8267d793897-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
@ 2017-07-19  9:25             ` Archit Taneja
  0 siblings, 0 replies; 59+ messages in thread
From: Archit Taneja @ 2017-07-19  9:25 UTC (permalink / raw)
  To: Maarten Lankhorst, Daniel Vetter
  Cc: Rob Herring, linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	Sushmita Susheelendra, Russell King, Vincent Abriou,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Markus Elfring



On 07/12/2017 04:15 PM, Maarten Lankhorst wrote:
> Op 12-07-17 om 11:48 schreef Daniel Vetter:
>> On Wed, Jul 12, 2017 at 10:13:42AM +0200, Maarten Lankhorst wrote:
>>> for_each_obj_in_state is about to be removed, so convert
>>> to the new iterator macros.
>>>
>>> Just like in omap, use crtc_state->active instead of
>>> crtc_state->enable when waiting for completion.

Tested-by: Archit Taneja <architt@codeaurora.org>

>>>
>>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>>> Cc: Rob Clark <robdclark@gmail.com>
>>> Cc: Archit Taneja <architt@codeaurora.org>
>>> Cc: Vincent Abriou <vincent.abriou@st.com>
>>> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>>> Cc: Russell King <rmk+kernel@armlinux.org.uk>
>>> Cc: Rob Herring <robh@kernel.org>
>>> Cc: Markus Elfring <elfring@users.sourceforge.net>
>>> Cc: Sushmita Susheelendra <ssusheel@codeaurora.org>
>>> Cc: linux-arm-msm@vger.kernel.org
>>> Cc: freedreno@lists.freedesktop.org
>>> ---
>>>   drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c |  4 ++--
>>>   drivers/gpu/drm/msm/msm_atomic.c        | 16 ++++++++--------
>>>   2 files changed, 10 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
>>> index bcd1f5cac72c..f7f087419ed8 100644
>>> --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
>>> +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
>>> @@ -114,7 +114,7 @@ static void mdp4_prepare_commit(struct msm_kms *kms, struct drm_atomic_state *st
>>>   	mdp4_enable(mdp4_kms);
>>>   
>>>   	/* see 119ecb7fd */
>>> -	for_each_crtc_in_state(state, crtc, crtc_state, i)
>>> +	for_each_new_crtc_in_state(state, crtc, crtc_state, i)
>>>   		drm_crtc_vblank_get(crtc);
>>>   }
>>>   
>>> @@ -126,7 +126,7 @@ static void mdp4_complete_commit(struct msm_kms *kms, struct drm_atomic_state *s
>>>   	struct drm_crtc_state *crtc_state;
>>>   
>>>   	/* see 119ecb7fd */
>>> -	for_each_crtc_in_state(state, crtc, crtc_state, i)
>>> +	for_each_new_crtc_in_state(state, crtc, crtc_state, i)
>>>   		drm_crtc_vblank_put(crtc);
>>>   
>>>   	mdp4_disable(mdp4_kms);
>>> diff --git a/drivers/gpu/drm/msm/msm_atomic.c b/drivers/gpu/drm/msm/msm_atomic.c
>>> index 9633a68b14d7..9d3cc1f5e31a 100644
>>> --- a/drivers/gpu/drm/msm/msm_atomic.c
>>> +++ b/drivers/gpu/drm/msm/msm_atomic.c
>>> @@ -84,13 +84,13 @@ static void msm_atomic_wait_for_commit_done(struct drm_device *dev,
>>>   		struct drm_atomic_state *old_state)
>>>   {
>>>   	struct drm_crtc *crtc;
>>> -	struct drm_crtc_state *crtc_state;
>>> +	struct drm_crtc_state *new_crtc_state;
>>>   	struct msm_drm_private *priv = old_state->dev->dev_private;
>>>   	struct msm_kms *kms = priv->kms;
>>>   	int i;
>>>   
>>> -	for_each_crtc_in_state(old_state, crtc, crtc_state, i) {
>>> -		if (!crtc->state->enable)
>>> +	for_each_new_crtc_in_state(old_state, crtc, new_crtc_state, i) {
>>> +		if (!new_crtc_state->active)
>>>   			continue;
>>>   
>>>   		kms->funcs->wait_for_crtc_commit_done(kms, crtc);
>>> @@ -195,7 +195,7 @@ int msm_atomic_commit(struct drm_device *dev,
>>>   	struct drm_crtc *crtc;
>>>   	struct drm_crtc_state *crtc_state;
>>>   	struct drm_plane *plane;
>>> -	struct drm_plane_state *plane_state;
>>> +	struct drm_plane_state *old_plane_state, *new_plane_state;
>>>   	int i, ret;
>>>   
>>>   	ret = drm_atomic_helper_prepare_planes(dev, state);
>>> @@ -211,15 +211,15 @@ int msm_atomic_commit(struct drm_device *dev,
>>>   	/*
>>>   	 * Figure out what crtcs we have:
>>>   	 */
>>> -	for_each_crtc_in_state(state, crtc, crtc_state, i)
>>> +	for_each_new_crtc_in_state(state, crtc, crtc_state, i)
>>>   		c->crtc_mask |= drm_crtc_mask(crtc);
>>>   
>>>   	/*
>>>   	 * Figure out what fence to wait for:
>>>   	 */
>>> -	for_each_plane_in_state(state, plane, plane_state, i) {
>>> -		if ((plane->state->fb != plane_state->fb) && plane_state->fb) {
>>> -			struct drm_gem_object *obj = msm_framebuffer_bo(plane_state->fb, 0);
>>> +	for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) {
>>> +		if ((new_plane_state->fb != old_plane_state->fb) && new_plane_state->fb) {
>>> +			struct drm_gem_object *obj = msm_framebuffer_bo(new_plane_state->fb, 0);
>>>   			struct msm_gem_object *msm_obj = to_msm_bo(obj);
>>>   			struct dma_fence *fence = reservation_object_get_excl_rcu(msm_obj->resv);
>> Pretty sure this fails to compile, you've forgotten to do one more
>> s/plane_state/new_plane_state/.
>>
>> With that fixed:
>>
>> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
> --->8---
> for_each_obj_in_state is about to be removed, so convert
> to the new iterator macros.
> 
> Just like in omap, use crtc_state->active instead of
> crtc_state->enable when waiting for completion.
> 
> Changes since v1:
> - Fix compilation.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Rob Clark <robdclark@gmail.com>
> Cc: Archit Taneja <architt@codeaurora.org>
> Cc: Vincent Abriou <vincent.abriou@st.com>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Russell King <rmk+kernel@armlinux.org.uk>
> Cc: Rob Herring <robh@kernel.org>
> Cc: Markus Elfring <elfring@users.sourceforge.net>
> Cc: Sushmita Susheelendra <ssusheel@codeaurora.org>
> Cc: linux-arm-msm@vger.kernel.org
> Cc: freedreno@lists.freedesktop.org
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>   drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c |  4 ++--
>   drivers/gpu/drm/msm/msm_atomic.c        | 18 +++++++++---------
>   2 files changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
> index bcd1f5cac72c..f7f087419ed8 100644
> --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
> +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
> @@ -114,7 +114,7 @@ static void mdp4_prepare_commit(struct msm_kms *kms, struct drm_atomic_state *st
>   	mdp4_enable(mdp4_kms);
>   
>   	/* see 119ecb7fd */
> -	for_each_crtc_in_state(state, crtc, crtc_state, i)
> +	for_each_new_crtc_in_state(state, crtc, crtc_state, i)
>   		drm_crtc_vblank_get(crtc);
>   }
>   
> @@ -126,7 +126,7 @@ static void mdp4_complete_commit(struct msm_kms *kms, struct drm_atomic_state *s
>   	struct drm_crtc_state *crtc_state;
>   
>   	/* see 119ecb7fd */
> -	for_each_crtc_in_state(state, crtc, crtc_state, i)
> +	for_each_new_crtc_in_state(state, crtc, crtc_state, i)
>   		drm_crtc_vblank_put(crtc);
>   
>   	mdp4_disable(mdp4_kms);
> diff --git a/drivers/gpu/drm/msm/msm_atomic.c b/drivers/gpu/drm/msm/msm_atomic.c
> index 9633a68b14d7..2728794a7142 100644
> --- a/drivers/gpu/drm/msm/msm_atomic.c
> +++ b/drivers/gpu/drm/msm/msm_atomic.c
> @@ -84,13 +84,13 @@ static void msm_atomic_wait_for_commit_done(struct drm_device *dev,
>   		struct drm_atomic_state *old_state)
>   {
>   	struct drm_crtc *crtc;
> -	struct drm_crtc_state *crtc_state;
> +	struct drm_crtc_state *new_crtc_state;
>   	struct msm_drm_private *priv = old_state->dev->dev_private;
>   	struct msm_kms *kms = priv->kms;
>   	int i;
>   
> -	for_each_crtc_in_state(old_state, crtc, crtc_state, i) {
> -		if (!crtc->state->enable)
> +	for_each_new_crtc_in_state(old_state, crtc, new_crtc_state, i) {
> +		if (!new_crtc_state->active)
>   			continue;
>   
>   		kms->funcs->wait_for_crtc_commit_done(kms, crtc);
> @@ -195,7 +195,7 @@ int msm_atomic_commit(struct drm_device *dev,
>   	struct drm_crtc *crtc;
>   	struct drm_crtc_state *crtc_state;
>   	struct drm_plane *plane;
> -	struct drm_plane_state *plane_state;
> +	struct drm_plane_state *old_plane_state, *new_plane_state;
>   	int i, ret;
>   
>   	ret = drm_atomic_helper_prepare_planes(dev, state);
> @@ -211,19 +211,19 @@ int msm_atomic_commit(struct drm_device *dev,
>   	/*
>   	 * Figure out what crtcs we have:
>   	 */
> -	for_each_crtc_in_state(state, crtc, crtc_state, i)
> +	for_each_new_crtc_in_state(state, crtc, crtc_state, i)
>   		c->crtc_mask |= drm_crtc_mask(crtc);
>   
>   	/*
>   	 * Figure out what fence to wait for:
>   	 */
> -	for_each_plane_in_state(state, plane, plane_state, i) {
> -		if ((plane->state->fb != plane_state->fb) && plane_state->fb) {
> -			struct drm_gem_object *obj = msm_framebuffer_bo(plane_state->fb, 0);
> +	for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) {
> +		if ((new_plane_state->fb != old_plane_state->fb) && new_plane_state->fb) {
> +			struct drm_gem_object *obj = msm_framebuffer_bo(new_plane_state->fb, 0);
>   			struct msm_gem_object *msm_obj = to_msm_bo(obj);
>   			struct dma_fence *fence = reservation_object_get_excl_rcu(msm_obj->resv);
>   
> -			drm_atomic_set_fence_for_plane(plane_state, fence);
> +			drm_atomic_set_fence_for_plane(new_plane_state, fence);
>   		}
>   	}
>   
> 

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

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

end of thread, other threads:[~2017-07-19  9:25 UTC | newest]

Thread overview: 59+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-12  8:13 [PATCH 00/16] drm/atomic: Remove deprecated atomic iterator macros Maarten Lankhorst
2017-07-12  8:13 ` [PATCH 01/16] drm/simple-kms-helper: Fix the check for the mismatch between plane and CRTC enabled Maarten Lankhorst
2017-07-12  9:01   ` Daniel Vetter
2017-07-12  8:13 ` [PATCH 02/16] drm/atomic: Use the correct iterator macro in atomic_remove_fb Maarten Lankhorst
2017-07-12  9:01   ` Daniel Vetter
2017-07-12  8:13 ` [PATCH 03/16] drm/atomic: Use the new helpers in drm_atomic_helper_disable_all() Maarten Lankhorst
2017-07-12  9:03   ` Daniel Vetter
2017-07-12  8:13 ` [PATCH 04/16] drm/atomic: Use new iterator macros in drm_atomic_helper_wait_for_flip_done Maarten Lankhorst
2017-07-12  9:07   ` [Intel-gfx] " Daniel Vetter
2017-07-12  8:13 ` [PATCH 05/16] drm/vmwgfx: Make check_modeset() use the new atomic iterator macros Maarten Lankhorst
2017-07-12  8:33   ` Sinclair Yeh
2017-07-12  9:09   ` [Intel-gfx] " Daniel Vetter
2017-07-12  9:11     ` Sinclair Yeh
2017-07-12  8:13 ` [PATCH 06/16] drm/i915: Use correct iterator macro Maarten Lankhorst
2017-07-12  9:10   ` Daniel Vetter
2017-07-12  8:13 ` [PATCH 07/16] drm/rcar-du: Use new iterator macros Maarten Lankhorst
2017-07-12  8:13   ` Maarten Lankhorst
2017-07-12  9:15   ` Daniel Vetter
2017-07-12  9:15     ` Daniel Vetter
2017-07-12 10:43     ` [PATCH v2 07/16] drm/rcar-du: Use new iterator macros, v2 Maarten Lankhorst
2017-07-12 10:43       ` Maarten Lankhorst
2017-07-12  8:13 ` [PATCH 08/16] drm/atmel-hlcdec: Use for_each_new_connector_in_state Maarten Lankhorst
2017-07-12  9:17   ` Daniel Vetter
2017-07-12  9:22   ` Boris Brezillon
2017-07-12  8:13 ` [PATCH 09/16] drm/rockchip: Use for_each_oldnew_plane_in_state in vop_crtc_atomic_flush Maarten Lankhorst
2017-07-12  8:13   ` Maarten Lankhorst
2017-07-12  9:21   ` Daniel Vetter
2017-07-12  9:21     ` Daniel Vetter
2017-07-12  9:41   ` Mark yao
2017-07-12  9:41     ` Mark yao
2017-07-12  8:13 ` [PATCH 10/16] drm/omapdrm: Fix omap_atomic_wait_for_completion Maarten Lankhorst
2017-07-12  9:23   ` Daniel Vetter
2017-07-12  8:13 ` [PATCH 11/16] drm/mali: Use new atomic iterator macros Maarten Lankhorst
2017-07-12  9:25   ` [Intel-gfx] " Daniel Vetter
2017-07-12  9:44   ` Liviu Dudau
2017-07-12 10:00     ` Maarten Lankhorst
2017-07-12 10:06       ` Liviu Dudau
2017-07-12  8:13 ` [PATCH 12/16] drm/imx: Use " Maarten Lankhorst
2017-07-12  9:26   ` Daniel Vetter
2017-07-12 10:00   ` Philipp Zabel
2017-07-12  8:13 ` [PATCH 13/16] drm/mediatek: Convert to new " Maarten Lankhorst
2017-07-12  8:13   ` Maarten Lankhorst
2017-07-12  9:45   ` Daniel Vetter
2017-07-12  9:45     ` Daniel Vetter
2017-07-13 16:00     ` Maarten Lankhorst
2017-07-13 16:00       ` Maarten Lankhorst
2017-07-12 10:01   ` Philipp Zabel
2017-07-12 10:01     ` Philipp Zabel
     [not found] ` <20170712081344.25495-1-maarten.lankhorst-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-07-12  8:13   ` [PATCH 14/16] drm/msm: Convert to use " Maarten Lankhorst
2017-07-12  9:48     ` [Intel-gfx] " Daniel Vetter
     [not found]       ` <20170712094823.2akjrev3v7ckxb7b-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2017-07-12 10:45         ` [PATCH 14/16] drm/msm: Convert to use new iterator macros, v2 Maarten Lankhorst
     [not found]           ` <de5e7892-71a0-d160-6619-e8267d793897-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-07-19  9:25             ` Archit Taneja
2017-07-12  8:13 ` [PATCH 15/16] drm/nouveau: Convert nouveau to use new iterator macros Maarten Lankhorst
2017-07-13 12:33   ` [Intel-gfx] " Daniel Vetter
2017-07-13 13:51     ` Maarten Lankhorst
2017-07-12  8:13 ` [PATCH 16/16] drm/atomic: Remove deprecated accessor macros Maarten Lankhorst
2017-07-12  9:50   ` Daniel Vetter
2017-07-12 11:48     ` Maarten Lankhorst
2017-07-12  8:33 ` ✓ Fi.CI.BAT: success for drm/atomic: Remove deprecated atomic iterator macros Patchwork

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.