svga: Map vertex- index- and constant buffers ansynchronously when reading
authorThomas Hellstrom <thellstrom@vmware.com>
Thu, 11 Apr 2019 08:10:04 +0000 (10:10 +0200)
committerThomas Hellstrom <thellstrom@vmware.com>
Thu, 20 Jun 2019 07:30:22 +0000 (09:30 +0200)
With SWTNL and index translation we're mapping buffers for reading. These
buffers are commonly upload_mgr buffers that might already be referenced
by another submitted or unsubmitted GPU command. A synchronous map will
then trigger a flush and sync, at least on Linux that doesn't distinguish
between read- and write referencing. So map these buffers async. If they
for some obscure reason happen to be dirty (stream-output, buffer-copy),
the resource_buffer code will read-back and sync anyway. For persistent /
coherent buffers a corresponding read-back and sync will happen in the
kernel fault handler.

Testing: Piglit quick. No regressions.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
src/gallium/drivers/svga/svga_draw_elements.c
src/gallium/drivers/svga/svga_swtnl_draw.c

index b955b2f77e272ac53e8934887eb9dda9e545ed80..41cd4d189935c66016bb72fe7772399feedea9d3 100644 (file)
@@ -120,7 +120,9 @@ translate_indices(struct svga_hwtnl *hwtnl,
          goto fail;
 
       *out_offset = 0;
-      src_map = pipe_buffer_map(pipe, info->index.resource, PIPE_TRANSFER_READ,
+      src_map = pipe_buffer_map(pipe, info->index.resource,
+                                PIPE_TRANSFER_READ |
+                                PIPE_TRANSFER_UNSYNCHRONIZED,
                                 &src_transfer);
       if (!src_map)
          goto fail;
index a7db73e02ee109df741321e6cd67bed95e88e5ea..1aa15d8cd263574fc34d476d63ccced03b5f2ee7 100644 (file)
@@ -73,7 +73,8 @@ svga_swtnl_draw_vbo(struct svga_context *svga,
       if (svga->curr.vb[i].buffer.resource) {
          map = pipe_buffer_map(&svga->pipe,
                                svga->curr.vb[i].buffer.resource,
-                               PIPE_TRANSFER_READ,
+                               PIPE_TRANSFER_READ |
+                               PIPE_TRANSFER_UNSYNCHRONIZED,
                                &vb_transfer[i]);
 
          draw_set_mapped_vertex_buffer(draw, i, map, ~0);
@@ -88,7 +89,8 @@ svga_swtnl_draw_vbo(struct svga_context *svga,
          map = (ubyte *) info->index.user;
       } else {
          map = pipe_buffer_map(&svga->pipe, info->index.resource,
-                               PIPE_TRANSFER_READ, &ib_transfer);
+                               PIPE_TRANSFER_READ |
+                               PIPE_TRANSFER_UNSYNCHRONIZED, &ib_transfer);
       }
       draw_set_indexes(draw,
                        (const ubyte *) map,
@@ -103,7 +105,8 @@ svga_swtnl_draw_vbo(struct svga_context *svga,
 
       map = pipe_buffer_map(&svga->pipe,
                             svga->curr.constbufs[PIPE_SHADER_VERTEX][i].buffer,
-                            PIPE_TRANSFER_READ,
+                            PIPE_TRANSFER_READ |
+                            PIPE_TRANSFER_UNSYNCHRONIZED,
                             &cb_transfer[i]);
       assert(map);
       draw_set_mapped_constant_buffer(