blob: 52e5d7efdd796a5a3e1ba8e820a8d0e12ab6d6e4 [file] [log] [blame]
# 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("//third_party/mako/py_srcs.gni")
import("../../../mesa.gni")
declare_args() {
# TODO(fxbug.dev/67565) - remove once external sync FD extensions fully supported
anv_enable_external_sync_fd = false
# Give maximum possible memory to Vulkan heap
anv_use_max_ram = false
}
config("vulkan_internal_config") {
defines = [ "USE_MAGMA=1" ]
if (!anv_enable_external_sync_fd) {
defines += [ "DISABLE_EXTERNAL_SYNC_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",
]
# Suppress warnings the vulkan code doesn't comply with.
configs = [
"//build/config:Wno-unused-but-set-variable",
"//build/config:Wno-strict-prototypes",
]
}
# 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(fxbug.dev/13195): support flexible device path
defines = [ "DEV_GPU_PATH_OVERRIDE=\"/dev/magma0\"" ]
}
public_configs = [ ":vulkan_internal_config" ]
deps = [
":anv_entrypoints",
":gen",
"$magma_build_root/include:magma",
"$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/intel/perf",
"$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",
"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_formats.c",
"anv_genX.h",
"anv_image.c",
"anv_magma.c",
"anv_magma_buffer_collection.c",
"anv_magma_buffer_collection_x.c",
"anv_magma_connection.cc",
"anv_measure.c",
"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_ubo_loads.c",
"anv_nir_lower_ycbcr_textures.c",
"anv_pass.c",
"anv_perf.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",
"//build/config:Wno-strict-prototypes",
]
}
group("gen") {
deps = [
":gen11",
":gen12",
":gen125",
":gen7",
":gen75",
":gen8",
":gen9",
]
}
template("vulkan_gen8") {
mesa_source_set(target_name) {
defines = [ invoker.defines ]
configs = [ ":vulkan_internal_config" ]
sources = [
"genX_blorp_exec.c",
"genX_cmd_buffer.c",
"genX_gpu_memcpy.c",
"genX_pipeline.c",
"genX_query.c",
"genX_state.c",
"gfx8_cmd_buffer.c",
]
deps = [
":anv_entrypoints",
"$magma_build_root/include:magma",
"$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 = "GFX_VERx10=80"
}
vulkan_gen8("gen9") {
defines = "GFX_VERx10=90"
}
vulkan_gen8("gen11") {
defines = "GFX_VERx10=110"
}
vulkan_gen8("gen12") {
defines = "GFX_VERx10=120"
}
vulkan_gen8("gen125") {
defines = "GFX_VERx10=125"
}
template("vulkan_gen7") {
mesa_source_set(target_name) {
defines = [ invoker.defines ]
configs = [ ":vulkan_internal_config" ]
sources = [
"genX_blorp_exec.c",
"genX_cmd_buffer.c",
"genX_gpu_memcpy.c",
"genX_pipeline.c",
"genX_query.c",
"genX_state.c",
"gfx7_cmd_buffer.c",
]
deps = [
":anv_entrypoints",
"$magma_build_root/include:magma",
"$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 = "GFX_VERx10=70"
}
vulkan_gen7("gen75") {
defines = "GFX_VERx10=75"
}
mesa_python_action("anv_entrypoints") {
outputs = [
"$target_gen_dir/anv_entrypoints.h",
"$target_gen_dir/anv_entrypoints.c",
]
script = "$mesa_build_root/src/vulkan/util/vk_entrypoints_gen.py"
inputs = [
"$mesa_build_root/src/vulkan/util/vk_dispatch_table_gen.py",
"$mesa_build_root/src/vulkan/util/vk_extensions.py",
"$mesa_build_root/src/vulkan/registry/vk.xml",
] + third_party_mako_srcs
args = [
"--xml",
rebase_path("$mesa_build_root", root_build_dir) +
"/src/vulkan/registry/vk.xml",
"--proto",
"--weak",
"--out-h",
rebase_path("$target_gen_dir/anv_entrypoints.h", root_build_dir),
"--out-c",
rebase_path("$target_gen_dir/anv_entrypoints.c", root_build_dir),
"--prefix",
"anv",
"--device-prefix",
"gfx7",
"--device-prefix",
"gfx75",
"--device-prefix",
"gfx8",
"--device-prefix",
"gfx9",
"--device-prefix",
"gfx11",
"--device-prefix",
"gfx12",
"--device-prefix",
"gfx125",
]
}