[Intel-gfx] [PATCH 3/6] drm/i915: Stop looking at plane->state in intel_prepare_plane_fb()

Chris Wilson chris at chris-wilson.co.uk
Fri Jan 10 20:10:21 UTC 2020


Quoting Ville Syrjala (2020-01-10 18:32:25)
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
> 
> Switch over to using explicit old/new planes states instead of
> digging the old state out via plane->state. The main issue is that
> plane->state will point to the uapi state which we generally don't
> even want to look at.
> 
> Also it sets a bad example as using plane->state during commit_tail()
> would be a bug. Here we're still holding the modeset locks so it's
> actually safe, but best not give people bad ideas.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 0a1f2564dea0..0df0719b0ac3 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -15749,23 +15749,25 @@ static void fb_obj_bump_render_priority(struct drm_i915_gem_object *obj)
>   * Returns 0 on success, negative error code on failure.
>   */
>  int
> -intel_prepare_plane_fb(struct drm_plane *plane,
> +intel_prepare_plane_fb(struct drm_plane *_plane,
>                        struct drm_plane_state *_new_plane_state)
>  {
> +       struct intel_plane *plane = to_intel_plane(_plane);
>         struct intel_plane_state *new_plane_state =
>                 to_intel_plane_state(_new_plane_state);
>         struct intel_atomic_state *intel_state =
>                 to_intel_atomic_state(new_plane_state->uapi.state);
> -       struct drm_i915_private *dev_priv = to_i915(plane->dev);
> -       struct drm_framebuffer *fb = new_plane_state->hw.fb;
> -       struct drm_i915_gem_object *obj = intel_fb_obj(fb);
> -       struct drm_i915_gem_object *old_obj = intel_fb_obj(plane->state->fb);
> +       struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
> +       const struct intel_plane_state *old_plane_state =
> +               intel_atomic_get_old_plane_state(intel_state, plane);
> +       struct drm_i915_gem_object *obj = intel_fb_obj(new_plane_state->hw.fb);
> +       struct drm_i915_gem_object *old_obj = intel_fb_obj(old_plane_state->hw.fb);

intel_state being the old one out. Often called just state in other
functions?
-Chris


More information about the Intel-gfx mailing list