From c7c1a03f909c15338b878418ae76498685aeb59b Mon Sep 17 00:00:00 2001 From: Tim Rowley Date: Thu, 11 Aug 2016 10:49:43 -0600 Subject: [PATCH] swr: [rasterizer core] move some global variables to SWR_CONTEXT Signed-off-by: Tim Rowley --- src/gallium/drivers/swr/rasterizer/core/api.cpp | 14 +++++--------- src/gallium/drivers/swr/rasterizer/core/context.h | 4 ++++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/gallium/drivers/swr/rasterizer/core/api.cpp b/src/gallium/drivers/swr/rasterizer/core/api.cpp index 15485012a08..e447bf6fbe3 100644 --- a/src/gallium/drivers/swr/rasterizer/core/api.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/api.cpp @@ -199,8 +199,6 @@ void WakeAllThreads(SWR_CONTEXT *pContext) pContext->FifosNotEmpty.notify_all(); } -static TileSet gSingleThreadLockedTiles; - template void QueueWork(SWR_CONTEXT *pContext) { @@ -240,7 +238,7 @@ void QueueWork(SWR_CONTEXT *pContext) { uint32_t curDraw[2] = { pContext->pCurDrawContext->drawId, pContext->pCurDrawContext->drawId }; WorkOnFifoFE(pContext, 0, curDraw[0]); - WorkOnFifoBE(pContext, 0, curDraw[1], gSingleThreadLockedTiles, 0, 0); + WorkOnFifoBE(pContext, 0, curDraw[1], pContext->singleThreadLockedTiles, 0, 0); } else { @@ -291,16 +289,14 @@ DRAW_CONTEXT* GetDrawContext(SWR_CONTEXT *pContext, bool isSplitDraw = false) uint64_t curDraw = pContext->dcRing.GetHead(); uint32_t dcIndex = curDraw % KNOB_MAX_DRAWS_IN_FLIGHT; - static uint64_t lastDrawChecked; - static uint32_t lastFrameChecked; - if ((pContext->frameCount - lastFrameChecked) > 2 || - (curDraw - lastDrawChecked) > 0x10000) + if ((pContext->frameCount - pContext->lastFrameChecked) > 2 || + (curDraw - pContext->lastDrawChecked) > 0x10000) { // Take this opportunity to clean-up old arena allocations pContext->cachingArenaAllocator.FreeOldBlocks(); - lastFrameChecked = pContext->frameCount; - lastDrawChecked = curDraw; + pContext->lastFrameChecked = pContext->frameCount; + pContext->lastDrawChecked = curDraw; } DRAW_CONTEXT* pCurDrawContext = &pContext->dcRing[dcIndex]; diff --git a/src/gallium/drivers/swr/rasterizer/core/context.h b/src/gallium/drivers/swr/rasterizer/core/context.h index 320aa924c4f..0a85ebe30a5 100644 --- a/src/gallium/drivers/swr/rasterizer/core/context.h +++ b/src/gallium/drivers/swr/rasterizer/core/context.h @@ -488,6 +488,10 @@ struct SWR_CONTEXT CachingAllocator cachingArenaAllocator; uint32_t frameCount; + + uint32_t lastFrameChecked; + uint64_t lastDrawChecked; + TileSet singleThreadLockedTiles; }; void WaitForDependencies(SWR_CONTEXT *pContext, uint64_t drawId); -- 2.30.2