diff options
author | Chia-I Wu <[email protected]> | 2019-05-09 13:27:34 -0700 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2019-05-15 20:51:28 +0000 |
commit | e87186fc679c146c5d521139bb79c8eafa0a22f0 (patch) | |
tree | 65f7d2d6e3ab2ad19f02a633faf5e56c797521bb /src/gallium/drivers/virgl/virgl_buffer.c | |
parent | cdcf38b98a7bfdfda5836d6a4cebb6cca074e5ff (diff) |
virgl: add virgl_resource_transfer_prepare
virgl_resource_transfer_prepare should be called before mapping to
prepare the resource. It does flush, readback, and wait as needed.
virgl_res_needs_flush and virgl_res_needs_readback become internal
helpers to the new function.
There should be no externally visible change.
Signed-off-by: Chia-I Wu <[email protected]>
Reviewed-by: Alexandros Frantzis <[email protected]>
Diffstat (limited to 'src/gallium/drivers/virgl/virgl_buffer.c')
-rw-r--r-- | src/gallium/drivers/virgl/virgl_buffer.c | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/src/gallium/drivers/virgl/virgl_buffer.c b/src/gallium/drivers/virgl/virgl_buffer.c index f955b7c624b..2b559e58468 100644 --- a/src/gallium/drivers/virgl/virgl_buffer.c +++ b/src/gallium/drivers/virgl/virgl_buffer.c @@ -38,33 +38,11 @@ static void *virgl_buffer_transfer_map(struct pipe_context *ctx, struct virgl_screen *vs = virgl_screen(ctx->screen); struct virgl_resource *vbuf = virgl_resource(resource); struct virgl_transfer *trans; - bool readback; - bool flush = false; trans = virgl_resource_create_transfer(&vctx->transfer_pool, resource, &vbuf->metadata, level, usage, box); - flush = virgl_res_needs_flush(vctx, trans); - if (flush) - ctx->flush(ctx, NULL, 0); - - readback = virgl_res_needs_readback(vctx, vbuf, usage, 0); - if (readback) - vs->vws->transfer_get(vs->vws, vbuf->hw_res, box, trans->base.stride, - trans->l_stride, trans->offset, level); - - /* XXX Consider - * - * glBufferSubData(GL_ARRAY_BUFFER, 0, 12, data1); - * glDrawArrays(..); - * glFlush(); - * glBufferSubData(GL_ARRAY_BUFFER, 0, 12, data2) - * - * readback and flush are both false in the second glBufferSubData call. - * The draw call might end up seeing data2. - */ - if (readback || flush) - vs->vws->resource_wait(vs->vws, vbuf->hw_res); + virgl_resource_transfer_prepare(vctx, trans); trans->hw_res_map = vs->vws->resource_map(vs->vws, vbuf->hw_res); if (!trans->hw_res_map) { |