From babd87f2e0865fde1386c4797131c26265b2da09 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Thu, 18 Jun 2020 00:51:19 -0400 Subject: [PATCH] radeonsi: make cs_preamble_state optional Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/gallium/drivers/radeonsi/si_gfx_cs.c | 3 ++- src/gallium/drivers/radeonsi/si_pipe.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_gfx_cs.c b/src/gallium/drivers/radeonsi/si_gfx_cs.c index 8ad95cba8af..fe175769f80 100644 --- a/src/gallium/drivers/radeonsi/si_gfx_cs.c +++ b/src/gallium/drivers/radeonsi/si_gfx_cs.c @@ -426,7 +426,8 @@ void si_begin_new_gfx_cs(struct si_context *ctx) si_pm4_reset_emitted(ctx); /* The CS initialization should be emitted before everything else. */ - si_pm4_emit(ctx, ctx->cs_preamble_state); + if (ctx->cs_preamble_state) + si_pm4_emit(ctx, ctx->cs_preamble_state); if (ctx->cs_preamble_gs_rings) si_pm4_emit(ctx, ctx->cs_preamble_gs_rings); diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c index 9501cb7c123..e366b6b5458 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.c +++ b/src/gallium/drivers/radeonsi/si_pipe.c @@ -195,7 +195,8 @@ static void si_destroy_context(struct pipe_context *context) si_resource_reference(&sctx->wait_mem_scratch, NULL); si_resource_reference(&sctx->small_prim_cull_info_buf, NULL); - si_pm4_free_state(sctx, sctx->cs_preamble_state, ~0); + if (sctx->cs_preamble_state) + si_pm4_free_state(sctx, sctx->cs_preamble_state, ~0); if (sctx->cs_preamble_gs_rings) si_pm4_free_state(sctx, sctx->cs_preamble_gs_rings, ~0); for (i = 0; i < ARRAY_SIZE(sctx->vgt_shader_config); i++) -- 2.30.2