Commit 9fa6fc9b authored by Brian Ho's avatar Brian Ho Committed by Commit Bot

Revert "gpu: Load vk functions for querying image/buffer properties"

This reverts commit 1ffb3583.

Reason for revert: This CL breaks Vulkan support for any client running
a Vulkan version earlier than 1.1. The reason for this is that in the
generator, we specify |'min_api_version': 'VK_VERSION_1_1'|, which gets
translated into |if (api_version >= VK_VERSION_1_1)|.

The issue here is that |api_version| is a Vulkan API version which is a
multi-part version number packed into a 32 bit int [1]. VK_VERSION_1_1
on the other hand, is defined as 1 [2], so the version check will
always pass. What we want here is actually VK_API_VERSION_1_1.

I will revert my CL and then upload a CL that fixes my code and all of
the existing code in this generator that uses VK_VERSION_1_1.

[1] https://vulkan.lunarg.com/doc/view/1.0.30.0/linux/vkspec.chunked/ch02s09.html
[2] https://cs.chromium.org/chromium/src/third_party/glfw/src/deps/vulkan/vulkan_core.h?l=3641&rcl=2de2589f910b1a85905f425be4d32f33cec092df

Original change's description:
> gpu: Load vk functions for querying image/buffer properties
> 
> This CL registers a few functions in the Vulkan binding generator script
> to be used for importing dma-bufs as VkImages [1] with the end
> goal of supporting WebGPU on Chrome OS. In particular, we add:
> 
> - vkGetPhysicalDeviceImageFormatProperties2: allows us to query if the
> physical device supports importing dma-bufs into Vulkan via the
> VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT flag [2].
> - vkGetMemoryFdPropertiesKHR: allows us to list the types of memory that
> our buffer backed by a dma-buf can be imported as.
> - vkGetImageMemoryRequirements2: allows us to list the types of memory
> supported by a given VkImage which can be compared to the output of
> vkGetMemoryFdPropertiesKHR to determine a suitable memory type for
> import.
> 
> [1] https://chromium-review.googlesource.com/c/chromium/src/+/1796049
> [2] https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkExternalMemoryHandleTypeFlagBits.html
> 
> BUG=996470
> TEST=ran the script and used the newly bound functions
> 
> Change-Id: I0f61e531009596d7237153f203084639e649afd7
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1794142
> Reviewed-by: Daniele Castagna <dcastagna@chromium.org>
> Reviewed-by: Peng Huang <penghuang@chromium.org>
> Commit-Queue: Brian Ho <hob@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#695296}

TBR=penghuang@chromium.org,dcastagna@chromium.org,hob@chromium.org

