refactor: remove not needed code

Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski 2023-10-13 15:03:52 +00:00 committed by Compute-Runtime-Automation
parent 0b7e6d90a3
commit 57e8edc489
5 changed files with 2 additions and 145 deletions

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2018-2022 Intel Corporation
# Copyright (C) 2018-2023 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
@ -15,7 +15,6 @@ add_executable(igdrcl_${target_name}
$<TARGET_OBJECTS:neo_shared_mocks>
$<TARGET_OBJECTS:neo_unit_tests_config>
$<TARGET_OBJECTS:mock_gmm>
${CMAKE_CURRENT_SOURCE_DIR}/drm_null_device_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/drm_wrap.h
${CMAKE_CURRENT_SOURCE_DIR}/main_linux_dll.cpp
${CMAKE_CURRENT_SOURCE_DIR}/mock_os_layer.cpp

View File

@ -1,92 +0,0 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/execution_environment/execution_environment.h"
#include "shared/source/helpers/hw_info.h"
#include "shared/source/helpers/register_offsets.h"
#include "shared/source/os_interface/linux/drm_null_device.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/test_macros/test.h"
#include "opencl/test/unit_test/linux/drm_wrap.h"
#include "opencl/test/unit_test/linux/mock_os_layer.h"
#include <memory>
using namespace NEO;
extern const DeviceDescriptor NEO::deviceDescriptorTable[];
class DrmNullDeviceTestsFixture {
public:
void setUp() {
if (deviceDescriptorTable[0].deviceId == 0) {
GTEST_SKIP();
}
// Create nullDevice drm
DebugManager.flags.EnableNullHardware.set(true);
executionEnvironment.prepareRootDeviceEnvironments(1);
drmNullDevice = DrmWrap::createDrm(*executionEnvironment.rootDeviceEnvironments[0]);
ASSERT_NE(drmNullDevice, nullptr);
}
void tearDown() {
}
std::unique_ptr<DrmWrap, std::function<void(Drm *)>> drmNullDevice;
ExecutionEnvironment executionEnvironment;
protected:
DebugManagerStateRestore dbgRestorer;
};
typedef Test<DrmNullDeviceTestsFixture> DrmNullDeviceTests;
TEST_F(DrmNullDeviceTests, GivenDrmNullDeviceWhenCallGetDeviceIdThenReturnProperDeviceId) {
int ret = drmNullDevice->queryDeviceIdAndRevision();
EXPECT_TRUE(ret);
auto hwInfo = drmNullDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
EXPECT_EQ(deviceId, hwInfo->platform.usDeviceID);
EXPECT_EQ(revisionId, hwInfo->platform.usRevId);
}
TEST_F(DrmNullDeviceTests, GivenDrmNullDeviceWhenCallIoctlThenAlwaysSuccess) {
EXPECT_EQ(drmNullDevice->ioctl(DrmIoctl::GemExecbuffer2, nullptr), 0);
}
TEST_F(DrmNullDeviceTests, GivenDrmNullDeviceWhenRegReadOtherThenTimestampReadThenAlwaysSuccessIsReturned) {
RegisterRead arg;
arg.offset = 0;
ASSERT_EQ(drmNullDevice->ioctl(DrmIoctl::RegRead, &arg), 0);
}
TEST_F(DrmNullDeviceTests, GivenDrmNullDeviceWhenGetGpuTimestamp32bOr64bThenErrorIsReturned) {
RegisterRead arg;
arg.offset = REG_GLOBAL_TIMESTAMP_LDW;
ASSERT_EQ(drmNullDevice->ioctl(DrmIoctl::RegRead, &arg), -1);
arg.offset = REG_GLOBAL_TIMESTAMP_UN;
ASSERT_EQ(drmNullDevice->ioctl(DrmIoctl::RegRead, &arg), -1);
}
TEST_F(DrmNullDeviceTests, GivenDrmNullDeviceWhenGetGpuTimestamp36bThenProperValuesAreReturned) {
RegisterRead arg;
arg.offset = REG_GLOBAL_TIMESTAMP_LDW | 1;
ASSERT_EQ(drmNullDevice->ioctl(DrmIoctl::RegRead, &arg), 0);
EXPECT_EQ(arg.value, 1000ULL);
ASSERT_EQ(drmNullDevice->ioctl(DrmIoctl::RegRead, &arg), 0);
EXPECT_EQ(arg.value, 2000ULL);
ASSERT_EQ(drmNullDevice->ioctl(DrmIoctl::RegRead, &arg), 0);
EXPECT_EQ(arg.value, 3000ULL);
}

View File

@ -13,7 +13,6 @@
#include "shared/source/helpers/hw_info.h"
#include "shared/source/os_interface/device_factory.h"
#include "shared/source/os_interface/linux/drm_neo.h"
#include "shared/source/os_interface/linux/drm_null_device.h"
#include "hw_cmds.h"
@ -32,12 +31,7 @@ const DeviceDescriptor deviceDescriptorTable[] = {
{0, nullptr, nullptr}};
Drm *Drm::create(std::unique_ptr<HwDeviceIdDrm> &&hwDeviceId, RootDeviceEnvironment &rootDeviceEnvironment) {
std::unique_ptr<Drm> drm;
if (DebugManager.flags.EnableNullHardware.get() == true) {
drm.reset(new DrmNullDevice(std::move(hwDeviceId), rootDeviceEnvironment));
} else {
drm.reset(new Drm(std::move(hwDeviceId), rootDeviceEnvironment));
}
auto drm = std::unique_ptr<Drm>(new Drm(std::move(hwDeviceId), rootDeviceEnvironment));
if (!drm->queryDeviceIdAndRevision()) {
return nullptr;

View File

@ -32,7 +32,6 @@ set(NEO_CORE_OS_INTERFACE_LINUX
${CMAKE_CURRENT_SOURCE_DIR}/drm_engine_mapper.h
${CMAKE_CURRENT_SOURCE_DIR}/drm_neo.h
${CMAKE_CURRENT_SOURCE_DIR}/drm_neo.cpp
${CMAKE_CURRENT_SOURCE_DIR}/drm_null_device.h
${CMAKE_CURRENT_SOURCE_DIR}/drm_memory_operations_handler.h
${CMAKE_CURRENT_SOURCE_DIR}/drm_memory_operations_handler_bind.cpp
${CMAKE_CURRENT_SOURCE_DIR}/drm_memory_operations_handler_bind.h

View File

@ -1,43 +0,0 @@
/*
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/helpers/register_offsets.h"
#include "shared/source/os_interface/linux/device_time_drm.h"
#include "shared/source/os_interface/linux/drm_neo.h"
#include "shared/source/os_interface/linux/drm_wrappers.h"
namespace NEO {
class DrmNullDevice : public Drm {
public:
int ioctl(DrmIoctl request, void *arg) override {
if (request == DrmIoctl::Getparam || request == DrmIoctl::Query) {
return Drm::ioctl(request, arg);
} else if (request == DrmIoctl::RegRead) {
auto *regArg = static_cast<RegisterRead *>(arg);
// Handle only 36b timestamp
if (regArg->offset == (REG_GLOBAL_TIMESTAMP_LDW | 1)) {
gpuTimestamp += 1000;
regArg->value = gpuTimestamp & 0x0000000FFFFFFFFF;
} else if (regArg->offset == REG_GLOBAL_TIMESTAMP_LDW || regArg->offset == REG_GLOBAL_TIMESTAMP_UN) {
return -1;
}
return 0;
} else {
return 0;
}
}
DrmNullDevice(std::unique_ptr<HwDeviceIdDrm> &&hwDeviceId, RootDeviceEnvironment &rootDeviceEnvironment) : Drm(std::move(hwDeviceId), rootDeviceEnvironment){};
protected:
uint64_t gpuTimestamp = 0;
};
} // namespace NEO