Add AHardwareBuffer support

Initial pass at adding AHardwareBufferSupport so that Dawn can display
content on Android. Confirmed that this will allow many WebGPU pages to
render when paired with
https://chromium-review.googlesource.com/c/chromium/src/+/3877262

Bug: dawn:286
Change-Id: I627fa2ab71f85bd3cb7ea21b0588dbd2089cdf5f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101460
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Brandon Jones
2022-09-08 23:03:28 +00:00
committed by Dawn LUCI CQ
parent 0d7cd27fd3
commit 7edef20bdd
15 changed files with 279 additions and 8 deletions

View File

@@ -229,6 +229,7 @@ enum ExternalImageType {
IOSurface,
DXGISharedHandle,
EGLImage,
AHardwareBuffer,
};
// Common properties of external images

View File

@@ -126,6 +126,26 @@ struct DAWN_NATIVE_EXPORT ExternalImageExportInfoDmaBuf : ExternalImageExportInf
ExternalImageExportInfoDmaBuf();
};
#ifdef __ANDROID__
// Descriptor for AHardwareBuffer image import
struct DAWN_NATIVE_EXPORT ExternalImageDescriptorAHardwareBuffer : ExternalImageDescriptorVk {
public:
ExternalImageDescriptorAHardwareBuffer();
struct AHardwareBuffer* handle; // The AHardwareBuffer which contains the memory of the image
std::vector<int> waitFDs; // File descriptors of semaphores which will be waited on
protected:
using ExternalImageDescriptorVk::ExternalImageDescriptorVk;
};
struct DAWN_NATIVE_EXPORT ExternalImageExportInfoAHardwareBuffer : ExternalImageExportInfoFD {
ExternalImageExportInfoAHardwareBuffer();
};
#endif // __ANDROID__
#endif // __linux__
// Imports external memory into a Vulkan image. Internally, this uses external memory /