mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-26 15:03:02 +08:00
fix: use pointer instead of std::function
MSVC Compiler found an issue that there could be an attempt to reference a deleted function when using std::function. As the functionality of ioctlHelper::getGpuTime is very straightforward, simple function pointer should be sufficient to make the job and it mitigates overhead of std::function. Related-To: NEO-8324 Signed-off-by: Naklicki, Mateusz <mateusz.naklicki@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
157d7a327a
commit
1352bde5c8
@@ -633,12 +633,12 @@ void IoctlHelper::initializeGetGpuTimeFunction() {
|
||||
reg.offset = REG_GLOBAL_TIMESTAMP_UN;
|
||||
err = this->ioctl(DrmIoctl::RegRead, ®);
|
||||
if (err) {
|
||||
this->getGpuTime = getGpuTime32;
|
||||
this->getGpuTime = &getGpuTime32;
|
||||
} else {
|
||||
this->getGpuTime = getGpuTimeSplitted;
|
||||
this->getGpuTime = &getGpuTimeSplitted;
|
||||
}
|
||||
} else {
|
||||
this->getGpuTime = getGpuTime36;
|
||||
this->getGpuTime = &getGpuTime36;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -647,7 +647,7 @@ bool IoctlHelper::setGpuCpuTimes(TimeStampData *pGpuCpuTime, OSTime *osTime) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!this->getGpuTime) {
|
||||
if (this->getGpuTime == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
@@ -168,7 +167,7 @@ class IoctlHelper {
|
||||
|
||||
virtual void initializeGetGpuTimeFunction();
|
||||
virtual bool setGpuCpuTimes(TimeStampData *pGpuCpuTime, OSTime *osTime);
|
||||
std::function<bool(::NEO::Drm &, uint64_t *)> getGpuTime;
|
||||
bool (*getGpuTime)(::NEO::Drm &, uint64_t *) = nullptr;
|
||||
|
||||
protected:
|
||||
Drm &drm;
|
||||
|
||||
Reference in New Issue
Block a user