Path: blob/21.2-virgl/src/gallium/drivers/swr/meson.build
4570 views
# Copyright © 2017-2020 Intel Corporation12# Permission is hereby granted, free of charge, to any person obtaining a copy3# of this software and associated documentation files (the "Software"), to deal4# in the Software without restriction, including without limitation the rights5# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell6# copies of the Software, and to permit persons to whom the Software is7# furnished to do so, subject to the following conditions:89# The above copyright notice and this permission notice shall be included in10# all copies or substantial portions of the Software.1112# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR13# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,14# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE15# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER16# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,17# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE18# SOFTWARE.1920files_swr_common = files(21'rasterizer/common/formats.cpp',22'rasterizer/common/formats.h',23'rasterizer/common/intrin.h',24'rasterizer/common/isa.hpp',25'rasterizer/common/os.cpp',26'rasterizer/common/os.h',27'rasterizer/common/rdtsc_buckets.cpp',28'rasterizer/common/rdtsc_buckets.h',29'rasterizer/common/rdtsc_buckets_shared.h',30'rasterizer/common/rdtsc_buckets_shared.h',31'rasterizer/common/simd16intrin.h',32'rasterizer/common/simdintrin.h',33'rasterizer/common/simdlib.hpp',34'rasterizer/common/simdlib_interface.hpp',35'rasterizer/common/simdlib_types.hpp',36'rasterizer/common/swr_assert.cpp',37'rasterizer/common/swr_assert.h',38)3940files_swr_mesa = files(41'swr_loader.cpp',42'swr_clear.cpp',43'swr_context.cpp',44'swr_context.h',45'swr_draw.cpp',46'swr_public.h',47'swr_resource.h',48'swr_screen.cpp',49'swr_screen.h',50'swr_state.cpp',51'swr_state.h',52'swr_tex_sample.cpp',53'swr_tex_sample.h',54'swr_scratch.h',55'swr_scratch.cpp',56'swr_shader.cpp',57'swr_shader.h',58'swr_memory.h',59'swr_fence.h',60'swr_fence.cpp',61'swr_fence_work.h',62'swr_fence_work.cpp',63'swr_query.h',64'swr_query.cpp',65'rasterizer/jitter/blend_jit.cpp',66'rasterizer/jitter/blend_jit.h',67'rasterizer/jitter/builder.cpp',68'rasterizer/jitter/builder.h',69'rasterizer/jitter/builder_math.h',70'rasterizer/jitter/builder_mem.cpp',71'rasterizer/jitter/builder_mem.h',72'rasterizer/jitter/builder_gfx_mem.cpp',73'rasterizer/jitter/builder_gfx_mem.h',74'rasterizer/jitter/builder_misc.cpp',75'rasterizer/jitter/builder_misc.h',76'rasterizer/jitter/fetch_jit.cpp',77'rasterizer/jitter/fetch_jit.h',78'rasterizer/jitter/jit_api.h',79'rasterizer/jitter/JitManager.cpp',80'rasterizer/jitter/JitManager.h',81'rasterizer/jitter/streamout_jit.cpp',82'rasterizer/jitter/streamout_jit.h',83'rasterizer/jitter/shader_lib/DebugOutput.cpp',84'rasterizer/jitter/shader_lib/Scatter.cpp',85'rasterizer/jitter/functionpasses/lower_x86.cpp',86'rasterizer/memory/SurfaceState.h'87)8889files_swr_arch = files(90'rasterizer/archrast/archrast.cpp',91'rasterizer/archrast/archrast.h',92'rasterizer/archrast/eventmanager.h',93'rasterizer/core/api.cpp',94'rasterizer/core/api.h',95'rasterizer/core/arena.h',96'rasterizer/core/backend.cpp',97'rasterizer/core/backend_clear.cpp',98'rasterizer/core/backend_sample.cpp',99'rasterizer/core/backend_singlesample.cpp',100'rasterizer/core/backend.h',101'rasterizer/core/backend_impl.h',102'rasterizer/core/binner.cpp',103'rasterizer/core/binner.h',104'rasterizer/core/blend.h',105'rasterizer/core/clip.cpp',106'rasterizer/core/clip.h',107'rasterizer/core/conservativeRast.h',108'rasterizer/core/context.h',109'rasterizer/core/depthstencil.h',110'rasterizer/core/fifo.hpp',111'rasterizer/core/format_conversion.h',112'rasterizer/core/format_traits.h',113'rasterizer/core/format_types.h',114'rasterizer/core/format_utils.h',115'rasterizer/core/frontend.cpp',116'rasterizer/core/frontend.h',117'rasterizer/core/knobs.h',118'rasterizer/core/knobs_init.h',119'rasterizer/core/multisample.h',120'rasterizer/core/pa_avx.cpp',121'rasterizer/core/pa.h',122'rasterizer/core/rasterizer.cpp',123'rasterizer/core/rasterizer.h',124'rasterizer/core/rasterizer_impl.h',125'rasterizer/core/rdtsc_core.cpp',126'rasterizer/core/rdtsc_core.h',127'rasterizer/core/ringbuffer.h',128'rasterizer/core/state.h',129'rasterizer/core/state_funcs.h',130'rasterizer/core/tessellator.h',131'rasterizer/core/tessellator.hpp',132'rasterizer/core/tessellator.cpp',133'rasterizer/core/threads.cpp',134'rasterizer/core/threads.h',135'rasterizer/core/tilemgr.cpp',136'rasterizer/core/tilemgr.h',137'rasterizer/core/tileset.h',138'rasterizer/core/utils.h',139'rasterizer/memory/ClearTile.cpp',140'rasterizer/memory/Convert.h',141'rasterizer/memory/LoadTile.cpp',142'rasterizer/memory/LoadTile.h',143'rasterizer/memory/LoadTile_Linear.cpp',144'rasterizer/memory/LoadTile_TileX.cpp',145'rasterizer/memory/LoadTile_TileY.cpp',146'rasterizer/memory/StoreTile.cpp',147'rasterizer/memory/StoreTile.h',148'rasterizer/memory/StoreTile_Linear2.cpp',149'rasterizer/memory/StoreTile_Linear.cpp',150'rasterizer/memory/StoreTile_TileW.cpp',151'rasterizer/memory/StoreTile_TileX2.cpp',152'rasterizer/memory/StoreTile_TileX.cpp',153'rasterizer/memory/StoreTile_TileY2.cpp',154'rasterizer/memory/StoreTile_TileY.cpp',155'rasterizer/memory/TilingFunctions.h',156'rasterizer/memory/tilingtraits.h',157'rasterizer/memory/InitMemory.h',158'rasterizer/memory/InitMemory.cpp',159'rasterizer/memory/SurfaceState.h'160)161162swr_context_files = files('swr_context.h')163swr_state_files = files('rasterizer/core/state.h')164swr_surf_state_files = files('rasterizer/memory/SurfaceState.h')165swr_event_proto_files = files('rasterizer/archrast/events.proto')166swr_event_pproto_files = files('rasterizer/archrast/events_private.proto')167swr_gen_backend_files = files('rasterizer/codegen/templates/gen_backend.cpp')168swr_gen_rasterizer_files = files('rasterizer/codegen/templates/gen_rasterizer.cpp')169swr_gen_header_init_files = files('rasterizer/codegen/templates/gen_header_init.hpp')170171swr_gen_llvm_ir_macros_py = files('rasterizer/codegen/gen_llvm_ir_macros.py')172swr_gen_backends_py = files('rasterizer/codegen/gen_backends.py')173174swr_gen_builder_depends = files(175'rasterizer/codegen/templates/gen_builder.hpp',176'rasterizer/codegen/gen_common.py'177)178179180subdir('rasterizer/jitter')181subdir('rasterizer/codegen')182subdir('rasterizer/core/backends')183184swr_incs = include_directories(185'rasterizer/codegen', 'rasterizer/core', 'rasterizer/jitter',186'rasterizer/archrast', 'rasterizer',187)188189swr_cpp_args = []190if cpp.has_argument('-fno-strict-aliasing')191swr_cpp_args += '-fno-strict-aliasing'192endif193if cpp.has_argument('-Wno-aligned-new')194swr_cpp_args += '-Wno-aligned-new'195endif196197198swr_arch_libs = []199swr_defines = []200201swr_avx_args = cpp.first_supported_argument(202'-target-cpu=sandybridge', '-mavx', '-march=core-avx', '-tp=sandybridge',203'/arch:AVX',204)205if swr_avx_args == []206error('Cannot find AVX support for swr. (these are required for SWR an all architectures.)')207endif208209shared_swr = get_option('shared-swr')210if not shared_swr211if with_swr_arches.length() > 1212error('When SWR is linked statically only one architecture is allowed.')213endif214swr_defines += '-DHAVE_SWR_BUILTIN'215endif216217if with_swr_arches.contains('skx')218swr_skx_args = cpp.first_supported_argument(219'-march=skylake-avx512', '-target-cpu=x86-skylake', '-xCORE-AVX512',220)221if swr_skx_args == []222error('Cannot find SKX support for swr.')223endif224225swr_defines += '-DHAVE_SWR_SKX'226if shared_swr227swr_arch_libs += shared_library(228'swrSKX',229[files_swr_common, files_swr_arch],230cpp_args : [231cpp_msvc_compat_args, swr_cpp_args, swr_skx_args,232'-DKNOB_ARCH=KNOB_ARCH_AVX512',233],234gnu_symbol_visibility : 'hidden',235link_args : [ld_args_gc_sections],236include_directories : [swr_incs],237dependencies : [dep_thread, dep_llvm],238version : '0.0.0',239soversion : host_machine.system() == 'windows' ? '' : '0',240install : true,241name_prefix : host_machine.system() == 'windows' ? '' : 'lib',242)243else244swr_arch_libs += static_library(245'swrSKX',246[files_swr_common, files_swr_arch],247cpp_args : [248cpp_msvc_compat_args, swr_cpp_args, swr_skx_args,249'-DKNOB_ARCH=KNOB_ARCH_AVX512',250],251gnu_symbol_visibility : 'hidden',252link_args : [ld_args_gc_sections],253include_directories : [swr_incs],254dependencies : [dep_thread, dep_llvm],255)256endif257endif258259if with_swr_arches.contains('knl')260swr_knl_args = cpp.first_supported_argument(261'-march=knl', '-target-cpu=mic-knl', '-xMIC-AVX512',262)263if swr_knl_args == []264error('Cannot find KNL support for swr.')265endif266267swr_defines += '-DHAVE_SWR_KNL'268if shared_swr269swr_arch_libs += shared_library(270'swrKNL',271[files_swr_common, files_swr_arch],272cpp_args : [273cpp_msvc_compat_args, swr_cpp_args, swr_knl_args,274'-DKNOB_ARCH=KNOB_ARCH_AVX512', '-DSIMD_ARCH_KNIGHTS',275],276gnu_symbol_visibility : 'hidden',277link_args : [ld_args_gc_sections],278include_directories : [swr_incs],279dependencies : [dep_thread, dep_llvm],280version : '0.0.0',281soversion : host_machine.system() == 'windows' ? '' : '0',282install : true,283name_prefix : host_machine.system() == 'windows' ? '' : 'lib',284)285else286swr_arch_libs += static_library(287'swrKNL',288[files_swr_common, files_swr_arch],289cpp_args : [290cpp_msvc_compat_args, swr_cpp_args, swr_knl_args,291'-DKNOB_ARCH=KNOB_ARCH_AVX512', '-DSIMD_ARCH_KNIGHTS',292],293gnu_symbol_visibility : 'hidden',294link_args : [ld_args_gc_sections],295include_directories : [swr_incs],296dependencies : [dep_thread, dep_llvm],297)298endif299endif300301302if with_swr_arches.contains('avx2')303swr_avx2_args = cpp.first_supported_argument(304'-target-cpu=haswell', '-march=core-avx2', '-tp=haswell', '/arch:AVX2',305)306if swr_avx2_args == []307if cpp.has_argument(['-mavx2', '-mfma', '-mbmi2', '-mf16c'])308swr_avx2_args = ['-mavx2', '-mfma', '-mbmi2', '-mf16c']309else310error('Cannot find AVX2 support for swr.')311endif312endif313314swr_defines += '-DHAVE_SWR_AVX2'315if shared_swr316swr_arch_libs += shared_library(317'swrAVX2',318[files_swr_common, files_swr_arch],319cpp_args : [320cpp_msvc_compat_args, swr_cpp_args, swr_avx2_args,321'-DKNOB_ARCH=KNOB_ARCH_AVX2',322],323gnu_symbol_visibility : 'hidden',324link_args : [ld_args_gc_sections],325include_directories : [swr_incs],326dependencies : [dep_thread, dep_llvm],327version : '0.0.0',328soversion : host_machine.system() == 'windows' ? '' : '0',329install : true,330name_prefix : host_machine.system() == 'windows' ? '' : 'lib',331)332else333swr_arch_libs += static_library(334'swrAVX2',335[files_swr_common, files_swr_arch],336cpp_args : [337cpp_msvc_compat_args, swr_cpp_args, swr_avx2_args,338'-DKNOB_ARCH=KNOB_ARCH_AVX2',339],340gnu_symbol_visibility : 'hidden',341link_args : [ld_args_gc_sections],342include_directories : [swr_incs],343dependencies : [dep_thread, dep_llvm],344)345endif346endif347348if with_swr_arches.contains('avx')349swr_defines += '-DHAVE_SWR_AVX'350if shared_swr351swr_arch_libs += shared_library(352'swrAVX',353[files_swr_common, files_swr_arch],354cpp_args : [355cpp_msvc_compat_args, swr_cpp_args, swr_avx_args,356'-DKNOB_ARCH=KNOB_ARCH_AVX',357],358gnu_symbol_visibility : 'hidden',359link_args : [ld_args_gc_sections],360include_directories : [swr_incs],361dependencies : [dep_thread, dep_llvm],362version : '0.0.0',363soversion : host_machine.system() == 'windows' ? '' : '0',364install : true,365name_prefix : host_machine.system() == 'windows' ? '' : 'lib',366)367else368swr_arch_libs += static_library(369'swrAVX',370[files_swr_common, files_swr_arch],371cpp_args : [372cpp_msvc_compat_args, swr_cpp_args, swr_avx_args,373'-DKNOB_ARCH=KNOB_ARCH_AVX',374],375gnu_symbol_visibility : 'hidden',376link_args : [ld_args_gc_sections],377include_directories : [swr_incs],378dependencies : [dep_thread, dep_llvm],379)380endif381endif382383384if swr_arch_libs == []385error('SWR configured, but no SWR architectures configured')386endif387388# The swr_avx_args are needed for intrensic usage in swr api headers.389libmesaswr = static_library(390'mesaswr',391[files_swr_mesa, files_swr_common, gen_knobs_h, gen_knobs_cpp,392gen_builder_hpp, gen_builder_meta_hpp, gen_builder_intrin_hpp],393cpp_args : [394cpp_msvc_compat_args, swr_cpp_args, swr_avx_args,395swr_defines,396],397gnu_symbol_visibility : 'hidden',398include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, swr_incs],399dependencies : [dep_llvm, idep_mesautil],400)401402link_libs = [libmesaswr]403if not shared_swr404link_libs += swr_arch_libs405endif406407driver_swr = declare_dependency(408compile_args : '-DGALLIUM_SWR',409link_with : link_libs410)411412413