Commit Graph

195289 Commits

Author SHA1 Message Date
Gurchetan Singh
e13526ca2b gfxstream: nuke ErrorLog.h
Another day, another code nuke.  ALOGE(..) or mesa_loge(..)
is better.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:03 +00:00
Gurchetan Singh
05dac426a7 gfxstream: simplify GLESv1/GLESv2/EGL/Vulkan builds
Certain libraries (libEGL_emulation, GLESv1/GLESv2, and
vulkan.ranchu) have duplicated variants due to two issues:

- whether to use the Kumquat and Linux VirtGpu backends
  is a build time decision.  This leads to "libplatform" and
  "libplatform_kumquat".

- virtgpu_kumquat_ffi pulls in librutabaga_gfx_gfxstream,
  which pulls in libgfxstream_backend -- which does not compile
  for glibc_x86 or android32.  This means "compile_multilib: 64"
  is needed for glibc_x86_64 and android64 builds.  The
  non-kumquat dependent Android build actually needs 32-bit
  libraries, while the kumquat dependent Android built does not.
  This leads to different libraries.

The follow changes are made:

- Kumquat and Linux backends are both built for
  host-builds.  An environment variable controls
  selection ("VIRTGPU_KUMQUAT").

- For Android builds, a stub Kumquat is built.  We can
  build a real Kumquat, but the use case does not exist.

These changes allow for a much simpler build.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:03 +00:00
Jason Macnak
089c5162b8 Fix vkAllocateCommandBuffers with failing allocation
Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Gurchetan Singh
8dbe8e0b1e gfxstream: end2end: nuke RutabagaLayer, use kumquat for testing
This change nukes the RutabagaLayer and makes the
end2end testing layer use Kumquat.

The benefit is not having two different testing
frameworks.  Compared to the RutabagaLayer, Kumquat
is more complex, but potentially has more features
in the long run.  Some advanatages:

  - virtgpu_kumquat_ffi is portable enough that
    non-gfxstream libraries (minigbm, others) can
    depend on it.  This would enable more accurate
    gralloc testing long-term.

  - multiple different context types can connect to
    Kumquat at the same time, rather than just one with
    the RutabagaLayer.

  - If anyone is bored, it should be pretty easy add
    v4l2 apis via an virtio-media like interface.

  - The kumquat server can actually call
    stream_renderer_teardown(..) when performing
    snapshot tests.

  - Kumquat relies on EventFd + VkExternalSync:
    this can eliminate the need to export the
    libplatform sync API outside VK, EGL over the
    long-term.

A point of complexity was Gralloc.  We have an external
Gralloc instance, but HostConnection also maintains a
thread-local Gralloc instances.  The thread-local gralloc
instances can potentially step on the kumquat connection
of the pipe or ASG stream.  The solution was for
GrallocEmulated to maintain it's own virtgpu_kumquat
instance.

The proper long-term solution is move gralloc out of
HostConnection entirely.

A prior version of this change relied on:

   - vkInitializeKumquat,
   - rcCreateDeviceKumquat
   - eglInitializeKumquat

since I read somewhere GoogleTest is necessarily
multi-threaded. That turned out to be fake news, so nuke
those functions as well.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Jason Macnak
3683fbcdee Handle null handles in vkFreeCommandBuffers
Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Gurchetan Singh
e64534bd64 gfxstream: guest: plumb the descriptor everywhere
This change does two things:
    - Makes sure the descriptor is passed through to
      EmulatedGralloc, where it makes a difference

    - Makes sure descriptor is always used when creating
      a VirtioGpuPipeStream.  The VirtioGpuPipeStream
      API where the descriptor is not passed in has
      been nuked.

GLES, VK, Gralloc, and RenderControl can all pass in
a descriptor via their APIs with this change.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Marcin Radomski
132ed7b81c Add mesa3d_platforms Soong config flag
It can be set to "none" to enable a "linux-like" build of gfxstream
guest code with Soong, providing support for DMA-BUF import extensions.

With the flag turned on, Android window system integration is disabled.

Tested with:

Comment out "FINISHME: support
VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT" check on vk_glow

