venus: refactor the ahb buffer mem_type_bits query api
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org> Reviewed-by: Chia-I Wu <olvaffe@gmail.com> Reviewed-by: Ryan Neph <ryanneph@google.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13428>
This commit is contained in:
@@ -1181,7 +1181,8 @@ vn_android_fix_buffer_create_info(
|
||||
}
|
||||
|
||||
VkResult
|
||||
vn_android_init_ahb_buffer_memory_type_bits(struct vn_device *dev)
|
||||
vn_android_get_ahb_buffer_memory_type_bits(struct vn_device *dev,
|
||||
uint32_t *out_mem_type_bits)
|
||||
{
|
||||
const uint32_t format = AHARDWAREBUFFER_FORMAT_BLOB;
|
||||
/* ensure dma_buf_memory_type_bits covers host visible usage */
|
||||
@@ -1213,7 +1214,7 @@ vn_android_init_ahb_buffer_memory_type_bits(struct vn_device *dev)
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
dev->ahb_buffer_memory_type_bits = mem_type_bits;
|
||||
*out_mem_type_bits = mem_type_bits;
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,8 @@ vn_android_buffer_from_ahb(struct vn_device *dev,
|
||||
struct vn_buffer **out_buf);
|
||||
|
||||
VkResult
|
||||
vn_android_init_ahb_buffer_memory_type_bits(struct vn_device *dev);
|
||||
vn_android_get_ahb_buffer_memory_type_bits(struct vn_device *dev,
|
||||
uint32_t *out_mem_type_bits);
|
||||
|
||||
#else
|
||||
|
||||
@@ -163,7 +164,8 @@ vn_android_buffer_from_ahb(UNUSED struct vn_device *dev,
|
||||
}
|
||||
|
||||
static inline VkResult
|
||||
vn_android_init_ahb_buffer_memory_type_bits(UNUSED struct vn_device *dev)
|
||||
vn_android_get_ahb_buffer_memory_type_bits(UNUSED struct vn_device *dev,
|
||||
UNUSED uint32_t *out_mem_type_bits)
|
||||
{
|
||||
return VK_ERROR_FEATURE_NOT_PRESENT;
|
||||
}
|
||||
|
||||
@@ -304,9 +304,13 @@ vn_device_init(struct vn_device *dev,
|
||||
|
||||
if (dev->base.base.enabled_extensions
|
||||
.ANDROID_external_memory_android_hardware_buffer) {
|
||||
result = vn_android_init_ahb_buffer_memory_type_bits(dev);
|
||||
uint32_t mem_type_bits = 0;
|
||||
result =
|
||||
vn_android_get_ahb_buffer_memory_type_bits(dev, &mem_type_bits);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail;
|
||||
|
||||
dev->ahb_buffer_memory_type_bits = mem_type_bits;
|
||||
}
|
||||
|
||||
return VK_SUCCESS;
|
||||
|
||||
Reference in New Issue
Block a user