Support AHARDWAREBUFFER_FORMAT_BLOB buffers
... by using `Buffer`s and not `ColorBuffer`s for blobs.
Bug: b/234513607
Test: launch_cvd --gpu_mode=gfxstream
Test: launch_cvd --gpu_mode=gfxstream (with WIP ANGLE)
Test: cts -m CtsNativeHardwareTestCases
Change-Id: Iab2ff38ee3e385ecd206e1d2aa6471b92985c42a
diff --git a/system/vulkan_enc/ResourceTracker.cpp b/system/vulkan_enc/ResourceTracker.cpp
index 0b164a4..a710f2a 100644
--- a/system/vulkan_enc/ResourceTracker.cpp
+++ b/system/vulkan_enc/ResourceTracker.cpp
@@ -4073,10 +4073,19 @@
if (ahw) {
D("%s: Import AHardwareBuffer", __func__);
- importCbInfo.colorBuffer =
- ResourceTracker::threadingCallbacks.hostConnectionGetFunc()->grallocHelper()->
- getHostHandle(AHardwareBuffer_getNativeHandle(ahw));
- vk_append_struct(&structChainIter, &importCbInfo);
+ const uint32_t hostHandle =
+ ResourceTracker::threadingCallbacks.hostConnectionGetFunc()->grallocHelper()
+ ->getHostHandle(AHardwareBuffer_getNativeHandle(ahw));
+
+ AHardwareBuffer_Desc ahbDesc = {};
+ AHardwareBuffer_describe(ahw, &ahbDesc);
+ if (ahbDesc.format == AHARDWAREBUFFER_FORMAT_BLOB) {
+ importBufferInfo.buffer = hostHandle;
+ vk_append_struct(&structChainIter, &importBufferInfo);
+ } else {
+ importCbInfo.colorBuffer = hostHandle;
+ vk_append_struct(&structChainIter, &importCbInfo);
+ }
}
zx_handle_t vmo_handle = ZX_HANDLE_INVALID;