radv: compute the GFX9 fence VA at allocation time
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 17 Jan 2019 08:33:38 +0000 (09:33 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 23 Jan 2019 10:31:12 +0000 (11:31 +0100)
Instead of doing every time we emit cache flushes.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_cmd_buffer.c
src/amd/vulkan/radv_private.h
src/amd/vulkan/si_cmd_buffer.c

index a260596c711a2386bcd5ae176e2087db22b3dd15..e75080d09757950b7a997fbc003632d444a78f29 100644 (file)
@@ -335,13 +335,14 @@ radv_reset_cmd_buffer(struct radv_cmd_buffer *cmd_buffer)
        if (cmd_buffer->device->physical_device->rad_info.chip_class >= GFX9 &&
            cmd_buffer->queue_family_index == RADV_QUEUE_GENERAL) {
                unsigned num_db = cmd_buffer->device->physical_device->rad_info.num_render_backends;
-               unsigned eop_bug_offset;
+               unsigned fence_offset, eop_bug_offset;
                void *fence_ptr;
 
-               radv_cmd_buffer_upload_alloc(cmd_buffer, 8, 0,
-                                            &cmd_buffer->gfx9_fence_offset,
+               radv_cmd_buffer_upload_alloc(cmd_buffer, 8, 0, &fence_offset,
                                             &fence_ptr);
-               cmd_buffer->gfx9_fence_bo = cmd_buffer->upload.upload_bo;
+               cmd_buffer->gfx9_fence_va =
+                       radv_buffer_get_va(cmd_buffer->upload.upload_bo);
+               cmd_buffer->gfx9_fence_va += fence_offset;
 
                /* Allocate a buffer for the EOP bug on GFX9. */
                radv_cmd_buffer_upload_alloc(cmd_buffer, 16 * num_db, 0,
@@ -494,8 +495,7 @@ radv_cmd_buffer_after_draw(struct radv_cmd_buffer *cmd_buffer,
                                RADV_CMD_FLAG_CS_PARTIAL_FLUSH));
 
                if (cmd_buffer->device->physical_device->rad_info.chip_class == GFX9) {
-                       va = radv_buffer_get_va(cmd_buffer->gfx9_fence_bo) +
-                            cmd_buffer->gfx9_fence_offset;
+                       va = cmd_buffer->gfx9_fence_va;
                        ptr = &cmd_buffer->gfx9_fence_idx;
                }
 
index dbe483d05f8b1c7098e55d5b61cf45349cf2edda..85c18906f849cb0ec39f9e4bc889b20e55723d7e 100644 (file)
@@ -1116,8 +1116,7 @@ struct radv_cmd_buffer {
 
        VkResult record_result;
 
-       uint32_t gfx9_fence_offset;
-       struct radeon_winsys_bo *gfx9_fence_bo;
+       uint64_t gfx9_fence_va;
        uint32_t gfx9_fence_idx;
        uint64_t gfx9_eop_bug_va;
 
index 2f32c72fea1731a2067aa50c834f3cf866b6e003..f05096fcdfe6ad19eaf24bc7638013dee93ef106 100644 (file)
@@ -976,7 +976,7 @@ si_emit_cache_flush(struct radv_cmd_buffer *cmd_buffer)
        uint32_t *ptr = NULL;
        uint64_t va = 0;
        if (chip_class == GFX9) {
-               va = radv_buffer_get_va(cmd_buffer->gfx9_fence_bo) + cmd_buffer->gfx9_fence_offset;
+               va = cmd_buffer->gfx9_fence_va;
                ptr = &cmd_buffer->gfx9_fence_idx;
        }
        si_cs_emit_cache_flush(cmd_buffer->cs,