diff mbox series

drm/i915: Determine uses-full-ppgtt from context for execbuf

Message ID 20180901092451.7233-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show
Series drm/i915: Determine uses-full-ppgtt from context for execbuf | expand

Commit Message

Chris Wilson Sept. 1, 2018, 9:24 a.m. UTC
Rather than inspect the global module parameter for whether full-ppgtt
maybe enabled, we can inspect the context directly as to whether it has
its own vm.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Bob Paauwe <bob.j.paauwe@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/i915/i915_gem_execbuffer.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

Rodrigo Vivi Sept. 3, 2018, 5:20 a.m. UTC | #1
On Sat, Sep 01, 2018 at 10:24:51AM +0100, Chris Wilson wrote:
> Rather than inspect the global module parameter for whether full-ppgtt
> maybe enabled, we can inspect the context directly as to whether it has
> its own vm.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Bob Paauwe <bob.j.paauwe@intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>

it is good that we don't need to depend on parameter for this.

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> ---
>  drivers/gpu/drm/i915/i915_gem_execbuffer.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> index a926d7d47183..020a2394fc85 100644
> --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> @@ -735,7 +735,12 @@ static int eb_select_context(struct i915_execbuffer *eb)
>  		return -ENOENT;
>  
>  	eb->ctx = ctx;
> -	eb->vm = ctx->ppgtt ? &ctx->ppgtt->vm : &eb->i915->ggtt.vm;
> +	if (ctx->ppgtt) {
> +		eb->vm = &ctx->ppgtt->vm;
> +		eb->invalid_flags |= EXEC_OBJECT_NEEDS_GTT;
> +	} else {
> +		eb->vm = &eb->i915->ggtt.vm;
> +	}
>  
>  	eb->context_flags = 0;
>  	if (ctx->flags & CONTEXT_NO_ZEROMAP)
> @@ -2201,8 +2206,6 @@ i915_gem_do_execbuffer(struct drm_device *dev,
>  	eb.flags = (unsigned int *)(eb.vma + args->buffer_count + 1);
>  
>  	eb.invalid_flags = __EXEC_OBJECT_UNKNOWN_FLAGS;
> -	if (USES_FULL_PPGTT(eb.i915))
> -		eb.invalid_flags |= EXEC_OBJECT_NEEDS_GTT;
>  	reloc_cache_init(&eb.reloc_cache, eb.i915);
>  
>  	eb.buffer_count = args->buffer_count;
> -- 
> 2.19.0.rc1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Chris Wilson Sept. 3, 2018, 9:15 a.m. UTC | #2
Quoting Rodrigo Vivi (2018-09-03 06:20:22)
> On Sat, Sep 01, 2018 at 10:24:51AM +0100, Chris Wilson wrote:
> > Rather than inspect the global module parameter for whether full-ppgtt
> > maybe enabled, we can inspect the context directly as to whether it has
> > its own vm.
> > 
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> > Cc: Bob Paauwe <bob.j.paauwe@intel.com>
> > Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> 
> it is good that we don't need to depend on parameter for this.
> 
> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

Ta, pushed. Along the create path it's a little trickier, but we would
rather push the decision down as to what type of ppgtt to create (if
any) to the responsible subsystem. There ought to be a simple way!
-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 a926d7d47183..020a2394fc85 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -735,7 +735,12 @@  static int eb_select_context(struct i915_execbuffer *eb)
 		return -ENOENT;
 
 	eb->ctx = ctx;
-	eb->vm = ctx->ppgtt ? &ctx->ppgtt->vm : &eb->i915->ggtt.vm;
+	if (ctx->ppgtt) {
+		eb->vm = &ctx->ppgtt->vm;
+		eb->invalid_flags |= EXEC_OBJECT_NEEDS_GTT;
+	} else {
+		eb->vm = &eb->i915->ggtt.vm;
+	}
 
 	eb->context_flags = 0;
 	if (ctx->flags & CONTEXT_NO_ZEROMAP)
@@ -2201,8 +2206,6 @@  i915_gem_do_execbuffer(struct drm_device *dev,
 	eb.flags = (unsigned int *)(eb.vma + args->buffer_count + 1);
 
 	eb.invalid_flags = __EXEC_OBJECT_UNKNOWN_FLAGS;
-	if (USES_FULL_PPGTT(eb.i915))
-		eb.invalid_flags |= EXEC_OBJECT_NEEDS_GTT;
 	reloc_cache_init(&eb.reloc_cache, eb.i915);
 
 	eb.buffer_count = args->buffer_count;