swr: [rasterizer core] move some global variables to SWR_CONTEXT
authorTim Rowley <timothy.o.rowley@intel.com>
Thu, 11 Aug 2016 16:49:43 +0000 (10:49 -0600)
committerTim Rowley <timothy.o.rowley@intel.com>
Wed, 17 Aug 2016 22:08:55 +0000 (17:08 -0500)
Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
src/gallium/drivers/swr/rasterizer/core/api.cpp
src/gallium/drivers/swr/rasterizer/core/context.h

index 15485012a08d6cce53bcb19ee816f849e842ea1e..e447bf6fbe3308fcaa00e13def6c619fb04cb983 100644 (file)
@@ -199,8 +199,6 @@ void WakeAllThreads(SWR_CONTEXT *pContext)
     pContext->FifosNotEmpty.notify_all();
 }
 
-static TileSet gSingleThreadLockedTiles;
-
 template<bool IsDraw>
 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];
index 320aa924c4fb8718d92cea2409be39637300af77..0a85ebe30a594d9cf60b07f97176b46a89dbe1ac 100644 (file)
@@ -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);