diff options
author | Ilia Mirkin <[email protected]> | 2015-03-29 20:39:48 -0400 |
---|---|---|
committer | Ilia Mirkin <[email protected]> | 2015-04-02 00:09:14 -0400 |
commit | 602bc6c88dbfa34083aa9d229fb6396b008e23eb (patch) | |
tree | 09a11efd6b449d8fa8694d95350ae72afbfaa14e | |
parent | d13803c76fd7429df64c1aa3631dcc451e7f1a29 (diff) |
freedreno: add core infrastructure support for MRTs
Signed-off-by: Ilia Mirkin <[email protected]>
4 files changed, 14 insertions, 8 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_context.c b/src/gallium/drivers/freedreno/freedreno_context.c index 79a27fe0e15..bb1b52797a8 100644 --- a/src/gallium/drivers/freedreno/freedreno_context.c +++ b/src/gallium/drivers/freedreno/freedreno_context.c @@ -95,6 +95,7 @@ fd_context_render(struct pipe_context *pctx) { struct fd_context *ctx = fd_context(pctx); struct pipe_framebuffer_state *pfb = &ctx->framebuffer; + int i; DBG("needs_flush: %d", ctx->needs_flush); @@ -116,8 +117,9 @@ fd_context_render(struct pipe_context *pctx) ctx->gmem_reason = 0; ctx->num_draws = 0; - if (pfb->cbufs[0]) - fd_resource(pfb->cbufs[0]->texture)->dirty = false; + for (i = 0; i < pfb->nr_cbufs; i++) + if (pfb->cbufs[i]) + fd_resource(pfb->cbufs[i]->texture)->dirty = false; if (pfb->zsbuf) fd_resource(pfb->zsbuf->texture)->dirty = false; } diff --git a/src/gallium/drivers/freedreno/freedreno_context.h b/src/gallium/drivers/freedreno/freedreno_context.h index bf9abaf8855..244d527ad20 100644 --- a/src/gallium/drivers/freedreno/freedreno_context.h +++ b/src/gallium/drivers/freedreno/freedreno_context.h @@ -189,7 +189,7 @@ struct fd_context { */ enum { /* align bitmask values w/ PIPE_CLEAR_*.. since that is convenient.. */ - FD_BUFFER_COLOR = PIPE_CLEAR_COLOR0, + FD_BUFFER_COLOR = PIPE_CLEAR_COLOR, FD_BUFFER_DEPTH = PIPE_CLEAR_DEPTH, FD_BUFFER_STENCIL = PIPE_CLEAR_STENCIL, FD_BUFFER_ALL = FD_BUFFER_COLOR | FD_BUFFER_DEPTH | FD_BUFFER_STENCIL, diff --git a/src/gallium/drivers/freedreno/freedreno_draw.c b/src/gallium/drivers/freedreno/freedreno_draw.c index 213bad84e84..423ae23769c 100644 --- a/src/gallium/drivers/freedreno/freedreno_draw.c +++ b/src/gallium/drivers/freedreno/freedreno_draw.c @@ -92,7 +92,7 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info) surf = pfb->cbufs[i]->texture; fd_resource(surf)->dirty = true; - buffers |= FD_BUFFER_COLOR; + buffers |= PIPE_CLEAR_COLOR0 << i; if (surf->nr_samples > 1) ctx->gmem_reason |= FD_GMEM_MSAA_ENABLED; @@ -147,6 +147,7 @@ fd_clear(struct pipe_context *pctx, unsigned buffers, struct pipe_framebuffer_state *pfb = &ctx->framebuffer; struct pipe_scissor_state *scissor = fd_context_get_scissor(ctx); unsigned cleared_buffers; + int i; /* for bookkeeping about which buffers have been cleared (and thus * can fully or partially skip mem2gmem) we need to ignore buffers @@ -173,7 +174,9 @@ fd_clear(struct pipe_context *pctx, unsigned buffers, ctx->needs_flush = true; if (buffers & PIPE_CLEAR_COLOR) - fd_resource(pfb->cbufs[0]->texture)->dirty = true; + for (i = 0; i < pfb->nr_cbufs; i++) + if (buffers & (PIPE_CLEAR_COLOR0 << i)) + fd_resource(pfb->cbufs[i]->texture)->dirty = true; if (buffers & (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL)) { fd_resource(pfb->zsbuf->texture)->dirty = true; diff --git a/src/gallium/drivers/freedreno/freedreno_gmem.c b/src/gallium/drivers/freedreno/freedreno_gmem.c index 4040d1f7615..afe088ac261 100644 --- a/src/gallium/drivers/freedreno/freedreno_gmem.c +++ b/src/gallium/drivers/freedreno/freedreno_gmem.c @@ -319,7 +319,7 @@ void fd_gmem_render_tiles(struct fd_context *ctx) { struct pipe_framebuffer_state *pfb = &ctx->framebuffer; - uint32_t timestamp = 0; + uint32_t i, timestamp = 0; bool sysmem = false; if (ctx->emit_sysmem_prep) { @@ -373,8 +373,9 @@ fd_gmem_render_tiles(struct fd_context *ctx) /* update timestamps on render targets: */ timestamp = fd_ringbuffer_timestamp(ctx->ring); - if (pfb->cbufs[0]) - fd_resource(pfb->cbufs[0]->texture)->timestamp = timestamp; + for (i = 0; i < pfb->nr_cbufs; i++) + if (pfb->cbufs[i]) + fd_resource(pfb->cbufs[i]->texture)->timestamp = timestamp; if (pfb->zsbuf) fd_resource(pfb->zsbuf->texture)->timestamp = timestamp; |