summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno/freedreno_draw.c
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2013-05-26 20:36:35 -0400
committerRob Clark <[email protected]>2013-06-08 13:15:51 -0400
commit4af1dcbb7d5431ae75cc39568c99d7a20231f081 (patch)
treeefaabfa4fd8b137483b2386a1b3fcc91f9fcd9a9 /src/gallium/drivers/freedreno/freedreno_draw.c
parent2855f3f7bcd9b36a275e942c9c7d0eb8e485c16f (diff)
freedreno: gmem bypass
The GPU (at least a3xx, but I think also a2xx) can render directly to memory, bypassing tiling. Although it can't do this if blend, depth, and a few other features of the pipeline are enabled. This direct memory mode can be faster for some sorts of operations, such as simple blits. In particular, this significantly speeds up XA by avoiding to pull the entire dest pixmap into GMEM, render tiles, and write it all back out again. This should also speed up resource copy-region and blit. Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/freedreno_draw.c')
-rw-r--r--src/gallium/drivers/freedreno/freedreno_draw.c33
1 files changed, 28 insertions, 5 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_draw.c b/src/gallium/drivers/freedreno/freedreno_draw.c
index 2b7c16847dc..dbdf5732658 100644
--- a/src/gallium/drivers/freedreno/freedreno_draw.c
+++ b/src/gallium/drivers/freedreno/freedreno_draw.c
@@ -114,7 +114,7 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
{
struct fd_context *ctx = fd_context(pctx);
struct pipe_framebuffer_state *pfb = &ctx->framebuffer;
- unsigned buffers;
+ unsigned i, buffers = 0;
/* if we supported transform feedback, we'd have to disable this: */
if (((ctx->scissor.maxx - ctx->scissor.minx) *
@@ -124,19 +124,40 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
ctx->needs_flush = true;
- fd_resource(pfb->cbufs[0]->texture)->dirty = true;
+ /*
+ * Figure out the buffers/features we need:
+ */
- /* figure out the buffers we need: */
- buffers = FD_BUFFER_COLOR;
if (fd_depth_enabled(ctx)) {
buffers |= FD_BUFFER_DEPTH;
fd_resource(pfb->zsbuf->texture)->dirty = true;
+ ctx->gmem_reason |= FD_GMEM_DEPTH_ENABLED;
}
+
if (fd_stencil_enabled(ctx)) {
buffers |= FD_BUFFER_STENCIL;
fd_resource(pfb->zsbuf->texture)->dirty = true;
+ ctx->gmem_reason |= FD_GMEM_STENCIL_ENABLED;
}
+ if (fd_logicop_enabled(ctx))
+ ctx->gmem_reason |= FD_GMEM_LOGICOP_ENABLED;
+
+ for (i = 0; i < pfb->nr_cbufs; i++) {
+ struct pipe_resource *surf = pfb->cbufs[i]->texture;
+
+ fd_resource(surf)->dirty = true;
+ buffers |= FD_BUFFER_COLOR;
+
+ if (surf->nr_samples > 1)
+ ctx->gmem_reason |= FD_GMEM_MSAA_ENABLED;
+
+ if (fd_blend_enabled(ctx, i))
+ ctx->gmem_reason |= FD_GMEM_BLEND_ENABLED;
+ }
+
+ ctx->num_draws++;
+
/* any buffers that haven't been cleared, we need to restore: */
ctx->restore |= buffers & (FD_BUFFER_ALL & ~ctx->cleared);
/* and any buffers used, need to be resolved: */
@@ -165,8 +186,10 @@ fd_clear(struct pipe_context *pctx, unsigned buffers,
if (buffers & PIPE_CLEAR_COLOR)
fd_resource(pfb->cbufs[0]->texture)->dirty = true;
- if (buffers & (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL))
+ if (buffers & (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL)) {
fd_resource(pfb->zsbuf->texture)->dirty = true;
+ ctx->gmem_reason |= FD_GMEM_CLEARS_DEPTH_STENCIL;
+ }
DBG("%x depth=%f, stencil=%u (%s/%s)", buffers, depth, stencil,
util_format_name(pfb->cbufs[0]->format),