vulkan: remove the temp hack for VK_ANDROID_native_buffer and regen framework
Previously the VK_ANDROID_native_buffer spec in the Vulkan registry is out of
date. Since the upstream Vulkan registry has been fixed and imported to the
Android downstream now, this change removes the hack and regenerate the Vulkan
framework.
This change also fixes below bugs:
1. Some device apis are treated as non-device.
2. The last command in the registry is ignored.
Bug: 134711355
Test: Build, flash and dEQP tests
Change-Id: I4eb77faf38b466f76caefdabb19a4d67a8ea789e
diff --git a/vulkan/libvulkan/driver_gen.cpp b/vulkan/libvulkan/driver_gen.cpp
index 3495861..4ea5a61 100644
--- a/vulkan/libvulkan/driver_gen.cpp
+++ b/vulkan/libvulkan/driver_gen.cpp
@@ -544,9 +544,9 @@
INIT_PROC_EXT(KHR_bind_memory2, true, dev, BindImageMemory2KHR);
INIT_PROC(false, dev, GetDeviceQueue2);
INIT_PROC_EXT(ANDROID_native_buffer, false, dev, GetSwapchainGrallocUsageANDROID);
+ INIT_PROC_EXT(ANDROID_native_buffer, false, dev, GetSwapchainGrallocUsage2ANDROID);
INIT_PROC_EXT(ANDROID_native_buffer, true, dev, AcquireImageANDROID);
INIT_PROC_EXT(ANDROID_native_buffer, true, dev, QueueSignalReleaseImageANDROID);
- INIT_PROC_EXT(ANDROID_native_buffer, false, dev, GetSwapchainGrallocUsage2ANDROID);
// clang-format on
return success;
diff --git a/vulkan/libvulkan/driver_gen.h b/vulkan/libvulkan/driver_gen.h
index 79f070c..f4182c7 100644
--- a/vulkan/libvulkan/driver_gen.h
+++ b/vulkan/libvulkan/driver_gen.h
@@ -91,9 +91,9 @@
PFN_vkBindImageMemory2KHR BindImageMemory2KHR;
PFN_vkGetDeviceQueue2 GetDeviceQueue2;
PFN_vkGetSwapchainGrallocUsageANDROID GetSwapchainGrallocUsageANDROID;
+ PFN_vkGetSwapchainGrallocUsage2ANDROID GetSwapchainGrallocUsage2ANDROID;
PFN_vkAcquireImageANDROID AcquireImageANDROID;
PFN_vkQueueSignalReleaseImageANDROID QueueSignalReleaseImageANDROID;
- PFN_vkGetSwapchainGrallocUsage2ANDROID GetSwapchainGrallocUsage2ANDROID;
// clang-format on
};
diff --git a/vulkan/nulldrv/null_driver_gen.cpp b/vulkan/nulldrv/null_driver_gen.cpp
index 7c9b0c0..b8d7d2b 100644
--- a/vulkan/nulldrv/null_driver_gen.cpp
+++ b/vulkan/nulldrv/null_driver_gen.cpp
@@ -16,10 +16,10 @@
// WARNING: This file is generated. See ../README.md for instructions.
-#include "null_driver_gen.h"
-
#include <algorithm>
+#include "null_driver_gen.h"
+
using namespace null_driver;
namespace {
diff --git a/vulkan/nulldrv/null_driver_gen.h b/vulkan/nulldrv/null_driver_gen.h
index 70ef340..668dc7d 100644
--- a/vulkan/nulldrv/null_driver_gen.h
+++ b/vulkan/nulldrv/null_driver_gen.h
@@ -204,9 +204,9 @@
VKAPI_ATTR void GetDeviceQueue2(VkDevice device, const VkDeviceQueueInfo2* pQueueInfo, VkQueue* pQueue);
VKAPI_ATTR void GetDescriptorSetLayoutSupport(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, VkDescriptorSetLayoutSupport* pSupport);
VKAPI_ATTR VkResult GetSwapchainGrallocUsageANDROID(VkDevice device, VkFormat format, VkImageUsageFlags imageUsage, int* grallocUsage);
+VKAPI_ATTR VkResult GetSwapchainGrallocUsage2ANDROID(VkDevice device, VkFormat format, VkImageUsageFlags imageUsage, VkSwapchainImageUsageFlagsANDROID swapchainImageUsage, uint64_t* grallocConsumerUsage, uint64_t* grallocProducerUsage);
VKAPI_ATTR VkResult AcquireImageANDROID(VkDevice device, VkImage image, int nativeFenceFd, VkSemaphore semaphore, VkFence fence);
VKAPI_ATTR VkResult QueueSignalReleaseImageANDROID(VkQueue queue, uint32_t waitSemaphoreCount, const VkSemaphore* pWaitSemaphores, VkImage image, int* pNativeFenceFd);
-VKAPI_ATTR VkResult GetSwapchainGrallocUsage2ANDROID(VkDevice device, VkFormat format, VkImageUsageFlags imageUsage, VkSwapchainImageUsageFlagsANDROID swapchainImageUsage, uint64_t* grallocConsumerUsage, uint64_t* grallocProducerUsage);
VKAPI_ATTR VkResult GetSwapchainGrallocUsageANDROID(VkDevice device, VkFormat format, VkImageUsageFlags imageUsage, int* grallocUsage);
VKAPI_ATTR VkResult AcquireImageANDROID(VkDevice device, VkImage image, int nativeFenceFd, VkSemaphore semaphore, VkFence fence);
VKAPI_ATTR VkResult QueueSignalReleaseImageANDROID(VkQueue queue, uint32_t waitSemaphoreCount, const VkSemaphore* pWaitSemaphores, VkImage image, int* pNativeFenceFd);
diff --git a/vulkan/scripts/generator_common.py b/vulkan/scripts/generator_common.py
index d9f97e1..fe9dab4 100644
--- a/vulkan/scripts/generator_common.py
+++ b/vulkan/scripts/generator_common.py
@@ -127,7 +127,7 @@
'VkCommandBuffer ' : 'Device'
}
- if len(paramDict[functionName])>0:
+ if len(paramDict[functionName]) > 0:
return switchCase.get(paramDict[functionName][0][0], 'Global')
return 'Global'
@@ -150,7 +150,7 @@
def clang_off(f, indent):
f.write (clang_off_spaces * indent + '// clang-format off\n')
-clang_off_spaces = ' '*4
+clang_off_spaces = ' ' * 4
parametersList = []
paramDict = {}
@@ -166,16 +166,13 @@
vulkan_registry = os.path.join(os.path.dirname(__file__),'..','..','..','..','external','vulkan-headers','registry','vk.xml')
tree = ET.parse(vulkan_registry)
root = tree.getroot()
- protoset = False
- fnName = ""
- fnType = ""
for commands in root.iter('commands'):
for command in commands:
if command.tag == 'command':
- if protoset == True:
- paramDict[fnName] = parametersList.copy()
parametersList.clear()
protoset = False
+ fnName = ""
+ fnType = ""
if command.get('alias') != None:
alias = command.get('alias')
fnName = command.get('name')
@@ -184,20 +181,20 @@
paramDict[fnName] = paramDict[alias].copy()
returnTypeDict[fnName] = returnTypeDict[alias]
for params in command:
- if(params.tag == 'param'):
+ if params.tag == 'param':
paramtype = ""
- if params.text!=None:
- paramtype = params.text
+ if params.text != None and params.text.strip() != '':
+ paramtype = params.text.strip() + ' '
typeval = params.find('type')
paramtype = paramtype + typeval.text
- if typeval.tail!=None:
- paramtype = paramtype + typeval.tail
+ if typeval.tail != None:
+ paramtype += typeval.tail.strip() + ' '
pname = params.find('name')
paramname = pname.text
- if pname.tail != None:
- parametersList.append((paramtype,paramname,pname.tail))
+ if pname.tail != None and pname.tail.strip() != '':
+ parametersList.append((paramtype, paramname, pname.tail.strip()))
else:
- parametersList.append((paramtype,paramname))
+ parametersList.append((paramtype, paramname))
if params.tag == 'proto':
for c in params:
if c.tag == 'type':
@@ -207,6 +204,8 @@
protoset = True
allCommandsList.append(fnName)
returnTypeDict[fnName] = fnType
+ if protoset == True:
+ paramDict[fnName] = parametersList.copy()
for exts in root.iter('extensions'):
for extension in exts:
@@ -214,7 +213,7 @@
if extension.tag == 'extension':
extname = extension.get('name')
for req in extension:
- if req.get('feature')!=None:
+ if req.get('feature') != None:
apiversion = req.get('feature')
for commands in req:
if commands.tag == 'command':
@@ -224,19 +223,6 @@
if apiversion != "":
versionDict[commandname] = apiversion
- # TODO(adsrini): http://b/136570819
- extensionsDict['vkGetSwapchainGrallocUsage2ANDROID'] = 'VK_ANDROID_native_buffer'
- allCommandsList.append('vkGetSwapchainGrallocUsage2ANDROID')
- returnTypeDict['vkGetSwapchainGrallocUsage2ANDROID'] = 'VkResult'
- paramDict['vkGetSwapchainGrallocUsage2ANDROID'] = [
- ('VkDevice ', 'device'),
- ('VkFormat ', 'format'),
- ('VkImageUsageFlags ', 'imageUsage'),
- ('VkSwapchainImageUsageFlagsANDROID ', 'swapchainImageUsage'),
- ('uint64_t* ', 'grallocConsumerUsage'),
- ('uint64_t* ', 'grallocProducerUsage')
- ]
-
for feature in root.iter('feature'):
apiversion = feature.get('name')
for req in feature: