u_blitter: use PIPE_TRANSFER_DISCARD to prevent cpu/gpu stall
authorMarek Olšák <maraeo@gmail.com>
Tue, 23 Nov 2010 13:09:21 +0000 (14:09 +0100)
committerMarek Olšák <maraeo@gmail.com>
Thu, 25 Nov 2010 19:25:53 +0000 (20:25 +0100)
But the driver must be smart here and follow PIPE_TRANSFER_DISCARD,
as it should.

src/gallium/auxiliary/util/u_blitter.c

index a163f93cb826fec91a99f1eb43c7a7c9756e33d6..31fc75aa110c0b5a6af15b64bbc1e6a120beda0d 100644 (file)
@@ -522,10 +522,13 @@ static void blitter_set_dst_dimensions(struct blitter_context_priv *ctx,
 static void blitter_draw_quad(struct blitter_context_priv *ctx)
 {
    struct pipe_context *pipe = ctx->base.pipe;
+   struct pipe_box box;
 
    /* write vertices and draw them */
-   pipe_buffer_write(pipe, ctx->vbuf,
-                     0, sizeof(ctx->vertices), ctx->vertices);
+   u_box_1d(0, sizeof(ctx->vertices), &box);
+   pipe->transfer_inline_write(pipe, ctx->vbuf, u_subresource(0,0),
+                               PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD,
+                               &box, ctx->vertices, sizeof(ctx->vertices), 0);
 
    util_draw_vertex_buffer(pipe, ctx->vbuf, 0, PIPE_PRIM_TRIANGLE_FAN,
                            4,  /* verts */