All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 4/5] drm/i915: Quick spring clean of intel_prepare_plane_fb()
Date: Tue, 15 Nov 2016 11:23:24 +0100	[thread overview]
Message-ID: <20161115102324.fdu63loejiwccqi4@phenom.ffwll.local> (raw)
In-Reply-To: <20161115085817.4210-4-chris@chris-wilson.co.uk>

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@chris-wilson.co.uk>
> ---
>  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@ffwll.ch>

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

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

  reply	other threads:[~2016-11-15 10:23 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-15  8:58 [PATCH 1/5] drm/i915: Move intel_prepare_plane_fb() and intel_cleanup_plane_fb() Chris Wilson
2016-11-15  8:58 ` [PATCH 2/5] drm/i915: Always prepare planes at the start of an atomic commit Chris Wilson
2016-11-15  9:37   ` Daniel Vetter
2016-11-15  9:47     ` Tvrtko Ursulin
2016-11-15  9:57     ` Chris Wilson
2016-11-15 10:10       ` Daniel Vetter
2016-11-15 10:18         ` Chris Wilson
2016-11-15  8:58 ` [PATCH 3/5] drm/i915: Track pinned vma in intel_plane_state Chris Wilson
2016-11-15  9:52   ` Daniel Vetter
2016-11-15 10:02     ` Chris Wilson
2016-11-15 10:13       ` Daniel Vetter
2016-11-15 10:24   ` Daniel Vetter
2016-11-15  8:58 ` [PATCH 4/5] drm/i915: Quick spring clean of intel_prepare_plane_fb() Chris Wilson
2016-11-15 10:23   ` Daniel Vetter [this message]
2016-11-15  8:58 ` [PATCH 5/5] drm/i915: Set crtc_state->fb_changed whenever a VMA is changed Chris Wilson
2016-11-15 10:15   ` Daniel Vetter
2016-11-15  9:15 ` ✗ Fi.CI.BAT: warning for series starting with [1/5] drm/i915: Move intel_prepare_plane_fb() and intel_cleanup_plane_fb() Patchwork
2016-11-15  9:28 ` [PATCH 1/5] " Daniel Vetter
  -- strict thread matches above, loose matches on Subject: below --
2016-10-29 12:04 Chris Wilson
2016-10-29 12:04 ` [PATCH 4/5] drm/i915: Quick spring clean of intel_prepare_plane_fb() Chris Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161115102324.fdu63loejiwccqi4@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.