drm/atomic: Use less confusing iterator names.
Subsystems (16)
Maarten Lankhorst
maintainercover drm/atomic: Use less confusing iterator names.
Add for_each_(old,new)_(crtc,connector,plane)_in_state iterators, and re-use for_each_*_in_state to be a iterator with the old and the new state.
This will be less confusing than the previous case, in which for_each_*_in_state could refer to the old or the new state.
The oldnew macro names are temporary in this series, until all drivers are converted to use the old, new or both states.
This series applies to the topic/drm-misc branch, and will probably conflict with a lot of other stuff. This is why I post this right after the merge window.
Compile tested on arm and tested for i915 on x86.
Maarten Lankhorst (19):
drm/atomic: Add new iterators over all state drm/atmel-hlcdc: Use new atomic iterator macros. drm/exynos: Use new atomic iterator macros. drm/blend: Use new atomic iterator macros. drm/atomic: Make add_affected_connectors look at crtc_state. drm/atomic: Use new atomic iterator macros. drm/atomic: Fix atomic helpers to use the new iterator macros. drm/vc4: Use new atomic iterator macros. drm/rockchip: Use new atomic iterator macros. drm/rcar-du: Use new atomic iterator macros. drm/omap: Use new atomic iterator macros
drm/msm: Use new atomic iterator macros
drm/imx: Use new atomic iterator macros drm/mediatek: Use new atomic iterator macros drm/i915: Use new atomic iterator macros in ddi drm/i915: Use new atomic iterator macros in fbc drm/i915: Use new atomic iterator macros in wm code drm/i915: Use new atomic iterator macros in display code drm/atomic: Rename atomic oldnew iterator
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 2 +- drivers/gpu/drm/drm_atomic.c | 27 +- drivers/gpu/drm/drm_atomic_helper.c | 354 ++++++++++++++----------- drivers/gpu/drm/drm_blend.c | 22 +- drivers/gpu/drm/exynos/exynos_drm_drv.c | 2 +- drivers/gpu/drm/i915/intel_ddi.c | 4 +- drivers/gpu/drm/i915/intel_display.c | 167 ++++++------ drivers/gpu/drm/i915/intel_drv.h | 2 - drivers/gpu/drm/i915/intel_fbc.c | 6 +- drivers/gpu/drm/i915/intel_pm.c | 12 +- drivers/gpu/drm/imx/imx-drm-core.c | 10 +- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 4 +- drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c | 4 +- drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | 6 +- drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h | 3 +- drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 4 +- drivers/gpu/drm/msm/msm_atomic.c | 16 +- drivers/gpu/drm/omapdrm/omap_drv.c | 8 +- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 2 +- drivers/gpu/drm/rcar-du/rcar_du_plane.c | 4 +- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 6 +- drivers/gpu/drm/vc4/vc4_kms.c | 6 +- include/drm/drm_atomic.h | 83 ++++-- include/drm/drm_atomic_helper.h | 3 + 24 files changed, 442 insertions(+), 315 deletions(-)
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Maarten Lankhorst
maintainerPATCH 1/19 drm/atomic: Add new iterators over all state
Add for_each_(old)(new)_(plane,connector,crtc)_in_state iterators to replace the old for_each_xxx_in_state ones. This is useful for >1 flip depth and getting rid of all xxx->state dereferences.
--- drivers/gpu/drm/drm_atomic.c | 6 +++ drivers/gpu/drm/drm_atomic_helper.c | 52 +++++++++++++++++++++-- drivers/gpu/drm/i915/intel_display.c | 11 ++--- include/drm/drm_atomic.h | 81 ++++++++++++++++++++++++++++++++++-- include/drm/drm_atomic_helper.h | 3 ++ 5 files changed, 142 insertions(+), 11 deletions(-)
drivers/gpu/drm/drm_atomic.c +6 -0
@@ -278,6 +278,8 @@ drm_atomic_get_crtc_state(struct drm_atomic_state *state,return ERR_PTR (-ENOMEM ); state->crtcs[index].state = crtc_state; + state->crtcs[index].old_state = crtc->state; + state->crtcs[index].new_state = crtc_state; state->crtcs[index].ptr = crtc; crtc_state->state = state;
@@ -640,6 +642,8 @@ drm_atomic_get_plane_state(struct drm_atomic_state *state, state->planes[index].state = plane_state; state->planes[index].ptr = plane; + state->planes[index].old_state = plane->state; + state->planes[index].new_state = plane_state; plane_state->state = state; DRM_DEBUG_ATOMIC("Added [PLANE:%d:%s] %p state to %p\n",
@@ -931,6 +935,8 @@ drm_atomic_get_connector_state(struct drm_atomic_state *state,drm_connector_reference (connector); state->connectors[index].state = connector_state; + state->connectors[index].old_state = connector->state; + state->connectors[index].new_state = connector_state; state->connectors[index].ptr = connector; connector_state->state = state;
drivers/gpu/drm/drm_atomic_helper.c +49 -3
71 lines not on this page · raw message
drivers/gpu/drm/i915/intel_display.c +6 -5
@@ -3497,7 +3497,8 @@ static void intel_update_primary_planes(struct drm_device *dev)static int __intel_display_resume (struct drm_device *dev, -struct drm_atomic_state *state) +struct drm_atomic_state *state, +struct drm_modeset_acquire_ctx *ctx) {struct drm_crtc_state *crtc_state;struct drm_crtc *crtc;
@@ -3521,7 +3522,7 @@ __intel_display_resume(struct drm_device *dev,/* ignore any reset values/BIOS leftovers in the WM registers */ to_intel_atomic_state (state)->skip_intermediate_wm = true; - ret =drm_atomic_commit (state); + ret =drm_atomic_helper_commit_duplicated_state (state, ctx, false);WARN_ON (ret == -EDEADLK );return ret;
@@ -3617,7 +3618,7 @@ void intel_finish_reset(struct drm_i915_private *dev_priv)*/ intel_update_primary_planes (dev); }else { - ret =__intel_display_resume (dev, state); + ret =__intel_display_resume (dev, state, ctx);if (ret)DRM_ERROR ("Restoring old state failed with %i\n" , ret); }
@@ -3636,7 +3637,7 @@ void intel_finish_reset(struct drm_i915_private *dev_priv) dev_priv->display.hpd_irq_setup (dev_priv);spin_unlock_irq (&dev_priv->irq_lock); - ret =__intel_display_resume (dev, state); + ret =__intel_display_resume (dev, state, ctx);if (ret)DRM_ERROR ("Restoring old state failed with %i\n" , ret);
@@ -16937,7 +16938,7 @@ void intel_display_resume(struct drm_device *dev) }if (!ret) - ret =__intel_display_resume (dev, state); + ret =__intel_display_resume (dev, state, &ctx);drm_modeset_drop_locks (&ctx);drm_modeset_acquire_fini (&ctx);
include/drm/drm_atomic.h +78 -3
114 lines not on this page · raw message
include/drm/drm_atomic_helper.h +3 -0
@@ -108,6 +108,9 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set,int drm_atomic_helper_disable_all (struct drm_device *dev,struct drm_modeset_acquire_ctx *ctx);struct drm_atomic_state *drm_atomic_helper_suspend (struct drm_device *dev); +int drm_atomic_helper_commit_duplicated_state (struct drm_atomic_state *state, +struct drm_modeset_acquire_ctx *ctx, +bool nonblock);int drm_atomic_helper_resume (struct drm_device *dev,struct drm_atomic_state *state);
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 01/19] drm/atomic: Add new iterators over all state
Quoted 59 lines · Maarten Lankhorst
Add for_each_(old)(new)_(plane,connector,crtc)_in_state iterators to replace the old
for_each_xxx_in_stateones. This is useful for >1 flip depth and getting rid of allxxx->statedereferences.Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 6 +++ drivers/gpu/drm/drm_atomic_helper.c | 52 +++++++++++++++++++++-- drivers/gpu/drm/i915/intel_display.c | 11 ++--- include/drm/drm_atomic.h | 81 ++++++++++++++++++++++++++++++++++-- include/drm/drm_atomic_helper.h | 3 ++ 5 files changed, 142 insertions(+), 11 deletions(-)drivers/gpu/drm/drm_atomic.c +6
-0@@ -278,6 +278,8 @@ drm_atomic_get_crtc_state(struct drm_atomic_state *state,return ERR_PTR (-ENOMEM ); state->crtcs[index].state = crtc_state; + state->crtcs[index].old_state = crtc->state; + state->crtcs[index].new_state = crtc_state; state->crtcs[index].ptr = crtc; crtc_state->state = state;@@ -640,6 +642,8 @@ drm_atomic_get_plane_state(struct drm_atomic_state *state, state->planes[index].state = plane_state; state->planes[index].ptr = plane; + state->planes[index].old_state = plane->state; + state->planes[index].new_state = plane_state; plane_state->state = state; DRM_DEBUG_ATOMIC("Added [PLANE:%d:%s] %p state to %p\n",@@ -931,6 +935,8 @@ drm_atomic_get_connector_state(struct drm_atomic_state *state,drm_connector_reference (connector); state->connectors[index].state = connector_state; + state->connectors[index].old_state = connector->state; + state->connectors[index].new_state = connector_state; state->connectors[index].ptr = connector; connector_state->state = state;drivers/gpu/drm/drm_atomic_helper.c +1
-1@@ -2495,7 +2495,7 @@ EXPORT_SYMBOL(drm_atomic_helper_disable_all);* * See also: * drm_atomic_helper_duplicate_state(), drm_atomic_helper_disable_all(), -* drm_atomic_helper_resume() +* drm_atomic_helper_resume(), drm_atomic_helper_commit_duplicated_state() */ struct drm_atomic_state *drm_atomic_helper_suspend (struct drm_device *dev) {@@ -2536,6 +2536,52 @@ unlock:EXPORT_SYMBOL (drm_atomic_helper_suspend);
drivers/gpu/drm/drm_atomic_helper.c unlock: · line 2546
Quoted 10 lines
drivers/gpu/drm/drm_atomic_helper.c +8
-0/** +* drm_atomic_helper_commit_duplicated_state - commit duplicated state +* @state: duplicated atomic state to commit +* @ctx: pointer to acquire_ctx to use for commit. +* @nonblock: commit the state non-blocking. +* +* The state returned by drm_atomic_helper_duplicate_state() and +* drm_atomic_helper_suspend() is partially invalid, and needs to +* be fixed up before commit.
So the old_state pointers are potentially invalid because whatever->state may have changed since we duplicated the state?
Quoted 246 lines
drivers/gpu/drm/drm_atomic_helper.c +40
-2+* +* Returns: +* 0 on success or a negative error code on failure. +* +* See also: +* drm_atomic_helper_suspend() +*/ +int drm_atomic_helper_commit_duplicated_state (struct drm_atomic_state *state, +struct drm_modeset_acquire_ctx *ctx, +bool nonblock) +{ +int i; +struct drm_plane *plane; +struct drm_plane_state *plane_state; +struct drm_connector *connector; +struct drm_connector_state *conn_state; +struct drm_crtc *crtc; +struct drm_crtc_state *crtc_state; + + state->acquire_ctx = ctx; + +for_each_new_plane_in_state (state, plane, plane_state, i) + state->planes[i].old_state = plane->state; + +for_each_new_crtc_in_state (state, crtc, crtc_state, i) + state->crtcs[i].old_state = crtc->state; + +for_each_new_connector_in_state (state, connector, conn_state, i) + state->connectors[i].old_state = connector->state; + +if (nonblock) +return drm_atomic_nonblocking_commit (state); +else +return drm_atomic_commit (state); +} +EXPORT_SYMBOL (drm_atomic_helper_commit_duplicated_state); + +/** * drm_atomic_helper_resume - subsystem-level resume helper * @dev: DRM device * @state: atomic state to resume to @@ -2558,9 +2604,9 @@ int drm_atomic_helper_resume(struct drm_device *dev,int err;drm_mode_config_reset (dev); +drm_modeset_lock_all (dev); - state->acquire_ctx = config->acquire_ctx; - err =drm_atomic_commit (state); + err =drm_atomic_helper_commit_duplicated_state (state, config->acquire_ctx, false);drm_modeset_unlock_all (dev);return err;drivers/gpu/drm/i915/intel_display.c +6
-5@@ -3497,7 +3497,8 @@ static void intel_update_primary_planes(struct drm_device *dev)static int __intel_display_resume (struct drm_device *dev, -struct drm_atomic_state *state) +struct drm_atomic_state *state, +struct drm_modeset_acquire_ctx *ctx) {struct drm_crtc_state *crtc_state;struct drm_crtc *crtc;@@ -3521,7 +3522,7 @@ __intel_display_resume(struct drm_device *dev,/* ignore any reset values/BIOS leftovers in the WM registers */ to_intel_atomic_state (state)->skip_intermediate_wm = true; - ret =drm_atomic_commit (state); + ret =drm_atomic_helper_commit_duplicated_state (state, ctx, false);WARN_ON (ret == -EDEADLK );return ret;@@ -3617,7 +3618,7 @@ void intel_finish_reset(struct drm_i915_private *dev_priv)*/ intel_update_primary_planes (dev); }else { - ret =__intel_display_resume (dev, state); + ret =__intel_display_resume (dev, state, ctx);if (ret)DRM_ERROR ("Restoring old state failed with %i\n" , ret); }@@ -3636,7 +3637,7 @@ void intel_finish_reset(struct drm_i915_private *dev_priv) dev_priv->display.hpd_irq_setup (dev_priv);spin_unlock_irq (&dev_priv->irq_lock); - ret =__intel_display_resume (dev, state); + ret =__intel_display_resume (dev, state, ctx);if (ret)DRM_ERROR ("Restoring old state failed with %i\n" , ret);@@ -16937,7 +16938,7 @@ void intel_display_resume(struct drm_device *dev) }if (!ret) - ret =__intel_display_resume (dev, state); + ret =__intel_display_resume (dev, state, &ctx);drm_modeset_drop_locks (&ctx);drm_modeset_acquire_fini (&ctx);include/drm/drm_atomic.h +78
-3@@ -137,18 +137,18 @@ struct drm_crtc_commit {struct __drm_planes_state {struct drm_plane *ptr; -struct drm_plane_state *state; +struct drm_plane_state *state, *old_state, *new_state; };struct __drm_crtcs_state {struct drm_crtc *ptr; -struct drm_crtc_state *state; +struct drm_crtc_state *state, *old_state, *new_state;struct drm_crtc_commit *commit; };struct __drm_connnectors_state {struct drm_connector *ptr; -struct drm_connector_state *state; +struct drm_connector_state *state, *old_state, *new_state; };/** @@ -372,6 +372,31 @@ int __must_check drm_atomic_nonblocking_commit(struct drm_atomic_state *state); (__i)++) \ for_each_if (connector) +#define for_each_oldnew_connector_in_state (__state, connector, old_connector_state, new_connector_state, __i) \ + for ((__i) = 0; \ + (__i) < (__state)->num_connector && \ + ((connector) = (__state)->connectors[__i].ptr, \ + (old_connector_state) = (__state)->connectors[__i].old_state, \ + (new_connector_state) = (__state)->connectors[__i].new_state, 1); \ + (__i)++) \ + for_each_if (connector) + +#define for_each_old_connector_in_state (__state, connector, old_connector_state, __i) \ + for ((__i) = 0; \ + (__i) < (__state)->num_connector && \ + ((connector) = (__state)->connectors[__i].ptr, \ + (old_connector_state) = (__state)->connectors[__i].old_state, 1); \ + (__i)++) \ + for_each_if (connector) + +#define for_each_new_connector_in_state (__state, connector, new_connector_state, __i) \ + for ((__i) = 0; \ + (__i) < (__state)->num_connector && \ + ((connector) = (__state)->connectors[__i].ptr, \ + (new_connector_state) = (__state)->connectors[__i].new_state, 1); \ + (__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 && \@@ -380,6 +405,31 @@ int __must_check drm_atomic_nonblocking_commit(struct drm_atomic_state *state); (__i)++) \ for_each_if (crtc_state) +#define for_each_oldnew_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, \ + (old_crtc_state) = (__state)->crtcs[__i].old_state, \ + (new_crtc_state) = (__state)->crtcs[__i].new_state, 1); \ + (__i)++) \ + for_each_if (crtc) + +#define for_each_old_crtc_in_state (__state, crtc, old_crtc_state, __i) \ + for ((__i) = 0; \ + (__i) < (__state)->dev->mode_config.num_crtc && \ + ((crtc) = (__state)->crtcs[__i].ptr, \ + (old_crtc_state) = (__state)->crtcs[__i].old_state, 1); \ + (__i)++) \ + for_each_if (crtc) + +#define for_each_new_crtc_in_state (__state, crtc, new_crtc_state, __i) \ + for ((__i) = 0; \ + (__i) < (__state)->dev->mode_config.num_crtc && \ + ((crtc) = (__state)->crtcs[__i].ptr, \ + (new_crtc_state) = (__state)->crtcs[__i].new_state, 1); \ + (__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 && \@@ -388,6 +438,31 @@ int __must_check drm_atomic_nonblocking_commit(struct drm_atomic_state *state); (__i)++) \ for_each_if (plane_state) +#define for_each_oldnew_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, \ + (old_plane_state) = (__state)->planes[__i].old_state, \ + (new_plane_state) = (__state)->planes[__i].new_state, 1); \ + (__i)++) \ + for_each_if (plane) + +#define for_each_old_plane_in_state (__state, plane, old_plane_state, __i) \ + for ((__i) = 0; \ + (__i) < (__state)->dev->mode_config.num_total_plane && \ + ((plane) = (__state)->planes[__i].ptr, \ + (old_plane_state) = (__state)->planes[__i].old_state, 1); \ + (__i)++) \ + for_each_if (plane) + +#define for_each_new_plane_in_state (__state, plane, new_plane_state, __i) \ + for ((__i) = 0; \ + (__i) < (__state)->dev->mode_config.num_total_plane && \ + ((plane) = (__state)->planes[__i].ptr, \ + (new_plane_state) = (__state)->planes[__i].new_state, 1); \ + (__i)++) \ + for_each_if (plane) +/** * drm_atomic_crtc_needs_modeset - compute combined modeset need * @state: &drm_crtc_state for the CRTC include/drm/drm_atomic_helper.h +3
-0@@ -108,6 +108,9 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set,int drm_atomic_helper_disable_all (struct drm_device *dev,struct drm_modeset_acquire_ctx *ctx);struct drm_atomic_state *drm_atomic_helper_suspend (struct drm_device *dev); +int drm_atomic_helper_commit_duplicated_state (struct drm_atomic_state *state, +struct drm_modeset_acquire_ctx *ctx, +bool nonblock);int drm_atomic_helper_resume (struct drm_device *dev,struct drm_atomic_state *state);Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Maarten Lankhorst
maintainerRe: [PATCH 01/19] drm/atomic: Add new iterators over all state
Op 01-11-16 om 14:09 schreef Ville Syrjälä:
Quoted 61 lines · Maarten Lankhorst
Quoted 60 lines
Add for_each_(old)(new)_(plane,connector,crtc)_in_state iterators to replace the old
for_each_xxx_in_stateones. This is useful for >1 flip depth and getting rid of allxxx->statedereferences.Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 6 +++ drivers/gpu/drm/drm_atomic_helper.c | 52 +++++++++++++++++++++-- drivers/gpu/drm/i915/intel_display.c | 11 ++--- include/drm/drm_atomic.h | 81 ++++++++++++++++++++++++++++++++++-- include/drm/drm_atomic_helper.h | 3 ++ 5 files changed, 142 insertions(+), 11 deletions(-)drivers/gpu/drm/drm_atomic.c +6
-0@@ -278,6 +278,8 @@ drm_atomic_get_crtc_state(struct drm_atomic_state *state,return ERR_PTR (-ENOMEM ); state->crtcs[index].state = crtc_state; + state->crtcs[index].old_state = crtc->state; + state->crtcs[index].new_state = crtc_state; state->crtcs[index].ptr = crtc; crtc_state->state = state;@@ -640,6 +642,8 @@ drm_atomic_get_plane_state(struct drm_atomic_state *state, state->planes[index].state = plane_state; state->planes[index].ptr = plane; + state->planes[index].old_state = plane->state; + state->planes[index].new_state = plane_state; plane_state->state = state; DRM_DEBUG_ATOMIC("Added [PLANE:%d:%s] %p state to %p\n",@@ -931,6 +935,8 @@ drm_atomic_get_connector_state(struct drm_atomic_state *state,drm_connector_reference (connector); state->connectors[index].state = connector_state; + state->connectors[index].old_state = connector->state; + state->connectors[index].new_state = connector_state; state->connectors[index].ptr = connector; connector_state->state = state;drivers/gpu/drm/drm_atomic_helper.c +1
-1@@ -2495,7 +2495,7 @@ EXPORT_SYMBOL(drm_atomic_helper_disable_all);* * See also: * drm_atomic_helper_duplicate_state(), drm_atomic_helper_disable_all(), -* drm_atomic_helper_resume() +* drm_atomic_helper_resume(), drm_atomic_helper_commit_duplicated_state() */ struct drm_atomic_state *drm_atomic_helper_suspend (struct drm_device *dev) {@@ -2536,6 +2536,52 @@ unlock:EXPORT_SYMBOL (drm_atomic_helper_suspend);
Quoted 11 lines
drivers/gpu/drm/drm_atomic_helper.c unlock: · line 2546
Quoted 9 lines
drivers/gpu/drm/drm_atomic_helper.c +8
-0/** +* drm_atomic_helper_commit_duplicated_state - commit duplicated state +* @state: duplicated atomic state to commit +* @ctx: pointer to acquire_ctx to use for commit. +* @nonblock: commit the state non-blocking. +* +* The state returned by drm_atomic_helper_duplicate_state() and +* drm_atomic_helper_suspend() is partially invalid, and needs to +* be fixed up before commit. So the
old_statepointers are potentially invalid becausewhatever->statemay have changed since we duplicated the state?
Yes when you use drm_atomic_helper_duplicate_state, and commit a different state before committing the duplicated state. This only happens during suspend/resume and gpu reset.
~Maarten
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 01/19] drm/atomic: Add new iterators over all state
Quoted 74 lines · Maarten Lankhorst
Op 01-11-16 om 14:09 schreef Ville Syrjälä:
Quoted 61 lines · Maarten Lankhorst
Quoted 60 lines
Add for_each_(old)(new)_(plane,connector,crtc)_in_state iterators to replace the old
for_each_xxx_in_stateones. This is useful for >1 flip depth and getting rid of allxxx->statedereferences.Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 6 +++ drivers/gpu/drm/drm_atomic_helper.c | 52 +++++++++++++++++++++-- drivers/gpu/drm/i915/intel_display.c | 11 ++--- include/drm/drm_atomic.h | 81 ++++++++++++++++++++++++++++++++++-- include/drm/drm_atomic_helper.h | 3 ++ 5 files changed, 142 insertions(+), 11 deletions(-)drivers/gpu/drm/drm_atomic.c +6
-0@@ -278,6 +278,8 @@ drm_atomic_get_crtc_state(struct drm_atomic_state *state,return ERR_PTR (-ENOMEM ); state->crtcs[index].state = crtc_state; + state->crtcs[index].old_state = crtc->state; + state->crtcs[index].new_state = crtc_state; state->crtcs[index].ptr = crtc; crtc_state->state = state;@@ -640,6 +642,8 @@ drm_atomic_get_plane_state(struct drm_atomic_state *state, state->planes[index].state = plane_state; state->planes[index].ptr = plane; + state->planes[index].old_state = plane->state; + state->planes[index].new_state = plane_state; plane_state->state = state; DRM_DEBUG_ATOMIC("Added [PLANE:%d:%s] %p state to %p\n",@@ -931,6 +935,8 @@ drm_atomic_get_connector_state(struct drm_atomic_state *state,drm_connector_reference (connector); state->connectors[index].state = connector_state; + state->connectors[index].old_state = connector->state; + state->connectors[index].new_state = connector_state; state->connectors[index].ptr = connector; connector_state->state = state;drivers/gpu/drm/drm_atomic_helper.c +1
-1@@ -2495,7 +2495,7 @@ EXPORT_SYMBOL(drm_atomic_helper_disable_all);* * See also: * drm_atomic_helper_duplicate_state(), drm_atomic_helper_disable_all(), -* drm_atomic_helper_resume() +* drm_atomic_helper_resume(), drm_atomic_helper_commit_duplicated_state() */ struct drm_atomic_state *drm_atomic_helper_suspend (struct drm_device *dev) {@@ -2536,6 +2536,52 @@ unlock:EXPORT_SYMBOL (drm_atomic_helper_suspend);Quoted 11 lines
drivers/gpu/drm/drm_atomic_helper.c unlock: · line 2546
Quoted 9 lines
drivers/gpu/drm/drm_atomic_helper.c +8
-0/** +* drm_atomic_helper_commit_duplicated_state - commit duplicated state +* @state: duplicated atomic state to commit +* @ctx: pointer to acquire_ctx to use for commit. +* @nonblock: commit the state non-blocking. +* +* The state returned by drm_atomic_helper_duplicate_state() and +* drm_atomic_helper_suspend() is partially invalid, and needs to +* be fixed up before commit. So the
old_statepointers are potentially invalid becausewhatever->statemay have changed since we duplicated the state?
Quoted 2 lines
Yes when you use
drm_atomic_helper_duplicate_state, and commit a different state before committing the duplicated state. This only happens during suspend/resume and gpu reset.
Should we maybe have something like drm_atomic_refresh_old_state(state)? Would allow the caller then to check something in the old vs. new state before committing?
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Maarten Lankhorst
maintainerRe: [PATCH 01/19] drm/atomic: Add new iterators over all state
Op 01-11-16 om 14:41 schreef Ville Syrjälä:
Quoted 74 lines · Maarten Lankhorst
Quoted 73 lines
Op 01-11-16 om 14:09 schreef Ville Syrjälä:
Quoted 72 lines · Maarten Lankhorst
Quoted 59 lines
Add for_each_(old)(new)_(plane,connector,crtc)_in_state iterators to replace the old
for_each_xxx_in_stateones. This is useful for >1 flip depth and getting rid of allxxx->statedereferences.Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 6 +++ drivers/gpu/drm/drm_atomic_helper.c | 52 +++++++++++++++++++++-- drivers/gpu/drm/i915/intel_display.c | 11 ++--- include/drm/drm_atomic.h | 81 ++++++++++++++++++++++++++++++++++-- include/drm/drm_atomic_helper.h | 3 ++ 5 files changed, 142 insertions(+), 11 deletions(-)drivers/gpu/drm/drm_atomic.c +6
-0@@ -278,6 +278,8 @@ drm_atomic_get_crtc_state(struct drm_atomic_state *state,return ERR_PTR (-ENOMEM ); state->crtcs[index].state = crtc_state; + state->crtcs[index].old_state = crtc->state; + state->crtcs[index].new_state = crtc_state; state->crtcs[index].ptr = crtc; crtc_state->state = state;@@ -640,6 +642,8 @@ drm_atomic_get_plane_state(struct drm_atomic_state *state, state->planes[index].state = plane_state; state->planes[index].ptr = plane; + state->planes[index].old_state = plane->state; + state->planes[index].new_state = plane_state; plane_state->state = state; DRM_DEBUG_ATOMIC("Added [PLANE:%d:%s] %p state to %p\n",@@ -931,6 +935,8 @@ drm_atomic_get_connector_state(struct drm_atomic_state *state,drm_connector_reference (connector); state->connectors[index].state = connector_state; + state->connectors[index].old_state = connector->state; + state->connectors[index].new_state = connector_state; state->connectors[index].ptr = connector; connector_state->state = state;drivers/gpu/drm/drm_atomic_helper.c +1
-1@@ -2495,7 +2495,7 @@ EXPORT_SYMBOL(drm_atomic_helper_disable_all);* * See also: * drm_atomic_helper_duplicate_state(), drm_atomic_helper_disable_all(), -* drm_atomic_helper_resume() +* drm_atomic_helper_resume(), drm_atomic_helper_commit_duplicated_state() */ struct drm_atomic_state *drm_atomic_helper_suspend (struct drm_device *dev) {@@ -2536,6 +2536,52 @@ unlock:EXPORT_SYMBOL (drm_atomic_helper_suspend);drivers/gpu/drm/drm_atomic_helper.c unlock: · line 2546
Quoted 10 lines
drivers/gpu/drm/drm_atomic_helper.c +8
-0/** +* drm_atomic_helper_commit_duplicated_state - commit duplicated state +* @state: duplicated atomic state to commit +* @ctx: pointer to acquire_ctx to use for commit. +* @nonblock: commit the state non-blocking. +* +* The state returned by drm_atomic_helper_duplicate_state() and +* drm_atomic_helper_suspend() is partially invalid, and needs to +* be fixed up before commit. So the
old_statepointers are potentially invalid becausewhatever->statemay have changed since we duplicated the state?
Quoted 5 lines
Quoted 2 lines
Yes when you use
drm_atomic_helper_duplicate_state, and commit a different state before committing the duplicated state. This only happens during suspend/resume and gpu reset.Should we maybe have something like
drm_atomic_refresh_old_state(state)? Would allow the caller then to check something in the old vs. new state before committing?
iirc that was the first approach I took, but then you shouldn't do anything with a duplicated state after creating a except commit it, so creating a commit_duplicated_state should be enough.
Can you think of any case where you do the following?
Duplicate state
commit different state
Look at duplicated state, tinker with it, commit it.
~Maarten
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 01/19] drm/atomic: Add new iterators over all state
Quoted 81 lines · Maarten Lankhorst
Op 01-11-16 om 14:41 schreef Ville Syrjälä:
Quoted 74 lines · Maarten Lankhorst
Quoted 73 lines
Op 01-11-16 om 14:09 schreef Ville Syrjälä:
Quoted 72 lines · Maarten Lankhorst
Quoted 59 lines
Add for_each_(old)(new)_(plane,connector,crtc)_in_state iterators to replace the old
for_each_xxx_in_stateones. This is useful for >1 flip depth and getting rid of allxxx->statedereferences.Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 6 +++ drivers/gpu/drm/drm_atomic_helper.c | 52 +++++++++++++++++++++-- drivers/gpu/drm/i915/intel_display.c | 11 ++--- include/drm/drm_atomic.h | 81 ++++++++++++++++++++++++++++++++++-- include/drm/drm_atomic_helper.h | 3 ++ 5 files changed, 142 insertions(+), 11 deletions(-)drivers/gpu/drm/drm_atomic.c +6
-0@@ -278,6 +278,8 @@ drm_atomic_get_crtc_state(struct drm_atomic_state *state,return ERR_PTR (-ENOMEM ); state->crtcs[index].state = crtc_state; + state->crtcs[index].old_state = crtc->state; + state->crtcs[index].new_state = crtc_state; state->crtcs[index].ptr = crtc; crtc_state->state = state;@@ -640,6 +642,8 @@ drm_atomic_get_plane_state(struct drm_atomic_state *state, state->planes[index].state = plane_state; state->planes[index].ptr = plane; + state->planes[index].old_state = plane->state; + state->planes[index].new_state = plane_state; plane_state->state = state; DRM_DEBUG_ATOMIC("Added [PLANE:%d:%s] %p state to %p\n",@@ -931,6 +935,8 @@ drm_atomic_get_connector_state(struct drm_atomic_state *state,drm_connector_reference (connector); state->connectors[index].state = connector_state; + state->connectors[index].old_state = connector->state; + state->connectors[index].new_state = connector_state; state->connectors[index].ptr = connector; connector_state->state = state;drivers/gpu/drm/drm_atomic_helper.c +1
-1@@ -2495,7 +2495,7 @@ EXPORT_SYMBOL(drm_atomic_helper_disable_all);* * See also: * drm_atomic_helper_duplicate_state(), drm_atomic_helper_disable_all(), -* drm_atomic_helper_resume() +* drm_atomic_helper_resume(), drm_atomic_helper_commit_duplicated_state() */ struct drm_atomic_state *drm_atomic_helper_suspend (struct drm_device *dev) {@@ -2536,6 +2536,52 @@ unlock:EXPORT_SYMBOL (drm_atomic_helper_suspend);drivers/gpu/drm/drm_atomic_helper.c unlock: · line 2546
Quoted 10 lines
drivers/gpu/drm/drm_atomic_helper.c +8
-0/** +* drm_atomic_helper_commit_duplicated_state - commit duplicated state +* @state: duplicated atomic state to commit +* @ctx: pointer to acquire_ctx to use for commit. +* @nonblock: commit the state non-blocking. +* +* The state returned by drm_atomic_helper_duplicate_state() and +* drm_atomic_helper_suspend() is partially invalid, and needs to +* be fixed up before commit. So the
old_statepointers are potentially invalid becausewhatever->statemay have changed since we duplicated the state?Quoted 5 lines
Quoted 2 lines
Yes when you use
drm_atomic_helper_duplicate_state, and commit a different state before committing the duplicated state. This only happens during suspend/resume and gpu reset.Should we maybe have something like
drm_atomic_refresh_old_state(state)? Would allow the caller then to check something in the old vs. new state before committing?
Quoted 8 lines
iirc that was the first approach I took, but then you shouldn't do anything with a duplicated state after creating a except commit it, so creating a
commit_duplicated_stateshould be enough.Can you think of any case where you do the following?
Duplicate state
commit different state
Look at duplicated state, tinker with it, commit it.
Not really. Oh, and we do still run the thing through the check phase when we commit it, don't we? That sounds like it should let the driver do whatever it needs to do.
So my only other concern is just the 'bool nonblock' parameter. It's a bit funny looking that we pass that in, then branch off to the nonblocking vs. blocking commits, which then just pass another bool parameter to the commit hook. Should we have block vs. nonblocking variants of this function as well or just remove drm_atomic_nonblocking_commit() and have callers pass the parameter straight from the beginning?
drm_atomic_commit() and drm_atomic_nonblocking_commit() could also use some code deduplication I think. Should we decice to keep them around.
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Maarten Lankhorst
maintainerRe: [PATCH 01/19] drm/atomic: Add new iterators over all state
Op 03-11-16 om 16:11 schreef Ville Syrjälä:
Quoted 99 lines · Maarten Lankhorst
Quoted 80 lines
Op 01-11-16 om 14:41 schreef Ville Syrjälä:
Quoted 74 lines · Maarten Lankhorst
Quoted 73 lines
Op 01-11-16 om 14:09 schreef Ville Syrjälä:
Quoted 72 lines · Maarten Lankhorst
Quoted 59 lines
Add for_each_(old)(new)_(plane,connector,crtc)_in_state iterators to replace the old
for_each_xxx_in_stateones. This is useful for >1 flip depth and getting rid of allxxx->statedereferences.Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 6 +++ drivers/gpu/drm/drm_atomic_helper.c | 52 +++++++++++++++++++++-- drivers/gpu/drm/i915/intel_display.c | 11 ++--- include/drm/drm_atomic.h | 81 ++++++++++++++++++++++++++++++++++-- include/drm/drm_atomic_helper.h | 3 ++ 5 files changed, 142 insertions(+), 11 deletions(-)drivers/gpu/drm/drm_atomic.c +6
-0@@ -278,6 +278,8 @@ drm_atomic_get_crtc_state(struct drm_atomic_state *state,return ERR_PTR (-ENOMEM ); state->crtcs[index].state = crtc_state; + state->crtcs[index].old_state = crtc->state; + state->crtcs[index].new_state = crtc_state; state->crtcs[index].ptr = crtc; crtc_state->state = state;@@ -640,6 +642,8 @@ drm_atomic_get_plane_state(struct drm_atomic_state *state, state->planes[index].state = plane_state; state->planes[index].ptr = plane; + state->planes[index].old_state = plane->state; + state->planes[index].new_state = plane_state; plane_state->state = state; DRM_DEBUG_ATOMIC("Added [PLANE:%d:%s] %p state to %p\n",@@ -931,6 +935,8 @@ drm_atomic_get_connector_state(struct drm_atomic_state *state,drm_connector_reference (connector); state->connectors[index].state = connector_state; + state->connectors[index].old_state = connector->state; + state->connectors[index].new_state = connector_state; state->connectors[index].ptr = connector; connector_state->state = state;drivers/gpu/drm/drm_atomic_helper.c +1
-1@@ -2495,7 +2495,7 @@ EXPORT_SYMBOL(drm_atomic_helper_disable_all);* * See also: * drm_atomic_helper_duplicate_state(), drm_atomic_helper_disable_all(), -* drm_atomic_helper_resume() +* drm_atomic_helper_resume(), drm_atomic_helper_commit_duplicated_state() */ struct drm_atomic_state *drm_atomic_helper_suspend (struct drm_device *dev) {@@ -2536,6 +2536,52 @@ unlock:EXPORT_SYMBOL (drm_atomic_helper_suspend);drivers/gpu/drm/drm_atomic_helper.c unlock: · line 2546
Quoted 10 lines
drivers/gpu/drm/drm_atomic_helper.c +8
-0/** +* drm_atomic_helper_commit_duplicated_state - commit duplicated state +* @state: duplicated atomic state to commit +* @ctx: pointer to acquire_ctx to use for commit. +* @nonblock: commit the state non-blocking. +* +* The state returned by drm_atomic_helper_duplicate_state() and +* drm_atomic_helper_suspend() is partially invalid, and needs to +* be fixed up before commit. So the
old_statepointers are potentially invalid becausewhatever->statemay have changed since we duplicated the state?Quoted 5 lines
Quoted 2 lines
Yes when you use
drm_atomic_helper_duplicate_state, and commit a different state before committing the duplicated state. This only happens during suspend/resume and gpu reset.Should we maybe have something like
drm_atomic_refresh_old_state(state)? Would allow the caller then to check something in the old vs. new state before committing?Quoted 8 lines
iirc that was the first approach I took, but then you shouldn't do anything with a duplicated state after creating a except commit it, so creating a
commit_duplicated_stateshould be enough.Can you think of any case where you do the following?
Duplicate state
commit different state
Look at duplicated state, tinker with it, commit it.Not really. Oh, and we do still run the thing through the check phase when we commit it, don't we? That sounds like it should let the driver do whatever it needs to do.
So my only other concern is just the 'bool nonblock' parameter. It's a bit funny looking that we pass that in, then branch off to the nonblocking vs. blocking commits, which then just pass another bool parameter to the commit hook. Should we have block vs. nonblocking variants of this function as well or just removedrm_atomic_nonblocking_commit()and have callers pass the parameter straight from the beginning?
Quoted 2 lines
drm_atomic_commit()anddrm_atomic_nonblocking_commit()could also use some code deduplication I think. Should we decice to keep them around.
I could have done the check and commit manually, but would rather use the dedicated atomic commands for it. However nowhere we end up using the nonblocking version, so I think I will remove the nonblock parameter and leave the decision on what to do with nonblocking commit for another day. :)
~Maarten
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 01/19] drm/atomic: Add new iterators over all state
In reply to Maarten LankhorstQuoted 74 lines · Maarten Lankhorst
Op 01-11-16 om 14:09 schreef Ville Syrjälä:
Quoted 61 lines · Maarten Lankhorst
Quoted 60 lines
Add for_each_(old)(new)_(plane,connector,crtc)_in_state iterators to replace the old
for_each_xxx_in_stateones. This is useful for >1 flip depth and getting rid of allxxx->statedereferences.Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 6 +++ drivers/gpu/drm/drm_atomic_helper.c | 52 +++++++++++++++++++++-- drivers/gpu/drm/i915/intel_display.c | 11 ++--- include/drm/drm_atomic.h | 81 ++++++++++++++++++++++++++++++++++-- include/drm/drm_atomic_helper.h | 3 ++ 5 files changed, 142 insertions(+), 11 deletions(-)drivers/gpu/drm/drm_atomic.c +6
-0@@ -278,6 +278,8 @@ drm_atomic_get_crtc_state(struct drm_atomic_state *state,return ERR_PTR (-ENOMEM ); state->crtcs[index].state = crtc_state; + state->crtcs[index].old_state = crtc->state; + state->crtcs[index].new_state = crtc_state; state->crtcs[index].ptr = crtc; crtc_state->state = state;@@ -640,6 +642,8 @@ drm_atomic_get_plane_state(struct drm_atomic_state *state, state->planes[index].state = plane_state; state->planes[index].ptr = plane; + state->planes[index].old_state = plane->state; + state->planes[index].new_state = plane_state; plane_state->state = state; DRM_DEBUG_ATOMIC("Added [PLANE:%d:%s] %p state to %p\n",@@ -931,6 +935,8 @@ drm_atomic_get_connector_state(struct drm_atomic_state *state,drm_connector_reference (connector); state->connectors[index].state = connector_state; + state->connectors[index].old_state = connector->state; + state->connectors[index].new_state = connector_state; state->connectors[index].ptr = connector; connector_state->state = state;drivers/gpu/drm/drm_atomic_helper.c +1
-1@@ -2495,7 +2495,7 @@ EXPORT_SYMBOL(drm_atomic_helper_disable_all);* * See also: * drm_atomic_helper_duplicate_state(), drm_atomic_helper_disable_all(), -* drm_atomic_helper_resume() +* drm_atomic_helper_resume(), drm_atomic_helper_commit_duplicated_state() */ struct drm_atomic_state *drm_atomic_helper_suspend (struct drm_device *dev) {@@ -2536,6 +2536,52 @@ unlock:EXPORT_SYMBOL (drm_atomic_helper_suspend);Quoted 11 lines
drivers/gpu/drm/drm_atomic_helper.c unlock: · line 2546
Quoted 9 lines
drivers/gpu/drm/drm_atomic_helper.c +8
-0/** +* drm_atomic_helper_commit_duplicated_state - commit duplicated state +* @state: duplicated atomic state to commit +* @ctx: pointer to acquire_ctx to use for commit. +* @nonblock: commit the state non-blocking. +* +* The state returned by drm_atomic_helper_duplicate_state() and +* drm_atomic_helper_suspend() is partially invalid, and needs to +* be fixed up before commit. So the
old_statepointers are potentially invalid becausewhatever->statemay have changed since we duplicated the state?
Quoted 2 lines
Yes when you use
drm_atomic_helper_duplicate_state, and commit a different state before committing the duplicated state. This only happens during suspend/resume and gpu reset.
Kerneldoc should imo mention that suspend/resume is the only case this is valid, and even then it depends upon the driver. Proper atomic commits never keep drm_atomic_state around when dropping locks, so this can't happen with an atomic ioctl. Please also directly cross-reference all these functions.
-Daniel
Quoted 7 lines
~Maarten
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Maarten Lankhorst
maintainerPATCH 2/19 drm/atmel-hlcdc: Use new atomic iterator macros.
In reply to Maarten Lankhorst--- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c +1 -1
@@ -268,7 +268,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;
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Maarten Lankhorst
maintainerPATCH 3/19 drm/exynos: Use new atomic iterator macros.
In reply to Maarten Lankhorst--- drivers/gpu/drm/exynos/exynos_drm_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/exynos/exynos_drm_drv.c +1 -1
@@ -243,7 +243,7 @@ int exynos_atomic_commit(struct drm_device *dev, struct drm_atomic_state *state,/* Wait until all affected CRTCs have completed previous commits and * mark them as pending. */ -for_each_crtc_in_state (state, crtc, crtc_state, i) +for_each_new_crtc_in_state (state, crtc, crtc_state, i) commit->crtcs |=drm_crtc_mask (crtc);wait_event (priv->wait, !commit_is_pending (priv, commit->crtcs));
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Maarten Lankhorst
maintainerPATCH 4/19 drm/blend: Use new atomic iterator macros.
In reply to Maarten Lankhorst--- drivers/gpu/drm/drm_blend.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/gpu/drm/drm_blend.c +11 -11
@@ -367,27 +367,27 @@ int drm_atomic_normalize_zpos(struct drm_device *dev, struct drm_atomic_state *state) {struct drm_crtc *crtc; -struct drm_crtc_state *crtc_state; +struct drm_crtc_state *old_crtc_state, *new_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 =0 ; -for_each_plane_in_state (state, plane, plane_state, i) { - crtc = plane_state->crtc; +for_each_oldnew_plane_in_state (state, plane, old_plane_state, new_plane_state, i) { + crtc = new_plane_state->crtc;if (!crtc)continue ; -if (plane->state->zpos != plane_state->zpos) { - crtc_state = +if (old_plane_state->zpos != new_plane_state->zpos) { + new_crtc_state =drm_atomic_get_existing_crtc_state (state, crtc); - crtc_state->zpos_changed = true; + new_crtc_state->zpos_changed = true; } } -for_each_crtc_in_state (state, crtc, crtc_state, i) { -if (crtc_state->plane_mask != crtc->state->plane_mask || - crtc_state->zpos_changed) { +for_each_oldnew_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, - crtc_state); + new_crtc_state);if (ret)return ret; }
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 04/19] drm/blend: Use new atomic iterator macros.
Quoted 1 line · Maarten Lankhorst
Signed-off-by Maarten Lankhorst <[email protected]>
Patches 02-04 looks sane to me, so for them
Quoted 54 lines
--- drivers/gpu/drm/drm_blend.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)drivers/gpu/drm/drm_blend.c +11
-11@@ -367,27 +367,27 @@ int drm_atomic_normalize_zpos(struct drm_device *dev, struct drm_atomic_state *state) {struct drm_crtc *crtc; -struct drm_crtc_state *crtc_state; +struct drm_crtc_state *old_crtc_state, *new_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 =0 ; -for_each_plane_in_state (state, plane, plane_state, i) { - crtc = plane_state->crtc; +for_each_oldnew_plane_in_state (state, plane, old_plane_state, new_plane_state, i) { + crtc = new_plane_state->crtc;if (!crtc)continue ; -if (plane->state->zpos != plane_state->zpos) { - crtc_state = +if (old_plane_state->zpos != new_plane_state->zpos) { + new_crtc_state =drm_atomic_get_existing_crtc_state (state, crtc); - crtc_state->zpos_changed = true; + new_crtc_state->zpos_changed = true; } } -for_each_crtc_in_state (state, crtc, crtc_state, i) { -if (crtc_state->plane_mask != crtc->state->plane_mask || - crtc_state->zpos_changed) { +for_each_oldnew_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, - crtc_state); + new_crtc_state);if (ret)return ret; }Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Maarten Lankhorst
maintainerPATCH 5/19 drm/atomic: Make add_affected_connectors look at crtc_state.
In reply to Maarten LankhorstThis kills another dereference of connector->state. connector_mask holds all unchanged connectors at least and any changed connectors are already in state anyway.
--- drivers/gpu/drm/drm_atomic.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_atomic.c +8 -3
@@ -1230,8 +1230,13 @@ drm_atomic_add_affected_connectors(struct drm_atomic_state *state,struct drm_mode_config *config = &state->dev->mode_config;struct drm_connector *connector;struct drm_connector_state *conn_state; +struct drm_crtc_state *crtc_state;int ret; + crtc_state =drm_atomic_get_crtc_state (state, crtc); +if (IS_ERR (crtc_state)) +return PTR_ERR (crtc_state); + ret =drm_modeset_lock (&config->connection_mutex, state->acquire_ctx);if (ret)return ret;
@@ -1240,11 +1245,11 @@ drm_atomic_add_affected_connectors(struct drm_atomic_state *state, crtc->base.id, crtc->name, state);/* -* Changed connectors are already in @state, so only need to look at the -* current configuration. +* Changed connectors are already in @state, so only need to look +* at the connector_mask in crtc_state. */ drm_for_each_connector (connector, state->dev) { -if (connector->state->crtc != crtc) +if (!(crtc_state->connector_mask & (1 <<drm_connector_index (connector))))continue ; conn_state =drm_atomic_get_connector_state (state, connector);
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 05/19] drm/atomic: Make add_affected_connectors look at crtc_state.
Quoted 30 lines · Maarten Lankhorst
This kills another dereference of
connector->state.connector_maskholds all unchanged connectors at least and any changed connectors are already in state anyway.Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)drivers/gpu/drm/drm_atomic.c +5
-0@@ -1230,8 +1230,13 @@ drm_atomic_add_affected_connectors(struct drm_atomic_state *state,struct drm_mode_config *config = &state->dev->mode_config;struct drm_connector *connector;struct drm_connector_state *conn_state; +struct drm_crtc_state *crtc_state;int ret; + crtc_state =drm_atomic_get_crtc_state (state, crtc); +if (IS_ERR (crtc_state)) +return PTR_ERR (crtc_state); + ret =drm_modeset_lock (&config->connection_mutex, state->acquire_ctx);if (ret)return ret;@@ -1240,11 +1245,11 @@ drm_atomic_add_affected_connectors(struct drm_atomic_state *state, crtc->base.id, crtc->name, state);
drivers/gpu/drm/drm_atomic.c drm_atomic_add_affected_connectors(struct drm_atomic_state *state, · line 1253
Quoted 10 lines
drivers/gpu/drm/drm_atomic.c +3
-3/* -* Changed connectors are already in @state, so only need to look at the -* current configuration. +* Changed connectors are already in @state, so only need to look +* at the connector_mask in crtc_state. */ drm_for_each_connector (connector, state->dev) { -if (connector->state->crtc != crtc) +if (!(crtc_state->connector_mask & (1 <<drm_connector_index (connector))))continue ;
So this being the new crtc state, connector_mask will include all newly enabled connectors (these will have been already added to the top level state), and also any connector that was already enabled and isn't getting disabled (these are the ones we need to explicitly add to the top level state here).
/me wishes the top level state would be renamed to drm_atomic_transaction or something...
Any connector that is getting disabled will already have been added to the top level state as well, so them not being included in the new crtc state's connectors_mask is fine.
Quoted 9 lines
drivers/gpu/drm/drm_atomic.c +0
-0conn_state =drm_atomic_get_connector_state (state, connector);Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 05/19] drm/atomic: Make add_affected_connectors look at crtc_state.
Quoted 47 lines · Ville Syrjälä
Quoted 30 lines · Maarten Lankhorst
This kills another dereference of
connector->state.connector_maskholds all unchanged connectors at least and any changed connectors are already in state anyway.Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)drivers/gpu/drm/drm_atomic.c +5
-0@@ -1230,8 +1230,13 @@ drm_atomic_add_affected_connectors(struct drm_atomic_state *state,struct drm_mode_config *config = &state->dev->mode_config;struct drm_connector *connector;struct drm_connector_state *conn_state; +struct drm_crtc_state *crtc_state;int ret; + crtc_state =drm_atomic_get_crtc_state (state, crtc); +if (IS_ERR (crtc_state)) +return PTR_ERR (crtc_state); + ret =drm_modeset_lock (&config->connection_mutex, state->acquire_ctx);if (ret)return ret;@@ -1240,11 +1245,11 @@ drm_atomic_add_affected_connectors(struct drm_atomic_state *state, crtc->base.id, crtc->name, state);drivers/gpu/drm/drm_atomic.c drm_atomic_add_affected_connectors(struct drm_atomic_state *state, · line 1253
Quoted 10 lines
drivers/gpu/drm/drm_atomic.c +3
-3/* -* Changed connectors are already in @state, so only need to look at the -* current configuration. +* Changed connectors are already in @state, so only need to look +* at the connector_mask in crtc_state. */ drm_for_each_connector (connector, state->dev) { -if (connector->state->crtc != crtc) +if (!(crtc_state->connector_mask & (1 <<drm_connector_index (connector))))continue ;So this being the new crtc state,
connector_maskwill include all newly enabled connectors (these will have been already added to the top level state), and also any connector that was already enabled and isn't getting disabled (these are the ones we need to explicitly add to the top level state here).
Quoted 1 line
/me wishes the top level state would be renamed to
drm_atomic_transactionor something...
+1 on drm_atomic_transaction, that's an awesome name. Not sure how bad it would be to roll this out though ...
-Daniel
Quoted 24 lines
Any connector that is getting disabled will already have been added to the top level state as well, so them not being included in the new crtc state's
connectors_maskis fine.Reviewed-by Ville Syrjälä <[email protected]>Quoted 9 lines
drivers/gpu/drm/drm_atomic.c +0
-0conn_state =drm_atomic_get_connector_state (state, connector);Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfxSignature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Maarten Lankhorst
maintainerPATCH 6/19 drm/atomic: Use new atomic iterator macros.
In reply to Maarten Lankhorst--- drivers/gpu/drm/drm_atomic.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/drm_atomic.c +5 -5
@@ -1369,7 +1369,7 @@ int drm_atomic_check_only(struct drm_atomic_state *state)DRM_DEBUG_ATOMIC ("checking %p\n" , state); -for_each_plane_in_state (state, plane, plane_state, i) { +for_each_new_plane_in_state (state, plane, plane_state, i) { ret =drm_atomic_plane_check (plane, plane_state);if (ret) { DRM_DEBUG_ATOMIC("[PLANE:%d:%s] atomic core check failed\n",
@@ -1378,7 +1378,7 @@ int drm_atomic_check_only(struct drm_atomic_state *state) } } -for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, crtc_state, i) { ret =drm_atomic_crtc_check (crtc, crtc_state);if (ret) { DRM_DEBUG_ATOMIC("[CRTC:%d:%s] atomic core check failed\n",
@@ -1391,7 +1391,7 @@ int drm_atomic_check_only(struct drm_atomic_state *state) ret = config->funcs->atomic_check (state->dev, state);if (!state->allow_modeset) { -for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, crtc_state, i) {if (drm_atomic_crtc_needs_modeset (crtc_state)) {DRM_DEBUG_ATOMIC ("[CRTC:%d:%s] requires full modeset\n" , crtc->base.id, crtc->name);
@@ -1732,7 +1732,7 @@ retry: }if (arg->flags &DRM_MODE_PAGE_FLIP_EVENT ) { -for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, crtc_state, i) {struct drm_pending_vblank_event *e; e = create_vblank_event(dev, file_priv, NULL,
@@ -1768,7 +1768,7 @@ out:* for TEST_ONLY too. */ -for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, crtc_state, i) {if (!crtc_state->event)continue ;
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 06/19] drm/atomic: Use new atomic iterator macros.
Quoted 28 lines · Maarten Lankhorst
Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/gpu/drm/drm_atomic.c +2
-2@@ -1369,7 +1369,7 @@ int drm_atomic_check_only(struct drm_atomic_state *state)DRM_DEBUG_ATOMIC ("checking %p\n" , state); -for_each_plane_in_state (state, plane, plane_state, i) { +for_each_new_plane_in_state (state, plane, plane_state, i) { ret =drm_atomic_plane_check (plane, plane_state);if (ret) { DRM_DEBUG_ATOMIC("[PLANE:%d:%s] atomic core check failed\n",@@ -1378,7 +1378,7 @@ int drm_atomic_check_only(struct drm_atomic_state *state) } } -for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, crtc_state, i) { ret =drm_atomic_crtc_check (crtc, crtc_state);if (ret) { DRM_DEBUG_ATOMIC("[CRTC:%d:%s] atomic core check failed\n",
drivers/gpu/drm/drm_atomic.c int drm_atomic_check_only(struct drm_atomic_state *state) · line 1397
Quoted 8 lines
drivers/gpu/drm/drm_atomic.c +1
-1@@ -1391,7 +1391,7 @@ int drm_atomic_check_only(struct drm_atomic_state *state) ret = config->funcs->atomic_check (state->dev, state);if (!state->allow_modeset) { -for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, crtc_state, i) {if (drm_atomic_crtc_needs_modeset (crtc_state)) {DRM_DEBUG_ATOMIC ("[CRTC:%d:%s] requires full modeset\n" , crtc->base.id, crtc->name);
All part of the check phase. Check.
Quoted 10 lines
drivers/gpu/drm/drm_atomic.c +1
-1@@ -1732,7 +1732,7 @@ retry: }if (arg->flags &DRM_MODE_PAGE_FLIP_EVENT ) { -for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, crtc_state, i) {struct drm_pending_vblank_event *e; e = create_vblank_event(dev, file_priv, NULL,
drivers/gpu/drm/drm_atomic.c out: · line 1773
Quoted 7 lines
drivers/gpu/drm/drm_atomic.c +1
-1@@ -1768,7 +1768,7 @@ out:* for TEST_ONLY too. */ -for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, crtc_state, i) {if (!crtc_state->event)continue ;
This latter one runs after the commit, but since it's only executed when the check/commit failed, we wouldn't have swapped the state yet.
Quoted 8 lines
Signature · 7 lines
-- 2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Maarten Lankhorst
maintainerPATCH 7/19 drm/atomic: Fix atomic helpers to use the new iterator macros.
In reply to Maarten Lankhorst--- drivers/gpu/drm/drm_atomic_helper.c | 302 +++++++++++++++++++----------------- 1 file changed, 157 insertions(+), 145 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +157 -145
@@ -103,7 +103,7 @@ static int handle_conflicting_encoders(struct drm_atomic_state *state,* part of the state. If the same encoder is assigned to multiple * connectors bail out. */ -for_each_connector_in_state (state, connector, conn_state, i) { +for_each_new_connector_in_state (state, connector, conn_state, i) {const struct drm_connector_helper_funcs *funcs = connector->helper_private;struct drm_encoder *new_encoder;
@@ -238,22 +238,22 @@ steal_encoder(struct drm_atomic_state *state, {struct drm_crtc_state *crtc_state;struct drm_connector *connector; -struct drm_connector_state *connector_state; +struct drm_connector_state *old_connector_state, *new_connector_state;int i; -for_each_connector_in_state (state, connector, connector_state, i) { +for_each_oldnew_connector_in_state (state, connector, old_connector_state, new_connector_state, i) {struct drm_crtc *encoder_crtc; -if (connector_state->best_encoder != encoder) +if (new_connector_state->best_encoder != encoder)continue ; - encoder_crtc = connector->state->crtc; + encoder_crtc = old_connector_state->crtc;DRM_DEBUG_ATOMIC ("[ENCODER:%d:%s] in use on [CRTC:%d:%s], stealing it\n" , encoder->base.id, encoder->name, encoder_crtc->base.id, encoder_crtc->name); -set_best_encoder (state, connector_state,NULL ); +set_best_encoder (state, new_connector_state,NULL ); crtc_state =drm_atomic_get_existing_crtc_state (state, encoder_crtc); crtc_state->connectors_changed = true;
@@ -265,7 +265,8 @@ steal_encoder(struct drm_atomic_state *state,static int update_connector_routing (struct drm_atomic_state *state,struct drm_connector *connector, -struct drm_connector_state *connector_state) +struct drm_connector_state *old_connector_state, +struct drm_connector_state *new_connector_state) {const struct drm_connector_helper_funcs *funcs;struct drm_encoder *new_encoder;
@@ -275,24 +276,24 @@ update_connector_routing(struct drm_atomic_state *state, connector->base.id, connector->name); -if (connector->state->crtc != connector_state->crtc) { -if (connector->state->crtc) { - crtc_state =drm_atomic_get_existing_crtc_state (state, connector->state->crtc); +if (old_connector_state->crtc != new_connector_state->crtc) { +if (old_connector_state->crtc) { + crtc_state =drm_atomic_get_existing_crtc_state (state, old_connector_state->crtc); crtc_state->connectors_changed = true; } -if (connector_state->crtc) { - crtc_state =drm_atomic_get_existing_crtc_state (state, connector_state->crtc); +if (new_connector_state->crtc) { + crtc_state =drm_atomic_get_existing_crtc_state (state, new_connector_state->crtc); crtc_state->connectors_changed = true; } } -if (!connector_state->crtc) { +if (!new_connector_state->crtc) {DRM_DEBUG_ATOMIC ("Disabling [CONNECTOR:%d:%s]\n" , connector->base.id, connector->name); -set_best_encoder (state, connector_state,NULL ); +set_best_encoder (state, new_connector_state,NULL );return 0 ; }
@@ -301,7 +302,7 @@ update_connector_routing(struct drm_atomic_state *state,if (funcs->atomic_best_encoder) new_encoder = funcs->atomic_best_encoder (connector, - connector_state); + new_connector_state);else if (funcs->best_encoder) new_encoder = funcs->best_encoder (connector);else
@@ -314,33 +315,33 @@ update_connector_routing(struct drm_atomic_state *state,return -EINVAL ; } -if (!drm_encoder_crtc_ok (new_encoder, connector_state->crtc)) { +if (!drm_encoder_crtc_ok (new_encoder, new_connector_state->crtc)) {DRM_DEBUG_ATOMIC ("[ENCODER:%d:%s] incompatible with [CRTC:%d]\n" , new_encoder->base.id, new_encoder->name, - connector_state->crtc->base.id); + new_connector_state->crtc->base.id);return -EINVAL ; } -if (new_encoder == connector_state->best_encoder) { -set_best_encoder (state, connector_state, new_encoder); +if (new_encoder == new_connector_state->best_encoder) { +set_best_encoder (state, new_connector_state, new_encoder);DRM_DEBUG_ATOMIC ("[CONNECTOR:%d:%s] keeps [ENCODER:%d:%s], now on [CRTC:%d:%s]\n" , connector->base.id, connector->name, new_encoder->base.id, new_encoder->name, - connector_state->crtc->base.id, - connector_state->crtc->name); + new_connector_state->crtc->base.id, + new_connector_state->crtc->name);return 0 ; }steal_encoder (state, new_encoder); -set_best_encoder (state, connector_state, new_encoder); +set_best_encoder (state, new_connector_state, new_encoder); - crtc_state =drm_atomic_get_existing_crtc_state (state, connector_state->crtc); + crtc_state =drm_atomic_get_existing_crtc_state (state, new_connector_state->crtc); crtc_state->connectors_changed = true; DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] using [ENCODER:%d:%s] on [CRTC:%d:%s]\n",
@@ -348,8 +349,8 @@ update_connector_routing(struct drm_atomic_state *state, connector->name, new_encoder->base.id, new_encoder->name, - connector_state->crtc->base.id, - connector_state->crtc->name); + new_connector_state->crtc->base.id, + new_connector_state->crtc->name);return 0 ; }
@@ -364,7 +365,7 @@ mode_fixup(struct drm_atomic_state *state)int i;bool ret; -for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, crtc_state, i) {if (!crtc_state->mode_changed && !crtc_state->connectors_changed)continue ;
@@ -372,7 +373,7 @@ mode_fixup(struct drm_atomic_state *state)drm_mode_copy (&crtc_state->adjusted_mode, &crtc_state->mode); } -for_each_connector_in_state (state, connector, conn_state, i) { +for_each_new_connector_in_state (state, connector, conn_state, i) {const struct drm_encoder_helper_funcs *funcs;struct drm_encoder *encoder;
@@ -417,7 +418,7 @@ mode_fixup(struct drm_atomic_state *state) } } -for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, crtc_state, i) {const struct drm_crtc_helper_funcs *funcs;if (!crtc_state->enable)
@@ -476,19 +477,19 @@ drm_atomic_helper_check_modeset(struct drm_device *dev, struct drm_atomic_state *state) {struct drm_crtc *crtc; -struct drm_crtc_state *crtc_state; +struct drm_crtc_state *old_crtc_state, *new_crtc_state;struct drm_connector *connector; -struct drm_connector_state *connector_state; +struct drm_connector_state *old_connector_state, *new_connector_state;int i, ret; -for_each_crtc_in_state (state, crtc, crtc_state, i) { -if (!drm_mode_equal (&crtc->state->mode, &crtc_state->mode)) { +for_each_oldnew_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); - crtc_state->mode_changed = true; + new_crtc_state->mode_changed = true; } -if (crtc->state->enable != crtc_state->enable) { +if (old_crtc_state->enable != new_crtc_state->enable) {DRM_DEBUG_ATOMIC ("[CRTC:%d:%s] enable changed\n" , crtc->base.id, crtc->name);
@@ -500,8 +501,8 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,* The other way around is true as well. enable != 0 * iff connectors are attached and a mode is set. */ - crtc_state->mode_changed = true; - crtc_state->connectors_changed = true; + new_crtc_state->mode_changed = true; + new_crtc_state->connectors_changed = true; } }
@@ -509,14 +510,15 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,if (ret)return ret; -for_each_connector_in_state (state, connector, connector_state, i) { +for_each_oldnew_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 * connector properties need to be updated. */ ret =update_connector_routing (state, connector, - connector_state); + old_connector_state, + new_connector_state);if (ret)return ret; }
@@ -527,28 +529,28 @@ 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_crtc_in_state (state, crtc, crtc_state, i) { +for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) {bool has_connectors = - !!crtc_state->connector_mask; + !!new_crtc_state->connector_mask;/* * We must set ->active_changed after walking connectors for * otherwise an update that only changes active would result in * a full modeset because update_connector_routing force that. */ -if (crtc->state->active != crtc_state->active) { +if (old_crtc_state->active != new_crtc_state->active) {DRM_DEBUG_ATOMIC ("[CRTC:%d:%s] active changed\n" , crtc->base.id, crtc->name); - crtc_state->active_changed = true; + new_crtc_state->active_changed = true; } -if (!drm_atomic_crtc_needs_modeset (crtc_state)) +if (!drm_atomic_crtc_needs_modeset (new_crtc_state))continue ;DRM_DEBUG_ATOMIC ("[CRTC:%d:%s] needs all connectors, enable: %c, active: %c\n" , crtc->base.id, crtc->name, - crtc_state->enable ?'y' :'n' , - crtc_state->active ?'y' :'n' ); + new_crtc_state->enable ?'y' :'n' , + new_crtc_state->active ?'y' :'n' ); ret =drm_atomic_add_affected_connectors (state, crtc);if (ret !=0 )
@@ -558,7 +560,7 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,if (ret !=0 )return ret; -if (crtc_state->enable != has_connectors) { +if (new_crtc_state->enable != has_connectors) {DRM_DEBUG_ATOMIC ("[CRTC:%d:%s] enabled/connectors mismatch\n" , crtc->base.id, crtc->name);
@@ -599,7 +601,7 @@ drm_atomic_helper_check_planes(struct drm_device *dev,if (ret)return ret; -for_each_plane_in_state (state, plane, plane_state, i) { +for_each_new_plane_in_state (state, plane, plane_state, i) {const struct drm_plane_helper_funcs *funcs; funcs = plane->helper_private;
@@ -617,7 +619,7 @@ drm_atomic_helper_check_planes(struct drm_device *dev, } } -for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, crtc_state, i) {const struct drm_crtc_helper_funcs *funcs; funcs = crtc->helper_private;
@@ -678,12 +680,12 @@ static void disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state) { struct drm_connector *connector; -struct drm_connector_state *old_conn_state; +struct drm_connector_state *old_conn_state, *new_conn_state;struct drm_crtc *crtc; -struct drm_crtc_state *old_crtc_state; +struct drm_crtc_state *old_crtc_state, *new_crtc_state;int i; -for_each_connector_in_state (old_state, connector, old_conn_state, i) { +for_each_oldnew_connector_in_state (old_state, connector, old_conn_state, new_conn_state, i) {const struct drm_encoder_helper_funcs *funcs;struct drm_encoder *encoder;
@@ -720,7 +722,7 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)/* Right function depends upon target state. */ if (funcs) { -if (connector->state->crtc && funcs->prepare) +if (new_conn_state->crtc && funcs->prepare) funcs->prepare (encoder);else if (funcs->disable) funcs->disable (encoder);
@@ -731,11 +733,11 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)drm_bridge_post_disable (encoder->bridge); } -for_each_crtc_in_state (old_state, crtc, old_crtc_state, i) { +for_each_oldnew_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. */ -if (!drm_atomic_crtc_needs_modeset (crtc->state)) +if (!drm_atomic_crtc_needs_modeset (new_crtc_state))continue ;if (!old_crtc_state->active)
@@ -748,7 +750,7 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)/* Right function depends upon target state. */ -if (crtc->state->enable && funcs->prepare) +if (new_crtc_state->enable && funcs->prepare) funcs->prepare (crtc);else if (funcs->atomic_disable) funcs->atomic_disable (crtc, old_crtc_state);
@@ -777,13 +779,13 @@ drm_atomic_helper_update_legacy_modeset_state(struct drm_device *dev, struct drm_atomic_state *old_state) {struct drm_connector *connector; -struct drm_connector_state *old_conn_state; +struct drm_connector_state *old_conn_state, *new_conn_state;struct drm_crtc *crtc; -struct drm_crtc_state *old_crtc_state; +struct drm_crtc_state *crtc_state;int i;/* clear out existing links and update dpms */ -for_each_connector_in_state (old_state, connector, old_conn_state, i) { +for_each_oldnew_connector_in_state (old_state, connector, old_conn_state, new_conn_state, i) {if (connector->encoder) {WARN_ON (!connector->encoder->crtc);
@@ -791,7 +793,7 @@ drm_atomic_helper_update_legacy_modeset_state(struct drm_device *dev, connector->encoder =NULL ; } - crtc = connector->state->crtc; + crtc = new_conn_state->crtc;if ((!crtc && old_conn_state->crtc) || (crtc &&drm_atomic_crtc_needs_modeset (crtc->state))) { struct drm_property *dpms_prop =
@@ -808,23 +810,23 @@ drm_atomic_helper_update_legacy_modeset_state(struct drm_device *dev, }/* set new links */ -for_each_connector_in_state (old_state, connector, old_conn_state, i) { -if (!connector->state->crtc) +for_each_new_connector_in_state (old_state, connector, new_conn_state, i) { +if (!new_conn_state->crtc)continue ; -if (WARN_ON (!connector->state->best_encoder)) +if (WARN_ON (!new_conn_state->best_encoder))continue ; - connector->encoder = connector->state->best_encoder; - connector->encoder->crtc = connector->state->crtc; + connector->encoder = new_conn_state->best_encoder; + connector->encoder->crtc = new_conn_state->crtc; }/* set legacy state in the crtc structure */ -for_each_crtc_in_state (old_state, crtc, old_crtc_state, i) { +for_each_new_crtc_in_state (old_state, crtc, crtc_state, i) {struct drm_plane *primary = crtc->primary; - crtc->mode = crtc->state->mode; - crtc->enabled = crtc->state->enable; + crtc->mode = crtc_state->mode; + crtc->enabled = crtc_state->enable;if (drm_atomic_get_existing_plane_state (old_state, primary) && primary->state->crtc == crtc) {
@@ -832,9 +834,9 @@ drm_atomic_helper_update_legacy_modeset_state(struct drm_device *dev, crtc->y = primary->state->src_y >>16 ; } -if (crtc->state->enable) +if (crtc_state->enable)drm_calc_timestamping_constants (crtc, - &crtc->state->adjusted_mode); + &crtc_state->adjusted_mode); } }EXPORT_SYMBOL (drm_atomic_helper_update_legacy_modeset_state);
@@ -843,20 +845,20 @@ static void crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state) { struct drm_crtc *crtc; -struct drm_crtc_state *old_crtc_state; +struct drm_crtc_state *crtc_state;struct drm_connector *connector; -struct drm_connector_state *old_conn_state; +struct drm_connector_state *conn_state;int i; -for_each_crtc_in_state (old_state, crtc, old_crtc_state, i) { +for_each_new_crtc_in_state (old_state, crtc, crtc_state, i) {const struct drm_crtc_helper_funcs *funcs; -if (!crtc->state->mode_changed) +if (!crtc_state->mode_changed)continue ; funcs = crtc->helper_private; -if (crtc->state->enable && funcs->mode_set_nofb) { +if (crtc_state->enable && funcs->mode_set_nofb) {DRM_DEBUG_ATOMIC ("modeset on [CRTC:%d:%s]\n" , crtc->base.id, crtc->name);
@@ -864,18 +866,18 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state) } } -for_each_connector_in_state (old_state, connector, old_conn_state, i) { +for_each_new_connector_in_state (old_state, connector, conn_state, i) {const struct drm_encoder_helper_funcs *funcs;struct drm_crtc_state *new_crtc_state;struct drm_encoder *encoder;struct drm_display_mode *mode, *adjusted_mode; -if (!connector->state->best_encoder) +if (!conn_state->best_encoder)continue ; - encoder = connector->state->best_encoder; + encoder = conn_state->best_encoder; funcs = encoder->helper_private; - new_crtc_state = connector->state->crtc->state; + new_crtc_state = conn_state->crtc->state; mode = &new_crtc_state->mode; adjusted_mode = &new_crtc_state->adjusted_mode;
@@ -891,7 +893,7 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state)*/ if (funcs && funcs->atomic_mode_set) { funcs->atomic_mode_set (encoder, new_crtc_state, - connector->state); + conn_state); }else if (funcs && funcs->mode_set) { funcs->mode_set (encoder, mode, adjusted_mode); }
@@ -943,24 +945,24 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev, struct drm_atomic_state *old_state) {struct drm_crtc *crtc; -struct drm_crtc_state *old_crtc_state; +struct drm_crtc_state *crtc_state;struct drm_connector *connector; -struct drm_connector_state *old_conn_state; +struct drm_connector_state *conn_state;int i; -for_each_crtc_in_state (old_state, crtc, old_crtc_state, i) { +for_each_new_crtc_in_state (old_state, crtc, crtc_state, i) {const struct drm_crtc_helper_funcs *funcs;/* Need to filter out CRTCs where only planes change. */ -if (!drm_atomic_crtc_needs_modeset (crtc->state)) +if (!drm_atomic_crtc_needs_modeset (crtc_state))continue ; -if (!crtc->state->active) +if (!crtc_state->active)continue ; funcs = crtc->helper_private; -if (crtc->state->enable) { +if (crtc_state->enable) {DRM_DEBUG_ATOMIC ("enabling [CRTC:%d:%s]\n" , crtc->base.id, crtc->name);
@@ -971,18 +973,18 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev, } } -for_each_connector_in_state (old_state, connector, old_conn_state, i) { +for_each_new_connector_in_state (old_state, connector, conn_state, i) {const struct drm_encoder_helper_funcs *funcs;struct drm_encoder *encoder; -if (!connector->state->best_encoder) +if (!conn_state->best_encoder)continue ; -if (!connector->state->crtc->state->active || - !drm_atomic_crtc_needs_modeset (connector->state->crtc->state)) +if (!conn_state->crtc->state->active || + !drm_atomic_crtc_needs_modeset (conn_state->crtc->state))continue ; - encoder = connector->state->best_encoder; + encoder = conn_state->best_encoder; funcs = encoder->helper_private; DRM_DEBUG_ATOMIC("enabling [ENCODER:%d:%s]\n",
@@ -1027,10 +1029,7 @@ int drm_atomic_helper_wait_for_fences(struct drm_device *dev,struct drm_plane_state *plane_state;int i, ret; -for_each_plane_in_state (state, plane, plane_state, i) { -if (!pre_swap) - plane_state = plane->state; - +for_each_new_plane_in_state (state, plane, plane_state, i) {if (!plane_state->fence)continue ;
@@ -1072,15 +1071,15 @@ bool drm_atomic_helper_framebuffer_changed(struct drm_device *dev, struct drm_crtc *crtc) {struct drm_plane *plane; -struct drm_plane_state *old_plane_state; +struct drm_plane_state *old_plane_state, *new_plane_state;int i; -for_each_plane_in_state (old_state, plane, old_plane_state, i) { -if (plane->state->crtc != crtc && +for_each_oldnew_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 ; -if (plane->state->fb != old_plane_state->fb) +if (new_plane_state->fb != old_plane_state->fb)return true; }
@@ -1104,21 +1103,21 @@ drm_atomic_helper_wait_for_vblanks(struct drm_device *dev, struct drm_atomic_state *old_state) { struct drm_crtc *crtc; - struct drm_crtc_state *old_crtc_state; + struct drm_crtc_state *old_crtc_state, *new_crtc_state; int i, ret; - for_each_crtc_in_state(old_state, crtc, old_crtc_state, i) { + /* Legacy cursor ioctls are completely unsynced, and userspace + * relies on that (by doing tons of cursor updates). */ + if (old_state->legacy_cursor_update) + return; + + for_each_oldnew_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. */ old_crtc_state->enable = false; - if (!crtc->state->enable) - continue; - - /* Legacy cursor ioctls are completely unsynced, and userspace - * relies on that (by doing tons of cursor updates). */ - if (old_state->legacy_cursor_update) + if (!new_crtc_state->enable) continue; if (!drm_atomic_helper_framebuffer_changed(dev,
@@ -1133,7 +1132,7 @@ drm_atomic_helper_wait_for_vblanks(struct drm_device *dev, old_crtc_state->last_vblank_count =drm_crtc_vblank_count (crtc); } -for_each_crtc_in_state (old_state, crtc, old_crtc_state, i) { +for_each_old_crtc_in_state (old_state, crtc, old_crtc_state, i) {if (!old_crtc_state->enable)continue ;
@@ -1432,11 +1431,11 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state, bool nonblock) {struct drm_crtc *crtc; -struct drm_crtc_state *crtc_state; +struct drm_crtc_state *old_crtc_state, *crtc_state;struct drm_crtc_commit *commit;int i, ret; -for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, crtc_state, i) { commit =kzalloc (sizeof (*commit),GFP_KERNEL );if (!commit)return -ENOMEM ;
@@ -1457,7 +1456,7 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state,/* Drivers only send out events when at least either current or * new CRTC state is active. Complete right away if everything * stays off. */ -if (!crtc->state->active && !crtc_state->active) { +if (!old_crtc_state->active && !crtc_state->active) {complete_all (&commit->flip_done);continue ; }
@@ -1521,7 +1520,7 @@ void drm_atomic_helper_wait_for_dependencies(struct drm_atomic_state *state)int i;long ret; -for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, crtc_state, i) {spin_lock (&crtc->commit_lock); commit =preceeding_commit (crtc);if (commit)
@@ -1572,13 +1571,13 @@ void drm_atomic_helper_commit_hw_done(struct drm_atomic_state *state)struct drm_crtc_commit *commit;int i; -for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, crtc_state, i) { commit = state->crtcs[i].commit;if (!commit)continue ;/* backend must have consumed any event by now */ -WARN_ON (crtc->state->event); +WARN_ON (crtc_state->event);spin_lock (&crtc->commit_lock);complete_all (&commit->hw_done);spin_unlock (&crtc->commit_lock);
@@ -1605,7 +1604,7 @@ void drm_atomic_helper_commit_cleanup_done(struct drm_atomic_state *state)int i;long ret; -for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, crtc_state, i) { commit = state->crtcs[i].commit;if (WARN_ON (!commit))continue ;
@@ -1658,7 +1657,7 @@ int drm_atomic_helper_prepare_planes(struct drm_device *dev,struct drm_plane_state *plane_state;int ret, i, j; -for_each_plane_in_state (state, plane, plane_state, i) { +for_each_new_plane_in_state (state, plane, plane_state, i) {const struct drm_plane_helper_funcs *funcs; funcs = plane->helper_private;
@@ -1676,7 +1675,7 @@ int drm_atomic_helper_prepare_planes(struct drm_device *dev,return 0 ; fail: -for_each_plane_in_state (state, plane, plane_state, j) { +for_each_new_plane_in_state (state, plane, plane_state, j) {const struct drm_plane_helper_funcs *funcs;if (j >= i)
@@ -1746,14 +1745,14 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev, uint32_t flags) {struct drm_crtc *crtc; -struct drm_crtc_state *old_crtc_state; +struct drm_crtc_state *old_crtc_state, *new_crtc_state;struct drm_plane *plane; -struct drm_plane_state *old_plane_state; +struct drm_plane_state *old_plane_state, *new_plane_state;int i;bool active_only = flags &DRM_PLANE_COMMIT_ACTIVE_ONLY ;bool no_disable = flags &DRM_PLANE_COMMIT_NO_DISABLE_AFTER_MODESET ; -for_each_crtc_in_state (old_state, crtc, old_crtc_state, i) { +for_each_oldnew_crtc_in_state (old_state, crtc, old_crtc_state, new_crtc_state, i) {const struct drm_crtc_helper_funcs *funcs; funcs = crtc->helper_private;
@@ -1761,13 +1760,13 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev,if (!funcs || !funcs->atomic_begin)continue ; -if (active_only && !crtc->state->active) +if (active_only && !new_crtc_state->active)continue ; funcs->atomic_begin (crtc, old_crtc_state); } -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) {const struct drm_plane_helper_funcs *funcs;bool disabling;
@@ -1786,7 +1785,7 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev,* CRTC to avoid skipping planes being disabled on an * active CRTC. */ -if (!disabling && !plane_crtc_active (plane->state)) +if (!disabling && !plane_crtc_active (new_plane_state))continue ;if (disabling && !plane_crtc_active (old_plane_state))continue ;
@@ -1805,12 +1804,12 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev,continue ; funcs->atomic_disable (plane, old_plane_state); - }else if (plane->state->crtc || disabling) { + }else if (new_plane_state->crtc || disabling) { funcs->atomic_update (plane, old_plane_state); } } -for_each_crtc_in_state (old_state, crtc, old_crtc_state, i) { +for_each_oldnew_crtc_in_state (old_state, crtc, old_crtc_state, new_crtc_state, i) {const struct drm_crtc_helper_funcs *funcs; funcs = crtc->helper_private;
@@ -1818,7 +1817,7 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev,if (!funcs || !funcs->atomic_flush)continue ; -if (active_only && !crtc->state->active) +if (active_only && !new_crtc_state->active)continue ; funcs->atomic_flush (crtc, old_crtc_state);
@@ -1945,12 +1944,19 @@ void drm_atomic_helper_cleanup_planes(struct drm_device *dev, struct drm_atomic_state *old_state) {struct drm_plane *plane; -struct drm_plane_state *plane_state; +struct drm_plane_state *plane_state, *new_plane_state;int i; -for_each_plane_in_state (old_state, plane, plane_state, i) { +for_each_oldnew_plane_in_state (old_state, plane, plane_state, new_plane_state, i) {const struct drm_plane_helper_funcs *funcs; +/* +* This might be called before swapping when commit is aborted, +* in which case we have to free the new state. +*/ +if (plane_state == plane->state) + plane_state = new_plane_state; +if (!drm_atomic_helper_framebuffer_changed (dev, old_state, plane_state->crtc))continue ;
@@ -1998,15 +2004,15 @@ void drm_atomic_helper_swap_state(struct drm_atomic_state *state,int i;long ret;struct drm_connector *connector; -struct drm_connector_state *conn_state; +struct drm_connector_state *old_conn_state, *new_conn_state;struct drm_crtc *crtc; -struct drm_crtc_state *crtc_state; +struct drm_crtc_state *old_crtc_state, *new_crtc_state;struct drm_plane *plane; -struct drm_plane_state *plane_state; +struct drm_plane_state *old_plane_state, *new_plane_state;struct drm_crtc_commit *commit;if (stall) { -for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) {spin_lock (&crtc->commit_lock); commit =list_first_entry_or_null (&crtc->commit_list, struct drm_crtc_commit, commit_entry);
@@ -2026,16 +2032,20 @@ void drm_atomic_helper_swap_state(struct drm_atomic_state *state, } } -for_each_connector_in_state (state, connector, conn_state, i) { - connector->state->state = state; -swap (state->connectors[i].state, connector->state); - connector->state->state =NULL ; +for_each_oldnew_connector_in_state (state, connector, old_conn_state, new_conn_state, i) { + old_conn_state->state = state; + new_conn_state->state =NULL ; + + state->connectors[i].state = old_conn_state; + connector->state = new_conn_state; } -for_each_crtc_in_state (state, crtc, crtc_state, i) { - crtc->state->state = state; -swap (state->crtcs[i].state, crtc->state); - crtc->state->state =NULL ; +for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) { + old_crtc_state->state = state; + new_crtc_state->state =NULL ; + + state->crtcs[i].state = old_crtc_state; + crtc->state = new_crtc_state;if (state->crtcs[i].commit) {spin_lock (&crtc->commit_lock);
@@ -2047,10 +2057,12 @@ void drm_atomic_helper_swap_state(struct drm_atomic_state *state, } } -for_each_plane_in_state (state, plane, plane_state, i) { - plane->state->state = state; -swap (state->planes[i].state, plane->state); - plane->state->state =NULL ; +for_each_oldnew_plane_in_state (state, plane, old_plane_state, new_plane_state, i) { + old_plane_state->state = state; + new_plane_state->state =NULL ; + + state->planes[i].state = old_plane_state; + plane->state = new_plane_state; } }EXPORT_SYMBOL (drm_atomic_helper_swap_state);
@@ -2248,7 +2260,7 @@ static int update_output_state(struct drm_atomic_state *state,if (ret)return ret; -for_each_connector_in_state (state, connector, conn_state, i) { +for_each_new_connector_in_state (state, connector, conn_state, i) {if (conn_state->crtc == set->crtc) { ret =drm_atomic_set_crtc_for_connector (conn_state,NULL );
@@ -2270,7 +2282,7 @@ static int update_output_state(struct drm_atomic_state *state,return ret; } -for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, crtc_state, i) {/* Don't update ->enable for the CRTC in the set_config request, * since a mismatch would indicate a bug in the upper layers. * The actual modeset code later on will catch any
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 07/19] drm/atomic: Fix atomic helpers to use the new iterator macros.
Quoted 287 lines · Maarten Lankhorst
Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/drm_atomic_helper.c | 302 +++++++++++++++++++----------------- 1 file changed, 157 insertions(+), 145 deletions(-)drivers/gpu/drm/drm_atomic_helper.c +49
-47@@ -103,7 +103,7 @@ static int handle_conflicting_encoders(struct drm_atomic_state *state,* part of the state. If the same encoder is assigned to multiple * connectors bail out. */ -for_each_connector_in_state (state, connector, conn_state, i) { +for_each_new_connector_in_state (state, connector, conn_state, i) {const struct drm_connector_helper_funcs *funcs = connector->helper_private;struct drm_encoder *new_encoder;@@ -238,22 +238,22 @@ steal_encoder(struct drm_atomic_state *state, {struct drm_crtc_state *crtc_state;struct drm_connector *connector; -struct drm_connector_state *connector_state; +struct drm_connector_state *old_connector_state, *new_connector_state;int i; -for_each_connector_in_state (state, connector, connector_state, i) { +for_each_oldnew_connector_in_state (state, connector, old_connector_state, new_connector_state, i) {struct drm_crtc *encoder_crtc; -if (connector_state->best_encoder != encoder) +if (new_connector_state->best_encoder != encoder)continue ; - encoder_crtc = connector->state->crtc; + encoder_crtc = old_connector_state->crtc;DRM_DEBUG_ATOMIC ("[ENCODER:%d:%s] in use on [CRTC:%d:%s], stealing it\n" , encoder->base.id, encoder->name, encoder_crtc->base.id, encoder_crtc->name); -set_best_encoder (state, connector_state,NULL ); +set_best_encoder (state, new_connector_state,NULL ); crtc_state =drm_atomic_get_existing_crtc_state (state, encoder_crtc); crtc_state->connectors_changed = true;@@ -265,7 +265,8 @@ steal_encoder(struct drm_atomic_state *state,static int update_connector_routing (struct drm_atomic_state *state,struct drm_connector *connector, -struct drm_connector_state *connector_state) +struct drm_connector_state *old_connector_state, +struct drm_connector_state *new_connector_state) {const struct drm_connector_helper_funcs *funcs;struct drm_encoder *new_encoder;@@ -275,24 +276,24 @@ update_connector_routing(struct drm_atomic_state *state, connector->base.id, connector->name); -if (connector->state->crtc != connector_state->crtc) { -if (connector->state->crtc) { - crtc_state =drm_atomic_get_existing_crtc_state (state, connector->state->crtc); +if (old_connector_state->crtc != new_connector_state->crtc) { +if (old_connector_state->crtc) { + crtc_state =drm_atomic_get_existing_crtc_state (state, old_connector_state->crtc); crtc_state->connectors_changed = true; } -if (connector_state->crtc) { - crtc_state =drm_atomic_get_existing_crtc_state (state, connector_state->crtc); +if (new_connector_state->crtc) { + crtc_state =drm_atomic_get_existing_crtc_state (state, new_connector_state->crtc); crtc_state->connectors_changed = true; } } -if (!connector_state->crtc) { +if (!new_connector_state->crtc) {DRM_DEBUG_ATOMIC ("Disabling [CONNECTOR:%d:%s]\n" , connector->base.id, connector->name); -set_best_encoder (state, connector_state,NULL ); +set_best_encoder (state, new_connector_state,NULL );return 0 ; }@@ -301,7 +302,7 @@ update_connector_routing(struct drm_atomic_state *state,if (funcs->atomic_best_encoder) new_encoder = funcs->atomic_best_encoder (connector, - connector_state); + new_connector_state);else if (funcs->best_encoder) new_encoder = funcs->best_encoder (connector);else @@ -314,33 +315,33 @@ update_connector_routing(struct drm_atomic_state *state,return -EINVAL ; } -if (!drm_encoder_crtc_ok (new_encoder, connector_state->crtc)) { +if (!drm_encoder_crtc_ok (new_encoder, new_connector_state->crtc)) {DRM_DEBUG_ATOMIC ("[ENCODER:%d:%s] incompatible with [CRTC:%d]\n" , new_encoder->base.id, new_encoder->name, - connector_state->crtc->base.id); + new_connector_state->crtc->base.id);return -EINVAL ; } -if (new_encoder == connector_state->best_encoder) { -set_best_encoder (state, connector_state, new_encoder); +if (new_encoder == new_connector_state->best_encoder) { +set_best_encoder (state, new_connector_state, new_encoder);DRM_DEBUG_ATOMIC ("[CONNECTOR:%d:%s] keeps [ENCODER:%d:%s], now on [CRTC:%d:%s]\n" , connector->base.id, connector->name, new_encoder->base.id, new_encoder->name, - connector_state->crtc->base.id, - connector_state->crtc->name); + new_connector_state->crtc->base.id, + new_connector_state->crtc->name);return 0 ; }steal_encoder (state, new_encoder); -set_best_encoder (state, connector_state, new_encoder); +set_best_encoder (state, new_connector_state, new_encoder); - crtc_state =drm_atomic_get_existing_crtc_state (state, connector_state->crtc); + crtc_state =drm_atomic_get_existing_crtc_state (state, new_connector_state->crtc); crtc_state->connectors_changed = true; DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] using [ENCODER:%d:%s] on [CRTC:%d:%s]\n",@@ -348,8 +349,8 @@ update_connector_routing(struct drm_atomic_state *state, connector->name, new_encoder->base.id, new_encoder->name, - connector_state->crtc->base.id, - connector_state->crtc->name); + new_connector_state->crtc->base.id, + new_connector_state->crtc->name);return 0 ; }@@ -364,7 +365,7 @@ mode_fixup(struct drm_atomic_state *state)int i;bool ret; -for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, crtc_state, i) {if (!crtc_state->mode_changed && !crtc_state->connectors_changed)continue ;@@ -372,7 +373,7 @@ mode_fixup(struct drm_atomic_state *state)drm_mode_copy (&crtc_state->adjusted_mode, &crtc_state->mode); } -for_each_connector_in_state (state, connector, conn_state, i) { +for_each_new_connector_in_state (state, connector, conn_state, i) {const struct drm_encoder_helper_funcs *funcs;struct drm_encoder *encoder;@@ -417,7 +418,7 @@ mode_fixup(struct drm_atomic_state *state) } } -for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, crtc_state, i) {const struct drm_crtc_helper_funcs *funcs;if (!crtc_state->enable)@@ -476,19 +477,19 @@ drm_atomic_helper_check_modeset(struct drm_device *dev, struct drm_atomic_state *state) {struct drm_crtc *crtc; -struct drm_crtc_state *crtc_state; +struct drm_crtc_state *old_crtc_state, *new_crtc_state;struct drm_connector *connector; -struct drm_connector_state *connector_state; +struct drm_connector_state *old_connector_state, *new_connector_state;int i, ret; -for_each_crtc_in_state (state, crtc, crtc_state, i) { -if (!drm_mode_equal (&crtc->state->mode, &crtc_state->mode)) { +for_each_oldnew_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); - crtc_state->mode_changed = true; + new_crtc_state->mode_changed = true; } -if (crtc->state->enable != crtc_state->enable) { +if (old_crtc_state->enable != new_crtc_state->enable) {DRM_DEBUG_ATOMIC ("[CRTC:%d:%s] enable changed\n" , crtc->base.id, crtc->name);@@ -500,8 +501,8 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,* The other way around is true as well. enable != 0 * iff connectors are attached and a mode is set. */ - crtc_state->mode_changed = true; - crtc_state->connectors_changed = true; + new_crtc_state->mode_changed = true; + new_crtc_state->connectors_changed = true; } }@@ -509,14 +510,15 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,if (ret)return ret; -for_each_connector_in_state (state, connector, connector_state, i) { +for_each_oldnew_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 * connector properties need to be updated. */ ret =update_connector_routing (state, connector, - connector_state); + old_connector_state, + new_connector_state);if (ret)return ret; }@@ -527,28 +529,28 @@ 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_crtc_in_state (state, crtc, crtc_state, i) { +for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) {bool has_connectors = - !!crtc_state->connector_mask; + !!new_crtc_state->connector_mask;/* * We must set ->active_changed after walking connectors for * otherwise an update that only changes active would result in * a full modeset because update_connector_routing force that. */ -if (crtc->state->active != crtc_state->active) { +if (old_crtc_state->active != new_crtc_state->active) {DRM_DEBUG_ATOMIC ("[CRTC:%d:%s] active changed\n" , crtc->base.id, crtc->name); - crtc_state->active_changed = true; + new_crtc_state->active_changed = true; } -if (!drm_atomic_crtc_needs_modeset (crtc_state)) +if (!drm_atomic_crtc_needs_modeset (new_crtc_state))continue ;DRM_DEBUG_ATOMIC ("[CRTC:%d:%s] needs all connectors, enable: %c, active: %c\n" , crtc->base.id, crtc->name, - crtc_state->enable ?'y' :'n' , - crtc_state->active ?'y' :'n' ); + new_crtc_state->enable ?'y' :'n' , + new_crtc_state->active ?'y' :'n' ); ret =drm_atomic_add_affected_connectors (state, crtc);if (ret !=0 )@@ -558,7 +560,7 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,if (ret !=0 )return ret; -if (crtc_state->enable != has_connectors) { +if (new_crtc_state->enable != has_connectors) {DRM_DEBUG_ATOMIC ("[CRTC:%d:%s] enabled/connectors mismatch\n" , crtc->base.id, crtc->name);@@ -599,7 +601,7 @@ drm_atomic_helper_check_planes(struct drm_device *dev,if (ret)return ret; -for_each_plane_in_state (state, plane, plane_state, i) { +for_each_new_plane_in_state (state, plane, plane_state, i) {const struct drm_plane_helper_funcs *funcs; funcs = plane->helper_private;
drivers/gpu/drm/drm_atomic_helper.c drm_atomic_helper_check_planes(struct drm_device *dev, · line 625
Quoted 8 lines
drivers/gpu/drm/drm_atomic_helper.c +1
-1@@ -617,7 +619,7 @@ drm_atomic_helper_check_planes(struct drm_device *dev, } } -for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, crtc_state, i) {const struct drm_crtc_helper_funcs *funcs; funcs = crtc->helper_private;
Up to here everything runs in the check phase, so the straightforwared s/state/new_state/ and s/foo->state/old_state/ looks correct.
Quoted 40 lines
drivers/gpu/drm/drm_atomic_helper.c +6
-6@@ -678,12 +680,12 @@ static void disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state) { struct drm_connector *connector; -struct drm_connector_state *old_conn_state; +struct drm_connector_state *old_conn_state, *new_conn_state;struct drm_crtc *crtc; -struct drm_crtc_state *old_crtc_state; +struct drm_crtc_state *old_crtc_state, *new_crtc_state;int i; -for_each_connector_in_state (old_state, connector, old_conn_state, i) { +for_each_oldnew_connector_in_state (old_state, connector, old_conn_state, new_conn_state, i) {const struct drm_encoder_helper_funcs *funcs;struct drm_encoder *encoder;@@ -720,7 +722,7 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)/* Right function depends upon target state. */ if (funcs) { -if (connector->state->crtc && funcs->prepare) +if (new_conn_state->crtc && funcs->prepare) funcs->prepare (encoder);else if (funcs->disable) funcs->disable (encoder);@@ -731,11 +733,11 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)drm_bridge_post_disable (encoder->bridge); } -for_each_crtc_in_state (old_state, crtc, old_crtc_state, i) { +for_each_oldnew_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. */ -if (!drm_atomic_crtc_needs_modeset (crtc->state)) +if (!drm_atomic_crtc_needs_modeset (new_crtc_state))continue ;if (!old_crtc_state->active)
drivers/gpu/drm/drm_atomic_helper.c disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state) · line 756
Quoted 8 lines
drivers/gpu/drm/drm_atomic_helper.c +1
-1@@ -748,7 +750,7 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)/* Right function depends upon target state. */ -if (crtc->state->enable && funcs->prepare) +if (new_crtc_state->enable && funcs->prepare) funcs->prepare (crtc);else if (funcs->atomic_disable) funcs->atomic_disable (crtc, old_crtc_state);
And this sucker is executed after we've swapped the state, so we need to do the s/foo->state/new_state/ replacement. Looks correct to me.
Not sure how worried I should be that we might forget some foo->state dereference somewhere. Should we try rename that pointer to something else to make sure we've caught everything?
Quoted 18 lines
drivers/gpu/drm/drm_atomic_helper.c +3
-3@@ -777,13 +779,13 @@ drm_atomic_helper_update_legacy_modeset_state(struct drm_device *dev, struct drm_atomic_state *old_state) {struct drm_connector *connector; -struct drm_connector_state *old_conn_state; +struct drm_connector_state *old_conn_state, *new_conn_state;struct drm_crtc *crtc; -struct drm_crtc_state *old_crtc_state; +struct drm_crtc_state *crtc_state;int i;/* clear out existing links and update dpms */ -for_each_connector_in_state (old_state, connector, old_conn_state, i) { +for_each_oldnew_connector_in_state (old_state, connector, old_conn_state, new_conn_state, i) {if (connector->encoder) {WARN_ON (!connector->encoder->crtc);
drivers/gpu/drm/drm_atomic_helper.c drm_atomic_helper_update_legacy_modeset_state(struct drm_device *dev, · line 798
Quoted 7 lines
drivers/gpu/drm/drm_atomic_helper.c +1
-1@@ -791,7 +793,7 @@ drm_atomic_helper_update_legacy_modeset_state(struct drm_device *dev, connector->encoder =NULL ; } - crtc = connector->state->crtc; + crtc = new_conn_state->crtc;if ((!crtc && old_conn_state->crtc) || (crtc &&drm_atomic_crtc_needs_modeset (crtc->state))) {
^^^^^^^^^^^^
Like this guy here. That should be new_crtc_state, no?
Quoted 23 lines
drivers/gpu/drm/drm_atomic_helper.c +5
-6struct drm_property *dpms_prop =@@ -808,23 +810,23 @@ drm_atomic_helper_update_legacy_modeset_state(struct drm_device *dev, }/* set new links */ -for_each_connector_in_state (old_state, connector, old_conn_state, i) { -if (!connector->state->crtc) +for_each_new_connector_in_state (old_state, connector, new_conn_state, i) { +if (!new_conn_state->crtc)continue ; -if (WARN_ON (!connector->state->best_encoder)) +if (WARN_ON (!new_conn_state->best_encoder))continue ; - connector->encoder = connector->state->best_encoder; - connector->encoder->crtc = connector->state->crtc; + connector->encoder = new_conn_state->best_encoder; + connector->encoder->crtc = new_conn_state->crtc; }/* set legacy state in the crtc structure */ -for_each_crtc_in_state (old_state, crtc, old_crtc_state, i) {
drivers/gpu/drm/drm_atomic_helper.c drm_atomic_helper_update_legacy_modeset_state(struct drm_device *dev, · line 832
Quoted 10 lines
drivers/gpu/drm/drm_atomic_helper.c +3
-2+for_each_new_crtc_in_state (old_state, crtc, crtc_state, i) {struct drm_plane *primary = crtc->primary; - crtc->mode = crtc->state->mode; - crtc->enabled = crtc->state->enable; + crtc->mode = crtc_state->mode; + crtc->enabled = crtc_state->enable;if (drm_atomic_get_existing_plane_state (old_state, primary) && primary->state->crtc == crtc) {
^^^^^^^^^^^^^^
new_plane_state or something?
Quoted 108 lines
drivers/gpu/drm/drm_atomic_helper.c +19
-19@@ -832,9 +834,9 @@ drm_atomic_helper_update_legacy_modeset_state(struct drm_device *dev, crtc->y = primary->state->src_y >>16 ; } -if (crtc->state->enable) +if (crtc_state->enable)drm_calc_timestamping_constants (crtc, - &crtc->state->adjusted_mode); + &crtc_state->adjusted_mode); } }EXPORT_SYMBOL (drm_atomic_helper_update_legacy_modeset_state);@@ -843,20 +845,20 @@ static void crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state) { struct drm_crtc *crtc; -struct drm_crtc_state *old_crtc_state; +struct drm_crtc_state *crtc_state;struct drm_connector *connector; -struct drm_connector_state *old_conn_state; +struct drm_connector_state *conn_state;int i; -for_each_crtc_in_state (old_state, crtc, old_crtc_state, i) { +for_each_new_crtc_in_state (old_state, crtc, crtc_state, i) {const struct drm_crtc_helper_funcs *funcs; -if (!crtc->state->mode_changed) +if (!crtc_state->mode_changed)continue ; funcs = crtc->helper_private; -if (crtc->state->enable && funcs->mode_set_nofb) { +if (crtc_state->enable && funcs->mode_set_nofb) {DRM_DEBUG_ATOMIC ("modeset on [CRTC:%d:%s]\n" , crtc->base.id, crtc->name);@@ -864,18 +866,18 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state) } } -for_each_connector_in_state (old_state, connector, old_conn_state, i) { +for_each_new_connector_in_state (old_state, connector, conn_state, i) {const struct drm_encoder_helper_funcs *funcs;struct drm_crtc_state *new_crtc_state;struct drm_encoder *encoder;struct drm_display_mode *mode, *adjusted_mode; -if (!connector->state->best_encoder) +if (!conn_state->best_encoder)continue ; - encoder = connector->state->best_encoder; + encoder = conn_state->best_encoder; funcs = encoder->helper_private; - new_crtc_state = connector->state->crtc->state; + new_crtc_state = conn_state->crtc->state; mode = &new_crtc_state->mode; adjusted_mode = &new_crtc_state->adjusted_mode;@@ -891,7 +893,7 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state)*/ if (funcs && funcs->atomic_mode_set) { funcs->atomic_mode_set (encoder, new_crtc_state, - connector->state); + conn_state); }else if (funcs && funcs->mode_set) { funcs->mode_set (encoder, mode, adjusted_mode); }@@ -943,24 +945,24 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev, struct drm_atomic_state *old_state) {struct drm_crtc *crtc; -struct drm_crtc_state *old_crtc_state; +struct drm_crtc_state *crtc_state;struct drm_connector *connector; -struct drm_connector_state *old_conn_state; +struct drm_connector_state *conn_state;int i; -for_each_crtc_in_state (old_state, crtc, old_crtc_state, i) { +for_each_new_crtc_in_state (old_state, crtc, crtc_state, i) {const struct drm_crtc_helper_funcs *funcs;/* Need to filter out CRTCs where only planes change. */ -if (!drm_atomic_crtc_needs_modeset (crtc->state)) +if (!drm_atomic_crtc_needs_modeset (crtc_state))continue ; -if (!crtc->state->active) +if (!crtc_state->active)continue ; funcs = crtc->helper_private; -if (crtc->state->enable) { +if (crtc_state->enable) {DRM_DEBUG_ATOMIC ("enabling [CRTC:%d:%s]\n" , crtc->base.id, crtc->name);@@ -971,18 +973,18 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev, } } -for_each_connector_in_state (old_state, connector, old_conn_state, i) { +for_each_new_connector_in_state (old_state, connector, conn_state, i) {const struct drm_encoder_helper_funcs *funcs;
drivers/gpu/drm/drm_atomic_helper.c void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev, · line 984
Quoted 10 lines
drivers/gpu/drm/drm_atomic_helper.c +3
-3struct drm_encoder *encoder; -if (!connector->state->best_encoder) +if (!conn_state->best_encoder)continue ; -if (!connector->state->crtc->state->active || - !drm_atomic_crtc_needs_modeset (connector->state->crtc->state)) +if (!conn_state->crtc->state->active || + !drm_atomic_crtc_needs_modeset (conn_state->crtc->state))
More foo->state stuff remaining
Quoted 8 lines
drivers/gpu/drm/drm_atomic_helper.c +1
-1continue ; - encoder = connector->state->best_encoder; + encoder = conn_state->best_encoder; funcs = encoder->helper_private; DRM_DEBUG_ATOMIC("enabling [ENCODER:%d:%s]\n",
drivers/gpu/drm/drm_atomic_helper.c int drm_atomic_helper_wait_for_fences(struct drm_device *dev, · line 1032
Quoted 8 lines
drivers/gpu/drm/drm_atomic_helper.c +1
-4@@ -1027,10 +1029,7 @@ int drm_atomic_helper_wait_for_fences(struct drm_device *dev,struct drm_plane_state *plane_state;int i, ret; -for_each_plane_in_state (state, plane, plane_state, i) { -if (!pre_swap) - plane_state = plane->state; - +for_each_new_plane_in_state (state, plane, plane_state, i) {
Nice. Can we kill the pre_swap flag now? Hmm, no, we pass it to dma_fence_wait() to indicate interruptible vs. not. Maybe we can rename it to convey its only remaining function better?
Quoted 12 lines
drivers/gpu/drm/drm_atomic_helper.c +1
-2if (!plane_state->fence)continue ;@@ -1072,15 +1071,15 @@ bool drm_atomic_helper_framebuffer_changed(struct drm_device *dev, struct drm_crtc *crtc) {struct drm_plane *plane; -struct drm_plane_state *old_plane_state; +struct drm_plane_state *old_plane_state, *new_plane_state;int i; -for_each_plane_in_state (old_state, plane, old_plane_state, i) {
drivers/gpu/drm/drm_atomic_helper.c bool drm_atomic_helper_framebuffer_changed(struct drm_device *dev, · line 1084
Quoted 10 lines
drivers/gpu/drm/drm_atomic_helper.c +3
-2-if (plane->state->crtc != crtc && +for_each_oldnew_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 ; -if (plane->state->fb != old_plane_state->fb) +if (new_plane_state->fb != old_plane_state->fb)return true; }
This thing was totally broken, but I guess now it actually should work regardless of when we call it. Cool.
I was actually wonder if we manage to plumb the old+new state everywhere maybe we could kill off some of the need_whatever flags? Not quite sure.
Quoted 5 lines
drivers/gpu/drm/drm_atomic_helper.c +0
-0@@ -1104,21 +1103,21 @@ drm_atomic_helper_wait_for_vblanks(struct drm_device *dev, struct drm_atomic_state *old_state) {struct drm_crtc *crtc;
drivers/gpu/drm/drm_atomic_helper.c drm_atomic_helper_wait_for_vblanks(struct drm_device *dev, · line 1113
Quoted 10 lines
drivers/gpu/drm/drm_atomic_helper.c +6
-2-struct drm_crtc_state *old_crtc_state; +struct drm_crtc_state *old_crtc_state, *new_crtc_state;int i, ret; -for_each_crtc_in_state (old_state, crtc, old_crtc_state, i) { +/* Legacy cursor ioctls are completely unsynced, and userspace +* relies on that (by doing tons of cursor updates). */ +if (old_state->legacy_cursor_update) +return ; +
We seem to have a change of behaviour here. Should be in a separate patch if we actually want it.
Quoted 17 lines
drivers/gpu/drm/drm_atomic_helper.c +2
-6+ for_each_oldnew_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. */ old_crtc_state->enable = false; -if (!crtc->state->enable) -continue ; - -/* Legacy cursor ioctls are completely unsynced, and userspace -* relies on that (by doing tons of cursor updates). */ -if (old_state->legacy_cursor_update) + if (!new_crtc_state->enable) continue; if (!drm_atomic_helper_framebuffer_changed(dev,
drivers/gpu/drm/drm_atomic_helper.c drm_atomic_helper_wait_for_vblanks(struct drm_device *dev, · line 1138
Quoted 8 lines
drivers/gpu/drm/drm_atomic_helper.c +1
-1@@ -1133,7 +1132,7 @@ drm_atomic_helper_wait_for_vblanks(struct drm_device *dev, old_crtc_state->last_vblank_count =drm_crtc_vblank_count (crtc); } -for_each_crtc_in_state (old_state, crtc, old_crtc_state, i) { +for_each_old_crtc_in_state (old_state, crtc, old_crtc_state, i) {if (!old_crtc_state->enable)continue ;
I think pretty much evething up to this point (from the last checkpoint) is executed after swapping the state, with drm_atomic_helper_framebuffer_changed() being the oddball that might be called from anywhere.
Quoted 15 lines
drivers/gpu/drm/drm_atomic_helper.c +2
-2@@ -1432,11 +1431,11 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state, bool nonblock) {struct drm_crtc *crtc; -struct drm_crtc_state *crtc_state; +struct drm_crtc_state *old_crtc_state, *crtc_state;struct drm_crtc_commit *commit;int i, ret; -for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, crtc_state, i) { commit =kzalloc (sizeof (*commit),GFP_KERNEL );if (!commit)return -ENOMEM ;
drivers/gpu/drm/drm_atomic_helper.c int drm_atomic_helper_setup_commit(struct drm_atomic_state *state, · line 1462
Quoted 8 lines
drivers/gpu/drm/drm_atomic_helper.c +1
-1@@ -1457,7 +1456,7 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state,/* Drivers only send out events when at least either current or * new CRTC state is active. Complete right away if everything * stays off. */ -if (!crtc->state->active && !crtc_state->active) { +if (!old_crtc_state->active && !crtc_state->active) {complete_all (&commit->flip_done);continue ; }
This guy is pre state swap. Looks correct.
drivers/gpu/drm/drm_atomic_helper.c void drm_atomic_helper_wait_for_dependencies(struct drm_atomic_state *state) · line 1523
Quoted 6 lines
drivers/gpu/drm/drm_atomic_helper.c +1
-1@@ -1521,7 +1520,7 @@ void drm_atomic_helper_wait_for_dependencies(struct drm_atomic_state *state)int i;long ret; -for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, crtc_state, i) {
This is post state swap, but we don't actually use the new or the old state here, so this looks fine.
Quoted 6 lines
drivers/gpu/drm/drm_atomic_helper.c +0
-0spin_lock (&crtc->commit_lock); commit =preceeding_commit (crtc);if (commit)@@ -1572,13 +1571,13 @@ void drm_atomic_helper_commit_hw_done(struct drm_atomic_state *state)struct drm_crtc_commit *commit;int i;
drivers/gpu/drm/drm_atomic_helper.c void drm_atomic_helper_commit_hw_done(struct drm_atomic_state *state) · line 1580
Quoted 10 lines
drivers/gpu/drm/drm_atomic_helper.c +2
-2-for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, crtc_state, i) { commit = state->crtcs[i].commit;if (!commit)continue ;/* backend must have consumed any event by now */ -WARN_ON (crtc->state->event); +WARN_ON (crtc_state->event);
Post swap. Looks correct.
drivers/gpu/drm/drm_atomic_helper.c void drm_atomic_helper_commit_cleanup_done(struct drm_atomic_state *state) · line 1607
Quoted 9 lines
drivers/gpu/drm/drm_atomic_helper.c +1
-1spin_lock (&crtc->commit_lock);complete_all (&commit->hw_done);spin_unlock (&crtc->commit_lock);@@ -1605,7 +1604,7 @@ void drm_atomic_helper_commit_cleanup_done(struct drm_atomic_state *state)int i;long ret; -for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, crtc_state, i) {
Post swap. State not used, so fine.
Quoted 13 lines
drivers/gpu/drm/drm_atomic_helper.c +1
-1commit = state->crtcs[i].commit;if (WARN_ON (!commit))continue ;@@ -1658,7 +1657,7 @@ int drm_atomic_helper_prepare_planes(struct drm_device *dev,struct drm_plane_state *plane_state;int ret, i, j; -for_each_plane_in_state (state, plane, plane_state, i) { +for_each_new_plane_in_state (state, plane, plane_state, i) {const struct drm_plane_helper_funcs *funcs; funcs = plane->helper_private;
drivers/gpu/drm/drm_atomic_helper.c int drm_atomic_helper_prepare_planes(struct drm_device *dev, · line 1678
Quoted 5 lines
drivers/gpu/drm/drm_atomic_helper.c +1
-1@@ -1676,7 +1675,7 @@ int drm_atomic_helper_prepare_planes(struct drm_device *dev,return 0 ; fail: -for_each_plane_in_state (state, plane, plane_state, j) { +for_each_new_plane_in_state (state, plane, plane_state, j) {
Pre swap stuff. Fine.
Quoted 78 lines
drivers/gpu/drm/drm_atomic_helper.c +10
-10const struct drm_plane_helper_funcs *funcs;if (j >= i)@@ -1746,14 +1745,14 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev, uint32_t flags) {struct drm_crtc *crtc; -struct drm_crtc_state *old_crtc_state; +struct drm_crtc_state *old_crtc_state, *new_crtc_state;struct drm_plane *plane; -struct drm_plane_state *old_plane_state; +struct drm_plane_state *old_plane_state, *new_plane_state;int i;bool active_only = flags &DRM_PLANE_COMMIT_ACTIVE_ONLY ;bool no_disable = flags &DRM_PLANE_COMMIT_NO_DISABLE_AFTER_MODESET ; -for_each_crtc_in_state (old_state, crtc, old_crtc_state, i) { +for_each_oldnew_crtc_in_state (old_state, crtc, old_crtc_state, new_crtc_state, i) {const struct drm_crtc_helper_funcs *funcs; funcs = crtc->helper_private;@@ -1761,13 +1760,13 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev,if (!funcs || !funcs->atomic_begin)continue ; -if (active_only && !crtc->state->active) +if (active_only && !new_crtc_state->active)continue ; funcs->atomic_begin (crtc, old_crtc_state); } -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) {const struct drm_plane_helper_funcs *funcs;bool disabling;@@ -1786,7 +1785,7 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev,* CRTC to avoid skipping planes being disabled on an * active CRTC. */ -if (!disabling && !plane_crtc_active (plane->state)) +if (!disabling && !plane_crtc_active (new_plane_state))continue ;if (disabling && !plane_crtc_active (old_plane_state))continue ;@@ -1805,12 +1804,12 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev,continue ; funcs->atomic_disable (plane, old_plane_state); - }else if (plane->state->crtc || disabling) { + }else if (new_plane_state->crtc || disabling) { funcs->atomic_update (plane, old_plane_state); } } -for_each_crtc_in_state (old_state, crtc, old_crtc_state, i) { +for_each_oldnew_crtc_in_state (old_state, crtc, old_crtc_state, new_crtc_state, i) {const struct drm_crtc_helper_funcs *funcs; funcs = crtc->helper_private;@@ -1818,7 +1817,7 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev,if (!funcs || !funcs->atomic_flush)continue ; -if (active_only && !crtc->state->active) +if (active_only && !new_crtc_state->active)continue ; funcs->atomic_flush (crtc, old_crtc_state);@@ -1945,12 +1944,19 @@ void drm_atomic_helper_cleanup_planes(struct drm_device *dev, struct drm_atomic_state *old_state) {struct drm_plane *plane; -struct drm_plane_state *plane_state; +struct drm_plane_state *plane_state, *new_plane_state;int i;
drivers/gpu/drm/drm_atomic_helper.c void drm_atomic_helper_cleanup_planes(struct drm_device *dev, · line 1958
Quoted 10 lines
drivers/gpu/drm/drm_atomic_helper.c +7
-1-for_each_plane_in_state (old_state, plane, plane_state, i) { +for_each_oldnew_plane_in_state (old_state, plane, plane_state, new_plane_state, i) {const struct drm_plane_helper_funcs *funcs; +/* +* This might be called before swapping when commit is aborted, +* in which case we have to free the new state. +*/ +if (plane_state == plane->state) + plane_state = new_plane_state;
Oh dear. Can we make this nicer somehow? I can't actually see any use like that currently. Am I blind?
I was wondering if we should add some kind of asserts to a bunch of these functions to make sure they are called during the correct phase of the operation. We could track the progress in the top level state I guess.
Quoted 59 lines
drivers/gpu/drm/drm_atomic_helper.c +17
-14+if (!drm_atomic_helper_framebuffer_changed (dev, old_state, plane_state->crtc))continue ;@@ -1998,15 +2004,15 @@ void drm_atomic_helper_swap_state(struct drm_atomic_state *state,int i;long ret;struct drm_connector *connector; -struct drm_connector_state *conn_state; +struct drm_connector_state *old_conn_state, *new_conn_state;struct drm_crtc *crtc; -struct drm_crtc_state *crtc_state; +struct drm_crtc_state *old_crtc_state, *new_crtc_state;struct drm_plane *plane; -struct drm_plane_state *plane_state; +struct drm_plane_state *old_plane_state, *new_plane_state;struct drm_crtc_commit *commit;if (stall) { -for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) {spin_lock (&crtc->commit_lock); commit =list_first_entry_or_null (&crtc->commit_list, struct drm_crtc_commit, commit_entry);@@ -2026,16 +2032,20 @@ void drm_atomic_helper_swap_state(struct drm_atomic_state *state, } } -for_each_connector_in_state (state, connector, conn_state, i) { - connector->state->state = state; -swap (state->connectors[i].state, connector->state); - connector->state->state =NULL ; +for_each_oldnew_connector_in_state (state, connector, old_conn_state, new_conn_state, i) { + old_conn_state->state = state; + new_conn_state->state =NULL ; + + state->connectors[i].state = old_conn_state; + connector->state = new_conn_state; } -for_each_crtc_in_state (state, crtc, crtc_state, i) { - crtc->state->state = state; -swap (state->crtcs[i].state, crtc->state); - crtc->state->state =NULL ; +for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) { + old_crtc_state->state = state; + new_crtc_state->state =NULL ; + + state->crtcs[i].state = old_crtc_state; + crtc->state = new_crtc_state;if (state->crtcs[i].commit) {spin_lock (&crtc->commit_lock);@@ -2047,10 +2057,12 @@ void drm_atomic_helper_swap_state(struct drm_atomic_state *state, } } -for_each_plane_in_state (state, plane, plane_state, i) { - plane->state->state = state;
drivers/gpu/drm/drm_atomic_helper.c void drm_atomic_helper_swap_state(struct drm_atomic_state *state, · line 2067
Quoted 10 lines
drivers/gpu/drm/drm_atomic_helper.c +6
-2-swap (state->planes[i].state, plane->state); - plane->state->state =NULL ; +for_each_oldnew_plane_in_state (state, plane, old_plane_state, new_plane_state, i) { + old_plane_state->state = state; + new_plane_state->state =NULL ; + + state->planes[i].state = old_plane_state; + plane->state = new_plane_state; } }
lgtm
Quoted 11 lines
drivers/gpu/drm/drm_atomic_helper.c +1
-1EXPORT_SYMBOL (drm_atomic_helper_swap_state);@@ -2248,7 +2260,7 @@ static int update_output_state(struct drm_atomic_state *state,if (ret)return ret; -for_each_connector_in_state (state, connector, conn_state, i) { +for_each_new_connector_in_state (state, connector, conn_state, i) {if (conn_state->crtc == set->crtc) { ret =drm_atomic_set_crtc_for_connector (conn_state,NULL );
drivers/gpu/drm/drm_atomic_helper.c static int update_output_state(struct drm_atomic_state *state, · line 2288
Quoted 8 lines
drivers/gpu/drm/drm_atomic_helper.c +1
-1@@ -2270,7 +2282,7 @@ static int update_output_state(struct drm_atomic_state *state,return ret; } -for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, crtc_state, i) {/* Don't update ->enable for the CRTC in the set_config request, * since a mismatch would indicate a bug in the upper layers. * The actual modeset code later on will catch any
Building up the new state. Looks correct.
Phew! Apart from some of the lingering foo->state dereferences and the change in behaviour for legacy cursors, and the slight oddballness in the plane_cleanup() I didn't spot anything wrong.
This thing could use a commit message I think. Could at least lay out the basic rules on the foo->state/foo_state vs. old_state/new_state replacements. Might help someone understand it who doesn't know so much about the current state swapping mechanism.
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 07/19] drm/atomic: Fix atomic helpers to use the new iterator macros.
Quoted 4 lines · Ville Syrjälä
This thing could use a commit message I think. Could at least lay out the basic rules on the foo->state/foo_state vs. old_state/new_state replacements. Might help someone understand it who doesn't know so much about the current state swapping mechanism.
Yup. I know Maarten doesn't like typing them, but except for trival&obvious stuff they're needed.
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Maarten Lankhorst
maintainerPATCH 8/19 drm/vc4: Use new atomic iterator macros.
In reply to Maarten Lankhorst--- drivers/gpu/drm/vc4/vc4_kms.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/vc4/vc4_kms.c +3 -3
@@ -111,7 +111,7 @@ static int vc4_atomic_commit(struct drm_device *dev,uint64_t wait_seqno =0 ;struct vc4_commit *c;struct drm_plane *plane; -struct drm_plane_state *new_state; +struct drm_plane_state *old_state, *new_state; c =commit_init (state);if (!c)
@@ -139,8 +139,8 @@ static int vc4_atomic_commit(struct drm_device *dev,return ret; } -for_each_plane_in_state (state, plane, new_state, i) { -if ((plane->state->fb != new_state->fb) && new_state->fb) { +for_each_oldnew_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 );struct vc4_bo *bo =to_vc4_bo (&cma_bo->base);
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Maarten Lankhorst
maintainerPATCH 9/19 drm/rockchip: Use new atomic iterator macros.
In reply to Maarten Lankhorst--- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +3 -3
@@ -1009,7 +1009,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;
@@ -1040,11 +1040,11 @@ 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);
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Maarten Lankhorst
maintainerPATCH 10/19 drm/rcar-du: Use new atomic iterator macros.
In reply to Maarten Lankhorst--- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 2 +- drivers/gpu/drm/rcar-du/rcar_du_plane.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/rcar-du/rcar_du_kms.c +1 -1
@@ -312,7 +312,7 @@ static int rcar_du_atomic_commit(struct drm_device *dev,/* Wait until all affected CRTCs have completed previous commits and * mark them as pending. */ -for_each_crtc_in_state (state, crtc, crtc_state, i) +for_each_new_crtc_in_state (state, crtc, crtc_state, i) commit->crtcs |=drm_crtc_mask (crtc);spin_lock (&rcdu->commit.wait.lock);
drivers/gpu/drm/rcar-du/rcar_du_plane.c +2 -2
@@ -144,7 +144,7 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,struct drm_plane_state *drm_plane_state;/* Check if hardware planes need to be reallocated. */ -for_each_plane_in_state (state, drm_plane, drm_plane_state, i) { +for_each_new_plane_in_state (state, drm_plane, drm_plane_state, i) {struct rcar_du_plane_state *plane_state;struct rcar_du_plane *plane;unsigned int index;
@@ -246,7 +246,7 @@ 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) { +for_each_new_plane_in_state (state, drm_plane, drm_plane_state, i) {struct rcar_du_plane_state *plane_state;struct rcar_du_plane *plane;unsigned int crtc_planes;
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Maarten Lankhorst
maintainerPATCH 11/19 drm/omap: Use new atomic iterator macros
In reply to Maarten Lankhorst--- drivers/gpu/drm/omapdrm/omap_drv.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/omapdrm/omap_drv.c +4 -4
@@ -69,13 +69,13 @@ struct omap_atomic_state_commit {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 *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, crtc_state, i) { +if (!crtc_state->enable)continue ; ret =omap_crtc_wait_pending (crtc);
@@ -164,7 +164,7 @@ static int omap_atomic_commit(struct drm_device *dev,/* Wait until all affected CRTCs have completed previous commits and * mark them as pending. */ -for_each_crtc_in_state (state, crtc, crtc_state, i) +for_each_new_crtc_in_state (state, crtc, crtc_state, i) commit->crtcs |=drm_crtc_mask (crtc);wait_event (priv->commit.wait, !omap_atomic_is_pending (priv, commit));
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Maarten Lankhorst
maintainerPATCH 12/19 drm/msm: Use new atomic iterator macros
In reply to Maarten Lankhorst--- drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c | 4 ++-- drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | 6 +++--- drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h | 3 ++- drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 4 ++-- drivers/gpu/drm/msm/msm_atomic.c | 16 ++++++++-------- 5 files changed, 17 insertions(+), 16 deletions(-)
drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c +2 -2
@@ -113,7 +113,7 @@ static void mdp4_prepare_commit(struct msm_kms *kms, struct drm_atomic_state *stmdp4_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); }
@@ -125,7 +125,7 @@ static void mdp4_complete_commit(struct msm_kms *kms, struct drm_atomic_state *sstruct 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);
drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c +3 -3
@@ -82,10 +82,10 @@ static void mdp5_complete_commit(struct msm_kms *kms, struct drm_atomic_state *sint i;struct mdp5_kms *mdp5_kms =to_mdp5_kms (to_mdp_kms (kms));struct drm_plane *plane; -struct drm_plane_state *plane_state; +struct drm_plane_state *old_state, *new_state; -for_each_plane_in_state (state, plane, plane_state, i) -mdp5_plane_complete_commit (plane, plane_state); +for_each_oldnew_plane_in_state (state, plane, old_state, new_state, i) +mdp5_plane_complete_commit (plane, old_state, new_state);mdp5_disable (mdp5_kms); }
drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h +2 -1
@@ -198,7 +198,8 @@ void mdp5_irq_domain_fini(struct mdp5_kms *mdp5_kms);uint32_t mdp5_plane_get_flush (struct drm_plane *plane);void mdp5_plane_complete_flip (struct drm_plane *plane);void mdp5_plane_complete_commit (struct drm_plane *plane, -struct drm_plane_state *state); +struct drm_plane_state *old_state, +struct drm_plane_state *new_state);enum mdp5_pipe mdp5_plane_pipe (struct drm_plane *plane); struct drm_plane *mdp5_plane_init(struct drm_device *dev, enum mdp5_pipe pipe, bool private_plane,
drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c +2 -2
@@ -859,13 +859,13 @@ uint32_t mdp5_plane_get_flush(struct drm_plane *plane)/* called after vsync in thread context */ void mdp5_plane_complete_commit (struct drm_plane *plane, -struct drm_plane_state *state) +struct drm_plane_state *old_state,struct drm_plane_state *new_state) {struct mdp5_kms *mdp5_kms =get_kms (plane);struct mdp5_plane *mdp5_plane =to_mdp5_plane (plane);enum mdp5_pipe pipe = mdp5_plane->pipe; -if (!plane_enabled (plane->state) && mdp5_kms->smp) { +if (!plane_enabled (new_state) && mdp5_kms->smp) {DBG ("%s: free SMP" , mdp5_plane->name);mdp5_smp_release (mdp5_kms->smp, pipe); }
drivers/gpu/drm/msm/msm_atomic.c +8 -8
@@ -89,8 +89,8 @@ static void msm_atomic_wait_for_commit_done(struct drm_device *dev,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, crtc_state, i) { +if (!crtc_state->enable)continue ;/* Legacy cursor ioctls are completely unsynced, and userspace
@@ -191,7 +191,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 *new_plane_state, *old_plane_state;int i, ret; ret =drm_atomic_helper_prepare_planes (dev, state);
@@ -207,18 +207,18 @@ 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 (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); - plane_state->fence =reservation_object_get_excl_rcu (msm_obj->resv); + new_plane_state->fence =reservation_object_get_excl_rcu (msm_obj->resv); } }
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 12/19] drm/msm: Use new atomic iterator macros
Quoted 23 lines · Maarten Lankhorst
Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c | 4 ++-- drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | 6 +++--- drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h | 3 ++- drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 4 ++-- drivers/gpu/drm/msm/msm_atomic.c | 16 ++++++++-------- 5 files changed, 17 insertions(+), 16 deletions(-)drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c +1
-1@@ -113,7 +113,7 @@ static void mdp4_prepare_commit(struct msm_kms *kms, struct drm_atomic_state *stmdp4_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); }
drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c static void mdp4_complete_commit(struct msm_kms *kms, struct drm_atomic_state *s · line 129
Quoted 6 lines
drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c +1
-1@@ -125,7 +125,7 @@ static void mdp4_complete_commit(struct msm_kms *kms, struct drm_atomic_state *sstruct 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);
post-swap, but crtc_state not used in either. So lgtm.
I wonder if you should go all in and try to rename all the foo_state variables as new_foo_state and old_foo_state to make sure you didn't miss any uses which might not agree with your new choice if iterator macro? Eg. if in this case crtc_state was actually used but you failed notice it you would have just broken something by using the _new_ iterator.
Quoted 44 lines
drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c +0
-0mdp4_disable (mdp4_kms);drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c +3
-3@@ -82,10 +82,10 @@ static void mdp5_complete_commit(struct msm_kms *kms, struct drm_atomic_state *sint i;struct mdp5_kms *mdp5_kms =to_mdp5_kms (to_mdp_kms (kms));struct drm_plane *plane; -struct drm_plane_state *plane_state; +struct drm_plane_state *old_state, *new_state; -for_each_plane_in_state (state, plane, plane_state, i) -mdp5_plane_complete_commit (plane, plane_state); +for_each_oldnew_plane_in_state (state, plane, old_state, new_state, i) +mdp5_plane_complete_commit (plane, old_state, new_state);mdp5_disable (mdp5_kms); }drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h +2
-1@@ -198,7 +198,8 @@ void mdp5_irq_domain_fini(struct mdp5_kms *mdp5_kms);uint32_t mdp5_plane_get_flush (struct drm_plane *plane);void mdp5_plane_complete_flip (struct drm_plane *plane);void mdp5_plane_complete_commit (struct drm_plane *plane, -struct drm_plane_state *state); +struct drm_plane_state *old_state, +struct drm_plane_state *new_state);enum mdp5_pipe mdp5_plane_pipe (struct drm_plane *plane); struct drm_plane *mdp5_plane_init(struct drm_device *dev, enum mdp5_pipe pipe, bool private_plane,drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c +1
-1@@ -859,13 +859,13 @@ uint32_t mdp5_plane_get_flush(struct drm_plane *plane)/* called after vsync in thread context */ void mdp5_plane_complete_commit (struct drm_plane *plane, -struct drm_plane_state *state) +struct drm_plane_state *old_state,struct drm_plane_state *new_state)
drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c uint32_t mdp5_plane_get_flush(struct drm_plane *plane) · line 871
Quoted 10 lines
drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c +1
-1{struct mdp5_kms *mdp5_kms =get_kms (plane);struct mdp5_plane *mdp5_plane =to_mdp5_plane (plane);enum mdp5_pipe pipe = mdp5_plane->pipe; -if (!plane_enabled (plane->state) && mdp5_kms->smp) { +if (!plane_enabled (new_state) && mdp5_kms->smp) {DBG ("%s: free SMP" , mdp5_plane->name);mdp5_smp_release (mdp5_kms->smp, pipe); }
Doesn't look like this guy actually needs the old state. Not sure why it was getting passed in. The replacement for plane->state looks correct nonetheless.
drivers/gpu/drm/msm/msm_atomic.c static void msm_atomic_wait_for_commit_done(struct drm_device *dev, · line 94
Quoted 13 lines
drivers/gpu/drm/msm/msm_atomic.c +2
-2@@ -89,8 +89,8 @@ static void msm_atomic_wait_for_commit_done(struct drm_device *dev,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, crtc_state, i) { +if (!crtc_state->enable)continue ;
post-swap, lgtm.
Quoted 23 lines
drivers/gpu/drm/msm/msm_atomic.c +2
-3/* Legacy cursor ioctls are completely unsynced, and userspace @@ -191,7 +191,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 *new_plane_state, *old_plane_state;int i, ret; ret =drm_atomic_helper_prepare_planes (dev, state);@@ -207,18 +207,18 @@ 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) {
drivers/gpu/drm/msm/msm_atomic.c int msm_atomic_commit(struct drm_device *dev, · line 222
Quoted 10 lines
drivers/gpu/drm/msm/msm_atomic.c +4
-3-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 (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); - plane_state->fence =reservation_object_get_excl_rcu (msm_obj->resv); + new_plane_state->fence =reservation_object_get_excl_rcu (msm_obj->resv); }
pre-swap, lgtm.
Patches 08-12
Quoted 9 lines
drivers/gpu/drm/msm/msm_atomic.c +0
-0}Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Maarten Lankhorst
maintainerPATCH 13/19 drm/imx: Use new atomic iterator macros
In reply to Maarten Lankhorst--- drivers/gpu/drm/imx/imx-drm-core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/imx/imx-drm-core.c +5 -5
@@ -155,7 +155,7 @@ static int imx_drm_atomic_commit(struct drm_device *dev, struct drm_atomic_state *state, bool nonblock) { -struct drm_plane_state *plane_state; +struct drm_plane_state *old_plane_state, *new_plane_state;struct drm_plane *plane;struct dma_buf *dma_buf;int i;
@@ -164,13 +164,13 @@ 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_plane_in_state (state, plane, plane_state, i) { -if ((plane->state->fb != plane_state->fb) && plane_state->fb) { - dma_buf =drm_fb_cma_get_gem_obj (plane_state->fb, +for_each_oldnew_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;if (!dma_buf)continue ; - plane_state->fence = + new_plane_state->fence =reservation_object_get_excl_rcu (dma_buf->resv); } }
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Maarten Lankhorst
maintainerPATCH 14/19 drm/mediatek: Use new atomic iterator macros
In reply to Maarten Lankhorst--- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/mediatek/mtk_drm_drv.c +2 -2
@@ -50,8 +50,8 @@ static void mtk_atomic_wait_for_fences(struct drm_atomic_state *state)struct drm_plane_state *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, plane_state, i) +mtk_fb_wait (plane_state->fb); } static void mtk_atomic_complete(struct mtk_drm_private *private,
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 14/19] drm/mediatek: Use new atomic iterator macros
Quoted 1 line · Maarten Lankhorst
Signed-off-by Maarten Lankhorst <[email protected]>
Patches 13-14
Quoted 26 lines
--- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/mediatek/mtk_drm_drv.c +2
-2@@ -50,8 +50,8 @@ static void mtk_atomic_wait_for_fences(struct drm_atomic_state *state)struct drm_plane_state *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, plane_state, i) +mtk_fb_wait (plane_state->fb); } static void mtk_atomic_complete(struct mtk_drm_private *private,Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Maarten Lankhorst
maintainerPATCH 15/19 drm/i915: Use new atomic iterator macros in ddi
In reply to Maarten LankhorstAlso make the function static, it's only used inside intel_ddi.c
--- drivers/gpu/drm/i915/intel_ddi.c | 4 ++-- drivers/gpu/drm/i915/intel_drv.h | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +2 -2
@@ -740,7 +740,7 @@ intel_ddi_get_crtc_encoder(struct drm_crtc *crtc)return ret; } -struct intel_encoder * +static struct intel_encoder *intel_ddi_get_crtc_new_encoder (struct intel_crtc_state *crtc_state) {struct intel_crtc *crtc =to_intel_crtc (crtc_state->base.crtc);
@@ -753,7 +753,7 @@ intel_ddi_get_crtc_new_encoder(struct intel_crtc_state *crtc_state) state = crtc_state->base.state; -for_each_connector_in_state (state, connector, connector_state, i) { +for_each_new_connector_in_state (state, connector, connector_state, i) {if (connector_state->crtc != crtc_state->base.crtc)continue ;
drivers/gpu/drm/i915/intel_drv.h +0 -2
@@ -1156,8 +1156,6 @@ void intel_ddi_prepare_link_retrain(struct intel_dp *intel_dp);bool intel_ddi_connector_get_hw_state (struct intel_connector *intel_connector);void intel_ddi_get_config (struct intel_encoder *encoder,struct intel_crtc_state *pipe_config); -struct intel_encoder * -intel_ddi_get_crtc_new_encoder (struct intel_crtc_state *crtc_state);void intel_ddi_init_dp_buf_reg (struct intel_encoder *encoder); void intel_ddi_clock_get(struct intel_encoder *encoder,
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 15/19] drm/i915: Use new atomic iterator macros in ddi
Quoted 22 lines · Maarten Lankhorst
Also make the function static, it's only used inside
intel_ddi.cSigned-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/i915/intel_ddi.c | 4 ++-- drivers/gpu/drm/i915/intel_drv.h | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/intel_ddi.c +1
-1@@ -740,7 +740,7 @@ intel_ddi_get_crtc_encoder(struct drm_crtc *crtc)return ret; } -struct intel_encoder * +static struct intel_encoder *intel_ddi_get_crtc_new_encoder (struct intel_crtc_state *crtc_state) {struct intel_crtc *crtc =to_intel_crtc (crtc_state->base.crtc);
drivers/gpu/drm/i915/intel_ddi.c intel_ddi_get_crtc_new_encoder(struct intel_crtc_state *crtc_state) · line 758
Quoted 7 lines
drivers/gpu/drm/i915/intel_ddi.c +1
-1@@ -753,7 +753,7 @@ intel_ddi_get_crtc_new_encoder(struct intel_crtc_state *crtc_state) state = crtc_state->base.state; -for_each_connector_in_state (state, connector, connector_state, i) { +for_each_new_connector_in_state (state, connector, connector_state, i) {if (connector_state->crtc != crtc_state->base.crtc)continue ;
Quoted 21 lines
drivers/gpu/drm/i915/intel_drv.h +0
-2@@ -1156,8 +1156,6 @@ void intel_ddi_prepare_link_retrain(struct intel_dp *intel_dp);bool intel_ddi_connector_get_hw_state (struct intel_connector *intel_connector);void intel_ddi_get_config (struct intel_encoder *encoder,struct intel_crtc_state *pipe_config); -struct intel_encoder * -intel_ddi_get_crtc_new_encoder (struct intel_crtc_state *crtc_state);void intel_ddi_init_dp_buf_reg (struct intel_encoder *encoder); void intel_ddi_clock_get(struct intel_encoder *encoder,Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Maarten Lankhorst
maintainerPATCH 16/19 drm/i915: Use new atomic iterator macros in fbc
In reply to Maarten Lankhorst--- drivers/gpu/drm/i915/intel_fbc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_fbc.c +3 -3
@@ -1060,7 +1060,7 @@ void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv,mutex_lock (&fbc->lock); -for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, crtc_state, i) {if (fbc->crtc ==to_intel_crtc (crtc)) { fbc_crtc_present = true;break ;
@@ -1074,14 +1074,14 @@ void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv,* plane. We could go for fancier schemes such as checking the plane * size, but this would just affect the few platforms that don't tie FBC * to pipe or plane A. */ -for_each_plane_in_state (state, plane, plane_state, i) { +for_each_new_plane_in_state (state, plane, plane_state, i) {struct intel_plane_state *intel_plane_state =to_intel_plane_state (plane_state);if (!intel_plane_state->base.visible)continue ; -for_each_crtc_in_state (state, crtc, crtc_state, j) { +for_each_new_crtc_in_state (state, crtc, crtc_state, j) {struct intel_crtc_state *intel_crtc_state =to_intel_crtc_state (crtc_state);
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 16/19] drm/i915: Use new atomic iterator macros in fbc
Quoted 19 lines · Maarten Lankhorst
Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/i915/intel_fbc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/intel_fbc.c +1
-1@@ -1060,7 +1060,7 @@ void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv,mutex_lock (&fbc->lock); -for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, crtc_state, i) {if (fbc->crtc ==to_intel_crtc (crtc)) { fbc_crtc_present = true;break ;
drivers/gpu/drm/i915/intel_fbc.c void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv, · line 1082
Quoted 10 lines
drivers/gpu/drm/i915/intel_fbc.c +1
-1@@ -1074,14 +1074,14 @@ void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv,* plane. We could go for fancier schemes such as checking the plane * size, but this would just affect the few platforms that don't tie FBC * to pipe or plane A. */ -for_each_plane_in_state (state, plane, plane_state, i) { +for_each_new_plane_in_state (state, plane, plane_state, i) {struct intel_plane_state *intel_plane_state =to_intel_plane_state (plane_state);if (!intel_plane_state->base.visible)continue ;
Unrelated but this thing looks somewhat bogus. FBC is tied to the primary plane only, so why do we care about the visibility of the other planes? Adding Paulo to Cc...
drivers/gpu/drm/i915/intel_fbc.c void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv, · line 1084
Quoted 3 lines
drivers/gpu/drm/i915/intel_fbc.c +1
-1-for_each_crtc_in_state (state, crtc, crtc_state, j) { +for_each_new_crtc_in_state (state, crtc, crtc_state, j) {
Also, can't this inner loop be replaced with a simple crtc = plane_state->crtc ?
Quoted 10 lines
drivers/gpu/drm/i915/intel_fbc.c +0
-0struct intel_crtc_state *intel_crtc_state =to_intel_crtc_state (crtc_state);Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 16/19] drm/i915: Use new atomic iterator macros in fbc
Em Qui, 2016-11-03 às 18:45 +0200, Ville Syrjälä escreveu:
Quoted 35 lines · Maarten Lankhorst
Quoted 34 lines
Signed-off-by Maarten Lankhorst <[email protected]Quoted 1 line
---
drivers/gpu/drm/i915/intel_fbc.c | 6 +++---1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/intel_fbc.c +0
-0@@ -1060,7 +1060,7 @@ void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv,
mutex_lock(&fbc->lock);drivers/gpu/drm/i915/intel_fbc.c +1
-1-for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, crtc_state, i) {if (
fbc->crtc==to_intel_crtc(crtc)) {fbc_crtc_present= true; break;drivers/gpu/drm/i915/intel_fbc.c +0
-0@@ -1074,14 +1074,14 @@ void intel_fbc_choose_crtc(structdrm_i915_private *dev_priv, * plane. We could go for fancier schemes such as checkingthe plane
* size, but this would just affect the few platforms that don't tie FBC
* to pipe or plane A. */drivers/gpu/drm/i915/intel_fbc.c +1
-1-for_each_plane_in_state (state, plane, plane_state, i) { +for_each_new_plane_in_state (state, plane, plane_state, i){
structintel_plane_state*intel_plane_state=to_intel_plane_state(plane_state);
Quoted 8 lines
Quoted 3 lines
if (!intel_plane_state->base.visible) continue;Unrelated but this thing looks somewhat bogus. FBC is tied to the primary plane only, so why do we care about the visibility of the other
planes? Adding Paulo to Cc...
Looks like you've found a bug... Thanks! We should really be iterating over primary planes only. Adding to the TODO list.
Quoted 10 lines
Quoted 7 lines
drivers/gpu/drm/i915/intel_fbc.c +0
-1-for_each_crtc_in_state (state, crtc, crtc_state, j){
drivers/gpu/drm/i915/intel_fbc.c +1
-0+ for_each_new_crtc_in_state(state, crtc,
crtc_state, j) {Also, can't this inner loop be replaced with a simple crtc =
plane_state->crtc?
Is there a way to get the proposed crtc_state without the loop?
Quoted 9 lines
Quoted 9 lines
struct
intel_crtc_state*intel_crtc_state=
to_intel_crtc_state(crtc_state);
--
2.7.4
Quoted 5 lines
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 16/19] drm/i915: Use new atomic iterator macros in fbc
Quoted 59 lines · Paulo Zanoni
Em Qui, 2016-11-03 às 18:45 +0200, Ville Syrjälä escreveu:
Quoted 35 lines · Maarten Lankhorst
Quoted 34 lines
Signed-off-by Maarten Lankhorst <[email protected]Quoted 1 line
---
drivers/gpu/drm/i915/intel_fbc.c | 6 +++---1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/intel_fbc.c +0
-0@@ -1060,7 +1060,7 @@ void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv,
mutex_lock(&fbc->lock);drivers/gpu/drm/i915/intel_fbc.c +1
-1-for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, crtc_state, i) {if (
fbc->crtc==to_intel_crtc(crtc)) {fbc_crtc_present= true; break;drivers/gpu/drm/i915/intel_fbc.c +0
-0@@ -1074,14 +1074,14 @@ void intel_fbc_choose_crtc(structdrm_i915_private *dev_priv, * plane. We could go for fancier schemes such as checkingthe plane
* size, but this would just affect the few platforms that don't tie FBC
* to pipe or plane A. */drivers/gpu/drm/i915/intel_fbc.c +1
-1-for_each_plane_in_state (state, plane, plane_state, i) { +for_each_new_plane_in_state (state, plane, plane_state, i){
structintel_plane_state*intel_plane_state=to_intel_plane_state(plane_state);Quoted 8 lines
Quoted 3 lines
if (!intel_plane_state->base.visible) continue;Unrelated but this thing looks somewhat bogus. FBC is tied to the primary plane only, so why do we care about the visibility of the other
planes? Adding Paulo to Cc...Looks like you've found a bug... Thanks! We should really be iterating over primary planes only. Adding to the TODO list.
Quoted 10 lines
Quoted 7 lines
drivers/gpu/drm/i915/intel_fbc.c +0
-1-for_each_crtc_in_state (state, crtc, crtc_state, j){
drivers/gpu/drm/i915/intel_fbc.c +1
-0+ for_each_new_crtc_in_state(state, crtc,
crtc_state, j) {Also, can't this inner loop be replaced with a simple crtc =
plane_state->crtc?
Quoted 1 line
Is there a way to get the proposed
crtc_statewithout the loop?
...get_existing_crtc_state(plane_state->crtc);
since the plane is part of the state the crtc should be too, I think.
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [Intel-gfx] [PATCH 16/19] drm/i915: Use new atomic iterator macros in fbc
Quoted 60 lines · Ville Syrjälä
Quoted 59 lines · Paulo Zanoni
Em Qui, 2016-11-03 às 18:45 +0200, Ville Syrjälä escreveu:
Quoted 35 lines · Maarten Lankhorst
Quoted 34 lines
Signed-off-by Maarten Lankhorst <[email protected]Quoted 1 line
---
drivers/gpu/drm/i915/intel_fbc.c | 6 +++---1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/intel_fbc.c +0
-0@@ -1060,7 +1060,7 @@ void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv,
mutex_lock(&fbc->lock);drivers/gpu/drm/i915/intel_fbc.c +1
-1-for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, crtc_state, i) {if (
fbc->crtc==to_intel_crtc(crtc)) {fbc_crtc_present= true; break;drivers/gpu/drm/i915/intel_fbc.c +0
-0@@ -1074,14 +1074,14 @@ void intel_fbc_choose_crtc(structdrm_i915_private *dev_priv, * plane. We could go for fancier schemes such as checkingthe plane
* size, but this would just affect the few platforms that don't tie FBC
* to pipe or plane A. */drivers/gpu/drm/i915/intel_fbc.c +1
-1-for_each_plane_in_state (state, plane, plane_state, i) { +for_each_new_plane_in_state (state, plane, plane_state, i){
structintel_plane_state*intel_plane_state=to_intel_plane_state(plane_state);Quoted 8 lines
Quoted 3 lines
if (!intel_plane_state->base.visible) continue;Unrelated but this thing looks somewhat bogus. FBC is tied to the primary plane only, so why do we care about the visibility of the other
planes? Adding Paulo to Cc...Looks like you've found a bug... Thanks! We should really be iterating over primary planes only. Adding to the TODO list.
Quoted 10 lines
Quoted 7 lines
drivers/gpu/drm/i915/intel_fbc.c +0
-1-for_each_crtc_in_state (state, crtc, crtc_state, j){
drivers/gpu/drm/i915/intel_fbc.c +1
-0+ for_each_new_crtc_in_state(state, crtc,
crtc_state, j) {Also, can't this inner loop be replaced with a simple crtc =
plane_state->crtc?
Quoted 5 lines
Quoted 1 line
Is there a way to get the proposed
crtc_statewithout the loop?...get_existing_crtc_state(plane_state->crtc);
since the plane is part of the state the crtc should be too, I think.
Well, I guess Maarten wants to change it to get_new_state() soon enough.
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Maarten Lankhorst
maintainerPATCH 17/19 drm/i915: Use new atomic iterator macros in wm code
In reply to Maarten Lankhorst--- drivers/gpu/drm/i915/intel_pm.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +6 -6
@@ -3227,7 +3227,7 @@ skl_get_total_relative_data_rate(struct intel_crtc_state *intel_cstate)return 0 ;/* Calculate and cache data rate for each plane */ -for_each_plane_in_state (state, plane, pstate, i) { +for_each_new_plane_in_state (state, plane, pstate, i) { id =skl_wm_plane_id (to_intel_plane (plane)); intel_plane =to_intel_plane (plane);
@@ -3364,14 +3364,14 @@ skl_allocate_pipe_ddb(struct intel_crtc_state *cstate, alloc_size -= cursor_blocks;/* 1. Allocate the mininum required blocks for each active plane */ -for_each_plane_in_state (state, plane, pstate, i) { +for_each_new_plane_in_state (state, plane, pstate, i) { intel_plane =to_intel_plane (plane); id =skl_wm_plane_id (intel_plane);if (intel_plane->pipe != pipe)continue ; -if (!to_intel_plane_state (pstate)->base.visible) { +if (!pstate->visible) { minimum[id] =0 ; y_minimum[id] =0 ;continue ;
@@ -3933,7 +3933,7 @@ pipes_modified(struct drm_atomic_state *state)struct drm_crtc_state *cstate;uint32_t i, ret =0 ; -for_each_crtc_in_state (state, crtc, cstate, i) +for_each_new_crtc_in_state (state, crtc, cstate, i) ret |=drm_crtc_mask (crtc);return ret;
@@ -4048,7 +4048,7 @@ skl_compute_wm(struct drm_atomic_state *state)* since any racing commits that want to update them would need to * hold _all_ CRTC state mutexes. */ -for_each_crtc_in_state (state, crtc, cstate, i) +for_each_new_crtc_in_state (state, crtc, cstate, i) changed = true;if (!changed)return 0 ;
@@ -4070,7 +4070,7 @@ skl_compute_wm(struct drm_atomic_state *state)* should allow skl_update_pipe_wm() to return failure in cases where * no suitable watermark values can be found. */ -for_each_crtc_in_state (state, crtc, cstate, i) { +for_each_new_crtc_in_state (state, crtc, cstate, i) {struct intel_crtc *intel_crtc =to_intel_crtc (crtc);struct intel_crtc_state *intel_cstate =to_intel_crtc_state (cstate);
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 17/19] drm/i915: Use new atomic iterator macros in wm code
Quoted 10 lines · Maarten Lankhorst
Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/i915/intel_pm.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/intel_pm.c +0
-0
drivers/gpu/drm/i915/intel_pm.c skl_get_total_relative_data_rate(struct intel_crtc_state *intel_cstate) · line 3230
Quoted 5 lines
drivers/gpu/drm/i915/intel_pm.c +1
-1@@ -3227,7 +3227,7 @@ skl_get_total_relative_data_rate(struct intel_crtc_state *intel_cstate)return 0 ;/* Calculate and cache data rate for each plane */ -for_each_plane_in_state (state, plane, pstate, i) { +for_each_new_plane_in_state (state, plane, pstate, i) {
Looks like this patch needs a refresh due to my tardiness in reviewing it.
Also unrelated, but I recently noticed that skl_get_total_relative_data_rate() doesn't exclude the cursor plane from the calculation. I'm thinking it should. Adding some Cc:s...
Quoted 54 lines
drivers/gpu/drm/i915/intel_pm.c +5
-5id =skl_wm_plane_id (to_intel_plane (plane)); intel_plane =to_intel_plane (plane);@@ -3364,14 +3364,14 @@ skl_allocate_pipe_ddb(struct intel_crtc_state *cstate, alloc_size -= cursor_blocks;/* 1. Allocate the mininum required blocks for each active plane */ -for_each_plane_in_state (state, plane, pstate, i) { +for_each_new_plane_in_state (state, plane, pstate, i) { intel_plane =to_intel_plane (plane); id =skl_wm_plane_id (intel_plane);if (intel_plane->pipe != pipe)continue ; -if (!to_intel_plane_state (pstate)->base.visible) { +if (!pstate->visible) { minimum[id] =0 ; y_minimum[id] =0 ;continue ;@@ -3933,7 +3933,7 @@ pipes_modified(struct drm_atomic_state *state)struct drm_crtc_state *cstate;uint32_t i, ret =0 ; -for_each_crtc_in_state (state, crtc, cstate, i) +for_each_new_crtc_in_state (state, crtc, cstate, i) ret |=drm_crtc_mask (crtc);return ret;@@ -4048,7 +4048,7 @@ skl_compute_wm(struct drm_atomic_state *state)* since any racing commits that want to update them would need to * hold _all_ CRTC state mutexes. */ -for_each_crtc_in_state (state, crtc, cstate, i) +for_each_new_crtc_in_state (state, crtc, cstate, i) changed = true;if (!changed)return 0 ;@@ -4070,7 +4070,7 @@ skl_compute_wm(struct drm_atomic_state *state)* should allow skl_update_pipe_wm() to return failure in cases where * no suitable watermark values can be found. */ -for_each_crtc_in_state (state, crtc, cstate, i) { +for_each_new_crtc_in_state (state, crtc, cstate, i) {struct intel_crtc *intel_crtc =to_intel_crtc (crtc);struct intel_crtc_state *intel_cstate =to_intel_crtc_state (cstate);Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 17/19] drm/i915: Use new atomic iterator macros in wm code
Em Qui, 2016-11-03 às 18:49 +0200, Ville Syrjälä escreveu:
Quoted 25 lines · Maarten Lankhorst
Quoted 17 lines
Signed-off-by Maarten Lankhorst <[email protected]Quoted 1 line
---
drivers/gpu/drm/i915/intel_pm.c | 12 ++++++------1 file changed, 6 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/intel_pm.c +0
-0@@ -3227,7 +3227,7 @@ skl_get_total_relative_data_rate(struct intel_crtc_state *intel_cstate) return 0;
/* Calculate and cache data rate for each plane */drivers/gpu/drm/i915/intel_pm.c
Quoted 2 lines
drivers/gpu/drm/i915/intel_pm.c +1
-1-for_each_plane_in_state (state, plane, pstate, i) { +for_each_new_plane_in_state (state, plane, pstate, i) {Looks like this patch needs a refresh due to my tardiness in reviewing
it.
Quoted 3 lines
Also unrelated, but I recently noticed that
skl_get_total_relative_data_rate()doesn't exclude the cursor plane from the calculation. I'm thinking it should. Adding some Cc:s...
It seems we're safe because skl_plane_relative_data_rate() returns 0 for cursor. But an explicitly check at the caller would probably be much much better instead of hidden deep in the code. OTOH, Matt's plans to exclude cursor case-handling would remove this need again.
Quoted 60 lines
Quoted 60 lines
id = skl_wm_plane_id(to_intel_plane(plane));
intel_plane=to_intel_plane(plane);drivers/gpu/drm/i915/intel_pm.c +0
-0@@ -3364,14 +3364,14 @@ skl_allocate_pipe_ddb(structintel_crtc_state *cstate, alloc_size -= cursor_blocks;
/* 1. Allocate the mininum required blocks for each active plane */drivers/gpu/drm/i915/intel_pm.c +1
-1-for_each_plane_in_state (state, plane, pstate, i) { +for_each_new_plane_in_state (state, plane, pstate, i) {
intel_plane=to_intel_plane(plane); id =skl_wm_plane_id(intel_plane);
if (intel_plane->pipe!= pipe) continue;drivers/gpu/drm/i915/intel_pm.c +1
-1-if (!to_intel_plane_state (pstate)->base.visible) { +if (!pstate->visible) {minimum[id] = 0;
y_minimum[id] = 0;
continue;drivers/gpu/drm/i915/intel_pm.c +0
-0@@ -3933,7 +3933,7 @@ pipes_modified(struct drm_atomic_state *state) struct drm_crtc_state *cstate; uint32_t i, ret = 0;drivers/gpu/drm/i915/intel_pm.c +1
-1-for_each_crtc_in_state (state, crtc, cstate, i) +for_each_new_crtc_in_state (state, crtc, cstate, i)ret |=
drm_crtc_mask(crtc);
return ret;drivers/gpu/drm/i915/intel_pm.c +0
-0@@ -4048,7 +4048,7 @@ skl_compute_wm(struct drm_atomic_state *state) * since any racing commits that want to update them wouldneed to
* hold _all_ CRTC state mutexes.
*/drivers/gpu/drm/i915/intel_pm.c +1
-1-for_each_crtc_in_state (state, crtc, cstate, i) +for_each_new_crtc_in_state (state, crtc, cstate, i)changed = true;
if (!changed)
return 0;drivers/gpu/drm/i915/intel_pm.c +0
-0@@ -4070,7 +4070,7 @@ skl_compute_wm(struct drm_atomic_state *state) * should allow skl_update_pipe_wm() to return failure incases where
* no suitable watermark values can be found. */drivers/gpu/drm/i915/intel_pm.c +1
-1-for_each_crtc_in_state (state, crtc, cstate, i) { +for_each_new_crtc_in_state (state, crtc, cstate, i) {struct
intel_crtc*intel_crtc=to_intel_crtc(crtc);
structintel_crtc_state*intel_cstate=to_intel_crtc_state(cstate); --
2.7.4
Quoted 5 lines
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Maarten Lankhorst
maintainerPATCH 18/19 drm/i915: Use new atomic iterator macros in display code
In reply to Maarten Lankhorst--- drivers/gpu/drm/i915/intel_display.c | 156 ++++++++++++++++++----------------- 1 file changed, 80 insertions(+), 76 deletions(-)
drivers/gpu/drm/i915/intel_display.c +80 -76
@@ -3510,7 +3510,12 @@ __intel_display_resume(struct drm_device *dev,if (!state)return 0 ; -for_each_crtc_in_state (state, crtc, crtc_state, i) { +/* +* We've duplicated the state, pointers to the old state are invalid. +* +* Don't attempt to use the old state until we commit the duplicated state. +*/ +for_each_new_crtc_in_state (state, crtc, crtc_state, i) {/* * Force recalculation even if we restore * current state. With fast modeset this may not result
@@ -5078,13 +5083,12 @@ static void intel_post_plane_update(struct intel_crtc_state *old_crtc_state) } } -static void intel_pre_plane_update (struct intel_crtc_state *old_crtc_state) +static void intel_pre_plane_update (struct intel_crtc_state *old_crtc_state, +struct intel_crtc_state *pipe_config) {struct intel_crtc *crtc =to_intel_crtc (old_crtc_state->base.crtc);struct drm_device *dev = crtc->base.dev;struct drm_i915_private *dev_priv =to_i915 (dev); -struct intel_crtc_state *pipe_config = -to_intel_crtc_state (crtc->base.state);struct drm_atomic_state *old_state = old_crtc_state->base.state;struct drm_plane *primary = crtc->base.primary; struct drm_plane_state *old_pri_state =
@@ -5186,12 +5190,11 @@ static void intel_encoders_pre_pll_enable(struct drm_crtc *crtc,struct intel_crtc_state *crtc_state, struct drm_atomic_state *old_state) { - struct drm_connector_state *old_conn_state; + struct drm_connector_state *conn_state;struct drm_connector *conn;int i; -for_each_connector_in_state (old_state, conn, old_conn_state, i) { -struct drm_connector_state *conn_state = conn->state; +for_each_new_connector_in_state (old_state, conn, conn_state, i) {struct intel_encoder *encoder =to_intel_encoder (conn_state->best_encoder);
@@ -5207,12 +5210,11 @@ static void intel_encoders_pre_enable(struct drm_crtc *crtc,struct intel_crtc_state *crtc_state, struct drm_atomic_state *old_state) { - struct drm_connector_state *old_conn_state; + struct drm_connector_state *conn_state;struct drm_connector *conn;int i; -for_each_connector_in_state (old_state, conn, old_conn_state, i) { -struct drm_connector_state *conn_state = conn->state; +for_each_new_connector_in_state (old_state, conn, conn_state, i) {struct intel_encoder *encoder =to_intel_encoder (conn_state->best_encoder);
@@ -5228,12 +5230,11 @@ static void intel_encoders_enable(struct drm_crtc *crtc,struct intel_crtc_state *crtc_state, struct drm_atomic_state *old_state) { - struct drm_connector_state *old_conn_state; + struct drm_connector_state *conn_state;struct drm_connector *conn;int i; -for_each_connector_in_state (old_state, conn, old_conn_state, i) { -struct drm_connector_state *conn_state = conn->state; +for_each_new_connector_in_state (old_state, conn, conn_state, i) {struct intel_encoder *encoder =to_intel_encoder (conn_state->best_encoder);
@@ -5253,7 +5254,7 @@ static void intel_encoders_disable(struct drm_crtc *crtc,struct drm_connector *conn;int i; -for_each_connector_in_state (old_state, conn, old_conn_state, i) { +for_each_old_connector_in_state (old_state, conn, old_conn_state, i) {struct intel_encoder *encoder =to_intel_encoder (old_conn_state->best_encoder);
@@ -5273,7 +5274,7 @@ static void intel_encoders_post_disable(struct drm_crtc *crtc,struct drm_connector *conn;int i; -for_each_connector_in_state (old_state, conn, old_conn_state, i) { +for_each_old_connector_in_state (old_state, conn, old_conn_state, i) {struct intel_encoder *encoder =to_intel_encoder (old_conn_state->best_encoder);
@@ -5293,7 +5294,7 @@ static void intel_encoders_post_pll_disable(struct drm_crtc *crtc,struct drm_connector *conn;int i; -for_each_connector_in_state (old_state, conn, old_conn_state, i) { +for_each_old_connector_in_state (old_state, conn, old_conn_state, i) {struct intel_encoder *encoder =to_intel_encoder (old_conn_state->best_encoder);
@@ -6573,7 +6574,7 @@ static int intel_mode_max_pixclk(struct drm_device *dev,memcpy (intel_state->min_pixclk, dev_priv->min_pixclk,sizeof (intel_state->min_pixclk)); -for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, crtc_state, i) {int pixclk =0 ;if (crtc_state->enable)
@@ -10238,7 +10239,7 @@ static int ilk_max_pixel_rate(struct drm_atomic_state *state)memcpy (intel_state->min_pixclk, dev_priv->min_pixclk,sizeof (intel_state->min_pixclk)); -for_each_crtc_in_state (state, crtc, cstate, i) { +for_each_new_crtc_in_state (state, crtc, cstate, i) {int pixel_rate; crtc_state =to_intel_crtc_state (cstate);
@@ -12530,7 +12531,7 @@ static bool check_single_encoder_cloning(struct drm_atomic_state *state,struct drm_connector_state *connector_state;int i; -for_each_connector_in_state (state, connector, connector_state, i) { +for_each_new_connector_in_state (state, connector, connector_state, i) {if (connector_state->crtc != &crtc->base)continue ;
@@ -12700,7 +12701,7 @@ compute_baseline_pipe_bpp(struct intel_crtc *crtc, state = pipe_config->base.state;/* Clamp display bpp to EDID value */ -for_each_connector_in_state (state, connector, connector_state, i) { +for_each_new_connector_in_state (state, connector, connector_state, i) {if (connector_state->crtc != &crtc->base)continue ;
@@ -12992,7 +12993,7 @@ intel_modeset_pipe_config(struct drm_crtc *crtc, &pipe_config->pipe_src_w, &pipe_config->pipe_src_h); -for_each_connector_in_state (state, connector, connector_state, i) { +for_each_new_connector_in_state (state, connector, connector_state, i) {if (connector_state->crtc != crtc)continue ;
@@ -13023,7 +13024,7 @@ encoder_retry:* adjust it according to limitations or connector properties, and also * a chance to reject the mode entirely. */ -for_each_connector_in_state (state, connector, connector_state, i) { +for_each_new_connector_in_state (state, connector, connector_state, i) {if (connector_state->crtc != crtc)continue ;
@@ -13072,16 +13073,16 @@ static void intel_modeset_update_crtc_state(struct drm_atomic_state *state) {struct drm_crtc *crtc; -struct drm_crtc_state *crtc_state; +struct drm_crtc_state *new_crtc_state;int i;/* Double check state. */ -for_each_crtc_in_state (state, crtc, crtc_state, i) { -to_intel_crtc (crtc)->config =to_intel_crtc_state (crtc->state); +for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) { +to_intel_crtc (crtc)->config =to_intel_crtc_state (new_crtc_state);/* Update hwmode for vblank functions */ -if (crtc->state->active) - crtc->hwmode = crtc->state->adjusted_mode; +if (new_crtc_state->active) + crtc->hwmode = new_crtc_state->adjusted_mode;else crtc->hwmode.crtc_clock =0 ;
@@ -13753,21 +13754,21 @@ static void intel_modeset_clear_plls(struct drm_atomic_state *state)struct drm_i915_private *dev_priv =to_i915 (dev);struct intel_shared_dpll_config *shared_dpll =NULL ;struct drm_crtc *crtc; -struct drm_crtc_state *crtc_state; +struct drm_crtc_state *old_crtc_state, *new_crtc_state;int i;if (!dev_priv->display.crtc_compute_clock)return ; -for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_oldnew_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 (crtc->state)->shared_dpll; +to_intel_crtc_state (old_crtc_state)->shared_dpll; -if (!needs_modeset (crtc_state)) +if (!needs_modeset (new_crtc_state))continue ; -to_intel_crtc_state (crtc_state)->shared_dpll =NULL ; +to_intel_crtc_state (new_crtc_state)->shared_dpll =NULL ;if (!old_dpll)continue ;
@@ -13796,7 +13797,7 @@ static int haswell_mode_set_planes_workaround(struct drm_atomic_state *state)int i;/* look at all crtc's that are going to be enabled in during modeset */ -for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, crtc_state, i) { intel_crtc =to_intel_crtc (crtc);if (!crtc_state->active || !needs_modeset (crtc_state))
@@ -13878,7 +13879,7 @@ static int intel_modeset_checks(struct drm_atomic_state *state)struct intel_atomic_state *intel_state =to_intel_atomic_state (state);struct drm_i915_private *dev_priv =to_i915 (state->dev);struct drm_crtc *crtc; -struct drm_crtc_state *crtc_state; +struct drm_crtc_state *old_crtc_state, *new_crtc_state;int ret =0 , i;if (!check_digital_port_conflicts (state)) {
@@ -13889,13 +13890,13 @@ static int intel_modeset_checks(struct drm_atomic_state *state) intel_state->modeset = true; intel_state->active_crtcs = dev_priv->active_crtcs; -for_each_crtc_in_state (state, crtc, crtc_state, i) { -if (crtc_state->active) +for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) { +if (new_crtc_state->active) intel_state->active_crtcs |=1 << i;else intel_state->active_crtcs &= ~(1 << i); -if (crtc_state->active != crtc->state->active) +if (old_crtc_state->active != new_crtc_state->active) intel_state->active_pipe_changes |=drm_crtc_mask (crtc); }
@@ -13964,7 +13965,7 @@ static int intel_atomic_check(struct drm_device *dev,struct drm_i915_private *dev_priv =to_i915 (dev);struct intel_atomic_state *intel_state =to_intel_atomic_state (state);struct drm_crtc *crtc; -struct drm_crtc_state *crtc_state; +struct drm_crtc_state *old_crtc_state, *crtc_state;int ret, i;bool any_ms = false;
@@ -13972,12 +13973,12 @@ static int intel_atomic_check(struct drm_device *dev,if (ret)return ret; -for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, crtc_state, i) {struct intel_crtc_state *pipe_config =to_intel_crtc_state (crtc_state);/* Catch I915_MODE_FLAG_INHERITED */ -if (crtc_state->mode.private_flags != crtc->state->mode.private_flags) +if (crtc_state->mode.private_flags != old_crtc_state->mode.private_flags) crtc_state->mode_changed = true;if (!needs_modeset (crtc_state))
@@ -14004,7 +14005,7 @@ static int intel_atomic_check(struct drm_device *dev,if (i915.fastboot &&intel_pipe_config_compare (dev, -to_intel_crtc_state (crtc->state), +to_intel_crtc_state (old_crtc_state), pipe_config, true)) { crtc_state->mode_changed = false;to_intel_crtc_state (crtc_state)->update_pipe = true;
@@ -14049,7 +14050,7 @@ static int intel_atomic_prepare_commit(struct drm_device *dev,struct drm_crtc *crtc;int i, ret; -for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, crtc_state, i) {if (state->legacy_cursor_update)continue ;
@@ -14069,7 +14070,7 @@ static int intel_atomic_prepare_commit(struct drm_device *dev,mutex_unlock (&dev->struct_mutex);if (!ret && !nonblock) { -for_each_plane_in_state (state, plane, plane_state, i) { +for_each_new_plane_in_state (state, plane, plane_state, i) {struct intel_plane_state *intel_plane_state =to_intel_plane_state (plane_state);
@@ -14171,19 +14172,21 @@ static bool needs_vblank_wait(struct intel_crtc_state *crtc_state)static void intel_update_crtc (struct drm_crtc *crtc,struct drm_atomic_state *state,struct drm_crtc_state *old_crtc_state, +struct drm_crtc_state *new_crtc_state,unsigned int *crtc_vblank_mask) {struct drm_device *dev = crtc->dev;struct drm_i915_private *dev_priv =to_i915 (dev);struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -struct intel_crtc_state *pipe_config =to_intel_crtc_state (crtc->state); -bool modeset =needs_modeset (crtc->state); +struct intel_crtc_state *pipe_config =to_intel_crtc_state (new_crtc_state); +bool modeset =needs_modeset (new_crtc_state);if (modeset) {update_scanline_offset (intel_crtc); dev_priv->display.crtc_enable (pipe_config, state); }else { -intel_pre_plane_update (to_intel_crtc_state (old_crtc_state)); +intel_pre_plane_update (to_intel_crtc_state (old_crtc_state), + pipe_config); }if (drm_atomic_get_existing_plane_state (state, crtc->primary)) {
@@ -14202,15 +14205,15 @@ static void intel_update_crtcs(struct drm_atomic_state *state, unsigned int *crtc_vblank_mask) {struct drm_crtc *crtc; -struct drm_crtc_state *old_crtc_state; +struct drm_crtc_state *old_crtc_state, *new_crtc_state;int i; -for_each_crtc_in_state (state, crtc, old_crtc_state, i) { -if (!crtc->state->active) +for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) { +if (!new_crtc_state->active)continue ;intel_update_crtc (crtc, state, old_crtc_state, - crtc_vblank_mask); + new_crtc_state, crtc_vblank_mask); } }
@@ -14221,7 +14224,7 @@ static void skl_update_crtcs(struct drm_atomic_state *state,struct drm_i915_private *dev_priv =to_i915 (dev);struct intel_atomic_state *intel_state =to_intel_atomic_state (state);struct drm_crtc *crtc; -struct drm_crtc_state *old_crtc_state; +struct drm_crtc_state *old_crtc_state, *new_crtc_state;struct skl_ddb_allocation *new_ddb = &intel_state->wm_results.ddb;struct skl_ddb_allocation *cur_ddb = &dev_priv->wm.skl_hw.ddb;unsigned int updated =0 ;
@@ -14238,12 +14241,12 @@ static void skl_update_crtcs(struct drm_atomic_state *state,int i; progress = false; -for_each_crtc_in_state (state, crtc, old_crtc_state, i) { +for_each_oldnew_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; -if (updated & cmask || !crtc->state->active) +if (updated & cmask || !new_crtc_state->active)continue ;if (skl_ddb_allocation_overlaps (state, cur_ddb, new_ddb, pipe))
@@ -14258,12 +14261,12 @@ static void skl_update_crtcs(struct drm_atomic_state *state,* new ddb allocation to take effect. */ if (!skl_ddb_allocation_equals (cur_ddb, new_ddb, pipe) && - !crtc->state->active_changed && + !new_crtc_state->active_changed && intel_state->wm_results.dirty_pipes != updated) vbl_wait = true;intel_update_crtc (crtc, state, old_crtc_state, - crtc_vblank_mask); + new_crtc_state, crtc_vblank_mask);if (vbl_wait)intel_wait_for_vblank (dev, pipe);
@@ -14278,7 +14281,7 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state)struct drm_device *dev = state->dev;struct intel_atomic_state *intel_state =to_intel_atomic_state (state);struct drm_i915_private *dev_priv =to_i915 (dev); -struct drm_crtc_state *old_crtc_state; +struct drm_crtc_state *old_crtc_state, *new_crtc_state;struct drm_crtc *crtc;struct intel_crtc_state *intel_cstate;struct drm_plane *plane;
@@ -14288,7 +14291,7 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state)unsigned crtc_vblank_mask =0 ;int i, ret; -for_each_plane_in_state (state, plane, plane_state, i) { +for_each_new_plane_in_state (state, plane, plane_state, i) {struct intel_plane_state *intel_plane_state =to_intel_plane_state (plane_state);
@@ -14313,22 +14316,23 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state)intel_display_power_get (dev_priv,POWER_DOMAIN_MODESET ); } -for_each_crtc_in_state (state, crtc, old_crtc_state, i) { +for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) {struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -if (needs_modeset (crtc->state) || -to_intel_crtc_state (crtc->state)->update_pipe) { +if (needs_modeset (new_crtc_state) || +to_intel_crtc_state (new_crtc_state)->update_pipe) { hw_check = true; put_domains[to_intel_crtc (crtc)->pipe] =modeset_get_crtc_power_domains (crtc, -to_intel_crtc_state (crtc->state)); +to_intel_crtc_state (new_crtc_state)); } -if (!needs_modeset (crtc->state)) +if (!needs_modeset (new_crtc_state))continue ; -intel_pre_plane_update (to_intel_crtc_state (old_crtc_state)); +intel_pre_plane_update (to_intel_crtc_state (old_crtc_state), +to_intel_crtc_state (new_crtc_state));if (old_crtc_state->active) {intel_crtc_disable_planes (crtc, old_crtc_state->plane_mask);
@@ -14372,16 +14376,16 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state) }/* Complete the events for pipes that have now been disabled */ -for_each_crtc_in_state (state, crtc, old_crtc_state, i) { -bool modeset =needs_modeset (crtc->state); +for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) { +bool modeset =needs_modeset (new_crtc_state);/* Complete events for now disable pipes here. */ -if (modeset && !crtc->state->active && crtc->state->event) { +if (modeset && !new_crtc_state->active && new_crtc_state->event) {spin_lock_irq (&dev->event_lock); -drm_crtc_send_vblank_event (crtc, crtc->state->event); +drm_crtc_send_vblank_event (crtc, new_crtc_state->event);spin_unlock_irq (&dev->event_lock); - crtc->state->event =NULL ; + new_crtc_state->event =NULL ; } }
@@ -14407,20 +14411,20 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state)* * TODO: Move this (and other cleanup) to an async worker eventually. */ -for_each_crtc_in_state (state, crtc, old_crtc_state, i) { - intel_cstate =to_intel_crtc_state (crtc->state); +for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) { + intel_cstate =to_intel_crtc_state (new_crtc_state);if (dev_priv->display.optimize_watermarks) dev_priv->display.optimize_watermarks (intel_cstate); } -for_each_crtc_in_state (state, crtc, old_crtc_state, i) { +for_each_oldnew_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])modeset_put_power_domains (dev_priv, put_domains[i]); -intel_modeset_verify_crtc (crtc, old_crtc_state, crtc->state); +intel_modeset_verify_crtc (crtc, old_crtc_state, new_crtc_state); } if (IS_SKYLAKE(dev_priv) && intel_state->modeset &&
@@ -14464,13 +14468,13 @@ static void intel_atomic_commit_work(struct work_struct *work)static void intel_atomic_track_fbs (struct drm_atomic_state *state) { -struct drm_plane_state *old_plane_state; +struct drm_plane_state *old_plane_state, *new_plane_state;struct drm_plane *plane;int i; -for_each_plane_in_state (state, plane, old_plane_state, i) +for_each_oldnew_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 (plane->state->fb), +intel_fb_obj (new_plane_state->fb),to_intel_plane (plane)->frontbuffer_bit); }
@@ -16299,7 +16303,7 @@ retry: }/* Write calculated watermark values back */ -for_each_crtc_in_state (state, crtc, cstate, i) { +for_each_new_crtc_in_state (state, crtc, cstate, i) {struct intel_crtc_state *cs =to_intel_crtc_state (cstate); cs->wm.need_postvbl_update = true;
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 18/19] drm/i915: Use new atomic iterator macros in display code
Quoted 177 lines · Maarten Lankhorst
Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 156 ++++++++++++++++++----------------- 1 file changed, 80 insertions(+), 76 deletions(-)drivers/gpu/drm/i915/intel_display.c +25
-25@@ -3510,7 +3510,12 @@ __intel_display_resume(struct drm_device *dev,if (!state)return 0 ; -for_each_crtc_in_state (state, crtc, crtc_state, i) { +/* +* We've duplicated the state, pointers to the old state are invalid. +* +* Don't attempt to use the old state until we commit the duplicated state. +*/ +for_each_new_crtc_in_state (state, crtc, crtc_state, i) {/* * Force recalculation even if we restore * current state. With fast modeset this may not result @@ -5078,13 +5083,12 @@ static void intel_post_plane_update(struct intel_crtc_state *old_crtc_state) } } -static void intel_pre_plane_update (struct intel_crtc_state *old_crtc_state) +static void intel_pre_plane_update (struct intel_crtc_state *old_crtc_state, +struct intel_crtc_state *pipe_config) {struct intel_crtc *crtc =to_intel_crtc (old_crtc_state->base.crtc);struct drm_device *dev = crtc->base.dev;struct drm_i915_private *dev_priv =to_i915 (dev); -struct intel_crtc_state *pipe_config = -to_intel_crtc_state (crtc->base.state);struct drm_atomic_state *old_state = old_crtc_state->base.state;struct drm_plane *primary = crtc->base.primary; struct drm_plane_state *old_pri_state =@@ -5186,12 +5190,11 @@ static void intel_encoders_pre_pll_enable(struct drm_crtc *crtc,struct intel_crtc_state *crtc_state, struct drm_atomic_state *old_state) { - struct drm_connector_state *old_conn_state; + struct drm_connector_state *conn_state;struct drm_connector *conn;int i; -for_each_connector_in_state (old_state, conn, old_conn_state, i) { -struct drm_connector_state *conn_state = conn->state; +for_each_new_connector_in_state (old_state, conn, conn_state, i) {struct intel_encoder *encoder =to_intel_encoder (conn_state->best_encoder);@@ -5207,12 +5210,11 @@ static void intel_encoders_pre_enable(struct drm_crtc *crtc,struct intel_crtc_state *crtc_state, struct drm_atomic_state *old_state) { - struct drm_connector_state *old_conn_state; + struct drm_connector_state *conn_state;struct drm_connector *conn;int i; -for_each_connector_in_state (old_state, conn, old_conn_state, i) { -struct drm_connector_state *conn_state = conn->state; +for_each_new_connector_in_state (old_state, conn, conn_state, i) {struct intel_encoder *encoder =to_intel_encoder (conn_state->best_encoder);@@ -5228,12 +5230,11 @@ static void intel_encoders_enable(struct drm_crtc *crtc,struct intel_crtc_state *crtc_state, struct drm_atomic_state *old_state) { - struct drm_connector_state *old_conn_state; + struct drm_connector_state *conn_state;struct drm_connector *conn;int i; -for_each_connector_in_state (old_state, conn, old_conn_state, i) { -struct drm_connector_state *conn_state = conn->state; +for_each_new_connector_in_state (old_state, conn, conn_state, i) {struct intel_encoder *encoder =to_intel_encoder (conn_state->best_encoder);@@ -5253,7 +5254,7 @@ static void intel_encoders_disable(struct drm_crtc *crtc,struct drm_connector *conn;int i; -for_each_connector_in_state (old_state, conn, old_conn_state, i) { +for_each_old_connector_in_state (old_state, conn, old_conn_state, i) {struct intel_encoder *encoder =to_intel_encoder (old_conn_state->best_encoder);@@ -5273,7 +5274,7 @@ static void intel_encoders_post_disable(struct drm_crtc *crtc,struct drm_connector *conn;int i; -for_each_connector_in_state (old_state, conn, old_conn_state, i) { +for_each_old_connector_in_state (old_state, conn, old_conn_state, i) {struct intel_encoder *encoder =to_intel_encoder (old_conn_state->best_encoder);@@ -5293,7 +5294,7 @@ static void intel_encoders_post_pll_disable(struct drm_crtc *crtc,struct drm_connector *conn;int i; -for_each_connector_in_state (old_state, conn, old_conn_state, i) { +for_each_old_connector_in_state (old_state, conn, old_conn_state, i) {struct intel_encoder *encoder =to_intel_encoder (old_conn_state->best_encoder);@@ -6573,7 +6574,7 @@ static int intel_mode_max_pixclk(struct drm_device *dev,memcpy (intel_state->min_pixclk, dev_priv->min_pixclk,sizeof (intel_state->min_pixclk)); -for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, crtc_state, i) {int pixclk =0 ;if (crtc_state->enable)@@ -10238,7 +10239,7 @@ static int ilk_max_pixel_rate(struct drm_atomic_state *state)memcpy (intel_state->min_pixclk, dev_priv->min_pixclk,sizeof (intel_state->min_pixclk)); -for_each_crtc_in_state (state, crtc, cstate, i) { +for_each_new_crtc_in_state (state, crtc, cstate, i) {int pixel_rate; crtc_state =to_intel_crtc_state (cstate);@@ -12530,7 +12531,7 @@ static bool check_single_encoder_cloning(struct drm_atomic_state *state,struct drm_connector_state *connector_state;int i; -for_each_connector_in_state (state, connector, connector_state, i) { +for_each_new_connector_in_state (state, connector, connector_state, i) {if (connector_state->crtc != &crtc->base)continue ;@@ -12700,7 +12701,7 @@ compute_baseline_pipe_bpp(struct intel_crtc *crtc, state = pipe_config->base.state;/* Clamp display bpp to EDID value */ -for_each_connector_in_state (state, connector, connector_state, i) { +for_each_new_connector_in_state (state, connector, connector_state, i) {if (connector_state->crtc != &crtc->base)continue ;@@ -12992,7 +12993,7 @@ intel_modeset_pipe_config(struct drm_crtc *crtc, &pipe_config->pipe_src_w, &pipe_config->pipe_src_h); -for_each_connector_in_state (state, connector, connector_state, i) { +for_each_new_connector_in_state (state, connector, connector_state, i) {if (connector_state->crtc != crtc)continue ;@@ -13023,7 +13024,7 @@ encoder_retry:* adjust it according to limitations or connector properties, and also * a chance to reject the mode entirely. */ -for_each_connector_in_state (state, connector, connector_state, i) { +for_each_new_connector_in_state (state, connector, connector_state, i) {if (connector_state->crtc != crtc)continue ;@@ -13072,16 +13073,16 @@ static void intel_modeset_update_crtc_state(struct drm_atomic_state *state) {struct drm_crtc *crtc; -struct drm_crtc_state *crtc_state; +struct drm_crtc_state *new_crtc_state;int i;/* Double check state. */ -for_each_crtc_in_state (state, crtc, crtc_state, i) { -to_intel_crtc (crtc)->config =to_intel_crtc_state (crtc->state); +for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) {
drivers/gpu/drm/i915/intel_display.c static void · line 13088
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +3
-2+to_intel_crtc (crtc)->config =to_intel_crtc_state (new_crtc_state);/* Update hwmode for vblank functions */ -if (crtc->state->active) - crtc->hwmode = crtc->state->adjusted_mode; +if (new_crtc_state->active) + crtc->hwmode = new_crtc_state->adjusted_mode;else crtc->hwmode.crtc_clock =0 ;
There's some primary->state stuff left after this point.
Quoted 49 lines
drivers/gpu/drm/i915/intel_display.c +7
-7@@ -13753,21 +13754,21 @@ static void intel_modeset_clear_plls(struct drm_atomic_state *state)struct drm_i915_private *dev_priv =to_i915 (dev);struct intel_shared_dpll_config *shared_dpll =NULL ;struct drm_crtc *crtc; -struct drm_crtc_state *crtc_state; +struct drm_crtc_state *old_crtc_state, *new_crtc_state;int i;if (!dev_priv->display.crtc_compute_clock)return ; -for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_oldnew_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 (crtc->state)->shared_dpll; +to_intel_crtc_state (old_crtc_state)->shared_dpll; -if (!needs_modeset (crtc_state)) +if (!needs_modeset (new_crtc_state))continue ; -to_intel_crtc_state (crtc_state)->shared_dpll =NULL ; +to_intel_crtc_state (new_crtc_state)->shared_dpll =NULL ;if (!old_dpll)continue ;@@ -13796,7 +13797,7 @@ static int haswell_mode_set_planes_workaround(struct drm_atomic_state *state)int i;/* look at all crtc's that are going to be enabled in during modeset */ -for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, crtc_state, i) { intel_crtc =to_intel_crtc (crtc);if (!crtc_state->active || !needs_modeset (crtc_state))@@ -13878,7 +13879,7 @@ static int intel_modeset_checks(struct drm_atomic_state *state)struct intel_atomic_state *intel_state =to_intel_atomic_state (state);struct drm_i915_private *dev_priv =to_i915 (state->dev);struct drm_crtc *crtc; -struct drm_crtc_state *crtc_state; +struct drm_crtc_state *old_crtc_state, *new_crtc_state;int ret =0 , i;if (!check_digital_port_conflicts (state)) {@@ -13889,13 +13890,13 @@ static int intel_modeset_checks(struct drm_atomic_state *state) intel_state->modeset = true; intel_state->active_crtcs = dev_priv->active_crtcs;
drivers/gpu/drm/i915/intel_display.c static int intel_modeset_checks(struct drm_atomic_state *state) · line 13899
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +3
-3-for_each_crtc_in_state (state, crtc, crtc_state, i) { -if (crtc_state->active) +for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) { +if (new_crtc_state->active) intel_state->active_crtcs |=1 << i;else intel_state->active_crtcs &= ~(1 << i); -if (crtc_state->active != crtc->state->active) +if (old_crtc_state->active != new_crtc_state->active)
Almost caught me with rearragning the order ;)
Quoted 251 lines
drivers/gpu/drm/i915/intel_display.c +41
-38intel_state->active_pipe_changes |=drm_crtc_mask (crtc); }@@ -13964,7 +13965,7 @@ static int intel_atomic_check(struct drm_device *dev,struct drm_i915_private *dev_priv =to_i915 (dev);struct intel_atomic_state *intel_state =to_intel_atomic_state (state);struct drm_crtc *crtc; -struct drm_crtc_state *crtc_state; +struct drm_crtc_state *old_crtc_state, *crtc_state;int ret, i;bool any_ms = false;@@ -13972,12 +13973,12 @@ static int intel_atomic_check(struct drm_device *dev,if (ret)return ret; -for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, crtc_state, i) {struct intel_crtc_state *pipe_config =to_intel_crtc_state (crtc_state);/* Catch I915_MODE_FLAG_INHERITED */ -if (crtc_state->mode.private_flags != crtc->state->mode.private_flags) +if (crtc_state->mode.private_flags != old_crtc_state->mode.private_flags) crtc_state->mode_changed = true;if (!needs_modeset (crtc_state))@@ -14004,7 +14005,7 @@ static int intel_atomic_check(struct drm_device *dev,if (i915.fastboot &&intel_pipe_config_compare (dev, -to_intel_crtc_state (crtc->state), +to_intel_crtc_state (old_crtc_state), pipe_config, true)) { crtc_state->mode_changed = false;to_intel_crtc_state (crtc_state)->update_pipe = true;@@ -14049,7 +14050,7 @@ static int intel_atomic_prepare_commit(struct drm_device *dev,struct drm_crtc *crtc;int i, ret; -for_each_crtc_in_state (state, crtc, crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, crtc_state, i) {if (state->legacy_cursor_update)continue ;@@ -14069,7 +14070,7 @@ static int intel_atomic_prepare_commit(struct drm_device *dev,mutex_unlock (&dev->struct_mutex);if (!ret && !nonblock) { -for_each_plane_in_state (state, plane, plane_state, i) { +for_each_new_plane_in_state (state, plane, plane_state, i) {struct intel_plane_state *intel_plane_state =to_intel_plane_state (plane_state);@@ -14171,19 +14172,21 @@ static bool needs_vblank_wait(struct intel_crtc_state *crtc_state)static void intel_update_crtc (struct drm_crtc *crtc,struct drm_atomic_state *state,struct drm_crtc_state *old_crtc_state, +struct drm_crtc_state *new_crtc_state,unsigned int *crtc_vblank_mask) {struct drm_device *dev = crtc->dev;struct drm_i915_private *dev_priv =to_i915 (dev);struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -struct intel_crtc_state *pipe_config =to_intel_crtc_state (crtc->state); -bool modeset =needs_modeset (crtc->state); +struct intel_crtc_state *pipe_config =to_intel_crtc_state (new_crtc_state); +bool modeset =needs_modeset (new_crtc_state);if (modeset) {update_scanline_offset (intel_crtc); dev_priv->display.crtc_enable (pipe_config, state); }else { -intel_pre_plane_update (to_intel_crtc_state (old_crtc_state)); +intel_pre_plane_update (to_intel_crtc_state (old_crtc_state), + pipe_config); }if (drm_atomic_get_existing_plane_state (state, crtc->primary)) {@@ -14202,15 +14205,15 @@ static void intel_update_crtcs(struct drm_atomic_state *state, unsigned int *crtc_vblank_mask) {struct drm_crtc *crtc; -struct drm_crtc_state *old_crtc_state; +struct drm_crtc_state *old_crtc_state, *new_crtc_state;int i; -for_each_crtc_in_state (state, crtc, old_crtc_state, i) { -if (!crtc->state->active) +for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) { +if (!new_crtc_state->active)continue ;intel_update_crtc (crtc, state, old_crtc_state, - crtc_vblank_mask); + new_crtc_state, crtc_vblank_mask); } }@@ -14221,7 +14224,7 @@ static void skl_update_crtcs(struct drm_atomic_state *state,struct drm_i915_private *dev_priv =to_i915 (dev);struct intel_atomic_state *intel_state =to_intel_atomic_state (state);struct drm_crtc *crtc; -struct drm_crtc_state *old_crtc_state; +struct drm_crtc_state *old_crtc_state, *new_crtc_state;struct skl_ddb_allocation *new_ddb = &intel_state->wm_results.ddb;struct skl_ddb_allocation *cur_ddb = &dev_priv->wm.skl_hw.ddb;unsigned int updated =0 ;@@ -14238,12 +14241,12 @@ static void skl_update_crtcs(struct drm_atomic_state *state,int i; progress = false; -for_each_crtc_in_state (state, crtc, old_crtc_state, i) { +for_each_oldnew_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; -if (updated & cmask || !crtc->state->active) +if (updated & cmask || !new_crtc_state->active)continue ;if (skl_ddb_allocation_overlaps (state, cur_ddb, new_ddb, pipe))@@ -14258,12 +14261,12 @@ static void skl_update_crtcs(struct drm_atomic_state *state,* new ddb allocation to take effect. */ if (!skl_ddb_allocation_equals (cur_ddb, new_ddb, pipe) && - !crtc->state->active_changed && + !new_crtc_state->active_changed && intel_state->wm_results.dirty_pipes != updated) vbl_wait = true;intel_update_crtc (crtc, state, old_crtc_state, - crtc_vblank_mask); + new_crtc_state, crtc_vblank_mask);if (vbl_wait)intel_wait_for_vblank (dev, pipe);@@ -14278,7 +14281,7 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state)struct drm_device *dev = state->dev;struct intel_atomic_state *intel_state =to_intel_atomic_state (state);struct drm_i915_private *dev_priv =to_i915 (dev); -struct drm_crtc_state *old_crtc_state; +struct drm_crtc_state *old_crtc_state, *new_crtc_state;struct drm_crtc *crtc;struct intel_crtc_state *intel_cstate;struct drm_plane *plane;@@ -14288,7 +14291,7 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state)unsigned crtc_vblank_mask =0 ;int i, ret; -for_each_plane_in_state (state, plane, plane_state, i) { +for_each_new_plane_in_state (state, plane, plane_state, i) {struct intel_plane_state *intel_plane_state =to_intel_plane_state (plane_state);@@ -14313,22 +14316,23 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state)intel_display_power_get (dev_priv,POWER_DOMAIN_MODESET ); } -for_each_crtc_in_state (state, crtc, old_crtc_state, i) { +for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) {struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -if (needs_modeset (crtc->state) || -to_intel_crtc_state (crtc->state)->update_pipe) { +if (needs_modeset (new_crtc_state) || +to_intel_crtc_state (new_crtc_state)->update_pipe) { hw_check = true; put_domains[to_intel_crtc (crtc)->pipe] =modeset_get_crtc_power_domains (crtc, -to_intel_crtc_state (crtc->state)); +to_intel_crtc_state (new_crtc_state)); } -if (!needs_modeset (crtc->state)) +if (!needs_modeset (new_crtc_state))continue ; -intel_pre_plane_update (to_intel_crtc_state (old_crtc_state)); +intel_pre_plane_update (to_intel_crtc_state (old_crtc_state), +to_intel_crtc_state (new_crtc_state));if (old_crtc_state->active) {intel_crtc_disable_planes (crtc, old_crtc_state->plane_mask);@@ -14372,16 +14376,16 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state) }/* Complete the events for pipes that have now been disabled */ -for_each_crtc_in_state (state, crtc, old_crtc_state, i) { -bool modeset =needs_modeset (crtc->state); +for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) { +bool modeset =needs_modeset (new_crtc_state);/* Complete events for now disable pipes here. */ -if (modeset && !crtc->state->active && crtc->state->event) { +if (modeset && !new_crtc_state->active && new_crtc_state->event) {spin_lock_irq (&dev->event_lock); -drm_crtc_send_vblank_event (crtc, crtc->state->event); +drm_crtc_send_vblank_event (crtc, new_crtc_state->event);spin_unlock_irq (&dev->event_lock); - crtc->state->event =NULL ; + new_crtc_state->event =NULL ; } }@@ -14407,20 +14411,20 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state)* * TODO: Move this (and other cleanup) to an async worker eventually. */ -for_each_crtc_in_state (state, crtc, old_crtc_state, i) { - intel_cstate =to_intel_crtc_state (crtc->state); +for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) { + intel_cstate =to_intel_crtc_state (new_crtc_state);if (dev_priv->display.optimize_watermarks) dev_priv->display.optimize_watermarks (intel_cstate); } -for_each_crtc_in_state (state, crtc, old_crtc_state, i) { +for_each_oldnew_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])modeset_put_power_domains (dev_priv, put_domains[i]); -intel_modeset_verify_crtc (crtc, old_crtc_state, crtc->state); +intel_modeset_verify_crtc (crtc, old_crtc_state, new_crtc_state); } if (IS_SKYLAKE(dev_priv) && intel_state->modeset &&@@ -14464,13 +14468,13 @@ static void intel_atomic_commit_work(struct work_struct *work)static void intel_atomic_track_fbs (struct drm_atomic_state *state) { -struct drm_plane_state *old_plane_state; +struct drm_plane_state *old_plane_state, *new_plane_state;struct drm_plane *plane;int i; -for_each_plane_in_state (state, plane, old_plane_state, i) +for_each_oldnew_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 (plane->state->fb), +intel_fb_obj (new_plane_state->fb),to_intel_plane (plane)->frontbuffer_bit); }
drivers/gpu/drm/i915/intel_display.c retry: · line 16309
Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c +1
-1@@ -16299,7 +16303,7 @@ retry: }/* Write calculated watermark values back */ -for_each_crtc_in_state (state, crtc, cstate, i) { +for_each_new_crtc_in_state (state, crtc, cstate, i) {struct intel_crtc_state *cs =to_intel_crtc_state (cstate); cs->wm.need_postvbl_update = true;
Apart from that lingering primary->state stuff this seems good. I can't say how many other foo->state dereferences still remain as I didn't crawl through the entire codebase.
With that caveat in mind this is
Quoted 7 lines
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Maarten Lankhorst
maintainerPATCH 19/19 drm/atomic: Rename atomic oldnew iterator
In reply to Maarten LankhorstWith 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.
--- 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(-)
drivers/gpu/drm/drm_atomic_helper.c +17 -17
@@ -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 ;
drivers/gpu/drm/drm_blend.c +2 -2
@@ -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,
drivers/gpu/drm/i915/intel_display.c +8 -8
@@ -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);
drivers/gpu/drm/imx/imx-drm-core.c +1 -1
@@ -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;
drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c +1 -1
@@ -84,7 +84,7 @@ static void mdp5_complete_commit(struct msm_kms *kms, struct drm_atomic_state *sstruct 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);
drivers/gpu/drm/msm/msm_atomic.c +1 -1
@@ -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);
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +1 -1
@@ -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 ;
drivers/gpu/drm/vc4/vc4_kms.c +1 -1
@@ -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 );
include/drm/drm_atomic.h +3 -27
@@ -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, \
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 19/19] drm/atomic: Rename atomic oldnew iterator
Quoted 5 lines · Maarten Lankhorst
With the old users of
for_each_obj_in_stategone, we can renamefor_each_oldnew_obj_in_stateback to that name. It's slightly less ugly.Signed-off-by Maarten Lankhorst <[email protected]>
Simple sed/coccinelle job I presume. Assuming the tool works
Quoted 394 lines
--- 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(-)drivers/gpu/drm/drm_atomic_helper.c +17
-17@@ -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 ;drivers/gpu/drm/drm_blend.c +2
-2@@ -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,drivers/gpu/drm/i915/intel_display.c +8
-8@@ -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);drivers/gpu/drm/imx/imx-drm-core.c +1
-1@@ -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;drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c +1
-1@@ -84,7 +84,7 @@ static void mdp5_complete_commit(struct msm_kms *kms, struct drm_atomic_state *sstruct 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);drivers/gpu/drm/msm/msm_atomic.c +1
-1@@ -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);drivers/gpu/drm/rockchip/rockchip_drm_vop.c +1
-1@@ -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 ;drivers/gpu/drm/vc4/vc4_kms.c +1
-1@@ -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 );include/drm/drm_atomic.h +3
-27@@ -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, \Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Patchwork
CI✗ Fi.CI.BAT: warning for drm/atomic: Use less confusing iterator names.
In reply to Maarten Lankhorst== Series Details ==
== Series Details ==
Series: drm/atomic: Use less confusing iterator names.
URL : https://patchwork.freedesktop.org/series/13869/
State : warning
== Summary ==
Series 13869v1 drm/atomic: Use less confusing iterator names.
https://patchwork.freedesktop.org/api/1.0/series/13869/revisions/1/mbox/
Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-b:
dmesg-warn -> PASS (fi-byt-j1900)
Test vgem_basic:
Subgroup unload:
pass -> SKIP (fi-hsw-4770)
pass -> SKIP (fi-kbl-7200u)
skip -> PASS (fi-skl-6770hq)fi-bdw-5557u total:246 pass:231 dwarn:0 dfail:0 fail:0 skip:15 fi-bsw-n3050 total:246 pass:204 dwarn:0 dfail:0 fail:0 skip:42 fi-byt-j1900 total:246 pass:213 dwarn:1 dfail:0 fail:1 skip:31 fi-byt-n2820 total:246 pass:210 dwarn:0 dfail:0 fail:1 skip:35 fi-hsw-4770 total:246 pass:223 dwarn:0 dfail:0 fail:0 skip:23 fi-hsw-4770r total:246 pass:224 dwarn:0 dfail:0 fail:0 skip:22 fi-ilk-650 total:246 pass:184 dwarn:0 dfail:0 fail:2 skip:60 fi-ivb-3520m total:246 pass:221 dwarn:0 dfail:0 fail:0 skip:25 fi-ivb-3770 total:246 pass:221 dwarn:0 dfail:0 fail:0 skip:25 fi-kbl-7200u total:246 pass:221 dwarn:0 dfail:0 fail:0 skip:25 fi-skl-6260u total:246 pass:232 dwarn:0 dfail:0 fail:0 skip:14 fi-skl-6700hq total:246 pass:223 dwarn:0 dfail:0 fail:0 skip:23 fi-skl-6700k total:246 pass:221 dwarn:1 dfail:0 fail:0 skip:24 fi-skl-6770hq total:246 pass:230 dwarn:1 dfail:0 fail:1 skip:14 fi-snb-2520m total:246 pass:210 dwarn:0 dfail:0 fail:0 skip:36 fi-snb-2600 total:246 pass:209 dwarn:0 dfail:0 fail:0 skip:37
Results at /archive/results/CI_IGT_test/Patchwork_2737/
15dfed2b90e84e7c277f81842fc3f19355293061 drm-intel-nightly: 2016y-10m-16d-23h-15m-00s UTC integration manifest ea8593b drm/atomic: Use new atomic iterator macros.
57e7629 drm/atomic: Make add_affected_connectors look at crtc_state.
288fbb6 drm/blend: Use new atomic iterator macros.
18176fd drm/exynos: Use new atomic iterator macros.
19b0930 drm/atmel-hlcdc: Use new atomic iterator macros.
caf279e drm/atomic: Add new iterators over all state
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx