| # Copyright 2016 Google, LLC |
| # |
| # 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. |
| |
| import("../../../mesa.gni") |
| |
| declare_args() { |
| # TODO(fxbug.dev/67565) - remove once external FD extensions fully supported |
| anv_enable_external_fd = false |
| # Give maximum possible memory to Vulkan heap |
| anv_use_max_ram = false |
| } |
| |
| config("vulkan_internal_config") { |
| defines = [ "ANV_MAGMA=1" ] |
| |
| if (!anv_enable_external_fd) { |
| defines += [ "DISABLE_EXTERNAL_FD=1" ] |
| } |
| if (anv_use_max_ram) { |
| defines += [ "ANV_AVAILABLE_RAM_FRACTION=1.0" ] |
| } |
| |
| include_dirs = [ |
| ".", |
| "..", # because anv_private.h includes isl/isl.h |
| "$mesa_build_root/include/drm-uapi", # because anv_private.h includes |
| # i915_drm.h |
| "$mesa_build_root/src", # because isl.h includes util/macros.h |
| "$mesa_build_root/src/vulkan/util", # because anv_private.h includes |
| # vk_alloc.h |
| "$root_gen_dir/third_party/mesa/src/intel/vulkan", |
| ] |
| } |
| |
| # Use a config rather than setting ldflags directly so the ldflags |
| # may overwrite the --build-id (no sha1) setting in a base config. |
| config("vulkan_icd_config") { |
| ldflags = [ |
| "-static-libstdc++", |
| "-Wl,--build-id=sha1", |
| ] |
| } |
| |
| magma_vulkan_icd("vulkan_intel") { |
| output_name = "libvulkan_intel" |
| deps = [ ":vulkan_internal" ] |
| |
| if (is_fuchsia) { |
| imported_symbols_allowlist = |
| rebase_path("$magma_build_root/gnbuild/imported_symbols.allowlist") |
| deps += [ |
| "$magma_build_root/src/libmagma", |
| # TODO(fxb/13095); enable this when fx logger failure case is handled |
| #"$mesa_build_root/src/os:fuchsia_libc_static", |
| ] |
| } |
| |
| if (is_linux) { |
| deps += [ "$magma_build_root/src/libmagma_linux" ] |
| } |
| |
| configs = [ ":vulkan_icd_config" ] |
| } |
| |
| # Also used by testing targets |
| mesa_source_set("vulkan_internal") { |
| public_deps = [ |
| "$mesa_build_root/include:vulkan", |
| "$mesa_build_root/src/intel/compiler", |
| "$mesa_build_root/src/vulkan/wsi", |
| ] |
| cflags_cc = [ "-Wno-c++11-narrowing" ] |
| |
| if (is_linux) { |
| # TODO(MA-588): support flexible device path |
| defines = [ "DEV_GPU_PATH_OVERRIDE=\"/dev/magma0\"" ] |
| } |
| |
| public_configs = [ ":vulkan_internal_config" ] |
| |
| deps = [ |
| ":anv_entrypoints", |
| ":anv_extensions", |
| ":gen", |
| "$magma_build_root/include:magma_abi", |
| "$mesa_build_root/include:c_compat", |
| "$mesa_build_root/src:sha1", |
| "$mesa_build_root/src/compiler/nir", |
| "$mesa_build_root/src/compiler/spirv", |
| "$mesa_build_root/src/intel:genxml", |
| "$mesa_build_root/src/intel:isl", |
| "$mesa_build_root/src/intel/blorp", |
| "$mesa_build_root/src/intel/common", |
| "$mesa_build_root/src/intel/dev", |
| "$mesa_build_root/src/os", |
| "$mesa_build_root/src/util", |
| "$mesa_build_root/src/vulkan/util", |
| "$msd_intel_gen_build_root/include", |
| ] |
| |
| if (is_linux) { |
| deps += [ "//third_party/wayland:client" ] |
| } |
| |
| sources = [ |
| "$target_gen_dir/anv_entrypoints.c", |
| "$target_gen_dir/anv_entrypoints.h", |
| "$target_gen_dir/anv_extensions.c", |
| "$target_gen_dir/anv_extensions.h", |
| "anv_allocator.c", |
| "anv_android_stubs.c", |
| "anv_batch_chain.c", |
| "anv_blorp.c", |
| "anv_cmd_buffer.c", |
| "anv_descriptor_set.c", |
| "anv_device.c", |
| "anv_dump.c", |
| "anv_formats.c", |
| "anv_genX.h", |
| "anv_image.c", |
| "anv_intel.c", |
| "anv_magma.c", |
| "anv_magma_buffer_collection.c", |
| "anv_magma_connection.cc", |
| "anv_nir.h", |
| "anv_nir_add_base_work_group_id.c", |
| "anv_nir_apply_pipeline_layout.c", |
| "anv_nir_compute_push_layout.c", |
| "anv_nir_lower_multiview.c", |
| "anv_nir_lower_ycbcr_textures.c", |
| "anv_pass.c", |
| "anv_pipeline.c", |
| "anv_pipeline_cache.c", |
| "anv_private.h", |
| "anv_queue.c", |
| "anv_util.c", |
| "anv_wsi.c", |
| "vk_format_info.h", |
| ] |
| |
| if (is_linux) { |
| sources += [ "anv_wsi_wayland.c" ] |
| } |
| configs = [ "//build/config:Wno-conversion" ] |
| } |
| |
| group("gen") { |
| deps = [ |
| ":gen10", |
| ":gen11", |
| ":gen12", |
| ":gen7", |
| ":gen75", |
| ":gen8", |
| ":gen9", |
| ] |
| } |
| |
| template("vulkan_gen8") { |
| mesa_source_set(target_name) { |
| defines = [ invoker.defines ] |
| |
| configs = [ ":vulkan_internal_config" ] |
| |
| sources = [ |
| "gen8_cmd_buffer.c", |
| "genX_blorp_exec.c", |
| "genX_cmd_buffer.c", |
| "genX_gpu_memcpy.c", |
| "genX_pipeline.c", |
| "genX_query.c", |
| "genX_state.c", |
| ] |
| |
| deps = [ |
| ":anv_entrypoints", |
| ":anv_extensions", |
| "$magma_build_root/include:magma_abi", |
| "$mesa_build_root/include:c_compat", |
| "$mesa_build_root/include:vulkan", |
| "$mesa_build_root/src/intel:genxml", |
| "$mesa_build_root/src/intel:isl", |
| "$mesa_build_root/src/intel/blorp", |
| "$mesa_build_root/src/intel/compiler", |
| "$mesa_build_root/src/vulkan/wsi", |
| ] |
| } |
| } |
| |
| vulkan_gen8("gen8") { |
| defines = "GEN_VERSIONx10=80" |
| } |
| |
| vulkan_gen8("gen9") { |
| defines = "GEN_VERSIONx10=90" |
| } |
| |
| vulkan_gen8("gen10") { |
| defines = "GEN_VERSIONx10=100" |
| } |
| |
| vulkan_gen8("gen11") { |
| defines = "GEN_VERSIONx10=110" |
| } |
| |
| vulkan_gen8("gen12") { |
| defines = "GEN_VERSIONx10=120" |
| } |
| |
| template("vulkan_gen7") { |
| mesa_source_set(target_name) { |
| defines = [ invoker.defines ] |
| |
| configs = [ ":vulkan_internal_config" ] |
| |
| sources = [ |
| "gen7_cmd_buffer.c", |
| "genX_blorp_exec.c", |
| "genX_cmd_buffer.c", |
| "genX_gpu_memcpy.c", |
| "genX_pipeline.c", |
| "genX_query.c", |
| "genX_state.c", |
| ] |
| |
| deps = [ |
| ":anv_entrypoints", |
| ":anv_extensions", |
| "$magma_build_root/include:magma_abi", |
| "$mesa_build_root/include:c_compat", |
| "$mesa_build_root/include:vulkan", |
| "$mesa_build_root/src/intel:genxml", |
| "$mesa_build_root/src/intel:isl", |
| "$mesa_build_root/src/intel/blorp", |
| "$mesa_build_root/src/intel/compiler", |
| "$mesa_build_root/src/vulkan/wsi", |
| ] |
| } |
| } |
| |
| vulkan_gen7("gen7") { |
| defines = "GEN_VERSIONx10=70" |
| } |
| |
| vulkan_gen7("gen75") { |
| defines = "GEN_VERSIONx10=75" |
| } |
| |
| mesa_python_action("anv_entrypoints") { |
| outputs = [ |
| "$target_gen_dir/anv_entrypoints.h", |
| "$target_gen_dir/anv_entrypoints.c", |
| ] |
| |
| script = "anv_entrypoints_gen.py" |
| |
| inputs = [ |
| "anv_extensions.py", |
| "$mesa_build_root/src/vulkan/registry/vk.xml", |
| ] |
| |
| args = [ |
| "--xml", |
| rebase_path("$mesa_build_root") + "/src/vulkan/registry/vk.xml", |
| "--outdir", |
| rebase_path("$target_gen_dir"), |
| ] |
| } |
| |
| mesa_python_action("anv_extensions") { |
| outputs = [ |
| "$target_gen_dir/anv_extensions.c", |
| "$target_gen_dir/anv_extensions.h", |
| ] |
| |
| script = "anv_extensions_gen.py" |
| |
| inputs = [ |
| "$mesa_build_root/src/vulkan/registry/vk.xml", |
| "anv_extensions.py", |
| ] |
| |
| args = [ |
| "--out-c", |
| rebase_path("$target_gen_dir/anv_extensions.c"), |
| "--out-h", |
| rebase_path("$target_gen_dir/anv_extensions.h"), |
| "--xml", |
| rebase_path("$mesa_build_root") + "/src/vulkan/registry/vk.xml", |
| ] |
| } |