From c95f4dcc9318e8657ba3ff5417fecc8f6da390a6 Mon Sep 17 00:00:00 2001 From: Gurchetan Singh Date: Wed, 24 Jan 2024 10:12:41 -0800 Subject: [PATCH] gfxstream: build time guest autogeneration By popular demand: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246#note_2565866 Only Soong/meson builds supported at the moment. Bazel or BUILD.gn can be added later. This reduces the size of checked-in code by ~94 kLOC. Reviewed-by: Aaron Ruby Acked-by: Yonggang Luo Acked-by: Adam Jackson Part-of: --- src/gfxstream/guest/vulkan/meson.build | 3 +- src/gfxstream/guest/vulkan_enc/meson.build | 51 +++++++++++++++++----- 2 files changed, 42 insertions(+), 12 deletions(-) diff --git a/src/gfxstream/guest/vulkan/meson.build b/src/gfxstream/guest/vulkan/meson.build index 88a681d4f8c..0c206dbf175 100644 --- a/src/gfxstream/guest/vulkan/meson.build +++ b/src/gfxstream/guest/vulkan/meson.build @@ -20,7 +20,8 @@ endif lib_vulkan_gfxstream = shared_library( 'vulkan_gfxstream', - files_lib_vulkan_gfxstream + files_lib_vulkan_enc + gfxstream_vk_entrypoints, + files_lib_vulkan_gfxstream + files_lib_vulkan_enc + gfxstream_vk_entrypoints + + gfxstream_guest_vk_autogen + vulkan_gfxstream_h, cpp_args: gfxstream_guest_args + gfxstream_vk_wsi_args, include_directories: [inc_vulkan_headers, inc_guest_iostream, inc_vulkan_enc, inc_platform_virtgpu, diff --git a/src/gfxstream/guest/vulkan_enc/meson.build b/src/gfxstream/guest/vulkan_enc/meson.build index 60c944bdec1..107f1b6cba3 100644 --- a/src/gfxstream/guest/vulkan_enc/meson.build +++ b/src/gfxstream/guest/vulkan_enc/meson.build @@ -1,6 +1,46 @@ # Copyright 2022 Android Open Source Project # SPDX-License-Identifier: MIT +output_host_path = meson.current_build_dir() + '/host/vulkan/cereal' +guest_enc_path = meson.current_build_dir() + +gfxstream_guest_vk_autogen = custom_target( + 'gfxstream_guest_vk_autogen', + output : [ + 'VkEncoder.h', + 'goldfish_vk_counting_guest.h', + 'goldfish_vk_deepcopy_guest.h', + 'goldfish_vk_marshaling_guest.h', + 'goldfish_vk_extension_structs_guest.h', + 'goldfish_vk_reserved_marshaling_guest.h', + 'goldfish_vk_transform_guest.h', + 'goldfish_vk_counting_guest.cpp', + 'goldfish_vk_deepcopy_guest.cpp', + 'goldfish_vk_extension_structs_guest.cpp', + 'goldfish_vk_marshaling_guest.cpp', + 'goldfish_vk_reserved_marshaling_guest.cpp', + 'goldfish_vk_transform_guest.cpp', + 'VkEncoder.cpp', + 'func_table.cpp', + ], + env: {'GFXSTREAM_NO_CLANG_FMT': '1', 'CEREAL_VARIANT' : 'guest', + 'GFXSTREAM_GUEST_ENCODER_DIR': guest_enc_path}, + input: [genvk, vk_xml_gfxstream, vk_gfxstream_xml], + command: [prog_python, '@INPUT0@', '-registry', '@INPUT1@', '-registryGfxstream', '@INPUT2@', + 'cereal', '-o', output_host_path], +) + +vulkan_gfxstream_h = custom_target( + 'vulkan_gfxstream_header', + output : [ + 'vulkan_gfxstream.h', + ], + env: {'GFXSTREAM_NO_CLANG_FMT': '1', 'CEREAL_VARIANT' : 'guest'}, + input: [genvk, vk_gfxstream_xml], + command: [prog_python, '@INPUT0@', '-registry', '@INPUT1@', 'vulkan_gfxstream.h', + '-o', guest_enc_path], +) + gfxstream_vk_entrypoints = custom_target( 'gfxstream_vk_entrypoints', input : [vk_entrypoints_gen, vk_api_xml], @@ -19,19 +59,8 @@ files_lib_vulkan_enc = files( 'ResourceTracker.cpp', 'Resources.cpp', 'Validation.cpp', - 'VkEncoder.cpp', 'VulkanHandleMapping.cpp', 'VulkanStreamGuest.cpp', - 'func_table.cpp', - 'goldfish_vk_counting_guest.cpp', - 'goldfish_vk_counting_guest.h', - 'goldfish_vk_deepcopy_guest.cpp', - 'goldfish_vk_extension_structs_guest.cpp', - 'goldfish_vk_marshaling_guest.cpp', - 'goldfish_vk_reserved_marshaling_guest.cpp', - 'goldfish_vk_transform_guest.cpp', - 'gfxstream_vk_private.cpp', - 'gfxstream_vk_private.cpp', 'gfxstream_vk_private.cpp', 'GfxStreamVulkanConnection.cpp', )