[Mesa-dev] [PATCH 2/6] i965/sync: Stop cacheing fence's signal status
Kenneth Graunke
kenneth at whitecape.org
Mon Oct 3 01:53:28 UTC 2016
On Tuesday, September 27, 2016 11:51:20 PM PDT Chad Versace wrote:
> Cacheing the signal status complicates the code for questionable
> performance benefit. I added the cacheing long ago, and I now think it
> was the wrong decision.
>
> When we later add support for fences based on sync fds (that is, a fd
> backed by struct sync_file in Linux 4.8), the cacheing becomes even more
> hairy. So it's best to eliminate it now.
> ---
> src/mesa/drivers/dri/i965/intel_syncobj.c | 27 ++-------------------------
> 1 file changed, 2 insertions(+), 25 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/intel_syncobj.c b/src/mesa/drivers/dri/i965/intel_syncobj.c
> index 4276f3f..ba8d3d0 100644
> --- a/src/mesa/drivers/dri/i965/intel_syncobj.c
> +++ b/src/mesa/drivers/dri/i965/intel_syncobj.c
> @@ -47,9 +47,7 @@ struct brw_fence {
> struct brw_context *brw;
> /** The fence waits for completion of this batch. */
> drm_intel_bo *batch_bo;
> -
> mtx_t mutex;
> - bool signalled;
> };
>
> struct intel_gl_sync_object {
> @@ -78,7 +76,6 @@ static void
> brw_fence_insert(struct brw_context *brw, struct brw_fence *fence)
> {
> assert(!fence->batch_bo);
> - assert(!fence->signalled);
>
> brw_emit_mi_flush(brw);
> fence->batch_bo = brw->batch.bo;
> @@ -89,17 +86,7 @@ brw_fence_insert(struct brw_context *brw, struct brw_fence *fence)
> static bool
> brw_fence_has_completed_locked(struct brw_fence *fence)
> {
> - if (fence->signalled)
> - return true;
> -
> - if (fence->batch_bo && !drm_intel_bo_busy(fence->batch_bo)) {
> - drm_intel_bo_unreference(fence->batch_bo);
> - fence->batch_bo = NULL;
> - fence->signalled = true;
> - return true;
> - }
> -
> - return false;
> + return !drm_intel_bo_busy(fence->batch_bo);
> }
Aside from making it faster to answer repeated "is it done yet?" queries
(which I agree is of dubious value)...this also makes it possible to
release batch_bo earlier. Now you have to keep it around until the
fence object is destroyed. That seems less than ideal?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20161002/3271db36/attachment-0001.sig>
More information about the mesa-dev
mailing list