1
0
mirror of https://github.com/Yours3lf/rpi-vk-driver.git synced 2024-11-29 11:24:14 +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:
Unknown 2018-11-18 14:21:33 +00:00
parent 5b767c2bc7
commit 1696c03670
13 changed files with 174 additions and 56 deletions

View File

@ -4,6 +4,6 @@ file(GLOB driverSrc
) )
add_library(vulkan-1-rpi SHARED ${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) target_link_libraries(vulkan-1-rpi drm pthread brcm)

View File

@ -335,7 +335,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkQueueSubmit(
//submit ioctl //submit ioctl
static uint64_t lastFinishedSeqno = 0; 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) for(int c = 0; c < pSubmits->commandBufferCount; ++c)

View File

@ -990,3 +990,83 @@ VKAPI_ATTR VkResult VKAPI_CALL vkQueueBindSparse(
{ {
return VK_SUCCESS; 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)
{
}

View File

@ -92,8 +92,6 @@ typedef struct VkInstance_T
int hasEtc1; int hasEtc1;
int hasThreadedFs; int hasThreadedFs;
int hasMadvise; int hasMadvise;
int controlFd;
//int renderFd;
} _instance; } _instance;
typedef struct VkDevice_T typedef struct VkDevice_T

View File

@ -35,7 +35,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDevices(
*pPhysicalDeviceCount = elementsWritten; *pPhysicalDeviceCount = elementsWritten;
if(elementsWritten < arraySize) if(arraySize < numGPUs)
{ {
return VK_INCOMPLETE; return VK_INCOMPLETE;
} }
@ -64,7 +64,7 @@ VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties(
.residencyNonResidentStrict = 1 .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->driverVersion = 1; //we'll simply call this v1
pProperties->vendorID = 0x14E4; //Broadcom pProperties->vendorID = 0x14E4; //Broadcom
pProperties->deviceID = 0; //TODO dunno? pProperties->deviceID = 0; //TODO dunno?

View File

@ -36,7 +36,14 @@ VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceExtensionProperties(
*pPropertyCount = elementsWritten; *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; (*pInstance)->dev.instance = *pInstance;
int ret = openIoctl(); assert(ret != -1); int ret = openIoctl(); assert(ret != -1);
(*pInstance)->controlFd = ret;
(*pInstance)->chipVersion = vc4_get_chip_info((*pInstance)->controlFd); (*pInstance)->chipVersion = vc4_get_chip_info(controlFd);
(*pInstance)->hasTiling = vc4_test_tiling((*pInstance)->controlFd); (*pInstance)->hasTiling = vc4_test_tiling(controlFd);
(*pInstance)->hasControlFlow = vc4_has_feature((*pInstance)->controlFd, DRM_VC4_PARAM_SUPPORTS_BRANCHES); (*pInstance)->hasControlFlow = vc4_has_feature(controlFd, DRM_VC4_PARAM_SUPPORTS_BRANCHES);
(*pInstance)->hasEtc1 = vc4_has_feature((*pInstance)->controlFd, DRM_VC4_PARAM_SUPPORTS_ETC1); (*pInstance)->hasEtc1 = vc4_has_feature(controlFd, DRM_VC4_PARAM_SUPPORTS_ETC1);
(*pInstance)->hasThreadedFs = vc4_has_feature((*pInstance)->controlFd, DRM_VC4_PARAM_SUPPORTS_THREADED_FS); (*pInstance)->hasThreadedFs = vc4_has_feature(controlFd, DRM_VC4_PARAM_SUPPORTS_THREADED_FS);
(*pInstance)->hasMadvise = vc4_has_feature((*pInstance)->controlFd, DRM_VC4_PARAM_SUPPORTS_MADVISE); (*pInstance)->hasMadvise = vc4_has_feature(controlFd, DRM_VC4_PARAM_SUPPORTS_MADVISE);
return VK_SUCCESS; return VK_SUCCESS;
} }
@ -132,7 +138,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceVersion(
uint32_t* pApiVersion) uint32_t* pApiVersion)
{ {
assert(pApiVersion); assert(pApiVersion);
*pApiVersion = VK_MAKE_VERSION(1, 1, 0); *pApiVersion = VK_DRIVER_VERSION; //
return VK_SUCCESS; return VK_SUCCESS;
} }
@ -159,6 +165,7 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(
} }
RETFUNC(vkCreateInstance); RETFUNC(vkCreateInstance);
RETFUNC(vkEnumerateInstanceVersion);
RETFUNC(vkDestroyInstance); RETFUNC(vkDestroyInstance);
RETFUNC(vkEnumeratePhysicalDevices); RETFUNC(vkEnumeratePhysicalDevices);
RETFUNC(vkGetPhysicalDeviceFeatures); RETFUNC(vkGetPhysicalDeviceFeatures);
@ -295,6 +302,17 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(
RETFUNC(vkCmdNextSubpass); RETFUNC(vkCmdNextSubpass);
RETFUNC(vkCmdEndRenderPass); RETFUNC(vkCmdEndRenderPass);
RETFUNC(vkCmdExecuteCommands); 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; return 0;
} }

