2017-12-21 00:45:38 +01:00
|
|
|
/*
|
2021-05-16 20:51:16 +02:00
|
|
|
* Copyright (C) 2020-2021 Intel Corporation
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
2018-09-18 09:11:08 +02:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/execution_environment/execution_environment.h"
|
|
|
|
|
#include "shared/source/execution_environment/root_device_environment.h"
|
2020-03-02 14:11:08 +01:00
|
|
|
#include "shared/source/gmm_helper/gmm_lib.h"
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/os_interface/hw_info_config.h"
|
|
|
|
|
#include "shared/source/os_interface/linux/drm_memory_operations_handler.h"
|
|
|
|
|
#include "shared/source/os_interface/linux/drm_neo.h"
|
2021-03-29 13:43:50 +02:00
|
|
|
#include "shared/source/os_interface/linux/sys_calls.h"
|
2021-05-21 01:17:57 +02:00
|
|
|
#include "shared/source/os_interface/os_interface.h"
|
2021-03-29 13:43:50 +02:00
|
|
|
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
#include <system_error>
|
|
|
|
|
#include <unistd.h>
|
2020-02-11 17:48:40 +01:00
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
namespace NEO {
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
bool OSInterface::osEnabled64kbPages = false;
|
2020-09-22 16:29:34 +02:00
|
|
|
bool OSInterface::newResourceImplicitFlush = true;
|
|
|
|
|
bool OSInterface::gpuIdleImplicitFlush = true;
|
2021-05-19 20:12:09 +00:00
|
|
|
bool OSInterface::requiresSupportForWddmTrimNotification = false;
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2021-05-21 01:17:57 +02:00
|
|
|
bool OSInterface::isDebugAttachAvailable() const {
|
|
|
|
|
if (driverModel) {
|
|
|
|
|
return driverModel->as<Drm>()->isDebugAttachAvailable();
|
2021-02-23 17:57:27 +00:00
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-10 12:36:44 +02:00
|
|
|
bool RootDeviceEnvironment::initOsInterface(std::unique_ptr<HwDeviceId> &&hwDeviceId, uint32_t rootDeviceIndex) {
|
2021-05-24 17:34:55 +00:00
|
|
|
Drm *drm = Drm::create(std::unique_ptr<HwDeviceIdDrm>(hwDeviceId.release()->as<HwDeviceIdDrm>()), *this);
|
2020-02-13 13:26:40 +01:00
|
|
|
if (!drm) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
osInterface.reset(new OSInterface());
|
2021-05-21 01:17:57 +02:00
|
|
|
osInterface->setDriverModel(std::unique_ptr<DriverModel>(drm));
|
2020-03-04 08:51:02 +01:00
|
|
|
auto hardwareInfo = getMutableHardwareInfo();
|
2020-02-13 13:26:40 +01:00
|
|
|
HwInfoConfig *hwConfig = HwInfoConfig::get(hardwareInfo->platform.eProductFamily);
|
2021-05-24 21:06:15 +02:00
|
|
|
if (hwConfig->configureHwInfoDrm(hardwareInfo, hardwareInfo, osInterface.get())) {
|
2020-02-13 13:26:40 +01:00
|
|
|
return false;
|
|
|
|
|
}
|
2020-09-30 13:01:05 +02:00
|
|
|
memoryOperationsInterface = DrmMemoryOperationsHandler::create(*drm, rootDeviceIndex);
|
2020-02-13 13:26:40 +01:00
|
|
|
return true;
|
|
|
|
|
}
|
2021-03-29 13:43:50 +02:00
|
|
|
|
2019-08-21 10:53:07 +02:00
|
|
|
} // namespace NEO
|