mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
Refactor waitOnCompletionFence method in DrmMemoryManager
get completion address and value from command stream receiver Related-To: NEO-6643 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
e32f624bf4
commit
9d502dea25
@@ -319,6 +319,14 @@ class CommandStreamReceiver {
|
||||
|
||||
MOCKABLE_VIRTUAL bool isGpuHangDetected() const;
|
||||
|
||||
virtual uint64_t getCompletionAddress() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual uint32_t getCompletionValue(const GraphicsAllocation &gfxAllocation) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected:
|
||||
void cleanupResources();
|
||||
void printDeviceIndex();
|
||||
|
||||
@@ -62,6 +62,10 @@ class DrmCommandStreamReceiver : public DeviceCommandStreamReceiver<GfxFamily> {
|
||||
gemCloseWorkerOperationMode = gemCloseWorkerMode::gemCloseWorkerInactive;
|
||||
}
|
||||
|
||||
uint64_t getCompletionAddress() override;
|
||||
|
||||
uint32_t getCompletionValue(const GraphicsAllocation &gfxAllocation) override;
|
||||
|
||||
void printBOsForSubmit(ResidencyContainer &allocationsForResidency, GraphicsAllocation &cmdBufferAllocation);
|
||||
|
||||
using CommandStreamReceiver::pageTableManager;
|
||||
|
||||
@@ -316,4 +316,16 @@ inline bool DrmCommandStreamReceiver<GfxFamily>::isUserFenceWaitActive() {
|
||||
return (this->drm->isVmBindAvailable() && useUserFenceWait);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
uint64_t DrmCommandStreamReceiver<GfxFamily>::getCompletionAddress() {
|
||||
uint64_t completionFenceAddress = castToUint64(const_cast<uint32_t *>(getTagAddress()));
|
||||
completionFenceAddress += Drm::completionFenceOffset;
|
||||
return completionFenceAddress;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
uint32_t DrmCommandStreamReceiver<GfxFamily>::getCompletionValue(const GraphicsAllocation &gfxAllocation) {
|
||||
auto osContextId = osContext->getContextId();
|
||||
return gfxAllocation.getTaskCount(osContextId);
|
||||
}
|
||||
} // namespace NEO
|
||||
|
||||
@@ -1526,14 +1526,13 @@ void DrmMemoryManager::waitOnCompletionFence(GraphicsAllocation *allocation) {
|
||||
|
||||
uint32_t activeHwContexts = csr->getActivePartitions();
|
||||
auto osContextId = osContext->getContextId();
|
||||
auto allocationTaskCount = allocation->getTaskCount(osContextId);
|
||||
uint64_t completionFenceAddress = castToUint64(const_cast<uint32_t *>(csr->getTagAddress()));
|
||||
auto allocationTaskCount = csr->getCompletionValue(*allocation);
|
||||
uint64_t completionFenceAddress = csr->getCompletionAddress();
|
||||
if (completionFenceAddress == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (allocation->isUsedByOsContext(osContextId)) {
|
||||
completionFenceAddress += Drm::completionFenceOffset;
|
||||
Drm &drm = getDrm(csr->getRootDeviceIndex());
|
||||
auto &ctxVector = static_cast<const OsContextLinux *>(osContext)->getDrmContextIds();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user