mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 21:18:24 +08:00
Move Drm cleanup logic to separated method
Related-To: NEO-6999 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
07bb2e7b0b
commit
2d151ec0fe
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2019-2021 Intel Corporation
|
||||
# Copyright (C) 2019-2022 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
@@ -30,6 +30,7 @@ set(NEO_CORE_OS_INTERFACE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_context.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_context.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_environment.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_interface.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_library.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_memory.cpp
|
||||
|
||||
@@ -352,7 +352,7 @@ void Drm::destroyDrmContext(uint32_t drmContextId) {
|
||||
void Drm::destroyDrmVirtualMemory(uint32_t drmVmId) {
|
||||
GemVmControl ctl = {};
|
||||
ctl.vmId = drmVmId;
|
||||
auto ret = Drm::ioctl(DrmIoctl::GemVmDestroy, &ctl);
|
||||
auto ret = ioctlHelper->ioctl(DrmIoctl::GemVmDestroy, &ctl);
|
||||
UNRECOVERABLE_IF(ret != 0);
|
||||
}
|
||||
|
||||
@@ -711,8 +711,11 @@ PhysicalDevicePciBusInfo Drm::getPciBusInfo() const {
|
||||
return pciBusInfo;
|
||||
}
|
||||
|
||||
Drm::~Drm() {
|
||||
void Drm::cleanup() {
|
||||
destroyVirtualMemoryAddressSpace();
|
||||
}
|
||||
|
||||
Drm::~Drm() {
|
||||
this->printIoctlStatistics();
|
||||
}
|
||||
|
||||
|
||||
@@ -251,6 +251,7 @@ class Drm : public DriverModel {
|
||||
bool isVmBindPatIndexProgrammingSupported() const { return vmBindPatIndexProgrammingSupported; }
|
||||
MOCKABLE_VIRTUAL bool getDeviceMemoryMaxClockRateInMhz(uint32_t tileId, uint32_t &clkRate);
|
||||
MOCKABLE_VIRTUAL bool getDeviceMemoryPhysicalSizeInBytes(uint32_t tileId, uint64_t &physicalSize);
|
||||
void cleanup() override;
|
||||
|
||||
protected:
|
||||
Drm(std::unique_ptr<HwDeviceIdDrm> &&hwDeviceIdIn, RootDeviceEnvironment &rootDeviceEnvironment);
|
||||
|
||||
33
shared/source/os_interface/os_interface.cpp
Normal file
33
shared/source/os_interface/os_interface.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
OSInterface::~OSInterface() {
|
||||
if (this->driverModel) {
|
||||
this->driverModel->cleanup();
|
||||
}
|
||||
}
|
||||
DriverModel *OSInterface::getDriverModel() const {
|
||||
return this->driverModel.get();
|
||||
};
|
||||
|
||||
void OSInterface::setDriverModel(std::unique_ptr<DriverModel> driverModel) {
|
||||
this->driverModel = std::move(driverModel);
|
||||
};
|
||||
|
||||
bool OSInterface::are64kbPagesEnabled() {
|
||||
return osEnabled64kbPages;
|
||||
}
|
||||
|
||||
static_assert(!std::is_move_constructible_v<OSInterface>);
|
||||
static_assert(!std::is_copy_constructible_v<OSInterface>);
|
||||
static_assert(!std::is_move_assignable_v<OSInterface>);
|
||||
static_assert(!std::is_copy_assignable_v<OSInterface>);
|
||||
} // namespace NEO
|
||||
@@ -92,6 +92,8 @@ class DriverModel : public NonCopyableClass {
|
||||
return skipResourceCleanupVar;
|
||||
}
|
||||
|
||||
virtual void cleanup() {}
|
||||
|
||||
virtual bool isGpuHangDetected(OsContext &osContext) = 0;
|
||||
|
||||
protected:
|
||||
@@ -101,21 +103,15 @@ class DriverModel : public NonCopyableClass {
|
||||
|
||||
class OSInterface : public NonCopyableClass {
|
||||
public:
|
||||
virtual ~OSInterface() = default;
|
||||
DriverModel *getDriverModel() const {
|
||||
return driverModel.get();
|
||||
};
|
||||
virtual ~OSInterface();
|
||||
DriverModel *getDriverModel() const;
|
||||
|
||||
void setDriverModel(std::unique_ptr<DriverModel> driverModel) {
|
||||
this->driverModel = std::move(driverModel);
|
||||
};
|
||||
void setDriverModel(std::unique_ptr<DriverModel> driverModel);
|
||||
|
||||
MOCKABLE_VIRTUAL bool isDebugAttachAvailable() const;
|
||||
static bool osEnabled64kbPages;
|
||||
static bool osEnableLocalMemory;
|
||||
static bool are64kbPagesEnabled() {
|
||||
return osEnabled64kbPages;
|
||||
}
|
||||
static bool are64kbPagesEnabled();
|
||||
static bool newResourceImplicitFlush;
|
||||
static bool gpuIdleImplicitFlush;
|
||||
static bool requiresSupportForWddmTrimNotification;
|
||||
@@ -126,9 +122,4 @@ class OSInterface : public NonCopyableClass {
|
||||
std::unique_ptr<DriverModel> driverModel = nullptr;
|
||||
};
|
||||
|
||||
static_assert(!std::is_move_constructible_v<NEO::OSInterface>);
|
||||
static_assert(!std::is_copy_constructible_v<NEO::OSInterface>);
|
||||
static_assert(!std::is_move_assignable_v<NEO::OSInterface>);
|
||||
static_assert(!std::is_copy_assignable_v<NEO::OSInterface>);
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
Reference in New Issue
Block a user