Run vk_glow on a lunch target with the entire CL chain, and the
mesa3d_platforms Soong flag set to "none", see output

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Marcin Radomski
ebee8b8279 vkCreateInfo: support VkImageDrmFormatModifierListCreateInfoEXT
If the host supports it, forward. Otherwise, emulate
DRM_FORMAT_MOD_LINEAR if requested.

Tested by running vkcube-wayland against kumquat
(https://crosvm.dev/book/appendix/rutabaga_gfx.html#kumquat-media-server), on:
- Intel(R) UHD Graphics (CML GT2)
- AMD Radeon Pro W6400 (RADV NAVI24)

cd $(crosvm_dir)/rutabaga_gfx/kumquat/server/ && ./target/debug/kumquat

export MESA_LOADER_DRIVER_OVERRIDE=zink
export VK_ICD_FILENAMES=$(gfxstream_dir)/guest-build/guest/vulkan/gfxstream_vk_devenv_icd.x86_64.json
vkcube-wayland

Result: https://screenshot.googleplex.com/7X5DNPPou5XtWet

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Marcin Radomski
e137086383 vkGetPhysicalDeviceImageFormatProperties2: support drm modifiers
Passed via VkDrmFormatModifierPropertiesListEXT. When not supported by
the host, emulate DRM_FORMAT_MODIFIER_LINEAR with VK_IMAGE_TILING_LINEAR.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Marcin Radomski
19cbe451ce vkAllocateMemory: support DRM format modifiers for dmabuf memory
The only aspectMask values valid for vkGetImageSubresourceLayout with
VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT are
VK_IMAGE_ASPECT_MEMORY_PLANE_i_BIT_EXT.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Marcin Radomski
8847a50a04 Enable VK_EXT_image_drm_format_modifier on Linux guests
Do not force linear tiling for WSI in vkCreateImage. Allow creating WSI
images from DMABUFs with DRM format modifiers.

If the extension is supported by host, forward
VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT to
vkGetPhysicalDeviceImageFormatProperties2 and vkCreateImage.

If it's not supported, attempt to support DRM_FORMAT_MOD_LINEAR by
mapping it to VK_TILING_LINEAR.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Marcin Radomski
048037727f Enable VK_EXT_image_drm_format_modifier in cerealgenerator.py
Add the extension to list in cerealgenerator.py, rerun
scripts/generate-gfxstream-vulkan.sh

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Marcin Radomski
d9db1fe887 Add missing includes
Fixes build errors about missing ALOG*/EINVAL.

Those showed up when building following the kumquat instructions:
https://crosvm.dev/book/appendix/rutabaga_gfx.html#kumquat-media-server

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Yahan Zhou
db6cf33439 [Vulkan Snapshot] tryLock when an API might create extra handles
We acquire the lock when createExtraHandlecsForNextApi is called. But
depending on config, vkCreateDescriptorPool may or may not call
createExtraHandlesForNextApi, which results in inconsistency of the lock
state when calling snapshot()->vkCreateDescriptorPool.

We add a tryLock so that it always acquires the lock before modifying
mReconstruction.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Jason Macnak
3fca9f7123 Handle DEPTH_STENCIL_ATTACHMENT_BIT in VK -> AHB usage
Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Gurchetan Singh
2f161c31e3 gfxstream: guest: nuke Android HealthMonitor
The HealthMonitor is hang detection at the API Vulkan
encoder level.

It's actually not used in CF/AAOS/Emualtor.  The
plan for AOSP is actually to increase the amount
of Android CTS that are run against gfxstream to
increase health/stability, for example (b/347288539).

So if we consistently pass CTS on main with gfxstream
(as is the plan), HealthMonitoring would be somewhat
redundant.

Also, AndroidHealthMonitor is somewhat duplicated with
libaemu's HealthMonitor as well.

Also, nuke EncoderAutoLock while we're at it.  It also
is unused code.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Gurchetan Singh
f42b3be1b5 gfxstream: guest: add vkInitializeKumquat
vkInitializeKumquat is a custom Vulkan API to allow
the user to specify the particular kumquat instance.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Gurchetan Singh
d41987eaae gfxstream: connect to the specificied kumquat socket
An multi-threaded test might want:

 - launch multiple kumquats
 - connect each thread to a specific instance
   of kumquat.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Gurchetan Singh
0f7101a5dc gfxstream: guest: plumb descriptor all the way through the HostConnection
A descriptor is an int32_t number.  Anything >= 0
is considered a valid descriptor.  It essentially like
a fd, but it will be used with kumquat testing.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Gurchetan Singh
6785aae717 gfxstream: nuke libplatform stub
This was added for Fuchsia support, and now we have a
dedicated Fuchsia subdir.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Gurchetan Singh
9356a87867 gfxstream: nuke set instance for testing
Not used.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Jean-Francois Thibert
669b530c83 Provided supported formats through gfxstream caps
Includes more complete support for depth formats.

Bug=b:352091996
Test=Ran CTS deqp test cases with cuttlefish

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Serdar Kocdemir
7f9783c8f5 Add error messages for unhandled extensions
Print missing structure information before calling abort.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Gurchetan Singh
eb6124d6bf gfxstream: guest: kumquat: fixes in preparation for AOSP Kumquat testing
- API for virtgpu_kumquat_init will change with
  crrev.com/c/5747430
- Better error reporting
- Use paths prefered by AOSP
- Handle emulated sync files via eventfd

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
sergiuferentz
1befa2975c Adding support for VK_EXT_external_memory_host extension
Supports querying supported memory indexes for host allocations.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Jason Macnak
9164e91ad4 Ensure mesa struct is translated to gfxstream struct on Android
... to avoid aborts due to unbox failures on the host as the
mesa layer was turned back on for Android in aosp/3066068.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Jason Macnak
a883f65ab6 Disable device groups
... by silo'ing each physical device in its own device group.
This unblocks dEQP VK testing until the mesa layer has codegen
to fully translate structs in pNext chains.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
C Stout
90c80dc90a [guest] Fix Fuchsia build
Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Gurchetan Singh
c27e611dd9 gfxstream: guest: nuke more AEMU base stuff
Things that missed the last round of deletions.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Gurchetan Singh
7da4dc42ca gfxstream: guest: use MESA_SCOPE_TRACE
- One less dependency on guest/android-emu/
- MESA_SCOPE_TRACE works on Linux guests or via Kumquat
  too, for better performance analysis

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Gurchetan Singh
a194a09444 gfxstream: guest: add support VK_FORMAT_A2R10G10B10_UNORM_PACK32 Wayland buffers
vkcube-wayland uses this format on Intel/Linux.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Gurchetan Singh
a3f888d089 gfxstream: host: don't abort when unbox fails
Unboxing fails if a NULL handle is passed in, triggering an abort.

However for vkCmdBeginTransformFeedbackEXT, this is perfectly
valid:

"For each element of pCounterBuffers that is VK_NULL_HANDLE,
transform feedback will start capturing vertex data to byte zero
in the corresponding bound transform feedback buffer."

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Gurchetan Singh
b05f3f8e12 gfxstream: guest: vk_CmdBeginTransformFeedbackEXT fix
pCounterBuffers can be NULL, which crashes on the autogen path:

"For each element of pCounterBuffers that is VK_NULL_HANDLE,
transform feedback will start capturing vertex data to byte zero
in the corresponding bound transform feedback buffer."

Need to special case.

     Intel

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Gurchetan Singh
96cceac511 gfxstream: guest: make sure signalSemaphoreValueCount is correct
From the Vulkan 1.3.204 spec:

VUID-VkSubmitInfo-pNext-03240

"If the pNext chain of this structure includes a
 VkTimelineSemaphoreSubmitInfo structure and any element of
 pSignalSemaphores was created with a VkSemaphoreType of
 VK_SEMAPHORE_TYPE_TIMELINE, then its signalSemaphoreValueCount
 member must equal signalSemaphoreCount"

Internally, Mesa WSI creates placeholder semaphores/fences (see
transformVkSemaphore functions in in gfxstream_vk_private.cpp).
We don't want to forward that to the host, since there is no host
side Vulkan object associated with the placeholder sync objects.

The way to test this behavior is Zink + glxgears, on Linux hosts.
It should fail without this check.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Gurchetan Singh
97304dffdf gfxstream: guest: nuke unused functions
These functions are not used.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Gurchetan Singh
84941bcbc5 gfxstream: guest: nuke aemu/base/Optional.h
Only seems to be used in the Fuchsia builds.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Gurchetan Singh
109a7b8d54 gfxstream: guest: nuke AndroidLock
Removes dependency on gfxstream::guest's AEMU lock classes.

Mostly consists on Autolock<RecursiveMutex> to
std::lock_guard<std::recursive_mutex>.

There are some cases where the code does:

Autolock<RecursiveMutex> lock(mLock)
..
lock.unlock()
[ do something ]
lock.lock().
..

Those cases were replaced with std::unique_lock.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Gurchetan Singh
5cb32d45a8 gfxstream: vulkan: fix issue with GCC
With newer versions of libstdc++, debug builds of gfxstream
hit this assert:

 0x00007ffff6ed2d60 in std::__glibcxx_assert_fail
(file=<optimized out>, line=<optimized out>, function=<optimized out>,
condition=<optimized out>)
    at /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/assert_fail.cc:41
std::allocator<VkDescriptorBufferInfo> >::operator[]
(this=0x555555609380, __n=0)
    at /usr/include/c++/14.1.1/bits/stl_vector.h:1130
(pDescriptorSets=0x7fffffffcc30, descriptorSetCount=2,
bufferInfos=std::vector of length 1, capacity 1 = {...})
    at ../guest/vulkan/gfxstream_vk_device.cpp:718
(device=0x55555562f400, descriptorWriteCount=2,
pDescriptorWrites=0x7fffffffcc30, descriptorCopyCount=0,
pDescriptorCopies=0x0)
    at ../guest/vulkan/gfxstream_vk_device.cpp:746

Use resize instead of reserve + memset.

"That way the vector size would be initialized, bounds checks would
be happy, and default-init would automatically zero out POD structs
for us." -- dextero@

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Gurchetan Singh
435102e266 gfxstream: guest: fix kumquat build
... after aosp/3162720

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Jason Macnak
b5b592c861 Demote some logs to debug only
... to remove some logspam. Looks like some ALOGVs were converted
to mesa_logi() in aosp/3093240.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Gurchetan Singh
aa4e85ab42 gfxstream: kumquat: unmap memory when needed
Forgot this.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Jason Macnak
f240f5677a Add YUV AHB import and sample end2end tests
... which triggers the device lost failures when aosp/3163776
is reverted.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Jason Macnak
02b45e7e99 Adds AHB import and sampling test
Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Serdar Kocdemir
e3125c8d2e Add extensions used in test applications
Add VK_KHR_ray_tracing_pipeline and VK_KHR_pipeline_library
extensions support which are used by some test applications.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Gurchetan Singh
3406a65950 gfxstream: guest: start using new vkGetSemaphoreGOOGLE apis
If gfxstream-vulkan host supports these features and
the virtgpu layer is new enough, use the apis.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Gurchetan Singh
538af15956 gfxstream: guest: mBlobId -> mAtomicId
It's a rename so the same concept can be used with sync
descriptors.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Gurchetan Singh
6c0ce98cb0 gfxstream: guest: add experimental fence passing APIs
This uses the new fence passing APIs provided by kumquat.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:02 +00:00
Gurchetan Singh
a1bdf71d8e gfxstream: guest: add GFXSTREAM_ACQUIRE_SYNC protocol
Guest side needs to check availability of new protocol.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:01 +00:00
Gurchetan Singh
5524afa1df gfxstream: host: introduce vkGetSemaphoreGOOGLE
New protocol which instructs the host to share sync descriptor
with ExternalObjectManager.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:01 +00:00
Jason Macnak
7787569b96 Adds helper for tracking command buffers with device lost
... which was useful for debugging b/347288539.

 --gpu_mode=gfxstream_guest_angle \
 --gpu_renderer_features=VulkanCommandBufferCheckpoints:enabled

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:01 +00:00