summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-10-08 17:50:31 +0200
committerMarek Olšák <[email protected]>2017-10-17 22:03:03 +0200
commit6d2664880cd8689ccee883150a1e8aa4f3b09843 (patch)
treeca04b6ad2d3e9adf8e9f0afa007c611c8fc6fae7 /src
parent8d2685d129ecabc71ca093b4bc7a4e5e4e2fa373 (diff)
radeonsi: unify code for extracting a buffer address from a descriptor
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/radeonsi/si_descriptors.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c
index cac203bdae1..3c33e85b0a9 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -97,6 +97,11 @@ static uint32_t null_image_descriptor[8] = {
* descriptor */
};
+static uint64_t si_desc_extract_buffer_address(uint32_t *desc)
+{
+ return desc[0] | ((uint64_t)G_008F04_BASE_ADDRESS_HI(desc[1]) << 32);
+}
+
static void si_init_descriptor_list(uint32_t *desc_list,
unsigned element_dw_size,
unsigned num_elements,
@@ -1365,8 +1370,7 @@ static void si_desc_reset_buffer_offset(struct pipe_context *ctx,
struct pipe_resource *new_buf)
{
/* Retrieve the buffer offset from the descriptor. */
- uint64_t old_desc_va =
- desc[0] | ((uint64_t)G_008F04_BASE_ADDRESS_HI(desc[1]) << 32);
+ uint64_t old_desc_va = si_desc_extract_buffer_address(desc);
assert(old_buf_va <= old_desc_va);
uint64_t offset_within_buffer = old_desc_va - old_buf_va;
@@ -2178,8 +2182,7 @@ static void si_update_bindless_buffer_descriptor(struct si_context *sctx,
assert(resource->target == PIPE_BUFFER);
/* Retrieve the old buffer addr from the descriptor. */
- old_desc_va = desc_list[0];
- old_desc_va |= ((uint64_t)G_008F04_BASE_ADDRESS_HI(desc_list[1]) << 32);
+ old_desc_va = si_desc_extract_buffer_address(desc_list);
if (old_desc_va != buf->gpu_address + offset) {
/* The buffer has been invalidated when the handle wasn't