mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 18:18:06 +02:00
swr: [rasterizer core] generalize compute dispatch mechanism
Generalize compute dispatch mechanism to support other types of dispatches. Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
This commit is contained in:
parent
33a1a09eb0
commit
b8a6f06c85
3 changed files with 15 additions and 4 deletions
|
|
@ -1425,7 +1425,7 @@ void SwrDispatch(
|
|||
uint32_t totalThreadGroups = threadGroupCountX * threadGroupCountY * threadGroupCountZ;
|
||||
uint32_t dcIndex = pDC->drawId % KNOB_MAX_DRAWS_IN_FLIGHT;
|
||||
pDC->pDispatch = &pContext->pDispatchQueueArray[dcIndex];
|
||||
pDC->pDispatch->initialize(totalThreadGroups, pTaskData);
|
||||
pDC->pDispatch->initialize(totalThreadGroups, pTaskData, &ProcessComputeBE);
|
||||
|
||||
QueueDispatch(pContext);
|
||||
AR_API_END(APIDispatch, threadGroupCountX * threadGroupCountY * threadGroupCountZ);
|
||||
|
|
|
|||
|
|
@ -670,8 +670,7 @@ void WorkOnCompute(
|
|||
uint32_t threadGroupId = 0;
|
||||
while (queue.getWork(threadGroupId))
|
||||
{
|
||||
ProcessComputeBE(pDC, workerId, threadGroupId, pSpillFillBuffer);
|
||||
|
||||
queue.dispatch(pDC, workerId, threadGroupId, pSpillFillBuffer);
|
||||
queue.finishedWork();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,6 +151,8 @@ private:
|
|||
OSALIGNLINE(volatile LONG) mWorkItemsConsumed { 0 };
|
||||
};
|
||||
|
||||
typedef void(*PFN_DISPATCH)(DRAW_CONTEXT* pDC, uint32_t workerId, uint32_t threadGroupId, void*& pSpillFillBuffer);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// DispatchQueue - work queue for dispatch
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -161,7 +163,7 @@ public:
|
|||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Setup the producer consumer counts.
|
||||
void initialize(uint32_t totalTasks, void* pTaskData)
|
||||
void initialize(uint32_t totalTasks, void* pTaskData, PFN_DISPATCH pfnDispatch)
|
||||
{
|
||||
// The available and outstanding counts start with total tasks.
|
||||
// At the start there are N tasks available and outstanding.
|
||||
|
|
@ -173,6 +175,7 @@ public:
|
|||
mTasksOutstanding = totalTasks;
|
||||
|
||||
mpTaskData = pTaskData;
|
||||
mPfnDispatch = pfnDispatch;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -226,7 +229,16 @@ public:
|
|||
return mpTaskData;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Dispatches a unit of work
|
||||
void dispatch(DRAW_CONTEXT* pDC, uint32_t workerId, uint32_t threadGroupId, void*& pSpillFillBuffer)
|
||||
{
|
||||
SWR_ASSERT(mPfnDispatch != nullptr);
|
||||
mPfnDispatch(pDC, workerId, threadGroupId, pSpillFillBuffer);
|
||||
}
|
||||
|
||||
void* mpTaskData{ nullptr }; // The API thread will set this up and the callback task function will interpet this.
|
||||
PFN_DISPATCH mPfnDispatch{ nullptr }; // Function to call per dispatch
|
||||
|
||||
OSALIGNLINE(volatile LONG) mTasksAvailable{ 0 };
|
||||
OSALIGNLINE(volatile LONG) mTasksOutstanding{ 0 };
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue