blob: caa4cff6fe39b96988ba70fd8e8aec5bd862add2 [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("../../../mesa.gni")
declare_args() {
# TODO(fxbug.dev/42146493) - remove once external sync FD extensions fully supported
anv_enable_external_sync_fd = false
anv_enable_raytracing = 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_enable_raytracing) {
defines += [ "ANV_SUPPORT_RT=1" ]
} else {
defines += [ "ANV_SUPPORT_RT=0" ]
}
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_virt" ]
}
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/42082076): support flexible device path
defines = [ "DEV_GPU_PATH_OVERRIDE=\"/dev/magma0\"" ]
}
public_configs = [
":vulkan_internal_config",
"$mesa_build_root/src/vulkan/runtime:magma_config",
]
deps = [
":anv_entrypoints",
":float64_spv_h",
":gen",
"$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:magma_util",
"$mesa_build_root/src/vulkan/runtime",
"$mesa_build_root/src/vulkan/util",
"$msd_intel_gen_build_root/include",
"//sdk/lib/magma_client:magma_headers",
]
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_bo_sync.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_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_nir_push_descriptor_analysis.c",
"anv_perf.c",
"anv_pipeline.c",
"anv_pipeline_cache.c",
"anv_private.h",
"anv_queue.c",
"anv_util.c",
"anv_utrace.c",
"anv_wsi.c",
"vk_format_info.h",
]
configs = [
"//build/config:Wno-conversion",
"//build/config:Wno-strict-prototypes",
]
}
group("gen") {
deps = [
":gen11",
":gen12",
":gen125",
":gen9",
]
}
template("vulkan_gen8") {
mesa_source_set(target_name) {
defines = [ invoker.defines ]
configs = [
":vulkan_internal_config",
"$mesa_build_root/src/vulkan/runtime:magma_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",
"$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/intel/ds",
"$mesa_build_root/src/vulkan/wsi",
"//sdk/lib/magma_client:magma_headers",
]
}
}
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"
}
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/util/vk_entrypoints.py",
"$mesa_build_root/src/vulkan/registry/vk.xml",
]
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",
"gfx9",
"--device-prefix",
"gfx11",
"--device-prefix",
"gfx12",
"--device-prefix",
"gfx125",
]
}
mesa_python_action("float64_spv_h") {
float64_spv_h = "${target_gen_dir}/float64_spv.h"
outputs = [ float64_spv_h ]
script = "${mesa_build_root}/src/util/glsl2spirv.py"
float64_glsl = "${mesa_build_root}/src/compiler/glsl/float64.glsl"
sources = [ float64_glsl ]
inputs = [ "${host_out_dir}/glslang_validator" ]
args = [
rebase_path(float64_glsl, root_build_dir),
rebase_path(float64_spv_h, root_build_dir),
rebase_path("${host_out_dir}/glslang_validator", root_build_dir),
"--create-entry",
"main",
"--vn",
"float64_spv_source",
"--glsl-version",
"450",
"-Olib",
]
deps = [ "//third_party/glslang:glslang_validator($host_toolchain)" ]
}