mesa: add option to enable virtgpu_kumquat FFI for gfxstream

Will be used by Cuttlefish CI/CD, but also commonly used by
gfxstream developers.

meson setup gfxstream-build -Dvulkan-drivers="gfxstream" -Dgallium-drivers="" -Dvirtgpu_kumquat=true -Dopengl=false -Drust_std=2021

In distros, virtgpu_kumquat is not expected to be packaged since
it is a CI/CD tool.

Reviewed-by: Aaron Ruby <aruby@qnx.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35210>
This commit is contained in:
Gurchetan Singh 2024-12-16 13:09:54 -08:00 committed by Marge Bot
parent f2b07903ab
commit f7a9991b89
6 changed files with 19 additions and 20 deletions

View file

@ -736,7 +736,8 @@ if with_gallium_rusticl
endif endif
endif endif
if with_gallium_rusticl or with_nouveau_vk or with_tools.contains('etnaviv') with_virtgpu_kumquat = get_option('virtgpu_kumquat') and with_gfxstream_vk
if with_gallium_rusticl or with_nouveau_vk or with_tools.contains('etnaviv') or with_virtgpu_kumquat
# rust.bindgen() does not pass `--rust-target` to bindgen until 1.7.0. # rust.bindgen() does not pass `--rust-target` to bindgen until 1.7.0.
if meson.version().version_compare('< 1.7.0') if meson.version().version_compare('< 1.7.0')
error('Mesa Rust support requires Meson 1.7.0 or newer') error('Mesa Rust support requires Meson 1.7.0 or newer')

View file

@ -840,3 +840,10 @@ option(
], ],
description : 'Allows the fallback mechanism if the dependency is not available on the system, or too old.' description : 'Allows the fallback mechanism if the dependency is not available on the system, or too old.'
) )
option(
'virtgpu_kumquat',
type : 'boolean',
value : false,
description : 'Build virtgpu_kumquat (only useful with gfxstream currently)'
)

View file

@ -24,16 +24,6 @@ endif
# Include the gfxstream private VkStructureType definitions # Include the gfxstream private VkStructureType definitions
gfxstream_guest_args += '-DVK_GFXSTREAM_STRUCTURE_TYPE_EXT' gfxstream_guest_args += '-DVK_GFXSTREAM_STRUCTURE_TYPE_EXT'
#===============#
# Dependencies #
#===============#
with_kumquat = false
virtgpu_kumquat_dep = dependency('virtgpu_kumquat_ffi', required: false)
if virtgpu_kumquat_dep.found()
with_kumquat = true
endif
#===============# #===============#
# Includes # # Includes #
#===============# #===============#

View file

@ -8,12 +8,7 @@
#include "GfxStreamVulkanMapper.h" #include "GfxStreamVulkanMapper.h"
#include "VirtGpu.h" #include "VirtGpu.h"
// Blueprint and Meson builds place things differently
#if defined(ANDROID)
#include "virtgpu_kumquat_ffi.h" #include "virtgpu_kumquat_ffi.h"
#else
#include "virtgpu_kumquat/virtgpu_kumquat_ffi.h"
#endif
class VirtGpuKumquatResource : public std::enable_shared_from_this<VirtGpuKumquatResource>, class VirtGpuKumquatResource : public std::enable_shared_from_this<VirtGpuKumquatResource>,
public VirtGpuResource { public VirtGpuResource {

View file

@ -1,7 +1,7 @@
# Copyright 2022 Android Open Source Project # Copyright 2022 Android Open Source Project
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
if with_kumquat if with_virtgpu_kumquat
files_libplatform_virtgpu_kumquat = files( files_libplatform_virtgpu_kumquat = files(
'VirtGpuKumquatDevice.cpp', 'VirtGpuKumquatDevice.cpp',
'VirtGpuKumquatBlobMapping.cpp', 'VirtGpuKumquatBlobMapping.cpp',
@ -17,7 +17,7 @@ libplatform_virtgpu_kumquat = static_library(
files_libplatform_virtgpu_kumquat, files_libplatform_virtgpu_kumquat,
cpp_args: gfxstream_guest_args, cpp_args: gfxstream_guest_args,
include_directories: [inc_platform_virtgpu, inc_src, inc_gfxstream_vulkan_mapper, include_directories: [inc_platform_virtgpu, inc_src, inc_gfxstream_vulkan_mapper,
inc_vulkan_util, inc_include], inc_vulkan_util, inc_include, inc_virtgpu_kumquat_ffi],
link_with: [libgfxstream_vulkan_mapper], link_with: [libgfxstream_vulkan_mapper, libvirtgpu_kumquat_ffi],
dependencies: [idep_vulkan_util_headers, virtgpu_kumquat_dep], dependencies: [idep_vulkan_util_headers],
) )

View file

@ -100,6 +100,12 @@ if with_any_nouveau
subdir('nouveau') subdir('nouveau')
endif endif
if with_gfxstream_vk if with_gfxstream_vk
if with_virtgpu_kumquat
subdir('util/rust')
subdir('virtio/protocols')
subdir('virtio/virtgpu_kumquat')
subdir('virtio/virtgpu_kumquat_ffi')
endif
subdir('gfxstream') subdir('gfxstream')
endif endif
if with_gallium_asahi or with_asahi_vk or with_tools.contains('asahi') if with_gallium_asahi or with_asahi_vk or with_tools.contains('asahi')