Commit Graph

195154 Commits

Author SHA1 Message Date
Sergiu
694638d30c Tweaking YCBCR conversion to return correct VK Format
* Adding a drm format field in cb_handler
* Convert android->vulkan format mapping into drm->vulkan format mapping

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
Yahan Zhou
85d52f5780 Add snapshot for command buffer
Record all vkCmd* commands. Also clear them on vkResetCommandBuffer.

Also use VK_IMAGE_ASPECT_STENCIL_BIT when snapshotting stencil
images.

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
26a0c8dd09 Support BGRA render target in CompositorVk
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
5b9905b329 Remove extra semicolon in VkEncoder
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
Serdar Kocdemir
d63edd44c3 Mark VK_MVK_moltenvk extension as supported on vulkan
MoltenVK extension code was not being generated because of the
missing "supported=vulkan" tag required by the code generator.

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:00 +00:00
Jean-Francois Thibert
0fe71cc5da gfxstream: move staging reset to end of reset command 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:00 +00:00
Serdar Kocdemir
e4f720c955 Add VK_EXT_metal_objects support
Adding VK_EXT_metal_objects to the supported extensions
for the host side operations.

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:00 +00:00
Jean-Francois Thibert
2aad7d2b00 gfxstream: Fix usage of encoder after release in vkResetCommandBuffer
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:00 +00:00
Aaron Ruby
fcb2b62bfe gfxstream: Revert all unnecessary gfxstream_vk_* object types and corresponding translations in functable.
Original approach was to translate all possible handle types for complete
Mesa object equivalence. Practically, only a subset of these objects
actually need to be real Mesa objects for use with WSI. This simplifies
the translation and handwritten entries substantially, which is somewhat
brittle and bug-prone.

Clean up parts of functable.py that we don't need.

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:00 +00:00
Aaron Ruby
a1920507dc gfxstream: Clean up VK_KHR_external_memory_fd support for 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:00 +00:00
Aaron Ruby
07c232e3b3 gfxstream: Add "transformList" method for VkFences, in addition to VkSemaphores
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:00 +00:00
Aaron Ruby
9908be77c7 Revert "Reland "Partial revert of aosp/2858589 to avoid Mesa layer for Android""
In preparation for making the issue less likely to appear.

This reverts commit 696eaaa012e369157dd745d1bf083b4dc064deaf.

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:00 +00:00
Gurchetan Singh
47b0536ba2 gfxstream: always advertise device memory extension guest side
memory report extension is present.  It's is filtered out when
sent host side, since for a virtual GPU this is quite difficult
to implement.

Mesa runtime is picky about physical device features.  So if
the test tries to enable device level extension without it
definitely existing, the test will fail.

The test can also be modified to check
VkPhysicalDeviceDeviceMemoryReportFeaturesEXT, but that's more
involved.  Work around this by always advertising the extension.

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:00 +00:00
Aaron Ruby
4a95b71975 gfxstream: Use vk_find_struct for other struct searches in gfxstream_vk_CreateDevice
It turns out we can use vk_find_struct after all.

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:00 +00:00
Aaron Ruby
9149038237 gfxstream: translate physicalDevices list in VkPhysicalDeviceGroupProperties to their gfxstream objects
In preparation to fix some end2end tests.

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:00 +00:00
Yahan Zhou
b38b4a7169 Snapshot VkBuffer
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:00 +00:00
Aaron Ruby
7b215df12b gfxstream: Fix createResource call for Linux-guest VirtGpu layer
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:00 +00:00
Jason Macnak
6d2dd9c22f Update vkMapMemory to not hold lock when calling into enc
... as this can lead to a deadlock with the following sequence:

Time1: guest-thread-1: vkDestroyBuffer() called
Time2:                 VkEncoder grabs seqno 1

Time3: guest-thread-2: vkMapMemory() called
Time4:                 ResourceTracker::on_vkMapMemory() locks mLock
                       for using `info_VkDeviceMemory`
Time5:                 ResourceTracker::on_vkMapMemory() calls
                       enc->vkGetBlobGOOGLE()
Time6:                 VkEncoder grabs seqno 2
Time7:                 VkEncoder sends the vkGetBlobGOOGLE with seqno
                       2 via ASG to host
Time8:                 VkEncoder waits for the `VkResult` from the
                       host via `stream->read()`

