diff options
author | Rob Clark <[email protected]> | 2016-07-19 12:08:42 -0400 |
---|---|---|
committer | Rob Clark <[email protected]> | 2016-07-30 09:23:42 -0400 |
commit | e6bfe1c7734cfbf41a763797527db6cb49fa1566 (patch) | |
tree | 2e48a32590d92ecaf31a63789b157e4daa916d69 /src/gallium/drivers/freedreno/freedreno_batch.h | |
parent | 0739bbceecbb66ffbcf14e5b73e6df222794c264 (diff) |
freedreno: move needs_wfi into batch
This is also used in gmem code, which executes from the "bottom half"
(ie. from the flush_queue worker thread), so it cannot be in fd_context.
Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/freedreno_batch.h')
-rw-r--r-- | src/gallium/drivers/freedreno/freedreno_batch.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_batch.h b/src/gallium/drivers/freedreno/freedreno_batch.h index 9b7a8c132b1..1d27a8f0234 100644 --- a/src/gallium/drivers/freedreno/freedreno_batch.h +++ b/src/gallium/drivers/freedreno/freedreno_batch.h @@ -93,6 +93,11 @@ struct fd_batch { bool blit : 1; bool back_blit : 1; /* only blit so far is resource shadowing back-blit */ + /* Keep track if WAIT_FOR_IDLE is needed for registers we need + * to update via RMW: + */ + bool needs_wfi : 1; + /* To decide whether to render to system memory, keep track of the * number of draws, and whether any of them require multisample, * depth_test (or depth write), stencil_test, blending, and @@ -212,4 +217,33 @@ fd_batch_reference(struct fd_batch **ptr, struct fd_batch *batch) *ptr = batch; } +static inline void +fd_reset_wfi(struct fd_batch *batch) +{ + batch->needs_wfi = true; +} + +/* emit a WAIT_FOR_IDLE only if needed, ie. if there has not already + * been one since last draw: + */ +static inline void +fd_wfi(struct fd_batch *batch, struct fd_ringbuffer *ring) +{ + if (batch->needs_wfi) { + OUT_WFI(ring); + batch->needs_wfi = false; + } +} + +/* emit a CP_EVENT_WRITE: + */ +static inline void +fd_event_write(struct fd_batch *batch, struct fd_ringbuffer *ring, + enum vgt_event_type evt) +{ + OUT_PKT3(ring, CP_EVENT_WRITE, 1); + OUT_RING(ring, evt); + fd_reset_wfi(batch); +} + #endif /* FREEDRENO_BATCH_H_ */ |