Re: [PATCH 4/5] drm/i915: Quick spring clean of intel_prepare_plane_fb()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Nov 15, 2016 at 08:58:16AM +0000, Chris Wilson wrote:
> Just a quick tidy now to make the next patch neater.
> 
> Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/intel_display.c | 38 ++++++++++++++++++++----------------
>  1 file changed, 21 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index cb52116f8577..4d578dc6d23f 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -14130,6 +14130,17 @@ static int intel_atomic_check(struct drm_device *dev,
>  	return calc_watermark_data(state);
>  }
>  
> +static bool old_plane_needs_modeset(struct drm_plane *plane,
> +				    struct drm_plane_state *new_state)
> +{
> +	struct drm_crtc_state *crtc_state;
> +
> +	crtc_state = drm_atomic_get_existing_crtc_state(new_state->state,
> +							plane->state->crtc);
> +
> +	return needs_modeset(crtc_state);
> +}
> +
>  /**
>   * intel_prepare_plane_fb - Prepare fb for usage on plane
>   * @plane: drm plane to prepare for
> @@ -14153,16 +14164,11 @@ intel_prepare_plane_fb(struct drm_plane *plane,
>  	struct drm_i915_private *dev_priv = to_i915(plane->dev);
>  	struct drm_framebuffer *fb = new_state->fb;
>  	struct drm_i915_gem_object *obj = intel_fb_obj(fb);
> -	struct drm_i915_gem_object *old_obj = intel_fb_obj(plane->state->fb);
>  	int ret;
>  
> -	if (!obj && !old_obj)
> -		return 0;
> -
> -	if (old_obj) {
> -		struct drm_crtc_state *crtc_state =
> -			drm_atomic_get_existing_crtc_state(new_state->state,
> -							   plane->state->crtc);
> +	if (plane->state->fb && old_plane_needs_modeset(plane, new_state)) {
> +		struct drm_i915_gem_object *old_obj =
> +			intel_fb_obj(plane->state->fb);
>  
>  		/* Big Hammer, we also need to ensure that any pending
>  		 * MI_WAIT_FOR_EVENT inside a user batch buffer on the
> @@ -14175,14 +14181,12 @@ intel_prepare_plane_fb(struct drm_plane *plane,
>  		 * This should only fail upon a hung GPU, in which case we
>  		 * can safely continue.
>  		 */
> -		if (needs_modeset(crtc_state)) {
> -			ret = i915_sw_fence_await_reservation(&intel_state->commit_ready,
> -							      old_obj->resv, NULL,
> -							      false, 0,
> -							      GFP_KERNEL);
> -			if (ret < 0)
> -				return ret;
> -		}
> +		ret = i915_sw_fence_await_reservation(&intel_state->commit_ready,
> +						      old_obj->resv, NULL,
> +						      false, 0,
> +						      GFP_KERNEL);
> +		if (ret < 0)
> +			return ret;
>  	}
>  
>  	if (new_state->fence) { /* explicit fencing */
> @@ -14221,7 +14225,7 @@ intel_prepare_plane_fb(struct drm_plane *plane,
>  
>  		vma = intel_pin_and_fence_fb_obj(fb, new_state->rotation);
>  		if (IS_ERR(vma))
> -			ret = PTR_ERR(vma);
> +			return PTR_ERR(vma);

I don't have this one here, I guess you have some different baseline.
Current code already has the direct return (but also a debug output on
top). Looking closer that's a mistake in the preceeding patch, which also
drops the debug output. I didn't spot that, so please fix that patch by
dropping the hunk and then you can drop this one here.

With that:

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

>  
>  		to_intel_plane_state(new_state)->vma = vma;
>  	}
> -- 
> 2.10.2
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux