fd_gmem_render_tiles(batch);
batch_reset_resources(batch);
- batch->ctx->last_fence = fd_ringbuffer_timestamp(batch->gmem);
}
static void
} 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);
_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;
fd_batch_sync(last_batch);
fd_batch_reference(&last_batch, NULL);
}
-
- return ctx->last_fence;
}
void
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);
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);
}
/**
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);
*/
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.
};
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)
{
*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)
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)
#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_ */
#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"
}
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
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);