mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 23: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
@@ -649,17 +649,13 @@ TEST_F(IoctlPrelimHelperTests, whenGettingTimeThenTimeIsCorrect) {
|
||||
ASSERT_EQ(true, ioctlHelper.initialize());
|
||||
|
||||
{
|
||||
auto p = ioctlHelper.getGpuTime;
|
||||
bool (*const *ptr)(Drm &, uint64_t *) = p.target<bool (*)(Drm &, uint64_t *)>();
|
||||
EXPECT_EQ(*ptr, &::NEO::getGpuTime36);
|
||||
EXPECT_EQ(ioctlHelper.getGpuTime, &getGpuTime36);
|
||||
}
|
||||
|
||||
{
|
||||
drm->ioctlRes = -1;
|
||||
ioctlHelper.initializeGetGpuTimeFunction();
|
||||
auto p = ioctlHelper.getGpuTime;
|
||||
bool (*const *ptr)(Drm &, uint64_t *) = p.target<bool (*)(Drm &, uint64_t *)>();
|
||||
EXPECT_EQ(*ptr, &::NEO::getGpuTime32);
|
||||
EXPECT_EQ(ioctlHelper.getGpuTime, &getGpuTime32);
|
||||
}
|
||||
|
||||
DrmMockCustom::IoctlResExt ioctlToPass = {1, 0};
|
||||
@@ -668,9 +664,7 @@ TEST_F(IoctlPrelimHelperTests, whenGettingTimeThenTimeIsCorrect) {
|
||||
drm->ioctlRes = -1;
|
||||
drm->ioctlResExt = &ioctlToPass; // 2nd ioctl is successful
|
||||
ioctlHelper.initializeGetGpuTimeFunction();
|
||||
auto p = ioctlHelper.getGpuTime;
|
||||
bool (*const *ptr)(Drm &, uint64_t *) = p.target<bool (*)(Drm &, uint64_t *)>();
|
||||
EXPECT_EQ(*ptr, &::NEO::getGpuTimeSplitted);
|
||||
EXPECT_EQ(ioctlHelper.getGpuTime, &getGpuTimeSplitted);
|
||||
drm->ioctlResExt = &drm->none;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -759,17 +759,13 @@ TEST(IoctlHelperTestsUpstream, whenGettingTimeThenTimeIsCorrect) {
|
||||
ASSERT_EQ(true, ioctlHelper.initialize());
|
||||
|
||||
{
|
||||
auto p = ioctlHelper.getGpuTime;
|
||||
bool (*const *ptr)(Drm &, uint64_t *) = p.target<bool (*)(Drm &, uint64_t *)>();
|
||||
EXPECT_EQ(*ptr, &::NEO::getGpuTime36);
|
||||
EXPECT_EQ(ioctlHelper.getGpuTime, &getGpuTime36);
|
||||
}
|
||||
|
||||
{
|
||||
drm->ioctlRes = -1;
|
||||
ioctlHelper.initializeGetGpuTimeFunction();
|
||||
auto p = ioctlHelper.getGpuTime;
|
||||
bool (*const *ptr)(Drm &, uint64_t *) = p.target<bool (*)(Drm &, uint64_t *)>();
|
||||
EXPECT_EQ(*ptr, &::NEO::getGpuTime32);
|
||||
EXPECT_EQ(ioctlHelper.getGpuTime, &getGpuTime32);
|
||||
}
|
||||
|
||||
DrmMockCustom::IoctlResExt ioctlToPass = {1, 0};
|
||||
@@ -778,9 +774,7 @@ TEST(IoctlHelperTestsUpstream, whenGettingTimeThenTimeIsCorrect) {
|
||||
drm->ioctlRes = -1;
|
||||
drm->ioctlResExt = &ioctlToPass; // 2nd ioctl is successful
|
||||
ioctlHelper.initializeGetGpuTimeFunction();
|
||||
auto p = ioctlHelper.getGpuTime;
|
||||
bool (*const *ptr)(Drm &, uint64_t *) = p.target<bool (*)(Drm &, uint64_t *)>();
|
||||
EXPECT_EQ(*ptr, &::NEO::getGpuTimeSplitted);
|
||||
EXPECT_EQ(ioctlHelper.getGpuTime, &getGpuTimeSplitted);
|
||||
drm->ioctlResExt = &drm->none;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user