28 Commits
Author SHA1 Message Date
Serdar Kocdemir 74647db33f Add mipLevels argument to vulkan color buffer creation
Android Hardware Buffers can be created with mip levels and
the mismatch is causing errors when importing vulkan images.

Bug: 406456167
Test: CtsNativeHardwareTestCases
Change-Id: I3634bd400574453bf4ff123c149cb5f95409a42f
2025-09-11 08:25:45 +00:00
Jason Macnak 453d39675a Use Gfxstream's Stream for save/load interface
Moves several of the "common/base" classes to host/backend as these
classes all used `Stream` which is a host only interface.

Bug: b/403363880

Test: cd hardware/google/gfxstream
      mma

Test: cd hardware/google/gfxstream
      mkdir build && cd build
      cmake .. -G Ninja
      ninja

Test: meson setup \
        -Ddefault_library=static \
        -Dgfxstream-build=host \
        build

      meson compile -C build

Test: cd <emu main dev repo>
      cd external/qemu
      python android/build/python/cmake.py --gfxstream

Test: cd <emu main next repo>
      prebuilts/bazel/linux-x86_64/bazel test \
      --platforms=@//build/bazel/platforms:linux_x64 \
     @gfxstream//...

Change-Id: Ia664776c2322b310614f632e4926bb3b031f3bc1
2025-05-07 12:35:25 -07:00
Jason Macnak a43dfa9f3c Add gfxstream host logging lib
... to eventually replace the existing host-common/logging. This
is needed to break up the circular dependency between aemu-base and
aemu-host-common, so that we can move parts of aemu-base and
aemu-host-common into hardware/google/gfxstream, in order to make
Gfxstream a self contained library for building.

Hooks up the existing host-common/logging via the
RenderLibImpl::setLogger() call.

Bug: b/403363880

Test: cd hardware/google/gfxstream
      mma

Test: cd hardware/google/gfxstream
      mkdir build && cd build
      cmake .. -G Ninja
      ninja

Test: meson setup \
        -Ddefault_library=static \
        -Dgfxstream-build=host \
        build
      meson compile -C build

Test: cd <emu master dev repo>
      cd external/qemu
      python android/build/python/cmake.py --gfxstream

Test: cd <emu main next repo>
      prebuilts/bazel/linux-x86_64/bazel test \
      --platforms=@//build/bazel/platforms:linux_x64 \
     @gfxstream//...

Change-Id: Id52c6f756f85d0a5fb948601228234d7a84a14c2
2025-04-09 13:11:08 -07:00
Serdar Kocdemir 4f0bcb55cc Refactor ExternalHandleInfo
.. to increase readability and reduce duplicated
functionality around the code base.

Bug: 389637419
Test: CI
Change-Id: Ib838b166a7629f00375cad6beb0a1630d2041986
2025-03-28 16:29:15 +00:00
Jason Macnak 4e379d810e Remove the global VkEmulation variable
... and move into FrameBuffer.

Bug: b/383139165
Test: cvd create --gpu_mode=gfxstream_guest_angle_host_swiftshader
Change-Id: Iab139a0793564b21126a66946031caab8a8a6456
2025-03-04 13:03:38 -08:00
Jason Macnak 17b4107260 Make VkEmulation a class w/ VkCommonOperations funcs
... so that members can start to be protected with GUARDED_BY
annotations and potentially can start to eliminate having a
global `sVkEmulation`.

Bug: b/383139165
Test: cvd create --gpu_mode=gfxstream_guest_angle_host_swiftshader
Change-Id: Iae4dd859991015e386fcc30ef091ccdb7ed1aeb6
2025-03-04 12:56:10 -08:00
Aaron Ruby 1ade01f177 Revert "Revert "Revert "gfxstream: stream-renderer: add waitSyncResource...""
This reverts commit 1cc4e5cfc8.

This is now a "revert^3". So finally removing this API/feature,
and all the associated code that was tracking this in queueSubmit.
As mentioned on chromium review, this was initially added by QNX for
zink+gfxstream-vulkan bring-up on Linux, but sync issues fixed in
Vulkan. This was never a robust API, and doesn't make sense in the
context of the virtio-gpu spec (i.e. for scanout resources).

Test:Linux + Android guests using gfxstream-vulkan-only configs

Change-Id: I9e25f797b27388f78c19b2fb6d979fd803bce60e
2025-03-03 18:51:02 -05:00
Aaron Ruby a051293dbd Remove all interfaces for explicitly importing a native resource
This will be covered explicitly with a new stream-renderer interface

BUG=382442209

Change-Id: Ife83b2be0d5d3b821d060cc52dd751701d4220a8
2024-12-18 11:33:29 -05:00
Aaron Ruby 6ea10ff53c Revert^2 "Remove VK_EXT_MEMORY_HANDLE_INVALID entirely"
fb311f0038

Change-Id: I452feb479438b24a9bd4a5f6717fc5c0c4fdb908
2024-12-18 10:46:19 -05:00
Aaron Ruby 4202c1bd5d Revert "Revert "Simplify the Vulkan external memory import code ..."
Revert submission 3414268-revert-3393388-extmem-refactor-dec-5-BQXYSDRQMH

Reason for revert: Fixing the MacOS issue that required the original revert of the recent changes.

Reverted changes: /q/submissionid:3414268-revert-3393388-extmem-refactor-dec-5-BQXYSDRQMH

Change-Id: I81fbb3263488f69aec16e5ffd9c6008d9ac670bf
2024-12-18 10:46:19 -05:00
Aaron Ruby 9ef51649a5 Revert^2 "Use a common GenericDescriptorInfo struct"
1bfb4638b4

NO_IFTTT=doesn't affect snapshot

Change-Id: I754c649c6e1f842108674ea405c6dcaab90e9c07
2024-12-18 10:46:01 -05:00
Lars Harrison 1bfb4638b4 Revert "Use a common GenericDescriptorInfo struct"
Revert submission 3393388-extmem-refactor-dec-5

Reason for revert: b/384041851 (+gap in test coverage)

Reverted changes: /q/submissionid:3393388-extmem-refactor-dec-5

NO_IFTTT=Revert, doesn't affect snapshot

Change-Id: I6b3184618a4beb16a25ddd1dbbd55d551aa85190
2024-12-13 19:03:45 -08:00
Lars Harrison 8cc2109d82 Revert "Simplify the Vulkan external memory import code for all ..."
Revert submission 3393388-extmem-refactor-dec-5

Reason for revert: b/384041851 (+gap in test coverage)

Reverted changes: /q/submissionid:3393388-extmem-refactor-dec-5

Change-Id: I8cdfdfd5042dadac4a8c8a76a79a6c8f3451bcda
2024-12-13 14:53:16 -08:00
Lars Harrison fb311f0038 Revert "Remove VK_EXT_MEMORY_HANDLE_INVALID entirely"
Revert submission 3393388-extmem-refactor-dec-5

Reason for revert: b/384041851 (+gap in test coverage)

Reverted changes: /q/submissionid:3393388-extmem-refactor-dec-5

Change-Id: Id153aa5ac872aec9d5aaa8a568d70c9d2fb40d6d
2024-12-13 14:53:16 -08:00
Aaron Ruby 61b49932d1 Remove VK_EXT_MEMORY_HANDLE_INVALID entirely
- Use ExternalHandleInfo wherever possible
- Validity of the handle can be checked by making it a std::optional, this
is more robust

BUG=382442209
TEST=sanity on Android14, Yocto w/ gfxstream
NO_IFTTT=doesn't affect snapshot

Change-Id: I427dd554d9a2841685f5f45e3d97620bedb87b56
2024-12-09 13:39:20 -05:00
Aaron Ruby bdc03cb155 Simplify the Vulkan external memory import code for all platforms
- Use ExternalMemoryHandle instead of VK_EXT_MEMORY_HANDLE, wherever
possible
- Make the dupExternalMemory internal to VkCommonOperations
- Make the Buffer and ColorBuffer getExtMem functions do the dup instead
- Resolve references and nomenclature for handleType/streamHandleType

BUG=382442209
TEST=Sanity on Android14 (ANGLE and gfxstream-gles backend), Yocto w/ gfxstream-vulkan
NO_IFTTT=doesn't affect snapshot

Change-Id: I9d56d058ed891ec036220aca90a54bd7a1dbaaa6
2024-12-09 13:35:59 -05:00
Aaron Ruby 4dd24d4409 Use a common GenericDescriptorInfo struct
Also clean up references to headers/namespace for ManagedDescriptor type

BUG=382442209
TEST=compile
NO_IFTTT=doesn't affect snapshot

Change-Id: I7dc660f239e47974588b574b3ce676c482658bd7
2024-12-09 13:35:59 -05:00
Serdar Kocdemir 3c57698c11 Add buffer size checks for color copy operations
Make readColorBufferToBytes calls safer by providing the size of
the destination buffer. Old unsafe version is kept with maximum
size value to allow backwards compatibility.

