Skip to content

Commit 4d6fc55

Browse files
committed
drm/amdgpu: expand runpm parameter
Allow the user to specify -2 as auto enabled with displays. By default we don't enter runtime suspend when there are displays attached because it does not work well in some desktop environments due to the driver sending hotplug events on resume in case any new displays were attached while the GPU was powered down. Some users still want this functionality though, so this lets you enable it. Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2428 Reviewed-by: Guchun Chen <guchun.chen@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 47f1724 commit 4d6fc55

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,9 @@ module_param_named(aspm, amdgpu_aspm, int, 0444);
347347
* Override for runtime power management control for dGPUs. The amdgpu driver can dynamically power down
348348
* the dGPUs when they are idle if supported. The default is -1 (auto enable).
349349
* Setting the value to 0 disables this functionality.
350+
* Setting the value to -2 is auto enabled with power down when displays are attached.
350351
*/
351-
MODULE_PARM_DESC(runpm, "PX runtime pm (2 = force enable with BAMACO, 1 = force enable with BACO, 0 = disable, -1 = auto)");
352+
MODULE_PARM_DESC(runpm, "PX runtime pm (2 = force enable with BAMACO, 1 = force enable with BACO, 0 = disable, -1 = auto, -2 = autowith displays)");
352353
module_param_named(runpm, amdgpu_runtime_pm, int, 0444);
353354

354355
/**
@@ -2496,24 +2497,26 @@ static int amdgpu_runtime_idle_check_display(struct device *dev)
24962497
struct drm_connector_list_iter iter;
24972498
int ret = 0;
24982499

2499-
/* XXX: Return busy if any displays are connected to avoid
2500-
* possible display wakeups after runtime resume due to
2501-
* hotplug events in case any displays were connected while
2502-
* the GPU was in suspend. Remove this once that is fixed.
2503-
*/
2504-
mutex_lock(&drm_dev->mode_config.mutex);
2505-
drm_connector_list_iter_begin(drm_dev, &iter);
2506-
drm_for_each_connector_iter(list_connector, &iter) {
2507-
if (list_connector->status == connector_status_connected) {
2508-
ret = -EBUSY;
2509-
break;
2500+
if (amdgpu_runtime_pm != -2) {
2501+
/* XXX: Return busy if any displays are connected to avoid
2502+
* possible display wakeups after runtime resume due to
2503+
* hotplug events in case any displays were connected while
2504+
* the GPU was in suspend. Remove this once that is fixed.
2505+
*/
2506+
mutex_lock(&drm_dev->mode_config.mutex);
2507+
drm_connector_list_iter_begin(drm_dev, &iter);
2508+
drm_for_each_connector_iter(list_connector, &iter) {
2509+
if (list_connector->status == connector_status_connected) {
2510+
ret = -EBUSY;
2511+
break;
2512+
}
25102513
}
2511-
}
2512-
drm_connector_list_iter_end(&iter);
2513-
mutex_unlock(&drm_dev->mode_config.mutex);
2514+
drm_connector_list_iter_end(&iter);
2515+
mutex_unlock(&drm_dev->mode_config.mutex);
25142516

2515-
if (ret)
2516-
return ret;
2517+
if (ret)
2518+
return ret;
2519+
}
25172520

25182521
if (adev->dc_enabled) {
25192522
struct drm_crtc *crtc;

0 commit comments

Comments
 (0)