From 950f07748a96829e6aad50474ff68af5871a9fcf Mon Sep 17 00:00:00 2001 From: Karmjit Mahil Date: Mon, 27 Oct 2025 14:07:13 +0000 Subject: [PATCH] meson: Use adreno-pm4-pack.xml.h instead of custom definitions This was causing build issues when using the generate-rd.cc file, due to redeclaration caused by the mixing of the generated header file and the custom definitions. Also adding some missing dependencies now introduced due to the header file include. Signed-off-by: Karmjit Mahil Part-of: --- src/freedreno/afuc/meson.build | 1 + src/freedreno/common/freedreno_pm4.h | 8 ++----- src/freedreno/common/meson.build | 1 + src/freedreno/decode/cffdec.c | 19 --------------- src/freedreno/decode/meson.build | 6 ++++- src/freedreno/registers/adreno/meson.build | 28 +++++++++++++++------- 6 files changed, 28 insertions(+), 35 deletions(-) diff --git a/src/freedreno/afuc/meson.build b/src/freedreno/afuc/meson.build index 5dddc9a4dec..d411a838d38 100644 --- a/src/freedreno/afuc/meson.build +++ b/src/freedreno/afuc/meson.build @@ -99,6 +99,7 @@ if cc.sizeof('size_t') > 4 'util.c', 'util.h', afuc_isa, + freedreno_pm4_xml_header_file, ], include_directories: [ inc_freedreno, diff --git a/src/freedreno/common/freedreno_pm4.h b/src/freedreno/common/freedreno_pm4.h index 4104620cdd2..a5c6922cef5 100644 --- a/src/freedreno/common/freedreno_pm4.h +++ b/src/freedreno/common/freedreno_pm4.h @@ -11,16 +11,12 @@ #include +#include "adreno_pm4.xml.h" + #ifdef __cplusplus extern "C" { #endif -#define CP_TYPE0_PKT 0x00000000 -#define CP_TYPE2_PKT 0x80000000 -#define CP_TYPE3_PKT 0xc0000000 -#define CP_TYPE4_PKT 0x40000000 -#define CP_TYPE7_PKT 0x70000000 - #define CP_NOP_MESG 0x4D455347 #define CP_NOP_BEGN 0x4245474E #define CP_NOP_END 0x454E4400 diff --git a/src/freedreno/common/meson.build b/src/freedreno/common/meson.build index ff413311a26..d1827a7fbd9 100644 --- a/src/freedreno/common/meson.build +++ b/src/freedreno/common/meson.build @@ -28,6 +28,7 @@ libfreedreno_common = static_library( 'freedreno_guardband.h', 'freedreno_vrs.h', freedreno_devices_h, + freedreno_pm4_xml_header_file, sha1_h, 'redump.h' ], diff --git a/src/freedreno/decode/cffdec.c b/src/freedreno/decode/cffdec.c index 796563c2b4e..6ed03877d82 100644 --- a/src/freedreno/decode/cffdec.c +++ b/src/freedreno/decode/cffdec.c @@ -1372,17 +1372,6 @@ enum state_t { UNKNOWN_4DWORDS, }; -enum adreno_state_block { - SB_VERT_TEX = 0, - SB_VERT_MIPADDR = 1, - SB_FRAG_TEX = 2, - SB_FRAG_MIPADDR = 3, - SB_VERT_SHADER = 4, - SB_GEOM_SHADER = 5, - SB_FRAG_SHADER = 6, - SB_COMPUTE_SHADER = 7, -}; - /* TODO there is probably a clever way to let rnndec parse things so * we don't have to care about packet format differences across gens */ @@ -2178,14 +2167,6 @@ draw_indx_common(uint32_t *dwords, int level) return num_indices; } -enum pc_di_index_size { - INDEX_SIZE_IGN = 0, - INDEX_SIZE_16_BIT = 0, - INDEX_SIZE_32_BIT = 1, - INDEX_SIZE_8_BIT = 2, - INDEX_SIZE_INVALID = 0, -}; - static void cp_draw_indx(uint32_t *dwords, uint32_t sizedwords, int level) { diff --git a/src/freedreno/decode/meson.build b/src/freedreno/decode/meson.build index 81aa0d39a75..c43058e35b1 100644 --- a/src/freedreno/decode/meson.build +++ b/src/freedreno/decode/meson.build @@ -28,6 +28,7 @@ libfreedreno_cffdec = static_library( 'script.h', 'util.h', cffdump_pkt_handler_h, + freedreno_pm4_xml_header_file, ], include_directories: [ inc_freedreno, @@ -92,7 +93,8 @@ if dep_libarchive.found() replay = executable( replay_name, [ - 'replay.c' + 'replay.c', + freedreno_pm4_xml_header_file, ], include_directories: [ inc_freedreno, @@ -164,6 +166,7 @@ if dep_lua.found() and dep_libarchive.found() 'cffdump', [ 'cffdump.c', + freedreno_pm4_xml_header_file, ], include_directories: [ inc_freedreno, @@ -192,6 +195,7 @@ if dep_lua.found() and dep_libarchive.found() 'crashdec-hfi.c', 'crashdec-mempool.c', 'crashdec-prefetch.c', + freedreno_pm4_xml_header_file, ], include_directories: [ inc_freedreno, diff --git a/src/freedreno/registers/adreno/meson.build b/src/freedreno/registers/adreno/meson.build index 7b9e7736a03..4e35c762206 100644 --- a/src/freedreno/registers/adreno/meson.build +++ b/src/freedreno/registers/adreno/meson.build @@ -22,10 +22,26 @@ xml_files += [ 'adreno_control_regs.xml', 'adreno_pipe_regs.xml', 'adreno_common.xml', - 'adreno_pm4.xml', ] -freedreno_py_header_files = [] +freedreno_pm4_xml_header_file = [] + +freedreno_pm4_xml_header_file += custom_target( + 'adreno_pm4.xml.h', + input: [gen_header_py, 'adreno_pm4.xml', freedreno_schema, freedreno_copyright], + output: 'adreno_pm4.xml.h', + command: [prog_python, '@INPUT0@', '--rnn', rnn_src_path, '--xml', '@INPUT1@', 'c-defines'], + capture: true, +) + +freedreno_pm4_xml_header_file += custom_target( + 'adreno-pm4-pack.xml.h', + input: [gen_header_py, 'adreno_pm4.xml', freedreno_schema, freedreno_copyright], + output: 'adreno-pm4-pack.xml.h', + command: [prog_python, '@INPUT0@', '--rnn', rnn_src_path, '--xml', '@INPUT1@', 'c-pack-structs'], + capture: true, +) +freedreno_xml_header_files += freedreno_pm4_xml_header_file foreach f : xml_files _name = f + '.h' @@ -57,13 +73,7 @@ freedreno_xml_header_files += custom_target( capture: true, ) -freedreno_xml_header_files += custom_target( - 'adreno-pm4-pack.xml.h', - input: [gen_header_py, 'adreno_pm4.xml', freedreno_schema, freedreno_copyright], - output: 'adreno-pm4-pack.xml.h', - command: [prog_python, '@INPUT0@', '--rnn', rnn_src_path, '--xml', '@INPUT1@', 'c-pack-structs'], - capture: true, -) +freedreno_py_header_files = [] foreach f : xml_reg_files _pyname = f.split('.')[0] + '.py'