Change-Id: Ia1dd50f868aa482bfef6a60e63d0d696c6e309d3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 996470
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1796527Reviewed-by: default avatarDaniele Castagna <dcastagna@chromium.org>
Commit-Queue: Daniele Castagna <dcastagna@chromium.org>
Cr-Commit-Position: refs/heads/master@{#695385}
parent a932406e
......@@ -70,12 +70,6 @@ VULKAN_INSTANCE_FUNCTIONS = [
'vkCreateImagePipeSurfaceFUCHSIA',
]
},
{
'min_api_version': 'VK_VERSION_1_1',
'functions': [
'vkGetPhysicalDeviceImageFormatProperties2',
]
},
{
# vkGetPhysicalDeviceFeatures2() is defined in Vulkan 1.1 or suffixed in the
# VK_KHR_get_physical_device_properties2 extension.
......@@ -147,12 +141,6 @@ VULKAN_DEVICE_FUNCTIONS = [
'vkWaitForFences',
]
},
{
'min_api_version': 'VK_VERSION_1_1',
'functions': [
'vkGetImageMemoryRequirements2',
]
},
{
'ifdef': 'defined(OS_ANDROID)',
'extension':
......@@ -173,8 +161,7 @@ VULKAN_DEVICE_FUNCTIONS = [
'ifdef': 'defined(OS_LINUX)',
'extension': 'VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME',
'functions': [
'vkGetMemoryFdKHR',
'vkGetMemoryFdPropertiesKHR',
'vkGetMemoryFdKHR'
]
},
{
......
......@@ -246,18 +246,6 @@ bool VulkanFunctionPointers::BindInstanceFunctionPointers(
}
#endif // defined(OS_FUCHSIA)
if (api_version >= VK_VERSION_1_1) {
vkGetPhysicalDeviceImageFormatProperties2Fn =
reinterpret_cast<PFN_vkGetPhysicalDeviceImageFormatProperties2>(
vkGetInstanceProcAddrFn(
vk_instance, "vkGetPhysicalDeviceImageFormatProperties2"));
if (!vkGetPhysicalDeviceImageFormatProperties2Fn) {
DLOG(WARNING) << "Failed to bind vulkan entrypoint: "
<< "vkGetPhysicalDeviceImageFormatProperties2";
return false;
}
}
if (api_version >= VK_VERSION_1_1) {
vkGetPhysicalDeviceFeatures2Fn =
reinterpret_cast<PFN_vkGetPhysicalDeviceFeatures2>(
......@@ -727,17 +715,6 @@ bool VulkanFunctionPointers::BindDeviceFunctionPointers(
return false;
}
if (api_version >= VK_VERSION_1_1) {
vkGetImageMemoryRequirements2Fn =
reinterpret_cast<PFN_vkGetImageMemoryRequirements2>(
vkGetDeviceProcAddrFn(vk_device, "vkGetImageMemoryRequirements2"));
if (!vkGetImageMemoryRequirements2Fn) {
DLOG(WARNING) << "Failed to bind vulkan entrypoint: "
<< "vkGetImageMemoryRequirements2";
return false;
}
}
#if defined(OS_ANDROID)
if (gfx::HasExtension(
enabled_extensions,
......@@ -785,15 +762,6 @@ bool VulkanFunctionPointers::BindDeviceFunctionPointers(
<< "vkGetMemoryFdKHR";
return false;
}
vkGetMemoryFdPropertiesKHRFn =
reinterpret_cast<PFN_vkGetMemoryFdPropertiesKHR>(
vkGetDeviceProcAddrFn(vk_device, "vkGetMemoryFdPropertiesKHR"));
if (!vkGetMemoryFdPropertiesKHRFn) {
DLOG(WARNING) << "Failed to bind vulkan entrypoint: "
<< "vkGetMemoryFdPropertiesKHR";
return false;
}
}
#endif // defined(OS_LINUX)
......
......@@ -107,9 +107,6 @@ struct VulkanFunctionPointers {
nullptr;
#endif // defined(OS_FUCHSIA)
PFN_vkGetPhysicalDeviceImageFormatProperties2
vkGetPhysicalDeviceImageFormatProperties2Fn = nullptr;
PFN_vkGetPhysicalDeviceFeatures2 vkGetPhysicalDeviceFeatures2Fn = nullptr;
// Device functions
......@@ -168,8 +165,6 @@ struct VulkanFunctionPointers {
PFN_vkUpdateDescriptorSets vkUpdateDescriptorSetsFn = nullptr;
PFN_vkWaitForFences vkWaitForFencesFn = nullptr;
PFN_vkGetImageMemoryRequirements2 vkGetImageMemoryRequirements2Fn = nullptr;
#if defined(OS_ANDROID)
PFN_vkGetAndroidHardwareBufferPropertiesANDROID
vkGetAndroidHardwareBufferPropertiesANDROIDFn = nullptr;
......@@ -182,7 +177,6 @@ struct VulkanFunctionPointers {
#if defined(OS_LINUX)
PFN_vkGetMemoryFdKHR vkGetMemoryFdKHRFn = nullptr;
PFN_vkGetMemoryFdPropertiesKHR vkGetMemoryFdPropertiesKHRFn = nullptr;
#endif // defined(OS_LINUX)
#if defined(OS_FUCHSIA)
......@@ -267,9 +261,6 @@ struct VulkanFunctionPointers {
gpu::GetVulkanFunctionPointers()->vkCreateImagePipeSurfaceFUCHSIAFn
#endif // defined(OS_FUCHSIA)
#define vkGetPhysicalDeviceImageFormatProperties2 \
gpu::GetVulkanFunctionPointers()->vkGetPhysicalDeviceImageFormatProperties2Fn
#define vkGetPhysicalDeviceFeatures2 \
gpu::GetVulkanFunctionPointers()->vkGetPhysicalDeviceFeatures2Fn
......@@ -359,9 +350,6 @@ struct VulkanFunctionPointers {
gpu::GetVulkanFunctionPointers()->vkUpdateDescriptorSetsFn
#define vkWaitForFences gpu::GetVulkanFunctionPointers()->vkWaitForFencesFn
#define vkGetImageMemoryRequirements2 \
gpu::GetVulkanFunctionPointers()->vkGetImageMemoryRequirements2Fn
#if defined(OS_ANDROID)
#define vkGetAndroidHardwareBufferPropertiesANDROID \
gpu::GetVulkanFunctionPointers() \
......@@ -377,8 +365,6 @@ struct VulkanFunctionPointers {
#if defined(OS_LINUX)
#define vkGetMemoryFdKHR gpu::GetVulkanFunctionPointers()->vkGetMemoryFdKHRFn
#define vkGetMemoryFdPropertiesKHR \
gpu::GetVulkanFunctionPointers()->vkGetMemoryFdPropertiesKHRFn
#endif // defined(OS_LINUX)
#if defined(OS_FUCHSIA)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment