mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
swr: [rasterizer core] Cleanup state ring arena after last draw that references it completes
Rather than waiting for the API thread to re-use it.
This commit is contained in:
parent
83822d7ed5
commit
813e89c0cc
3 changed files with 14 additions and 2 deletions
|
|
@ -297,6 +297,8 @@ DRAW_CONTEXT* GetDrawContext(SWR_CONTEXT *pContext, bool isSplitDraw = false)
|
|||
|
||||
// Assign unique drawId for this DC
|
||||
pCurDrawContext->drawId = pContext->dcRing.GetHead();
|
||||
|
||||
pCurDrawContext->cleanupState = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1076,6 +1078,8 @@ void DrawInstanced(
|
|||
pDC->FeWork.desc.draw.startPrimID = draw * primsPerDraw;
|
||||
pDC->FeWork.desc.draw.startVertexID = draw * maxVertsPerDraw;
|
||||
|
||||
pDC->cleanupState = (remainingVerts == numVertsForDraw);
|
||||
|
||||
//enqueue DC
|
||||
QueueDraw(pContext);
|
||||
|
||||
|
|
@ -1210,6 +1214,8 @@ void DrawIndexedInstance(
|
|||
pDC->FeWork.desc.draw.baseVertex = baseVertex;
|
||||
pDC->FeWork.desc.draw.startPrimID = draw * primsPerDraw;
|
||||
|
||||
pDC->cleanupState = (remainingIndices == numIndicesForDraw);
|
||||
|
||||
//enqueue DC
|
||||
QueueDraw(pContext);
|
||||
|
||||
|
|
|
|||
|
|
@ -402,6 +402,8 @@ struct DRAW_CONTEXT
|
|||
CachingArena* pArena;
|
||||
|
||||
uint8_t* pSpillFill[KNOB_MAX_NUM_THREADS]; // Scratch space used for spill fills.
|
||||
|
||||
bool cleanupState; // True if this is the last draw using an entry in the state ring.
|
||||
};
|
||||
|
||||
INLINE const API_STATE& GetApiState(const DRAW_CONTEXT* pDC)
|
||||
|
|
|
|||
|
|
@ -287,11 +287,15 @@ INLINE void CompleteDrawContext(SWR_CONTEXT* pContext, DRAW_CONTEXT* pDC)
|
|||
|
||||
if (result == 0)
|
||||
{
|
||||
_ReadWriteBarrier();
|
||||
|
||||
// Cleanup memory allocations
|
||||
pDC->pArena->Reset(true);
|
||||
pDC->pTileMgr->initialize();
|
||||
if (pDC->cleanupState)
|
||||
{
|
||||
pDC->pState->pArena->Reset(true);
|
||||
}
|
||||
|
||||
_ReadWriteBarrier();
|
||||
|
||||
pContext->dcRing.Dequeue(); // Remove from tail
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue