diff options
Diffstat (limited to 'src/gallium/drivers/virgl/virgl_buffer.c')
-rw-r--r-- | src/gallium/drivers/virgl/virgl_buffer.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/gallium/drivers/virgl/virgl_buffer.c b/src/gallium/drivers/virgl/virgl_buffer.c index 2b559e58468..fce1ac496e7 100644 --- a/src/gallium/drivers/virgl/virgl_buffer.c +++ b/src/gallium/drivers/virgl/virgl_buffer.c @@ -38,13 +38,22 @@ 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; + enum virgl_transfer_map_type map_type; trans = virgl_resource_create_transfer(&vctx->transfer_pool, resource, &vbuf->metadata, level, usage, box); - 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 = vs->vws->resource_map(vs->vws, vbuf->hw_res); + break; + case VIRGL_TRANSFER_MAP_ERROR: + default: + trans->hw_res_map = NULL; + break; + } - trans->hw_res_map = vs->vws->resource_map(vs->vws, vbuf->hw_res); if (!trans->hw_res_map) { virgl_resource_destroy_transfer(&vctx->transfer_pool, trans); return NULL; |