i915/gem_exec_schedule: Fill in obj.offset for spinner resubmission

Submitted by Chris Wilson on April 16, 2019, 8:46 a.m.

Details

Message ID 20190416084648.24650-1-chris@chris-wilson.co.uk
State Accepted
Commit 81f4dd04f0109bed01b12133325b1c8d007e38b2
Headers show
Series "i915/gem_exec_schedule: Fill in obj.offset for spinner resubmission" ( rev: 1 ) in IGT (deprecated)

Not browsing as part of any series.

Commit Message

Chris Wilson April 16, 2019, 8:46 a.m.
When resubmitting the spinner, fill in the expected offset so that we
are not tempted to relocate it across contexts (as the spinner must
point back to itself for the MI_BB_START to work). In this case, these
should work correctly as they are reusing the same active vma, but for
pedagogy we should dtrt.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
---
 tests/i915/gem_exec_schedule.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

Patch hide | download patch | download mbox

diff --git a/tests/i915/gem_exec_schedule.c b/tests/i915/gem_exec_schedule.c
index 29653ae24..6f3f52d20 100644
--- a/tests/i915/gem_exec_schedule.c
+++ b/tests/i915/gem_exec_schedule.c
@@ -223,12 +223,9 @@  static void independent(int fd, unsigned int engine)
 		if (spin == NULL) {
 			spin = __igt_spin_batch_new(fd, .engine = other);
 		} else {
-			struct drm_i915_gem_exec_object2 obj = {
-				.handle = spin->handle,
-			};
 			struct drm_i915_gem_execbuffer2 eb = {
 				.buffer_count = 1,
-				.buffers_ptr = to_user_pointer(&obj),
+				.buffers_ptr = to_user_pointer(&spin->obj[1]),
 				.flags = other,
 			};
 			gem_execbuf(fd, &eb);
@@ -621,12 +618,9 @@  static igt_spin_t *__noise(int fd, uint32_t ctx, int prio, igt_spin_t *spin)
 						    .ctx = ctx,
 						    .engine = other);
 		} else {
-			struct drm_i915_gem_exec_object2 obj = {
-				.handle = spin->handle,
-			};
 			struct drm_i915_gem_execbuffer2 eb = {
 				.buffer_count = 1,
-				.buffers_ptr = to_user_pointer(&obj),
+				.buffers_ptr = to_user_pointer(&spin->obj[1]),
 				.rsvd1 = ctx,
 				.flags = other,
 			};

Comments

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

> When resubmitting the spinner, fill in the expected offset so that we
> are not tempted to relocate it across contexts (as the spinner must
> point back to itself for the MI_BB_START to work). In this case, these
> should work correctly as they are reusing the same active vma, but for
> pedagogy we should dtrt.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>

Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>

> ---
>  tests/i915/gem_exec_schedule.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/tests/i915/gem_exec_schedule.c b/tests/i915/gem_exec_schedule.c
> index 29653ae24..6f3f52d20 100644
> --- a/tests/i915/gem_exec_schedule.c
> +++ b/tests/i915/gem_exec_schedule.c
> @@ -223,12 +223,9 @@ static void independent(int fd, unsigned int engine)
>  		if (spin == NULL) {
>  			spin = __igt_spin_batch_new(fd, .engine = other);
>  		} else {
> -			struct drm_i915_gem_exec_object2 obj = {
> -				.handle = spin->handle,
> -			};
>  			struct drm_i915_gem_execbuffer2 eb = {
>  				.buffer_count = 1,
> -				.buffers_ptr = to_user_pointer(&obj),
> +				.buffers_ptr = to_user_pointer(&spin->obj[1]),
>  				.flags = other,
>  			};
>  			gem_execbuf(fd, &eb);
> @@ -621,12 +618,9 @@ static igt_spin_t *__noise(int fd, uint32_t ctx, int prio, igt_spin_t *spin)
>  						    .ctx = ctx,
>  						    .engine = other);
>  		} else {
> -			struct drm_i915_gem_exec_object2 obj = {
> -				.handle = spin->handle,
> -			};
>  			struct drm_i915_gem_execbuffer2 eb = {
>  				.buffer_count = 1,
> -				.buffers_ptr = to_user_pointer(&obj),
> +				.buffers_ptr = to_user_pointer(&spin->obj[1]),
>  				.rsvd1 = ctx,
>  				.flags = other,
>  			};
> -- 
> 2.20.1