mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Add new DRM wait function
Related-To: NEO-5845 Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
b98148fb3f
commit
d14c7e4ffb
@ -24,6 +24,8 @@ class DrmCommandStreamReceiver : public DeviceCommandStreamReceiver<GfxFamily> {
|
||||
protected:
|
||||
typedef DeviceCommandStreamReceiver<GfxFamily> BaseClass;
|
||||
using CommandStreamReceiverHw<GfxFamily>::CommandStreamReceiver::getTagAddress;
|
||||
using CommandStreamReceiverHw<GfxFamily>::CommandStreamReceiver::getTagAllocation;
|
||||
using CommandStreamReceiverHw<GfxFamily>::CommandStreamReceiver::taskCount;
|
||||
using BaseClass::getScratchPatchAddress;
|
||||
using BaseClass::makeNonResident;
|
||||
using BaseClass::makeResident;
|
||||
@ -61,10 +63,14 @@ class DrmCommandStreamReceiver : public DeviceCommandStreamReceiver<GfxFamily> {
|
||||
protected:
|
||||
MOCKABLE_VIRTUAL void flushInternal(const BatchBuffer &batchBuffer, const ResidencyContainer &allocationsForResidency);
|
||||
MOCKABLE_VIRTUAL void exec(const BatchBuffer &batchBuffer, uint32_t vmHandleId, uint32_t drmContextId);
|
||||
MOCKABLE_VIRTUAL int waitUserFence(uint32_t waitValue);
|
||||
|
||||
std::vector<BufferObject *> residency;
|
||||
std::vector<drm_i915_gem_exec_object2> execObjectsStorage;
|
||||
Drm *drm;
|
||||
gemCloseWorkerMode gemCloseWorkerOperationMode;
|
||||
|
||||
bool useUserFenceWait = false;
|
||||
bool useContextForUserFenceWait = false;
|
||||
};
|
||||
} // namespace NEO
|
||||
|
@ -52,6 +52,12 @@ DrmCommandStreamReceiver<GfxFamily>::DrmCommandStreamReceiver(ExecutionEnvironme
|
||||
if (DebugManager.flags.CsrDispatchMode.get()) {
|
||||
this->dispatchMode = static_cast<DispatchMode>(DebugManager.flags.CsrDispatchMode.get());
|
||||
}
|
||||
if (DebugManager.flags.EnableUserFenceForCompletionWait.get() == 1) {
|
||||
useUserFenceWait = true;
|
||||
}
|
||||
if (DebugManager.flags.EnableUserFenceUseCtxId.get() == 1) {
|
||||
useContextForUserFenceWait = true;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
@ -93,7 +99,11 @@ bool DrmCommandStreamReceiver<GfxFamily>::flush(BatchBuffer &batchBuffer, Reside
|
||||
return this->blitterDirectSubmission->dispatchCommandBuffer(batchBuffer, *this->flushStamp.get());
|
||||
}
|
||||
|
||||
this->flushStamp->setStamp(bb->peekHandle());
|
||||
if (useUserFenceWait) {
|
||||
this->flushStamp->setStamp(taskCount + 1);
|
||||
} else {
|
||||
this->flushStamp->setStamp(bb->peekHandle());
|
||||
}
|
||||
this->flushInternal(batchBuffer, allocationsForResidency);
|
||||
|
||||
if (this->gemCloseWorkerOperationMode == gemCloseWorkerMode::gemCloseWorkerActive) {
|
||||
@ -193,11 +203,13 @@ GmmPageTableMngr *DrmCommandStreamReceiver<GfxFamily>::createPageTableManager()
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool DrmCommandStreamReceiver<GfxFamily>::waitForFlushStamp(FlushStamp &flushStamp) {
|
||||
drm_i915_gem_wait wait = {};
|
||||
wait.bo_handle = static_cast<uint32_t>(flushStamp);
|
||||
wait.timeout_ns = -1;
|
||||
auto waitValue = static_cast<uint32_t>(flushStamp);
|
||||
if (useUserFenceWait) {
|
||||
waitUserFence(waitValue);
|
||||
} else {
|
||||
this->drm->waitHandle(waitValue);
|
||||
}
|
||||
|
||||
drm->ioctl(DRM_IOCTL_I915_GEM_WAIT, &wait);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2020 Intel Corporation
|
||||
* Copyright (C) 2019-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@ -17,4 +17,13 @@ void DrmCommandStreamReceiver<GfxFamily>::flushInternal(const BatchBuffer &batch
|
||||
this->exec(batchBuffer, 0u, static_cast<const OsContextLinux *>(osContext)->getDrmContextIds()[0]);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
int DrmCommandStreamReceiver<GfxFamily>::waitUserFence(uint32_t waitValue) {
|
||||
uint32_t ctxId = 0u;
|
||||
if (useContextForUserFenceWait) {
|
||||
ctxId = static_cast<const OsContextLinux *>(osContext)->getDrmContextIds()[0];
|
||||
}
|
||||
return this->drm->waitUserFence(ctxId, getTagAllocation()->getGpuAddress(), waitValue, Drm::ValueWidth::U32);
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
Reference in New Issue
Block a user