swr: [rasterizer core] archrast fixes
- Immediately sleep threads until thread data is initialized - Fix some compile bugs with AR enabled Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
This commit is contained in:
parent
aaeb07989e
commit
4198520a82
|
@ -55,6 +55,11 @@ static INLINE SWR_CONTEXT* GetContext(HANDLE hContext)
|
||||||
return (SWR_CONTEXT*)hContext;
|
return (SWR_CONTEXT*)hContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WakeAllThreads(SWR_CONTEXT *pContext)
|
||||||
|
{
|
||||||
|
pContext->FifosNotEmpty.notify_all();
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief Create SWR Context.
|
/// @brief Create SWR Context.
|
||||||
/// @param pCreateInfo - pointer to creation info.
|
/// @param pCreateInfo - pointer to creation info.
|
||||||
|
@ -154,6 +159,8 @@ HANDLE SwrCreateContext(
|
||||||
|
|
||||||
pCreateInfo->contextSaveSize = sizeof(API_STATE);
|
pCreateInfo->contextSaveSize = sizeof(API_STATE);
|
||||||
|
|
||||||
|
WakeAllThreads(pContext);
|
||||||
|
|
||||||
return (HANDLE)pContext;
|
return (HANDLE)pContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,11 +169,6 @@ void CopyState(DRAW_STATE& dst, const DRAW_STATE& src)
|
||||||
memcpy(&dst.state, &src.state, sizeof(API_STATE));
|
memcpy(&dst.state, &src.state, sizeof(API_STATE));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WakeAllThreads(SWR_CONTEXT *pContext)
|
|
||||||
{
|
|
||||||
pContext->FifosNotEmpty.notify_all();
|
|
||||||
}
|
|
||||||
|
|
||||||
template<bool IsDraw>
|
template<bool IsDraw>
|
||||||
void QueueWork(SWR_CONTEXT *pContext)
|
void QueueWork(SWR_CONTEXT *pContext)
|
||||||
{
|
{
|
||||||
|
|
|
@ -288,7 +288,7 @@ void ProcessStoreTileBE(DRAW_CONTEXT *pDC, uint32_t workerId, uint32_t macroTile
|
||||||
|
|
||||||
AR_BEGIN(BEStoreTiles, pDC->drawId);
|
AR_BEGIN(BEStoreTiles, pDC->drawId);
|
||||||
|
|
||||||
#ifdef KNOB_ENABLE_RDTSC
|
#if defined(KNOB_ENABLE_RDTSC) || defined(KNOB_ENABLE_AR)
|
||||||
uint32_t numTiles = 0;
|
uint32_t numTiles = 0;
|
||||||
#endif
|
#endif
|
||||||
SWR_FORMAT srcFormat;
|
SWR_FORMAT srcFormat;
|
||||||
|
|
|
@ -1295,7 +1295,7 @@ void ProcessDraw(
|
||||||
fetchInfo.StartVertex = work.startVertex;
|
fetchInfo.StartVertex = work.startVertex;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef KNOB_ENABLE_RDTSC
|
#if defined(KNOB_ENABLE_RDTSC) || defined(KNOB_ENABLE_AR)
|
||||||
uint32_t numPrims = GetNumPrims(state.topology, work.numVerts);
|
uint32_t numPrims = GetNumPrims(state.topology, work.numVerts);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -718,6 +718,11 @@ DWORD workerThreadMain(LPVOID pData)
|
||||||
// the worker can safely increment its oldestDraw counter and move on to the next draw.
|
// the worker can safely increment its oldestDraw counter and move on to the next draw.
|
||||||
std::unique_lock<std::mutex> lock(pContext->WaitLock, std::defer_lock);
|
std::unique_lock<std::mutex> lock(pContext->WaitLock, std::defer_lock);
|
||||||
|
|
||||||
|
// Suspend thread immediately. SwrCreateContext or QueueWork will wake this up again.
|
||||||
|
lock.lock();
|
||||||
|
pContext->FifosNotEmpty.wait(lock);
|
||||||
|
lock.unlock();
|
||||||
|
|
||||||
auto threadHasWork = [&](uint32_t curDraw) { return curDraw != pContext->dcRing.GetHead(); };
|
auto threadHasWork = [&](uint32_t curDraw) { return curDraw != pContext->dcRing.GetHead(); };
|
||||||
|
|
||||||
uint32_t curDrawBE = 0;
|
uint32_t curDrawBE = 0;
|
||||||
|
|
Loading…
Reference in New Issue