From 396201a9abc76df49529cbd565beb689addbd0c9 Mon Sep 17 00:00:00 2001 From: Karmjit Mahil Date: Thu, 9 Apr 2026 13:29:05 +0100 Subject: [PATCH] freedreno: Add fd{2,3,4,5}_hw.h and fd_hw_common.h Add some wrapper header files so that we always include everything that's needed by the generated header. This is in preparation for setting up a script which enforces using these instead of importing the xml generated headers directly. Signed-off-by: Karmjit Mahil Part-of: --- src/freedreno/common/fd2_hw.h | 12 ++++++++++++ src/freedreno/common/fd3_hw.h | 12 ++++++++++++ src/freedreno/common/fd4_hw.h | 12 ++++++++++++ src/freedreno/common/fd5_hw.h | 12 ++++++++++++ src/freedreno/common/fd6_hw.h | 9 +-------- src/freedreno/common/fd_hw_common.h | 18 ++++++++++++++++++ src/freedreno/common/freedreno_gpu_event.h | 2 +- src/freedreno/common/freedreno_lrz.h | 2 +- src/freedreno/computerator/a4xx.cc | 6 +----- src/freedreno/computerator/main.h | 3 +-- src/freedreno/drm/freedreno_ringbuffer.h | 3 +-- src/freedreno/fdl/fd5_layout_test.c | 5 +---- src/freedreno/fdl/freedreno_layout.h | 2 +- src/freedreno/ir2/instr-a2xx.h | 5 +---- src/freedreno/perfcntrs/fd2_perfcntr.c | 6 ++---- src/freedreno/perfcntrs/fd5_perfcntr.c | 5 ++--- src/gallium/drivers/freedreno/a2xx/fd2_util.h | 2 +- .../drivers/freedreno/a3xx/fd3_format.h | 2 +- .../drivers/freedreno/a4xx/fd4_format.h | 2 +- .../drivers/freedreno/a5xx/fd5_format.h | 2 +- .../drivers/freedreno/a5xx/fd5_screen.h | 2 +- src/gallium/drivers/freedreno/freedreno_util.h | 3 +-- 22 files changed, 85 insertions(+), 42 deletions(-) create mode 100644 src/freedreno/common/fd2_hw.h create mode 100644 src/freedreno/common/fd3_hw.h create mode 100644 src/freedreno/common/fd4_hw.h create mode 100644 src/freedreno/common/fd5_hw.h create mode 100644 src/freedreno/common/fd_hw_common.h diff --git a/src/freedreno/common/fd2_hw.h b/src/freedreno/common/fd2_hw.h new file mode 100644 index 00000000000..82890aab554 --- /dev/null +++ b/src/freedreno/common/fd2_hw.h @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2026 Valve Corporation + * SPDX-License-Identifier: MIT + */ + +#ifndef FD2_HW_H +#define FD2_HW_H + +#include "fd_hw_common.h" +#include "a2xx.xml.h" + +#endif /* FD2_HW_H */ diff --git a/src/freedreno/common/fd3_hw.h b/src/freedreno/common/fd3_hw.h new file mode 100644 index 00000000000..0c367ea79ca --- /dev/null +++ b/src/freedreno/common/fd3_hw.h @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2026 Valve Corporation + * SPDX-License-Identifier: MIT + */ + +#ifndef FD3_HW_H +#define FD3_HW_H + +#include "fd_hw_common.h" +#include "a3xx.xml.h" + +#endif /* FD3_HW_H */ diff --git a/src/freedreno/common/fd4_hw.h b/src/freedreno/common/fd4_hw.h new file mode 100644 index 00000000000..87789152cd0 --- /dev/null +++ b/src/freedreno/common/fd4_hw.h @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2026 Valve Corporation + * SPDX-License-Identifier: MIT + */ + +#ifndef FD4_HW_H +#define FD4_HW_H + +#include "fd_hw_common.h" +#include "a4xx.xml.h" + +#endif /* FD4_HW_H */ diff --git a/src/freedreno/common/fd5_hw.h b/src/freedreno/common/fd5_hw.h new file mode 100644 index 00000000000..1a4f202089a --- /dev/null +++ b/src/freedreno/common/fd5_hw.h @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2026 Valve Corporation + * SPDX-License-Identifier: MIT + */ + +#ifndef FD5_HW_H +#define FD5_HW_H + +#include "fd_hw_common.h" +#include "a5xx.xml.h" + +#endif /* FD5_HW_H */ diff --git a/src/freedreno/common/fd6_hw.h b/src/freedreno/common/fd6_hw.h index 24dcb92a756..20e3e5ccd41 100644 --- a/src/freedreno/common/fd6_hw.h +++ b/src/freedreno/common/fd6_hw.h @@ -6,14 +6,7 @@ #ifndef FD6_HW_H #define FD6_HW_H -#include -#include - -#include "util/half_float.h" -#include "util/u_math.h" - -#include "adreno_pm4.xml.h" -#include "adreno_common.xml.h" +#include "fd_hw_common.h" #include "a6xx_enums.xml.h" #include "a7xx_enums.xml.h" diff --git a/src/freedreno/common/fd_hw_common.h b/src/freedreno/common/fd_hw_common.h new file mode 100644 index 00000000000..bd0ba84041d --- /dev/null +++ b/src/freedreno/common/fd_hw_common.h @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2026 Valve Corporation + * SPDX-License-Identifier: MIT + */ + +#ifndef FD_HW_COMMON_H +#define FD_HW_COMMON_H + +#include +#include + +#include "util/half_float.h" +#include "util/u_math.h" + +#include "adreno_pm4.xml.h" +#include "adreno_common.xml.h" + +#endif /* FD_HW_COMMON_H */ diff --git a/src/freedreno/common/freedreno_gpu_event.h b/src/freedreno/common/freedreno_gpu_event.h index 2547e71b827..ecc13243a73 100644 --- a/src/freedreno/common/freedreno_gpu_event.h +++ b/src/freedreno/common/freedreno_gpu_event.h @@ -6,7 +6,7 @@ #ifndef __FREEDRENO_GPU_EVENT_H__ #define __FREEDRENO_GPU_EVENT_H__ -#include "adreno_pm4.xml.h" +#include "fd_hw_common.h" #include "freedreno_common.h" /* On terminology: diff --git a/src/freedreno/common/freedreno_lrz.h b/src/freedreno/common/freedreno_lrz.h index 7bf9403b332..649b43bdd61 100644 --- a/src/freedreno/common/freedreno_lrz.h +++ b/src/freedreno/common/freedreno_lrz.h @@ -6,7 +6,7 @@ #ifndef __FREEDRENO_LRZ_H__ #define __FREEDRENO_LRZ_H__ -#include "adreno_common.xml.h" +#include "fd_hw_common.h" #include "freedreno_common.h" enum fd_lrz_gpu_dir : uint8_t { diff --git a/src/freedreno/computerator/a4xx.cc b/src/freedreno/computerator/a4xx.cc index 953ef1bb363..49aa76f3b69 100644 --- a/src/freedreno/computerator/a4xx.cc +++ b/src/freedreno/computerator/a4xx.cc @@ -25,12 +25,8 @@ #include "util/u_math.h" #include "util/u_queue.h" -#include "util/half_float.h" - -#include "adreno_pm4.xml.h" -#include "adreno_common.xml.h" -#include "a4xx.xml.h" +#include "common/fd4_hw.h" #include "ir3_asm.h" #include "main.h" diff --git a/src/freedreno/computerator/main.h b/src/freedreno/computerator/main.h index 99d7bf31dbd..060a7842b1d 100644 --- a/src/freedreno/computerator/main.h +++ b/src/freedreno/computerator/main.h @@ -13,8 +13,7 @@ #include "drm/freedreno_drmif.h" #include "drm/freedreno_ringbuffer.h" -#include "adreno_common.xml.h" -#include "adreno_pm4.xml.h" +#include "common/fd_hw_common.h" #include "ir3/ir3_assembler.h" diff --git a/src/freedreno/drm/freedreno_ringbuffer.h b/src/freedreno/drm/freedreno_ringbuffer.h index 88a4bca7dd5..8962699f0ec 100644 --- a/src/freedreno/drm/freedreno_ringbuffer.h +++ b/src/freedreno/drm/freedreno_ringbuffer.h @@ -13,8 +13,7 @@ #include "util/u_atomic.h" #include "util/u_debug.h" -#include "adreno_common.xml.h" -#include "adreno_pm4.xml.h" +#include "common/fd_hw_common.h" #include "freedreno_drmif.h" #include "freedreno_pm4.h" diff --git a/src/freedreno/fdl/fd5_layout_test.c b/src/freedreno/fdl/fd5_layout_test.c index 8cf0fb37d3e..7df3b4f0123 100644 --- a/src/freedreno/fdl/fd5_layout_test.c +++ b/src/freedreno/fdl/fd5_layout_test.c @@ -3,12 +3,9 @@ * SPDX-License-Identifier: MIT */ +#include "common/fd5_hw.h" #include "freedreno_layout.h" #include "fd_layout_test.h" -#include "adreno_common.xml.h" -#include "util/half_float.h" -#include "util/u_math.h" -#include "a5xx.xml.h" #include diff --git a/src/freedreno/fdl/freedreno_layout.h b/src/freedreno/fdl/freedreno_layout.h index c745a735611..10b24f1227e 100644 --- a/src/freedreno/fdl/freedreno_layout.h +++ b/src/freedreno/fdl/freedreno_layout.h @@ -476,7 +476,7 @@ uint32_t fdl6_get_bank_shift(const struct fdl_ubwc_config *config); ENDC; #ifdef __cplusplus -#include "adreno_common.xml.h" +#include "common/fd_hw_common.h" template void fdl6_view_init(struct fdl6_view *view, const struct fdl_layout **layouts, diff --git a/src/freedreno/ir2/instr-a2xx.h b/src/freedreno/ir2/instr-a2xx.h index f76eb05ab5f..1bbbe88a8ce 100644 --- a/src/freedreno/ir2/instr-a2xx.h +++ b/src/freedreno/ir2/instr-a2xx.h @@ -8,10 +8,7 @@ #define PACKED __attribute__((__packed__)) -#include "util/u_math.h" -#include "adreno_common.xml.h" -#include "adreno_pm4.xml.h" -#include "a2xx.xml.h" +#include "fd2_hw.h" /* * ALU instructions: diff --git a/src/freedreno/perfcntrs/fd2_perfcntr.c b/src/freedreno/perfcntrs/fd2_perfcntr.c index eae2ac85096..b26363576c4 100644 --- a/src/freedreno/perfcntrs/fd2_perfcntr.c +++ b/src/freedreno/perfcntrs/fd2_perfcntr.c @@ -7,11 +7,9 @@ * Rob Clark */ -#include "util/half_float.h" #include "util/u_math.h" -#include "adreno_common.xml.h" -#include "adreno_pm4.xml.h" -#include "a2xx.xml.h" + +#include "common/fd2_hw.h" #define REG(_x) REG_A2XX_ ## _x #include "freedreno_perfcntr.h" diff --git a/src/freedreno/perfcntrs/fd5_perfcntr.c b/src/freedreno/perfcntrs/fd5_perfcntr.c index 2dcc3143030..f2061cfca1b 100644 --- a/src/freedreno/perfcntrs/fd5_perfcntr.c +++ b/src/freedreno/perfcntrs/fd5_perfcntr.c @@ -9,10 +9,9 @@ #ifndef FD5_PERFCNTR_H_ #define FD5_PERFCNTR_H_ -#include "util/half_float.h" #include "util/u_math.h" -#include "adreno_common.xml.h" -#include "a5xx.xml.h" + +#include "common/fd5_hw.h" #define REG(_x) REG_A5XX_ ## _x #include "freedreno_perfcntr.h" diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_util.h b/src/gallium/drivers/freedreno/a2xx/fd2_util.h index 72dba319a74..c9d17dd92c5 100644 --- a/src/gallium/drivers/freedreno/a2xx/fd2_util.h +++ b/src/gallium/drivers/freedreno/a2xx/fd2_util.h @@ -11,7 +11,7 @@ #include "freedreno_util.h" -#include "a2xx.xml.h" +#include "fd2_hw.h" struct surface_format { /* If enum is a signed type, 0x7f is out of range. Cast it to avoid warnings. */ diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_format.h b/src/gallium/drivers/freedreno/a3xx/fd3_format.h index a79b7554013..be4bfe662de 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_format.h +++ b/src/gallium/drivers/freedreno/a3xx/fd3_format.h @@ -10,7 +10,7 @@ #include "util/format/u_format.h" #include "freedreno_util.h" -#include "a3xx.xml.h" +#include "fd3_hw.h" enum a3xx_vtx_fmt fd3_pipe2vtx(enum pipe_format format); enum a3xx_tex_fmt fd3_pipe2tex(enum pipe_format format); diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_format.h b/src/gallium/drivers/freedreno/a4xx/fd4_format.h index 35211bb741e..b3cb4b9c14d 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_format.h +++ b/src/gallium/drivers/freedreno/a4xx/fd4_format.h @@ -11,7 +11,7 @@ #include "freedreno_util.h" -#include "a4xx.xml.h" +#include "fd4_hw.h" enum a4xx_vtx_fmt fd4_pipe2vtx(enum pipe_format format); enum a4xx_tex_fmt fd4_pipe2tex(enum pipe_format format); diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_format.h b/src/gallium/drivers/freedreno/a5xx/fd5_format.h index 925d9b20483..3f17d86e2be 100644 --- a/src/gallium/drivers/freedreno/a5xx/fd5_format.h +++ b/src/gallium/drivers/freedreno/a5xx/fd5_format.h @@ -11,7 +11,7 @@ #include "freedreno_util.h" -#include "a5xx.xml.h" +#include "fd5_hw.h" enum a5xx_vtx_fmt fd5_pipe2vtx(enum pipe_format format); enum a5xx_tex_fmt fd5_pipe2tex(enum pipe_format format); diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_screen.h b/src/gallium/drivers/freedreno/a5xx/fd5_screen.h index d68f16a7b58..e7be9b3fb51 100644 --- a/src/gallium/drivers/freedreno/a5xx/fd5_screen.h +++ b/src/gallium/drivers/freedreno/a5xx/fd5_screen.h @@ -13,7 +13,7 @@ #include "freedreno_util.h" -#include "a5xx.xml.h" +#include "fd5_hw.h" void fd5_screen_init(struct pipe_screen *pscreen); diff --git a/src/gallium/drivers/freedreno/freedreno_util.h b/src/gallium/drivers/freedreno/freedreno_util.h index 80f772e5dff..399422e4b9c 100644 --- a/src/gallium/drivers/freedreno/freedreno_util.h +++ b/src/gallium/drivers/freedreno/freedreno_util.h @@ -27,8 +27,7 @@ #include "util/u_math.h" #include "util/u_pack_color.h" -#include "adreno_common.xml.h" -#include "adreno_pm4.xml.h" +#include "fd_hw_common.h" #include "disasm.h" #ifdef __cplusplus