venus: update vn_GetSwapchainGrallocUsage2ANDROID for shared present
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15868>
This commit is contained in:
parent
d6b4f746b0
commit
2df0aa185e
|
@ -86,6 +86,12 @@ vn_android_gralloc_fini()
|
|||
dlclose(_vn_android_gralloc.module->common.dso);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
vn_android_gralloc_get_shared_present_usage()
|
||||
{
|
||||
return _vn_android_gralloc.front_rendering_usage;
|
||||
}
|
||||
|
||||
struct cros_gralloc0_buffer_info {
|
||||
uint32_t drm_fourcc;
|
||||
int num_fds; /* ignored */
|
||||
|
@ -346,15 +352,15 @@ vn_GetSwapchainGrallocUsage2ANDROID(
|
|||
uint64_t *grallocProducerUsage)
|
||||
{
|
||||
struct vn_device *dev = vn_device_from_handle(device);
|
||||
|
||||
if (VN_DEBUG(WSI)) {
|
||||
vn_log(dev->instance,
|
||||
"format=%d, imageUsage=0x%x, swapchainImageUsage=0x%x", format,
|
||||
imageUsage, swapchainImageUsage);
|
||||
}
|
||||
|
||||
*grallocConsumerUsage = 0;
|
||||
*grallocProducerUsage = 0;
|
||||
|
||||
if (swapchainImageUsage & VK_SWAPCHAIN_IMAGE_USAGE_SHARED_BIT_ANDROID)
|
||||
return vn_error(dev->instance, VK_ERROR_INITIALIZATION_FAILED);
|
||||
|
||||
if (VN_DEBUG(WSI))
|
||||
vn_log(dev->instance, "format=%d, imageUsage=0x%x", format, imageUsage);
|
||||
|
||||
if (imageUsage & (VK_IMAGE_USAGE_TRANSFER_DST_BIT |
|
||||
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT))
|
||||
*grallocProducerUsage |= AHARDWAREBUFFER_USAGE_GPU_FRAMEBUFFER;
|
||||
|
@ -362,7 +368,10 @@ vn_GetSwapchainGrallocUsage2ANDROID(
|
|||
if (imageUsage &
|
||||
(VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_SAMPLED_BIT |
|
||||
VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT))
|
||||
*grallocConsumerUsage |= AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE;
|
||||
*grallocProducerUsage |= AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE;
|
||||
|
||||
if (swapchainImageUsage & VK_SWAPCHAIN_IMAGE_USAGE_SHARED_BIT_ANDROID)
|
||||
*grallocProducerUsage |= vn_android_gralloc_get_shared_present_usage();
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -83,6 +83,9 @@ VkResult
|
|||
vn_android_get_ahb_buffer_memory_type_bits(struct vn_device *dev,
|
||||
uint32_t *out_mem_type_bits);
|
||||
|
||||
uint32_t
|
||||
vn_android_gralloc_get_shared_present_usage(void);
|
||||
|
||||
#else
|
||||
|
||||
static inline const VkNativeBufferANDROID *
|
||||
|
@ -180,6 +183,12 @@ vn_android_get_ahb_buffer_memory_type_bits(UNUSED struct vn_device *dev,
|
|||
return VK_ERROR_FEATURE_NOT_PRESENT;
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
vn_android_gralloc_get_shared_present_usage(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* ANDROID */
|
||||
|
||||
#endif /* VN_ANDROID_H */
|
||||
|
|
Loading…
Reference in New Issue