Просмотр исходного кода

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.
tags/12.0-branchpoint
Tim Rowley 9 лет назад
Родитель
Сommit
813e89c0cc

+ 6
- 0
src/gallium/drivers/swr/rasterizer/core/api.cpp Просмотреть файл

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


+ 2
- 0
src/gallium/drivers/swr/rasterizer/core/context.h Просмотреть файл

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

+ 6
- 2
src/gallium/drivers/swr/rasterizer/core/threads.cpp Просмотреть файл

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

Загрузка…
Отмена
Сохранить