v3dv/android: Enable shared presentable image support

Functionality ensures gralloc won't allocate compressed buffer
incompatible with shared presentable image support.

Broadcom does not support compressed buffers and we can just enable the
feature without additional logic. Despite that, we add the logic here
so it can be replaced with the generic code someday.

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25028>
This commit is contained in:
Roman Stratiienko 2023-09-02 18:35:09 +03:00 committed by Marge Bot
parent 83b90c4400
commit 22809765ac
2 changed files with 24 additions and 0 deletions

View file

@ -304,6 +304,12 @@ v3dv_GetSwapchainGrallocUsage2ANDROID(
*grallocConsumerUsage |= GRALLOC1_CONSUMER_USAGE_HWCOMPOSER;
}
if (swapchainImageUsage & VK_SWAPCHAIN_IMAGE_USAGE_SHARED_BIT_ANDROID) {
uint64_t front_rendering_usage = 0;
u_gralloc_get_front_rendering_usage(device->gralloc, &front_rendering_usage);
*grallocProducerUsage |= front_rendering_usage;
}
return VK_SUCCESS;
}
#endif

View file

@ -1656,6 +1656,24 @@ v3dv_GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice,
props->allowCommandBufferQueryCopies = true;
break;
}
#ifdef ANDROID
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wswitch"
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENTATION_PROPERTIES_ANDROID: {
VkPhysicalDevicePresentationPropertiesANDROID *props =
(VkPhysicalDevicePresentationPropertiesANDROID *)ext;
uint64_t front_rendering_usage = 0;
struct u_gralloc *gralloc = u_gralloc_create(U_GRALLOC_TYPE_AUTO);
if (gralloc != NULL) {
u_gralloc_get_front_rendering_usage(gralloc, &front_rendering_usage);
u_gralloc_destroy(&gralloc);
}
props->sharedImage = front_rendering_usage ? VK_TRUE
: VK_FALSE;
break;
}
#pragma GCC diagnostic pop
#endif
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRM_PROPERTIES_EXT: {
VkPhysicalDeviceDrmPropertiesEXT *props =
(VkPhysicalDeviceDrmPropertiesEXT *)ext;