diff options
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/virgl/virgl_buffer.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/virgl/virgl_context.c | 5 | ||||
-rw-r--r-- | src/gallium/drivers/virgl/virgl_texture.c | 9 |
3 files changed, 12 insertions, 6 deletions
diff --git a/src/gallium/drivers/virgl/virgl_buffer.c b/src/gallium/drivers/virgl/virgl_buffer.c index 7081c090814..fd00b1748c4 100644 --- a/src/gallium/drivers/virgl/virgl_buffer.c +++ b/src/gallium/drivers/virgl/virgl_buffer.c @@ -53,12 +53,12 @@ static void *virgl_buffer_transfer_map(struct pipe_context *ctx, ctx->flush(ctx, NULL, 0); readback = virgl_res_needs_readback(vctx, vbuf, usage, 0); - if (readback) { + if (readback) vs->vws->transfer_get(vs->vws, vbuf->hw_res, box, trans->base.stride, trans->l_stride, trans->offset, level); + if (readback || flush) vs->vws->resource_wait(vs->vws, vbuf->hw_res); - } ptr = vs->vws->resource_map(vs->vws, vbuf->hw_res); if (!ptr) { diff --git a/src/gallium/drivers/virgl/virgl_context.c b/src/gallium/drivers/virgl/virgl_context.c index b5188654892..b07cab7289d 100644 --- a/src/gallium/drivers/virgl/virgl_context.c +++ b/src/gallium/drivers/virgl/virgl_context.c @@ -522,6 +522,7 @@ void virgl_transfer_inline_write(struct pipe_context *ctx, unsigned layer_stride) { struct virgl_context *vctx = virgl_context(ctx); + struct virgl_screen *vs = virgl_screen(ctx->screen); struct virgl_resource *grres = virgl_resource(res); struct virgl_transfer trans = { 0 }; @@ -535,8 +536,10 @@ void virgl_transfer_inline_write(struct pipe_context *ctx, virgl_resource_dirty(grres, 0); - if (virgl_res_needs_flush(vctx, &trans)) + if (virgl_res_needs_flush(vctx, &trans)) { ctx->flush(ctx, NULL, 0); + vs->vws->resource_wait(vs->vws, grres->hw_res); + } virgl_encoder_inline_write(vctx, grres, level, usage, box, data, stride, layer_stride); 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) { |