From 643a8c6775a210b12bb0f76b04fca239e1cc2f2b Mon Sep 17 00:00:00 2001 From: Unknown <0.tamas.marton@gmail.com> Date: Mon, 30 Sep 2019 01:13:55 +0100 Subject: [PATCH] loader work pt2 --- QPUassembler/CMakeLists.txt | 2 +- brcm/CMakeLists.txt | 4 +-- driver/CMakeLists.txt | 2 +- driver/command.c | 2 +- driver/common.c | 8 ++--- driver/common.h | 1 + driver/compute.c | 8 ++--- driver/device.c | 16 +++++----- driver/draw.c | 4 +-- driver/instance.c | 58 +++++++------------------------------ driver/memory.c | 2 +- driver/pipeline.c | 8 ++--- driver/resource.c | 8 ++--- driver/shader.c | 2 +- driver/sparse.c | 10 +++---- driver/sync.c | 16 +++++----- driver/vkExt.h | 4 +-- driver/wsi.c | 10 ++++--- install.sh | 2 -- test/blending/blending.cpp | 42 +++++++++++++++++++++++++++ 20 files changed, 109 insertions(+), 100 deletions(-) diff --git a/QPUassembler/CMakeLists.txt b/QPUassembler/CMakeLists.txt index cafa34a..25bcad1 100644 --- a/QPUassembler/CMakeLists.txt +++ b/QPUassembler/CMakeLists.txt @@ -7,5 +7,5 @@ file(GLOB asmSrc "qpu_assembler.c" ) -add_library(QPUassembler SHARED ${asmSrc}) +add_library(QPUassembler OBJECT ${asmSrc}) target_compile_options(QPUassembler PRIVATE -Wall -Werror=implicit-function-declaration -std=c11) diff --git a/brcm/CMakeLists.txt b/brcm/CMakeLists.txt index 43b4c35..3aeeebd 100644 --- a/brcm/CMakeLists.txt +++ b/brcm/CMakeLists.txt @@ -22,7 +22,7 @@ else(CMD_ERROR2 STREQUAL "") message(FATAL_ERROR ${CMD_ERROR2}) endif(CMD_ERROR2 STREQUAL "") -add_library(brcm SHARED ${brcmSrc}) +add_library(brcm OBJECT ${brcmSrc}) target_compile_options(brcm PRIVATE -Wall -std=c99) -target_link_libraries(brcm expat z) +#target_link_libraries(brcm expat z) target_compile_definitions(brcm PRIVATE V3D_VERSION=21) diff --git a/driver/CMakeLists.txt b/driver/CMakeLists.txt index e500079..15c033d 100644 --- a/driver/CMakeLists.txt +++ b/driver/CMakeLists.txt @@ -6,4 +6,4 @@ file(GLOB driverSrc add_library(rpi-vk-driver SHARED ${driverSrc}) target_compile_options(rpi-vk-driver PRIVATE -Wall -Werror=implicit-function-declaration -std=c11) -target_link_libraries(rpi-vk-driver drm pthread brcm QPUassembler) +target_link_libraries(rpi-vk-driver drm pthread expat z $ $) diff --git a/driver/command.c b/driver/command.c index e51bb84..ea34c05 100644 --- a/driver/command.c +++ b/driver/command.c @@ -692,5 +692,5 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdSetDeviceMask( VkCommandBuffer commandBuffer, uint32_t deviceMask) { - UNSUPPORTED(vkCmdSetDeviceMask); + UNSUPPORTED(rpi_vkCmdSetDeviceMask); } diff --git a/driver/common.c b/driver/common.c index 27427ce..45edd0e 100644 --- a/driver/common.c +++ b/driver/common.c @@ -911,7 +911,7 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetPhysicalDeviceExternalBufferProperties( const VkPhysicalDeviceExternalBufferInfo* pExternalBufferInfo, VkExternalBufferProperties* pExternalBufferProperties) { - UNSUPPORTED(vkGetPhysicalDeviceExternalBufferProperties); + UNSUPPORTED(rpi_vkGetPhysicalDeviceExternalBufferProperties); } VKAPI_ATTR void VKAPI_CALL rpi_vkGetPhysicalDeviceExternalFenceProperties( @@ -919,7 +919,7 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetPhysicalDeviceExternalFenceProperties( const VkPhysicalDeviceExternalFenceInfo* pExternalFenceInfo, VkExternalFenceProperties* pExternalFenceProperties) { - UNSUPPORTED(vkGetPhysicalDeviceExternalFenceProperties); + UNSUPPORTED(rpi_vkGetPhysicalDeviceExternalFenceProperties); } @@ -928,7 +928,7 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetPhysicalDeviceExternalSemaphoreProperties( const VkPhysicalDeviceExternalSemaphoreInfo* pExternalSemaphoreInfo, VkExternalSemaphoreProperties* pExternalSemaphoreProperties) { - UNSUPPORTED(vkGetPhysicalDeviceExternalSemaphoreProperties); + UNSUPPORTED(rpi_vkGetPhysicalDeviceExternalSemaphoreProperties); } VKAPI_ATTR void VKAPI_CALL rpi_vkGetDeviceGroupPeerMemoryFeatures( @@ -938,5 +938,5 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetDeviceGroupPeerMemoryFeatures( uint32_t remoteDeviceIndex, VkPeerMemoryFeatureFlags* pPeerMemoryFeatures) { - UNSUPPORTED(vkGetDeviceGroupPeerMemoryFeatures); + UNSUPPORTED(rpi_vkGetDeviceGroupPeerMemoryFeatures); } diff --git a/driver/common.h b/driver/common.h index 6f496d5..c33243f 100644 --- a/driver/common.h +++ b/driver/common.h @@ -4,6 +4,7 @@ #include #include +#define VK_NO_PROTOTYPES #include #include #include "vkExt.h" diff --git a/driver/compute.c b/driver/compute.c index 49a4d25..de308f7 100644 --- a/driver/compute.c +++ b/driver/compute.c @@ -11,7 +11,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateComputePipelines( const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines) { - UNSUPPORTED(vkCreateComputePipelines); + UNSUPPORTED(rpi_vkCreateComputePipelines); return VK_SUCCESS; } @@ -20,7 +20,7 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdDispatchIndirect( VkBuffer buffer, VkDeviceSize offset) { - UNSUPPORTED(vkCmdDispatchIndirect); + UNSUPPORTED(rpi_vkCmdDispatchIndirect); } VKAPI_ATTR void VKAPI_CALL rpi_vkCmdDispatch( @@ -29,7 +29,7 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdDispatch( uint32_t groupCountY, uint32_t groupCountZ) { - UNSUPPORTED(vkCmdDispatch); + UNSUPPORTED(rpi_vkCmdDispatch); } VKAPI_ATTR void VKAPI_CALL rpi_vkCmdDispatchBase( @@ -41,5 +41,5 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdDispatchBase( uint32_t groupCountY, uint32_t groupCountZ) { - UNSUPPORTED(vkCmdDispatchBase); + UNSUPPORTED(rpi_vkCmdDispatchBase); } diff --git a/driver/device.c b/driver/device.c index 935ae59..ef2fc5e 100644 --- a/driver/device.c +++ b/driver/device.c @@ -1,5 +1,7 @@ #include "common.h" +#include "declarations.h" + /* * https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#devsandqueues-physical-device-enumeration * If pPhysicalDevices is NULL, then the number of physical devices available is returned in pPhysicalDeviceCount. Otherwise, pPhysicalDeviceCount must point to a @@ -310,7 +312,7 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetDeviceQueue2( //TODO handle pNext - vkGetDeviceQueue(device, pQueueInfo->queueFamilyIndex, pQueueInfo->queueIndex, pQueue); + rpi_vkGetDeviceQueue(device, pQueueInfo->queueFamilyIndex, pQueueInfo->queueIndex, pQueue); } /* @@ -422,7 +424,7 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetPhysicalDeviceProperties2( { assert(physicalDevice); assert(pProperties); - vkGetPhysicalDeviceProperties(physicalDevice, &pProperties->properties); + rpi_vkGetPhysicalDeviceProperties(physicalDevice, &pProperties->properties); if(pProperties->pNext) { @@ -518,7 +520,7 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetPhysicalDeviceFormatProperties2( { assert(physicalDevice); assert(pFormatProperties); - vkGetPhysicalDeviceFormatProperties(physicalDevice, format, &pFormatProperties->formatProperties); + rpi_vkGetPhysicalDeviceFormatProperties(physicalDevice, format, &pFormatProperties->formatProperties); } VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetPhysicalDeviceImageFormatProperties( @@ -653,7 +655,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetPhysicalDeviceImageFormatProperties2( //TODO handle pNext - return vkGetPhysicalDeviceImageFormatProperties(physicalDevice, + return rpi_vkGetPhysicalDeviceImageFormatProperties(physicalDevice, pImageFormatInfo->format, pImageFormatInfo->type, pImageFormatInfo->tiling, @@ -668,7 +670,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkEnumerateDeviceLayerProperties( VkLayerProperties* pProperties) { //deprecated, just return instance layers - return vkEnumerateInstanceLayerProperties(pPropertyCount, pProperties); + return rpi_vkEnumerateInstanceLayerProperties(pPropertyCount, pProperties); } VKAPI_ATTR void VKAPI_CALL rpi_vkGetPhysicalDeviceFeatures2( @@ -677,7 +679,7 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetPhysicalDeviceFeatures2( { assert(physicalDevice); assert(pFeatures); - vkGetPhysicalDeviceFeatures(physicalDevice, &pFeatures->features); + rpi_vkGetPhysicalDeviceFeatures(physicalDevice, &pFeatures->features); } VKAPI_ATTR void VKAPI_CALL rpi_vkGetPhysicalDeviceQueueFamilyProperties2( @@ -686,5 +688,5 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetPhysicalDeviceQueueFamilyProperties2( VkQueueFamilyProperties2* pQueueFamilyProperties) { assert(physicalDevice); - vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, pQueueFamilyPropertyCount, pQueueFamilyProperties); + rpi_vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, pQueueFamilyPropertyCount, pQueueFamilyProperties); } diff --git a/driver/draw.c b/driver/draw.c index 10e979e..80e2df9 100644 --- a/driver/draw.c +++ b/driver/draw.c @@ -480,7 +480,7 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdDrawIndexedIndirect( uint32_t drawCount, uint32_t stride) { - UNSUPPORTED(vkCmdDrawIndexedIndirect); + UNSUPPORTED(rpi_vkCmdDrawIndexedIndirect); } VKAPI_ATTR void VKAPI_CALL rpi_vkCmdDrawIndirect( @@ -490,5 +490,5 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdDrawIndirect( uint32_t drawCount, uint32_t stride) { - UNSUPPORTED(vkCmdDrawIndirect); + UNSUPPORTED(rpi_vkCmdDrawIndirect); } diff --git a/driver/instance.c b/driver/instance.c index 9576658..d3d5442 100644 --- a/driver/instance.c +++ b/driver/instance.c @@ -3,6 +3,7 @@ #include #include "declarations.h" +#include "vkExt.h" #define RETFUNC(f) if(!strcmp(pName, #f)) return rpi_##f @@ -18,64 +19,23 @@ VKAPI_ATTR VkResult VKAPI_CALL vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetInstanceProcAddr(VkInstance instance, const char* pName) { + fprintf(stderr, "-----------------vk_icdGetInstanceProcAddr: %s\n", pName); + if(loaderVersion == -1) { //dealing with legacy ICD loader, as vk_icdNegotiateLoaderICDInterfaceVersion has not been called loaderVersion = 1; } - RETFUNC(vkCreateInstance); - RETFUNC(vkEnumerateInstanceExtensionProperties); - RETFUNC(vkEnumerateInstanceVersion); - RETFUNC(vkDestroyInstance); - RETFUNC(vkEnumeratePhysicalDevices); - RETFUNC(vkGetInstanceProcAddr); - RETFUNC(vkEnumeratePhysicalDeviceGroups); - RETFUNC(vkDestroySurfaceKHR); - RETFUNC(vkGetPhysicalDeviceFeatures); - RETFUNC(vkGetPhysicalDeviceFeatures2); - RETFUNC(vkGetPhysicalDeviceProperties); - RETFUNC(vkGetPhysicalDeviceProperties2); - RETFUNC(vkGetPhysicalDeviceFormatProperties); - RETFUNC(vkGetPhysicalDeviceFormatProperties2); - RETFUNC(vkGetPhysicalDeviceImageFormatProperties); - RETFUNC(vkGetPhysicalDeviceImageFormatProperties2); - RETFUNC(vkGetPhysicalDeviceProperties); - RETFUNC(vkGetPhysicalDeviceProperties2); - RETFUNC(vkGetPhysicalDeviceQueueFamilyProperties); - RETFUNC(vkGetPhysicalDeviceQueueFamilyProperties2); - RETFUNC(vkGetPhysicalDeviceMemoryProperties); - RETFUNC(vkGetPhysicalDeviceMemoryProperties2); - RETFUNC(vkCreateDevice); - RETFUNC(vkDestroyDevice); - RETFUNC(vkEnumerateDeviceExtensionProperties); - RETFUNC(vkEnumerateDeviceLayerProperties); - - return 0; + return rpi_vkGetInstanceProcAddr(instance, pName); } VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetPhysicalDeviceProcAddr(VkInstance instance, const char* pName) { - RETFUNC(vkEnumeratePhysicalDevices); - RETFUNC(vkEnumeratePhysicalDeviceGroups); - RETFUNC(vkGetPhysicalDeviceFeatures); - RETFUNC(vkGetPhysicalDeviceFeatures2); - RETFUNC(vkGetPhysicalDeviceProperties); - RETFUNC(vkGetPhysicalDeviceProperties2); - RETFUNC(vkGetPhysicalDeviceFormatProperties); - RETFUNC(vkGetPhysicalDeviceFormatProperties2); - RETFUNC(vkGetPhysicalDeviceImageFormatProperties); - RETFUNC(vkGetPhysicalDeviceImageFormatProperties2); - RETFUNC(vkGetPhysicalDeviceProperties); - RETFUNC(vkGetPhysicalDeviceProperties2); - RETFUNC(vkGetPhysicalDeviceQueueFamilyProperties); - RETFUNC(vkGetPhysicalDeviceQueueFamilyProperties2); - RETFUNC(vkGetPhysicalDeviceMemoryProperties); - RETFUNC(vkGetPhysicalDeviceMemoryProperties2); - RETFUNC(vkCreateDevice); - RETFUNC(vkEnumerateDeviceExtensionProperties); - RETFUNC(vkEnumerateDeviceLayerProperties); + fprintf(stderr, "-----------------vk_icdGetPhysicalDeviceProcAddr: %s\n", pName); + + return 0; } @@ -235,6 +195,8 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL rpi_vkGetInstanceProcAddr( VkInstance instance, const char* pName) { + fprintf(stderr, "-----------------rpi_vkGetInstanceProcAddr: %s\n", pName); + //TODO take instance into consideration //eg only return extension functions that are enabled? @@ -414,6 +376,8 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL rpi_vkGetInstanceProcAddr( RETFUNC(vkGetDescriptorSetLayoutSupport); RETFUNC(vkBindBufferMemory2); + RETFUNC(vkCreateRpiSurfaceEXT); + RETFUNC(vkCreateShaderModuleFromRpiAssemblyEXT); return 0; } diff --git a/driver/memory.c b/driver/memory.c index b6d1f53..c13ab72 100644 --- a/driver/memory.c +++ b/driver/memory.c @@ -182,7 +182,7 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetPhysicalDeviceMemoryProperties2( VkPhysicalDeviceMemoryProperties2* pMemoryProperties) { assert(physicalDevice); - vkGetPhysicalDeviceMemoryProperties(physicalDevice, pMemoryProperties); + rpi_vkGetPhysicalDeviceMemoryProperties(physicalDevice, pMemoryProperties); } VKAPI_ATTR void VKAPI_CALL rpi_vkGetDeviceMemoryCommitment( diff --git a/driver/pipeline.c b/driver/pipeline.c index 458a63e..851807e 100644 --- a/driver/pipeline.c +++ b/driver/pipeline.c @@ -328,7 +328,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkMergePipelineCaches( uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches) { - UNSUPPORTED(vkMergePipelineCaches); + UNSUPPORTED(rpi_vkMergePipelineCaches); return VK_SUCCESS; } @@ -338,7 +338,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetPipelineCacheData( size_t* pDataSize, void* pData) { - UNSUPPORTED(vkGetPipelineCacheData); + UNSUPPORTED(rpi_vkGetPipelineCacheData); return VK_SUCCESS; } @@ -347,7 +347,7 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkDestroyPipelineCache( VkPipelineCache pipelineCache, const VkAllocationCallbacks* pAllocator) { - UNSUPPORTED(vkDestroyPipelineCache); + UNSUPPORTED(rpi_vkDestroyPipelineCache); } VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreatePipelineLayout( @@ -413,6 +413,6 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreatePipelineCache( const VkAllocationCallbacks* pAllocator, VkPipelineCache* pPipelineCache) { - UNSUPPORTED(vkCreatePipelineCache); + UNSUPPORTED(rpi_vkCreatePipelineCache); return VK_SUCCESS; } diff --git a/driver/resource.c b/driver/resource.c index ef16a53..fba2d8f 100644 --- a/driver/resource.c +++ b/driver/resource.c @@ -80,7 +80,7 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetBufferMemoryRequirements2( assert(pInfo); assert(pMemoryRequirements); - vkGetBufferMemoryRequirements(device, pInfo->buffer, &pMemoryRequirements->memoryRequirements); + rpi_vkGetBufferMemoryRequirements(device, pInfo->buffer, &pMemoryRequirements->memoryRequirements); } /* @@ -339,7 +339,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkBindBufferMemory2( for(uint32_t c = 0; c < bindInfoCount; ++c) { - VkResult res = vkBindBufferMemory(device, pBindInfos[c].buffer, pBindInfos[c].memory, pBindInfos[c].memoryOffset); + VkResult res = rpi_vkBindBufferMemory(device, pBindInfos[c].buffer, pBindInfos[c].memory, pBindInfos[c].memoryOffset); if(res != VK_SUCCESS) { ret = res; @@ -357,7 +357,7 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetImageMemoryRequirements2( assert(device); assert(pInfo); assert(pMemoryRequirements); - vkGetImageMemoryRequirements(device, pInfo->image, pMemoryRequirements); + rpi_vkGetImageMemoryRequirements(device, pInfo->image, pMemoryRequirements); } VKAPI_ATTR VkResult VKAPI_CALL rpi_vkBindImageMemory2( @@ -372,7 +372,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkBindImageMemory2( for(uint32_t c = 0; c < bindInfoCount; ++c) { - VkResult res = vkBindImageMemory(device, pBindInfos[c].image, pBindInfos[c].memory, pBindInfos[c].memoryOffset); + VkResult res = rpi_vkBindImageMemory(device, pBindInfos[c].image, pBindInfos[c].memory, pBindInfos[c].memoryOffset); if(res != VK_SUCCESS) { ret = res; diff --git a/driver/shader.c b/driver/shader.c index 7170c83..fbca0cf 100644 --- a/driver/shader.c +++ b/driver/shader.c @@ -116,7 +116,7 @@ VkResult rpi_vkCreateShaderModuleFromRpiAssemblyEXT(VkDevice device, VkRpiShader */ VkResult rpi_vkCreateShaderModule(VkDevice device, const VkShaderModuleCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkShaderModule* pShaderModule) { - UNSUPPORTED(vkCreateShaderModule); + UNSUPPORTED(rpi_vkCreateShaderModule); return VK_SUCCESS; } diff --git a/driver/sparse.c b/driver/sparse.c index ce4b685..619c652 100644 --- a/driver/sparse.c +++ b/driver/sparse.c @@ -10,7 +10,7 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetPhysicalDeviceSparseImageFormatProperties( uint32_t* pPropertyCount, VkSparseImageFormatProperties* pProperties) { - UNSUPPORTED(vkGetPhysicalDeviceSparseImageFormatProperties); + UNSUPPORTED(rpi_vkGetPhysicalDeviceSparseImageFormatProperties); } VKAPI_ATTR void VKAPI_CALL rpi_vkGetImageSparseMemoryRequirements( @@ -19,7 +19,7 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetImageSparseMemoryRequirements( uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements* pSparseMemoryRequirements) { - UNSUPPORTED(vkGetImageSparseMemoryRequirements); + UNSUPPORTED(rpi_vkGetImageSparseMemoryRequirements); } VKAPI_ATTR VkResult VKAPI_CALL rpi_vkQueueBindSparse( @@ -28,7 +28,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkQueueBindSparse( const VkBindSparseInfo* pBindInfo, VkFence fence) { - UNSUPPORTED(vkQueueBindSparse); + UNSUPPORTED(rpi_vkQueueBindSparse); return VK_SUCCESS; } @@ -38,7 +38,7 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetPhysicalDeviceSparseImageFormatProperties2( uint32_t* pPropertyCount, VkSparseImageFormatProperties2* pProperties) { - UNSUPPORTED(vkGetPhysicalDeviceSparseImageFormatProperties2); + UNSUPPORTED(rpi_vkGetPhysicalDeviceSparseImageFormatProperties2); } VKAPI_ATTR void VKAPI_CALL rpi_vkGetImageSparseMemoryRequirements2( @@ -47,5 +47,5 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetImageSparseMemoryRequirements2( uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2* pSparseMemoryRequirements) { - UNSUPPORTED(vkGetImageSparseMemoryRequirements2); + UNSUPPORTED(rpi_vkGetImageSparseMemoryRequirements2); } diff --git a/driver/sync.c b/driver/sync.c index 8a75ce6..2d03ecb 100644 --- a/driver/sync.c +++ b/driver/sync.c @@ -436,14 +436,14 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdWaitEvents( uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier* pImageMemoryBarriers) { - UNSUPPORTED(vkCmdWaitEvents); + UNSUPPORTED(rpi_vkCmdWaitEvents); } VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetEventStatus( VkDevice device, VkEvent event) { - UNSUPPORTED(vkGetEventStatus); + UNSUPPORTED(rpi_vkGetEventStatus); return VK_SUCCESS; } @@ -452,7 +452,7 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkDestroyEvent( VkEvent event, const VkAllocationCallbacks* pAllocator) { - UNSUPPORTED(vkDestroyEvent); + UNSUPPORTED(rpi_vkDestroyEvent); } VKAPI_ATTR void VKAPI_CALL rpi_vkCmdResetEvent( @@ -460,7 +460,7 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdResetEvent( VkEvent event, VkPipelineStageFlags stageMask) { - UNSUPPORTED(vkCmdResetEvent); + UNSUPPORTED(rpi_vkCmdResetEvent); } VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateEvent( @@ -469,7 +469,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateEvent( const VkAllocationCallbacks* pAllocator, VkEvent* pEvent) { - UNSUPPORTED(vkCreateEvent); + UNSUPPORTED(rpi_vkCreateEvent); return VK_SUCCESS; } @@ -477,7 +477,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkResetEvent( VkDevice device, VkEvent event) { - UNSUPPORTED(vkResetEvent); + UNSUPPORTED(rpi_vkResetEvent); return VK_SUCCESS; } @@ -485,7 +485,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkSetEvent( VkDevice device, VkEvent event) { - UNSUPPORTED(vkSetEvent); + UNSUPPORTED(rpi_vkSetEvent); return VK_SUCCESS; } @@ -494,5 +494,5 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdSetEvent( VkEvent event, VkPipelineStageFlags stageMask) { - UNSUPPORTED(vkCmdSetEvent); + UNSUPPORTED(rpi_vkCmdSetEvent); } diff --git a/driver/vkExt.h b/driver/vkExt.h index 733ad78..92204f6 100644 --- a/driver/vkExt.h +++ b/driver/vkExt.h @@ -76,14 +76,14 @@ typedef struct VkRpiShaderModuleAssemblyCreateInfoEXT { //extension name something like: VK_KHR_rpi_surface //extension that allows developers to create a surface to render to on Raspbian Stretch Lite -VkResult vkCreateRpiSurfaceEXT( +VkResult rpi_vkCreateRpiSurfaceEXT( VkInstance instance, const VkRpiSurfaceCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); //extension that allows developers to submit QPU assembly directly and thus hand optimise code -VkResult vkCreateShaderModuleFromRpiAssemblyEXT( +VkResult rpi_vkCreateShaderModuleFromRpiAssemblyEXT( VkDevice device, VkRpiShaderModuleAssemblyCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, diff --git a/driver/wsi.c b/driver/wsi.c index 9348188..da843ee 100644 --- a/driver/wsi.c +++ b/driver/wsi.c @@ -3,6 +3,8 @@ #include "kernel/vc4_packet.h" +#include "declarations.h" + /* * Implementation of our RPI specific "extension" */ @@ -234,7 +236,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateSwapchainKHR( VkMemoryRequirements mr; - vkGetImageMemoryRequirements(device, &s->images[c], &mr); + rpi_vkGetImageMemoryRequirements(device, &s->images[c], &mr); //TODO is this the right place to do this? s->images[c].tiling = VC4_TILING_FORMAT_T; @@ -253,9 +255,9 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateSwapchainKHR( } VkDeviceMemory mem; - vkAllocateMemory(device, &ai, 0, &mem); + rpi_vkAllocateMemory(device, &ai, 0, &mem); - vkBindImageMemory(device, &s->images[c], mem, 0); + rpi_vkBindImageMemory(device, &s->images[c], mem, 0); //set tiling to T if size > 4KB if(s->images[c].tiling == VC4_TILING_FORMAT_T) @@ -408,7 +410,7 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkDestroySwapchainKHR( { for(int c = 0; c < s->numImages; ++c) { - vkFreeMemory(device, s->images[c].boundMem, 0); + rpi_vkFreeMemory(device, s->images[c].boundMem, 0); modeset_destroy_fb(controlFd, &s->images[c]); } diff --git a/install.sh b/install.sh index 57a6f5f..58c6983 100755 --- a/install.sh +++ b/install.sh @@ -2,7 +2,5 @@ mkdir -p $HOME/.rpi-vk-driver/ cp librpi-vk-driver.so $HOME/.rpi-vk-driver/ -cp libQPUassembler.so $HOME/.rpi-vk-driver/ -cp libbrcm.so $HOME/.rpi-vk-driver/ mkdir -p $HOME/.local/share/vulkan/icd.d/ cp rpi-vk-driver.json $HOME/.local/share/vulkan/icd.d/ \ No newline at end of file diff --git a/test/blending/blending.cpp b/test/blending/blending.cpp index 71ffac1..666563e 100644 --- a/test/blending/blending.cpp +++ b/test/blending/blending.cpp @@ -158,6 +158,42 @@ void mainLoop() { } } +VkBool32 debugCallback( + VkDebugReportFlagsEXT flags, + VkDebugReportObjectTypeEXT objectType, + uint64_t object, + size_t location, + int32_t messageCode, + const char* pLayerPrefix, + const char* pMessage, + void* pUserData) +{ + std::cerr << "Debug callback: "; + if(flags & VK_DEBUG_REPORT_INFORMATION_BIT_EXT) + std::cerr << "info "; + + if(flags & VK_DEBUG_REPORT_WARNING_BIT_EXT) + std::cerr << "warn "; + if(flags & VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT) + std::cerr << "perf "; + + if(flags & VK_DEBUG_REPORT_ERROR_BIT_EXT) + std::cerr << "error "; + + if(flags & VK_DEBUG_REPORT_DEBUG_BIT_EXT) + std::cerr << "debug "; + + std::cerr << std::endl + << "object type: " << objectType + << " object: " << object + << " location: " << location + << " message code: " << messageCode << std::endl + << " layer prefix: " << pLayerPrefix << std::endl + << " message: " << pMessage + << std::endl; + +} + void createInstance() { VkApplicationInfo appInfo = {}; appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO; @@ -190,8 +226,14 @@ void createInstance() { std::cout << "\t" << extension.extensionName << std::endl; } + VkDebugReportCallbackCreateInfoEXT debugCallbackInfo = {}; + debugCallbackInfo.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT; + debugCallbackInfo.flags = 0xffffffff; + debugCallbackInfo.pfnCallback = (PFN_vkDebugReportCallbackEXT)debugCallback; + VkInstanceCreateInfo createInfo = {}; createInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; + createInfo.pNext = &debugCallbackInfo; createInfo.pApplicationInfo = &appInfo; //createInfo.enabledExtensionCount = glfwExtensionCount; createInfo.enabledExtensionCount = 0;