xref: /aosp_15_r20/external/mesa3d/src/gallium/drivers/radeonsi/si_pm4.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * Copyright 2012 Advanced Micro Devices, Inc.
3  *
4  * SPDX-License-Identifier: MIT
5  */
6 
7 #ifndef SI_PM4_H
8 #define SI_PM4_H
9 
10 #include <stdint.h>
11 #include <stdbool.h>
12 
13 #include "ac_pm4.h"
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
19 /* forward definitions */
20 struct si_screen;
21 struct si_context;
22 
23 /* State atoms are callbacks which write a sequence of packets into a GPU
24  * command buffer (AKA indirect buffer, AKA IB, AKA command stream, AKA CS).
25  */
26 struct si_atom {
27    /* The index is only used by si_pm4_emit_state. Non-pm4 atoms don't use it. */
28    void (*emit)(struct si_context *ctx, unsigned index);
29 };
30 
31 struct si_pm4_state {
32    /* For shader states only */
33    struct si_atom atom;
34 
35    struct ac_pm4_state base;
36 };
37 
38 void si_pm4_clear_state(struct si_pm4_state *state, struct si_screen *sscreen,
39                         bool is_compute_queue);
40 void si_pm4_free_state(struct si_context *sctx, struct si_pm4_state *state, unsigned idx);
41 
42 void si_pm4_emit_commands(struct si_context *sctx, struct si_pm4_state *state);
43 void si_pm4_emit_state(struct si_context *sctx, unsigned index);
44 void si_pm4_emit_shader(struct si_context *sctx, unsigned index);
45 void si_pm4_reset_emitted(struct si_context *sctx);
46 struct si_pm4_state *si_pm4_create_sized(struct si_screen *sscreen, unsigned max_dw,
47                                          bool is_compute_queue);
48 struct si_pm4_state *si_pm4_clone(struct si_screen *sscreen, struct si_pm4_state *orig);
49 
50 #ifdef __cplusplus
51 }
52 #endif
53 
54 #endif
55