mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-25 13:33:02 +08:00
fix: Make tlb flush os agnostic
Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
3c4d921a80
commit
c294ef48ce
@@ -105,8 +105,9 @@ class DirectSubmissionHw {
|
||||
virtual bool allocateOsResources() = 0;
|
||||
virtual bool submit(uint64_t gpuAddress, size_t size) = 0;
|
||||
virtual bool handleResidency() = 0;
|
||||
virtual void handleNewResourcesSubmission();
|
||||
virtual size_t getSizeNewResourceHandler();
|
||||
void handleNewResourcesSubmission();
|
||||
bool isNewResourceHandleNeeded();
|
||||
size_t getSizeNewResourceHandler();
|
||||
virtual void handleStopRingBuffer(){};
|
||||
virtual uint64_t switchRingBuffers();
|
||||
virtual void handleSwitchRingBuffers() = 0;
|
||||
|
||||
@@ -1000,11 +1000,28 @@ inline void DirectSubmissionHw<GfxFamily, Dispatcher>::setReturnAddress(void *re
|
||||
|
||||
template <typename GfxFamily, typename Dispatcher>
|
||||
inline void DirectSubmissionHw<GfxFamily, Dispatcher>::handleNewResourcesSubmission() {
|
||||
if (isNewResourceHandleNeeded()) {
|
||||
auto tlbFlushCounter = this->osContext.peekTlbFlushCounter();
|
||||
Dispatcher::dispatchTlbFlush(this->ringCommandStream, this->gpuVaForMiFlush, this->rootDeviceEnvironment);
|
||||
this->osContext.setTlbFlushed(tlbFlushCounter);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename GfxFamily, typename Dispatcher>
|
||||
inline size_t DirectSubmissionHw<GfxFamily, Dispatcher>::getSizeNewResourceHandler() {
|
||||
return 0u;
|
||||
size_t DirectSubmissionHw<GfxFamily, Dispatcher>::getSizeNewResourceHandler() {
|
||||
// Overestimate to avoid race
|
||||
return Dispatcher::getSizeTlbFlush(this->rootDeviceEnvironment);
|
||||
}
|
||||
|
||||
template <typename GfxFamily, typename Dispatcher>
|
||||
bool DirectSubmissionHw<GfxFamily, Dispatcher>::isNewResourceHandleNeeded() {
|
||||
auto newResourcesBound = this->osContext.isTlbFlushRequired();
|
||||
|
||||
if (DebugManager.flags.DirectSubmissionNewResourceTlbFlush.get() != -1) {
|
||||
newResourcesBound = DebugManager.flags.DirectSubmissionNewResourceTlbFlush.get();
|
||||
}
|
||||
|
||||
return newResourcesBound;
|
||||
}
|
||||
|
||||
template <typename GfxFamily, typename Dispatcher>
|
||||
|
||||
@@ -27,9 +27,6 @@ class DrmDirectSubmission : public DirectSubmissionHw<GfxFamily, Dispatcher> {
|
||||
bool submit(uint64_t gpuAddress, size_t size) override;
|
||||
|
||||
bool handleResidency() override;
|
||||
bool isNewResourceHandleNeeded();
|
||||
void handleNewResourcesSubmission() override;
|
||||
size_t getSizeNewResourceHandler() override;
|
||||
void handleStopRingBuffer() override;
|
||||
void handleSwitchRingBuffers() override;
|
||||
uint64_t updateTagValue() override;
|
||||
|
||||
@@ -189,35 +189,6 @@ bool DrmDirectSubmission<GfxFamily, Dispatcher>::handleResidency() {
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename GfxFamily, typename Dispatcher>
|
||||
bool DrmDirectSubmission<GfxFamily, Dispatcher>::isNewResourceHandleNeeded() {
|
||||
auto osContextLinux = static_cast<OsContextLinux *>(&this->osContext);
|
||||
auto newResourcesBound = osContextLinux->isTlbFlushRequired();
|
||||
|
||||
if (DebugManager.flags.DirectSubmissionNewResourceTlbFlush.get() != -1) {
|
||||
newResourcesBound = DebugManager.flags.DirectSubmissionNewResourceTlbFlush.get();
|
||||
}
|
||||
|
||||
return newResourcesBound;
|
||||
}
|
||||
|
||||
template <typename GfxFamily, typename Dispatcher>
|
||||
void DrmDirectSubmission<GfxFamily, Dispatcher>::handleNewResourcesSubmission() {
|
||||
if (isNewResourceHandleNeeded()) {
|
||||
auto osContextLinux = static_cast<OsContextLinux *>(&this->osContext);
|
||||
auto tlbFlushCounter = osContextLinux->peekTlbFlushCounter();
|
||||
|
||||
Dispatcher::dispatchTlbFlush(this->ringCommandStream, this->gpuVaForMiFlush, this->rootDeviceEnvironment);
|
||||
osContextLinux->setTlbFlushed(tlbFlushCounter);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename GfxFamily, typename Dispatcher>
|
||||
size_t DrmDirectSubmission<GfxFamily, Dispatcher>::getSizeNewResourceHandler() {
|
||||
// Overestimate to avoid race
|
||||
return Dispatcher::getSizeTlbFlush(this->rootDeviceEnvironment);
|
||||
}
|
||||
|
||||
template <typename GfxFamily, typename Dispatcher>
|
||||
void DrmDirectSubmission<GfxFamily, Dispatcher>::handleStopRingBuffer() {
|
||||
if (this->disableMonitorFence) {
|
||||
|
||||
Reference in New Issue
Block a user