diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c index 9759da2d2cf..aa4b24e6354 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.c +++ b/src/gallium/drivers/radeonsi/si_pipe.c @@ -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,