Time9: guest-thread-1: VkEncoder calls sResourceTracker->destroyMapping()
                       ->mapHandles_VkBuffer((VkBuffer*)&buffer);
                       which calls ResourceTracker::unregister_VkBuffer()

                       ResourceTracker::unregister_VkBuffer() tries to
                       locks mLock to erase the buffer's info struct
                       from `info_VkBuffer`

!!! DEADLOCKED HERE !!!

guest-thread-1 is stuck waiting on mLock (currently locked by
guest-thread-2) before it would `stream->flush();` to finishing
sending the vkDestroyBuffer() command to the host and potentially
ping its corresponding host-render-thread-1.

guest-thread-2 stuck waiting on the result from host-render-thread-2
but host-render-thread-2 won't progress until host-render-thread-1
finishes seqno 1 which needs guest-thread-1 to finish sending/pinging.

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:00 +00:00
Hailin Zhang
8d4630549d Vulkan: fix dstArrayElement index wrap issue
See https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkWriteDescriptorSet.html

> If the dstBinding has fewer than descriptorCount array elements
> remaining starting from dstArrayElement, then the remainder will
> be used to update the subsequent binding - dstBinding+1 starting
> at array element zero. If a binding has a descriptorCount of zero,
> it is skipped. This behavior applies recursively, with the update
> affecting consecutive bindings as needed to update all
> descriptorCount 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:00 +00:00
C Stout
8e708a6c45 [guest] Fuchsia: initialize queries
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:00 +00:00
Jason Macnak
8ebd422fcd Reland "Partial revert of aosp/2858589 to avoid Mesa layer for Android"
This reverts commit 9eef6d0aefcf0aa1c07d42d9b307b1092a6deec9.

... as this does not yet have a way to generically convert Mesa
handles into Gfxstream handles in extension structs which causes
breakage in dEQP VK for many tests.

Moves the mesa based codegen to a separate `mesa_func_table`.

Reland fixes the end2end test guest vulkan ICD.

      cts -m CtsDeqpTestCases
          --module-arg CtsDeqpTestCases:include-filter:dEQP-VK.*

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:00 +00:00
Yahan Zhou
d6af74d9b0 Handle dependency by VkMemoryDedicatedAllocateInfo
We have a situation that if an image memory is created with
VkMemoryDedicatedAllocateInfo, the following commands that refer to the
same image  must happen in this exact order:

vkCreateImage
vkAllocateMemory (with dedicated image memory)
vkBindImageMemory
vkCreateImageView

Our previous dependency graph implementation uses Vulkan objects as
nodes and does not haven enough granularity to handle this situation.
vkCreateImageView can only be executed after an image is created and
bound to memory. Our previous dependency graph does not have the
notion of "bound to memory". We worked around it by adding
vkBindImageMemory as part of the image initialization steps.

To make sure we can bind image at initialization, we marked image to be
dependent on the memory it bounds to. When adding the new
vkAllocateMemory with dedicated image memory extension into the mix, it
introduced a circular dependency. vkAllocateMemory will say the memory
has dependency on the image. vkBindImageMemory will say the image has
dependency on the memory.

To properly resolve the issue, we will need to record the state of an
Vulkan object, and declare that vkCreateImageView not only depends on an
image, but also requires the image to be bound to memory. We do so by
introducing a "State" enum and use the pair <VkObjectHandle, State> as
the vertex in the deppendency graph. Currently State is an enum with 2
values: CREATED and BOUND_MEMORY. By default, after a VkCreate* command,
an object will be in CREATED state. When calling vkBindImageMemory or
vkBindBufferMemory it will transform the image or buffer into
BOUND_MEMORY state. Then vkCreateImageView will have dependency with
{VkImage, BOUND_MEMORY}.

Then we can create a dependency graph that looks like this:

VkImageView --> {VkImage,BOUND_MEMORY} --> VkMemory
                        |                       |
                        |   ┌-------------------⅃
                        v   v
                       VkImage

No more circular dependency.

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:00 +00:00
Jason Macnak
b57b7043f6 Revert "Partial revert of aosp/2858589 to avoid Mesa layer for Android"
This reverts commit d6e1b00029419b3ae52607967bbb950137bff848.

Reason for revert: broke end2end tests b/333885743

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:00 +00:00
Jason Macnak
cc76ad2582 Partial revert of aosp/2858589 to avoid Mesa layer for Android
... as this does not yet have a way to generically convert Mesa
handles into Gfxstream handles in extension structs which causes
breakage in dEQP VK for many tests.

Moves the mesa based codegen to a separate `mesa_func_table`.

      cts -m CtsDeqpTestCases
          --module-arg CtsDeqpTestCases:include-filter:dEQP-VK.*

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:00 +00:00
Jason Macnak
70c695550a Explicitly specify target/bind/bpp in resource creation
... instead of trying to guess it so that BLOB AHBs can be
distinguished from pipe buffers used for guest<->host communication
in VirtioGpuPipeStream.

Adds a test which allocates a BLOB AHB.

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:00 +00:00
Jason Macnak
d0a61f5813 Rename VirtGpuBlob -> VirtGpuResource
... as this is more generic and "VirglBlob" is not actually a blob.

find . -type f -name "*.cpp" -print0 | \
    xargs -0 sed -i '' -e 's/VirtGpuBlob/VirtGpuResource/g'
find . -type f -name "*.h" -print0 | \
    xargs -0 sed -i '' -e 's/VirtGpuBlob/VirtGpuResource/g'
find . -type f -name "*.cpp" -print0 | \
    xargs -0 sed -i '' -e 's/createVirglBlob/createResource/g'
find . -type f -name "*.h" -print0 | \
    xargs -0 sed -i '' -e 's/createVirglBlob/createResource/g'

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:00 +00:00
Jason Macnak
d9518399dc Update emulated gralloc to use AHB format
... to match the existing real guest usage. This was okay since all of
the tests were using the drm format too but we should match.

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:00 +00:00
Yahan Zhou
563c11a3a9 Fix corner cases where vk dependency graph breaks
There are 2 issues with the current implementation of VkReconstruct:

a. When deleting a child handle it does not erase itself from its
   parent. When doing snapshot we enumerate children handles and check
   if they are still "alive". But the handle pool is written in the way
   that it could reuse handles that have been previously destroyed,
   invalidating the "alive" check.
b. Previous dependency graph does not support one handle with multiple
   parents.

In this commit we fix (a) by making child<->parent pointer
bidirectional. When deleting a child it will be erased from its parents.

We fix (b) by rewriting a significant part of dependency graph logic on
snapshot save.

The commit also makes all destroy command to be recursive (except for
vkDestroyShaderModule), which will be handled in later commits.

Also add dependency VkFrameBuffer -> VkImageView.

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:00 +00:00
Jason Macnak
d0a4d3f3bc Add composition support to the end2end test framework
... so that we can start to test GL->VK->Host-Compositor flows.

Adds a fake render control lib that basically just exposes some of
the render control functions with scoped host connection inside of
a `RenderControlDevice`.

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:00 +00:00
Jason Macnak
c2d57b76be Ensure glProgramBinary initializes uniform and attrib info
Adds Scoped* helper classes to hopefully make writing tests easier.

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:00 +00:00
Yahan Zhou
b1b8eb9301 Make it not crash during vk snapshot load
We are trying to make vk snapshot load the google Chrome home page
without crashing. With this CL it does not crash during load but would
crash with a device lost after submitting a queue (which is
unsurprising because everything is missing to snapshot vk queue).

Content of this commit includes:

 - Add dependencies for VkImageView, VkGraphicsPipelines, VkFramebuffer.
   They are necessary to tell the snapshot module the order of vk object
   creation.
 - Add vkBindImageMemory into the loading sequencey of VkImage, so that
   it would be executed before vkCreateImageView.
 - Delay the destruction of VkShaderModule. This is because other
   objects can still refer to it after it is destroyed.
 - Initialize VK backend for color buffer properly on snapshot load.
 - Save and load vk images in the same order by sorting them according
   to their boxed handle.
 - Record all the placeholder handles for vkCreateDescriptorPool. For
   performance purpose this function creates a lot of extra handles
   without real contents. We need to snapshot those handles 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:00 +00:00
Bo Hu
2f958ad3f8 goldfish: handle null handle
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:00 +00:00
Erwin Jansen
677b398ea4 Enable GFXStream bazel build
This builds the "standalone" GFXStream library that can be consumed by
Qemu 8.2

The bazel build allows us to transition rutabaga to a bazel based
build, which will unify the Qemu 8.2 build as used by the emulator.

It also opens up the path to migrate this to g3 if we decide to do this.

This change forces a few header changes, as bazel is more strict about
the relationship between headers and packages, and doesn't easily give
you fine grained control over the include paths.

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:00 +00:00
Serdar Kocdemir
0deb66fcae Add support for VK_EXT_robustness2
This extension is required to get Vulkan Capabilities
Viewer working correctly in the emulator.

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:00 +00:00
C Stout
36d09f70ce [guest] Fuchsia: open magma device
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:00 +00:00
Jason Macnak
a7b61ee151 Introduce Gfxstream Features to decouple Gfxstream from AEMU
... which will allow building Gfxstream from a fixed version of
AEMU for the purposes of packaging.

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:00 +00:00
Gurchetan Singh
f1392431e0 gfxstream: generate development ICD for meson build
An user is now able to do:

export VK_ICD_FILENAMES=./amd64-build/guest/vulkan/gfxstream_vk_devenv_icd.x86_64.json

that allows vulkan apps without install the ICD.

If built with option `-Dgfxstream-build=guest-test`, that would go
into the gfxstream VK ICD and the test layer.  Unfortunately,
the test layer hangs right now since I believe the gfxstream_backend's
vulkan loading logic is also affected by the environment variable.

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:00 +00:00
Serdar Kocdemir
876844ddd6 Add VK_EXT_validation_features to host modules
This is another extension used for vulkan validation.

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:00 +00:00
Yahan Zhou
fe6accba65 Better track color buffer usage in Vulkan
Sometimes guest renders to an AHB without calling
vkQueueSignalReleaseImageANDROIDAsyncGOOGLE. This would result in the
color buffer not being updated from Vulkan.

This commit tracks the situation that AHB is rendered to, and copies its
content to color buffer.

Note that it adds extra wait, which could hurt performance.

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:00 +00:00
Serdar Kocdemir
ae8d2c2907 Add VK_EXT_debug_utils to host modules for codegen
Fixes emulator crashes when the validation layers
are enabled on the guest side.

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:00 +00:00
C Stout
9fbbdf87b6 [guest] Fix Fuchsia build, add missing header
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:00 +00:00
C Stout
220d0ffb79 [guest] Remove Fuchsia syslog_static dependency
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:00 +00:00
Serdar Kocdemir
272db6ebc4 Use append to chain memory pointer info
Append importHostInfo rather than directly assigning
to pNext for VkMemoryAllocateInfo struct.

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:00 +00:00
C Stout
2daad5f609 [guest] Fuchsia: include missing Vulkan entry points
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:00 +00:00
Serdar Kocdemir
bb2e9be160 Reduce heap pressure on getPacketContents
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:00 +00:00
Jason Macnak
092dbc32ab Make RutabagaLayer shared between "guest impls"
... so that "guest gralloc", "guest egl", "guest vulkan", etc are
all using the same underlying emulation layer (RutabagaLayer).

This moves Gralloc and ANativeWindow into platform as these should
be hidden from GfxstreamEnd2EndTests.

Note: we still want to static-ify a lot of the guest libraries.

      meson setup \
          -Ddefault_library=static \
          -Dgfxstream-build=both \
          build
      meson compile -C 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:00 +00:00
Jason Macnak
bfac7ab65e Handle AHB R8 format conversions
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:00 +00:00
Lars Harrison
fe4a621c7b Fix coherent memory allocation to use device
When allocating coherent memory (generally, suballocations) and looking
up existing VkDeviceMemory entries, the device is critical to finding
valid allocation blocks, otherwise allocations from other devices might
be chosen, which invalidate things.

This happens only in situations where a single process has multiple
VkDevices, so it was rare enough not to be caught until now.

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:00 +00:00
Gurchetan Singh
ef4d6d8fb4 gfxstream: build the test layer via Meson
Useful for host driver in guest efforts.

     ninja -C amd64-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:00 +00:00
Yahan Zhou
362ffb5f81 Snapshot vk image content in common situation
This commit snapshots vk image content by allocating a staging buffer
and copying the bytes on snapshot. It only works in the simplest setup.
Many situations are not considered in this commit, they include:

(1) the image does not support VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL
layout;
(2) the image does not support VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL
layout;
(3) the queue is dirty.

Also there is no performance optimization.

Implementation-wise, snapshot happens in VkDecoderGlobalState after
recording / playing back all create / bind commands. It borrows an
existing queue to run the extra vk copy commands. A temporary staging
buffer is also created for copying. Later we could optimize the code
by reusing most of the temporary objects.

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:00 +00:00