radeonsi: make cs_preamble_state optional
authorMarek Olšák <marek.olsak@amd.com>
Thu, 18 Jun 2020 04:51:19 +0000 (00:51 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 22 Jul 2020 16:08:19 +0000 (12:08 -0400)
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5798>

src/gallium/drivers/radeonsi/si_gfx_cs.c
src/gallium/drivers/radeonsi/si_pipe.c

index 8ad95cba8af5fa1fa2e66bc81377ce469b5da219..fe175769f8039c0575b40ad556467b00bdca8a64 100644 (file)
@@ -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_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);
 
    if (ctx->cs_preamble_gs_rings)
       si_pm4_emit(ctx, ctx->cs_preamble_gs_rings);
 
index 9501cb7c12364ba32f170a378f292083db5dccd6..e366b6b5458bd1c1aad5af8cac8ded5ab1d781c4 100644 (file)
@@ -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_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++)
    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++)