Bug: 378779335
Test: presubmit, run on Mac
Change-Id: Idcadecda7642bdb45be65c7f0908fd7925c152fa
2024-11-14 14:45:24 +00:00
Gurchetan Singh 619646f3a4 gfxstream: host: BlobManager --> ExternalObjectManager
We should try to support external sync, along with
external memory so:

find ./ -type f -exec sed -i -e 's/BlobManager/ExternalObjectManager/g' {} \;
find ./ -type f -exec sed -i -e 's/removeDescriptorInfo/removeBlobDescriptorInfo/g' {} \;
find ./ -type f -exec sed -i -e 's/addDescriptorInfo/addBlobDescriptorInfo/g' {} \;
find ./ -type f -exec sed -i -e 's/mDescriptorInfo/mBlobDescriptorInfo/g' {} \;
find ./ -type f -exec sed -i -e 's/ManagedDescriptorInfo/BlobDescriptorInfo/g' {} \;

BUG=350965057
TEST=compile

Change-Id: Id9fe5319ed617638ae8c67f9377f5426fe15cf44
2024-07-03 16:21:42 +00:00
Gurchetan Singh b86aa8b160 gfxstream: host: add exportColorBuffer + exportBuffer functions
We want to share the color buffer or buffer with a Wayland,

BUG=349122558
TEST=see dmabufs being exported

Change-Id: I5d3a94aec2b7a58b8281ba081d8041e21d12e8bf
2024-07-02 11:47:45 -07:00
Gurchetan Singh 1cc4e5cfc8 Revert "Revert "gfxstream: stream-renderer: add waitSyncResource..."
Revert submission 3125001

BUG=346348303
TEST=atbd

Change-Id: Iff294455e95093e80cbcb66f36d0a280c48299b3
2024-06-14 07:48:33 -07:00
Gurchetan Singh 68437f938a Revert "gfxstream: stream-renderer: add waitSyncResource interface"
BUG=346348303
TEST=todo

This reverts commit 7609a83699.

Change-Id: I15432fe856bc1e5b3f1b71731c5bdf290da54ac1
2024-06-13 18:31:34 +00:00
Aaron Ruby 7609a83699 gfxstream: stream-renderer: add waitSyncResource interface
Useful for syncing against a specific resource. This will only be
applicable to colorBuffer resources.

Add waitSync implementation for ColorBufferVk

BUG=343234676
TEST=gfxstream guest ANGLE + gfxstream guest Zink + end2endtests

Change-Id: I8268f3b3637984f3d4d1cd6127fdd542978790c0
2024-06-06 16:21:07 -07:00
Yahan Zhou 88df7cff15 Fix ColorBufferVk layout on snapshot load again
We have a situation that the color buffer vulkan images are transformed
into the wrong layout after snapshot load. Fix it by memorizing the
layout in snapshot.

We don't have a test for it yet as we don't really understand how to
trigger this behavior at unittest level.

Also recover layout for multi-sample images after snapshot loads. But we
still don't snapshot its content yet.

Bug: 332775761
Test: CanSubmitQueue
Change-Id: I8007f504d055041b11c3af3425cfbdbfac0553dd
2024-04-19 14:59:58 -07:00
Yahan Zhou 4c20def42a Hide ColorBuffer Vulkan snapshot behind a flag
All Vulkan snapshot related functionality should be hidden behind
-feature VulkanSnapshots.

Bug: 332775761
Test: existing
Change-Id: Id0b0caefe619872f6f8a8144d3485a9c60f4f3fc
2024-04-11 19:41:00 +00:00
Yahan Zhou b1514065bc Snapshot image layout
Should be able to snapshot Chrome home page without crashing. (Website
browsing still needs more work.)

Bug: 332775761
Test: CanSubmitQueue
Change-Id: If1dbd4fc2af17d022cdcdfca98528d7183e32ab6
2024-04-08 11:30:57 -07:00
Aaron Ruby 4fc86edae8 gfxstream: Add Vulkan external memory resource import implementation for host.
Developed for QNX use-case, but applies generally to any
platform that supports external memory for import but not for
export.

Some robustness around VK_QNX_external_memory_screen_buffer API
usage added with the updateExternalMemoryInfo() function.

BUG=319510663
TEST=compile && launch_cvd --gpu_mode=gfxstream_guest_angle

Change-Id: I7b10b70da024df60881c8b27ea29bd44101b95f6
2024-01-16 15:53:20 -08:00
Jason Macnak 648a9edc06 Rename stream-servers to host
Bug: b/271464937
Test: m
Change-Id: I89553dfe2e27170e1e968e234b364f13e76b2f88
2023-05-19 15:09:46 -07:00