mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-05 13:20:10 +01:00
freedreno: Cooperate with tc to stop checking the BC for resource_busy().
The resource_busy() hook was having to check the batch cache for usage of the resource, since TC didn't know how long our driver would. By committing to calling the tc_driver_internal_flush_notify() hook on non-deferred flushes, TC keeps track of which buffers have been used but not flushed and considers them busy, saving us needing to look in the BC (which we won't be able to do once we move it to being per-context). drawoverhead test results (all numbers are throughput, n=5): 1, DrawElements ( 1 VBO| 0 UBO| 0 ) w/ no state change: -4.94214% +/- 2.45047% 7, DrawElements ( 1 VBO| 8 UBO| 8 Tex) w/ vertex attrib change: 48.3992% +/- 5.02827% 8, DrawElements ( 1 VBO| 8 UBO| 8 Tex) w/ 1 texture change: 26.0974% +/- 1.14932% 9, DrawElements ( 1 VBO| 8 UBO| 8 Tex) w/ 8 textures change: 12.6963% +/- 3.01077% 17, DrawElements ( 1 VBO| 8 UBO| 8 Tex) w/ 8 UBOs change: 54.3846% +/- 35.0049% Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11513>
This commit is contained in:
parent
6d0aceae4d
commit
5cb043cf82
2 changed files with 17 additions and 4 deletions
|
|
@ -60,6 +60,8 @@ fd_context_flush(struct pipe_context *pctx, struct pipe_fence_handle **fencep,
|
|||
if (ctx->screen->reorder)
|
||||
fd_bc_flush(ctx, flags & PIPE_FLUSH_DEFERRED);
|
||||
fd_bc_dump(ctx, "%p: NULL batch, remaining:\n", ctx);
|
||||
if (!(flags & PIPE_FLUSH_DEFERRED))
|
||||
tc_driver_internal_flush_notify(ctx->tc);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -138,6 +140,12 @@ fd_context_flush(struct pipe_context *pctx, struct pipe_fence_handle **fencep,
|
|||
fd_bc_dump(ctx, "%p: remaining:\n", ctx);
|
||||
|
||||
out:
|
||||
/* If we just flushed all rendering out of the batch cache, then inform TC
|
||||
* that it can use the resource_busy callback to check if they're still busy.
|
||||
*/
|
||||
if (!(flags & PIPE_FLUSH_DEFERRED))
|
||||
tc_driver_internal_flush_notify(ctx->tc);
|
||||
|
||||
if (fencep)
|
||||
fd_fence_ref(fencep, fence);
|
||||
|
||||
|
|
@ -703,7 +711,7 @@ fd_context_init_tc(struct pipe_context *pctx, unsigned flags)
|
|||
fd_replace_buffer_storage,
|
||||
fd_fence_create_unflushed,
|
||||
fd_resource_busy,
|
||||
false,
|
||||
true,
|
||||
&ctx->tc);
|
||||
|
||||
uint64_t total_ram;
|
||||
|
|
|
|||
|
|
@ -312,15 +312,20 @@ translate_usage(unsigned usage)
|
|||
return op;
|
||||
}
|
||||
|
||||
/* This is called by TC to check if a buffer is idle on the GPU so it can do
|
||||
* unsynchronized mappings from the frontend.
|
||||
*
|
||||
* Note that TC tracks what buffers are outstanding in its queue in between
|
||||
* pctx->flush() calls (which we inform it of through
|
||||
* tc_driver_internal_flush_notify()) so we don't need to go digging in our
|
||||
* batch cache to check for usages.
|
||||
*/
|
||||
bool
|
||||
fd_resource_busy(struct pipe_screen *pscreen, struct pipe_resource *prsc,
|
||||
unsigned usage)
|
||||
{
|
||||
struct fd_resource *rsc = fd_resource(prsc);
|
||||
|
||||
if (pending(rsc, !!(usage & PIPE_MAP_WRITE)))
|
||||
return true;
|
||||
|
||||
if (resource_busy(rsc, translate_usage(usage)))
|
||||
return true;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue