1
0
mirror of https://github.com/Yours3lf/rpi-vk-driver.git synced 2025-02-19 16:54:18 +01:00
This commit is contained in:
Unknown 2020-03-08 22:06:12 +00:00
parent db18a1695c
commit cd90786187
5 changed files with 31 additions and 27 deletions

View File

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

View File

@ -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);

View File

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

View File

@ -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;
}

View File

@ -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]);