From 913c06f501162ebcdb5ba2381ca12c98cb0ddfe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sun, 6 Dec 2020 14:46:20 -0500 Subject: [PATCH] radeonsi: unify uploaders and upload to VRAM if all VRAM is visible Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/gallium/drivers/radeonsi/si_pipe.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c index 01700647505..ac16028e60c 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.c +++ b/src/gallium/drivers/radeonsi/si_pipe.c @@ -289,7 +289,7 @@ static void si_destroy_context(struct pipe_context *context) if (sctx->b.stream_uploader) u_upload_destroy(sctx->b.stream_uploader); - if (sctx->b.const_uploader) + if (sctx->b.const_uploader && sctx->b.const_uploader != sctx->b.stream_uploader) u_upload_destroy(sctx->b.const_uploader); if (sctx->cached_gtt_allocator) u_upload_destroy(sctx->cached_gtt_allocator); @@ -493,16 +493,23 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, unsign goto fail; /* Initialize public allocators. */ + bool all_vram_visible = sscreen->info.all_vram_visible; sctx->b.stream_uploader = - u_upload_create(&sctx->b, 1024 * 1024, 0, PIPE_USAGE_STREAM, SI_RESOURCE_FLAG_READ_ONLY); + u_upload_create(&sctx->b, 1024 * 1024, 0, + all_vram_visible ? PIPE_USAGE_DEFAULT : PIPE_USAGE_STREAM, + SI_RESOURCE_FLAG_32BIT); /* same flags as const_uploader */ if (!sctx->b.stream_uploader) goto fail; - sctx->b.const_uploader = - u_upload_create(&sctx->b, 256 * 1024, 0, PIPE_USAGE_DEFAULT, - SI_RESOURCE_FLAG_32BIT); - if (!sctx->b.const_uploader) - goto fail; + if (all_vram_visible) { + sctx->b.const_uploader = sctx->b.stream_uploader; + } else { + sctx->b.const_uploader = + u_upload_create(&sctx->b, 256 * 1024, 0, PIPE_USAGE_DEFAULT, + SI_RESOURCE_FLAG_32BIT); + if (!sctx->b.const_uploader) + goto fail; + } /* Border colors. */ sctx->border_color_table = malloc(SI_MAX_BORDER_COLORS * sizeof(*sctx->border_color_table));