vulkan: Add an ahardware_buffer_format field to vk_image

Reviewed-by: Lina Versace <lina@kiwitree.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22038>
This commit is contained in:
Faith Ekstrand 2023-03-21 10:24:40 -05:00 committed by Marge Bot
parent dc0749adab
commit 906944b210
2 changed files with 14 additions and 2 deletions

View file

@ -23,8 +23,6 @@
#include "vk_image.h"
#include <vulkan/vulkan_android.h>
#ifndef _WIN32
#include <drm-uapi/drm_fourcc.h>
#endif
@ -40,6 +38,11 @@
#include "vk_util.h"
#include "vulkan/wsi/wsi_common.h"
#ifdef ANDROID
#include "vk_android.h"
#include <vulkan/vulkan_android.h>
#endif
void
vk_image_init(struct vk_device *device,
struct vk_image *image,
@ -97,6 +100,8 @@ vk_image_init(struct vk_device *device,
#endif
#ifdef ANDROID
image->ahardware_buffer_format = 0;
const VkExternalFormatANDROID *ext_format =
vk_find_struct_const(pCreateInfo->pNext, EXTERNAL_FORMAT_ANDROID);
if (ext_format && ext_format->externalFormat != 0) {

View file

@ -70,6 +70,13 @@ struct vk_image {
#endif
#ifdef ANDROID
/* AHARDWAREBUFFER_FORMAT for this image or 0
*
* A default is provided by the Vulkan runtime code based on the VkFormat
* but it may be overridden by the driver as needed.
*/
unsigned ahardware_buffer_format;
/* VK_ANDROID_external_memory_android_hardware_buffer */
uint64_t android_external_format;
#endif