2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2023-01-27 20:45:12 +08:00
|
|
|
* Copyright (C) 2018-2023 Intel Corporation
|
2018-09-18 15:11:08 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
#pragma once
|
2021-05-21 01:49:44 +08:00
|
|
|
#include "shared/source/os_interface/linux/device_time_drm.h"
|
2023-01-27 20:45:12 +08:00
|
|
|
#include "shared/source/os_interface/linux/drm_neo.h"
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/os_interface/linux/os_time_linux.h"
|
2021-05-21 07:17:57 +08:00
|
|
|
#include "shared/source/os_interface/os_interface.h"
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2021-05-21 01:49:44 +08:00
|
|
|
class MockDeviceTimeDrm : public DeviceTimeDrm {
|
|
|
|
public:
|
|
|
|
using DeviceTimeDrm::pDrm;
|
|
|
|
MockDeviceTimeDrm() : DeviceTimeDrm(nullptr) {
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
class MockOSTimeLinux : public OSTimeLinux {
|
|
|
|
public:
|
2021-05-21 01:49:44 +08:00
|
|
|
MockOSTimeLinux(OSInterface *osInterface)
|
|
|
|
: OSTimeLinux(osInterface, std::make_unique<MockDeviceTimeDrm>()) {
|
|
|
|
}
|
2017-12-21 07:45:38 +08:00
|
|
|
void setResolutionFunc(resolutionFunc_t func) {
|
|
|
|
this->resolutionFunc = func;
|
|
|
|
}
|
|
|
|
void setGetTimeFunc(getTimeFunc_t func) {
|
|
|
|
this->getTimeFunc = func;
|
|
|
|
}
|
|
|
|
void updateDrm(Drm *drm) {
|
2021-05-21 07:17:57 +08:00
|
|
|
osInterface->setDriverModel(std::unique_ptr<DriverModel>(drm));
|
2021-05-21 01:49:44 +08:00
|
|
|
static_cast<MockDeviceTimeDrm *>(this->deviceTime.get())->pDrm = drm;
|
|
|
|
static_cast<MockDeviceTimeDrm *>(this->deviceTime.get())->timestampTypeDetect();
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
static std::unique_ptr<MockOSTimeLinux> create(OSInterface *osInterface) {
|
|
|
|
return std::unique_ptr<MockOSTimeLinux>(new MockOSTimeLinux(osInterface));
|
|
|
|
}
|
2021-05-21 01:49:44 +08:00
|
|
|
|
|
|
|
MockDeviceTimeDrm *getDeviceTime() {
|
|
|
|
return static_cast<MockDeviceTimeDrm *>(this->deviceTime.get());
|
|
|
|
}
|
2017-12-21 07:45:38 +08:00
|
|
|
};
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|