Commit graph

497 commits

Author SHA1 Message Date
Dmitry Baryshkov
4315c28739 gfxstream: don't dump genvk.py args to generated files
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Full command lines include full path to the output file, which triggers
reproducibility warnings (e.g. in Yocto builds). Drop the args and print
only a basename of the script used to generate the file.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38875>
2025-12-18 18:52:19 +00:00
Yonggang Luo
be4ad5c819 meson: Remove VK_ICD_FILENAMES totally from source tree.
This is a follow up of
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28516

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@google.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com> hk changes
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> for RADV changes
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38637>
2025-12-10 14:46:11 +00:00
Gurchetan Singh
4f45e834ae gfxstream: fix logspam in TLS helper function
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Logspam has been reported in a gfxstream initialization
path.

Fixes: 4a30c6fd70 ("gfxstream: Use the Mesa common tss_* TLS helper functions")
Cc: mesa-stable

Reviewed-by: David Gilhooley <djgilhooley.gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38776>
2025-12-03 09:12:21 -08:00
Gurchetan Singh
15983e6d0d gfxstream: more fixes for missing prototypes
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Fixes things like:

GfxStreamVulkanMapper.cpp:45:10:
error: no previous prototype for function 'chooseGfxQueueFamily'[-Werror,-Wmissing-prototypes]

Reviewed-by: David Gilhooley <djgilhooley.gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38751>
2025-12-01 14:07:18 -08:00
Yonggang Luo
168042fb05 gfxstream: os_set_option can be used on windows now
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@google.com>
Reviewed-by: Antonio Ospite <antonio.ospite@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38640>
2025-11-27 18:22:34 +00:00
Yonggang Luo
0a32d5e6fd treewide: Use regexp to replace usage of setenv with os_set_option.
setenv\((.*), 1\);
=>
os_set_option($1, true);

setenv\((.*), 0\);
=>
os_set_option($1, false);

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Antonio Ospite <antonio.ospite@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38640>
2025-11-27 18:22:34 +00:00
Yonggang Luo
1825715623 treewide: Use regexp to replace usage of unsetenv with os_unset_option.
unsetenv\((.*)\);
=>
os_unset_option($1);

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Antonio Ospite <antonio.ospite@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38640>
2025-11-27 18:22:33 +00:00
Yonggang Luo
6356efc4e0 gfxstream: Use os_get_option_dup(VK_DRIVER_FILES)
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
As the return value os_get_option should be immediately consumed.

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38687>
2025-11-27 10:20:52 +08:00
Yonggang Luo
d668c0ad42 gfxstream: Use VK_DRIVER_FILES instead of VK_ICD_FILENAMES as VK_ICD_FILENAMES is deprecated for a while.
This is a prepare for remove VK_ICD_FILENAMES in source tree.

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38687>
2025-11-27 10:20:48 +08:00
Gurchetan Singh
4f9d7c3385 gfxstream: codegen: don't generate custom protocols in function table
vulkan_gfxstream.h contains custom protocols not found
in vk.xml (vk_gfxstream.xml).

gfxstream_vk_entrypoints.h is codegen by Mesa common code,
and it does not accept the custom XML.

So avoid generating implementations for them:

guest/vulkan_enc/gfxstream_guest_vk_autogen_impl/gen/func_table.cpp:5321:1:
note: declare 'static' if the function is not intended to be
      used outside of this translation unit
 5321 | void gfxstream_vk_CollectDescriptorPoolIdsGOOGLE(
      | ^
      | static
fatal error: too many errors emitted, stopping now [-ferror-limit=]

Reviewed-by: David Gilhooley <djgilhooley.gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38632>
2025-11-25 09:12:15 -08:00
Gurchetan Singh
169f571f4f gfxstream: delete createImmutableSamplersFilteredImageInfo
This function is not used.

Reviewed-by: David Gilhooley <djgilhooley.gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38632>
2025-11-25 09:12:10 -08:00
Gurchetan Singh
b6df034363 gfxstream: make functions static when needed
Fixes errors like:

ResourceTracker.cpp:62:6: error: no previous prototype for function 'zx_handle_close'
                          [-Werror,-Wmissing-prototypes]

Reviewed-by: David Gilhooley <djgilhooley.gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38632>
2025-11-25 09:12:06 -08:00
Gurchetan Singh
0a231dfb40 gfxstream: silence non-null Clang check on Android
Workaround:

src/gfxstream/guest/connection-manager/GfxStreamConnectionManager.cpp:82:51:
error: null passed to a callee that requires a non-null argument [-Werror,-Wnonnull]
   82 |     tss_set(gfxstream_connection_manager_tls_key, nullptr);
      |                                                   ^~~~~~~

Ultimately, the Bionic headers look wrong.  Passing NULL to tss_set
is completely legit.

Reviewed-by: David Gilhooley <djgilhooley.gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38632>
2025-11-25 09:11:35 -08:00
Simon McVittie
b860ae309a vulkan: Optionally share one JSON manifest per driver between architectures
If the library_path is just a basename like `libvulkan_lvp.so`, then we
can share the same JSON manifest like `lvp_icd.json` between all of the
architectures, like we already do for Vulkan layers. The library will
be looked up in the dynamic linker's default search path in this case,
and in practice will be found in `${libdir}`. This is how the Mesa's
EGL driver and Vulkan layers work, how Mesa is packaged in Debian 13,
and also how the Nvidia proprietary driver works; it makes installation
simpler for distros, especially on multiarch systems like Debian and
the freedesktop.org SDK.

However, if we want a separate manifest per architecture in order to
be able to write the full path into it, we still need per-architecture
filename disambiguation like `lvp_icd.x86_64.json`.

We presumably still want a separate per architecture on Windows, because
the concept of a single monolithic `${libdir}` is less common there, and
it can also be helpful during development when setting `$VK_DRIVER_FILES`
to force the use of a specific driver installed in a non-default location.

Use the following parameter to passed to vk_icd_gen:
'--icd-lib-path', vulkan_icd_lib_path,
'--icd-filename', icd_file_name,
output : 'virtio_icd.' + vulkan_manifest_suffix,

and the output is passed by '--out', '@OUTPUT@',
so we can detect vulkan_manifest_per_architecture from the --out parameter in script.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13745
Signed-off-by: Simon McVittie <smcv@collabora.com>
Co-authored-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37314>
2025-11-24 19:05:57 +00:00
Gurchetan Singh
62d0957a3b gfxstream: enable kumquat building on Windows
This adds several fixes so that kumquat can build.

TEST=meson setup -Dvulkan-drivers="gfxstream" -Dgallium-drivers="" \
                 -Dzlib=false -Dopengl=false -Degl=false \
                 -Dvirtgpu_kumquat=true
                 --cross-file ${CROSS_PATH}

Reviewed-by: David Gilhooley <djgilhooley.gmail.com>
2025-11-24 06:59:22 -08:00
Gurchetan Singh
3a16b69337 gfxstream: WindowsVirtGPU.h --> WindowsVirtGpu.h
Proper naming is important.  Needed for cross-compile for mingw.

Reviewed-by: David Gilhooley <djgilhooley.gmail.com>
2025-11-24 06:56:07 -08:00
Gurchetan Singh
5826a0aad9 gfxstream: meson format -i {all meson files}
More readable, allows meson format to be used in the future.

Acked-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38388>
2025-11-12 16:05:12 +00:00
Vinson Lee
1889f1a779 gfxstream: Fix GfxStreamVulkanMapper.cpp build error
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
../src/gfxstream/guest/platform/kumquat/vulkan-mapper/GfxStreamVulkanMapper.cpp: In static member function ‘static GfxStreamVulkanMapper* GfxStreamVulkanMapper::getInstance(std::optional<DeviceId>)’:
../src/gfxstream/guest/platform/kumquat/vulkan-mapper/GfxStreamVulkanMapper.cpp:208:30: error: ‘os_get_option’ was not declared in this scope
  208 |         const char* driver = os_get_option(VK_ICD_FILENAMES);
      |

Fixes: 222b85328e ("mesa: replace most occurrences of getenv() with os_get_option()")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38331>
2025-11-09 03:10:37 +00:00
Antonio Ospite
222b85328e mesa: replace most occurrences of getenv() with os_get_option()
The standard way to query options in mesa is `os_get_option()` which
abstracts platform-specific mechanisms to get config variables.

However in quite a few places `getenv()` is still used and this may
preclude controlling some options on some systems.

For instance it is not generally possible to use `MESA_DEBUG` on
Android.

So replace most `getenv()` occurrences with  `os_get_option()` to
support configuration options more consistently across different
platforms.

Do the same with `secure_getenv()` replacing it with
`os_get_option_secure()`.

The bulk of the proposed changes are mechanically performed by the
following script:

-----------------------------------------------------------------------
  #!/bin/sh

  set -e

  replace() {

    # Don't replace in some files, for example where `os_get_option` is defined,
    # or in external files
    EXCLUDE_FILES_PATTERN='(src/util/os_misc.c|src/util/u_debug.h|src/gtest/include/gtest/internal/gtest-port.h)'

    # Don't replace some "system" variables
    EXCLUDE_VARS_PATTERN='("XDG|"DISPLAY|"HOME|"TMPDIR|"POSIXLY_CORRECT)'

    git grep "[=!( ]$1(" -- src/ | cut -d ':' -f 1 | sort | uniq | \
      grep -v -E "$EXCLUDE_FILES_PATTERN" | \
      while read -r file;
      do
        # Don't replace usages of XDG_* variables or HOME
        sed -E -e "/$EXCLUDE_VARS_PATTERN/!s/([=!\( ])$1\(/\1$2\(/g" -i "$file";
      done
  }

  # Add const to os_get_option results, to avoid warning about discarded qualifier:
  #   warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  # but also errors in some cases:
  #   error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
  add_const_results() {
    git grep -l -P '(?<!const )char.*os_get_option' | \
      while read -r file;
      do
        sed -e '/^\s*const/! s/\(char.*os_get_option\)/const \1/g' -i "$file"
      done
  }

  replace 'secure_getenv' 'os_get_option_secure'

  replace 'getenv' 'os_get_option'

  add_const_results
-----------------------------------------------------------------------

After this, the `#include "util/os_misc.h"` is also added in files where
`os_get_option()` was not used before.

And since the replacements from the script above generated some new
`-Wdiscarded-qualifiers` warnings, those have been addressed as well,
generally by declaring `os_get_option()` results as `const char *` and
adjusting some function declarations.

Finally some replacements caused new errors like:

-----------------------------------------------------------------------
../src/gallium/auxiliary/gallivm/lp_bld_misc.cpp:127:31: error: no matching function for call to 'strtok'
  127 |          for (n = 0, option = strtok(env_llc_options, " "); option; n++, option = strtok(NULL, " ")) {
      |                               ^~~~~~
/android-ndk-r27c/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/string.h:124:17: note: candidate function not viable: 1st argument ('const char *') would lose const qualifier
  124 | char* _Nullable strtok(char* _Nullable __s, const char* _Nonnull __delimiter);
      |                 ^      ~~~~~~~~~~~~~~~~~~~
-----------------------------------------------------------------------

Those have been addressed too, copying the const string returned by
`os_get_option()` so that it could be modified.

In particular, the error above has been fixed  by copying the `const
char *env_llc_options` variable in
`src/gallium/auxiliary/gallivm/lp_bld_misc.cpp` to a `char *` which can
be tokenized using `strtok()`.

Reviewed-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38128>
2025-11-06 04:36:13 +00:00
Serdar Kocdemir
7bc14977a8 gfxstream: Check host allocation mode for external memory
New host feature allows usage of external_memory_host extension
for external memory support, mainly for software renderers which
don't implement platform specific extensions.

Also moves enablement of queue_family_foreign outside of android,
to allow it also on linux guests (ref: github PR#74), and removes
the check for VK_MVK_moltenvk extension in favor of metal mode.

Test: -gpu lavapipe -feature VulkanNativeSwapchain on windows

Reviewed-by: David Gilhooley <djgilhooley.gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38153>
2025-10-30 15:27:26 +00:00
Jason Macnak
deb48556dc gfxstream: codegen changes for new filenames and namespaces
Bug: n/a
Test: build + CI

Reviewed-by: David Gilhooley <djgilhooley.gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38153>
2025-10-30 15:27:26 +00:00
Gurchetan Singh
a85e9b8d8a gfxstream: fix build after VK 1.4.33.0 spec update
The root cause is "Add initial Vulkan Base support", which refactors
Vulkan versions into smaller features (base + graphics + compute).
Not sure if this is the cleanest solution, but someone needs to
refactor gfxstream codegen anyways.

There's also can issue with VkRenderingArea.

Fixes: 61c71733c8 ("vulkan: update spec to 1.4.330")
TEST=libgfxstream_vulkan.so + gfxstream_backend.so (host) commpiles
     with new changes

Reviewed-by: David Gilhooley <djgilhooley.gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38153>
2025-10-30 15:27:26 +00:00
Eric Engestrom
4ab65cdaa4 docs: update/fix vk spec urls
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37993>
2025-10-22 09:23:34 +02:00
Gurchetan Singh
cd06ec1dcb gfxstream: codegen: remove CheckOutOfMemory
Nobody uses it.

Reviewed-by: David Gilhooley <djgilhooley.gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37855>
2025-10-20 15:45:07 +00:00
Gurchetan Singh
af6ff36379 gfxstream: codegen: add vkTraceAsyncGOOGLE to GLOBAL_COMMANDS_WITHOUT_DISPATCH
Otherwise the codegen output fails to compile.

Reviewed-by: David Gilhooley <djgilhooley.gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37855>
2025-10-20 15:45:07 +00:00
Jason Macnak
14e01b1eea gfxstream: Handle BGRA in Gfxstream AHB format conversions
Test: cvd create --gpu_mode=gfxstream_guest_angle_host_swiftshader

Reviewed-by: David Gilhooley <djgilhooley.gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37855>
2025-10-20 15:45:06 +00:00
Gurchetan Singh
37a2a5c552 gfxstream: kumquat: opaque fd or dmabuf, not both
So Mesa drivers actually don't like both:

src/vulkan/runtime/vk_device_memory.c:

"""
 case VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR: {
   const VkImportMemoryFdInfoKHR *fd_info = (void *)ext;
     if (fd_info->handleType) {
       assert(fd_info->handleType == VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT ||
              fd_info->handleType == VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT);
"""

Reviewed-by: David Gilhooley <djgilhooley.gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37855>
2025-10-20 15:45:06 +00:00
Gurchetan Singh
05cd676287 gfxstream: delete magma-over-gfxstream
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
This was always meant to a be transitional approach.

Reviewed-by: Aaron Ruby <aruby@qnx.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37728>
2025-10-08 15:42:13 +00:00
Vinson Lee
77f6753d68 gfxstream: Fix build error
../src/gfxstream/guest/vulkan_enc/ResourceTracker.cpp:40:10: fatal error: perfetto/tracing.h: No such file or directory
   40 | #include <perfetto/tracing.h>
      |          ^~~~~~~~~~~~~~~~~~~~

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13939
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37699>
2025-10-08 05:38:19 +00:00
Simon McVittie
9d36bf891b vulkan: Compute path to write into JSON manifests once, use it everywhere
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
This reduces duplication: we only need to distinguish between Windows
and Unix in one place.

The previous code was inconsistent about using either the `platforms`
option, or the `host_machine`. Following the logic described in
commit 94379377 "lavapipe: build "Windows" check should use the host machine, not the `platforms` option.",
I've assumed that checking the host machine is the more-correct version
and used that.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37576>
2025-09-26 10:47:31 +00:00
Simon McVittie
be8cac52d3 vulkan: Consistently form driver library names as prefix + name + suffix
This consistently uses `NAME.dll` on Windows, `libNAME.dylib` on Darwin
derivatives such as macOS, and `libNAME.so` on Linux, *BSD and so on.
It's also consistent about using the local variable name `icd_file_name`
for this name in every Vulkan driver, which was already the case in many
but not all drivers.

Some of these drivers probably don't make sense (or don't work) on
Windows and/or macOS, but if this is kept consistent for all drivers,
it should avoid the need for driver-specific commits like
commit 611e9f29e "lavapipe: fix icd generation for windows",
commit 951f3287 "lavapipe: set empty dll prefix",
commit 13e7a39f "lavapipe: fixes for macOS support",
commit 7008e655 "radv: Update JSON generator if Windows" and so on,
each time a driver is found to be relevant on more platforms than
previously believed.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37576>
2025-09-26 10:47:31 +00:00
Eric Engestrom
618038860d gfxstream/meson: generate git_sha1.h before compiling ResourceTracker.cpp
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37544>
2025-09-24 10:23:18 +00:00
Gurchetan Singh
943ac08280 gfxstream: determine page size based on guest properties too
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
blobAlignment helps with running a 4KB guest on a 16KB host.
But for 16KB guest on 4KB host, we'll need to check guest
size too.  os_get_page_size(..) might not work on all target
guest OSes now, so default to 4KB.

TEST=CF 16KB works

Reviewed-by: David Gilhooley <djgilhooley.gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37460>
2025-09-22 16:21:44 +00:00
Jason Macnak
03a4d7ff7e gfxstream: Address some Werror errors from ag/35389434
Fix things.

Test: github CI

Reviewed-by: Aaron Ruby <aruby@qnx.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37410>
2025-09-16 23:26:27 +00:00
Serdar Kocdemir
f1c1dc66d4 gfxstream: Enable VK_MVK_macos_surface for host dispatch
To be used in Vulkan composition on macOS.

Test: -feature GuestAngle, VulkanNativeSwapchain

Reviewed-by: Aaron Ruby <aruby@qnx.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37410>
2025-09-16 23:26:27 +00:00
Jason Macnak
2e56f34952 gfxstream: hide vkTraceAsyncGOOGLE behind new capset flag
... to make it forward compatible / to make it not crash older
Gfxstream host builds.

Test: Capture guest and host trace and inspect in perfetto UI

Reviewed-by: Aaron Ruby <aruby@qnx.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37410>
2025-09-16 23:26:27 +00:00
Jason Macnak
46bfb31d7f gfxstream: add a vkTraceAsyncGOOGLE
... to allow sharing perfetto global flow ids between guest and host
so that combined traces can have an arrow between the guest and host
render threads to aid debugging.

Test: Capture guest and host trace and inspect in perfetto UI

Reviewed-by: Aaron Ruby <aruby@qnx.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37410>
2025-09-16 23:26:27 +00:00
Aaron Ruby
39a5e80a7a gfxstream: address-space graphics requires kParamResourceBlob and kParamHostVisible
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Make init failure more clear if this is not the case.

Reviewed-by: Gurchetan Singh <gurchetansingh@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37285>
2025-09-12 18:38:21 +00:00
Alyssa Ross
6f8cdd8a3c gfxstream: guest: don't use transitional LFS64 API
musl removed the LFS64 APIs like mmap64(), which were intended to be a
transitional measure multiple decades ago, causing a build failure
here.  Since virtio-gpu sizes and offsets are 64-bit, we do still want
to make sure that we're using 64-bit mmap here, so I've added
-D_FILE_OFFSET_BITS=64, which will ensure that off_t is always 64-bit
in gfxstream guest, and which is generally the modern solution here.

With this change, I am able to build gfxstream with musl.

Fixes: fec8e296a3 ("Make VirtGpu* interfaces")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37086>
2025-09-02 16:45:20 +00:00
Aaron Ruby
c3533e49ab gfxstream: Prune all guest-side KHR entrypoints that are provided with VK_VERSION_1_1
vk dispatch in mesa provides the redirection for this. Also, other
recent changes have increment the minimium host requirement for
gfxstream-vk to VK_VERSION_1_1, anyways.

Reviewed-by: Gurchetan Singh <gurchetansingh@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36942>
2025-08-27 16:40:44 +00:00
Gurchetan Singh
091e2f5ec5 gfxstream: ANDROID --> VK_USE_PLATFORM_ANDROID_KHR
gfxstream mostly uses VK_USE_PLATFROM_ANDROID_KHR to determine
the presence of window system extensions.

Reviewed-by: David Gilhooley <djgilhooley.gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36826>
2025-08-19 10:46:16 +00:00
sergiuferentz
651d2fd804 gfxstream: VirtGpuDevice can be null for Goldfish.
Fixes crashes.

Test: atest CtsDeqpTestCases -- --module-arg 'CtsDeqpTestCases:include-filter:dEQP-VK.image.swapchain_mutable.android.2d*'

Reviewed-by: David Gilhooley <djgilhooley.gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36826>
2025-08-19 10:46:16 +00:00
Bo Hu
4ebda87b49 gfxstream: [vulkan snapshot]: update code gen for vkUpdateDescriptorSet change
Update codegen

Reviewed-by: David Gilhooley <djgilhooley.gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36826>
2025-08-19 10:46:16 +00:00
Jeongik Cha
3e39c09aa0 gfxstream: Generate goldfish dispatch code for AHB extension
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36510>
2025-08-01 18:34:15 +00:00
Jason Macnak
72d07c16a3 gfxstream: Add gfxstream TLS connection manager reset
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
... which is still needed to keep the end2end tests happy
when one thread creates and destroys instances multiple times
(which happens in the MultiThreadedShutdown test).

Test: GfxstreamEnd2EndTests
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36471>
2025-07-30 19:41:14 +00:00
Gurchetan Singh
8d899622b6 gfxstream: correct Android API level check
The header says:

enum ADataSpace AHardwareBuffer_getDataSpace(const AHardwareBuffer* _Nonnull buffer)
        __INTRODUCED_IN(__ANDROID_API_V__);

which is API level 35.

Reviewed-by: Jason Macnak <jmacnak@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36338>
2025-07-24 20:30:45 +00:00
Aaron Ruby
49ec8bc982 gfxstream: Add init+tracking for the host-equivalent queue_family
information

This information (otherwise invisible to the guest) may be used in the
future in some other guest-only functionality

Reviewed-by: Gurchetan Singh <gurchetansingh@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36330>
2025-07-24 15:58:30 +00:00
Aaron Ruby
89ccc8ba2b gfxstream: Pre-fetch the VkQueue objects from the host
.. and refactor vk_queue initialization entirely to store the queue
information at device-creation time.

Reviewed-by: Gurchetan Singh <gurchetansingh@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36330>
2025-07-24 15:58:30 +00:00
Aaron Ruby
b1f6b76f85 gfxstream: Remove on_vkGetDeviceQueue* impls entirely
The VkQueue_info::device field is not actually needed anywhere.

Reviewed-by: Gurchetan Singh <gurchetansingh@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36330>
2025-07-24 15:58:30 +00:00
Aaron Ruby
4a30c6fd70 gfxstream: Use the Mesa common tss_* TLS helper functions
... in GfxstreamConnectionManager, to acquire the threadLocalInstance
of the connectionManager. Using thread_local attribute storage to store
some CPP primitives (i.e. unique_ptr) can cause issues on some
platforms.

Better to do all TLS as explicit as possible, using the available
utilities from common src/util. Don't need to wrap it in
a std::unique_ptr either, as the instance is just managed by the
destructor in the TLS interface.

Reviewed-by: Gurchetan Singh <gurchetansingh@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36302>
2025-07-24 15:44:42 +00:00