mirror of
https://github.com/Yours3lf/rpi-vk-driver.git
synced 2024-11-28 10:24:15 +01:00
even more CTS fixes
changed back to one FD per process as apparently they are shared. I just need to make sure that I close the FD when the last instance is destroyed. the kernel side driver should be able to handle this properly
This commit is contained in:
parent
5b767c2bc7
commit
1696c03670
@ -4,6 +4,6 @@ file(GLOB driverSrc
|
||||
)
|
||||
|
||||
add_library(vulkan-1-rpi SHARED ${driverSrc})
|
||||
target_compile_options(vulkan-1-rpi PRIVATE -Wall -Werror=implicit-function-declaration -std=c99)
|
||||
target_compile_options(vulkan-1-rpi PRIVATE -Wall -Werror=implicit-function-declaration -std=c11)
|
||||
|
||||
target_link_libraries(vulkan-1-rpi drm pthread brcm)
|
||||
|
@ -335,7 +335,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkQueueSubmit(
|
||||
|
||||
//submit ioctl
|
||||
static uint64_t lastFinishedSeqno = 0;
|
||||
vc4_cl_submit(queue->dev->dev->instance->controlFd, &cmdbuf->submitCl, &queue->lastEmitSeqno, &lastFinishedSeqno);
|
||||
vc4_cl_submit(controlFd, &cmdbuf->submitCl, &queue->lastEmitSeqno, &lastFinishedSeqno);
|
||||
}
|
||||
|
||||
for(int c = 0; c < pSubmits->commandBufferCount; ++c)
|
||||
|
@ -990,3 +990,83 @@ VKAPI_ATTR VkResult VKAPI_CALL vkQueueBindSparse(
|
||||
{
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures2(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
VkPhysicalDeviceFeatures2* pFeatures)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties2(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
VkPhysicalDeviceProperties2* pProperties)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties2(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
VkFormat format,
|
||||
VkFormatProperties2* pFormatProperties)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties2(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
const VkPhysicalDeviceImageFormatInfo2* pImageFormatInfo,
|
||||
VkImageFormatProperties2* pImageFormatProperties)
|
||||
{
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties2(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
uint32_t* pQueueFamilyPropertyCount,
|
||||
VkQueueFamilyProperties2* pQueueFamilyProperties)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties2(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
VkPhysicalDeviceMemoryProperties2* pMemoryProperties)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties2(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
const VkPhysicalDeviceSparseImageFormatInfo2* pFormatInfo,
|
||||
uint32_t* pPropertyCount,
|
||||
VkSparseImageFormatProperties2* pProperties)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalBufferProperties(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
const VkPhysicalDeviceExternalBufferInfo* pExternalBufferInfo,
|
||||
VkExternalBufferProperties* pExternalBufferProperties)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalFenceProperties(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
const VkPhysicalDeviceExternalFenceInfo* pExternalFenceInfo,
|
||||
VkExternalFenceProperties* pExternalFenceProperties)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalSemaphoreProperties(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
const VkPhysicalDeviceExternalSemaphoreInfo* pExternalSemaphoreInfo,
|
||||
VkExternalSemaphoreProperties* pExternalSemaphoreProperties)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -92,8 +92,6 @@ typedef struct VkInstance_T
|
||||
int hasEtc1;
|
||||
int hasThreadedFs;
|
||||
int hasMadvise;
|
||||
int controlFd;
|
||||
//int renderFd;
|
||||
} _instance;
|
||||
|
||||
typedef struct VkDevice_T
|
||||
|
@ -35,7 +35,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDevices(
|
||||
|
||||
*pPhysicalDeviceCount = elementsWritten;
|
||||
|
||||
if(elementsWritten < arraySize)
|
||||
if(arraySize < numGPUs)
|
||||
{
|
||||
return VK_INCOMPLETE;
|
||||
}
|
||||
@ -64,7 +64,7 @@ VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties(
|
||||
.residencyNonResidentStrict = 1
|
||||
};
|
||||
|
||||
pProperties->apiVersion = VK_MAKE_VERSION(1,1,0);
|
||||
pProperties->apiVersion = VK_DRIVER_VERSION;
|
||||
pProperties->driverVersion = 1; //we'll simply call this v1
|
||||
pProperties->vendorID = 0x14E4; //Broadcom
|
||||
pProperties->deviceID = 0; //TODO dunno?
|
||||
|
@ -36,7 +36,14 @@ VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceExtensionProperties(
|
||||
|
||||
*pPropertyCount = elementsWritten;
|
||||
|
||||
return VK_SUCCESS;
|
||||
if(arraySize < numInstanceExtensions)
|
||||
{
|
||||
return VK_INCOMPLETE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -97,15 +104,14 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(
|
||||
(*pInstance)->dev.instance = *pInstance;
|
||||
|
||||
int ret = openIoctl(); assert(ret != -1);
|
||||
(*pInstance)->controlFd = ret;
|
||||
|
||||
(*pInstance)->chipVersion = vc4_get_chip_info((*pInstance)->controlFd);
|
||||
(*pInstance)->hasTiling = vc4_test_tiling((*pInstance)->controlFd);
|
||||
(*pInstance)->chipVersion = vc4_get_chip_info(controlFd);
|
||||
(*pInstance)->hasTiling = vc4_test_tiling(controlFd);
|
||||
|
||||
(*pInstance)->hasControlFlow = vc4_has_feature((*pInstance)->controlFd, DRM_VC4_PARAM_SUPPORTS_BRANCHES);
|
||||
(*pInstance)->hasEtc1 = vc4_has_feature((*pInstance)->controlFd, DRM_VC4_PARAM_SUPPORTS_ETC1);
|
||||
(*pInstance)->hasThreadedFs = vc4_has_feature((*pInstance)->controlFd, DRM_VC4_PARAM_SUPPORTS_THREADED_FS);
|
||||
(*pInstance)->hasMadvise = vc4_has_feature((*pInstance)->controlFd, DRM_VC4_PARAM_SUPPORTS_MADVISE);
|
||||
(*pInstance)->hasControlFlow = vc4_has_feature(controlFd, DRM_VC4_PARAM_SUPPORTS_BRANCHES);
|
||||
(*pInstance)->hasEtc1 = vc4_has_feature(controlFd, DRM_VC4_PARAM_SUPPORTS_ETC1);
|
||||
(*pInstance)->hasThreadedFs = vc4_has_feature(controlFd, DRM_VC4_PARAM_SUPPORTS_THREADED_FS);
|
||||
(*pInstance)->hasMadvise = vc4_has_feature(controlFd, DRM_VC4_PARAM_SUPPORTS_MADVISE);
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
@ -132,7 +138,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceVersion(
|
||||
uint32_t* pApiVersion)
|
||||
{
|
||||
assert(pApiVersion);
|
||||
*pApiVersion = VK_MAKE_VERSION(1, 1, 0);
|
||||
*pApiVersion = VK_DRIVER_VERSION; //
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
@ -159,6 +165,7 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(
|
||||
}
|
||||
|
||||
RETFUNC(vkCreateInstance);
|
||||
RETFUNC(vkEnumerateInstanceVersion);
|
||||
RETFUNC(vkDestroyInstance);
|
||||
RETFUNC(vkEnumeratePhysicalDevices);
|
||||
RETFUNC(vkGetPhysicalDeviceFeatures);
|
||||
@ -295,6 +302,17 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(
|
||||
RETFUNC(vkCmdNextSubpass);
|
||||
RETFUNC(vkCmdEndRenderPass);
|
||||
RETFUNC(vkCmdExecuteCommands);
|
||||
RETFUNC(vkEnumeratePhysicalDeviceGroups);
|
||||
RETFUNC(vkGetPhysicalDeviceFeatures2);
|
||||
RETFUNC(vkGetPhysicalDeviceProperties2);
|
||||
RETFUNC(vkGetPhysicalDeviceFormatProperties2);
|
||||
RETFUNC(vkGetPhysicalDeviceImageFormatProperties2);
|
||||
RETFUNC(vkGetPhysicalDeviceQueueFamilyProperties2);
|
||||
RETFUNC(vkGetPhysicalDeviceMemoryProperties2);
|
||||
RETFUNC(vkGetPhysicalDeviceSparseImageFormatProperties2);
|
||||
RETFUNC(vkGetPhysicalDeviceExternalBufferProperties);
|
||||
RETFUNC(vkGetPhysicalDeviceExternalFenceProperties);
|
||||
RETFUNC(vkGetPhysicalDeviceExternalSemaphoreProperties);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,26 +1,42 @@
|
||||
#define _GNU_SOURCE
|
||||
#include "kernelInterface.h"
|
||||
#include <stdatomic.h>
|
||||
|
||||
atomic_int refCounter = 0;
|
||||
int controlFd = 0;
|
||||
//int renderFd = 0;
|
||||
|
||||
int openIoctl()
|
||||
{
|
||||
int controlFd = open(DRM_IOCTL_CTRL_DEV_FILE_NAME, O_RDWR | O_CLOEXEC);
|
||||
if (controlFd < 0) {
|
||||
printf("Can't open device file: %s\n", DRM_IOCTL_CTRL_DEV_FILE_NAME);
|
||||
return -1;
|
||||
if(!controlFd)
|
||||
{
|
||||
controlFd = open(DRM_IOCTL_CTRL_DEV_FILE_NAME, O_RDWR | O_CLOEXEC);
|
||||
if (controlFd < 0) {
|
||||
printf("Can't open device file: %s \nError: %s\n", DRM_IOCTL_CTRL_DEV_FILE_NAME, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/*renderFd = open(DRM_IOCTL_RENDER_DEV_FILE_NAME, O_RDWR | O_CLOEXEC);
|
||||
if (renderFd < 0) {
|
||||
printf("Can't open device file: %s\n", DRM_IOCTL_RENDER_DEV_FILE_NAME);
|
||||
return -1;
|
||||
/*if(!renderFd)
|
||||
{
|
||||
renderFd = open(DRM_IOCTL_RENDER_DEV_FILE_NAME, O_RDWR | O_CLOEXEC);
|
||||
if (renderFd < 0) {
|
||||
printf("Can't open device file: %s \nError: %s\n", DRM_IOCTL_RENDER_DEV_FILE_NAME, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
}*/
|
||||
|
||||
return controlFd;
|
||||
++refCounter;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void closeIoctl(int fd)
|
||||
{
|
||||
close(fd);
|
||||
if (--refCounter == 0)
|
||||
{
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t align(uint32_t num, uint32_t alignment)
|
||||
|
@ -34,6 +34,9 @@ extern "C" {
|
||||
#define WAIT_TIMEOUT_INFINITE 0xffffffffffffffffull
|
||||
#define ARM_PAGE_SIZE 4096
|
||||
|
||||
extern int controlFd;
|
||||
//extern int renderFd;
|
||||
|
||||
int openIoctl();
|
||||
void closeIoctl();
|
||||
|
||||
|
@ -65,7 +65,7 @@ VkResult vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo* pAllocate
|
||||
assert(pAllocateInfo);
|
||||
assert(pMemory);
|
||||
|
||||
uint32_t bo = vc4_bo_alloc(device->dev->instance->controlFd, pAllocateInfo->allocationSize, "vkAllocateMemory");
|
||||
uint32_t bo = vc4_bo_alloc(controlFd, pAllocateInfo->allocationSize, "vkAllocateMemory");
|
||||
if(!bo)
|
||||
{
|
||||
return VK_ERROR_OUT_OF_DEVICE_MEMORY;
|
||||
@ -111,7 +111,7 @@ VkResult vkMapMemory(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset
|
||||
//TODO check ppdata alignment
|
||||
//TODO multiple instances?
|
||||
|
||||
void* ptr = vc4_bo_map(device->dev->instance->controlFd, ((_deviceMemory*)memory)->bo, offset, size);
|
||||
void* ptr = vc4_bo_map(controlFd, ((_deviceMemory*)memory)->bo, offset, size);
|
||||
if(!ptr)
|
||||
{
|
||||
return VK_ERROR_MEMORY_MAP_FAILED;
|
||||
@ -133,7 +133,7 @@ void vkUnmapMemory(VkDevice device, VkDeviceMemory memory)
|
||||
assert(device);
|
||||
assert(memory);
|
||||
|
||||
vc4_bo_unmap_unsynchronized(device->dev->instance->controlFd, ((_deviceMemory*)memory)->mappedPtr, ((_deviceMemory*)memory)->mappedSize);
|
||||
vc4_bo_unmap_unsynchronized(controlFd, ((_deviceMemory*)memory)->mappedPtr, ((_deviceMemory*)memory)->mappedSize);
|
||||
}
|
||||
|
||||
void vkFreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks* pAllocator)
|
||||
@ -142,7 +142,7 @@ void vkFreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCall
|
||||
assert(memory);
|
||||
|
||||
_deviceMemory* mem = memory;
|
||||
vc4_bo_free(device->dev->instance->controlFd, mem->bo, mem->mappedPtr, mem->size);
|
||||
vc4_bo_free(controlFd, mem->bo, mem->mappedPtr, mem->size);
|
||||
FREE(mem);
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ VkResult vkCreateShaderModuleFromRpiAssemblyKHR(VkDevice device, VkRpiShaderModu
|
||||
if(pCreateInfo->byteStreamArray[c])
|
||||
{
|
||||
uint32_t size = pCreateInfo->numBytesArray[c];
|
||||
shader->bos[c] = vc4_bo_alloc_shader(device->dev->instance->controlFd, pCreateInfo->byteStreamArray[c], &size);
|
||||
shader->bos[c] = vc4_bo_alloc_shader(controlFd, pCreateInfo->byteStreamArray[c], &size);
|
||||
shader->sizes[c] = size;
|
||||
}
|
||||
else
|
||||
@ -56,7 +56,7 @@ void vkDestroyShaderModule(VkDevice device, VkShaderModule shaderModule, const V
|
||||
{
|
||||
if(shader->bos[c])
|
||||
{
|
||||
vc4_bo_free(device->dev->instance->controlFd, shader->bos[c], 0, shader->sizes[c]);
|
||||
vc4_bo_free(controlFd, shader->bos[c], 0, shader->sizes[c]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -244,7 +244,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkDeviceWaitIdle(
|
||||
{
|
||||
uint64_t lastFinishedSeqno;
|
||||
uint64_t timeout = WAIT_TIMEOUT_INFINITE;
|
||||
vc4_seqno_wait(device->dev->instance->controlFd, &lastFinishedSeqno, device->queues[c][d].lastEmitSeqno, &timeout);
|
||||
vc4_seqno_wait(controlFd, &lastFinishedSeqno, device->queues[c][d].lastEmitSeqno, &timeout);
|
||||
}
|
||||
}
|
||||
|
||||
@ -262,7 +262,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkQueueWaitIdle(
|
||||
_queue* q = queue;
|
||||
uint64_t lastFinishedSeqno;
|
||||
uint64_t timeout = WAIT_TIMEOUT_INFINITE;
|
||||
vc4_seqno_wait(queue->dev->dev->instance->controlFd, &lastFinishedSeqno, q->lastEmitSeqno, &timeout);
|
||||
vc4_seqno_wait(controlFd, &lastFinishedSeqno, q->lastEmitSeqno, &timeout);
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
@ -391,7 +391,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkWaitForFences(
|
||||
uint64_t lastFinishedSeqno = 0;
|
||||
if(!f->signaled)
|
||||
{
|
||||
int ret = vc4_seqno_wait(device->dev->instance->controlFd, &lastFinishedSeqno, f->seqno, &timeout);
|
||||
int ret = vc4_seqno_wait(controlFd, &lastFinishedSeqno, f->seqno, &timeout);
|
||||
|
||||
if(ret < 0)
|
||||
{
|
||||
@ -426,7 +426,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkWaitForFences(
|
||||
uint64_t lastFinishedSeqno = 0;
|
||||
if(!f->signaled)
|
||||
{
|
||||
int ret = vc4_seqno_wait(device->dev->instance->controlFd, &lastFinishedSeqno, f->seqno, &timeout);
|
||||
int ret = vc4_seqno_wait(controlFd, &lastFinishedSeqno, f->seqno, &timeout);
|
||||
|
||||
if(ret < 0)
|
||||
{
|
||||
|
@ -35,8 +35,8 @@ static VkPhysicalDeviceLimits _limits =
|
||||
.maxDescriptorSetSampledImages = 98304,
|
||||
.maxDescriptorSetStorageImages = 98304,
|
||||
.maxDescriptorSetInputAttachments = 8, //TODO
|
||||
.maxVertexInputAttributes = 8,
|
||||
.maxVertexInputBindings = 8,
|
||||
.maxVertexInputAttributes = 8, //TODO will fail CTS, MIN is 16
|
||||
.maxVertexInputBindings = 8, //TODO will fail CTS, MIN is 16
|
||||
.maxVertexInputAttributeOffset = 2047,
|
||||
.maxVertexInputBindingStride = 2048,
|
||||
.maxVertexOutputComponents = 128,
|
||||
@ -57,10 +57,10 @@ static VkPhysicalDeviceLimits _limits =
|
||||
.maxFragmentOutputAttachments = 8,
|
||||
.maxFragmentDualSrcAttachments = 1,
|
||||
.maxFragmentCombinedOutputResources = 16,
|
||||
.maxComputeSharedMemorySize = 0, //TODO no compute for now
|
||||
.maxComputeWorkGroupCount = {0,0,0},
|
||||
.maxComputeWorkGroupInvocations = 0,
|
||||
.maxComputeWorkGroupSize = {0,0,0},
|
||||
.maxComputeSharedMemorySize = 0, //TODO no compute for now, fails CTS
|
||||
.maxComputeWorkGroupCount = {0,0,0}, //TODO no compute for now, fails CTS
|
||||
.maxComputeWorkGroupInvocations = 0, //TODO no compute for now, fails CTS
|
||||
.maxComputeWorkGroupSize = {0,0,0}, //TODO no compute for now, fails CTS
|
||||
.subPixelPrecisionBits = 8,
|
||||
.subTexelPrecisionBits = 8,
|
||||
.mipmapPrecisionBits = 8,
|
||||
@ -102,10 +102,10 @@ static VkPhysicalDeviceLimits _limits =
|
||||
.maxClipDistances = 8,
|
||||
.maxCullDistances = 8,
|
||||
.maxCombinedClipAndCullDistances = 8,
|
||||
.discreteQueuePriorities = 1,
|
||||
.pointSizeRange = {1, 1},
|
||||
.discreteQueuePriorities = 1, //TODO will fail CTS, MIN is 2
|
||||
.pointSizeRange = {1, 64}, //TODO [1] has to be 64 - pointSizeGranularity
|
||||
.lineWidthRange = {0.5, 10},
|
||||
.pointSizeGranularity = 0.0,
|
||||
.pointSizeGranularity = 0.0, //TODO
|
||||
.lineWidthGranularity = 0.125,
|
||||
.strictLines = 0, //TODO
|
||||
.standardSampleLocations = 1,
|
||||
@ -135,7 +135,7 @@ static VkPhysicalDeviceFeatures _features =
|
||||
.wideLines = 1,
|
||||
.largePoints = 1,
|
||||
.alphaToOne = 1,
|
||||
.multiViewport = 1,
|
||||
.multiViewport = 0,
|
||||
.samplerAnisotropy = 1,
|
||||
.textureCompressionETC2 = 0,
|
||||
.textureCompressionASTC_LDR = 0,
|
||||
@ -221,10 +221,11 @@ static VkExtensionProperties instanceExtensions[] =
|
||||
.extensionName = "VK_EXT_debug_utils",
|
||||
.specVersion = 1
|
||||
},
|
||||
{
|
||||
.extensionName = "VK_KHR_rpi_surface",
|
||||
.specVersion = 1
|
||||
}
|
||||
//TODO not an official extension, so can't expose it
|
||||
//{
|
||||
// .extensionName = "VK_KHR_rpi_surface",
|
||||
// .specVersion = 1
|
||||
//}
|
||||
};
|
||||
#define numInstanceExtensions (sizeof(instanceExtensions) / sizeof(VkExtensionProperties))
|
||||
|
||||
@ -282,3 +283,5 @@ static VkMemoryHeap memoryHeaps[] =
|
||||
}
|
||||
};
|
||||
#define numMemoryHeaps (sizeof(memoryHeaps) / sizeof(VkMemoryHeap))
|
||||
|
||||
#define VK_DRIVER_VERSION VK_MAKE_VERSION(1, 1, 0)
|
||||
|
14
driver/wsi.c
14
driver/wsi.c
@ -18,7 +18,7 @@ VkResult vkCreateRpiSurfaceKHR(
|
||||
|
||||
//TODO use allocator!
|
||||
|
||||
*pSurface = (VkSurfaceKHR)modeset_create(instance->controlFd);
|
||||
*pSurface = (VkSurfaceKHR)modeset_create(controlFd);
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
@ -39,7 +39,7 @@ VKAPI_ATTR void VKAPI_CALL vkDestroySurfaceKHR(
|
||||
|
||||
//TODO use allocator
|
||||
|
||||
modeset_destroy(instance->controlFd, (modeset_dev*)surface);
|
||||
modeset_destroy(controlFd, (modeset_dev*)surface);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -250,14 +250,14 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateSwapchainKHR(
|
||||
//set tiling to T if size > 4KB
|
||||
if(s->images[c].tiling == VC4_TILING_FORMAT_T)
|
||||
{
|
||||
int ret = vc4_bo_set_tiling(device->dev->instance->controlFd, s->images[c].boundMem->bo, DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED); assert(ret);
|
||||
int ret = vc4_bo_set_tiling(controlFd, s->images[c].boundMem->bo, DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED); assert(ret);
|
||||
}
|
||||
else
|
||||
{
|
||||
int ret = vc4_bo_set_tiling(device->dev->instance->controlFd, s->images[c].boundMem->bo, DRM_FORMAT_MOD_LINEAR); assert(ret);
|
||||
int ret = vc4_bo_set_tiling(controlFd, s->images[c].boundMem->bo, DRM_FORMAT_MOD_LINEAR); assert(ret);
|
||||
}
|
||||
|
||||
int res = modeset_create_fb(device->dev->instance->controlFd, &s->images[c]); assert(res == 0);
|
||||
int res = modeset_create_fb(controlFd, &s->images[c]); assert(res == 0);
|
||||
}
|
||||
|
||||
//defer to first swapbuffer (or at least later, getting swapchain != presenting immediately)
|
||||
@ -373,7 +373,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkQueuePresentKHR(
|
||||
for(int c = 0; c < pPresentInfo->swapchainCount; ++c)
|
||||
{
|
||||
_swapchain* s = pPresentInfo->pSwapchains[c];
|
||||
modeset_present_buffer(queue->dev->dev->instance->controlFd, (modeset_dev*)s->surface, &s->images[s->backbufferIdx]);
|
||||
modeset_present_buffer(controlFd, (modeset_dev*)s->surface, &s->images[s->backbufferIdx]);
|
||||
s->backbufferIdx = (s->backbufferIdx + 1) % s->numImages;
|
||||
}
|
||||
|
||||
@ -398,7 +398,7 @@ VKAPI_ATTR void VKAPI_CALL vkDestroySwapchainKHR(
|
||||
for(int c = 0; c < s->numImages; ++c)
|
||||
{
|
||||
vkFreeMemory(device, s->images[c].boundMem, 0);
|
||||
modeset_destroy_fb(device->dev->instance->controlFd, &s->images[c]);
|
||||
modeset_destroy_fb(controlFd, &s->images[c]);
|
||||
}
|
||||
|
||||
FREE(s->images);
|
||||
|
Loading…
Reference in New Issue
Block a user