mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-04 02:40:11 +01:00
freedreno: some fence cleanup
Prep-work for next patch, mostly move to tracking last_fence as a pipe_fence_handle (created now only in fd_gmem_render_tiles()), and a bit of superficial renaming. Signed-off-by: Rob Clark <robdclark@gmail.com>
This commit is contained in:
parent
026a7223a6
commit
16f6ceaca9
9 changed files with 23 additions and 27 deletions
|
|
@ -234,7 +234,6 @@ batch_flush_func(void *job, int id)
|
|||
|
||||
fd_gmem_render_tiles(batch);
|
||||
batch_reset_resources(batch);
|
||||
batch->ctx->last_fence = fd_ringbuffer_timestamp(batch->gmem);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -275,7 +274,6 @@ batch_flush(struct fd_batch *batch)
|
|||
} else {
|
||||
fd_gmem_render_tiles(batch);
|
||||
batch_reset_resources(batch);
|
||||
batch->ctx->last_fence = fd_ringbuffer_timestamp(batch->gmem);
|
||||
}
|
||||
|
||||
debug_assert(batch->reference.count > 0);
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ fd_bc_fini(struct fd_batch_cache *cache)
|
|||
_mesa_hash_table_destroy(cache->ht, NULL);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
void
|
||||
fd_bc_flush(struct fd_batch_cache *cache, struct fd_context *ctx)
|
||||
{
|
||||
struct hash_entry *entry;
|
||||
|
|
@ -150,8 +150,6 @@ fd_bc_flush(struct fd_batch_cache *cache, struct fd_context *ctx)
|
|||
fd_batch_sync(last_batch);
|
||||
fd_batch_reference(&last_batch, NULL);
|
||||
}
|
||||
|
||||
return ctx->last_fence;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ struct fd_batch_cache {
|
|||
void fd_bc_init(struct fd_batch_cache *cache);
|
||||
void fd_bc_fini(struct fd_batch_cache *cache);
|
||||
|
||||
uint32_t fd_bc_flush(struct fd_batch_cache *cache, struct fd_context *ctx);
|
||||
void fd_bc_flush(struct fd_batch_cache *cache, struct fd_context *ctx);
|
||||
|
||||
void fd_bc_invalidate_context(struct fd_context *ctx);
|
||||
void fd_bc_invalidate_batch(struct fd_batch *batch, bool destroy);
|
||||
|
|
|
|||
|
|
@ -43,22 +43,15 @@ fd_context_flush(struct pipe_context *pctx, struct pipe_fence_handle **fence,
|
|||
unsigned flags)
|
||||
{
|
||||
struct fd_context *ctx = fd_context(pctx);
|
||||
uint32_t timestamp;
|
||||
|
||||
if (!ctx->screen->reorder) {
|
||||
struct fd_batch *batch = NULL;
|
||||
fd_batch_reference(&batch, ctx->batch);
|
||||
fd_batch_flush(batch, true);
|
||||
timestamp = fd_ringbuffer_timestamp(batch->gmem);
|
||||
fd_batch_reference(&batch, NULL);
|
||||
fd_batch_flush(ctx->batch, true);
|
||||
} else {
|
||||
timestamp = fd_bc_flush(&ctx->screen->batch_cache, ctx);
|
||||
fd_bc_flush(&ctx->screen->batch_cache, ctx);
|
||||
}
|
||||
|
||||
if (fence) {
|
||||
fd_screen_fence_ref(pctx->screen, fence, NULL);
|
||||
*fence = fd_fence_create(pctx, timestamp);
|
||||
}
|
||||
if (fence)
|
||||
fd_fence_ref(pctx->screen, fence, ctx->last_fence);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -109,6 +102,8 @@ fd_context_destroy(struct pipe_context *pctx)
|
|||
fd_batch_reference(&ctx->batch, NULL); /* unref current batch */
|
||||
fd_bc_invalidate_context(ctx);
|
||||
|
||||
fd_fence_ref(pctx->screen, &ctx->last_fence, NULL);
|
||||
|
||||
fd_prog_fini(pctx);
|
||||
fd_hw_query_fini(pctx);
|
||||
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ struct fd_context {
|
|||
*/
|
||||
struct fd_batch *batch;
|
||||
|
||||
uint32_t last_fence;
|
||||
struct pipe_fence_handle *last_fence;
|
||||
|
||||
/* Are we in process of shadowing a resource? Used to detect recursion
|
||||
* in transfer_map, and skip unneeded synchronization.
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ struct pipe_fence_handle {
|
|||
};
|
||||
|
||||
void
|
||||
fd_screen_fence_ref(struct pipe_screen *pscreen,
|
||||
fd_fence_ref(struct pipe_screen *pscreen,
|
||||
struct pipe_fence_handle **ptr,
|
||||
struct pipe_fence_handle *pfence)
|
||||
{
|
||||
|
|
@ -50,7 +50,7 @@ fd_screen_fence_ref(struct pipe_screen *pscreen,
|
|||
*ptr = pfence;
|
||||
}
|
||||
|
||||
boolean fd_screen_fence_finish(struct pipe_screen *screen,
|
||||
boolean fd_fence_finish(struct pipe_screen *pscreen,
|
||||
struct pipe_context *ctx,
|
||||
struct pipe_fence_handle *fence,
|
||||
uint64_t timeout)
|
||||
|
|
@ -61,11 +61,10 @@ boolean fd_screen_fence_finish(struct pipe_screen *screen,
|
|||
return true;
|
||||
}
|
||||
|
||||
struct pipe_fence_handle * fd_fence_create(struct pipe_context *pctx,
|
||||
struct pipe_fence_handle * fd_fence_create(struct fd_context *ctx,
|
||||
uint32_t timestamp)
|
||||
{
|
||||
struct pipe_fence_handle *fence;
|
||||
struct fd_context *ctx = fd_context(pctx);
|
||||
|
||||
fence = CALLOC_STRUCT(pipe_fence_handle);
|
||||
if (!fence)
|
||||
|
|
|
|||
|
|
@ -31,14 +31,16 @@
|
|||
|
||||
#include "pipe/p_context.h"
|
||||
|
||||
void fd_screen_fence_ref(struct pipe_screen *pscreen,
|
||||
void fd_fence_ref(struct pipe_screen *pscreen,
|
||||
struct pipe_fence_handle **ptr,
|
||||
struct pipe_fence_handle *pfence);
|
||||
boolean fd_screen_fence_finish(struct pipe_screen *screen,
|
||||
boolean fd_fence_finish(struct pipe_screen *screen,
|
||||
struct pipe_context *ctx,
|
||||
struct pipe_fence_handle *pfence,
|
||||
uint64_t timeout);
|
||||
struct pipe_fence_handle * fd_fence_create(struct pipe_context *pctx,
|
||||
|
||||
struct fd_context;
|
||||
struct pipe_fence_handle * fd_fence_create(struct fd_context *ctx,
|
||||
uint32_t timestamp);
|
||||
|
||||
#endif /* FREEDRENO_FENCE_H_ */
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
|
||||
#include "freedreno_gmem.h"
|
||||
#include "freedreno_context.h"
|
||||
#include "freedreno_fence.h"
|
||||
#include "freedreno_resource.h"
|
||||
#include "freedreno_query_hw.h"
|
||||
#include "freedreno_util.h"
|
||||
|
|
@ -399,6 +400,9 @@ fd_gmem_render_tiles(struct fd_batch *batch)
|
|||
}
|
||||
|
||||
fd_ringbuffer_flush(batch->gmem);
|
||||
|
||||
fd_fence_ref(&ctx->screen->base, &ctx->last_fence, NULL);
|
||||
ctx->last_fence = fd_fence_create(ctx, fd_ringbuffer_timestamp(batch->gmem));
|
||||
}
|
||||
|
||||
/* tile needs restore if it isn't completely contained within the
|
||||
|
|
|
|||
|
|
@ -711,8 +711,8 @@ fd_screen_create(struct fd_device *dev)
|
|||
|
||||
pscreen->get_timestamp = fd_screen_get_timestamp;
|
||||
|
||||
pscreen->fence_reference = fd_screen_fence_ref;
|
||||
pscreen->fence_finish = fd_screen_fence_finish;
|
||||
pscreen->fence_reference = fd_fence_ref;
|
||||
pscreen->fence_finish = fd_fence_finish;
|
||||
|
||||
slab_create_parent(&screen->transfer_pool, sizeof(struct fd_transfer), 16);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue