mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 05:08:08 +02:00
anv: adopt common Android gralloc helpers
u_gralloc will be initialized upon the initial vk_android_get_ugralloc. v2: drop explicit gralloc init Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> (v1) Acked-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35561>
This commit is contained in:
parent
896bda5143
commit
710282f83c
5 changed files with 10 additions and 24 deletions
|
|
@ -331,10 +331,11 @@ anv_android_get_tiling(struct anv_device *device,
|
|||
struct u_gralloc_buffer_handle *gr_handle,
|
||||
enum isl_tiling *tiling_out)
|
||||
{
|
||||
assert(device->u_gralloc);
|
||||
struct u_gralloc *gralloc = vk_android_get_ugralloc();
|
||||
assert(gralloc);
|
||||
|
||||
struct u_gralloc_buffer_basic_info buf_info;
|
||||
if (u_gralloc_get_buffer_basic_info(device->u_gralloc, gr_handle, &buf_info))
|
||||
if (u_gralloc_get_buffer_basic_info(gralloc, gr_handle, &buf_info))
|
||||
return vk_errorf(device, VK_ERROR_INVALID_EXTERNAL_HANDLE,
|
||||
"failed to get tiling from gralloc buffer info");
|
||||
|
||||
|
|
@ -385,7 +386,7 @@ anv_image_init_from_gralloc(struct anv_device *device,
|
|||
}
|
||||
|
||||
enum isl_tiling tiling;
|
||||
if (device->u_gralloc) {
|
||||
if (vk_android_get_ugralloc()) {
|
||||
struct u_gralloc_buffer_handle gr_handle = {
|
||||
.handle = gralloc_info->handle,
|
||||
.hal_format = gralloc_info->format,
|
||||
|
|
@ -644,10 +645,11 @@ VkResult anv_GetSwapchainGrallocUsage2ANDROID(
|
|||
*grallocConsumerUsage |= GRALLOC1_CONSUMER_USAGE_HWCOMPOSER;
|
||||
}
|
||||
|
||||
struct u_gralloc *gralloc = vk_android_get_ugralloc();
|
||||
if ((swapchainImageUsage & VK_SWAPCHAIN_IMAGE_USAGE_SHARED_BIT_ANDROID) &&
|
||||
device->u_gralloc != NULL) {
|
||||
gralloc) {
|
||||
uint64_t front_rendering_usage = 0;
|
||||
u_gralloc_get_front_rendering_usage(device->u_gralloc, &front_rendering_usage);
|
||||
u_gralloc_get_front_rendering_usage(gralloc, &front_rendering_usage);
|
||||
*grallocProducerUsage |= front_rendering_usage;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,9 +36,6 @@
|
|||
#include "util/os_file.h"
|
||||
#include "util/os_misc.h"
|
||||
#include "util/u_atomic.h"
|
||||
#if DETECT_OS_ANDROID
|
||||
#include "util/u_gralloc/u_gralloc.h"
|
||||
#endif
|
||||
#include "util/u_string.h"
|
||||
#include "vk_common_entrypoints.h"
|
||||
#include "vk_util.h"
|
||||
|
|
@ -912,10 +909,6 @@ VkResult anv_CreateDevice(
|
|||
goto fail_internal_cache;
|
||||
}
|
||||
|
||||
#if DETECT_OS_ANDROID
|
||||
device->u_gralloc = u_gralloc_create(U_GRALLOC_TYPE_AUTO);
|
||||
#endif
|
||||
|
||||
device->robust_buffer_access =
|
||||
device->vk.enabled_features.robustBufferAccess ||
|
||||
device->vk.enabled_features.nullDescriptor;
|
||||
|
|
@ -1157,10 +1150,6 @@ void anv_DestroyDevice(
|
|||
if (!device)
|
||||
return;
|
||||
|
||||
#if DETECT_OS_ANDROID
|
||||
u_gralloc_destroy(&device->u_gralloc);
|
||||
#endif
|
||||
|
||||
anv_memory_trace_finish(device);
|
||||
|
||||
struct anv_physical_device *pdevice = device->physical;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
#include "anv_private.h"
|
||||
#include "drm-uapi/drm_fourcc.h"
|
||||
#include "vk_android.h"
|
||||
#include "vk_enum_defines.h"
|
||||
#include "vk_enum_to_str.h"
|
||||
#include "vk_format.h"
|
||||
|
|
|
|||
|
|
@ -1266,11 +1266,9 @@ get_properties(const struct anv_physical_device *pdevice,
|
|||
#if DETECT_OS_ANDROID
|
||||
/* Used to fill struct VkPhysicalDevicePresentationPropertiesANDROID */
|
||||
uint64_t front_rendering_usage = 0;
|
||||
struct u_gralloc *gralloc = u_gralloc_create(U_GRALLOC_TYPE_AUTO);
|
||||
if (gralloc != NULL) {
|
||||
struct u_gralloc *gralloc = vk_android_get_ugralloc();
|
||||
if (gralloc != NULL)
|
||||
u_gralloc_get_front_rendering_usage(gralloc, &front_rendering_usage);
|
||||
u_gralloc_destroy(&gralloc);
|
||||
}
|
||||
#endif /* DETECT_OS_ANDROID */
|
||||
|
||||
struct anv_descriptor_limits desc_limits;
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@
|
|||
#include "util/xmlconfig.h"
|
||||
#include "vk_acceleration_structure.h"
|
||||
#include "vk_alloc.h"
|
||||
#include "vk_android.h"
|
||||
#include "vk_buffer.h"
|
||||
#include "vk_buffer_view.h"
|
||||
#include "vk_command_buffer.h"
|
||||
|
|
@ -2136,9 +2137,6 @@ struct anv_device {
|
|||
|
||||
uint32_t draw_call_count;
|
||||
struct anv_state breakpoint;
|
||||
#if DETECT_OS_ANDROID
|
||||
struct u_gralloc *u_gralloc;
|
||||
#endif
|
||||
|
||||
/** Precompute all dirty graphics bits
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue