diff --git a/src/amd/Android.common.mk b/src/amd/Android.common.mk index d5a266215f0..f77aa79c7d8 100644 --- a/src/amd/Android.common.mk +++ b/src/amd/Android.common.mk @@ -30,9 +30,8 @@ LOCAL_MODULE := libmesa_amd_common LOCAL_SRC_FILES := \ $(AMD_COMMON_FILES) \ - $(AMD_COMPILER_FILES) \ - $(AMD_DEBUG_FILES) \ - $(AMD_NIR_FILES) + $(AMD_COMMON_LLVM_FILES) \ + $(AMD_DEBUG_FILES) LOCAL_CFLAGS += -DFORCE_BUILD_AMDGPU # instructs LLVM to declare LLVMInitializeAMDGPU* functions @@ -72,6 +71,7 @@ LOCAL_C_INCLUDES := \ $(MESA_TOP)/include \ $(MESA_TOP)/src \ $(MESA_TOP)/src/amd/common \ + $(MESA_TOP)/src/amd/llvm \ $(MESA_TOP)/src/compiler \ $(call generated-sources-dir-for,STATIC_LIBRARIES,libmesa_nir,,)/nir \ $(MESA_TOP)/src/gallium/include \ diff --git a/src/amd/Makefile.sources b/src/amd/Makefile.sources index 22f71bf1758..245ce1042ee 100644 --- a/src/amd/Makefile.sources +++ b/src/amd/Makefile.sources @@ -36,33 +36,30 @@ ADDRLIB_FILES = \ addrlib/src/r800/siaddrlib.cpp \ addrlib/src/r800/siaddrlib.h -AMD_COMPILER_FILES = \ +AMD_COMMON_FILES = \ common/ac_binary.c \ common/ac_binary.h \ common/ac_exp_param.h \ - common/ac_llvm_build.c \ - common/ac_llvm_build.h \ - common/ac_llvm_cull.c \ - common/ac_llvm_cull.h \ - common/ac_llvm_helper.cpp \ - common/ac_llvm_util.c \ - common/ac_llvm_util.h \ - common/ac_rtld.c \ - common/ac_rtld.h \ - common/ac_shader_abi.h \ - common/ac_shader_util.c \ - common/ac_shader_util.h - - -AMD_NIR_FILES = \ - common/ac_nir_to_llvm.c \ - common/ac_nir_to_llvm.h - -AMD_COMMON_FILES = \ common/ac_gpu_info.c \ common/ac_gpu_info.h \ common/ac_surface.c \ - common/ac_surface.h + common/ac_surface.h \ + common/ac_rtld.c \ + common/ac_rtld.h \ + common/ac_shader_util.c \ + common/ac_shader_util.h + +AMD_COMMON_LLVM_FILES = \ + llvm/ac_llvm_build.c \ + llvm/ac_llvm_build.h \ + llvm/ac_llvm_cull.c \ + llvm/ac_llvm_cull.h \ + llvm/ac_llvm_helper.cpp \ + llvm/ac_llvm_util.c \ + llvm/ac_llvm_util.h \ + llvm/ac_shader_abi.h \ + llvm/ac_nir_to_llvm.c \ + llvm/ac_nir_to_llvm.h AMD_DEBUG_FILES = \ common/ac_debug.c \ diff --git a/src/amd/common/meson.build b/src/amd/common/meson.build index d5d70ad66db..d752bfce83f 100644 --- a/src/amd/common/meson.build +++ b/src/amd/common/meson.build @@ -40,18 +40,8 @@ amd_common_files = files( 'ac_binary.c', 'ac_binary.h', 'ac_exp_param.h', - 'ac_llvm_build.c', - 'ac_llvm_build.h', - 'ac_llvm_cull.c', - 'ac_llvm_cull.h', - 'ac_llvm_helper.cpp', - 'ac_llvm_util.c', - 'ac_llvm_util.h', - 'ac_shader_abi.h', 'ac_shader_util.c', 'ac_shader_util.h', - 'ac_nir_to_llvm.c', - 'ac_nir_to_llvm.h', 'ac_gpu_info.c', 'ac_gpu_info.h', 'ac_rtld.c', @@ -69,7 +59,7 @@ libamd_common = static_library( inc_common, inc_compiler, inc_mesa, inc_mapi, inc_amd, ], dependencies : [ - dep_llvm, dep_thread, dep_elf, dep_libdrm_amdgpu, dep_valgrind, + dep_thread, dep_elf, dep_libdrm_amdgpu, dep_valgrind, idep_nir_headers, ], c_args : [c_vis_args], diff --git a/src/amd/compiler/meson.build b/src/amd/compiler/meson.build index 73151cad6eb..f4c8b57fc94 100644 --- a/src/amd/compiler/meson.build +++ b/src/amd/compiler/meson.build @@ -85,7 +85,7 @@ _libaco = static_library( 'aco', [libaco_files, aco_opcodes_c, aco_opcodes_h, aco_builder_h], include_directories : [ - inc_common, inc_compiler, inc_mesa, inc_mapi, inc_amd, inc_amd_common, + inc_common, inc_compiler, inc_mesa, inc_mapi, inc_amd, inc_amd_common, inc_amd_common_llvm, ], dependencies : [ dep_llvm, dep_thread, dep_elf, dep_libdrm_amdgpu, dep_valgrind, diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/llvm/ac_llvm_build.c similarity index 100% rename from src/amd/common/ac_llvm_build.c rename to src/amd/llvm/ac_llvm_build.c diff --git a/src/amd/common/ac_llvm_build.h b/src/amd/llvm/ac_llvm_build.h similarity index 100% rename from src/amd/common/ac_llvm_build.h rename to src/amd/llvm/ac_llvm_build.h diff --git a/src/amd/common/ac_llvm_cull.c b/src/amd/llvm/ac_llvm_cull.c similarity index 100% rename from src/amd/common/ac_llvm_cull.c rename to src/amd/llvm/ac_llvm_cull.c diff --git a/src/amd/common/ac_llvm_cull.h b/src/amd/llvm/ac_llvm_cull.h similarity index 100% rename from src/amd/common/ac_llvm_cull.h rename to src/amd/llvm/ac_llvm_cull.h diff --git a/src/amd/common/ac_llvm_helper.cpp b/src/amd/llvm/ac_llvm_helper.cpp similarity index 100% rename from src/amd/common/ac_llvm_helper.cpp rename to src/amd/llvm/ac_llvm_helper.cpp diff --git a/src/amd/common/ac_llvm_util.c b/src/amd/llvm/ac_llvm_util.c similarity index 100% rename from src/amd/common/ac_llvm_util.c rename to src/amd/llvm/ac_llvm_util.c diff --git a/src/amd/common/ac_llvm_util.h b/src/amd/llvm/ac_llvm_util.h similarity index 100% rename from src/amd/common/ac_llvm_util.h rename to src/amd/llvm/ac_llvm_util.h diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/llvm/ac_nir_to_llvm.c similarity index 100% rename from src/amd/common/ac_nir_to_llvm.c rename to src/amd/llvm/ac_nir_to_llvm.c diff --git a/src/amd/common/ac_nir_to_llvm.h b/src/amd/llvm/ac_nir_to_llvm.h similarity index 100% rename from src/amd/common/ac_nir_to_llvm.h rename to src/amd/llvm/ac_nir_to_llvm.h diff --git a/src/amd/common/ac_shader_abi.h b/src/amd/llvm/ac_shader_abi.h similarity index 100% rename from src/amd/common/ac_shader_abi.h rename to src/amd/llvm/ac_shader_abi.h diff --git a/src/amd/llvm/meson.build b/src/amd/llvm/meson.build new file mode 100644 index 00000000000..f9868cfac09 --- /dev/null +++ b/src/amd/llvm/meson.build @@ -0,0 +1,50 @@ +# Copyright © 2019 Valve 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 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. + +amd_common_llvm_files = files( + 'ac_llvm_build.c', + 'ac_llvm_build.h', + 'ac_llvm_cull.c', + 'ac_llvm_cull.h', + 'ac_llvm_helper.cpp', + 'ac_llvm_util.c', + 'ac_llvm_util.h', + 'ac_nir_to_llvm.c', + 'ac_nir_to_llvm.h', + 'ac_shader_abi.h', +) + +libamd_common_llvm = static_library( + 'amd_common_llvm', + [amd_common_llvm_files], + include_directories : [ + inc_common, inc_compiler, inc_mesa, inc_mapi, inc_amd, inc_amd_common + ], + link_with: [ + libamd_common + ], + dependencies : [ + dep_llvm, dep_thread, dep_elf, dep_libdrm_amdgpu, dep_valgrind, + idep_nir_headers, idep_amdgfxregs_h, + ], + c_args : [c_vis_args], + cpp_args : [cpp_vis_args], +) + diff --git a/src/amd/meson.build b/src/amd/meson.build index 085abecd2a9..10b04c00333 100644 --- a/src/amd/meson.build +++ b/src/amd/meson.build @@ -22,6 +22,7 @@ inc_amd = include_directories('.') subdir('addrlib') subdir('common') +subdir('llvm') if with_amd_vk subdir('compiler') subdir('vulkan') diff --git a/src/amd/vulkan/meson.build b/src/amd/vulkan/meson.build index 72cb64c5847..afc5bde56c7 100644 --- a/src/amd/vulkan/meson.build +++ b/src/amd/vulkan/meson.build @@ -149,10 +149,10 @@ libvulkan_radeon = shared_library( 'vulkan_radeon', [libradv_files, radv_entrypoints, radv_extensions_c, amd_vk_format_table_c, sha1_h, xmlpool_options_h, radv_gfx10_format_table_h], include_directories : [ - inc_common, inc_amd, inc_amd_common, inc_compiler, inc_util, inc_vulkan_wsi, + inc_common, inc_amd, inc_amd_common, inc_amd_common_llvm, inc_compiler, inc_util, inc_vulkan_wsi, ], link_with : [ - libamd_common, libamdgpu_addrlib, libvulkan_wsi, + libamd_common, libamd_common_llvm, libamdgpu_addrlib, libvulkan_wsi, ], dependencies : [ dep_llvm, dep_libdrm_amdgpu, dep_thread, dep_elf, dep_dl, dep_m, diff --git a/src/gallium/drivers/r600/Android.mk b/src/gallium/drivers/r600/Android.mk index 9f684cf2445..19a3ba8209f 100644 --- a/src/gallium/drivers/r600/Android.mk +++ b/src/gallium/drivers/r600/Android.mk @@ -30,7 +30,9 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES := $(C_SOURCES) $(CXX_SOURCES) -LOCAL_C_INCLUDES += $(MESA_TOP)/src/amd/common +LOCAL_C_INCLUDES += \ + $(MESA_TOP)/src/amd/common \ + $(MESA_TOP)/src/amd/llvm LOCAL_SHARED_LIBRARIES := libdrm_radeon LOCAL_MODULE := libmesa_pipe_r600 diff --git a/src/gallium/drivers/radeonsi/Android.mk b/src/gallium/drivers/radeonsi/Android.mk index e402da639e7..2a75c463379 100644 --- a/src/gallium/drivers/radeonsi/Android.mk +++ b/src/gallium/drivers/radeonsi/Android.mk @@ -36,6 +36,7 @@ LOCAL_MODULE_CLASS := STATIC_LIBRARIES LOCAL_C_INCLUDES := \ $(MESA_TOP)/src/amd/common \ + $(MESA_TOP)/src/amd/llvm \ $(call generated-sources-dir-for,STATIC_LIBRARIES,libmesa_amd_common,,)/common \ $(call generated-sources-dir-for,STATIC_LIBRARIES,libmesa_nir,,)/nir diff --git a/src/gallium/drivers/radeonsi/meson.build b/src/gallium/drivers/radeonsi/meson.build index a362c207776..6e155243a27 100644 --- a/src/gallium/drivers/radeonsi/meson.build +++ b/src/gallium/drivers/radeonsi/meson.build @@ -117,7 +117,7 @@ libradeonsi = static_library( 'radeonsi', [files_libradeonsi, si_driinfo_h, sid_tables_h, gfx10_format_table_h], include_directories : [ - inc_src, inc_include, inc_gallium, inc_gallium_aux, inc_amd_common, + inc_src, inc_include, inc_gallium, inc_gallium_aux, inc_amd_common, inc_amd_common_llvm, inc_gallium_drivers, ], c_args : ['-Wstrict-overflow=0', c_vis_args], @@ -129,7 +129,7 @@ driver_radeonsi = declare_dependency( compile_args : '-DGALLIUM_RADEONSI', sources : si_driinfo_h, link_with : [ - libradeonsi, libradeonwinsys, libamdgpuwinsys, libamd_common, + libradeonsi, libradeonwinsys, libamdgpuwinsys, libamd_common, libamd_common_llvm ], dependencies : idep_nir, ) diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c index a89432d8594..7864b21e3c7 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c @@ -39,8 +39,8 @@ #include #include #include -#include "amd/common/ac_llvm_util.h" -#include "amd/common/sid.h" +#include "ac_llvm_util.h" +#include "sid.h" #ifndef AMDGPU_INFO_NUM_VRAM_CPU_PAGE_FAULTS #define AMDGPU_INFO_NUM_VRAM_CPU_PAGE_FAULTS 0x1E diff --git a/src/gallium/winsys/amdgpu/drm/meson.build b/src/gallium/winsys/amdgpu/drm/meson.build index 65a5e64dc62..ef2705d52ad 100644 --- a/src/gallium/winsys/amdgpu/drm/meson.build +++ b/src/gallium/winsys/amdgpu/drm/meson.build @@ -27,6 +27,7 @@ libamdgpuwinsys = static_library( ), include_directories : [ inc_amd, inc_gallium, inc_gallium_aux, inc_include, inc_src, + inc_amd_common, inc_amd_common_llvm, ], c_args : [c_vis_args], cpp_args : [cpp_vis_args], diff --git a/src/meson.build b/src/meson.build index d01f84c0d46..10b2772f907 100644 --- a/src/meson.build +++ b/src/meson.build @@ -26,6 +26,7 @@ inc_src = include_directories('.') inc_gallium = include_directories('gallium/include') inc_gallium_aux = include_directories('gallium/auxiliary') inc_amd_common = include_directories('amd/common') +inc_amd_common_llvm = include_directories('amd/llvm') libglsl_util = static_library( 'glsl_util',