{
struct fd_ringbuffer *ring = batch->gmem;
+ if (batch->epilogue)
+ fd6_emit_ib(batch->gmem, batch->epilogue);
+
OUT_PKT4(ring, REG_A6XX_GRAS_LRZ_CNTL, 1);
OUT_RING(ring, A6XX_GRAS_LRZ_CNTL_ENABLE | A6XX_GRAS_LRZ_CNTL_UNK3);
{
struct fd_ringbuffer *ring = batch->gmem;
+ if (batch->epilogue)
+ fd6_emit_ib(batch->gmem, batch->epilogue);
+
OUT_PKT7(ring, CP_SKIP_IB2_ENABLE_GLOBAL, 1);
OUT_RING(ring, 0x0);
fd6_event_write(batch, ring, ZPASS_DONE, false);
- OUT_PKT7(ring, CP_WAIT_REG_MEM, 6);
- OUT_RING(ring, 0x00000014); // XXX
- OUT_RELOC(ring, query_sample(aq, stop));
- OUT_RING(ring, 0xffffffff);
- OUT_RING(ring, 0xffffffff);
- OUT_RING(ring, 0x00000010); // XXX
+ /* To avoid stalling in the draw buffer, emit code the code to compute the
+ * counter delta in the epilogue ring.
+ */
+ struct fd_ringbuffer *epilogue = fd_batch_get_epilogue(batch);
+ fd_wfi(batch, epilogue);
/* result += stop - start: */
- OUT_PKT7(ring, CP_MEM_TO_MEM, 9);
- OUT_RING(ring, CP_MEM_TO_MEM_0_DOUBLE |
+ OUT_PKT7(epilogue, CP_MEM_TO_MEM, 9);
+ OUT_RING(epilogue, CP_MEM_TO_MEM_0_DOUBLE |
CP_MEM_TO_MEM_0_NEG_C);
- OUT_RELOC(ring, query_sample(aq, result)); /* dst */
- OUT_RELOC(ring, query_sample(aq, result)); /* srcA */
- OUT_RELOC(ring, query_sample(aq, stop)); /* srcB */
- OUT_RELOC(ring, query_sample(aq, start)); /* srcC */
+ OUT_RELOC(epilogue, query_sample(aq, result)); /* dst */
+ OUT_RELOC(epilogue, query_sample(aq, result)); /* srcA */
+ OUT_RELOC(epilogue, query_sample(aq, stop)); /* srcB */
+ OUT_RELOC(epilogue, query_sample(aq, start)); /* srcC */
fd6_context(batch->ctx)->samples_passed_queries--;
}
/** tiling/gmem (IB0) cmdstream: */
struct fd_ringbuffer *gmem;
+ /** epilogue cmdstream: */
+ struct fd_ringbuffer *epilogue;
+
// TODO maybe more generically split out clear and clear_binning rings?
struct fd_ringbuffer *lrz_clear;
struct fd_ringbuffer *tile_setup;
fd_reset_wfi(batch);
}
+static inline struct fd_ringbuffer *
+fd_batch_get_epilogue(struct fd_batch *batch)
+{
+ if (batch->epilogue == NULL)
+ batch->epilogue = fd_submit_new_ringbuffer(batch->submit, 0x1000, 0);
+
+ return batch->epilogue;
+}
+
+
#endif /* FREEDRENO_BATCH_H_ */