aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2014-08-06 22:27:43 +0200
committerMarek Olšák <[email protected]>2014-08-09 23:41:15 +0200
commite878e154cdfd4dbb5474f776e0a6d86fcb983098 (patch)
tree1188d8adccd0c07a4f148316adcfd6189d79f9e2
parent43b5c34cc36d44aafdc5f1eb6bb607756eacf953 (diff)
gallium/radeon: store VM address in r600_resource
This will help to get rid of the buffer_get_virtual_address calls. Reviewed-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]>
-rw-r--r--src/gallium/drivers/radeon/r600_buffer_common.c7
-rw-r--r--src/gallium/drivers/radeon/r600_pipe_common.h1
-rw-r--r--src/gallium/drivers/radeon/r600_texture.c1
3 files changed, 7 insertions, 2 deletions
diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c b/src/gallium/drivers/radeon/r600_buffer_common.c
index d747cbcb930..a5806851bf3 100644
--- a/src/gallium/drivers/radeon/r600_buffer_common.c
+++ b/src/gallium/drivers/radeon/r600_buffer_common.c
@@ -168,14 +168,17 @@ bool r600_init_resource(struct r600_common_screen *rscreen,
old_buf = res->buf;
res->cs_buf = rscreen->ws->buffer_get_cs_handle(new_buf); /* should be atomic */
res->buf = new_buf; /* should be atomic */
+
+ if (rscreen->info.r600_virtual_address)
+ res->gpu_address = rscreen->ws->buffer_get_virtual_address(res->cs_buf);
+
pb_reference(&old_buf, NULL);
util_range_set_empty(&res->valid_buffer_range);
if (rscreen->debug_flags & DBG_VM && res->b.b.target == PIPE_BUFFER) {
fprintf(stderr, "VM start=0x%"PRIX64" end=0x%"PRIX64" | Buffer %u bytes\n",
- r600_resource_va(&rscreen->b, &res->b.b),
- r600_resource_va(&rscreen->b, &res->b.b) + res->buf->size,
+ res->gpu_address, res->gpu_address + res->buf->size,
res->buf->size);
}
return true;
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h
index ac69d5b8746..59d0b3e21c4 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -127,6 +127,7 @@ struct r600_resource {
/* Winsys objects. */
struct pb_buffer *buf;
struct radeon_winsys_cs_handle *cs_buf;
+ uint64_t gpu_address;
/* Resource state. */
enum radeon_bo_domain domains;
diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c
index 482bbff4e63..326aca4e09b 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -655,6 +655,7 @@ r600_texture_create_object(struct pipe_screen *screen,
} else {
resource->buf = buf;
resource->cs_buf = rscreen->ws->buffer_get_cs_handle(buf);
+ resource->gpu_address = rscreen->ws->buffer_get_virtual_address(resource->cs_buf);
resource->domains = rscreen->ws->buffer_get_initial_domain(resource->cs_buf);
}