Mesa (main): radeonsi/gfx11: don't allocate unused wait_mem_scratch
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Jun 15 21:27:03 UTC 2022
Module: Mesa
Branch: main
Commit: 99fd408946ed6097f1cb40fcc44d4d66a7896b41
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=99fd408946ed6097f1cb40fcc44d4d66a7896b41
Author: Marek Olšák <marek.olsak at amd.com>
Date: Fri May 20 08:31:02 2022 -0400
radeonsi/gfx11: don't allocate unused wait_mem_scratch
We sync using PWS instead of memory.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16990>
---
src/gallium/drivers/radeonsi/si_gfx_cs.c | 2 ++
src/gallium/drivers/radeonsi/si_pipe.c | 27 +++++++++++++--------------
2 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/src/gallium/drivers/radeonsi/si_gfx_cs.c b/src/gallium/drivers/radeonsi/si_gfx_cs.c
index 17710483a47..85b110b839d 100644
--- a/src/gallium/drivers/radeonsi/si_gfx_cs.c
+++ b/src/gallium/drivers/radeonsi/si_gfx_cs.c
@@ -620,6 +620,8 @@ static struct si_resource *si_get_wait_mem_scratch_bo(struct si_context *ctx,
{
struct si_screen *sscreen = ctx->screen;
+ assert(ctx->gfx_level < GFX11);
+
if (likely(!is_secure)) {
return ctx->wait_mem_scratch;
} else {
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
index 7ab529f76a5..659223fb888 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -691,18 +691,6 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, unsign
sctx->b.create_video_buffer = vl_video_buffer_create;
}
- if (sctx->gfx_level >= GFX9) {
- sctx->wait_mem_scratch =
- si_aligned_buffer_create(screen,
- PIPE_RESOURCE_FLAG_UNMAPPABLE | SI_RESOURCE_FLAG_DRIVER_INTERNAL,
- PIPE_USAGE_DEFAULT, 4,
- sscreen->info.tcc_cache_line_size);
- if (!sctx->wait_mem_scratch) {
- fprintf(stderr, "radeonsi: can't create wait_mem_scratch\n");
- goto fail;
- }
- }
-
/* GFX7 cannot unbind a constant buffer (S_BUFFER_LOAD doesn't skip loads
* if NUM_RECORDS == 0). We need to use a dummy buffer instead. */
if (sctx->gfx_level == GFX7) {
@@ -775,10 +763,21 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, unsign
si_begin_new_gfx_cs(sctx, true);
assert(sctx->gfx_cs.current.cdw == sctx->initial_gfx_cs_size);
- /* Initialize per-context buffers. */
- if (sctx->wait_mem_scratch)
+ if (sctx->gfx_level >= GFX9 && sctx->gfx_level < GFX11) {
+ sctx->wait_mem_scratch =
+ si_aligned_buffer_create(screen,
+ PIPE_RESOURCE_FLAG_UNMAPPABLE |
+ SI_RESOURCE_FLAG_DRIVER_INTERNAL,
+ PIPE_USAGE_DEFAULT, 4,
+ sscreen->info.tcc_cache_line_size);
+ if (!sctx->wait_mem_scratch) {
+ fprintf(stderr, "radeonsi: can't create wait_mem_scratch\n");
+ goto fail;
+ }
+
si_cp_write_data(sctx, sctx->wait_mem_scratch, 0, 4, V_370_MEM, V_370_ME,
&sctx->wait_mem_number);
+ }
if (sctx->gfx_level == GFX7) {
/* Clear the NULL constant buffer, because loads should return zeros.
More information about the mesa-commit
mailing list