Files
compute-runtime/shared/source/os_interface/linux/drm_query.cpp
Slawomir Milczarek 52deab65e0 Moved unit test for getMaxGpuFrequency on Linux to shared code
Related-To: NEO-4544

Change-Id: I5319e9485bbaa973f73bc11dd07effa184f27e64
Signed-off-by: Slawomir Milczarek <slawomir.milczarek@intel.com>
2020-04-14 12:41:54 +02:00

49 lines
959 B
C++

/*
* Copyright (C) 2019-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/os_interface/linux/drm_engine_mapper.h"
#include "drm_neo.h"
#include <fstream>
namespace NEO {
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;
}
std::unique_ptr<uint8_t[]> Drm::query(uint32_t queryId) {
return nullptr;
}
bool Drm::queryEngineInfo() {
return true;
}
bool Drm::queryMemoryInfo() {
return true;
}
unsigned int Drm::bindDrmContext(uint32_t drmContextId, uint32_t deviceIndex, aub_stream::EngineType engineType) {
return DrmEngineMapper::engineNodeMap(engineType);
}
} // namespace NEO