diff options
author | Krzysztof Raszkowski <[email protected]> | 2020-02-13 14:41:41 +0100 |
---|---|---|
committer | Krzysztof Raszkowski <[email protected]> | 2020-02-13 15:33:27 +0100 |
commit | 5a593bec16b1e5830bc57462abc0b056342ac876 (patch) | |
tree | 6d90e1574c94afb22649f037d0690e720d7717ea /src/gallium/drivers/swr | |
parent | dd16ad107da7ade9c6c0f738626b29cfd875f51f (diff) |
gallium/swr: fix rdtsc debug statistics mechanism
Reviewed-by: Jan Zielinski <[email protected]>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3812>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3812>
Diffstat (limited to 'src/gallium/drivers/swr')
9 files changed, 44 insertions, 58 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/core/api.h b/src/gallium/drivers/swr/rasterizer/core/api.h index 29651c9beed..77f20e5834b 100644 --- a/src/gallium/drivers/swr/rasterizer/core/api.h +++ b/src/gallium/drivers/swr/rasterizer/core/api.h @@ -97,13 +97,13 @@ struct SWR_RECT ////////////////////////////////////////////////////////////////////////// /// @brief Function signature for load hot tiles -/// @param hPrivateContext - handle to private data +/// @param hDC - handle to DRAW_CONTEXT /// @param dstFormat - format of the hot tile /// @param renderTargetIndex - render target to store, can be color, depth or stencil /// @param x - destination x coordinate /// @param y - destination y coordinate /// @param pDstHotTile - pointer to the hot tile surface -typedef void(SWR_API* PFN_LOAD_TILE)(HANDLE hPrivateContext, +typedef void(SWR_API* PFN_LOAD_TILE)(HANDLE hDC, HANDLE hWorkerPrivateData, SWR_FORMAT dstFormat, SWR_RENDERTARGET_ATTACHMENT renderTargetIndex, @@ -114,13 +114,13 @@ typedef void(SWR_API* PFN_LOAD_TILE)(HANDLE hPrivateContext ////////////////////////////////////////////////////////////////////////// /// @brief Function signature for store hot tiles -/// @param hPrivateContext - handle to private data +/// @param hDC - handle to DRAW_CONTEXT /// @param srcFormat - format of the hot tile /// @param renderTargetIndex - render target to store, can be color, depth or stencil /// @param x - destination x coordinate /// @param y - destination y coordinate /// @param pSrcHotTile - pointer to the hot tile surface -typedef void(SWR_API* PFN_STORE_TILE)(HANDLE hPrivateContext, +typedef void(SWR_API* PFN_STORE_TILE)(HANDLE hDC, HANDLE hWorkerPrivateData, SWR_FORMAT srcFormat, SWR_RENDERTARGET_ATTACHMENT renderTargetIndex, diff --git a/src/gallium/drivers/swr/rasterizer/core/backend.cpp b/src/gallium/drivers/swr/rasterizer/core/backend.cpp index 49b163ee6ae..bb9d6f7dc52 100644 --- a/src/gallium/drivers/swr/rasterizer/core/backend.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/backend.cpp @@ -175,7 +175,7 @@ void ProcessStoreTileBE(DRAW_CONTEXT* pDC, int32_t destX = KNOB_MACROTILE_X_DIM * x; int32_t destY = KNOB_MACROTILE_Y_DIM * y; - pContext->pfnStoreTile(GetPrivateState(pDC), + pContext->pfnStoreTile(pDC, hWorkerPrivateData, srcFormat, attachment, diff --git a/src/gallium/drivers/swr/rasterizer/core/tilemgr.cpp b/src/gallium/drivers/swr/rasterizer/core/tilemgr.cpp index a23de56a0a5..a02fa336277 100644 --- a/src/gallium/drivers/swr/rasterizer/core/tilemgr.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/tilemgr.cpp @@ -184,7 +184,7 @@ HOTTILE* HotTileMgr::GetHotTile(SWR_CONTEXT* pContext, if (hotTile.state == HOTTILE_DIRTY) { - pContext->pfnStoreTile(GetPrivateState(pDC), + pContext->pfnStoreTile(pDC, hWorkerPrivateData, format, attachment, @@ -194,7 +194,7 @@ HOTTILE* HotTileMgr::GetHotTile(SWR_CONTEXT* pContext, hotTile.pBuffer); } - pContext->pfnLoadTile(GetPrivateState(pDC), + pContext->pfnLoadTile(pDC, hWorkerPrivateData, format, attachment, @@ -370,7 +370,7 @@ void HotTileMgr::InitializeHotTiles(SWR_CONTEXT* pContext, { RDTSC_BEGIN(pContext->pBucketMgr, BELoadTiles, pDC->drawId); // invalid hottile before draw requires a load from surface before we can draw to it - pContext->pfnLoadTile(GetPrivateState(pDC), + pContext->pfnLoadTile(pDC, hWorkerPrivateData, KNOB_COLOR_HOT_TILE_FORMAT, (SWR_RENDERTARGET_ATTACHMENT)(SWR_ATTACHMENT_COLOR0 + rtSlot), @@ -401,7 +401,7 @@ void HotTileMgr::InitializeHotTiles(SWR_CONTEXT* pContext, { RDTSC_BEGIN(pContext->pBucketMgr, BELoadTiles, pDC->drawId); // invalid hottile before draw requires a load from surface before we can draw to it - pContext->pfnLoadTile(GetPrivateState(pDC), + pContext->pfnLoadTile(pDC, hWorkerPrivateData, KNOB_DEPTH_HOT_TILE_FORMAT, SWR_ATTACHMENT_DEPTH, @@ -431,7 +431,7 @@ void HotTileMgr::InitializeHotTiles(SWR_CONTEXT* pContext, { RDTSC_BEGIN(pContext->pBucketMgr, BELoadTiles, pDC->drawId); // invalid hottile before draw requires a load from surface before we can draw to it - pContext->pfnLoadTile(GetPrivateState(pDC), + pContext->pfnLoadTile(pDC, hWorkerPrivateData, KNOB_STENCIL_HOT_TILE_FORMAT, SWR_ATTACHMENT_STENCIL, diff --git a/src/gallium/drivers/swr/rasterizer/memory/InitMemory.h b/src/gallium/drivers/swr/rasterizer/memory/InitMemory.h index 6838ddc701d..a3ed7b3cbdb 100644 --- a/src/gallium/drivers/swr/rasterizer/memory/InitMemory.h +++ b/src/gallium/drivers/swr/rasterizer/memory/InitMemory.h @@ -42,6 +42,7 @@ SWR_FUNC(void, SwrLoadHotTile, HANDLE hWorkerPrivateData, const SWR_SURFACE_STATE* pSrcSurface, + BucketManager* pBucketManager, SWR_FORMAT dstFormat, SWR_RENDERTARGET_ATTACHMENT renderTargetIndex, uint32_t x, @@ -60,6 +61,7 @@ SWR_FUNC(void, SwrStoreHotTileToSurface, HANDLE hWorkerPrivateData, SWR_SURFACE_STATE* pDstSurface, + BucketManager* pBucketManager, SWR_FORMAT srcFormat, SWR_RENDERTARGET_ATTACHMENT renderTargetIndex, uint32_t x, diff --git a/src/gallium/drivers/swr/rasterizer/memory/LoadTile.cpp b/src/gallium/drivers/swr/rasterizer/memory/LoadTile.cpp index 8033304d20c..a26d45d130f 100644 --- a/src/gallium/drivers/swr/rasterizer/memory/LoadTile.cpp +++ b/src/gallium/drivers/swr/rasterizer/memory/LoadTile.cpp @@ -27,21 +27,6 @@ ******************************************************************************/ #include "LoadTile.h" - -static void BUCKETS_START(UINT id) -{ -#ifdef KNOB_ENABLE_RDTSC - gBucketMgr.StartBucket(id); -#endif -} - -static void BUCKETS_STOP(UINT id) -{ -#ifdef KNOB_ENABLE_RDTSC - gBucketMgr.StopBucket(id); -#endif -} - // on demand buckets for load tiles static std::vector<int> sBuckets(NUM_SWR_FORMATS, -1); static std::mutex sBucketMutex; @@ -56,6 +41,7 @@ static std::mutex sBucketMutex; void SwrLoadHotTile( HANDLE hWorkerPrivateData, const SWR_SURFACE_STATE *pSrcSurface, + BucketManager* pBucketMgr, SWR_FORMAT dstFormat, SWR_RENDERTARGET_ATTACHMENT renderTargetIndex, uint32_t x, uint32_t y, uint32_t renderTargetArrayIndex, @@ -147,15 +133,19 @@ void SwrLoadHotTile( { const SWR_FORMAT_INFO& info = GetFormatInfo(pSrcSurface->format); BUCKET_DESC desc{ info.name, "", false, 0xffffffff }; - sBuckets[pSrcSurface->format] = gBucketMgr.RegisterBucket(desc); + sBuckets[pSrcSurface->format] = pBucketMgr->RegisterBucket(desc); } sBucketMutex.unlock(); } #endif - BUCKETS_START(sBuckets[pSrcSurface->format]); +#ifdef KNOB_ENABLE_RDTSC + pBucketMgr->StartBucket(sBuckets[pSrcSurface->format]); +#endif pfnLoadTiles(pSrcSurface, pDstHotTile, x, y, renderTargetArrayIndex); - BUCKETS_STOP(sBuckets[pSrcSurface->format]); +#ifdef KNOB_ENABLE_RDTSC + pBucketMgr->StopBucket(sBuckets[pSrcSurface->format]); +#endif } diff --git a/src/gallium/drivers/swr/rasterizer/memory/LoadTile.h b/src/gallium/drivers/swr/rasterizer/memory/LoadTile.h index 37be28c5ec7..f74c3fdf4b0 100644 --- a/src/gallium/drivers/swr/rasterizer/memory/LoadTile.h +++ b/src/gallium/drivers/swr/rasterizer/memory/LoadTile.h @@ -347,7 +347,8 @@ static INLINE void InitLoadTileDepthTable(PFN_LOAD_TILES(&table)[NUM_SWR_FORMATS void SwrLoadHotTile( HANDLE hWorkerPrivateData, const SWR_SURFACE_STATE *pSrcSurface, + BucketManager* pBucketMgr, SWR_FORMAT dstFormat, SWR_RENDERTARGET_ATTACHMENT renderTargetIndex, uint32_t x, uint32_t y, uint32_t renderTargetArrayIndex, - uint8_t *pDstHotTile);
\ No newline at end of file + uint8_t *pDstHotTile); diff --git a/src/gallium/drivers/swr/rasterizer/memory/StoreTile.cpp b/src/gallium/drivers/swr/rasterizer/memory/StoreTile.cpp index 53b82c4c12c..9fee13a045a 100644 --- a/src/gallium/drivers/swr/rasterizer/memory/StoreTile.cpp +++ b/src/gallium/drivers/swr/rasterizer/memory/StoreTile.cpp @@ -33,20 +33,6 @@ PFN_STORE_TILES sStoreTilesTableColor[SWR_TILE_MODE_COUNT][NUM_SWR_FORMATS] = {} PFN_STORE_TILES sStoreTilesTableDepth[SWR_TILE_MODE_COUNT][NUM_SWR_FORMATS] = {}; PFN_STORE_TILES sStoreTilesTableStencil[SWR_TILE_MODE_COUNT][NUM_SWR_FORMATS] = {}; -static void BUCKETS_START(UINT id) -{ -#ifdef KNOB_ENABLE_RDTSC - gBucketMgr.StartBucket(id); -#endif -} - -static void BUCKETS_STOP(UINT id) -{ -#ifdef KNOB_ENABLE_RDTSC - gBucketMgr.StopBucket(id); -#endif -} - // on demand buckets for store tiles static std::mutex sBucketMutex; static std::vector<int32_t> sBuckets(NUM_SWR_FORMATS, -1); @@ -61,6 +47,7 @@ static std::vector<int32_t> sBuckets(NUM_SWR_FORMATS, -1); void SwrStoreHotTileToSurface( HANDLE hWorkerPrivateData, SWR_SURFACE_STATE *pDstSurface, + BucketManager* pBucketMgr, SWR_FORMAT srcFormat, SWR_RENDERTARGET_ATTACHMENT renderTargetIndex, uint32_t x, uint32_t y, uint32_t renderTargetArrayIndex, @@ -108,15 +95,20 @@ void SwrStoreHotTileToSurface( { const SWR_FORMAT_INFO& info = GetFormatInfo(pDstSurface->format); BUCKET_DESC desc{info.name, "", false, 0xffffffff}; - sBuckets[pDstSurface->format] = gBucketMgr.RegisterBucket(desc); + sBuckets[pDstSurface->format] = pBucketMgr->RegisterBucket(desc); } sBucketMutex.unlock(); } #endif - BUCKETS_START(sBuckets[pDstSurface->format]); +#ifdef KNOB_ENABLE_RDTSC + pBucketMgr->StartBucket(sBuckets[pDstSurface->format]); +#endif pfnStoreTiles(pSrcHotTile, pDstSurface, x, y, renderTargetArrayIndex); - BUCKETS_STOP(sBuckets[pDstSurface->format]); +#ifdef KNOB_ENABLE_RDTSC + pBucketMgr->StopBucket(sBuckets[pDstSurface->format]); +#endif + } diff --git a/src/gallium/drivers/swr/rasterizer/memory/StoreTile.h b/src/gallium/drivers/swr/rasterizer/memory/StoreTile.h index 9b7f5aa3efc..2d32e90330e 100644 --- a/src/gallium/drivers/swr/rasterizer/memory/StoreTile.h +++ b/src/gallium/drivers/swr/rasterizer/memory/StoreTile.h @@ -2044,7 +2044,8 @@ void InitStoreTilesTableStencil( void SwrStoreHotTileToSurface( HANDLE hWorkerPrivateData, SWR_SURFACE_STATE *pDstSurface, + BucketManager* pBucketMgr, SWR_FORMAT srcFormat, SWR_RENDERTARGET_ATTACHMENT renderTargetIndex, uint32_t x, uint32_t y, uint32_t renderTargetArrayIndex, - uint8_t *pSrcHotTile);
\ No newline at end of file + uint8_t *pSrcHotTile); diff --git a/src/gallium/drivers/swr/swr_memory.h b/src/gallium/drivers/swr/swr_memory.h index c7c05fb7c65..bf6eaa34758 100644 --- a/src/gallium/drivers/swr/swr_memory.h +++ b/src/gallium/drivers/swr/swr_memory.h @@ -22,35 +22,35 @@ ***************************************************************************/ #pragma once - +#include "rasterizer/core/context.h" INLINE void -swr_LoadHotTile(HANDLE hPrivateContext, +swr_LoadHotTile(HANDLE hDC, HANDLE hWorkerPrivateData, SWR_FORMAT dstFormat, SWR_RENDERTARGET_ATTACHMENT renderTargetIndex, UINT x, UINT y, uint32_t renderTargetArrayIndex, uint8_t* pDstHotTile) { - // Grab source surface state from private context - swr_draw_context *pDC = (swr_draw_context*)hPrivateContext; - SWR_SURFACE_STATE *pSrcSurface = &pDC->renderTargets[renderTargetIndex]; + DRAW_CONTEXT *pDC = (DRAW_CONTEXT*)hDC; + swr_draw_context *pSDC = (swr_draw_context*)GetPrivateState(pDC); + SWR_SURFACE_STATE *pSrcSurface = &pSDC->renderTargets[renderTargetIndex]; - pDC->pTileAPI->pfnSwrLoadHotTile(hWorkerPrivateData, pSrcSurface, dstFormat, renderTargetIndex, x, y, renderTargetArrayIndex, pDstHotTile); + pSDC->pTileAPI->pfnSwrLoadHotTile(hWorkerPrivateData, pSrcSurface, pDC->pContext->pBucketMgr, dstFormat, renderTargetIndex, x, y, renderTargetArrayIndex, pDstHotTile); } INLINE void -swr_StoreHotTile(HANDLE hPrivateContext, +swr_StoreHotTile(HANDLE hDC, HANDLE hWorkerPrivateData, SWR_FORMAT srcFormat, SWR_RENDERTARGET_ATTACHMENT renderTargetIndex, UINT x, UINT y, uint32_t renderTargetArrayIndex, uint8_t* pSrcHotTile) { - // Grab destination surface state from private context - swr_draw_context *pDC = (swr_draw_context*)hPrivateContext; - SWR_SURFACE_STATE *pDstSurface = &pDC->renderTargets[renderTargetIndex]; + DRAW_CONTEXT *pDC = (DRAW_CONTEXT*)hDC; + swr_draw_context *pSDC = (swr_draw_context*)GetPrivateState(pDC); + SWR_SURFACE_STATE *pDstSurface = &pSDC->renderTargets[renderTargetIndex]; - pDC->pTileAPI->pfnSwrStoreHotTileToSurface(hWorkerPrivateData, pDstSurface, srcFormat, renderTargetIndex, x, y, renderTargetArrayIndex, pSrcHotTile); + pSDC->pTileAPI->pfnSwrStoreHotTileToSurface(hWorkerPrivateData, pDstSurface, pDC->pContext->pBucketMgr, srcFormat, renderTargetIndex, x, y, renderTargetArrayIndex, pSrcHotTile); } INLINE gfxptr_t |