aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/virgl/virgl_texture.c
diff options
context:
space:
mode:
authorGurchetan Singh <[email protected]>2019-04-15 20:36:54 -0700
committerGurchetan Singh <[email protected]>2019-04-18 15:38:04 -0700
commit599d55371c83e2a535814c78b62f4293be79408d (patch)
tree8195d33c840bce00b157dbdf216642ca7c4baf67 /src/gallium/drivers/virgl/virgl_texture.c
parentdfd79079daf08cba0e1d5defc18dedeffb0c6327 (diff)
virgl: wait after a flush
We really need to wait under certain circumstances, or we can end up writing to memory the same time the host is reading. Partial revert of d6dc68 ("virgl: use uint16_t mask instead of separate booleans"). Test cases: - dEQP-GLES31.functional.texture.texture_buffer.render_modify.as_vertex_array.bufferdata on vtest protocol version 2 - Flickering during Alien Isolation Fixes: d6dc68 ("virgl: use uint16_t mask instead of separate booleans") Signed-off-by: Gurchetan Singh <[email protected]> Reviewed-By: Gert Wollny <[email protected]> Reviewed-By: Piotr Rak <[email protected]>
Diffstat (limited to 'src/gallium/drivers/virgl/virgl_texture.c')
-rw-r--r--src/gallium/drivers/virgl/virgl_texture.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/gallium/drivers/virgl/virgl_texture.c b/src/gallium/drivers/virgl/virgl_texture.c
index f0a2465021c..deb637ee58e 100644
--- a/src/gallium/drivers/virgl/virgl_texture.c
+++ b/src/gallium/drivers/virgl/virgl_texture.c
@@ -126,6 +126,7 @@ static void *texture_transfer_map_plain(struct pipe_context *ctx,
struct virgl_winsys *vws = virgl_screen(ctx->screen)->vws;
struct virgl_resource *vtex = virgl_resource(resource);
struct virgl_transfer *trans;
+ bool flush, readback;
trans = virgl_resource_create_transfer(&vctx->transfer_pool, resource,
&vtex->metadata, level, usage, box);
@@ -133,15 +134,17 @@ static void *texture_transfer_map_plain(struct pipe_context *ctx,
assert(resource->nr_samples <= 1);
- if (virgl_res_needs_flush(vctx, trans))
+ flush = virgl_res_needs_flush(vctx, trans);
+ if (flush)
ctx->flush(ctx, NULL, 0);
- if (virgl_res_needs_readback(vctx, vtex, usage, level)) {
+ readback = virgl_res_needs_readback(vctx, vtex, usage, level);
+ if (readback)
vws->transfer_get(vws, vtex->hw_res, box, trans->base.stride,
trans->l_stride, trans->offset, level);
+ if (readback || flush)
vws->resource_wait(vws, vtex->hw_res);
- }
void *ptr = vws->resource_map(vws, vtex->hw_res);
if (!ptr) {