mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Read max frequency using pci path
Related-To: NEO-4359 Change-Id: I2dc106cc2d7bc9087fb3925051969fa2a245e6f5 Signed-off-by: Jablonski, Mateusz <mateusz.jablonski@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
39ece6481b
commit
719b22ee11
@ -15,7 +15,7 @@ const char *frontEndDllName = FCL_LIBRARY_NAME;
|
||||
const char *igcDllName = IGC_LIBRARY_NAME;
|
||||
const char *libvaDllName = "libva.so.2";
|
||||
|
||||
const char *sysFsPciPath = "/sys/bus/pci/devices/";
|
||||
const char *sysFsPciPathPrefix = "/sys/bus/pci/devices/0000:";
|
||||
const char *pciDevicesDirectory = "/dev/dri/by-path";
|
||||
const char *tbxLibName = "libtbxAccess.so";
|
||||
|
||||
|
@ -104,6 +104,31 @@ TEST(DrmTest, GivenSelectedExistingDeviceWhenGetDeviceFdThenReturnFd) {
|
||||
EXPECT_NE(nullptr, hwDeviceIds[0].get());
|
||||
}
|
||||
|
||||
TEST(DrmTest, GivenSelectedExistingDeviceWhenOpenDirSuccedsThenHwDeviceIdsHaveProperPciPaths) {
|
||||
VariableBackup<decltype(openFull)> backupOpenFull(&openFull);
|
||||
VariableBackup<decltype(failOnOpenDir)> backupOpenDir(&failOnOpenDir, false);
|
||||
VariableBackup<decltype(entryIndex)> backupEntryIndex(&entryIndex, 0u);
|
||||
openFull = openWithCounter;
|
||||
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
|
||||
entryIndex = 0;
|
||||
openCounter = 1;
|
||||
auto hwDeviceIds = OSInterface::discoverDevices(executionEnvironment);
|
||||
EXPECT_EQ(1u, hwDeviceIds.size());
|
||||
EXPECT_NE(nullptr, hwDeviceIds[0].get());
|
||||
EXPECT_STREQ("test1", hwDeviceIds[0]->getPciPath());
|
||||
|
||||
entryIndex = 0;
|
||||
openCounter = 2;
|
||||
hwDeviceIds = OSInterface::discoverDevices(executionEnvironment);
|
||||
EXPECT_EQ(2u, hwDeviceIds.size());
|
||||
EXPECT_NE(nullptr, hwDeviceIds[0].get());
|
||||
EXPECT_STREQ("test1", hwDeviceIds[0]->getPciPath());
|
||||
EXPECT_NE(nullptr, hwDeviceIds[1].get());
|
||||
EXPECT_STREQ("test2", hwDeviceIds[1]->getPciPath());
|
||||
}
|
||||
|
||||
TEST(DrmTest, GivenSelectedExistingDeviceWhenOpenDirFailsThenRetryOpeningRenderDevices) {
|
||||
VariableBackup<decltype(openFull)> backupOpenFull(&openFull);
|
||||
VariableBackup<decltype(failOnOpenDir)> backupOpenDir(&failOnOpenDir, true);
|
||||
@ -115,13 +140,16 @@ TEST(DrmTest, GivenSelectedExistingDeviceWhenOpenDirFailsThenRetryOpeningRenderD
|
||||
EXPECT_STREQ("/dev/dri/renderD128", lastOpenedPath.c_str());
|
||||
EXPECT_EQ(1u, hwDeviceIds.size());
|
||||
EXPECT_NE(nullptr, hwDeviceIds[0].get());
|
||||
EXPECT_STREQ("00:02.0", hwDeviceIds[0]->getPciPath());
|
||||
|
||||
openCounter = 2;
|
||||
hwDeviceIds = OSInterface::discoverDevices(executionEnvironment);
|
||||
EXPECT_STREQ("/dev/dri/renderD129", lastOpenedPath.c_str());
|
||||
EXPECT_EQ(2u, hwDeviceIds.size());
|
||||
EXPECT_NE(nullptr, hwDeviceIds[0].get());
|
||||
EXPECT_STREQ("00:02.0", hwDeviceIds[0]->getPciPath());
|
||||
EXPECT_NE(nullptr, hwDeviceIds[1].get());
|
||||
EXPECT_STREQ("00:02.0", hwDeviceIds[1]->getPciPath());
|
||||
}
|
||||
|
||||
TEST(DrmTest, GivenSelectedIncorectDeviceWhenGetDeviceFdThenFail) {
|
||||
|
@ -48,3 +48,4 @@ extern char providedDrmVersion[5];
|
||||
extern int ioctlSeq[8];
|
||||
extern size_t ioctlCnt;
|
||||
extern bool failOnOpenDir;
|
||||
extern uint32_t entryIndex;
|
||||
|
@ -24,7 +24,7 @@ using namespace NEO;
|
||||
TEST(DrmMemoryManagerTest, givenDrmMemoryManagerWhenSharedAllocationIsCreatedFromMultipleThreadsThenSingleBoIsReused) {
|
||||
class MockDrm : public Drm {
|
||||
public:
|
||||
MockDrm(int fd, RootDeviceEnvironment &rootDeviceEnvironment) : Drm(std::make_unique<HwDeviceId>(fd), rootDeviceEnvironment) {}
|
||||
MockDrm(int fd, RootDeviceEnvironment &rootDeviceEnvironment) : Drm(std::make_unique<HwDeviceId>(fd, ""), rootDeviceEnvironment) {}
|
||||
|
||||
int ioctl(unsigned long request, void *arg) override {
|
||||
if (request == DRM_IOCTL_PRIME_FD_TO_HANDLE) {
|
||||
@ -71,7 +71,7 @@ TEST(DrmMemoryManagerTest, givenDrmMemoryManagerWhenSharedAllocationIsCreatedFro
|
||||
TEST(DrmMemoryManagerTest, givenMultipleThreadsWhenSharedAllocationIsCreatedThenPrimeFdToHandleDoesNotRaceWithClose) {
|
||||
class MockDrm : public Drm {
|
||||
public:
|
||||
MockDrm(int fd, RootDeviceEnvironment &rootDeviceEnvironment) : Drm(std::make_unique<HwDeviceId>(fd), rootDeviceEnvironment) {
|
||||
MockDrm(int fd, RootDeviceEnvironment &rootDeviceEnvironment) : Drm(std::make_unique<HwDeviceId>(fd, ""), rootDeviceEnvironment) {
|
||||
primeFdHandle = 1;
|
||||
closeHandle = 1;
|
||||
}
|
||||
|
@ -25,32 +25,31 @@
|
||||
#include <cstdint>
|
||||
#include <iostream>
|
||||
|
||||
#define RENDER_DEVICE_NAME_MATCHER ::testing::StrEq("/dev/dri/renderD128")
|
||||
|
||||
using NEO::constructPlatform;
|
||||
using NEO::Drm;
|
||||
using NEO::HwDeviceId;
|
||||
using NEO::RootDeviceEnvironment;
|
||||
|
||||
static const int mockFd = 33;
|
||||
static const char *mockPciPath = "";
|
||||
|
||||
class DrmMockImpl : public Drm {
|
||||
public:
|
||||
DrmMockImpl(int fd) : Drm(std::make_unique<HwDeviceId>(fd), *constructPlatform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]){};
|
||||
DrmMockImpl(int fd) : Drm(std::make_unique<HwDeviceId>(fd, mockPciPath), *constructPlatform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]){};
|
||||
MOCK_METHOD2(ioctl, int(unsigned long request, void *arg));
|
||||
};
|
||||
|
||||
class DrmMockSuccess : public Drm {
|
||||
public:
|
||||
DrmMockSuccess() : DrmMockSuccess(*constructPlatform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]) {}
|
||||
DrmMockSuccess(RootDeviceEnvironment &rootDeviceEnvironment) : Drm(std::make_unique<HwDeviceId>(mockFd), rootDeviceEnvironment) {}
|
||||
DrmMockSuccess(RootDeviceEnvironment &rootDeviceEnvironment) : Drm(std::make_unique<HwDeviceId>(mockFd, mockPciPath), rootDeviceEnvironment) {}
|
||||
|
||||
int ioctl(unsigned long request, void *arg) override { return 0; };
|
||||
};
|
||||
|
||||
class DrmMockFail : public Drm {
|
||||
public:
|
||||
DrmMockFail() : Drm(std::make_unique<HwDeviceId>(mockFd), *constructPlatform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]) {}
|
||||
DrmMockFail() : Drm(std::make_unique<HwDeviceId>(mockFd, mockPciPath), *constructPlatform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]) {}
|
||||
|
||||
int ioctl(unsigned long request, void *arg) override { return -1; };
|
||||
};
|
||||
@ -335,7 +334,7 @@ class DrmMockCustom : public Drm {
|
||||
ioctl_res_ext = &NONE;
|
||||
}
|
||||
|
||||
DrmMockCustom() : Drm(std::make_unique<HwDeviceId>(mockFd), *constructPlatform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]) {
|
||||
DrmMockCustom() : Drm(std::make_unique<HwDeviceId>(mockFd, mockPciPath), *constructPlatform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]) {
|
||||
reset();
|
||||
ioctl_expected.contextCreate = static_cast<int>(NEO::HwHelper::get(NEO::defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*NEO::defaultHwInfo).size());
|
||||
ioctl_expected.contextDestroy = ioctl_expected.contextCreate.load();
|
||||
|
@ -37,7 +37,7 @@ class DrmMockForWorker : public Drm {
|
||||
std::atomic<int> gem_close_cnt;
|
||||
std::atomic<int> gem_close_expected;
|
||||
std::atomic<std::thread::id> ioctl_caller_thread_id;
|
||||
DrmMockForWorker() : Drm(std::make_unique<HwDeviceId>(33), *platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]) {
|
||||
DrmMockForWorker() : Drm(std::make_unique<HwDeviceId>(mockFd, mockPciPath), *platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]) {
|
||||
}
|
||||
int ioctl(unsigned long request, void *arg) override {
|
||||
if (_IOC_TYPE(request) == DRM_IOCTL_BASE) {
|
||||
|
@ -34,24 +34,13 @@ class DrmMock : public Drm {
|
||||
using Drm::query;
|
||||
using Drm::sliceCountChangeSupported;
|
||||
|
||||
DrmMock(RootDeviceEnvironment &rootDeviceEnvironment) : Drm(std::make_unique<HwDeviceId>(mockFd), rootDeviceEnvironment) {
|
||||
DrmMock(RootDeviceEnvironment &rootDeviceEnvironment) : Drm(std::make_unique<HwDeviceId>(mockFd, ""), rootDeviceEnvironment) {
|
||||
sliceCountChangeSupported = true;
|
||||
}
|
||||
DrmMock() : DrmMock(*platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]) {}
|
||||
|
||||
~DrmMock() override {
|
||||
if (sysFsDefaultGpuPathToRestore != nullptr) {
|
||||
sysFsDefaultGpuPath = sysFsDefaultGpuPathToRestore;
|
||||
}
|
||||
}
|
||||
|
||||
int ioctl(unsigned long request, void *arg) override;
|
||||
|
||||
void setSysFsDefaultGpuPath(const char *path) {
|
||||
sysFsDefaultGpuPathToRestore = sysFsDefaultGpuPath;
|
||||
sysFsDefaultGpuPath = path;
|
||||
}
|
||||
|
||||
void writeConfigFile(const char *name, int deviceID) {
|
||||
std::ofstream tempfile(name, std::ios::binary);
|
||||
if (tempfile.is_open()) {
|
||||
@ -71,7 +60,11 @@ class DrmMock : public Drm {
|
||||
}
|
||||
|
||||
void setFileDescriptor(int fd) {
|
||||
hwDeviceId = std::make_unique<HwDeviceId>(fd);
|
||||
hwDeviceId = std::make_unique<HwDeviceId>(fd, "");
|
||||
}
|
||||
|
||||
void setPciPath(const char *pciPath) {
|
||||
hwDeviceId = std::make_unique<HwDeviceId>(getFileDescriptor(), pciPath);
|
||||
}
|
||||
|
||||
void setDeviceID(int deviceId) { this->deviceId = deviceId; }
|
||||
@ -139,7 +132,4 @@ class DrmMock : public Drm {
|
||||
uint64_t storedParamSseu = ULONG_MAX;
|
||||
|
||||
virtual int handleRemainingRequests(unsigned long request, void *arg) { return -1; }
|
||||
|
||||
private:
|
||||
const char *sysFsDefaultGpuPathToRestore = nullptr;
|
||||
};
|
||||
|
@ -32,71 +32,34 @@ TEST(DrmTest, GetDeviceID) {
|
||||
delete pDrm;
|
||||
}
|
||||
|
||||
TEST(DrmTest, GivenConfigFileWithWrongDeviceIDWhenFrequencyIsQueriedThenReturnZero) {
|
||||
DrmMock *pDrm = new DrmMock;
|
||||
EXPECT_NE(nullptr, pDrm);
|
||||
|
||||
pDrm->StoredDeviceID = 0x4321;
|
||||
int maxFrequency = 0;
|
||||
int ret = pDrm->getMaxGpuFrequency(maxFrequency);
|
||||
EXPECT_EQ(0, ret);
|
||||
|
||||
EXPECT_EQ(0, maxFrequency);
|
||||
|
||||
delete pDrm;
|
||||
}
|
||||
|
||||
TEST(DrmTest, GivenConfigFileWithWrongDeviceIDFailIoctlWhenFrequencyIsQueriedThenReturnZero) {
|
||||
DrmMock *pDrm = new DrmMock;
|
||||
EXPECT_NE(nullptr, pDrm);
|
||||
|
||||
pDrm->StoredDeviceID = 0x4321;
|
||||
pDrm->StoredRetValForDeviceID = -1;
|
||||
int maxFrequency = 0;
|
||||
int ret = pDrm->getMaxGpuFrequency(maxFrequency);
|
||||
EXPECT_EQ(-1, ret);
|
||||
|
||||
EXPECT_EQ(0, maxFrequency);
|
||||
|
||||
delete pDrm;
|
||||
}
|
||||
|
||||
TEST(DrmTest, GivenValidConfigFileWhenFrequencyIsQueriedThenValidValueIsReturned) {
|
||||
|
||||
int expectedMaxFrequency = 1000;
|
||||
|
||||
DrmMock *pDrm = new DrmMock;
|
||||
EXPECT_NE(nullptr, pDrm);
|
||||
DrmMock drm{};
|
||||
|
||||
pDrm->StoredDeviceID = 0x1234;
|
||||
std::string gtMaxFreqFile = "test_files/linux/devices/device/drm/card1/gt_max_freq_mhz";
|
||||
|
||||
std::string gpuFile = "test_files/devices/config";
|
||||
std::string gtMaxFreqFile = "test_files/devices/drm/card0/gt_max_freq_mhz";
|
||||
|
||||
EXPECT_TRUE(fileExists(gpuFile));
|
||||
EXPECT_TRUE(fileExists(gtMaxFreqFile));
|
||||
drm.setPciPath("device");
|
||||
|
||||
int maxFrequency = 0;
|
||||
int ret = pDrm->getMaxGpuFrequency(maxFrequency);
|
||||
int ret = drm.getMaxGpuFrequency(maxFrequency);
|
||||
EXPECT_EQ(0, ret);
|
||||
|
||||
EXPECT_EQ(expectedMaxFrequency, maxFrequency);
|
||||
delete pDrm;
|
||||
}
|
||||
|
||||
TEST(DrmTest, GivenNoConfigFileWhenFrequencyIsQueriedThenReturnZero) {
|
||||
DrmMock *pDrm = new DrmMock;
|
||||
EXPECT_NE(nullptr, pDrm);
|
||||
DrmMock drm{};
|
||||
|
||||
pDrm->StoredDeviceID = 0x1234;
|
||||
// change directory
|
||||
pDrm->setSysFsDefaultGpuPath("./");
|
||||
int maxFrequency = 0;
|
||||
int ret = pDrm->getMaxGpuFrequency(maxFrequency);
|
||||
|
||||
drm.setPciPath("invalidPci");
|
||||
int ret = drm.getMaxGpuFrequency(maxFrequency);
|
||||
EXPECT_EQ(0, ret);
|
||||
|
||||
EXPECT_EQ(0, maxFrequency);
|
||||
delete pDrm;
|
||||
}
|
||||
|
||||
TEST(DrmTest, GetRevisionID) {
|
||||
@ -399,7 +362,7 @@ TEST(HwDeviceId, whenHwDeviceIdIsDestroyedThenFileDescriptorIsClosed) {
|
||||
SysCalls::closeFuncCalled = 0;
|
||||
int fileDescriptor = 0x1234;
|
||||
{
|
||||
HwDeviceId hwDeviceId(fileDescriptor);
|
||||
HwDeviceId hwDeviceId(fileDescriptor, "");
|
||||
}
|
||||
EXPECT_EQ(1u, SysCalls::closeFuncCalled);
|
||||
EXPECT_EQ(fileDescriptor, SysCalls::closeFuncArgPassed);
|
||||
|
@ -25,7 +25,7 @@ const char *gmmInitFuncName = "initMockGmm";
|
||||
const char *gmmDestroyFuncName = "destroyMockGmm";
|
||||
const char *metricsLibraryDllName = "";
|
||||
#endif
|
||||
const char *sysFsPciPath = "./test_files";
|
||||
const char *sysFsPciPathPrefix = "./test_files/linux/devices/";
|
||||
const char *pciDevicesDirectory = "./test_files/linux/by-path";
|
||||
} // namespace Os
|
||||
|
||||
|
@ -1 +0,0 @@
|
||||
<EFBFBD><EFBFBD>4<12><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
@ -26,10 +26,6 @@
|
||||
|
||||
namespace NEO {
|
||||
|
||||
const char *Drm::sysFsDefaultGpuPath = "/drm/card0";
|
||||
const char *Drm::maxGpuFrequencyFile = "/gt_max_freq_mhz";
|
||||
const char *Drm::configFileName = "/config";
|
||||
|
||||
namespace IoctlHelper {
|
||||
constexpr const char *getIoctlParamString(int param) {
|
||||
switch (param) {
|
||||
@ -108,19 +104,9 @@ int Drm::getEnabledPooledEu(int &enabled) {
|
||||
|
||||
int Drm::getMaxGpuFrequency(int &maxGpuFrequency) {
|
||||
maxGpuFrequency = 0;
|
||||
int deviceID = 0;
|
||||
int ret = getDeviceID(deviceID);
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
std::string clockSysFsPath = getSysFsPciPath(deviceID);
|
||||
std::string clockSysFsPath = getSysFsPciPath();
|
||||
|
||||
if (clockSysFsPath.size() == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
clockSysFsPath += sysFsDefaultGpuPath;
|
||||
clockSysFsPath += maxGpuFrequencyFile;
|
||||
clockSysFsPath += "/gt_max_freq_mhz";
|
||||
|
||||
std::ifstream ifs(clockSysFsPath.c_str(), std::ifstream::in);
|
||||
if (ifs.fail()) {
|
||||
@ -132,27 +118,16 @@ int Drm::getMaxGpuFrequency(int &maxGpuFrequency) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string Drm::getSysFsPciPath(int deviceID) {
|
||||
std::string nullPath;
|
||||
std::string sysFsPciDirectory = Os::sysFsPciPath;
|
||||
std::vector<std::string> files = Directory::getFiles(sysFsPciDirectory);
|
||||
|
||||
for (std::vector<std::string>::iterator file = files.begin(); file != files.end(); ++file) {
|
||||
PCIConfig config = {};
|
||||
std::string configPath = *file + configFileName;
|
||||
std::string sysfsPath = *file;
|
||||
std::ifstream configFile(configPath, std::ifstream::binary);
|
||||
if (configFile.is_open()) {
|
||||
configFile.read(reinterpret_cast<char *>(&config), sizeof(config));
|
||||
|
||||
if (!configFile.good() || (config.DeviceID != deviceID)) {
|
||||
configFile.close();
|
||||
continue;
|
||||
}
|
||||
return sysfsPath;
|
||||
std::string Drm::getSysFsPciPath() {
|
||||
std::string path = std::string(Os::sysFsPciPathPrefix) + hwDeviceId->getPciPath() + "/drm";
|
||||
std::string expectedFilePrefix = path + "/card";
|
||||
auto files = Directory::getFiles(path.c_str());
|
||||
for (auto &file : files) {
|
||||
if (file.find(expectedFilePrefix.c_str()) != std::string::npos) {
|
||||
return file;
|
||||
}
|
||||
}
|
||||
return nullPath;
|
||||
return {};
|
||||
}
|
||||
|
||||
int Drm::queryGttSize(uint64_t >tSizeOutput) {
|
||||
@ -293,10 +268,10 @@ int Drm::setupHardwareInfo(DeviceDescriptor *device, bool setupFeatureTableAndWo
|
||||
return 0;
|
||||
}
|
||||
|
||||
void appendHwDeviceId(std::vector<std::unique_ptr<HwDeviceId>> &hwDeviceIds, int fileDescriptor) {
|
||||
void appendHwDeviceId(std::vector<std::unique_ptr<HwDeviceId>> &hwDeviceIds, int fileDescriptor, const char *pciPath) {
|
||||
if (fileDescriptor >= 0) {
|
||||
if (Drm::isi915Version(fileDescriptor)) {
|
||||
hwDeviceIds.push_back(std::make_unique<HwDeviceId>(fileDescriptor));
|
||||
hwDeviceIds.push_back(std::make_unique<HwDeviceId>(fileDescriptor, pciPath));
|
||||
} else {
|
||||
SysCalls::close(fileDescriptor);
|
||||
}
|
||||
@ -323,7 +298,7 @@ std::vector<std::unique_ptr<HwDeviceId>> OSInterface::discoverDevices(ExecutionE
|
||||
for (unsigned int i = 0; i < maxDrmDevices; i++) {
|
||||
std::string path = std::string(pathPrefix) + std::to_string(i + startNum);
|
||||
int fileDescriptor = SysCalls::open(path.c_str(), O_RDWR);
|
||||
appendHwDeviceId(hwDeviceIds, fileDescriptor);
|
||||
appendHwDeviceId(hwDeviceIds, fileDescriptor, "00:02.0");
|
||||
}
|
||||
return hwDeviceIds;
|
||||
}
|
||||
@ -341,7 +316,7 @@ std::vector<std::unique_ptr<HwDeviceId>> OSInterface::discoverDevices(ExecutionE
|
||||
}
|
||||
}
|
||||
int fileDescriptor = SysCalls::open(file->c_str(), O_RDWR);
|
||||
appendHwDeviceId(hwDeviceIds, fileDescriptor);
|
||||
appendHwDeviceId(hwDeviceIds, fileDescriptor, pciPath.c_str());
|
||||
}
|
||||
if (hwDeviceIds.empty()) {
|
||||
return hwDeviceIds;
|
||||
|
@ -107,7 +107,7 @@ class Drm {
|
||||
std::unique_ptr<EngineInfo> engineInfo;
|
||||
std::unique_ptr<MemoryInfo> memoryInfo;
|
||||
|
||||
std::string getSysFsPciPath(int deviceID);
|
||||
std::string getSysFsPciPath();
|
||||
std::unique_ptr<uint8_t[]> query(uint32_t queryId);
|
||||
|
||||
#pragma pack(1)
|
||||
@ -137,10 +137,6 @@ class Drm {
|
||||
uint8_t MaxLatency;
|
||||
};
|
||||
#pragma pack()
|
||||
static const char *sysFsDefaultGpuPath;
|
||||
static const char *maxGpuFrequencyFile;
|
||||
static const char *configFileName;
|
||||
|
||||
private:
|
||||
int getParamIoctl(int param, int *dstValue);
|
||||
};
|
||||
|
@ -8,15 +8,18 @@
|
||||
#pragma once
|
||||
#include "shared/source/helpers/non_copyable_or_moveable.h"
|
||||
|
||||
#include <string>
|
||||
namespace NEO {
|
||||
|
||||
class HwDeviceId : NonCopyableClass {
|
||||
public:
|
||||
HwDeviceId(int fileDescriptorIn) : fileDescriptor(fileDescriptorIn) {}
|
||||
HwDeviceId(int fileDescriptorIn, const char *pciPathIn) : fileDescriptor(fileDescriptorIn), pciPath(pciPathIn) {}
|
||||
~HwDeviceId();
|
||||
int getFileDescriptor() const { return fileDescriptor; }
|
||||
const char *getPciPath() const { return pciPath.c_str(); }
|
||||
|
||||
protected:
|
||||
const int fileDescriptor;
|
||||
const std::string pciPath;
|
||||
};
|
||||
} // namespace NEO
|
||||
|
@ -11,6 +11,6 @@
|
||||
#define __cdecl
|
||||
namespace Os {
|
||||
// Pci Path
|
||||
extern const char *sysFsPciPath;
|
||||
extern const char *sysFsPciPathPrefix;
|
||||
extern const char *pciDevicesDirectory;
|
||||
} // namespace Os
|
||||
|
Reference in New Issue
Block a user