Mesa (master): radeonsi: initialize ctx and gfx_cs first, then allocators

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Dec 9 15:52:00 UTC 2020


Module: Mesa
Branch: master
Commit: 8bd25d3835d4399aba2c27e7f82681a9005073e9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8bd25d3835d4399aba2c27e7f82681a9005073e9

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Sun Dec  6 13:49:21 2020 -0500

radeonsi: initialize ctx and gfx_cs first, then allocators

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7951>

---

 src/gallium/drivers/radeonsi/si_pipe.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
index ac87400e028..01700647505 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -475,22 +475,27 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, unsign
          goto fail;
    }
 
-   /* Initialize context allocators. */
+   /* Initialize the context handle and the command stream. */
+   sctx->ctx = sctx->ws->ctx_create(sctx->ws);
+   if (!sctx->ctx)
+      goto fail;
+
+   ws->cs_create(&sctx->gfx_cs, sctx->ctx, sctx->has_graphics ? RING_GFX : RING_COMPUTE,
+                 (void *)si_flush_gfx_cs, sctx, stop_exec_on_failure);
+
+   /* Initialize private allocators. */
    u_suballocator_init(&sctx->allocator_zeroed_memory, &sctx->b, 128 * 1024, 0,
                        PIPE_USAGE_DEFAULT,
                        SI_RESOURCE_FLAG_UNMAPPABLE | SI_RESOURCE_FLAG_CLEAR, false);
 
-   sctx->b.stream_uploader =
-      u_upload_create(&sctx->b, 1024 * 1024, 0, PIPE_USAGE_STREAM, SI_RESOURCE_FLAG_READ_ONLY);
-   if (!sctx->b.stream_uploader)
-      goto fail;
-
    sctx->cached_gtt_allocator = u_upload_create(&sctx->b, 16 * 1024, 0, PIPE_USAGE_STAGING, 0);
    if (!sctx->cached_gtt_allocator)
       goto fail;
 
-   sctx->ctx = sctx->ws->ctx_create(sctx->ws);
-   if (!sctx->ctx)
+   /* Initialize public allocators. */
+   sctx->b.stream_uploader =
+      u_upload_create(&sctx->b, 1024 * 1024, 0, PIPE_USAGE_STREAM, SI_RESOURCE_FLAG_READ_ONLY);
+   if (!sctx->b.stream_uploader)
       goto fail;
 
    sctx->b.const_uploader =
@@ -499,9 +504,6 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, unsign
    if (!sctx->b.const_uploader)
       goto fail;
 
-   ws->cs_create(&sctx->gfx_cs, sctx->ctx, sctx->has_graphics ? RING_GFX : RING_COMPUTE,
-                 (void *)si_flush_gfx_cs, sctx, stop_exec_on_failure);
-
    /* Border colors. */
    sctx->border_color_table = malloc(SI_MAX_BORDER_COLORS * sizeof(*sctx->border_color_table));
    if (!sctx->border_color_table)



More information about the mesa-commit mailing list