Commit 5a593bec authored by Krzysztof Raszkowski's avatar Krzysztof Raszkowski
Browse files

gallium/swr: fix rdtsc debug statistics mechanism


Reviewed-by: Jan Zielinski's avatarJan Zielinski <jan.zielinski@intel.com>
Tested-by: Marge Bot <mesa/mesa!3812>
Part-of: <mesa/mesa!3812>
parent dd16ad10
......@@ -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,
......
......@@ -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,
......
......@@ -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,
......
......@@ -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,
......
......@@ -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
}
......
......@@ -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);
......@@ -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
}
......
......@@ -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);
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment