Mesa (master): swr: [rasterizer core] move some global variables to SWR_CONTEXT

Tim Rowley torowley at kemper.freedesktop.org
Wed Aug 17 22:12:46 UTC 2016


Module: Mesa
Branch: master
Commit: c7c1a03f909c15338b878418ae76498685aeb59b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c7c1a03f909c15338b878418ae76498685aeb59b

Author: Tim Rowley <timothy.o.rowley at intel.com>
Date:   Thu Aug 11 10:49:43 2016 -0600

swr: [rasterizer core] move some global variables to SWR_CONTEXT

Signed-off-by: Tim Rowley <timothy.o.rowley at intel.com>

---

 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 1548501..e447bf6 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<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];
diff --git a/src/gallium/drivers/swr/rasterizer/core/context.h b/src/gallium/drivers/swr/rasterizer/core/context.h
index 320aa92..0a85ebe 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);




More information about the mesa-commit mailing list