On Mon, Oct 24, 2016 at 5:46 AM, Christian König <christian.koenig@xxxxxxx> wrote: > Am 23.10.2016 um 01:05 schrieb Lucas Stach: >> >> The current default of always using the performance power state leads >> to increased power consumption of mobile devices, which have a dedicated >> battery power state. Switch between the performance and battery power >> state automatically, dpending on the current AC power status, when the >> user asked for the balanced power state. >> >> The user can still override this logic by asking for the performance >> or battery power state explicitly. >> >> Signed-off-by: Lucas Stach <dev@xxxxxxxxxx> > > > Nice addition, the only thing I can of hand see is that you probably want to > remove the "balanced states don't exist at the moment" comment when you > actually implement them (or abuse them). > > Apart from that I'm not so deep into the PM stuff, so patch is only > Acked-by: Christian König <christian.koenig@xxxxxxx>. IIRC, I had a similar patch years ago, and it was generally shot down since it moved policy into the driver. Also, certain userspace packages like tlp do this already. That said, I'm happy to apply it if there are no objections. Alex > > Regards, > Christian. > > >> --- >> This saves about 1.2W on my Richland based laptop, whithout me having >> to remember to ask for the battery state or have userspace set up in >> a way to do this. >> --- >> drivers/gpu/drm/radeon/radeon_pm.c | 6 +++++- >> 1 file changed, 5 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/gpu/drm/radeon/radeon_pm.c >> b/drivers/gpu/drm/radeon/radeon_pm.c >> index 4b65425..326ad06 100644 >> --- a/drivers/gpu/drm/radeon/radeon_pm.c >> +++ b/drivers/gpu/drm/radeon/radeon_pm.c >> @@ -47,6 +47,7 @@ static bool radeon_pm_in_vbl(struct radeon_device >> *rdev); >> static bool radeon_pm_debug_check_in_vbl(struct radeon_device *rdev, >> bool finish); >> static void radeon_pm_update_profile(struct radeon_device *rdev); >> static void radeon_pm_set_clocks(struct radeon_device *rdev); >> +static void radeon_pm_compute_clocks_dpm(struct radeon_device *rdev); >> int radeon_pm_get_type_index(struct radeon_device *rdev, >> enum radeon_pm_state_type ps_type, >> @@ -79,6 +80,8 @@ void radeon_pm_acpi_event_handler(struct radeon_device >> *rdev) >> radeon_dpm_enable_bapm(rdev, >> rdev->pm.dpm.ac_power); >> } >> mutex_unlock(&rdev->pm.mutex); >> + /* allow new DPM state to be picked */ >> + radeon_pm_compute_clocks_dpm(rdev); >> } else if (rdev->pm.pm_method == PM_METHOD_PROFILE) { >> if (rdev->pm.profile == PM_PROFILE_AUTO) { >> mutex_lock(&rdev->pm.mutex); >> @@ -882,7 +885,8 @@ static struct radeon_ps >> *radeon_dpm_pick_power_state(struct radeon_device *rdev, >> dpm_state = POWER_STATE_TYPE_INTERNAL_3DPERF; >> /* balanced states don't exist at the moment */ >> if (dpm_state == POWER_STATE_TYPE_BALANCED) >> - dpm_state = POWER_STATE_TYPE_PERFORMANCE; >> + dpm_state = rdev->pm.dpm.ac_power ? >> + POWER_STATE_TYPE_PERFORMANCE : >> POWER_STATE_TYPE_BATTERY; >> restart_search: >> /* Pick the best power state based on current conditions */ > > > > _______________________________________________ > dri-devel mailing list > dri-devel@xxxxxxxxxxxxxxxxxxxxx > https://lists.freedesktop.org/mailman/listinfo/dri-devel _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel