diff options
author | Tim Rowley <[email protected]> | 2017-07-06 13:16:18 -0500 |
---|---|---|
committer | Andres Gomez <[email protected]> | 2017-07-12 19:32:08 +0300 |
commit | d856e97d928c97c159964f1edd07f95909f572f0 (patch) | |
tree | 7b0683427df2a8e3f8b07e9a25728b16c937eed8 /src/gallium | |
parent | 7bd9eccbfeb178389e7a55bcfa1f4877f6289e5f (diff) |
swr/rast: Correctly allocate SWR_STATS memory as cacheline aligned
Cacheline alignment of SWR_STATS to prevent sharing of cachelines
between threads (performance).
Gets rid of gcc-7.1 warning about using c++17's over-aligned new
feature.
Cc: [email protected]
Reviewed-by: Bruce Cherniak <[email protected]>
(cherry picked from commit bab03c06fc79ec5624982777684d0c5f123c127c)
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/swr/rasterizer/core/api.cpp | 6 | ||||
-rw-r--r-- | src/gallium/drivers/swr/rasterizer/core/threads.cpp | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/core/api.cpp b/src/gallium/drivers/swr/rasterizer/core/api.cpp index 5c3225d58b2..2423aa7378f 100644 --- a/src/gallium/drivers/swr/rasterizer/core/api.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/api.cpp @@ -108,7 +108,7 @@ HANDLE SwrCreateContext( CreateThreadPool(pContext, &pContext->threadPool); pContext->ppScratch = new uint8_t*[pContext->NumWorkerThreads]; - pContext->pStats = new SWR_STATS[pContext->NumWorkerThreads]; + pContext->pStats = (SWR_STATS*)AlignedMalloc(sizeof(SWR_STATS) * pContext->NumWorkerThreads, 64); #if defined(KNOB_ENABLE_AR) // Setup ArchRast thread contexts which includes +1 for API thread. @@ -367,7 +367,7 @@ void SwrDestroyContext(HANDLE hContext) // free the fifos for (uint32_t i = 0; i < KNOB_MAX_DRAWS_IN_FLIGHT; ++i) { - delete[] pContext->dcRing[i].dynState.pStats; + AlignedFree(pContext->dcRing[i].dynState.pStats); delete pContext->dcRing[i].pArena; delete pContext->dsRing[i].pArena; pContext->pMacroTileManagerArray[i].~MacroTileMgr(); @@ -392,7 +392,7 @@ void SwrDestroyContext(HANDLE hContext) } delete[] pContext->ppScratch; - delete[] pContext->pStats; + AlignedFree(pContext->pStats); delete(pContext->pHotTileMgr); diff --git a/src/gallium/drivers/swr/rasterizer/core/threads.cpp b/src/gallium/drivers/swr/rasterizer/core/threads.cpp index e3ad2585c01..4c223171be5 100644 --- a/src/gallium/drivers/swr/rasterizer/core/threads.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/threads.cpp @@ -363,7 +363,7 @@ INLINE void UpdateClientStats(SWR_CONTEXT* pContext, uint32_t workerId, DRAW_CON } DRAW_DYNAMIC_STATE& dynState = pDC->dynState; - SWR_STATS stats{ 0 }; + OSALIGNLINE(SWR_STATS) stats{ 0 }; // Sum up stats across all workers before sending to client. for (uint32_t i = 0; i < pContext->NumWorkerThreads; ++i) @@ -972,7 +972,7 @@ void CreateThreadPool(SWR_CONTEXT* pContext, THREAD_POOL* pPool) // Initialize DRAW_CONTEXT's per-thread stats for (uint32_t dc = 0; dc < KNOB_MAX_DRAWS_IN_FLIGHT; ++dc) { - pContext->dcRing[dc].dynState.pStats = new SWR_STATS[numThreads]; + pContext->dcRing[dc].dynState.pStats = (SWR_STATS*)AlignedMalloc(sizeof(SWR_STATS) * numThreads, 64); memset(pContext->dcRing[dc].dynState.pStats, 0, sizeof(SWR_STATS) * numThreads); } |