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
This commit is contained in:
Yiwei Zhang 2019-09-23 15:17:22 -07:00
parent 7e5d85ab04
commit 4bc489bb99
5 changed files with 20 additions and 34 deletions

View file

@ -544,9 +544,9 @@ bool InitDriverTable(VkDevice dev,
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;

View file

@ -91,9 +91,9 @@ struct DeviceDriverTable {
PFN_vkBindImageMemory2KHR BindImageMemory2KHR;
PFN_vkGetDeviceQueue2 GetDeviceQueue2;
PFN_vkGetSwapchainGrallocUsageANDROID GetSwapchainGrallocUsageANDROID;
PFN_vkGetSwapchainGrallocUsage2ANDROID GetSwapchainGrallocUsage2ANDROID;
PFN_vkAcquireImageANDROID AcquireImageANDROID;
PFN_vkQueueSignalReleaseImageANDROID QueueSignalReleaseImageANDROID;
PFN_vkGetSwapchainGrallocUsage2ANDROID GetSwapchainGrallocUsage2ANDROID;
// clang-format on
};

View file

@ -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 {

View file

@ -204,9 +204,9 @@ VKAPI_ATTR void DestroySamplerYcbcrConversion(VkDevice device, VkSamplerYcbcrCon
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);

View file

@ -127,7 +127,7 @@ def getDispatchTableType(functionName):
'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_on(f, indent):
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 @@ def parseVulkanRegistry():
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 @@ def parseVulkanRegistry():
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 @@ def parseVulkanRegistry():
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 @@ def parseVulkanRegistry():
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 @@ def parseVulkanRegistry():
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: