mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 01:04:57 +08:00
Add Drm::queryEngineInfo.
Related-To: NEO-3008 Change-Id: I2a4d21bfa1f078b5da2f893bdb7554d502df8522 Signed-off-by: Piotr Fusik <piotr.fusik@intel.com>
This commit is contained in:
@@ -67,7 +67,6 @@ bool Drm::isi915Version(int fd) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int Drm::getDeviceFd(const int devType) {
|
int Drm::getDeviceFd(const int devType) {
|
||||||
int fd = -1;
|
|
||||||
char fullPath[PATH_MAX];
|
char fullPath[PATH_MAX];
|
||||||
const char *pathPrefix;
|
const char *pathPrefix;
|
||||||
unsigned int startNum;
|
unsigned int startNum;
|
||||||
@@ -85,22 +84,21 @@ int Drm::getDeviceFd(const int devType) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int i = 0; i < maxDrmDevices; i++) {
|
for (unsigned int i = 0; i < maxDrmDevices; i++) {
|
||||||
snprintf(fullPath, PATH_MAX, "%s%d", pathPrefix, i + startNum);
|
snprintf(fullPath, PATH_MAX, "%s%u", pathPrefix, i + startNum);
|
||||||
if ((fd = ::open(fullPath, O_RDWR)) >= 0) {
|
int fd = ::open(fullPath, O_RDWR);
|
||||||
|
if (fd >= 0) {
|
||||||
if (isi915Version(fd)) {
|
if (isi915Version(fd)) {
|
||||||
break;
|
return fd;
|
||||||
}
|
}
|
||||||
::close(fd);
|
::close(fd);
|
||||||
fd = -1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return fd;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Drm::openDevice() {
|
int Drm::openDevice() {
|
||||||
int fd = -1;
|
int fd = getDeviceFd(0);
|
||||||
fd = getDeviceFd(0);
|
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
fd = getDeviceFd(1);
|
fd = getDeviceFd(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ set(RUNTIME_SRCS_OS_INTERFACE_LINUX
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_neo.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/drm_neo.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_neo.h
|
${CMAKE_CURRENT_SOURCE_DIR}/drm_neo.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_neo_create.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/drm_neo_create.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/drm_neo_memory_info.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/drm_query.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_null_device.h
|
${CMAKE_CURRENT_SOURCE_DIR}/drm_null_device.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/linux_inc.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/linux_inc.cpp
|
||||||
|
|||||||
@@ -69,9 +69,10 @@ class Drm {
|
|||||||
MOCKABLE_VIRTUAL int getErrno();
|
MOCKABLE_VIRTUAL int getErrno();
|
||||||
void setSimplifiedMocsTableUsage(bool value);
|
void setSimplifiedMocsTableUsage(bool value);
|
||||||
bool getSimplifiedMocsTableUsage() const;
|
bool getSimplifiedMocsTableUsage() const;
|
||||||
|
void queryEngineInfo();
|
||||||
void queryMemoryInfo();
|
void queryMemoryInfo();
|
||||||
|
|
||||||
MemoryInfo *getMemoryInfo() {
|
MemoryInfo *getMemoryInfo() const {
|
||||||
return memoryInfo.get();
|
return memoryInfo.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,6 +93,7 @@ class Drm {
|
|||||||
static void closeDevice(int32_t deviceOrdinal);
|
static void closeDevice(int32_t deviceOrdinal);
|
||||||
|
|
||||||
std::string getSysFsPciPath(int deviceID);
|
std::string getSysFsPciPath(int deviceID);
|
||||||
|
void *query(uint32_t queryId);
|
||||||
|
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
struct PCIConfig {
|
struct PCIConfig {
|
||||||
|
|||||||
@@ -9,6 +9,13 @@
|
|||||||
|
|
||||||
namespace NEO {
|
namespace NEO {
|
||||||
|
|
||||||
|
void *Drm::query(uint32_t queryId) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Drm::queryEngineInfo() {
|
||||||
|
}
|
||||||
|
|
||||||
void Drm::queryMemoryInfo() {
|
void Drm::queryMemoryInfo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -17,6 +17,7 @@ set(IGDRCL_SRCS_tests_os_interface_linux
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_buffer_object_tests.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/drm_buffer_object_tests.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_command_stream_mm_tests.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/drm_command_stream_mm_tests.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_command_stream_tests.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/drm_command_stream_tests.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/drm_engine_info_tests.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_gem_close_worker_tests.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/drm_gem_close_worker_tests.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/drm_mapper_tests.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/drm_mapper_tests.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/drm_memory_info_tests.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/drm_memory_info_tests.cpp
|
||||||
|
|||||||
28
unit_tests/os_interface/linux/drm_engine_info_tests.cpp
Normal file
28
unit_tests/os_interface/linux/drm_engine_info_tests.cpp
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019 Intel Corporation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "unit_tests/os_interface/linux/drm_mock.h"
|
||||||
|
|
||||||
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
|
using namespace NEO;
|
||||||
|
|
||||||
|
TEST(DrmTest, whenQueryingDrmThenNullIsReturnedAndNoIoctlIsCalled) {
|
||||||
|
std::unique_ptr<DrmMock> drm = std::make_unique<DrmMock>();
|
||||||
|
EXPECT_NE(nullptr, drm);
|
||||||
|
|
||||||
|
EXPECT_EQ(nullptr, drm->query(1));
|
||||||
|
EXPECT_EQ(0u, drm->ioctlCallsCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(DrmTest, whenQueryingEngineInfoThenNoIoctlIsCalled) {
|
||||||
|
std::unique_ptr<DrmMock> drm = std::make_unique<DrmMock>();
|
||||||
|
EXPECT_NE(nullptr, drm);
|
||||||
|
|
||||||
|
drm->queryEngineInfo();
|
||||||
|
EXPECT_EQ(0u, drm->ioctlCallsCount);
|
||||||
|
}
|
||||||
@@ -28,6 +28,7 @@ class DrmMock : public Drm {
|
|||||||
public:
|
public:
|
||||||
using Drm::memoryInfo;
|
using Drm::memoryInfo;
|
||||||
using Drm::preemptionSupported;
|
using Drm::preemptionSupported;
|
||||||
|
using Drm::query;
|
||||||
|
|
||||||
DrmMock() : Drm(mockFd) {
|
DrmMock() : Drm(mockFd) {
|
||||||
sysFsDefaultGpuPathToRestore = nullptr;
|
sysFsDefaultGpuPathToRestore = nullptr;
|
||||||
|
|||||||
Reference in New Issue
Block a user