1
0
mirror of https://github.com/Yours3lf/rpi-vk-driver.git synced 2025-02-20 17:54:17 +01:00

added asserts for a couple of hw bugs

This commit is contained in:
yours3lf 2020-06-07 18:15:36 +01:00
parent 093e35a961
commit 044b3be14c
5 changed files with 17 additions and 6 deletions

View File

@ -60,6 +60,7 @@ void clInsertNewCLMarker(ControlList* cl,
marker.shaderRecBufOffset = 0;
marker.uniformsBufOffset = 0;
marker.nextMarkerOffset = -1;
marker.numDrawCallsSubmitted = 0;
//close current marker
if(cl->currMarkerOffset != -1 && !((CLMarker*)getCPAptrFromOffset(cl->CPA, cl->currMarkerOffset))->size)

View File

@ -42,6 +42,8 @@ typedef struct CLMarker
uint32_t width, height; //render w/h
uint32_t mipLevel;
uint32_t numDrawCallsSubmitted;
//pointers that point to where all the other CL data is
//plus sizes
//uint8_t* handlesBuf; //

View File

@ -11,6 +11,8 @@
static uint64_t lastFinishedSeqno = 0;
static atomic_int lastSeqnoGuard = 0;
#define VC4_HW_2116_COUNT 0x1ef0
/*
* https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#commandbuffers-pools
* Command pools are opaque objects that command buffer memory is allocated from, and which allow the implementation to amortize the
@ -132,7 +134,6 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkAllocateCommandBuffers)(
pCommandBuffers[c]->graphicsPipeline = 0;
pCommandBuffers[c]->computePipeline = 0;
pCommandBuffers[c]->numDrawCallsSubmitted = 0;
pCommandBuffers[c]->indexBuffer = 0;
pCommandBuffers[c]->indexBufferOffset = 0;
pCommandBuffers[c]->vertexBufferDirty = 1;
@ -662,6 +663,8 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkQueueSubmit)(
printf("perfmonID %u\n", submitCl.perfmonid);
/**/
assert(marker->numDrawCallsSubmitted <= VC4_HW_2116_COUNT);
assert(submitCl.bo_handle_count > 0);
//TODO
@ -673,6 +676,10 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkQueueSubmit)(
lastSeqnoGuard = 0;
}
//see if it's a sync bug
//uint64_t timeout = WAIT_TIMEOUT_INFINITE;
//vc4_seqno_wait(controlFd, &lastFinishedSeqno, queue->lastEmitSeqno, &timeout);
//advance in linked list
marker = marker->nextMarkerOffset == -1 ? 0 : getCPAptrFromOffset(cmdbuf->binCl.CPA, marker->nextMarkerOffset + cmdbuf->binCl.offset);
}
@ -889,7 +896,6 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkResetCommandBuffer)(
commandBuffer->graphicsPipeline = 0;
commandBuffer->computePipeline = 0;
commandBuffer->numDrawCallsSubmitted = 0;
commandBuffer->indexBuffer = 0;
commandBuffer->indexBufferOffset = 0;
commandBuffer->vertexBufferDirty = 1;

View File

@ -382,8 +382,6 @@ typedef struct VkCommandBuffer_T
_renderpass* currRenderPass;
uint32_t numDrawCallsSubmitted;
VkViewport viewport;
VkRect2D scissor;
float lineWidth;

View File

@ -584,6 +584,8 @@ void RPIFUNC(vkCmdDraw)(VkCommandBuffer commandBuffer, uint32_t vertexCount, uin
UNSUPPORTED(instancing);
}
assert((firstVertex + vertexCount) <= ((1<<16) - 1));
drawCommon(commandBuffer, 0);
_commandBuffer* cb = commandBuffer;
@ -592,7 +594,7 @@ void RPIFUNC(vkCmdDraw)(VkCommandBuffer commandBuffer, uint32_t vertexCount, uin
clFit(commandBuffer, &commandBuffer->binCl, V3D21_VERTEX_ARRAY_PRIMITIVES_length);
clInsertVertexArrayPrimitives(&commandBuffer->binCl, firstVertex, vertexCount, getPrimitiveMode(cb->graphicsPipeline->topology));
cb->numDrawCallsSubmitted++;
((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->numDrawCallsSubmitted++;
PROFILEEND(RPIFUNC(vkCmdDraw));
}
@ -615,6 +617,8 @@ VKAPI_ATTR void VKAPI_CALL RPIFUNC(vkCmdDrawIndexed)(
UNSUPPORTED(instancing);
}
assert((firstIndex + indexCount) <= ((1<<16) - 1));
uint32_t maxIndex = drawCommon(commandBuffer, vertexOffset);
_commandBuffer* cb = commandBuffer;
@ -634,7 +638,7 @@ VKAPI_ATTR void VKAPI_CALL RPIFUNC(vkCmdDrawIndexed)(
1, //we only support 16 bit indices
getPrimitiveMode(cb->graphicsPipeline->topology));
cb->numDrawCallsSubmitted++;
((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->numDrawCallsSubmitted++;
PROFILEEND(RPIFUNC(vkCmdDrawIndexed));
}