This commit is a step towards the goal of being able to build RADV without LLVM. In the future we would like to offer the option to use RADV solely with ACO. There is still a need for the common AMD code located in amd/common but the LLVM specific parts need to be separated. Signed-off-by: Timur Kristóf <timur.kristof@gmail.com> Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Acked-by: Marek Olšák <marek.olsak@amd.com> Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>tags/19.3-branchpoint
@@ -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 \ |
@@ -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_gpu_info.c \ | |||
common/ac_gpu_info.h \ | |||
common/ac_surface.c \ | |||
common/ac_surface.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 | |||
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 \ |
@@ -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], |
@@ -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, |
@@ -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], | |||
) | |||
@@ -22,6 +22,7 @@ inc_amd = include_directories('.') | |||
subdir('addrlib') | |||
subdir('common') | |||
subdir('llvm') | |||
if with_amd_vk | |||
subdir('compiler') | |||
subdir('vulkan') |
@@ -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, |
@@ -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 |
@@ -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 | |||
@@ -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, | |||
) |
@@ -39,8 +39,8 @@ | |||
#include <stdio.h> | |||
#include <sys/stat.h> | |||
#include <fcntl.h> | |||
#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 |
@@ -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], |
@@ -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', |