radeonsi: align scratch and ring buffer allocations for faster memory access
authorMarek Olšák <marek.olsak@amd.com>
Mon, 19 Aug 2019 17:06:47 +0000 (13:06 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 27 Aug 2019 20:52:28 +0000 (16:52 -0400)
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
src/gallium/drivers/radeonsi/si_compute.c
src/gallium/drivers/radeonsi/si_compute_prim_discard.c
src/gallium/drivers/radeonsi/si_state_shaders.c

index f534b5c2e5e9431a83b29565c8c7ed19814a841b..32f934237b0245f20a58bf28887fe97316c98679 100644 (file)
@@ -422,7 +422,8 @@ static bool si_setup_compute_scratch_buffer(struct si_context *sctx,
                        si_aligned_buffer_create(&sctx->screen->b,
                                                 SI_RESOURCE_FLAG_UNMAPPABLE,
                                                 PIPE_USAGE_DEFAULT,
-                                                scratch_needed, 256);
+                                                scratch_needed,
+                                                sctx->screen->info.pte_fragment_size);
 
                if (!sctx->compute_scratch_buffer)
                        return false;
index 373fd4ffa7cb0e1a6a5469b95c23b1b360a02df9..34e6d344486fbc1c5a4abdcab1043728a61cf812 100644 (file)
@@ -977,7 +977,7 @@ static bool si_initialize_prim_discard_cmdbuf(struct si_context *sctx)
                                                 SI_RESOURCE_FLAG_UNMAPPABLE,
                                                 PIPE_USAGE_DEFAULT,
                                                 sctx->index_ring_size_per_ib * 2,
-                                                2 * 1024 * 1024);
+                                                sctx->screen->info.pte_fragment_size);
                if (!sctx->index_ring)
                        return false;
        }
index 365eed2f84e1dbe49f7c9ddc2f41ff07a30357e3..5d64f39b2877175974753c3c077199f0b2b58334 100644 (file)
@@ -3487,7 +3487,8 @@ static bool si_update_gs_ring_buffers(struct si_context *sctx)
                        pipe_aligned_buffer_create(sctx->b.screen,
                                                   SI_RESOURCE_FLAG_UNMAPPABLE,
                                                   PIPE_USAGE_DEFAULT,
-                                                  esgs_ring_size, alignment);
+                                                  esgs_ring_size,
+                                                  sctx->screen->info.pte_fragment_size);
                if (!sctx->esgs_ring)
                        return false;
        }
@@ -3498,7 +3499,8 @@ static bool si_update_gs_ring_buffers(struct si_context *sctx)
                        pipe_aligned_buffer_create(sctx->b.screen,
                                                   SI_RESOURCE_FLAG_UNMAPPABLE,
                                                   PIPE_USAGE_DEFAULT,
-                                                  gsvs_ring_size, alignment);
+                                                  gsvs_ring_size,
+                                                  sctx->screen->info.pte_fragment_size);
                if (!sctx->gsvs_ring)
                        return false;
        }
@@ -3735,9 +3737,10 @@ static bool si_update_spi_tmpring_size(struct si_context *sctx)
 
                        sctx->scratch_buffer =
                                si_aligned_buffer_create(&sctx->screen->b,
-                                                          SI_RESOURCE_FLAG_UNMAPPABLE,
-                                                          PIPE_USAGE_DEFAULT,
-                                                          scratch_needed_size, 256);
+                                                        SI_RESOURCE_FLAG_UNMAPPABLE,
+                                                        PIPE_USAGE_DEFAULT,
+                                                        scratch_needed_size,
+                                                        sctx->screen->info.pte_fragment_size);
                        if (!sctx->scratch_buffer)
                                return false;