xref: /aosp_15_r20/external/mesa3d/src/gallium/drivers/r600/evergreen_compute_internal.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * Authors:
3  *      Adam Rak <[email protected]>
4  * SPDX-License-Identifier: MIT
5  */
6 
7 #ifndef EVERGREEN_COMPUTE_INTERNAL_H
8 #define EVERGREEN_COMPUTE_INTERNAL_H
9 
10 #include "ac_binary.h"
11 #include "r600_asm.h"
12 #ifdef HAVE_OPENCL
13 #include <llvm-c/Core.h>
14 #endif
15 
16 struct r600_shader_reloc {
17 	char name[32];
18 	uint64_t offset;
19 };
20 
21 struct r600_shader_binary {
22 	unsigned code_size;
23 	unsigned config_size;
24 	/** The number of bytes of config information for each global symbol.
25 	 */
26 	unsigned config_size_per_symbol;
27 	unsigned rodata_size;
28 	unsigned global_symbol_count;
29 	unsigned reloc_count;
30 
31 	/** Shader code */
32 	unsigned char *code;
33 
34 	/** Config/Context register state that accompanies this shader.
35 	 * This is a stream of dword pairs.  First dword contains the
36 	 * register address, the second dword contains the value.*/
37 	unsigned char *config;
38 
39 
40 	/** Constant data accessed by the shader.  This will be uploaded
41 	 * into a constant buffer. */
42 	unsigned char *rodata;
43 
44 	/** List of symbol offsets for the shader */
45 	uint64_t *global_symbol_offsets;
46 
47 	struct r600_shader_reloc *relocs;
48 
49 	/** Disassembled shader in a string. */
50 	char *disasm_string;
51 };
52 
53 struct r600_pipe_compute {
54 	struct r600_context *ctx;
55 
56 	struct r600_shader_binary binary;
57 
58 	enum pipe_shader_ir ir_type;
59 
60 	/* tgsi selector */
61 	struct r600_pipe_shader_selector *sel;
62 
63 	struct r600_resource *code_bo;
64 	struct r600_bytecode bc;
65 
66 	unsigned local_size;
67 	unsigned input_size;
68 	struct r600_resource *kernel_param;
69 
70 #ifdef HAVE_OPENCL
71 	LLVMContextRef llvm_ctx;
72 #endif
73 };
74 
75 struct r600_resource* r600_compute_buffer_alloc_vram(struct r600_screen *screen, unsigned size);
76 
77 #endif
78