View File

@ -1,26 +1,42 @@
#define _GNU_SOURCE #define _GNU_SOURCE
#include "kernelInterface.h" #include "kernelInterface.h"
#include <stdatomic.h>
atomic_int refCounter = 0;
int controlFd = 0;
//int renderFd = 0;
int openIoctl() int openIoctl()
{ {
int controlFd = open(DRM_IOCTL_CTRL_DEV_FILE_NAME, O_RDWR | O_CLOEXEC); if(!controlFd)
if (controlFd < 0) { {
printf("Can't open device file: %s\n", DRM_IOCTL_CTRL_DEV_FILE_NAME); controlFd = open(DRM_IOCTL_CTRL_DEV_FILE_NAME, O_RDWR | O_CLOEXEC);
return -1; 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)
if (renderFd < 0) { {
printf("Can't open device file: %s\n", DRM_IOCTL_RENDER_DEV_FILE_NAME); renderFd = open(DRM_IOCTL_RENDER_DEV_FILE_NAME, O_RDWR | O_CLOEXEC);
return -1; 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) void closeIoctl(int fd)
{ {
close(fd); if (--refCounter == 0)
{
close(fd);
}
} }
static uint32_t align(uint32_t num, uint32_t alignment) static uint32_t align(uint32_t num, uint32_t alignment)

View File

@ -34,6 +34,9 @@ extern "C" {
#define WAIT_TIMEOUT_INFINITE 0xffffffffffffffffull #define WAIT_TIMEOUT_INFINITE 0xffffffffffffffffull
#define ARM_PAGE_SIZE 4096 #define ARM_PAGE_SIZE 4096
extern int controlFd;
//extern int renderFd;
int openIoctl(); int openIoctl();
void closeIoctl(); void closeIoctl();

View File

@ -65,7 +65,7 @@ VkResult vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo* pAllocate
assert(pAllocateInfo); assert(pAllocateInfo);
assert(pMemory); 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) if(!bo)
{ {
return VK_ERROR_OUT_OF_DEVICE_MEMORY; return VK_ERROR_OUT_OF_DEVICE_MEMORY;
@ -111,7 +111,7 @@ VkResult vkMapMemory(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset
//TODO check ppdata alignment //TODO check ppdata alignment
//TODO multiple instances? //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) if(!ptr)
{ {
return VK_ERROR_MEMORY_MAP_FAILED; return VK_ERROR_MEMORY_MAP_FAILED;
@ -133,7 +133,7 @@ void vkUnmapMemory(VkDevice device, VkDeviceMemory memory)
assert(device); assert(device);
assert(memory); 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) void vkFreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks* pAllocator)
@ -142,7 +142,7 @@ void vkFreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCall
assert(memory); assert(memory);
_deviceMemory* mem = 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); FREE(mem);
} }

View File

@ -22,7 +22,7 @@ VkResult vkCreateShaderModuleFromRpiAssemblyKHR(VkDevice device, VkRpiShaderModu
if(pCreateInfo->byteStreamArray[c]) if(pCreateInfo->byteStreamArray[c])
{ {
uint32_t size = pCreateInfo->numBytesArray[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; shader->sizes[c] = size;
} }
else else
@ -56,7 +56,7 @@ void vkDestroyShaderModule(VkDevice device, VkShaderModule shaderModule, const V
{ {
if(shader->bos[c]) 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]);
} }
} }

View File

@ -244,7 +244,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkDeviceWaitIdle(
{ {
uint64_t lastFinishedSeqno; uint64_t lastFinishedSeqno;
uint64_t timeout = WAIT_TIMEOUT_INFINITE; 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; _queue* q = queue;
uint64_t lastFinishedSeqno; uint64_t lastFinishedSeqno;
uint64_t timeout = WAIT_TIMEOUT_INFINITE; 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; return VK_SUCCESS;
} }
@ -391,7 +391,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkWaitForFences(
uint64_t lastFinishedSeqno = 0; uint64_t lastFinishedSeqno = 0;
if(!f->signaled) 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) if(ret < 0)
{ {
@ -426,7 +426,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkWaitForFences(
uint64_t lastFinishedSeqno = 0; uint64_t lastFinishedSeqno = 0;
if(!f->signaled) 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) if(ret < 0)
{ {

View File

@ -35,8 +35,8 @@ static VkPhysicalDeviceLimits _limits =
.maxDescriptorSetSampledImages = 98304, .maxDescriptorSetSampledImages = 98304,
.maxDescriptorSetStorageImages = 98304, .maxDescriptorSetStorageImages = 98304,
.maxDescriptorSetInputAttachments = 8, //TODO .maxDescriptorSetInputAttachments = 8, //TODO
.maxVertexInputAttributes = 8, .maxVertexInputAttributes = 8, //TODO will fail CTS, MIN is 16
.maxVertexInputBindings = 8, .maxVertexInputBindings = 8, //TODO will fail CTS, MIN is 16
.maxVertexInputAttributeOffset = 2047, .maxVertexInputAttributeOffset = 2047,
.maxVertexInputBindingStride = 2048, .maxVertexInputBindingStride = 2048,
.maxVertexOutputComponents = 128, .maxVertexOutputComponents = 128,
@ -57,10 +57,10 @@ static VkPhysicalDeviceLimits _limits =
.maxFragmentOutputAttachments = 8, .maxFragmentOutputAttachments = 8,
.maxFragmentDualSrcAttachments = 1, .maxFragmentDualSrcAttachments = 1,
.maxFragmentCombinedOutputResources = 16, .maxFragmentCombinedOutputResources = 16,
.maxComputeSharedMemorySize = 0, //TODO no compute for now .maxComputeSharedMemorySize = 0, //TODO no compute for now, fails CTS
.maxComputeWorkGroupCount = {0,0,0}, .maxComputeWorkGroupCount = {0,0,0}, //TODO no compute for now, fails CTS
.maxComputeWorkGroupInvocations = 0, .maxComputeWorkGroupInvocations = 0, //TODO no compute for now, fails CTS
.maxComputeWorkGroupSize = {0,0,0}, .maxComputeWorkGroupSize = {0,0,0}, //TODO no compute for now, fails CTS
.subPixelPrecisionBits = 8, .subPixelPrecisionBits = 8,
.subTexelPrecisionBits = 8, .subTexelPrecisionBits = 8,
.mipmapPrecisionBits = 8, .mipmapPrecisionBits = 8,
@ -102,10 +102,10 @@ static VkPhysicalDeviceLimits _limits =
.maxClipDistances = 8, .maxClipDistances = 8,
.maxCullDistances = 8, .maxCullDistances = 8,
.maxCombinedClipAndCullDistances = 8, .maxCombinedClipAndCullDistances = 8,
.discreteQueuePriorities = 1, .discreteQueuePriorities = 1, //TODO will fail CTS, MIN is 2
.pointSizeRange = {1, 1}, .pointSizeRange = {1, 64}, //TODO [1] has to be 64 - pointSizeGranularity
.lineWidthRange = {0.5, 10}, .lineWidthRange = {0.5, 10},
.pointSizeGranularity = 0.0, .pointSizeGranularity = 0.0, //TODO
.lineWidthGranularity = 0.125, .lineWidthGranularity = 0.125,
.strictLines = 0, //TODO .strictLines = 0, //TODO
.standardSampleLocations = 1, .standardSampleLocations = 1,
@ -135,7 +135,7 @@ static VkPhysicalDeviceFeatures _features =
.wideLines = 1, .wideLines = 1,
.largePoints = 1, .largePoints = 1,
.alphaToOne = 1, .alphaToOne = 1,
.multiViewport = 1, .multiViewport = 0,
.samplerAnisotropy = 1, .samplerAnisotropy = 1,
.textureCompressionETC2 = 0, .textureCompressionETC2 = 0,
.textureCompressionASTC_LDR = 0, .textureCompressionASTC_LDR = 0,
@ -221,10 +221,11 @@ static VkExtensionProperties instanceExtensions[] =
.extensionName = "VK_EXT_debug_utils", .extensionName = "VK_EXT_debug_utils",
.specVersion = 1 .specVersion = 1
}, },
{ //TODO not an official extension, so can't expose it
.extensionName = "VK_KHR_rpi_surface", //{
.specVersion = 1 // .extensionName = "VK_KHR_rpi_surface",
} // .specVersion = 1
//}
}; };
#define numInstanceExtensions (sizeof(instanceExtensions) / sizeof(VkExtensionProperties)) #define numInstanceExtensions (sizeof(instanceExtensions) / sizeof(VkExtensionProperties))
@ -282,3 +283,5 @@ static VkMemoryHeap memoryHeaps[] =
} }
}; };
#define numMemoryHeaps (sizeof(memoryHeaps) / sizeof(VkMemoryHeap)) #define numMemoryHeaps (sizeof(memoryHeaps) / sizeof(VkMemoryHeap))
#define VK_DRIVER_VERSION VK_MAKE_VERSION(1, 1, 0)

View File

@ -18,7 +18,7 @@ VkResult vkCreateRpiSurfaceKHR(
//TODO use allocator! //TODO use allocator!
*pSurface = (VkSurfaceKHR)modeset_create(instance->controlFd); *pSurface = (VkSurfaceKHR)modeset_create(controlFd);
return VK_SUCCESS; return VK_SUCCESS;
} }
@ -39,7 +39,7 @@ VKAPI_ATTR void VKAPI_CALL vkDestroySurfaceKHR(
//TODO use allocator //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 //set tiling to T if size > 4KB
if(s->images[c].tiling == VC4_TILING_FORMAT_T) 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 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) //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) for(int c = 0; c < pPresentInfo->swapchainCount; ++c)
{ {
_swapchain* s = pPresentInfo->pSwapchains[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; 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) for(int c = 0; c < s->numImages; ++c)
{ {
vkFreeMemory(device, s->images[c].boundMem, 0); 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); FREE(s->images);