Re: [PATCH 11/16] drm/i915/gen9: Allow watermark calculation on in-flight atomic state

Maarten Lankhorst
2016-04-05T09:53:00Z

Op 01-04-16 om 03:46 schreef Matt Roper:
> In an upcoming patch we'll move this calculation to the atomic 'check'
> phase so that the display update can be rejected early if no valid
> watermark programming is possible.
>
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> ---
> drivers/gpu/drm/i915/intel_drv.h | 21 +++++++++++++++++++++
> drivers/gpu/drm/i915/intel_pm.c | 31 +++++++++++++++++++------------
> 2 files changed, 40 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 483261c..6471f69 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1667,6 +1667,27 @@ intel_atomic_get_existing_plane_state(struct drm_atomic_state *state,
> return to_intel_plane_state(plane_state);
> }
>
> +/*
> + * If cstate is in-flight, return in-flight plane state, otherwise
> + * return committed plane state.
> + */
> +static inline struct intel_plane_state *
> +intel_pstate_for_cstate_plane(struct intel_crtc_state *cstate,
> + struct intel_plane *plane)
> +{
> + struct drm_atomic_state *state = cstate->base.state;
> + struct drm_plane_state *pstate;
> +
> + if (state == NULL)
> + return to_intel_plane_state(plane->base.state);
> +
> + pstate = drm_atomic_get_plane_state(state, &plane->base);
> +
> + return to_intel_plane_state(pstate);
> +}
> +
Don't create a helper please, this should only be done when transitioning code situations.

plane->base.state might not be the right state when we support more than 1 pending atomic commit.

~Maarten