diff mbox

[2/2] drm/i915/selftesta: Attach the fence to the object when making busy

Message ID 20180629133717.11761-2-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson June 29, 2018, 1:37 p.m. UTC
make_obj_busy() makes a dummy busy object, but didn't attach the fence
to the reservation object, so it would not have registered as busy. For
completeness, attach the dummy request as the exclusive fence and mark
the object as written (in i915_vma_move_to_active)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 drivers/gpu/drm/i915/selftests/i915_gem_object.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Tvrtko Ursulin June 29, 2018, 2:15 p.m. UTC | #1
On 29/06/2018 14:37, Chris Wilson wrote:
> make_obj_busy() makes a dummy busy object, but didn't attach the fence
> to the reservation object, so it would not have registered as busy. For
> completeness, attach the dummy request as the exclusive fence and mark
> the object as written (in i915_vma_move_to_active)
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
>   drivers/gpu/drm/i915/selftests/i915_gem_object.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_object.c b/drivers/gpu/drm/i915/selftests/i915_gem_object.c
> index 549707b9d738..77dd7a510ea6 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_gem_object.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_gem_object.c
> @@ -454,7 +454,12 @@ static int make_obj_busy(struct drm_i915_gem_object *obj)
>   		return PTR_ERR(rq);
>   	}
>   
> -	i915_vma_move_to_active(vma, rq, 0);
> +	i915_vma_move_to_active(vma, rq, EXEC_OBJECT_WRITE);
> +
> +	reservation_object_lock(vma->resv, NULL);
> +	reservation_object_add_excl_fence(vma->resv, &rq->fence);
> +	reservation_object_unlock(vma->resv);
> +
>   	i915_request_add(rq);
>   
>   	i915_gem_object_set_active_reference(obj);
> 

Does it matter or not if the object is marked as written to in this 
test? But anyway:

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

Tvrtko
Chris Wilson June 29, 2018, 2:28 p.m. UTC | #2
Quoting Tvrtko Ursulin (2018-06-29 15:15:30)
> 
> On 29/06/2018 14:37, Chris Wilson wrote:
> > make_obj_busy() makes a dummy busy object, but didn't attach the fence
> > to the reservation object, so it would not have registered as busy. For
> > completeness, attach the dummy request as the exclusive fence and mark
> > the object as written (in i915_vma_move_to_active)
> > 
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> > ---
> >   drivers/gpu/drm/i915/selftests/i915_gem_object.c | 7 ++++++-
> >   1 file changed, 6 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_object.c b/drivers/gpu/drm/i915/selftests/i915_gem_object.c
> > index 549707b9d738..77dd7a510ea6 100644
> > --- a/drivers/gpu/drm/i915/selftests/i915_gem_object.c
> > +++ b/drivers/gpu/drm/i915/selftests/i915_gem_object.c
> > @@ -454,7 +454,12 @@ static int make_obj_busy(struct drm_i915_gem_object *obj)
> >               return PTR_ERR(rq);
> >       }
> >   
> > -     i915_vma_move_to_active(vma, rq, 0);
> > +     i915_vma_move_to_active(vma, rq, EXEC_OBJECT_WRITE);
> > +
> > +     reservation_object_lock(vma->resv, NULL);
> > +     reservation_object_add_excl_fence(vma->resv, &rq->fence);
> > +     reservation_object_unlock(vma->resv);
> > +
> >       i915_request_add(rq);
> >   
> >       i915_gem_object_set_active_reference(obj);
> > 
> 
> Does it matter or not if the object is marked as written to in this 
> test? But anyway:

No. The only user was checking for obj->active and calling
i915_gem_wait_for_idle, so not inspecting obj->resv at all. So for the
moment, it doesn't matter, and using the exclusive slot is easier.
Adding make_obj_busy(flags = EXEC_OBJECT_WRITE) seems like a simple
extension for future.
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_object.c b/drivers/gpu/drm/i915/selftests/i915_gem_object.c
index 549707b9d738..77dd7a510ea6 100644
--- a/drivers/gpu/drm/i915/selftests/i915_gem_object.c
+++ b/drivers/gpu/drm/i915/selftests/i915_gem_object.c
@@ -454,7 +454,12 @@  static int make_obj_busy(struct drm_i915_gem_object *obj)
 		return PTR_ERR(rq);
 	}
 
-	i915_vma_move_to_active(vma, rq, 0);
+	i915_vma_move_to_active(vma, rq, EXEC_OBJECT_WRITE);
+
+	reservation_object_lock(vma->resv, NULL);
+	reservation_object_add_excl_fence(vma->resv, &rq->fence);
+	reservation_object_unlock(vma->resv);
+
 	i915_request_add(rq);
 
 	i915_gem_object_set_active_reference(obj);