2019-03-19 13:53:55 +01:00
|
|
|
/*
|
2020-01-21 15:24:52 +01:00
|
|
|
* Copyright (C) 2019-2020 Intel Corporation
|
2019-03-19 13:53:55 +01:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/os_interface/linux/drm_engine_mapper.h"
|
2020-08-24 13:08:59 -04:00
|
|
|
#include "shared/source/os_interface/linux/engine_info_impl.h"
|
2019-06-17 13:56:03 +02:00
|
|
|
|
2019-03-19 13:53:55 +01:00
|
|
|
#include "drm_neo.h"
|
2020-11-19 12:04:17 +01:00
|
|
|
#include "drm_query_flags.h"
|
2019-03-19 13:53:55 +01:00
|
|
|
|
2020-04-10 13:54:07 +02:00
|
|
|
#include <fstream>
|
|
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
namespace NEO {
|
2019-03-19 13:53:55 +01:00
|
|
|
|
2020-04-10 13:54:07 +02:00
|
|
|
int Drm::getMaxGpuFrequency(HardwareInfo &hwInfo, int &maxGpuFrequency) {
|
|
|
|
|
maxGpuFrequency = 0;
|
|
|
|
|
std::string clockSysFsPath = getSysFsPciPath();
|
|
|
|
|
|
|
|
|
|
clockSysFsPath += "/gt_max_freq_mhz";
|
|
|
|
|
|
|
|
|
|
std::ifstream ifs(clockSysFsPath.c_str(), std::ifstream::in);
|
|
|
|
|
if (ifs.fail()) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ifs >> maxGpuFrequency;
|
|
|
|
|
ifs.close();
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-24 16:00:33 +01:00
|
|
|
bool Drm::querySystemInfo() {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-08 18:49:54 +01:00
|
|
|
bool Drm::queryEngineInfo() {
|
2020-08-24 13:08:59 -04:00
|
|
|
auto length = 0;
|
2020-11-19 12:04:17 +01:00
|
|
|
auto dataQuery = this->query(DRM_I915_QUERY_ENGINE_INFO, DrmQueryItemFlags::empty, length);
|
2020-08-24 13:08:59 -04:00
|
|
|
auto data = reinterpret_cast<drm_i915_query_engine_info *>(dataQuery.get());
|
|
|
|
|
if (data) {
|
|
|
|
|
this->engineInfo.reset(new EngineInfoImpl(data->engines, data->num_engines));
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
2019-04-30 13:09:49 +02:00
|
|
|
}
|
|
|
|
|
|
2019-11-08 18:49:54 +01:00
|
|
|
bool Drm::queryMemoryInfo() {
|
|
|
|
|
return true;
|
2019-07-31 22:44:27 +02:00
|
|
|
}
|
|
|
|
|
|
2019-07-11 14:29:45 +02:00
|
|
|
unsigned int Drm::bindDrmContext(uint32_t drmContextId, uint32_t deviceIndex, aub_stream::EngineType engineType) {
|
2019-06-17 13:56:03 +02:00
|
|
|
return DrmEngineMapper::engineNodeMap(engineType);
|
2019-05-13 13:22:47 +02:00
|
|
|
}
|
|
|
|
|
|
2020-08-11 14:00:41 +02:00
|
|
|
int Drm::bindBufferObject(OsContext *osContext, uint32_t vmHandleId, BufferObject *bo) {
|
2020-07-02 11:49:46 +02:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-11 14:00:41 +02:00
|
|
|
int Drm::unbindBufferObject(OsContext *osContext, uint32_t vmHandleId, BufferObject *bo) {
|
2020-07-02 11:49:46 +02:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-19 20:43:01 +00:00
|
|
|
bool Drm::isVmBindAvailable() {
|
|
|
|
|
return this->bindAvailable;
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
} // namespace NEO
|