summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/virgl/virgl_texture.c
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2019-05-10 21:23:12 -0700
committerChia-I Wu <[email protected]>2019-05-15 20:51:28 +0000
commit659c5800e566d3fce90501c06e47c61f9623d663 (patch)
tree51e460b7a997af08e6421b6bbd1a97da88bdd0b5 /src/gallium/drivers/virgl/virgl_texture.c
parente87186fc679c146c5d521139bb79c8eafa0a22f0 (diff)
virgl: handle DONT_BLOCK and MAP_DIRECTLY
Handle PIPE_TRANSFER_DONT_BLOCK and PIPE_TRANSFER_MAP_DIRECTLY. Make virgl_resource_transfer_prepare return an enum instead of a bool for extensibility (e.g., instruct the callers to map differently). Signed-off-by: Chia-I Wu <[email protected]> Reviewed-by: Alexandros Frantzis <[email protected]>
Diffstat (limited to 'src/gallium/drivers/virgl/virgl_texture.c')
-rw-r--r--src/gallium/drivers/virgl/virgl_texture.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/gallium/drivers/virgl/virgl_texture.c b/src/gallium/drivers/virgl/virgl_texture.c
index c2bdc3ef9e2..bba5830d33c 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;
+ enum virgl_transfer_map_type map_type;
trans = virgl_resource_create_transfer(&vctx->transfer_pool, resource,
&vtex->metadata, level, usage, box);
@@ -133,9 +134,17 @@ static void *texture_transfer_map_plain(struct pipe_context *ctx,
assert(resource->nr_samples <= 1);
- virgl_resource_transfer_prepare(vctx, trans);
+ map_type = virgl_resource_transfer_prepare(vctx, trans);
+ switch (map_type) {
+ case VIRGL_TRANSFER_MAP_HW_RES:
+ trans->hw_res_map = vws->resource_map(vws, vtex->hw_res);
+ break;
+ case VIRGL_TRANSFER_MAP_ERROR:
+ default:
+ trans->hw_res_map = NULL;
+ break;
+ }
- trans->hw_res_map = vws->resource_map(vws, vtex->hw_res);
if (!trans->hw_res_map) {
virgl_resource_destroy_transfer(&vctx->transfer_pool, trans);
return NULL;