/* there are two cases where we currently need to wait for render complete: * 1) pctx->flush() .. since at the moment we have no way for DDX to sync * the presentation blit with the 3d core * 2) wrap-around for ringbuffer.. possibly we can do something more * Intelligent here. Right now we need to ensure there is enough room * at the end of the drawcmds in the cmdstream buffer for all the per- * tile cmds. We do this the lamest way possible, by making the ringbuffer * big, and flushing and resetting back to the beginning if we get too * close to the end. */ static void fd_context_wait(struct pipe_context *pctx) { struct fd_context *ctx = fd_context(pctx); uint32_t ts = fd_ringbuffer_timestamp(ctx->ring); DBG("wait: %u", ts); fd_pipe_wait(ctx->screen->pipe, ts); fd_ringbuffer_reset(ctx->ring); fd_ringmarker_mark(ctx->draw_start); }
void next_ring(void) { int idx = ring_idx++ % ARRAY_SIZE(rings); if (rings[idx]) { ring = rings[idx]; fd_ringbuffer_reset(ring); return; } ring = rings[idx] = fd_ringbuffer_new(pipe, 0x5000); memcpy(ring->start, initial_state, STATE_SIZE * sizeof(uint32_t)); ring->cur = &ring->start[120]; OUT_RELOC (ring, context_bos[0]); ring->cur = &ring->start[122]; OUT_RELOC (ring, context_bos[1]); ring->cur = &ring->start[124]; OUT_RELOC (ring, context_bos[2]); fd_ringbuffer_reset(ring); }
static struct fd_ringbuffer *next_rb(struct fd_context *ctx) { struct fd_ringbuffer *ring; uint32_t ts; /* grab next ringbuffer: */ ring = ctx->rings[(ctx->rings_idx++) % ARRAY_SIZE(ctx->rings)]; /* wait for new rb to be idle: */ ts = fd_ringbuffer_timestamp(ring); if (ts) { DBG("wait: %u", ts); fd_pipe_wait(ctx->screen->pipe, ts); } fd_ringbuffer_reset(ring); return ring; }
void fd_ringbuffer_del(struct fd_ringbuffer *ring) { fd_ringbuffer_reset(ring); ring->funcs->destroy(ring); }