drm/amd/display: change the panel power savings level without a modeset

We don't actually need to request that the compositor does a full
modeset to modify the panel power savings level, we can instead
just make a request to DMUB, to set the new level dynamically.

Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Leo Li <sunpeng.li@amd.com>
Cc: Mario Limonciello <mario.limonciello@amd.com>
Cc: Sebastian Wick <sebastian@sebastianwick.net>
Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
Tested-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3578
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Hamza Mahfooz
2024-08-09 16:42:53 -04:00
committed by Alex Deucher
parent c75c5285e5
commit 8d20a066fa
3 changed files with 41 additions and 17 deletions

View File

@@ -6908,9 +6908,14 @@ static ssize_t panel_power_savings_store(struct device *device,
const char *buf, size_t count)
{
struct drm_connector *connector = dev_get_drvdata(device);
struct amdgpu_dm_connector *aconn = to_amdgpu_dm_connector(connector);
struct drm_device *dev = connector->dev;
struct amdgpu_device *adev = drm_to_adev(dev);
struct dc *dc = adev->dm.dc;
struct pipe_ctx *pipe_ctx;
long val;
int ret;
int i;
ret = kstrtol(buf, 0, &val);
@@ -6925,7 +6930,17 @@ static ssize_t panel_power_savings_store(struct device *device,
ABM_LEVEL_IMMEDIATE_DISABLE;
drm_modeset_unlock(&dev->mode_config.connection_mutex);
drm_kms_helper_hotplug_event(dev);
mutex_lock(&adev->dm.dc_lock);
for (i = 0; i < dc->res_pool->pipe_count; i++) {
pipe_ctx = &dc->current_state->res_ctx.pipe_ctx[i];
if (pipe_ctx->stream &&
pipe_ctx->stream->link == aconn->dc_link) {
dc_set_abm_level(dc, pipe_ctx, val);
break;
}
}
mutex_unlock(&adev->dm.dc_lock);
return count;
}