svga: Map vertex- index- and constant buffers ansynchronously when reading

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>
This commit is contained in:
Thomas Hellstrom 2019-04-11 10:10:04 +02:00
parent f51915ba62
commit 3b828c4e68
2 changed files with 9 additions and 4 deletions

View 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;

View 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(