From: Tim Rowley Date: Wed, 2 Nov 2016 21:29:29 +0000 (-0500) Subject: swr: [rasterizer core] various code style changes X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5912552947cc84e794543589388d18aaf4ff6c86;p=mesa.git swr: [rasterizer core] various code style changes Reviewed-by: Bruce Cherniak --- diff --git a/src/gallium/drivers/swr/rasterizer/core/api.cpp b/src/gallium/drivers/swr/rasterizer/core/api.cpp index bf7a9f606f5..3c41aecf9b0 100644 --- a/src/gallium/drivers/swr/rasterizer/core/api.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/api.cpp @@ -155,6 +155,7 @@ HANDLE SwrCreateContext( pContext->pfnUpdateSoWriteOffset = pCreateInfo->pfnUpdateSoWriteOffset; pContext->pfnUpdateStats = pCreateInfo->pfnUpdateStats; pContext->pfnUpdateStatsFE = pCreateInfo->pfnUpdateStatsFE; + // pass pointer to bucket manager back to caller #ifdef KNOB_ENABLE_RDTSC @@ -333,6 +334,7 @@ DRAW_CONTEXT* GetDrawContext(SWR_CONTEXT *pContext, bool isSplitDraw = false) pCurDrawContext->drawId = pContext->dcRing.GetHead(); pCurDrawContext->cleanupState = true; + } else { @@ -822,6 +824,7 @@ extern PFN_BACKEND_FUNC gBackendPixelRateTable[SWR_MULTISAMPLE_TYPE_COUNT][SWR_M extern PFN_BACKEND_FUNC gBackendSampleRateTable[SWR_MULTISAMPLE_TYPE_COUNT][SWR_INPUT_COVERAGE_COUNT][2][2]; void SetupPipeline(DRAW_CONTEXT *pDC) { + SWR_CONTEXT* pContext = pDC->pContext; DRAW_STATE* pState = pDC->pState; const SWR_RASTSTATE &rastState = pState->state.rastState; const SWR_PS_STATE &psState = pState->state.psState; @@ -891,6 +894,7 @@ void SetupPipeline(DRAW_CONTEXT *pDC) break; }; + // disable clipper if viewport transform is disabled if (pState->state.frontendState.vpTransformDisable) { @@ -912,6 +916,7 @@ void SetupPipeline(DRAW_CONTEXT *pDC) pState->pfnProcessPrims = nullptr; } + // set up the frontend attribute count pState->state.feNumAttributes = 0; const SWR_BACKEND_STATE& backendState = pState->state.backendState; @@ -1010,6 +1015,8 @@ void InitDraw( SetupMacroTileScissors(pDC); SetupPipeline(pDC); } + + } ////////////////////////////////////////////////////////////////////////// @@ -1137,6 +1144,7 @@ void DrawInstanced( pState->rastState.cullMode = SWR_CULLMODE_NONE; } + int draw = 0; while (remainingVerts) { @@ -1175,6 +1183,7 @@ void DrawInstanced( pDC = GetDrawContext(pContext); pDC->pState->state.rastState.cullMode = oldCullMode; + AR_API_END(APIDraw, numVertices * numInstances); } @@ -1276,6 +1285,7 @@ void DrawIndexedInstance( pState->rastState.cullMode = SWR_CULLMODE_NONE; } + while (remainingIndices) { uint32_t numIndicesForDraw = (remainingIndices < maxIndicesPerDraw) ? @@ -1283,6 +1293,7 @@ void DrawIndexedInstance( // When breaking up draw, we need to obtain new draw context for each iteration. bool isSplitDraw = (draw > 0) ? true : false; + pDC = GetDrawContext(pContext, isSplitDraw); InitDraw(pDC, isSplitDraw); @@ -1314,9 +1325,10 @@ void DrawIndexedInstance( draw++; } - // restore culling state + // Restore culling state pDC = GetDrawContext(pContext); pDC->pState->state.rastState.cullMode = oldCullMode; + AR_API_END(APIDrawIndexed, numIndices * numInstances); } @@ -1626,3 +1638,4 @@ void SWR_API SwrEndFrame( pContext->frameCount++; } + diff --git a/src/gallium/drivers/swr/rasterizer/core/api.h b/src/gallium/drivers/swr/rasterizer/core/api.h index c4d80165d95..cf4bf688ca1 100644 --- a/src/gallium/drivers/swr/rasterizer/core/api.h +++ b/src/gallium/drivers/swr/rasterizer/core/api.h @@ -206,6 +206,7 @@ struct SWR_CREATECONTEXT_INFO PFN_UPDATE_STATS pfnUpdateStats; PFN_UPDATE_STATS_FE pfnUpdateStatsFE; + // Pointer to rdtsc buckets mgr returned to the caller. // Only populated when KNOB_ENABLE_RDTSC is set BucketManager* pBucketMgr; @@ -648,4 +649,5 @@ void SWR_API SwrEnableStatsBE( void SWR_API SwrEndFrame( HANDLE hContext); -#endif//__SWR_API_H__ + +#endif diff --git a/src/gallium/drivers/swr/rasterizer/core/binner.cpp b/src/gallium/drivers/swr/rasterizer/core/binner.cpp index 75ddce95ad7..f015f21d837 100644 --- a/src/gallium/drivers/swr/rasterizer/core/binner.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/binner.cpp @@ -761,6 +761,8 @@ void BinTriangles( _simd_store_si((simdscalari*)aRTAI, _simd_setzero_si()); } +endBinTriangles: + // scan remaining valid triangles and bin each separately while (_BitScanForward(&triIndex, triMask)) { @@ -839,7 +841,6 @@ void BinTriangles( triMask &= ~(1 << triIndex); } -endBinTriangles: AR_END(FEBinTriangles, 1); } @@ -860,6 +861,7 @@ PFN_PROCESS_PRIMS GetBinTrianglesFunc(bool IsConservative) return TemplateArgUnroller::GetFunc(IsConservative); } + ////////////////////////////////////////////////////////////////////////// /// @brief Bin SIMD points to the backend. Only supports point size of 1 /// @param pDC - pointer to draw context. diff --git a/src/gallium/drivers/swr/rasterizer/core/clip.h b/src/gallium/drivers/swr/rasterizer/core/clip.h index 3d86b2827a8..fcb2ecb2673 100644 --- a/src/gallium/drivers/swr/rasterizer/core/clip.h +++ b/src/gallium/drivers/swr/rasterizer/core/clip.h @@ -502,8 +502,7 @@ public: void ExecuteStage(PA_STATE& pa, simdvector prim[], uint32_t primMask, simdscalari primId, simdscalari viewportIdx) { SWR_ASSERT(pa.pDC != nullptr); - - SWR_CONTEXT *pContext = pa.pDC->pContext; + SWR_CONTEXT* pContext = pa.pDC->pContext; // set up binner based on PA state PFN_PROCESS_PRIMS pfnBinner; @@ -524,6 +523,7 @@ public: break; }; + // update clipper invocations pipeline stat uint32_t numInvoc = _mm_popcnt_u32(primMask); UPDATE_STAT_FE(CInvocations, numInvoc); diff --git a/src/gallium/drivers/swr/rasterizer/core/context.h b/src/gallium/drivers/swr/rasterizer/core/context.h index e7c462da8b9..5eb13651bcd 100644 --- a/src/gallium/drivers/swr/rasterizer/core/context.h +++ b/src/gallium/drivers/swr/rasterizer/core/context.h @@ -415,6 +415,8 @@ struct DRAW_CONTEXT volatile int32_t threadsDone; SYNC_DESC retireCallback; // Call this func when this DC is retired. + + }; static_assert((sizeof(DRAW_CONTEXT) & 63) == 0, "Invalid size for DRAW_CONTEXT"); @@ -496,6 +498,7 @@ struct SWR_CONTEXT PFN_UPDATE_STATS pfnUpdateStats; PFN_UPDATE_STATS_FE pfnUpdateStatsFE; + // Global Stats SWR_STATS* pStats; diff --git a/src/gallium/drivers/swr/rasterizer/core/frontend.cpp b/src/gallium/drivers/swr/rasterizer/core/frontend.cpp index bc8a1dae37e..a208a36a218 100644 --- a/src/gallium/drivers/swr/rasterizer/core/frontend.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/frontend.cpp @@ -1388,6 +1388,7 @@ void ProcessDraw( pa.Reset(); } + AR_END(FEProcessDraw, numPrims * work.numInstances); }