From 20f677f6bccdabafbffd0d8e948514dda0acb3f4 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Tue, 17 Jul 2018 09:54:23 -0400 Subject: [PATCH] freedreno: get rid of noop render This was basically to avoid a zero-dword IB (indirect-branch), but instead just don't emit the IB packet in that case. Signed-off-by: Rob Clark --- src/gallium/drivers/freedreno/freedreno_batch.c | 5 ----- src/gallium/drivers/freedreno/freedreno_gmem.c | 15 --------------- src/gallium/drivers/freedreno/freedreno_gmem.h | 1 - src/gallium/drivers/freedreno/freedreno_util.h | 6 ++++++ 4 files changed, 6 insertions(+), 21 deletions(-) diff --git a/src/gallium/drivers/freedreno/freedreno_batch.c b/src/gallium/drivers/freedreno/freedreno_batch.c index 9918c259e48..6244e3bcc25 100644 --- a/src/gallium/drivers/freedreno/freedreno_batch.c +++ b/src/gallium/drivers/freedreno/freedreno_batch.c @@ -276,10 +276,6 @@ batch_flush(struct fd_batch *batch, bool force) DBG("%p: needs_flush=%d", batch, batch->needs_flush); if (!batch->needs_flush) { - if (force) { - fd_gmem_render_noop(batch); - goto out; - } return; } @@ -310,7 +306,6 @@ batch_flush(struct fd_batch *batch, bool force) debug_assert(batch->reference.count > 0); -out: if (batch == batch->ctx->batch) { batch_reset(batch); } else { diff --git a/src/gallium/drivers/freedreno/freedreno_gmem.c b/src/gallium/drivers/freedreno/freedreno_gmem.c index 1cd254b3629..95b4c16e091 100644 --- a/src/gallium/drivers/freedreno/freedreno_gmem.c +++ b/src/gallium/drivers/freedreno/freedreno_gmem.c @@ -442,21 +442,6 @@ fd_gmem_render_tiles(struct fd_batch *batch) flush_ring(batch); } -/* special case for when we need to create a fence but have no rendering - * to flush.. just emit a no-op string-marker packet. - */ -void -fd_gmem_render_noop(struct fd_batch *batch) -{ - struct fd_context *ctx = batch->ctx; - struct pipe_context *pctx = &ctx->base; - - pctx->emit_string_marker(pctx, "noop", 4); - /* emit IB to drawcmds (which contain the string marker): */ - ctx->emit_ib(batch->gmem, batch->draw); - flush_ring(batch); -} - /* tile needs restore if it isn't completely contained within the * cleared scissor: */ diff --git a/src/gallium/drivers/freedreno/freedreno_gmem.h b/src/gallium/drivers/freedreno/freedreno_gmem.h index 07e13f57328..144e9506cfb 100644 --- a/src/gallium/drivers/freedreno/freedreno_gmem.h +++ b/src/gallium/drivers/freedreno/freedreno_gmem.h @@ -63,7 +63,6 @@ struct fd_gmem_stateobj { struct fd_batch; void fd_gmem_render_tiles(struct fd_batch *batch); -void fd_gmem_render_noop(struct fd_batch *batch); bool fd_gmem_needs_restore(struct fd_batch *batch, struct fd_tile *tile, uint32_t buffers); diff --git a/src/gallium/drivers/freedreno/freedreno_util.h b/src/gallium/drivers/freedreno/freedreno_util.h index cdac08be6e2..d8dec0151d0 100644 --- a/src/gallium/drivers/freedreno/freedreno_util.h +++ b/src/gallium/drivers/freedreno/freedreno_util.h @@ -355,6 +355,9 @@ OUT_WFI5(struct fd_ringbuffer *ring) static inline void __OUT_IB(struct fd_ringbuffer *ring, bool prefetch, struct fd_ringbuffer *target) { + if (target->cur == target->start) + return; + unsigned count = fd_ringbuffer_cmd_count(target); debug_assert(__gpu_id(ring) < 500); @@ -382,6 +385,9 @@ __OUT_IB(struct fd_ringbuffer *ring, bool prefetch, struct fd_ringbuffer *target static inline void __OUT_IB5(struct fd_ringbuffer *ring, struct fd_ringbuffer *target) { + if (target->cur == target->start) + return; + unsigned count = fd_ringbuffer_cmd_count(target); for (unsigned i = 0; i < count; i++) { -- 2.30.2