mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2024-11-23 18:24:13 +08:00
turnip: Make Android platform build
We still don't have a way to keep this from breaking, but I don't think this ever built. Let's call it progress. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4478>
This commit is contained in:
parent
97578c69e8
commit
5789505ab3
@ -92,6 +92,12 @@ if with_platform_drm
|
||||
libtu_files += files('tu_wsi_display.c')
|
||||
endif
|
||||
|
||||
if with_platform_android
|
||||
tu_flags += '-DVK_USE_PLATFORM_ANDROID_KHR'
|
||||
libtu_files += files('tu_android.c')
|
||||
tu_deps += [dep_android]
|
||||
endif
|
||||
|
||||
if with_xlib_lease
|
||||
tu_deps += [dep_xcb_xrandr, dep_xlib_xrandr]
|
||||
tu_flags += '-DVK_USE_PLATFORM_XLIB_XRANDR_EXT'
|
||||
|
@ -119,7 +119,6 @@ tu_image_from_gralloc(VkDevice device_h,
|
||||
TU_FROM_HANDLE(tu_device, device, device_h);
|
||||
VkImage image_h = VK_NULL_HANDLE;
|
||||
struct tu_image *image = NULL;
|
||||
struct tu_bo *bo = NULL;
|
||||
VkResult result;
|
||||
|
||||
result = tu_image_create(device_h, base_info, alloc, &image_h,
|
||||
@ -151,37 +150,20 @@ tu_image_from_gralloc(VkDevice device_h,
|
||||
.image = image_h
|
||||
};
|
||||
|
||||
const VkImportMemoryFdInfo import_info = {
|
||||
.sType = VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO,
|
||||
const VkImportMemoryFdInfoKHR import_info = {
|
||||
.sType = VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR,
|
||||
.pNext = &ded_alloc,
|
||||
.handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT,
|
||||
.fd = dup(dma_buf),
|
||||
};
|
||||
/* Find the first VRAM memory type, or GART for PRIME images. */
|
||||
int memory_type_index = -1;
|
||||
for (int i = 0;
|
||||
i < device->physical_device->memory_properties.memoryTypeCount; ++i) {
|
||||
bool is_local =
|
||||
!!(device->physical_device->memory_properties.memoryTypes[i]
|
||||
.propertyFlags &
|
||||
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
|
||||
if (is_local) {
|
||||
memory_type_index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* fallback */
|
||||
if (memory_type_index == -1)
|
||||
memory_type_index = 0;
|
||||
|
||||
result =
|
||||
tu_AllocateMemory(device_h,
|
||||
&(VkMemoryAllocateInfo) {
|
||||
.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
|
||||
.pNext = &import_info,
|
||||
.allocationSize = image->size,
|
||||
.memoryTypeIndex = memory_type_index,
|
||||
.allocationSize = image->layout.size,
|
||||
.memoryTypeIndex = 0,
|
||||
},
|
||||
alloc, &memory_h);
|
||||
if (result != VK_SUCCESS)
|
||||
@ -196,7 +178,6 @@ tu_image_from_gralloc(VkDevice device_h,
|
||||
return VK_SUCCESS;
|
||||
|
||||
fail_create_image:
|
||||
fail_size:
|
||||
tu_DestroyImage(device_h, image_h, alloc);
|
||||
|
||||
return result;
|
||||
@ -288,6 +269,19 @@ tu_GetSwapchainGrallocUsageANDROID(VkDevice device_h,
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VkResult
|
||||
tu_GetSwapchainGrallocUsage2ANDROID(VkDevice device,
|
||||
VkFormat format,
|
||||
VkImageUsageFlags imageUsage,
|
||||
VkSwapchainImageUsageFlagsANDROID swapchainImageUsage,
|
||||
uint64_t *grallocConsumerUsage,
|
||||
uint64_t *grallocProducerUsage)
|
||||
{
|
||||
tu_stub();
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VkResult
|
||||
tu_AcquireImageANDROID(VkDevice device,
|
||||
VkImage image_h,
|
||||
|
@ -78,6 +78,7 @@ EXTENSIONS = [
|
||||
Extension('VK_EXT_external_memory_dma_buf', 1, True),
|
||||
Extension('VK_EXT_image_drm_format_modifier', 1, False),
|
||||
Extension('VK_EXT_transform_feedback', 1, True),
|
||||
Extension('VK_ANDROID_native_buffer', 1, True),
|
||||
Extension('VK_KHR_external_semaphore_fd', 1, True),
|
||||
Extension('VK_KHR_external_fence_fd', 1, True),
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user