summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYiwei Zhang <zzyiwei@chromium.org>2021-10-18 21:22:57 +0000
committerMarge Bot <eric+marge@anholt.net>2021-10-28 00:23:14 +0000
commit927dea7c346b9717d1fe5fd113b46846b8369f7e (patch)
treee204a56551882bbe23b35e7c5d0febac0a7a9519
parent34b7d820e2912c6b586f7ae670120eb18aeb45a5 (diff)
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>
-rw-r--r--src/virtio/vulkan/vn_android.c5
-rw-r--r--src/virtio/vulkan/vn_android.h6
-rw-r--r--src/virtio/vulkan/vn_device.c6
3 files changed, 12 insertions, 5 deletions
diff --git a/src/virtio/vulkan/vn_android.c b/src/virtio/vulkan/vn_android.c
index 8ddf4c9c068..b914966ca02 100644
--- a/src/virtio/vulkan/vn_android.c
+++ b/src/virtio/vulkan/vn_android.c
@@ -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;
}
diff --git a/src/virtio/vulkan/vn_android.h b/src/virtio/vulkan/vn_android.h
index 327ff7a674a..02dca992170 100644
--- a/src/virtio/vulkan/vn_android.h
+++ b/src/virtio/vulkan/vn_android.h
@@ -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;
}
diff --git a/src/virtio/vulkan/vn_device.c b/src/virtio/vulkan/vn_device.c
index ab4c53dd87b..e2d6d6b9ef8 100644
--- a/src/virtio/vulkan/vn_device.c
+++ b/src/virtio/vulkan/vn_device.c
@@ -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;