From 5af81ed7c5ec705f1c385cff895b2488097f6754 Mon Sep 17 00:00:00 2001 From: Gurchetan Singh Date: Wed, 24 Jan 2024 10:12:31 -0800 Subject: [PATCH] mesa: add gfxstream-experimental to -Dvulkan-drivers This adds gfxstream-vk as a vulkan driver to Mesa. It will be used in the following places: - Android Emulator - Fuchsia Emulator - Cloud Android - AAOS reference hardware - [a few other places] meson amd64-build/ -Dvulkan-drivers="gfxstream-experimental" -Dgallium-drivers="" -Dopengl=false Reviewed-by: Aaron Ruby Acked-by: Yonggang Luo Acked-by: Adam Jackson Part-of: --- meson.build | 3 +- meson_options.txt | 3 +- src/gfxstream/guest/meson.build | 61 ++++++++++++++++++++++ src/gfxstream/guest/vulkan_enc/meson.build | 2 +- src/gfxstream/meson.build | 7 +++ src/meson.build | 3 ++ 6 files changed, 76 insertions(+), 3 deletions(-) create mode 100644 src/gfxstream/guest/meson.build create mode 100644 src/gfxstream/meson.build diff --git a/meson.build b/meson.build index f83be6ec601..eeefe7a97f3 100644 --- a/meson.build +++ b/meson.build @@ -242,7 +242,7 @@ elif _vulkan_drivers.contains('all') _vulkan_drivers = ['amd', 'intel', 'intel_hasvk', 'swrast', 'freedreno', 'panfrost', 'virtio', 'broadcom', 'imagination-experimental', 'microsoft-experimental', - 'nouveau', 'asahi'] + 'nouveau', 'asahi', 'gfxstream-experimental'] endif with_intel_vk = _vulkan_drivers.contains('intel') @@ -258,6 +258,7 @@ with_imagination_srv = get_option('imagination-srv') with_microsoft_vk = _vulkan_drivers.contains('microsoft-experimental') with_nouveau_vk = _vulkan_drivers.contains('nouveau') with_asahi_vk = _vulkan_drivers.contains('asahi') +with_gfxstream_vk = _vulkan_drivers.contains('gfxstream-experimental') with_any_vk = _vulkan_drivers.length() != 0 if with_any_vk and host_machine.system() == 'windows' and meson.version().version_compare('< 1.3') diff --git a/meson_options.txt b/meson_options.txt index d800f65f287..82324617884 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -205,7 +205,8 @@ option( value : ['auto'], choices : ['auto', 'amd', 'broadcom', 'freedreno', 'intel', 'intel_hasvk', 'panfrost', 'swrast', 'virtio', 'imagination-experimental', - 'microsoft-experimental', 'nouveau', 'asahi', 'all'], + 'microsoft-experimental', 'nouveau', 'asahi', + 'gfxstream-experimental', 'all'], description : 'List of vulkan drivers to build. If this is set to auto ' + 'all drivers applicable to the target OS/architecture ' + 'will be built' diff --git a/src/gfxstream/guest/meson.build b/src/gfxstream/guest/meson.build new file mode 100644 index 00000000000..17e92532660 --- /dev/null +++ b/src/gfxstream/guest/meson.build @@ -0,0 +1,61 @@ +# Copyright 2022 Android Open Source Project +# SPDX-License-Identifier: MIT + +#===============# +# Options # +#===============# + +with_vulkan_icd_dir = get_option('vulkan-icd-dir') +if with_vulkan_icd_dir == '' + with_vulkan_icd_dir = join_paths(get_option('datadir'), 'vulkan/icd.d') +endif + +#===============# +# Configuration # +#===============# +gfxstream_guest_args = [] + +# Our internal guest build +gfxstream_guest_args += '-DLINUX_GUEST_BUILD' +# Include the gfxstream private VkStructureType definitions +gfxstream_guest_args += '-DVK_GFXSTREAM_STRUCTURE_TYPE_EXT' + +#===============# +# Dependencies # +#===============# + +dl_dep = cc.find_library('dl', required: false) +drm_dep = dependency('libdrm') +thread_dep = dependency('threads') +aemu_base_dep = dependency('aemu_base') + +with_kumquat = false +virtgpu_kumquat_dep = dependency('virtgpu_kumquat_ffi', required: false) +if virtgpu_kumquat_dep.found() + with_kumquat = true +endif + +#===============# +# Includes # +#===============# + +inc_include_mesa = include_directories('../../../include') +inc_vulkan_headers = include_directories('../../../include/vulkan') +inc_vulkan_enc = include_directories('vulkan_enc') + +#================# +# Mesa compat # +#================# +# dep_libdrm = drm_dep +# dep_dl = dl_dep +# dep_thread = thread_dep + +#================# +# Subdirectories # +#================# +subdir('iostream') +subdir('platform') +subdir('GoldfishAddressSpace') +subdir('connection-manager') +subdir('vulkan_enc') +subdir('vulkan') diff --git a/src/gfxstream/guest/vulkan_enc/meson.build b/src/gfxstream/guest/vulkan_enc/meson.build index 107f1b6cba3..d1c9557542f 100644 --- a/src/gfxstream/guest/vulkan_enc/meson.build +++ b/src/gfxstream/guest/vulkan_enc/meson.build @@ -25,7 +25,7 @@ gfxstream_guest_vk_autogen = custom_target( ], env: {'GFXSTREAM_NO_CLANG_FMT': '1', 'CEREAL_VARIANT' : 'guest', 'GFXSTREAM_GUEST_ENCODER_DIR': guest_enc_path}, - input: [genvk, vk_xml_gfxstream, vk_gfxstream_xml], + input: [genvk, vk_api_xml, vk_gfxstream_xml], command: [prog_python, '@INPUT0@', '-registry', '@INPUT1@', '-registryGfxstream', '@INPUT2@', 'cereal', '-o', output_host_path], ) diff --git a/src/gfxstream/meson.build b/src/gfxstream/meson.build new file mode 100644 index 00000000000..9d42ffbf0dc --- /dev/null +++ b/src/gfxstream/meson.build @@ -0,0 +1,7 @@ +# Copyright © 2024 Google +# SPDX-License-Identifier: MIT + +genvk = files('codegen/scripts/genvk.py') +vk_gfxstream_xml = files('codegen/xml/vk_gfxstream.xml') + +subdir('guest') diff --git a/src/meson.build b/src/meson.build index e1fbada2479..aafaeaf0030 100644 --- a/src/meson.build +++ b/src/meson.build @@ -99,6 +99,9 @@ endif if with_any_nouveau subdir('nouveau') endif +if with_gfxstream_vk + subdir('gfxstream') +endif if with_gallium_asahi or with_tools.contains('asahi') subdir('asahi') endif