mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 23:03:02 +08:00
Implement WddmFanImp::setDefaultMode to enable zesFanSetDefaultMode feature (#11623)
* Implement WddmFanImp::setDefaultMode to enable zesFanSetDefaultMode feature Signed-off-by: sairamud <sairam.udaya.janardhana.muttavarapu@intel.com> * Implement WddmFanImp::setDefaultMode to enable zesFanSetDefaultMode feature Signed-off-by: sairamud <sairam.udaya.janardhana.muttavarapu@intel.com> * Implement WddmFanImp::setDefaultMode to enable zesFanSetDefaultMode feature Signed-off-by: sairamud <sairam.udaya.janardhana.muttavarapu@intel.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -67,7 +67,18 @@ ze_result_t WddmFanImp::getConfig(zes_fan_config_t *pConfig) {
|
||||
}
|
||||
|
||||
ze_result_t WddmFanImp::setDefaultMode() {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
KmdSysman::RequestProperty request;
|
||||
KmdSysman::ResponseProperty response;
|
||||
|
||||
// Passing current number of control points as zero will reset pcode to default fan curve
|
||||
uint32_t value = 0; // 0 to reset to default
|
||||
request.commandId = KmdSysman::Command::Set;
|
||||
request.componentId = KmdSysman::Component::FanComponent;
|
||||
request.requestId = KmdSysman::Requests::Fans::CurrentNumOfControlPoints;
|
||||
request.dataSize = sizeof(uint32_t);
|
||||
memcpy_s(request.dataBuffer, sizeof(uint32_t), &value, sizeof(uint32_t));
|
||||
|
||||
return pKmdSysManager->requestSingle(request, response);
|
||||
}
|
||||
|
||||
ze_result_t WddmFanImp::setFixedSpeedMode(const zes_fan_speed_t *pSpeed) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -61,7 +61,13 @@ struct Mock<FanKmdSysManager> : public FanKmdSysManager {
|
||||
uint32_t *pValue = reinterpret_cast<uint32_t *>(pBuffer);
|
||||
mockFanCurrentFanPoints = *pValue;
|
||||
pResponse->outDataSize = 0;
|
||||
pResponse->outReturnCode = KmdSysman::KmdSysmanSuccess;
|
||||
if ((mockFanCurrentFanPoints % 2 == 0) && (mockFanCurrentFanPoints > 0) && (mockFanCurrentFanPoints <= mockFanMaxPoints)) {
|
||||
pResponse->outReturnCode = KmdSysman::KmdSysmanSuccess;
|
||||
} else if (mockFanCurrentFanPoints == 0) {
|
||||
pResponse->outReturnCode = KmdSysman::KmdSysmanSuccess;
|
||||
} else {
|
||||
pResponse->outReturnCode = KmdSysman::KmdSysmanFail;
|
||||
}
|
||||
} break;
|
||||
default: {
|
||||
pResponse->outDataSize = 0;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -176,14 +176,14 @@ TEST_F(SysmanDeviceFanFixture, GivenValidFanHandleWhenGettingFanConfigThenUnsupp
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(SysmanDeviceFanFixture, GivenValidFanHandleWhenSettingDefaultModeThenUnsupportedIsReturned) {
|
||||
TEST_F(SysmanDeviceFanFixture, GivenValidFanHandleWhenSettingDefaultModeThenSupportedIsReturned) {
|
||||
// Setting allow set calls or not
|
||||
init(true, true);
|
||||
|
||||
auto handles = get_fan_handles();
|
||||
|
||||
for (auto handle : handles) {
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, zesFanSetDefaultMode(handle));
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zesFanSetDefaultMode(handle));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ TEST_F(SysmanDeviceFanFixture, GivenValidFanHandleWhenSettingFixedSpeedModeThenU
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(SysmanDeviceFanFixture, GivenValidFanHandleWhenSettingTheSpeedTableModeThenUnsupportedIsReturned) {
|
||||
TEST_F(SysmanDeviceFanFixture, GivenValidFanHandleWhenSettingTheSpeedTableModeWithNumberOfPointsZeroThenUnsupportedIsReturned) {
|
||||
// Setting allow set calls or not
|
||||
init(true, true);
|
||||
|
||||
@@ -211,6 +211,19 @@ TEST_F(SysmanDeviceFanFixture, GivenValidFanHandleWhenSettingTheSpeedTableModeTh
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(SysmanDeviceFanFixture, GivenValidFanHandleWhenSettingTheSpeedTableModeWithGreaterThanMaxNumberOfPointsThenUnsupportedIsReturned) {
|
||||
// Setting allow set calls or not
|
||||
init(true, true);
|
||||
|
||||
auto handles = get_fan_handles();
|
||||
|
||||
for (auto handle : handles) {
|
||||
zes_fan_speed_table_t fanSpeedTable = {0};
|
||||
fanSpeedTable.numPoints = 20; // Setting number of control points greater than max number of control points (10)
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zesFanSetSpeedTableMode(handle, &fanSpeedTable));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(SysmanDeviceFanFixture, GivenValidFanHandleWhenGettingFanSpeedWithRPMUnitThenValidFanSpeedReadingsRetrieved) {
|
||||
// Setting allow set calls or not
|
||||
init(true, true);
|
||||
|
||||
Reference in New Issue
Block a user