diff mbox series

[23/38] drm/i915: Re-arrange execbuf so context is known before engine

Message ID 20190301140404.26690-23-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show
Series [01/38] drm/i915/execlists: Suppress redundant preemption | expand

Commit Message

Chris Wilson March 1, 2019, 2:03 p.m. UTC
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Needed for a following patch.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 drivers/gpu/drm/i915/i915_gem_execbuffer.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Comments

Tvrtko Ursulin March 1, 2019, 3:33 p.m. UTC | #1
On 01/03/2019 14:03, Chris Wilson wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> Needed for a following patch.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

I'll do yours, you do mine. Criss-cross. Now that's an oldend but golden 
reference. :)

Regards,

Tvrtko

> ---
>   drivers/gpu/drm/i915/i915_gem_execbuffer.c | 11 +++++++----
>   1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> index 07c0af316f86..53d0d70c97fa 100644
> --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> @@ -2312,10 +2312,6 @@ i915_gem_do_execbuffer(struct drm_device *dev,
>   	if (args->flags & I915_EXEC_IS_PINNED)
>   		eb.batch_flags |= I915_DISPATCH_PINNED;
>   
> -	eb.engine = eb_select_engine(eb.i915, file, args);
> -	if (!eb.engine)
> -		return -EINVAL;
> -
>   	if (args->flags & I915_EXEC_FENCE_IN) {
>   		in_fence = sync_file_get_fence(lower_32_bits(args->rsvd2));
>   		if (!in_fence)
> @@ -2340,6 +2336,12 @@ i915_gem_do_execbuffer(struct drm_device *dev,
>   	if (unlikely(err))
>   		goto err_destroy;
>   
> +	eb.engine = eb_select_engine(eb.i915, file, args);
> +	if (!eb.engine) {
> +		err = -EINVAL;
> +		goto err_engine;
> +	}
> +
>   	/*
>   	 * Take a local wakeref for preparing to dispatch the execbuf as
>   	 * we expect to access the hardware fairly frequently in the
> @@ -2505,6 +2507,7 @@ i915_gem_do_execbuffer(struct drm_device *dev,
>   	mutex_unlock(&dev->struct_mutex);
>   err_rpm:
>   	intel_runtime_pm_put(eb.i915, wakeref);
> +err_engine:
>   	i915_gem_context_put(eb.ctx);
>   err_destroy:
>   	eb_destroy(&eb);
>
Chris Wilson March 1, 2019, 7:11 p.m. UTC | #2
Quoting Tvrtko Ursulin (2019-03-01 15:33:50)
> 
> On 01/03/2019 14:03, Chris Wilson wrote:
> > From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> > 
> > Needed for a following patch.
> > 
> > Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> I'll do yours, you do mine. Criss-cross. Now that's an oldend but golden 
> reference. :)

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>

Must remember to s-o-b, or at least check that dim checks it this time.
-Chris
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 07c0af316f86..53d0d70c97fa 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -2312,10 +2312,6 @@  i915_gem_do_execbuffer(struct drm_device *dev,
 	if (args->flags & I915_EXEC_IS_PINNED)
 		eb.batch_flags |= I915_DISPATCH_PINNED;
 
-	eb.engine = eb_select_engine(eb.i915, file, args);
-	if (!eb.engine)
-		return -EINVAL;
-
 	if (args->flags & I915_EXEC_FENCE_IN) {
 		in_fence = sync_file_get_fence(lower_32_bits(args->rsvd2));
 		if (!in_fence)
@@ -2340,6 +2336,12 @@  i915_gem_do_execbuffer(struct drm_device *dev,
 	if (unlikely(err))
 		goto err_destroy;
 
+	eb.engine = eb_select_engine(eb.i915, file, args);
+	if (!eb.engine) {
+		err = -EINVAL;
+		goto err_engine;
+	}
+
 	/*
 	 * Take a local wakeref for preparing to dispatch the execbuf as
 	 * we expect to access the hardware fairly frequently in the
@@ -2505,6 +2507,7 @@  i915_gem_do_execbuffer(struct drm_device *dev,
 	mutex_unlock(&dev->struct_mutex);
 err_rpm:
 	intel_runtime_pm_put(eb.i915, wakeref);
+err_engine:
 	i915_gem_context_put(eb.ctx);
 err_destroy:
 	eb_destroy(&eb);