Files
compute-runtime/shared/source/os_interface/linux/drm_query_dg1.cpp
Slawomir Milczarek 7e56a8303a Add DG1 support to OpenCL and Level Zero (2/n)
Source location of Linux kernel DRM/i915 interface headers:
https://repositories.intel.com/graphics/kernel-api/index.html

Related-To: NEO-4744

Change-Id: I08a9ab651d8594e9a04d6a83dc48682d4fa53702
Signed-off-by: Slawomir Milczarek <slawomir.milczarek@intel.com>
2020-06-25 18:23:40 +02:00

53 lines
1.2 KiB
C++

/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/os_interface/linux/drm_engine_mapper.h"
#include "shared/source/os_interface/linux/memory_info_impl.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;
}
bool Drm::queryEngineInfo() {
return true;
}
bool Drm::queryMemoryInfo() {
auto length = 0;
auto dataQuery = this->query(DRM_I915_QUERY_MEMORY_REGIONS, length);
auto data = reinterpret_cast<drm_i915_query_memory_regions *>(dataQuery.get());
if (data) {
this->memoryInfo.reset(new MemoryInfoImpl(data->regions, data->num_regions));
return true;
}
return false;
}
unsigned int Drm::bindDrmContext(uint32_t drmContextId, uint32_t deviceIndex, aub_stream::EngineType engineType) {
return DrmEngineMapper::engineNodeMap(engineType);
}
} // namespace NEO