From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 14/37] drm/i915: Refactor export_fence() after i915_vma_move_to_active()
Date: Fri, 29 Jun 2018 13:00:26 +0100 [thread overview]
Message-ID: <01d67f96-0bb9-2cd0-d176-1d024d1257a9@linux.intel.com> (raw)
In-Reply-To: <20180629075348.27358-14-chris@chris-wilson.co.uk>
On 29/06/2018 08:53, Chris Wilson wrote:
> Currently all callers are responsible for adding the vma to the active
> timeline and then exporting its fence. Combine the two operations into
> i915_vma_move_to_active() to move all the extra handling from the
> callers to the single site.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
> drivers/gpu/drm/i915/i915_gem_execbuffer.c | 47 +++++++++----------
> drivers/gpu/drm/i915/selftests/huge_pages.c | 4 --
> .../drm/i915/selftests/i915_gem_coherency.c | 4 --
> .../gpu/drm/i915/selftests/i915_gem_context.c | 4 --
> 4 files changed, 21 insertions(+), 38 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> index c2dd9b4cdace..91f20445147f 100644
> --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> @@ -1166,15 +1166,9 @@ static int __reloc_gpu_alloc(struct i915_execbuffer *eb,
>
> GEM_BUG_ON(!reservation_object_test_signaled_rcu(batch->resv, true));
> i915_vma_move_to_active(batch, rq, 0);
> - reservation_object_lock(batch->resv, NULL);
> - reservation_object_add_excl_fence(batch->resv, &rq->fence);
> - reservation_object_unlock(batch->resv);
Here now the exclusive fence is not added any more due flags being zero.
> i915_vma_unpin(batch);
>
> 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);
>
> rq->batch = batch;
>
> @@ -1771,25 +1765,6 @@ static int eb_relocate(struct i915_execbuffer *eb)
> return eb_relocate_slow(eb);
> }
>
> -static void eb_export_fence(struct i915_vma *vma,
> - struct i915_request *rq,
> - unsigned int flags)
> -{
> - struct reservation_object *resv = vma->resv;
> -
> - /*
> - * Ignore errors from failing to allocate the new fence, we can't
> - * handle an error right now. Worst case should be missed
> - * synchronisation leading to rendering corruption.
> - */
> - reservation_object_lock(resv, NULL);
> - if (flags & EXEC_OBJECT_WRITE)
> - reservation_object_add_excl_fence(resv, &rq->fence);
> - else if (reservation_object_reserve_shared(resv) == 0)
> - reservation_object_add_shared_fence(resv, &rq->fence);
> - reservation_object_unlock(resv);
> -}
> -
> static int eb_move_to_gpu(struct i915_execbuffer *eb)
> {
> const unsigned int count = eb->buffer_count;
> @@ -1844,7 +1819,6 @@ static int eb_move_to_gpu(struct i915_execbuffer *eb)
> struct i915_vma *vma = eb->vma[i];
>
> i915_vma_move_to_active(vma, eb->request, flags);
> - eb_export_fence(vma, eb->request, flags);
>
> __eb_unreserve_vma(vma, flags);
> vma->exec_flags = NULL;
> @@ -1884,6 +1858,25 @@ static bool i915_gem_check_execbuffer(struct drm_i915_gem_execbuffer2 *exec)
> return true;
> }
>
> +static void export_fence(struct i915_vma *vma,
> + struct i915_request *rq,
> + unsigned int flags)
> +{
> + struct reservation_object *resv = vma->resv;
> +
> + /*
> + * Ignore errors from failing to allocate the new fence, we can't
> + * handle an error right now. Worst case should be missed
> + * synchronisation leading to rendering corruption.
> + */
> + reservation_object_lock(resv, NULL);
> + if (flags & EXEC_OBJECT_WRITE)
> + reservation_object_add_excl_fence(resv, &rq->fence);
> + else if (reservation_object_reserve_shared(resv) == 0)
> + reservation_object_add_shared_fence(resv, &rq->fence);
> + reservation_object_unlock(resv);
> +}
> +
> void i915_vma_move_to_active(struct i915_vma *vma,
> struct i915_request *rq,
> unsigned int flags)
> @@ -1921,6 +1914,8 @@ void i915_vma_move_to_active(struct i915_vma *vma,
>
> if (flags & EXEC_OBJECT_NEEDS_FENCE)
> i915_gem_active_set(&vma->last_fence, rq);
> +
> + export_fence(vma, rq, flags);
> }
>
> static int i915_reset_gen7_sol_offsets(struct i915_request *rq)
> diff --git a/drivers/gpu/drm/i915/selftests/huge_pages.c b/drivers/gpu/drm/i915/selftests/huge_pages.c
> index b5e87fcdcdae..358fc81f6c99 100644
> --- a/drivers/gpu/drm/i915/selftests/huge_pages.c
> +++ b/drivers/gpu/drm/i915/selftests/huge_pages.c
> @@ -998,10 +998,6 @@ static int gpu_write(struct i915_vma *vma,
>
> 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);
> -
> err_request:
> i915_request_add(rq);
>
> diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_coherency.c b/drivers/gpu/drm/i915/selftests/i915_gem_coherency.c
> index a4900091ae3d..11427aae0853 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_gem_coherency.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_gem_coherency.c
> @@ -225,10 +225,6 @@ static int gpu_set(struct drm_i915_gem_object *obj,
> i915_vma_move_to_active(vma, rq, EXEC_OBJECT_WRITE);
> i915_vma_unpin(vma);
>
> - reservation_object_lock(obj->resv, NULL);
> - reservation_object_add_excl_fence(obj->resv, &rq->fence);
> - reservation_object_unlock(obj->resv);
> -
> i915_request_add(rq);
>
> return 0;
> diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_context.c b/drivers/gpu/drm/i915/selftests/i915_gem_context.c
> index 3169b72180d0..a78f8bdb8222 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_gem_context.c
> @@ -179,10 +179,6 @@ static int gpu_fill(struct drm_i915_gem_object *obj,
> i915_vma_move_to_active(vma, rq, 0);
> i915_vma_unpin(vma);
>
> - reservation_object_lock(obj->resv, NULL);
> - reservation_object_add_excl_fence(obj->resv, &rq->fence);
Here as well this won't be added due zero flags.
> - reservation_object_unlock(obj->resv);
> -
> i915_request_add(rq);
>
> return 0;
>
There is one i915_vma_move_to_active in render state and one in gvt
which will now have some extra processing/allocations, do we care?
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2018-06-29 12:00 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-29 7:53 [PATCH 01/37] drm/i915/gtt: Add read only pages to gen8_pte_encode Chris Wilson
2018-06-29 7:53 ` [PATCH 02/37] drm/i915/gtt: Read-only pages for insert_entries on bdw+ Chris Wilson
2018-06-29 7:53 ` [PATCH 03/37] drm/i915: Prevent writing into a read-only object via a GGTT mmap Chris Wilson
2018-06-29 7:53 ` [PATCH 04/37] drm/i915: Reject attempted pwrites into a read-only object Chris Wilson
2018-06-29 7:53 ` [PATCH 05/37] drm/i915/userptr: Enable read-only support on gen8+ Chris Wilson
2018-06-29 7:53 ` [PATCH 06/37] drm/i915: Move rate-limiting request retire to after submission Chris Wilson
2018-06-29 10:00 ` Tvrtko Ursulin
2018-06-29 10:10 ` Chris Wilson
2018-06-29 7:53 ` [PATCH 07/37] drm/i915: Move engine request retirement to intel_engine_cs Chris Wilson
2018-06-29 7:53 ` [PATCH 08/37] drm/i915: Hold request reference for submission until retirement Chris Wilson
2018-06-29 7:53 ` [PATCH 09/37] drm/i915/execlists: Switch to rb_root_cached Chris Wilson
2018-07-11 13:20 ` Tvrtko Ursulin
2018-06-29 7:53 ` [PATCH 10/37] drm/i915: Reserve some priority bits for internal use Chris Wilson
2018-06-29 7:53 ` [PATCH 11/37] drm/i915: Combine multiple internal plists into the same i915_priolist bucket Chris Wilson
2018-06-29 7:53 ` [PATCH 12/37] drm/i915: Priority boost for new clients Chris Wilson
2018-06-29 10:04 ` Tvrtko Ursulin
2018-06-29 10:09 ` Chris Wilson
2018-06-29 10:36 ` Tvrtko Ursulin
2018-06-29 10:41 ` Chris Wilson
2018-06-29 10:51 ` Chris Wilson
2018-06-29 11:10 ` Tvrtko Ursulin
2018-07-02 10:19 ` Tvrtko Ursulin
2018-06-29 7:53 ` [PATCH 13/37] drm/i915: Priority boost switching to an idle ring Chris Wilson
2018-06-29 10:08 ` Tvrtko Ursulin
2018-06-29 10:15 ` Chris Wilson
2018-06-29 10:41 ` Tvrtko Ursulin
2018-06-29 7:53 ` [PATCH 14/37] drm/i915: Refactor export_fence() after i915_vma_move_to_active() Chris Wilson
2018-06-29 12:00 ` Tvrtko Ursulin [this message]
2018-06-29 7:53 ` [PATCH 15/37] drm/i915: Export i915_request_skip() Chris Wilson
2018-06-29 12:10 ` Tvrtko Ursulin
2018-06-29 12:15 ` Chris Wilson
2018-06-29 7:53 ` [PATCH 16/37] drm/i915: Start returning an error from i915_vma_move_to_active() Chris Wilson
2018-06-29 12:17 ` Tvrtko Ursulin
2018-06-29 7:53 ` [PATCH 17/37] drm/i915: Track vma activity per fence.context, not per engine Chris Wilson
2018-06-29 14:54 ` Tvrtko Ursulin
2018-06-29 15:03 ` Chris Wilson
2018-06-29 15:34 ` Chris Wilson
2018-06-29 15:08 ` Tvrtko Ursulin
2018-06-29 15:36 ` Chris Wilson
2018-06-29 15:39 ` Chris Wilson
2018-07-02 9:38 ` Tvrtko Ursulin
2018-06-29 22:03 ` [PATCH v2] " Chris Wilson
2018-06-29 7:53 ` [PATCH 18/37] drm/i915: Track the last-active inside the i915_vma Chris Wilson
2018-06-29 22:01 ` [PATCH v2] " Chris Wilson
2018-06-29 7:53 ` [PATCH 19/37] drm/i915: Stop tracking MRU activity on VMA Chris Wilson
2018-06-29 7:53 ` [PATCH 20/37] drm/i915: Introduce the i915_user_extension_method Chris Wilson
2018-06-29 7:53 ` [PATCH 21/37] drm/i915: Extend CREATE_CONTEXT to allow inheritance ala clone() Chris Wilson
2018-06-29 7:53 ` [PATCH 22/37] drm/i915: Allow contexts to share a single timeline across all engines Chris Wilson
2018-06-29 7:53 ` [PATCH 23/37] drm/i915: Fix I915_EXEC_RING_MASK Chris Wilson
2018-06-29 7:53 ` [PATCH 24/37] drm/i915: Re-arrange execbuf so context is known before engine Chris Wilson
2018-06-29 7:53 ` [PATCH 25/37] drm/i915: Allow a context to define its set of engines Chris Wilson
2018-06-29 7:53 ` [PATCH 26/37] drm/i915/execlists: Flush the tasklet before unpinning Chris Wilson
2018-06-29 7:53 ` [PATCH 27/37] drm/i915/execlists: Refactor out can_merge_rq() Chris Wilson
2018-06-29 7:53 ` [PATCH 28/37] drm/i915: Replace nested subclassing with explicit subclasses Chris Wilson
2018-06-29 7:53 ` [PATCH 29/37] RFC drm/i915: Load balancing across a virtual engine Chris Wilson
2018-06-29 7:53 ` [PATCH 30/37] drm/i915: Introduce i915_address_space.mutex Chris Wilson
2018-06-29 7:53 ` [PATCH 31/37] drm/i915: Move fence register tracking to GGTT Chris Wilson
2018-06-29 7:53 ` [PATCH 32/37] drm/i915: Convert fences to use a GGTT lock rather than struct_mutex Chris Wilson
2018-06-29 7:53 ` [PATCH 33/37] drm/i915: Tidy i915_gem_suspend() Chris Wilson
2018-06-29 7:53 ` [PATCH 34/37] drm/i915: Move fence-reg interface to i915_gem_fence_reg.h Chris Wilson
2018-06-29 7:53 ` [PATCH 35/37] drm/i915: Dynamically allocate the array of drm_i915_gem_fence_reg Chris Wilson
2018-06-29 7:53 ` [PATCH 36/37] drm/i915: Pull all the reset functionality together into i915_reset.c Chris Wilson
2018-06-29 7:53 ` [PATCH 37/37] drm/i915: Remove GPU reset dependence on struct_mutex Chris Wilson
2018-06-29 8:58 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [01/37] drm/i915/gtt: Add read only pages to gen8_pte_encode Patchwork
2018-06-29 9:14 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-06-29 9:16 ` ✓ Fi.CI.BAT: success " Patchwork
2018-06-29 11:53 ` ✗ Fi.CI.IGT: failure " Patchwork
2018-06-29 22:38 ` ✗ Fi.CI.BAT: failure for series starting with [01/37] drm/i915/gtt: Add read only pages to gen8_pte_encode (rev3) Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=01d67f96-0bb9-2cd0-d176-1d024d1257a9@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.