diff mbox series

[11/23] drm/i915: Nuke arguments to eb_pin_engine

Message ID 20200703122221.591656-12-maarten.lankhorst@linux.intel.com
State New, archived
Headers show
Series drm/i915: Use ww locking in execbuf submission. | expand

Commit Message

Maarten Lankhorst July 3, 2020, 12:22 p.m. UTC
Those arguments are already set as eb.file and eb.args, so kill off
the extra arguments. This will allow us to move eb_pin_engine() to
after we reserved all BO's.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

Comments

Tvrtko Ursulin July 3, 2020, 1:38 p.m. UTC | #1
On 03/07/2020 13:22, Maarten Lankhorst wrote:
> Those arguments are already set as eb.file and eb.args, so kill off
> the extra arguments. This will allow us to move eb_pin_engine() to
> after we reserved all BO's.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
>   drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 17 +++++++----------
>   1 file changed, 7 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> index 45ef9b2368a1..09f3badd564d 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> @@ -2599,11 +2599,10 @@ static void eb_unpin_engine(struct i915_execbuffer *eb)
>   }
>   
>   static unsigned int
> -eb_select_legacy_ring(struct i915_execbuffer *eb,
> -		      struct drm_file *file,
> -		      struct drm_i915_gem_execbuffer2 *args)
> +eb_select_legacy_ring(struct i915_execbuffer *eb)
>   {
>   	struct drm_i915_private *i915 = eb->i915;
> +	struct drm_i915_gem_execbuffer2 *args = eb->args;
>   	unsigned int user_ring_id = args->flags & I915_EXEC_RING_MASK;
>   
>   	if (user_ring_id != I915_EXEC_BSD &&
> @@ -2618,7 +2617,7 @@ eb_select_legacy_ring(struct i915_execbuffer *eb,
>   		unsigned int bsd_idx = args->flags & I915_EXEC_BSD_MASK;
>   
>   		if (bsd_idx == I915_EXEC_BSD_DEFAULT) {
> -			bsd_idx = gen8_dispatch_bsd_engine(i915, file);
> +			bsd_idx = gen8_dispatch_bsd_engine(i915, eb->file);
>   		} else if (bsd_idx >= I915_EXEC_BSD_RING1 &&
>   			   bsd_idx <= I915_EXEC_BSD_RING2) {
>   			bsd_idx >>= I915_EXEC_BSD_SHIFT;
> @@ -2643,18 +2642,16 @@ eb_select_legacy_ring(struct i915_execbuffer *eb,
>   }
>   
>   static int
> -eb_pin_engine(struct i915_execbuffer *eb,
> -	      struct drm_file *file,
> -	      struct drm_i915_gem_execbuffer2 *args)
> +eb_pin_engine(struct i915_execbuffer *eb)
>   {
>   	struct intel_context *ce;
>   	unsigned int idx;
>   	int err;
>   
>   	if (i915_gem_context_user_engines(eb->gem_context))
> -		idx = args->flags & I915_EXEC_RING_MASK;
> +		idx = eb->args->flags & I915_EXEC_RING_MASK;
>   	else
> -		idx = eb_select_legacy_ring(eb, file, args);
> +		idx = eb_select_legacy_ring(eb);
>   
>   	ce = i915_gem_context_get_engine(eb->gem_context, idx);
>   	if (IS_ERR(ce))
> @@ -2920,7 +2917,7 @@ i915_gem_do_execbuffer(struct drm_device *dev,
>   	if (unlikely(err))
>   		goto err_destroy;
>   
> -	err = eb_pin_engine(&eb, file, args);
> +	err = eb_pin_engine(&eb);
>   	if (unlikely(err))
>   		goto err_context;
>   
> 
Reviewed-by: Tvrtko Ursulin <tvrtko.ursuli@intel.com>

Regards,

Tvrtko
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
index 45ef9b2368a1..09f3badd564d 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
@@ -2599,11 +2599,10 @@  static void eb_unpin_engine(struct i915_execbuffer *eb)
 }
 
 static unsigned int
-eb_select_legacy_ring(struct i915_execbuffer *eb,
-		      struct drm_file *file,
-		      struct drm_i915_gem_execbuffer2 *args)
+eb_select_legacy_ring(struct i915_execbuffer *eb)
 {
 	struct drm_i915_private *i915 = eb->i915;
+	struct drm_i915_gem_execbuffer2 *args = eb->args;
 	unsigned int user_ring_id = args->flags & I915_EXEC_RING_MASK;
 
 	if (user_ring_id != I915_EXEC_BSD &&
@@ -2618,7 +2617,7 @@  eb_select_legacy_ring(struct i915_execbuffer *eb,
 		unsigned int bsd_idx = args->flags & I915_EXEC_BSD_MASK;
 
 		if (bsd_idx == I915_EXEC_BSD_DEFAULT) {
-			bsd_idx = gen8_dispatch_bsd_engine(i915, file);
+			bsd_idx = gen8_dispatch_bsd_engine(i915, eb->file);
 		} else if (bsd_idx >= I915_EXEC_BSD_RING1 &&
 			   bsd_idx <= I915_EXEC_BSD_RING2) {
 			bsd_idx >>= I915_EXEC_BSD_SHIFT;
@@ -2643,18 +2642,16 @@  eb_select_legacy_ring(struct i915_execbuffer *eb,
 }
 
 static int
-eb_pin_engine(struct i915_execbuffer *eb,
-	      struct drm_file *file,
-	      struct drm_i915_gem_execbuffer2 *args)
+eb_pin_engine(struct i915_execbuffer *eb)
 {
 	struct intel_context *ce;
 	unsigned int idx;
 	int err;
 
 	if (i915_gem_context_user_engines(eb->gem_context))
-		idx = args->flags & I915_EXEC_RING_MASK;
+		idx = eb->args->flags & I915_EXEC_RING_MASK;
 	else
-		idx = eb_select_legacy_ring(eb, file, args);
+		idx = eb_select_legacy_ring(eb);
 
 	ce = i915_gem_context_get_engine(eb->gem_context, idx);
 	if (IS_ERR(ce))
@@ -2920,7 +2917,7 @@  i915_gem_do_execbuffer(struct drm_device *dev,
 	if (unlikely(err))
 		goto err_destroy;
 
-	err = eb_pin_engine(&eb, file, args);
+	err = eb_pin_engine(&eb);
 	if (unlikely(err))
 		goto err_context;