With the old users of for_each_obj_in_state gone, we can rename for_each_oldnew_obj_in_state back to that name. It's slightly less ugly. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx> --- drivers/gpu/drm/drm_atomic_helper.c | 34 ++++++++++++++--------------- drivers/gpu/drm/drm_blend.c | 4 ++-- drivers/gpu/drm/i915/intel_display.c | 16 +++++++------- drivers/gpu/drm/imx/imx-drm-core.c | 2 +- drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | 2 +- drivers/gpu/drm/msm/msm_atomic.c | 2 +- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 2 +- drivers/gpu/drm/vc4/vc4_kms.c | 2 +- include/drm/drm_atomic.h | 30 +++---------------------- 9 files changed, 35 insertions(+), 59 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index c8aba493fc17..8fb955181641 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -241,7 +241,7 @@ steal_encoder(struct drm_atomic_state *state, struct drm_connector_state *old_connector_state, *new_connector_state; int i; - for_each_oldnew_connector_in_state(state, connector, old_connector_state, new_connector_state, i) { + for_each_connector_in_state(state, connector, old_connector_state, new_connector_state, i) { struct drm_crtc *encoder_crtc; if (new_connector_state->best_encoder != encoder) @@ -482,7 +482,7 @@ drm_atomic_helper_check_modeset(struct drm_device *dev, struct drm_connector_state *old_connector_state, *new_connector_state; int i, ret; - for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { + for_each_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { if (!drm_mode_equal(&old_crtc_state->mode, &new_crtc_state->mode)) { DRM_DEBUG_ATOMIC("[CRTC:%d:%s] mode changed\n", crtc->base.id, crtc->name); @@ -510,7 +510,7 @@ drm_atomic_helper_check_modeset(struct drm_device *dev, if (ret) return ret; - for_each_oldnew_connector_in_state(state, connector, old_connector_state, new_connector_state, i) { + for_each_connector_in_state(state, connector, old_connector_state, new_connector_state, i) { /* * This only sets crtc->connectors_changed for routing changes, * drivers must set crtc->connectors_changed themselves when @@ -529,7 +529,7 @@ drm_atomic_helper_check_modeset(struct drm_device *dev, * configuration. This must be done before calling mode_fixup in case a * crtc only changed its mode but has the same set of connectors. */ - for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { + for_each_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { bool has_connectors = !!new_crtc_state->connector_mask; @@ -685,7 +685,7 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state) struct drm_crtc_state *old_crtc_state, *new_crtc_state; int i; - for_each_oldnew_connector_in_state(old_state, connector, old_conn_state, new_conn_state, i) { + for_each_connector_in_state(old_state, connector, old_conn_state, new_conn_state, i) { const struct drm_encoder_helper_funcs *funcs; struct drm_encoder *encoder; @@ -733,7 +733,7 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state) drm_bridge_post_disable(encoder->bridge); } - for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state, new_crtc_state, i) { + for_each_crtc_in_state(old_state, crtc, old_crtc_state, new_crtc_state, i) { const struct drm_crtc_helper_funcs *funcs; /* Shut down everything that needs a full modeset. */ @@ -785,7 +785,7 @@ drm_atomic_helper_update_legacy_modeset_state(struct drm_device *dev, int i; /* clear out existing links and update dpms */ - for_each_oldnew_connector_in_state(old_state, connector, old_conn_state, new_conn_state, i) { + for_each_connector_in_state(old_state, connector, old_conn_state, new_conn_state, i) { if (connector->encoder) { WARN_ON(!connector->encoder->crtc); @@ -1074,7 +1074,7 @@ bool drm_atomic_helper_framebuffer_changed(struct drm_device *dev, struct drm_plane_state *old_plane_state, *new_plane_state; int i; - for_each_oldnew_plane_in_state(old_state, plane, old_plane_state, new_plane_state, i) { + for_each_plane_in_state(old_state, plane, old_plane_state, new_plane_state, i) { if (new_plane_state->crtc != crtc && old_plane_state->crtc != crtc) continue; @@ -1111,7 +1111,7 @@ drm_atomic_helper_wait_for_vblanks(struct drm_device *dev, if (old_state->legacy_cursor_update) return; - for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state, new_crtc_state, i) { + for_each_crtc_in_state(old_state, crtc, old_crtc_state, new_crtc_state, i) { /* No one cares about the old state, so abuse it for tracking * and store whether we hold a vblank reference (and should do a * vblank wait) in the ->enable boolean. */ @@ -1435,7 +1435,7 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state, struct drm_crtc_commit *commit; int i, ret; - for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, crtc_state, i) { + for_each_crtc_in_state(state, crtc, old_crtc_state, crtc_state, i) { commit = kzalloc(sizeof(*commit), GFP_KERNEL); if (!commit) return -ENOMEM; @@ -1752,7 +1752,7 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev, bool active_only = flags & DRM_PLANE_COMMIT_ACTIVE_ONLY; bool no_disable = flags & DRM_PLANE_COMMIT_NO_DISABLE_AFTER_MODESET; - for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state, new_crtc_state, i) { + for_each_crtc_in_state(old_state, crtc, old_crtc_state, new_crtc_state, i) { const struct drm_crtc_helper_funcs *funcs; funcs = crtc->helper_private; @@ -1766,7 +1766,7 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev, funcs->atomic_begin(crtc, old_crtc_state); } - for_each_oldnew_plane_in_state(old_state, plane, old_plane_state, new_plane_state, i) { + for_each_plane_in_state(old_state, plane, old_plane_state, new_plane_state, i) { const struct drm_plane_helper_funcs *funcs; bool disabling; @@ -1809,7 +1809,7 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev, } } - for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state, new_crtc_state, i) { + for_each_crtc_in_state(old_state, crtc, old_crtc_state, new_crtc_state, i) { const struct drm_crtc_helper_funcs *funcs; funcs = crtc->helper_private; @@ -1947,7 +1947,7 @@ void drm_atomic_helper_cleanup_planes(struct drm_device *dev, struct drm_plane_state *plane_state, *new_plane_state; int i; - for_each_oldnew_plane_in_state(old_state, plane, plane_state, new_plane_state, i) { + for_each_plane_in_state(old_state, plane, plane_state, new_plane_state, i) { const struct drm_plane_helper_funcs *funcs; /* @@ -2032,7 +2032,7 @@ void drm_atomic_helper_swap_state(struct drm_atomic_state *state, } } - for_each_oldnew_connector_in_state(state, connector, old_conn_state, new_conn_state, i) { + for_each_connector_in_state(state, connector, old_conn_state, new_conn_state, i) { old_conn_state->state = state; new_conn_state->state = NULL; @@ -2040,7 +2040,7 @@ void drm_atomic_helper_swap_state(struct drm_atomic_state *state, connector->state = new_conn_state; } - for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { + for_each_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { old_crtc_state->state = state; new_crtc_state->state = NULL; @@ -2057,7 +2057,7 @@ void drm_atomic_helper_swap_state(struct drm_atomic_state *state, } } - for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) { + for_each_plane_in_state(state, plane, old_plane_state, new_plane_state, i) { old_plane_state->state = state; new_plane_state->state = NULL; diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c index 70c03eb032fc..ed8e366f1c02 100644 --- a/drivers/gpu/drm/drm_blend.c +++ b/drivers/gpu/drm/drm_blend.c @@ -372,7 +372,7 @@ int drm_atomic_normalize_zpos(struct drm_device *dev, struct drm_plane_state *old_plane_state, *new_plane_state; int i, ret = 0; - for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) { + for_each_plane_in_state(state, plane, old_plane_state, new_plane_state, i) { crtc = new_plane_state->crtc; if (!crtc) continue; @@ -383,7 +383,7 @@ int drm_atomic_normalize_zpos(struct drm_device *dev, } } - for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { + for_each_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { if (old_crtc_state->plane_mask != new_crtc_state->plane_mask || new_crtc_state->zpos_changed) { ret = drm_atomic_helper_crtc_normalize_zpos(crtc, diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index d310abace86a..bac0fc342f8d 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -13760,7 +13760,7 @@ static void intel_modeset_clear_plls(struct drm_atomic_state *state) if (!dev_priv->display.crtc_compute_clock) return; - for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { + for_each_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { struct intel_crtc *intel_crtc = to_intel_crtc(crtc); struct intel_shared_dpll *old_dpll = to_intel_crtc_state(old_crtc_state)->shared_dpll; @@ -13890,7 +13890,7 @@ static int intel_modeset_checks(struct drm_atomic_state *state) intel_state->modeset = true; intel_state->active_crtcs = dev_priv->active_crtcs; - for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { + for_each_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { if (new_crtc_state->active) intel_state->active_crtcs |= 1 << i; else @@ -13973,7 +13973,7 @@ static int intel_atomic_check(struct drm_device *dev, if (ret) return ret; - for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, crtc_state, i) { + for_each_crtc_in_state(state, crtc, old_crtc_state, crtc_state, i) { struct intel_crtc_state *pipe_config = to_intel_crtc_state(crtc_state); @@ -14208,7 +14208,7 @@ static void intel_update_crtcs(struct drm_atomic_state *state, struct drm_crtc_state *old_crtc_state, *new_crtc_state; int i; - for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { + for_each_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { if (!new_crtc_state->active) continue; @@ -14241,7 +14241,7 @@ static void skl_update_crtcs(struct drm_atomic_state *state, int i; progress = false; - for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { + for_each_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { bool vbl_wait = false; unsigned int cmask = drm_crtc_mask(crtc); pipe = to_intel_crtc(crtc)->pipe; @@ -14316,7 +14316,7 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state) intel_display_power_get(dev_priv, POWER_DOMAIN_MODESET); } - for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { + for_each_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { struct intel_crtc *intel_crtc = to_intel_crtc(crtc); if (needs_modeset(new_crtc_state) || @@ -14418,7 +14418,7 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state) dev_priv->display.optimize_watermarks(intel_cstate); } - for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { + for_each_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { intel_post_plane_update(to_intel_crtc_state(old_crtc_state)); if (put_domains[i]) @@ -14472,7 +14472,7 @@ static void intel_atomic_track_fbs(struct drm_atomic_state *state) struct drm_plane *plane; int i; - for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) + for_each_plane_in_state(state, plane, old_plane_state, new_plane_state, i) i915_gem_track_fb(intel_fb_obj(old_plane_state->fb), intel_fb_obj(new_plane_state->fb), to_intel_plane(plane)->frontbuffer_bit); diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c index d484af773460..48be1483b263 100644 --- a/drivers/gpu/drm/imx/imx-drm-core.c +++ b/drivers/gpu/drm/imx/imx-drm-core.c @@ -164,7 +164,7 @@ static int imx_drm_atomic_commit(struct drm_device *dev, * If the plane fb has an dma-buf attached, fish out the exclusive * fence for the atomic helper to wait on. */ - for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) { + for_each_plane_in_state(state, plane, old_plane_state, new_plane_state, i) { if ((old_plane_state->fb != new_plane_state->fb) && new_plane_state->fb) { dma_buf = drm_fb_cma_get_gem_obj(new_plane_state->fb, 0)->base.dma_buf; diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c index 7cfeb0455039..398e2e9a4135 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c @@ -84,7 +84,7 @@ static void mdp5_complete_commit(struct msm_kms *kms, struct drm_atomic_state *s struct drm_plane *plane; struct drm_plane_state *old_state, *new_state; - for_each_oldnew_plane_in_state(state, plane, old_state, new_state, i) + for_each_plane_in_state(state, plane, old_state, new_state, i) mdp5_plane_complete_commit(plane, old_state, new_state); mdp5_disable(mdp5_kms); diff --git a/drivers/gpu/drm/msm/msm_atomic.c b/drivers/gpu/drm/msm/msm_atomic.c index 333c379e6561..5508e3a2e4ef 100644 --- a/drivers/gpu/drm/msm/msm_atomic.c +++ b/drivers/gpu/drm/msm/msm_atomic.c @@ -213,7 +213,7 @@ int msm_atomic_commit(struct drm_device *dev, /* * Figure out what fence to wait for: */ - for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) { + for_each_plane_in_state(state, plane, old_plane_state, new_plane_state, i) { if (old_plane_state->fb != new_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); diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index 5c0625e5dca1..7a0806c24776 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -1040,7 +1040,7 @@ static void vop_crtc_atomic_flush(struct drm_crtc *crtc, } spin_unlock_irq(&crtc->dev->event_lock); - for_each_oldnew_plane_in_state(old_state, plane, old_plane_state, new_plane_state, i) { + for_each_plane_in_state(old_state, plane, old_plane_state, new_plane_state, i) { if (!old_plane_state->fb) continue; diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c index 76cc9b374215..d9329a918014 100644 --- a/drivers/gpu/drm/vc4/vc4_kms.c +++ b/drivers/gpu/drm/vc4/vc4_kms.c @@ -139,7 +139,7 @@ static int vc4_atomic_commit(struct drm_device *dev, return ret; } - for_each_oldnew_plane_in_state(state, plane, old_state, new_state, i) { + for_each_plane_in_state(state, plane, old_state, new_state, i) { if (old_state->fb != new_state->fb && new_state->fb) { struct drm_gem_cma_object *cma_bo = drm_fb_cma_get_gem_obj(new_state->fb, 0); diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h index 09fb6b316ca9..c02ea85de9ca 100644 --- a/include/drm/drm_atomic.h +++ b/include/drm/drm_atomic.h @@ -364,15 +364,7 @@ int __must_check drm_atomic_check_only(struct drm_atomic_state *state); int __must_check drm_atomic_commit(struct drm_atomic_state *state); int __must_check drm_atomic_nonblocking_commit(struct drm_atomic_state *state); -#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) - -#define for_each_oldnew_connector_in_state(__state, connector, old_connector_state, new_connector_state, __i) \ +#define for_each_connector_in_state(__state, connector, old_connector_state, new_connector_state, __i) \ for ((__i) = 0; \ (__i) < (__state)->num_connector && \ ((connector) = (__state)->connectors[__i].ptr, \ @@ -397,15 +389,7 @@ int __must_check drm_atomic_nonblocking_commit(struct drm_atomic_state *state); (__i)++) \ for_each_if (connector) -#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) - -#define for_each_oldnew_crtc_in_state(__state, crtc, old_crtc_state, new_crtc_state, __i) \ +#define for_each_crtc_in_state(__state, crtc, old_crtc_state, new_crtc_state, __i) \ for ((__i) = 0; \ (__i) < (__state)->dev->mode_config.num_crtc && \ ((crtc) = (__state)->crtcs[__i].ptr, \ @@ -430,15 +414,7 @@ int __must_check drm_atomic_nonblocking_commit(struct drm_atomic_state *state); (__i)++) \ for_each_if (crtc) -#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) - -#define for_each_oldnew_plane_in_state(__state, plane, old_plane_state, new_plane_state, __i) \ +#define for_each_plane_in_state(__state, plane, old_plane_state, new_plane_state, __i) \ for ((__i) = 0; \ (__i) < (__state)->dev->mode_config.num_total_plane && \ ((plane) = (__state)->planes[__i].ptr, \ -- 2.7.4 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx