diff options
author | Faith Ekstrand <faith.ekstrand@collabora.com> | 2023-03-21 10:24:40 -0500 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2023-03-31 14:57:03 +0000 |
commit | 906944b210c4d4f7d15d19fd16a5fca4ff25d3ac (patch) | |
tree | fca056a803df2508c54fad7c75d20e436e4cda05 /src/vulkan | |
parent | dc0749adab3a6c0286aba9634b73ab9c32113f60 (diff) | |
download | mesa-906944b210c4d4f7d15d19fd16a5fca4ff25d3ac.tar.gz mesa-906944b210c4d4f7d15d19fd16a5fca4ff25d3ac.tar.bz2 mesa-906944b210c4d4f7d15d19fd16a5fca4ff25d3ac.zip |
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>
Diffstat (limited to 'src/vulkan')
-rw-r--r-- | src/vulkan/runtime/vk_image.c | 9 | ||||
-rw-r--r-- | src/vulkan/runtime/vk_image.h | 7 |
2 files changed, 14 insertions, 2 deletions
diff --git a/src/vulkan/runtime/vk_image.c b/src/vulkan/runtime/vk_image.c index e4bd997a215..b33d10e7e94 100644 --- a/src/vulkan/runtime/vk_image.c +++ b/src/vulkan/runtime/vk_image.c @@ -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) { diff --git a/src/vulkan/runtime/vk_image.h b/src/vulkan/runtime/vk_image.h index bd120da646a..a3db8ed0e43 100644 --- a/src/vulkan/runtime/vk_image.h +++ b/src/vulkan/runtime/vk_image.h @@ -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 |