From af93215b7a2c1a6dbe68452d83aeb9a63024f6e2 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 6 Oct 2025 16:31:36 -0700 Subject: [PATCH] intel: Re-unify brw_prim.h and elk_prim.h These are identical and are just hardware enum values, not related to the structure of the backend compiler. Reviewed-by: Dylan Baker Reviewed-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/crocus/crocus_program.c | 2 +- src/gallium/drivers/iris/iris_program.c | 3 +- src/intel/compiler/brw_compile_gs.cpp | 2 +- src/intel/compiler/elk/elk_clip_line.c | 2 +- src/intel/compiler/elk/elk_clip_tri.c | 2 +- src/intel/compiler/elk/elk_clip_unfilled.c | 2 +- src/intel/compiler/elk/elk_compile_ff_gs.c | 2 +- src/intel/compiler/elk/elk_compile_sf.c | 2 +- .../compiler/elk/elk_gfx6_gs_visitor.cpp | 2 +- src/intel/compiler/elk/elk_prim.h | 47 ------------------- .../compiler/elk/elk_vec4_gs_visitor.cpp | 2 +- src/intel/compiler/elk/meson.build | 2 +- .../compiler/{brw_prim.h => intel_prim.h} | 0 src/intel/compiler/meson.build | 2 +- src/intel/vulkan/genX_gfx_state.c | 2 +- src/intel/vulkan_hasvk/genX_cmd_buffer.c | 2 +- 16 files changed, 14 insertions(+), 62 deletions(-) delete mode 100644 src/intel/compiler/elk/elk_prim.h rename src/intel/compiler/{brw_prim.h => intel_prim.h} (100%) diff --git a/src/gallium/drivers/crocus/crocus_program.c b/src/gallium/drivers/crocus/crocus_program.c index 20af4f366cd..c0fe749f844 100644 --- a/src/gallium/drivers/crocus/crocus_program.c +++ b/src/gallium/drivers/crocus/crocus_program.c @@ -44,9 +44,9 @@ #include "compiler/nir/nir_serialize.h" #include "intel/compiler/elk/elk_compiler.h" #include "intel/compiler/elk/elk_nir.h" -#include "intel/compiler/elk/elk_prim.h" #include "intel/compiler/elk/elk_reg.h" #include "intel/compiler/intel_nir.h" +#include "intel/compiler/intel_prim.h" #include "crocus_context.h" #include "nir/tgsi_to_nir.h" #include "program/prog_instruction.h" diff --git a/src/gallium/drivers/iris/iris_program.c b/src/gallium/drivers/iris/iris_program.c index e8fc7784ed3..19590a3fb39 100644 --- a/src/gallium/drivers/iris/iris_program.c +++ b/src/gallium/drivers/iris/iris_program.c @@ -45,11 +45,10 @@ #include "intel/compiler/brw_compiler.h" #include "intel/compiler/brw_nir.h" #include "intel/compiler/intel_nir.h" -#include "intel/compiler/brw_prim.h" +#include "intel/compiler/intel_prim.h" #ifdef INTEL_USE_ELK #include "intel/compiler/elk/elk_compiler.h" #include "intel/compiler/elk/elk_nir.h" -#include "intel/compiler/elk/elk_prim.h" #endif #include "iris_context.h" #include "iris_pipe.h" diff --git a/src/intel/compiler/brw_compile_gs.cpp b/src/intel/compiler/brw_compile_gs.cpp index 9cc6446007d..655a683fa1d 100644 --- a/src/intel/compiler/brw_compile_gs.cpp +++ b/src/intel/compiler/brw_compile_gs.cpp @@ -7,7 +7,7 @@ #include "brw_shader.h" #include "brw_builder.h" #include "brw_generator.h" -#include "brw_prim.h" +#include "intel_prim.h" #include "brw_nir.h" #include "brw_private.h" #include "dev/intel_debug.h" diff --git a/src/intel/compiler/elk/elk_clip_line.c b/src/intel/compiler/elk/elk_clip_line.c index a261b79ffa8..7a77efcab3c 100644 --- a/src/intel/compiler/elk/elk_clip_line.c +++ b/src/intel/compiler/elk/elk_clip_line.c @@ -30,7 +30,7 @@ */ #include "elk_clip.h" -#include "elk_prim.h" +#include "compiler/intel_prim.h" static void elk_clip_line_alloc_regs( struct elk_clip_compile *c ) { diff --git a/src/intel/compiler/elk/elk_clip_tri.c b/src/intel/compiler/elk/elk_clip_tri.c index b0df4ea4c62..c0e1e72dfe4 100644 --- a/src/intel/compiler/elk/elk_clip_tri.c +++ b/src/intel/compiler/elk/elk_clip_tri.c @@ -30,7 +30,7 @@ */ #include "elk_clip.h" -#include "elk_prim.h" +#include "compiler/intel_prim.h" static void release_tmps( struct elk_clip_compile *c ) { diff --git a/src/intel/compiler/elk/elk_clip_unfilled.c b/src/intel/compiler/elk/elk_clip_unfilled.c index f120af1c806..81cb8c4c40b 100644 --- a/src/intel/compiler/elk/elk_clip_unfilled.c +++ b/src/intel/compiler/elk/elk_clip_unfilled.c @@ -30,7 +30,7 @@ */ #include "elk_clip.h" -#include "elk_prim.h" +#include "compiler/intel_prim.h" /* This is performed against the original triangles, so no indirection diff --git a/src/intel/compiler/elk/elk_compile_ff_gs.c b/src/intel/compiler/elk/elk_compile_ff_gs.c index 9d36e8d86c7..5a37c2034d6 100644 --- a/src/intel/compiler/elk/elk_compile_ff_gs.c +++ b/src/intel/compiler/elk/elk_compile_ff_gs.c @@ -32,7 +32,7 @@ #include "elk_compiler.h" #include "elk_disasm.h" #include "elk_eu.h" -#include "elk_prim.h" +#include "compiler/intel_prim.h" #include "dev/intel_debug.h" diff --git a/src/intel/compiler/elk/elk_compile_sf.c b/src/intel/compiler/elk/elk_compile_sf.c index e0d05145379..aa1baa63675 100644 --- a/src/intel/compiler/elk/elk_compile_sf.c +++ b/src/intel/compiler/elk/elk_compile_sf.c @@ -24,7 +24,7 @@ #include "elk_compiler.h" #include "elk_disasm.h" #include "elk_eu.h" -#include "elk_prim.h" +#include "compiler/intel_prim.h" #include "dev/intel_debug.h" diff --git a/src/intel/compiler/elk/elk_gfx6_gs_visitor.cpp b/src/intel/compiler/elk/elk_gfx6_gs_visitor.cpp index 869feb1f015..44a9378599d 100644 --- a/src/intel/compiler/elk/elk_gfx6_gs_visitor.cpp +++ b/src/intel/compiler/elk/elk_gfx6_gs_visitor.cpp @@ -31,7 +31,7 @@ #include "elk_gfx6_gs_visitor.h" #include "elk_eu.h" -#include "elk_prim.h" +#include "compiler/intel_prim.h" namespace elk { diff --git a/src/intel/compiler/elk/elk_prim.h b/src/intel/compiler/elk/elk_prim.h deleted file mode 100644 index fc754b44fe3..00000000000 --- a/src/intel/compiler/elk/elk_prim.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright © 2022 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -#pragma once - -#define _3DPRIM_POINTLIST 0x01 -#define _3DPRIM_LINELIST 0x02 -#define _3DPRIM_LINESTRIP 0x03 -#define _3DPRIM_TRILIST 0x04 -#define _3DPRIM_TRISTRIP 0x05 -#define _3DPRIM_TRIFAN 0x06 -#define _3DPRIM_QUADLIST 0x07 -#define _3DPRIM_QUADSTRIP 0x08 -#define _3DPRIM_LINELIST_ADJ 0x09 /* G45+ */ -#define _3DPRIM_LINESTRIP_ADJ 0x0A /* G45+ */ -#define _3DPRIM_TRILIST_ADJ 0x0B /* G45+ */ -#define _3DPRIM_TRISTRIP_ADJ 0x0C /* G45+ */ -#define _3DPRIM_TRISTRIP_REVERSE 0x0D -#define _3DPRIM_POLYGON 0x0E -#define _3DPRIM_RECTLIST 0x0F -#define _3DPRIM_LINELOOP 0x10 -#define _3DPRIM_POINTLIST_BF 0x11 -#define _3DPRIM_LINESTRIP_CONT 0x12 -#define _3DPRIM_LINESTRIP_BF 0x13 -#define _3DPRIM_LINESTRIP_CONT_BF 0x14 -#define _3DPRIM_TRIFAN_NOSTIPPLE 0x16 -#define _3DPRIM_PATCHLIST(n) ({ assert(n > 0 && n <= 32); 0x20 + (n - 1); }) diff --git a/src/intel/compiler/elk/elk_vec4_gs_visitor.cpp b/src/intel/compiler/elk/elk_vec4_gs_visitor.cpp index 06cc7b8ab74..13c5b2abd0b 100644 --- a/src/intel/compiler/elk/elk_vec4_gs_visitor.cpp +++ b/src/intel/compiler/elk/elk_vec4_gs_visitor.cpp @@ -33,7 +33,7 @@ #include "elk_cfg.h" #include "elk_fs.h" #include "elk_nir.h" -#include "elk_prim.h" +#include "compiler/intel_prim.h" #include "elk_private.h" #include "dev/intel_debug.h" diff --git a/src/intel/compiler/elk/meson.build b/src/intel/compiler/elk/meson.build index a7060b8887a..f5a1bb6adcb 100644 --- a/src/intel/compiler/elk/meson.build +++ b/src/intel/compiler/elk/meson.build @@ -2,6 +2,7 @@ # SPDX-License-Identifier: MIT libintel_compiler_elk_files = files( + '../intel_prim.h', 'elk_cfg.cpp', 'elk_cfg.h', 'elk_clip.h', @@ -76,7 +77,6 @@ libintel_compiler_elk_files = files( 'elk_nir_private.h', 'elk_packed_float.c', 'elk_predicated_break.cpp', - 'elk_prim.h', 'elk_private.h', 'elk_reg.h', 'elk_reg_type.c', diff --git a/src/intel/compiler/brw_prim.h b/src/intel/compiler/intel_prim.h similarity index 100% rename from src/intel/compiler/brw_prim.h rename to src/intel/compiler/intel_prim.h diff --git a/src/intel/compiler/meson.build b/src/intel/compiler/meson.build index 9d8f1ac816e..d55ed7efe86 100644 --- a/src/intel/compiler/meson.build +++ b/src/intel/compiler/meson.build @@ -30,6 +30,7 @@ libintel_compiler_nir = static_library( ) libintel_compiler_brw_files = files( + 'intel_prim.h', 'brw_analysis.h', 'brw_analysis.cpp', 'brw_analysis_def.cpp', @@ -115,7 +116,6 @@ libintel_compiler_brw_files = files( 'brw_opt_virtual_grfs.cpp', 'brw_packed_float.c', 'brw_print.cpp', - 'brw_prim.h', 'brw_private.h', 'brw_reg.cpp', 'brw_reg.h', diff --git a/src/intel/vulkan/genX_gfx_state.c b/src/intel/vulkan/genX_gfx_state.c index 6bb846cd4a4..b0a03c1d6e0 100644 --- a/src/intel/vulkan/genX_gfx_state.c +++ b/src/intel/vulkan/genX_gfx_state.c @@ -34,7 +34,7 @@ #include "common/intel_genX_state_brw.h" #include "common/intel_guardband.h" #include "common/intel_tiled_render.h" -#include "compiler/brw_prim.h" +#include "compiler/intel_prim.h" #include "genX_mi_builder.h" diff --git a/src/intel/vulkan_hasvk/genX_cmd_buffer.c b/src/intel/vulkan_hasvk/genX_cmd_buffer.c index 108b6358ed3..221c1c61c06 100644 --- a/src/intel/vulkan_hasvk/genX_cmd_buffer.c +++ b/src/intel/vulkan_hasvk/genX_cmd_buffer.c @@ -35,7 +35,7 @@ #include "genxml/gen_macros.h" #include "genxml/genX_pack.h" #include "common/intel_guardband.h" -#include "compiler/elk/elk_prim.h" +#include "compiler/intel_prim.h" #include "nir/nir_xfb_info.h"