summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorTim Rowley <[email protected]>2016-09-21 13:39:44 -0500
committerTim Rowley <[email protected]>2016-10-03 09:57:13 -0500
commitb8a6f06c855aa088323e9d13b4806659b90c10d6 (patch)
tree7f29ac440b71cbdf828a02eab42d67eb8f7a976d /src/gallium/drivers
parent33a1a09eb0d59487748c0a27760f9e352f89b700 (diff)
swr: [rasterizer core] generalize compute dispatch mechanism
Generalize compute dispatch mechanism to support other types of dispatches. Signed-off-by: Tim Rowley <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/swr/rasterizer/core/api.cpp2
-rw-r--r--src/gallium/drivers/swr/rasterizer/core/threads.cpp3
-rw-r--r--src/gallium/drivers/swr/rasterizer/core/tilemgr.h14
3 files changed, 15 insertions, 4 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/core/api.cpp b/src/gallium/drivers/swr/rasterizer/core/api.cpp
index 703f239cc01..63f764680d6 100644
--- a/src/gallium/drivers/swr/rasterizer/core/api.cpp
+++ b/src/gallium/drivers/swr/rasterizer/core/api.cpp
@@ -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);
diff --git a/src/gallium/drivers/swr/rasterizer/core/threads.cpp b/src/gallium/drivers/swr/rasterizer/core/threads.cpp
index b1a27f34c29..4f331532111 100644
--- a/src/gallium/drivers/swr/rasterizer/core/threads.cpp
+++ b/src/gallium/drivers/swr/rasterizer/core/threads.cpp
@@ -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();
}
}
diff --git a/src/gallium/drivers/swr/rasterizer/core/tilemgr.h b/src/gallium/drivers/swr/rasterizer/core/tilemgr.h
index 2befe97e7c2..bfff339a55f 100644
--- a/src/gallium/drivers/swr/rasterizer/core/tilemgr.h
+++ b/src/gallium/drivers/swr/rasterizer/core/tilemgr.h
@@ -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 };