summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Riley <[email protected]>2019-04-30 17:33:59 -0700
committerGurchetan Singh <[email protected]>2019-05-01 15:48:28 -0700
commite94a9a7f38de13230d1fb8767c45e6c8f4e59c64 (patch)
tree54ade59a327be98dcd820645fbcbaab74e37357a
parentebbb05b3c93d8f62985099cc9d4cf157c597f4b5 (diff)
virgl: Store mapped hw resource with transfer object.
Signed-off-by: David Riley <[email protected]> Reviewed-by: Gurchetan Singh <[email protected]>
-rw-r--r--src/gallium/drivers/virgl/virgl_buffer.c7
-rw-r--r--src/gallium/drivers/virgl/virgl_resource.h1
-rw-r--r--src/gallium/drivers/virgl/virgl_texture.c6
3 files changed, 7 insertions, 7 deletions
diff --git a/src/gallium/drivers/virgl/virgl_buffer.c b/src/gallium/drivers/virgl/virgl_buffer.c
index fd00b1748c4..42434752d53 100644
--- a/src/gallium/drivers/virgl/virgl_buffer.c
+++ b/src/gallium/drivers/virgl/virgl_buffer.c
@@ -38,7 +38,6 @@ 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;
- void *ptr;
bool readback;
bool flush = false;
@@ -60,14 +59,14 @@ static void *virgl_buffer_transfer_map(struct pipe_context *ctx,
if (readback || flush)
vs->vws->resource_wait(vs->vws, vbuf->hw_res);
- ptr = vs->vws->resource_map(vs->vws, vbuf->hw_res);
- if (!ptr) {
+ 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;
}
*transfer = &trans->base;
- return ptr + trans->offset;
+ return trans->hw_res_map + trans->offset;
}
static void virgl_buffer_transfer_unmap(struct pipe_context *ctx,
diff --git a/src/gallium/drivers/virgl/virgl_resource.h b/src/gallium/drivers/virgl/virgl_resource.h
index abe8578bd23..380e145564a 100644
--- a/src/gallium/drivers/virgl/virgl_resource.h
+++ b/src/gallium/drivers/virgl/virgl_resource.h
@@ -58,6 +58,7 @@ struct virgl_transfer {
struct util_range range;
struct list_head queue_link;
struct pipe_transfer *resolve_transfer;
+ void *hw_res_map;
};
void virgl_resource_destroy(struct pipe_screen *screen,
diff --git a/src/gallium/drivers/virgl/virgl_texture.c b/src/gallium/drivers/virgl/virgl_texture.c
index deb637ee58e..19ae6ff1d3a 100644
--- a/src/gallium/drivers/virgl/virgl_texture.c
+++ b/src/gallium/drivers/virgl/virgl_texture.c
@@ -146,14 +146,14 @@ static void *texture_transfer_map_plain(struct pipe_context *ctx,
if (readback || flush)
vws->resource_wait(vws, vtex->hw_res);
- void *ptr = vws->resource_map(vws, vtex->hw_res);
- if (!ptr) {
+ 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;
}
*transfer = &trans->base;
- return ptr + trans->offset;
+ return trans->hw_res_map + trans->offset;
}
static void *texture_transfer_map_resolve(struct pipe_context *ctx,