Hi Marek,

So I was looking at some perf traces from r600g, and I see a stall on
the blitter quad vbuf, every clear will cause the CPU to block on the
mapping of the vbuf to upload the new coords. On r300g I can see this
not mattering as the immediate upload path takes care of things,
however I think we should probably do something like the attached and
fire and forget the vertex buffer.

Dave.
From b7aa1230f36d3395f19ad0e0caf35ea06a37cb3c Mon Sep 17 00:00:00 2001
From: Dave Airlie <[email protected]>
Date: Tue, 23 Nov 2010 13:15:05 +1000
Subject: [PATCH] u_blitter: fire and forget the vertex buffer

at least on r600 we were getting a CPU stall here.
---
 src/gallium/auxiliary/util/u_blitter.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c
index a163f93..74eb3fc 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -276,7 +276,8 @@ void util_blitter_destroy(struct blitter_context *blitter)
       if (ctx->sampler_state[i])
          pipe->delete_sampler_state(pipe, ctx->sampler_state[i]);
 
-   pipe_resource_reference(&ctx->vbuf, NULL);
+   if (ctx->vbuf)
+       pipe_resource_reference(&ctx->vbuf, NULL);
    FREE(ctx);
 }
 
@@ -523,6 +524,11 @@ static void blitter_draw_quad(struct blitter_context_priv *ctx)
 {
    struct pipe_context *pipe = ctx->base.pipe;
 
+   if (!ctx->vbuf) {
+       ctx->vbuf = pipe_buffer_create(ctx->base.pipe->screen,
+				      PIPE_BIND_VERTEX_BUFFER,
+				      sizeof(ctx->vertices));
+   }
    /* write vertices and draw them */
    pipe_buffer_write(pipe, ctx->vbuf,
                      0, sizeof(ctx->vertices), ctx->vertices);
@@ -530,6 +536,8 @@ static void blitter_draw_quad(struct blitter_context_priv *ctx)
    util_draw_vertex_buffer(pipe, ctx->vbuf, 0, PIPE_PRIM_TRIANGLE_FAN,
                            4,  /* verts */
                            2); /* attribs/vert */
+
+   pipe_resource_reference(&ctx->vbuf, NULL);
 }
 
 static INLINE
-- 
1.7.3.2

_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to