mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-18 06:10:36 +01:00
vulkan/android: Add common helpers for the AHB extension
Change-Id: I0d88ebf6b14b6425a7ecbdbb1c17df62e4ca103a Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com> Tested-by: tarsin <yuanqingxiang233@163.com> Reviewed-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25360>
This commit is contained in:
parent
d0996d1a30
commit
e8f7e7582a
2 changed files with 36 additions and 0 deletions
|
|
@ -328,6 +328,28 @@ vk_android_get_anb_layout(
|
|||
out_layouts, max_planes);
|
||||
}
|
||||
|
||||
VkResult
|
||||
vk_android_get_ahb_layout(
|
||||
struct AHardwareBuffer *ahardware_buffer,
|
||||
VkImageDrmFormatModifierExplicitCreateInfoEXT *out,
|
||||
VkSubresourceLayout *out_layouts, int max_planes)
|
||||
{
|
||||
AHardwareBuffer_Desc description;
|
||||
const native_handle_t *handle =
|
||||
AHardwareBuffer_getNativeHandle(ahardware_buffer);
|
||||
|
||||
AHardwareBuffer_describe(ahardware_buffer, &description);
|
||||
|
||||
struct u_gralloc_buffer_handle gr_handle = {
|
||||
.handle = handle,
|
||||
.pixel_stride = description.stride,
|
||||
.hal_format = description.format,
|
||||
};
|
||||
|
||||
return vk_gralloc_to_drm_explicit_layout(&gr_handle, out,
|
||||
out_layouts, max_planes);
|
||||
}
|
||||
|
||||
/* From the Android hardware_buffer.h header:
|
||||
*
|
||||
* "The buffer will be written to by the GPU as a framebuffer attachment.
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ extern "C" {
|
|||
struct u_gralloc;
|
||||
struct vk_device;
|
||||
struct vk_image;
|
||||
struct AHardwareBuffer;
|
||||
|
||||
#if DETECT_OS_ANDROID
|
||||
struct u_gralloc *vk_android_get_ugralloc(void);
|
||||
|
|
@ -49,6 +50,10 @@ VkResult vk_android_get_anb_layout(
|
|||
const VkImageCreateInfo *pCreateInfo,
|
||||
VkImageDrmFormatModifierExplicitCreateInfoEXT *out,
|
||||
VkSubresourceLayout *out_layouts, int max_planes);
|
||||
VkResult vk_android_get_ahb_layout(
|
||||
struct AHardwareBuffer *ahardware_buffer,
|
||||
VkImageDrmFormatModifierExplicitCreateInfoEXT *out,
|
||||
VkSubresourceLayout *out_layouts, int max_planes);
|
||||
#else
|
||||
static inline struct u_gralloc *
|
||||
vk_android_get_ugralloc(void)
|
||||
|
|
@ -85,6 +90,15 @@ vk_android_get_anb_layout(
|
|||
return VK_ERROR_FEATURE_NOT_PRESENT;
|
||||
}
|
||||
|
||||
static inline VkResult
|
||||
vk_android_get_ahb_layout(
|
||||
struct AHardwareBuffer *ahardware_buffer,
|
||||
VkImageDrmFormatModifierExplicitCreateInfoEXT *out,
|
||||
VkSubresourceLayout *out_layouts, int max_planes)
|
||||
{
|
||||
return VK_ERROR_FEATURE_NOT_PRESENT;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if DETECT_OS_ANDROID && ANDROID_API_LEVEL >= 26
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue