radeonsi: handle a failure to create gfx_cs

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32356>
This commit is contained in:
Marek Olšák
2024-11-26 13:05:49 -05:00
committed by Marge Bot
parent b23161ace1
commit 733e0ebf19
+9 -3
View File
@@ -315,7 +315,8 @@ static void si_destroy_context(struct pipe_context *context)
if (sctx->sh_query_result_shader)
sctx->b.delete_compute_state(&sctx->b, sctx->sh_query_result_shader);
sctx->ws->cs_destroy(&sctx->gfx_cs);
if (sctx->gfx_cs.priv)
sctx->ws->cs_destroy(&sctx->gfx_cs);
if (sctx->ctx)
sctx->ws->ctx_destroy(sctx->ctx);
if (sctx->sdma_cs) {
@@ -564,8 +565,13 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, unsign
goto fail;
}
ws->cs_create(&sctx->gfx_cs, sctx->ctx, sctx->has_graphics ? AMD_IP_GFX : AMD_IP_COMPUTE,
(void *)si_flush_gfx_cs, sctx);
if (!ws->cs_create(&sctx->gfx_cs, sctx->ctx, sctx->has_graphics ? AMD_IP_GFX : AMD_IP_COMPUTE,
(void *)si_flush_gfx_cs, sctx)) {
fprintf(stderr, "radeonsi: can't create gfx_cs\n");
sctx->gfx_cs.priv = NULL;
goto fail;
}
assert(sctx->gfx_cs.priv);
/* Initialize private allocators. */
u_suballocator_init(&sctx->allocator_zeroed_memory, &sctx->b, 128 * 1024, 0,