From cd9078618755351578d058b32be90c5c1174cb87 Mon Sep 17 00:00:00 2001 From: Unknown <0.tamas.marton@gmail.com> Date: Sun, 8 Mar 2020 22:06:12 +0000 Subject: [PATCH] backup --- driver/ConsecutivePoolAllocator.c | 2 ++ driver/ControlListUtil.h | 10 ++++---- driver/command.c | 3 ++- driver/kernelInterface.c | 4 ++++ driver/pipeline.c | 39 ++++++++++++++----------------- 5 files changed, 31 insertions(+), 27 deletions(-) diff --git a/driver/ConsecutivePoolAllocator.c b/driver/ConsecutivePoolAllocator.c index 757069b..1aab82c 100644 --- a/driver/ConsecutivePoolAllocator.c +++ b/driver/ConsecutivePoolAllocator.c @@ -174,6 +174,8 @@ void* consecutivePoolReAllocate(ConsecutivePoolAllocator* pa, void* currentMem, assert(currentMem); assert(currNumBlocks); + assert(0); + fprintf(stderr, "CPA realloc\n"); uint32_t* nextCandidate = (char*)currentMem + pa->blockSize * currNumBlocks; diff --git a/driver/ControlListUtil.h b/driver/ControlListUtil.h index 69e41e0..8675429 100644 --- a/driver/ControlListUtil.h +++ b/driver/ControlListUtil.h @@ -15,7 +15,7 @@ typedef struct ControlListAddress typedef struct CLMarker { //current binning cl buf position is this struct in the CL plus sizeof(this struct) - struct CLMarker* nextMarker; + struct CLMarker* nextMarker; //TODO change to offset, could be reallocated uint32_t size; //in bytes void* writeImage; //_image* to render to void* readImage; @@ -39,12 +39,12 @@ typedef struct CLMarker //pointers that point to where all the other CL data is //plus sizes - uint8_t* handlesBuf; + uint8_t* handlesBuf; //TODO change to offset, could be reallocated uint32_t handlesSize; - uint8_t* shaderRecBuf; + uint8_t* shaderRecBuf; //TODO change to offset, could be reallocated uint32_t shaderRecSize; uint32_t shaderRecCount; - uint8_t* uniformsBuf; + uint8_t* uniformsBuf; //TODO change to offset, could be reallocated uint32_t uniformsSize; } CLMarker; @@ -54,7 +54,7 @@ typedef struct ControlList uint32_t numBlocks; uint32_t blockSize; uint8_t* nextFreeByte; //pointer to the next available free byte - CLMarker* currMarker; + CLMarker* currMarker; //TODO change to offset, could be reallocated } ControlList; void clEmitShaderRelocation(ControlList* relocCl, ControlList* handlesCl, uint8_t* handlesBuf, uint32_t handlesSize, const ControlListAddress* address); diff --git a/driver/command.c b/driver/command.c index f2f3b7d..7f54ec4 100644 --- a/driver/command.c +++ b/driver/command.c @@ -50,7 +50,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateCommandPool( //initial number of command buffers to hold int numCommandBufs = 128; - int consecutiveBlockSize = ARM_PAGE_SIZE>>2; + int consecutiveBlockSize = ARM_PAGE_SIZE; int consecutiveBlockNumber = 64; //int numCommandBufs = 30; //int consecutiveBlockSize = getCPABlockSize(256); @@ -607,6 +607,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkQueueSubmit( printf("perfmonID %u\n", submitCl.perfmonid); /**/ + assert(submitCl.bo_handle_count > 0); //TODO somehow store last finished globally //so waiting on fences is faster diff --git a/driver/kernelInterface.c b/driver/kernelInterface.c index fec70c6..06e9c6a 100644 --- a/driver/kernelInterface.c +++ b/driver/kernelInterface.c @@ -477,6 +477,10 @@ uint32_t vc4_bo_alloc(int fd, uint32_t size, const char *name) vc4_bo_label(fd, handle, name); + //TODO debug stuff, not for release + void* ptr = vc4_bo_map(fd, handle, 0, size); + memset(ptr, 0, size); + return handle; } diff --git a/driver/pipeline.c b/driver/pipeline.c index 0e37510..dba8c6c 100644 --- a/driver/pipeline.c +++ b/driver/pipeline.c @@ -221,13 +221,12 @@ VkResult rpi_vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipeline //patchShaderDepthStencilBlending(&s->instructions[RPI_ASSEMBLY_TYPE_FRAGMENT], &s->sizes[RPI_ASSEMBLY_TYPE_FRAGMENT], pCreateInfos[c].pDepthStencilState, pCreateInfos[c].pColorBlendState->pAttachments, pAllocator); //TODO if debug... - for(uint64_t e = 0; e < s->sizes[RPI_ASSEMBLY_TYPE_FRAGMENT] / 8; ++e) - { - printf("%#llx ", s->instructions[RPI_ASSEMBLY_TYPE_FRAGMENT][e]); - disassemble_qpu_asm(s->instructions[RPI_ASSEMBLY_TYPE_FRAGMENT][e]); - } - - printf("\n"); +// for(uint64_t e = 0; e < s->sizes[RPI_ASSEMBLY_TYPE_FRAGMENT] / 8; ++e) +// { +// printf("%#llx ", s->instructions[RPI_ASSEMBLY_TYPE_FRAGMENT][e]); +// disassemble_qpu_asm(s->instructions[RPI_ASSEMBLY_TYPE_FRAGMENT][e]); +// } +// printf("\n"); s->bos[RPI_ASSEMBLY_TYPE_FRAGMENT] = vc4_bo_alloc_shader(controlFd, s->instructions[RPI_ASSEMBLY_TYPE_FRAGMENT], &s->sizes[RPI_ASSEMBLY_TYPE_FRAGMENT]); } @@ -235,21 +234,19 @@ VkResult rpi_vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipeline if(pCreateInfos[c].pStages[d].stage & VK_SHADER_STAGE_VERTEX_BIT) { //TODO if debug... - for(uint64_t e = 0; e < s->sizes[RPI_ASSEMBLY_TYPE_VERTEX] / 8; ++e) - { - printf("%#llx ", s->instructions[RPI_ASSEMBLY_TYPE_VERTEX][e]); - disassemble_qpu_asm(s->instructions[RPI_ASSEMBLY_TYPE_VERTEX][e]); - } +// for(uint64_t e = 0; e < s->sizes[RPI_ASSEMBLY_TYPE_VERTEX] / 8; ++e) +// { +// printf("%#llx ", s->instructions[RPI_ASSEMBLY_TYPE_VERTEX][e]); +// disassemble_qpu_asm(s->instructions[RPI_ASSEMBLY_TYPE_VERTEX][e]); +// } +// printf("\n"); - printf("\n"); - - for(uint64_t e = 0; e < s->sizes[RPI_ASSEMBLY_TYPE_COORDINATE] / 8; ++e) - { - printf("%#llx ", s->instructions[RPI_ASSEMBLY_TYPE_COORDINATE][e]); - disassemble_qpu_asm(s->instructions[RPI_ASSEMBLY_TYPE_COORDINATE][e]); - } - - printf("\n"); +// for(uint64_t e = 0; e < s->sizes[RPI_ASSEMBLY_TYPE_COORDINATE] / 8; ++e) +// { +// printf("%#llx ", s->instructions[RPI_ASSEMBLY_TYPE_COORDINATE][e]); +// disassemble_qpu_asm(s->instructions[RPI_ASSEMBLY_TYPE_COORDINATE][e]); +// } +// printf("\n"); s->bos[RPI_ASSEMBLY_TYPE_COORDINATE] = vc4_bo_alloc_shader(controlFd, s->instructions[RPI_ASSEMBLY_TYPE_COORDINATE], &s->sizes[RPI_ASSEMBLY_TYPE_COORDINATE]); s->bos[RPI_ASSEMBLY_TYPE_VERTEX] = vc4_bo_alloc_shader(controlFd, s->instructions[RPI_ASSEMBLY_TYPE_VERTEX], &s->sizes[RPI_ASSEMBLY_TYPE_VERTEX]);