drm/radeon/kms: update pm code
Subsystems (2)
cover drm/radeon/kms: update pm code
This set of patches applies on top of the code in drm-radeon-testing.
I've been testing this code pretty hard this week and it's been solid. In addition to some fixes on top of what's in d-r-t, it also reworks the pm code to support two basic methods:
1. "dynpm"
2. "profile"
You can select the methods via sysfs. Echo "dynpm" or "profile" to /sys/class/drm/card-0/device/power_method.
The "dynpm" method dynamically changes the clocks based on the number of pending fences, so performance is ramped up when running GPU intensive apps, and ramped down when the GPU is idle. The reclocking is attemped during vertical blanking periods, but due to the timing of the reclocking functions, doesn't not always complete in the blanking period, which can lead to flicker in the display. Due to this, dynpm only works when a single head is active.
The "profile" method exposes 4 profiles that can be selected from:
1. "default"
2. "auto"
3. "low"
4. "high"
Select the profile by echoing the selected profile to /sys/class/drm/card-0/device/power_profile.
"default" uses the default clocks and does not change the power state. This is the default behavior.
"auto" selects between low and high power states based on the whether the system is on battery power or not. Even lower power states are selected when the monitors are in the dpms off state.
"low" forces the gpu to be in the low power state all the time. Even lower power states are selected when the monitors are in the dpms off state. "high" forces the gpu to be in the high power state all the time. Even lower power states are selected when the monitors are in the dpms off state.
The "profile" method is not as agressive as "dynpm," but is currently much more stable and flicker free and works with multiple heads active.
The default power management method is "profile" using the "default" profile. The default should eventaully be changed to "profile" "auto".
For upstream, we may want to squash some of these. I'm open to suggestions. Everthing that's been added since drm-linus?
Alex
PATCH 1/9 drm/radeon/kms: enable misc pm power state features on r5xx, rs6xx
voltage drop, dynamic voltage, dynamic sclk, pcie lane adjust, etc,
--- drivers/gpu/drm/radeon/rs600.c | 14 ++++++++++---- drivers/gpu/drm/radeon/rs600d.h | 2 ++ 2 files changed, 12 insertions(+), 4 deletions(-)
drivers/gpu/drm/radeon/rs600.c +10 -4
@@ -48,12 +48,11 @@ int rs600_mc_wait_for_idle(struct radeon_device *rdev);void rs600_pm_misc (struct radeon_device *rdev) { -#if 0 int requested_index = rdev->pm.requested_power_state_index;struct radeon_power_state *ps = &rdev->pm.power_state[requested_index];struct radeon_voltage *voltage = &ps->clock_info[0 ].voltage;u32 tmp, dyn_pwrmgt_sclk_length, dyn_sclk_vol_cntl; -u32 hdp_dyn_cntl, mc_host_dyn_cntl; +u32 hdp_dyn_cntl,/*mc_host_dyn_cntl,*/ dyn_backbias_cntl;if ((voltage->type ==VOLTAGE_GPIO ) && (voltage->gpio.valid)) {if (ps->misc &ATOM_PM_MISCINFO_VOLTAGE_DROP_SUPPORT ) {
@@ -112,13 +111,21 @@ void rs600_pm_misc(struct radeon_device *rdev)else hdp_dyn_cntl |=HDP_FORCEON ;WREG32_PLL (HDP_DYN_CNTL , hdp_dyn_cntl); - +#if 0 +/* mc_host_dyn seems to cause hangs from time to time */ mc_host_dyn_cntl =RREG32_PLL (MC_HOST_DYN_CNTL );if (ps->misc &ATOM_PM_MISCINFO_DYNAMIC_MC_HOST_BLOCK_EN ) mc_host_dyn_cntl &= ~MC_HOST_FORCEON ;else mc_host_dyn_cntl |=MC_HOST_FORCEON ;WREG32_PLL (MC_HOST_DYN_CNTL , mc_host_dyn_cntl); +#endif + dyn_backbias_cntl =RREG32_PLL (DYN_BACKBIAS_CNTL ); +if (ps->misc &ATOM_PM_MISCINFO2_DYNAMIC_BACK_BIAS_EN ) + dyn_backbias_cntl |=IO_CG_BACKBIAS_EN ; +else + dyn_backbias_cntl &= ~IO_CG_BACKBIAS_EN ; +WREG32_PLL (DYN_BACKBIAS_CNTL , dyn_backbias_cntl);/* set pcie lanes */ if ((rdev->flags & RADEON_IS_PCIE) &&
@@ -130,7 +137,6 @@ void rs600_pm_misc(struct radeon_device *rdev) ps->pcie_lanes);DRM_INFO ("Setting: p: %d\n" , ps->pcie_lanes); } -#endif }void rs600_pm_prepare (struct radeon_device *rdev)
drivers/gpu/drm/radeon/rs600d.h +2 -0
@@ -655,6 +655,8 @@#define HDP_FORCEON (1 << 0)#define MC_HOST_DYN_CNTL 0x1e#define MC_HOST_FORCEON (1 << 0) +#define DYN_BACKBIAS_CNTL 0x29 +#define IO_CG_BACKBIAS_EN (1 << 0)/* mmreg */ #define DOUT_POWER_MANAGEMENT_CNTL 0x7ee0
Signature · 1 line
1.5.6.3
PATCH 2/9 drm/radeon/kms: enable misc pm power state features on r1xx-r4xx
voltage drop, dynamic voltage, dynamic sclk, pcie lane adjust, etc,
--- drivers/gpu/drm/radeon/r100.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/r100.c +0 -2
@@ -220,7 +220,6 @@ void r100_set_power_state(struct radeon_device *rdev, bool static_switch)void r100_pm_misc (struct radeon_device *rdev) { -#if 0 int requested_index = rdev->pm.requested_power_state_index;struct radeon_power_state *ps = &rdev->pm.power_state[requested_index];struct radeon_voltage *voltage = &ps->clock_info[0 ].voltage;
@@ -308,7 +307,6 @@ void r100_pm_misc(struct radeon_device *rdev) ps->pcie_lanes);DRM_INFO ("Setting: p: %d\n" , ps->pcie_lanes); } -#endif }void r100_pm_prepare (struct radeon_device *rdev)
Signature · 1 line
1.5.6.3
PATCH 3/9 drm/radeon/kms: re-enable gui idle interrupts on r6xx+
--- drivers/gpu/drm/radeon/radeon_pm.c | 24 +++++++++++++----------- 1 files changed, 13 insertions(+), 11 deletions(-)
drivers/gpu/drm/radeon/radeon_pm.c +13 -11
@@ -64,17 +64,19 @@ static void radeon_pm_set_clocks(struct radeon_device *rdev, int static_switch)mutex_lock (&rdev->ddev->struct_mutex);mutex_lock (&rdev->vram_mutex);mutex_lock (&rdev->cp.mutex); -#if 0 -/* wait for GPU idle */ - rdev->pm.gui_idle = false; - rdev->irq.gui_idle = true; -radeon_irq_set (rdev); -wait_event_interruptible_timeout ( - rdev->irq.idle_queue, rdev->pm.gui_idle, -msecs_to_jiffies (RADEON_WAIT_IDLE_TIMEOUT )); - rdev->irq.gui_idle = false; -radeon_irq_set (rdev); -#endif + +/* gui idle int has issues on older chips it seems */ +if (rdev->family >=CHIP_R600 ) { +/* wait for GPU idle */ + rdev->pm.gui_idle = false; + rdev->irq.gui_idle = true; +radeon_irq_set (rdev); +wait_event_interruptible_timeout ( + rdev->irq.idle_queue, rdev->pm.gui_idle, +msecs_to_jiffies (RADEON_WAIT_IDLE_TIMEOUT )); + rdev->irq.gui_idle = false; +radeon_irq_set (rdev); + }radeon_unmap_vram_bos (rdev);if (!static_switch) {
Signature · 1 line
1.5.6.3
PATCH 4/9 radeon: Split out ring locking and allocation
From: Matthew Garrett <[email protected]>
We need to handle the ring while we've already locked it, so split out the allocation and commit functions in order to allow them to be used.
--- drivers/gpu/drm/radeon/radeon.h | 2 ++ drivers/gpu/drm/radeon/radeon_ring.c | 27 +++++++++++++++++++++------ 2 files changed, 23 insertions(+), 6 deletions(-)
drivers/gpu/drm/radeon/radeon.h +2 -0
@@ -471,7 +471,9 @@ int radeon_ib_test(struct radeon_device *rdev);extern void radeon_ib_bogus_add (struct radeon_device *rdev,struct radeon_ib *ib);/* Ring access between begin & end cannot sleep */ void radeon_ring_free_size (struct radeon_device *rdev); +int radeon_ring_alloc (struct radeon_device *rdev,unsigned ndw);int radeon_ring_lock (struct radeon_device *rdev,unsigned ndw); +void radeon_ring_commit (struct radeon_device *rdev);void radeon_ring_unlock_commit (struct radeon_device *rdev);void radeon_ring_unlock_undo (struct radeon_device *rdev);int radeon_ring_test (struct radeon_device *rdev);
drivers/gpu/drm/radeon/radeon_ring.c +21 -6
@@ -258,31 +258,41 @@ void radeon_ring_free_size(struct radeon_device *rdev) } } -int radeon_ring_lock (struct radeon_device *rdev,unsigned ndw) +int radeon_ring_alloc (struct radeon_device *rdev,unsigned ndw) {int r;/* Align requested size with padding so unlock_commit can * pad safely */ ndw = (ndw + rdev->cp.align_mask) & ~rdev->cp.align_mask; -mutex_lock (&rdev->cp.mutex);while (ndw > (rdev->cp.ring_free_dw -1 )) {radeon_ring_free_size (rdev);if (ndw < rdev->cp.ring_free_dw) {break ; } r =radeon_fence_wait_next (rdev); -if (r) { -mutex_unlock (&rdev->cp.mutex); +if (r)return r; - } } rdev->cp.count_dw = ndw; rdev->cp.wptr_old = rdev->cp.wptr;return 0 ; } -void radeon_ring_unlock_commit (struct radeon_device *rdev) +int radeon_ring_lock (struct radeon_device *rdev,unsigned ndw) +{ +int r; + +mutex_lock (&rdev->cp.mutex); + r =radeon_ring_alloc (rdev, ndw); +if (r) { +mutex_unlock (&rdev->cp.mutex); +return r; + } +return 0 ; +} + +void radeon_ring_commit (struct radeon_device *rdev) {unsigned count_dw_pad;unsigned i;
@@ -295,6 +305,11 @@ void radeon_ring_unlock_commit(struct radeon_device *rdev) }DRM_MEMORYBARRIER ();radeon_cp_commit (rdev); +} + +void radeon_ring_unlock_commit (struct radeon_device *rdev) +{ +radeon_ring_commit (rdev);mutex_unlock (&rdev->cp.mutex); }
Signature · 1 line
1.5.6.3
PATCH 5/9 radeon: Use fences to gate entry to reclocking on <r600
From: Matthew Garrett <[email protected]>
GUI idle interrupts don't seem to work terribly well on r500 and earlier, so let's use a fence instead.
--- drivers/gpu/drm/radeon/radeon_pm.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/gpu/drm/radeon/radeon_pm.c +8 -0
@@ -76,6 +76,14 @@ static void radeon_pm_set_clocks(struct radeon_device *rdev, int static_switch) msecs_to_jiffies(RADEON_WAIT_IDLE_TIMEOUT)); rdev->irq.gui_idle = false;radeon_irq_set (rdev); + }else { +struct radeon_fence *fence; +radeon_ring_alloc (rdev,64 ); +radeon_fence_create (rdev, &fence); +radeon_fence_emit (rdev, fence); +radeon_ring_commit (rdev); +radeon_fence_wait (fence, false); +radeon_fence_unref (&fence); }radeon_unmap_vram_bos (rdev);
Signature · 1 line
1.5.6.3
PATCH 6/9 drm/radeon/kms: fix lock ordering in ring, ib handling
--- drivers/gpu/drm/radeon/radeon_ring.c | 39 +++++++++++++++++++-------------- 1 files changed, 22 insertions(+), 17 deletions(-)
drivers/gpu/drm/radeon/radeon_ring.c +22 -17
@@ -219,24 +219,26 @@ int radeon_ib_pool_init(struct radeon_device *rdev)void radeon_ib_pool_fini (struct radeon_device *rdev) {int r; +struct radeon_bo *robj;if (!rdev->ib_pool.ready) {return ; }mutex_lock (&rdev->ib_pool.mutex);radeon_ib_bogus_cleanup (rdev); + robj = rdev->ib_pool.robj; + rdev->ib_pool.robj =NULL ; +mutex_unlock (&rdev->ib_pool.mutex); -if (rdev->ib_pool.robj) { - r =radeon_bo_reserve (rdev->ib_pool.robj, false); +if (robj) { + r =radeon_bo_reserve (robj, false);if (likely (r ==0 )) { -radeon_bo_kunmap (rdev->ib_pool.robj); -radeon_bo_unpin (rdev->ib_pool.robj); -radeon_bo_unreserve (rdev->ib_pool.robj); +radeon_bo_kunmap (robj); +radeon_bo_unpin (robj); +radeon_bo_unreserve (robj); } -radeon_bo_unref (&rdev->ib_pool.robj); - rdev->ib_pool.robj =NULL ; +radeon_bo_unref (&robj); } -mutex_unlock (&rdev->ib_pool.mutex); }
@@ -359,20 +361,23 @@ int radeon_ring_init(struct radeon_device *rdev, unsigned ring_size)void radeon_ring_fini (struct radeon_device *rdev) {int r; +struct radeon_bo *ring_obj;mutex_lock (&rdev->cp.mutex); -if (rdev->cp.ring_obj) { - r =radeon_bo_reserve (rdev->cp.ring_obj, false); + ring_obj = rdev->cp.ring_obj; + rdev->cp.ring =NULL ; + rdev->cp.ring_obj =NULL ; +mutex_unlock (&rdev->cp.mutex); + +if (ring_obj) { + r =radeon_bo_reserve (ring_obj, false);if (likely (r ==0 )) { -radeon_bo_kunmap (rdev->cp.ring_obj); -radeon_bo_unpin (rdev->cp.ring_obj); -radeon_bo_unreserve (rdev->cp.ring_obj); +radeon_bo_kunmap (ring_obj); +radeon_bo_unpin (ring_obj); +radeon_bo_unreserve (ring_obj); } -radeon_bo_unref (&rdev->cp.ring_obj); - rdev->cp.ring =NULL ; - rdev->cp.ring_obj =NULL ; +radeon_bo_unref (&ring_obj); } -mutex_unlock (&rdev->cp.mutex); }
Signature · 1 line
1.5.6.3
PATCH 7/9 drm/radeon/kms/pm: add support for no display power states
The lowest power states often cause display problems, so only enable them when all displays are off.
--- drivers/gpu/drm/radeon/atombios_crtc.c | 9 +++--- drivers/gpu/drm/radeon/r100.c | 12 ++++++-- drivers/gpu/drm/radeon/r600.c | 20 ++++++++++++-- drivers/gpu/drm/radeon/radeon.h | 7 +++- drivers/gpu/drm/radeon/radeon_atombios.c | 37 ++++++++++++++++++-------- drivers/gpu/drm/radeon/radeon_combios.c | 2 +- drivers/gpu/drm/radeon/radeon_legacy_crtc.c | 9 +++--- drivers/gpu/drm/radeon/radeon_pm.c | 38 ++++++++++++++++++-------- 8 files changed, 94 insertions(+), 40 deletions(-)
drivers/gpu/drm/radeon/atombios_crtc.c +5 -4
@@ -245,13 +245,15 @@ void atombios_crtc_dpms(struct drm_crtc *crtc, int mode)switch (mode) {case DRM_MODE_DPMS_ON : + radeon_crtc->enabled = true; +/* adjust pm to dpms changes BEFORE enabling crtcs */ +radeon_pm_compute_clocks (rdev);atombios_enable_crtc (crtc,ATOM_ENABLE );if (ASIC_IS_DCE3 (rdev))atombios_enable_crtc_memreq (crtc,ATOM_ENABLE );atombios_blank_crtc (crtc,ATOM_DISABLE );drm_vblank_post_modeset (dev, radeon_crtc->crtc_id);radeon_crtc_load_lut (crtc); - radeon_crtc->enabled = true;break ;case DRM_MODE_DPMS_STANDBY :case DRM_MODE_DPMS_SUSPEND :
@@ -262,11 +264,10 @@ void atombios_crtc_dpms(struct drm_crtc *crtc, int mode)atombios_enable_crtc_memreq (crtc,ATOM_DISABLE );atombios_enable_crtc (crtc,ATOM_DISABLE ); radeon_crtc->enabled = false; +/* adjust pm to dpms changes AFTER disabling crtcs */ +radeon_pm_compute_clocks (rdev);break ; } - -/* adjust pm to dpms change */ -radeon_pm_compute_clocks (rdev); } static void
drivers/gpu/drm/radeon/r100.c +9 -3
@@ -87,7 +87,7 @@ void r100_get_power_state(struct radeon_device *rdev, }else {if (rdev->pm.active_crtc_count >1 ) {for (i =0 ; i < rdev->pm.num_power_states; i++) { -if (rdev->pm.power_state[i].flags &RADEON_PM_SINGLE_DISPLAY_ONLY ) +if (rdev->pm.power_state[i].flags &RADEON_PM_STATE_SINGLE_DISPLAY_ONLY )continue ;else if (i >= rdev->pm.current_power_state_index) { rdev->pm.requested_power_state_index = rdev->pm.current_power_state_index;
@@ -101,6 +101,12 @@ void r100_get_power_state(struct radeon_device *rdev, rdev->pm.requested_power_state_index = rdev->pm.current_power_state_index -1 ; } +/* don't use the power state if crtcs are active and no display flag is set */ +if ((rdev->pm.active_crtc_count >0 ) && + (rdev->pm.power_state[rdev->pm.requested_power_state_index].clock_info[0 ].flags & +RADEON_PM_MODE_NO_DISPLAY )) { + rdev->pm.requested_power_state_index++; + }break ;case PM_ACTION_UPCLOCK :if (rdev->pm.current_power_state_index == (rdev->pm.num_power_states -1 )) {
@@ -109,7 +115,7 @@ void r100_get_power_state(struct radeon_device *rdev, }else {if (rdev->pm.active_crtc_count >1 ) {for (i = (rdev->pm.num_power_states -1 ); i >=0 ; i--) { -if (rdev->pm.power_state[i].flags &RADEON_PM_SINGLE_DISPLAY_ONLY ) +if (rdev->pm.power_state[i].flags &RADEON_PM_STATE_SINGLE_DISPLAY_ONLY )continue ;else if (i <= rdev->pm.current_power_state_index) { rdev->pm.requested_power_state_index = rdev->pm.current_power_state_index;
@@ -215,7 +221,7 @@ void r100_set_power_state(struct radeon_device *rdev, bool static_switch) rdev->pm.current_power_state_index = rdev->pm.requested_power_state_index; rdev->pm.current_clock_mode_index = rdev->pm.requested_clock_mode_index; }else -DRM_INFO ("GUI not idle!!!\n" ); +DRM_INFO ("pm: GUI not idle!!!\n" ); }void r100_pm_misc (struct radeon_device *rdev)
drivers/gpu/drm/radeon/r600.c +17 -3
@@ -120,7 +120,7 @@ void r600_get_power_state(struct radeon_device *rdev, }else {if (rdev->pm.active_crtc_count >1 ) {for (i =0 ; i < rdev->pm.num_power_states; i++) { -if (rdev->pm.power_state[i].flags &RADEON_PM_SINGLE_DISPLAY_ONLY ) +if (rdev->pm.power_state[i].flags &RADEON_PM_STATE_SINGLE_DISPLAY_ONLY )continue ;else if (i >= rdev->pm.current_power_state_index) { rdev->pm.requested_power_state_index =
@@ -136,6 +136,13 @@ void r600_get_power_state(struct radeon_device *rdev, rdev->pm.current_power_state_index -1 ; } rdev->pm.requested_clock_mode_index =0 ; +/* don't use the power state if crtcs are active and no display flag is set */ +if ((rdev->pm.active_crtc_count >0 ) && + (rdev->pm.power_state[rdev->pm.requested_power_state_index]. + clock_info[rdev->pm.requested_clock_mode_index].flags & +RADEON_PM_MODE_NO_DISPLAY )) { + rdev->pm.requested_power_state_index++; + }break ;case PM_ACTION_UPCLOCK :if (rdev->pm.current_power_state_index == (rdev->pm.num_power_states -1 )) {
@@ -144,7 +151,7 @@ void r600_get_power_state(struct radeon_device *rdev, }else {if (rdev->pm.active_crtc_count >1 ) {for (i = (rdev->pm.num_power_states -1 ); i >=0 ; i--) { -if (rdev->pm.power_state[i].flags &RADEON_PM_SINGLE_DISPLAY_ONLY ) +if (rdev->pm.power_state[i].flags &RADEON_PM_STATE_SINGLE_DISPLAY_ONLY )continue ;else if (i <= rdev->pm.current_power_state_index) { rdev->pm.requested_power_state_index =
@@ -179,7 +186,7 @@ void r600_get_power_state(struct radeon_device *rdev, rdev->pm.requested_power_state_index =-1 ;/* start at 1 as we don't want the default mode */ for (i =1 ; i < rdev->pm.num_power_states; i++) { -if (rdev->pm.power_state[i].flags &RADEON_PM_SINGLE_DISPLAY_ONLY ) +if (rdev->pm.power_state[i].flags &RADEON_PM_STATE_SINGLE_DISPLAY_ONLY )continue ;else if ((rdev->pm.power_state[i].type ==POWER_STATE_TYPE_PERFORMANCE ) || (rdev->pm.power_state[i].type ==POWER_STATE_TYPE_BATTERY )) {
@@ -210,6 +217,13 @@ void r600_get_power_state(struct radeon_device *rdev, rdev->pm.requested_clock_mode_index =0 ; rdev->pm.can_downclock = false; } +/* don't use the power state if crtcs are active and no display flag is set */ +if ((rdev->pm.active_crtc_count >0 ) && + (rdev->pm.power_state[rdev->pm.requested_power_state_index]. + clock_info[rdev->pm.requested_clock_mode_index].flags & +RADEON_PM_MODE_NO_DISPLAY )) { + rdev->pm.requested_clock_mode_index++; + }break ;case PM_ACTION_UPCLOCK :if (rdev->pm.requested_power_state_index == rdev->pm.current_power_state_index) {
drivers/gpu/drm/radeon/radeon.h +5 -2
@@ -658,6 +658,9 @@ struct radeon_voltage {u32 voltage; }; +/* clock mode flags */ +#define RADEON_PM_MODE_NO_DISPLAY (1 << 0) +struct radeon_pm_clock_info {/* memory clock */ u32 mclk;
@@ -665,12 +668,12 @@ struct radeon_pm_clock_info {u32 sclk;/* voltage info */ struct radeon_voltage voltage; -/* standardized clock flags - not sure we'll need these */ +/* standardized clock flags */ u32 flags; };/* state flags */ -#define RADEON_PM_SINGLE_DISPLAY_ONLY (1 << 0) +#define RADEON_PM_STATE_SINGLE_DISPLAY_ONLY (1 << 0)struct radeon_power_state {enum radeon_pm_state_type type;
drivers/gpu/drm/radeon/radeon_atombios.c +26 -11
@@ -1549,7 +1549,7 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev) rdev->pm.power_state[state_index].clock_info[0 ].voltage.vddc_id = power_info->info.asPowerPlayInfo[i].ucVoltageDropIndex; } - rdev->pm.power_state[state_index].flags =RADEON_PM_SINGLE_DISPLAY_ONLY ; + rdev->pm.power_state[state_index].flags =RADEON_PM_STATE_SINGLE_DISPLAY_ONLY ; rdev->pm.power_state[state_index].misc = misc;/* order matters! */ if (misc &ATOM_PM_MISCINFO_POWER_SAVING_MODE )
@@ -1568,7 +1568,7 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev) rdev->pm.power_state[state_index].type =POWER_STATE_TYPE_PERFORMANCE ; rdev->pm.power_state[state_index].flags &= - ~RADEON_PM_SINGLE_DISPLAY_ONLY ; + ~RADEON_PM_STATE_SINGLE_DISPLAY_ONLY ; }if (misc &ATOM_PM_MISCINFO_DRIVER_DEFAULT_MODE ) { rdev->pm.power_state[state_index].type =
@@ -1577,7 +1577,10 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev) rdev->pm.power_state[state_index].default_clock_mode = &rdev->pm.power_state[state_index].clock_info[0 ]; rdev->pm.power_state[state_index].flags &= - ~RADEON_PM_SINGLE_DISPLAY_ONLY ; + ~RADEON_PM_STATE_SINGLE_DISPLAY_ONLY ; + }else if (state_index ==0 ) { + rdev->pm.power_state[state_index].clock_info[0 ].flags |= +RADEON_PM_MODE_NO_DISPLAY ; } state_index++;break ;
@@ -1613,7 +1616,7 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev) rdev->pm.power_state[state_index].clock_info[0 ].voltage.vddc_id = power_info->info_2.asPowerPlayInfo[i].ucVoltageDropIndex; } - rdev->pm.power_state[state_index].flags =RADEON_PM_SINGLE_DISPLAY_ONLY ; + rdev->pm.power_state[state_index].flags =RADEON_PM_STATE_SINGLE_DISPLAY_ONLY ; rdev->pm.power_state[state_index].misc = misc; rdev->pm.power_state[state_index].misc2 = misc2;/* order matters! */
@@ -1633,14 +1636,14 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev) rdev->pm.power_state[state_index].type =POWER_STATE_TYPE_PERFORMANCE ; rdev->pm.power_state[state_index].flags &= - ~RADEON_PM_SINGLE_DISPLAY_ONLY ; + ~RADEON_PM_STATE_SINGLE_DISPLAY_ONLY ; }if (misc2 &ATOM_PM_MISCINFO2_SYSTEM_AC_LITE_MODE ) rdev->pm.power_state[state_index].type =POWER_STATE_TYPE_BALANCED ;if (misc2 &ATOM_PM_MISCINFO2_MULTI_DISPLAY_SUPPORT ) rdev->pm.power_state[state_index].flags &= - ~RADEON_PM_SINGLE_DISPLAY_ONLY ; + ~RADEON_PM_STATE_SINGLE_DISPLAY_ONLY ;if (misc &ATOM_PM_MISCINFO_DRIVER_DEFAULT_MODE ) { rdev->pm.power_state[state_index].type =POWER_STATE_TYPE_DEFAULT ;
@@ -1648,7 +1651,10 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev) rdev->pm.power_state[state_index].default_clock_mode = &rdev->pm.power_state[state_index].clock_info[0 ]; rdev->pm.power_state[state_index].flags &= - ~RADEON_PM_SINGLE_DISPLAY_ONLY ; + ~RADEON_PM_STATE_SINGLE_DISPLAY_ONLY ; + }else if (state_index ==0 ) { + rdev->pm.power_state[state_index].clock_info[0 ].flags |= +RADEON_PM_MODE_NO_DISPLAY ; } state_index++;break ;
@@ -1690,7 +1696,7 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev) power_info->info_3.asPowerPlayInfo[i].ucVDDCI_VoltageDropIndex; } } - rdev->pm.power_state[state_index].flags =RADEON_PM_SINGLE_DISPLAY_ONLY ; + rdev->pm.power_state[state_index].flags =RADEON_PM_STATE_SINGLE_DISPLAY_ONLY ; rdev->pm.power_state[state_index].misc = misc; rdev->pm.power_state[state_index].misc2 = misc2;/* order matters! */
@@ -1710,7 +1716,7 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev) rdev->pm.power_state[state_index].type =POWER_STATE_TYPE_PERFORMANCE ; rdev->pm.power_state[state_index].flags &= - ~RADEON_PM_SINGLE_DISPLAY_ONLY ; + ~RADEON_PM_STATE_SINGLE_DISPLAY_ONLY ; }if (misc2 &ATOM_PM_MISCINFO2_SYSTEM_AC_LITE_MODE ) rdev->pm.power_state[state_index].type =
@@ -1721,6 +1727,9 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev) rdev->pm.default_power_state_index = state_index; rdev->pm.power_state[state_index].default_clock_mode = &rdev->pm.power_state[state_index].clock_info[0 ]; + }else if (state_index ==0 ) { + rdev->pm.power_state[state_index].clock_info[0 ].flags |= +RADEON_PM_MODE_NO_DISPLAY ; } state_index++;break ;
@@ -1734,7 +1743,7 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev) rdev->pm.power_state[state_index -1 ].default_clock_mode = &rdev->pm.power_state[state_index -1 ].clock_info[0 ]; rdev->pm.power_state[state_index].flags &= - ~RADEON_PM_SINGLE_DISPLAY_ONLY ; + ~RADEON_PM_STATE_SINGLE_DISPLAY_ONLY ; rdev->pm.power_state[state_index].misc =0 ; rdev->pm.power_state[state_index].misc2 =0 ; }
@@ -1881,7 +1890,7 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev) rdev->pm.power_state[state_index].flags =0 ;if (misc &ATOM_PPLIB_SINGLE_DISPLAY_ONLY ) rdev->pm.power_state[state_index].flags |= -RADEON_PM_SINGLE_DISPLAY_ONLY ; +RADEON_PM_STATE_SINGLE_DISPLAY_ONLY ;if (misc2 &ATOM_PPLIB_CLASSIFICATION_BOOT ) { rdev->pm.power_state[state_index].type =POWER_STATE_TYPE_DEFAULT ;
@@ -1892,6 +1901,12 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev) state_index++; } } +/* if multiple clock modes, mark the lowest as no display */ +for (i =0 ; i < state_index; i++) { +if (rdev->pm.power_state[i].num_clock_modes >1 ) + rdev->pm.power_state[i].clock_info[0 ].flags |= +RADEON_PM_MODE_NO_DISPLAY ; + }/* first mode is usually default */ if (rdev->pm.default_power_state_index ==-1 ) { rdev->pm.power_state[0].type =
drivers/gpu/drm/radeon/radeon_combios.c +1 -1
@@ -2435,7 +2435,7 @@ void radeon_combios_get_power_modes(struct radeon_device *rdev)if (rev >6 ) rdev->pm.power_state[state_index].pcie_lanes =RBIOS8 (offset +0x5 +0x10 ); - rdev->pm.power_state[state_index].flags =RADEON_PM_SINGLE_DISPLAY_ONLY ; + rdev->pm.power_state[state_index].flags =RADEON_PM_STATE_SINGLE_DISPLAY_ONLY ; state_index++; }else {/* XXX figure out some good default low power mode for mobility cards w/out power tables */
drivers/gpu/drm/radeon/radeon_legacy_crtc.c +5 -4
@@ -314,6 +314,9 @@ void radeon_crtc_dpms(struct drm_crtc *crtc, int mode)switch (mode) {case DRM_MODE_DPMS_ON : + radeon_crtc->enabled = true; +/* adjust pm to dpms changes BEFORE enabling crtcs */ +radeon_pm_compute_clocks (rdev);if (radeon_crtc->crtc_id)WREG32_P (RADEON_CRTC2_GEN_CNTL ,RADEON_CRTC2_EN , ~(RADEON_CRTC2_EN | mask));else {
@@ -323,7 +326,6 @@ void radeon_crtc_dpms(struct drm_crtc *crtc, int mode) }drm_vblank_post_modeset (dev, radeon_crtc->crtc_id);radeon_crtc_load_lut (crtc); - radeon_crtc->enabled = true;break ;case DRM_MODE_DPMS_STANDBY :case DRM_MODE_DPMS_SUSPEND :
@@ -337,11 +339,10 @@ void radeon_crtc_dpms(struct drm_crtc *crtc, int mode)WREG32_P (RADEON_CRTC_EXT_CNTL , mask, ~mask); } radeon_crtc->enabled = false; +/* adjust pm to dpms changes AFTER disabling crtcs */ +radeon_pm_compute_clocks (rdev);break ; } - -/* adjust pm to dpms change */ -radeon_pm_compute_clocks (rdev); } int radeon_crtc_set_base(struct drm_crtc *crtc, int x, int y,
drivers/gpu/drm/radeon/radeon_pm.c +26 -12
@@ -58,7 +58,7 @@ static void radeon_pm_set_clocks(struct radeon_device *rdev, int static_switch) {int i; -if (!static_switch) +if (rdev->pm.state !=PM_STATE_DISABLED )radeon_get_power_state (rdev, rdev->pm.planned_action);mutex_lock (&rdev->ddev->struct_mutex);
@@ -147,8 +147,11 @@ static ssize_t radeon_set_power_state_static(struct device *dev,mutex_lock (&rdev->pm.mutex);if ((ps >=0 ) && (ps < rdev->pm.num_power_states) && (cm >=0 ) && (cm < rdev->pm.power_state[ps].num_clock_modes)) { -if ((rdev->pm.active_crtc_count >1 ) && - (rdev->pm.power_state[ps].flags &RADEON_PM_SINGLE_DISPLAY_ONLY )) { +if ((rdev->pm.active_crtc_count >0 ) && + (rdev->pm.power_state[ps].clock_info[cm].flags &RADEON_PM_MODE_NO_DISPLAY )) { +DRM_ERROR ("Invalid power state for display: %d.%d\n" , ps, cm); + }else if ((rdev->pm.active_crtc_count >1 ) && + (rdev->pm.power_state[ps].flags &RADEON_PM_STATE_SINGLE_DISPLAY_ONLY )) {DRM_ERROR ("Invalid power state for multi-head: %d.%d\n" , ps, cm); }else {/* disable dynpm */
@@ -248,7 +251,7 @@ static void radeon_print_power_mode_info(struct radeon_device *rdev) is_default ? "(default)" : "");if ((rdev->flags &RADEON_IS_PCIE ) && !(rdev->flags &RADEON_IS_IGP ))DRM_INFO ("\t%d PCIE Lanes\n" , rdev->pm.power_state[i].pcie_lanes); -if (rdev->pm.power_state[i].flags &RADEON_PM_SINGLE_DISPLAY_ONLY ) +if (rdev->pm.power_state[i].flags &RADEON_PM_STATE_SINGLE_DISPLAY_ONLY )DRM_INFO ("\tSingle display only\n" );DRM_INFO ("\t%d Clock Mode(s)\n" , rdev->pm.power_state[i].num_clock_modes);for (j =0 ; j < rdev->pm.power_state[i].num_clock_modes; j++) {
@@ -261,6 +264,8 @@ static void radeon_print_power_mode_info(struct radeon_device *rdev) j, rdev->pm.power_state[i].clock_info[j].sclk *10 , rdev->pm.power_state[i].clock_info[j].mclk * 10); +if (rdev->pm.power_state[i].clock_info[j].flags &RADEON_PM_MODE_NO_DISPLAY ) +DRM_INFO ("\t\tNo display only\n" ); } } }
@@ -318,7 +323,7 @@ void radeon_pm_fini(struct radeon_device *rdev)/* reset default clocks */ rdev->pm.state =PM_STATE_DISABLED ; rdev->pm.planned_action =PM_ACTION_DEFAULT ; -radeon_pm_set_clocks (rdev, false); +radeon_pm_set_clocks (rdev, true); }else if ((rdev->pm.current_power_state_index != rdev->pm.default_power_state_index) || (rdev->pm.current_clock_mode_index !=0 )) {
@@ -342,9 +347,6 @@ void radeon_pm_compute_clocks(struct radeon_device *rdev)struct drm_crtc *crtc;struct radeon_crtc *radeon_crtc; -if (rdev->pm.state ==PM_STATE_DISABLED ) -return ; -mutex_lock (&rdev->pm.mutex); rdev->pm.active_crtcs =0 ;
@@ -358,13 +360,22 @@ void radeon_pm_compute_clocks(struct radeon_device *rdev) } } +if (rdev->pm.state ==PM_STATE_DISABLED ) { +mutex_unlock (&rdev->pm.mutex); +return ; + } + +/* Note, radeon_pm_set_clocks is called with static_switch set +* to true since we always want to statically set the clocks, +* not wait for vbl. +*/ if (rdev->pm.active_crtc_count >1 ) {if (rdev->pm.state ==PM_STATE_ACTIVE ) {cancel_delayed_work (&rdev->pm.idle_work); rdev->pm.state =PM_STATE_PAUSED ; - rdev->pm.planned_action =PM_ACTION_UPCLOCK ; -radeon_pm_set_clocks (rdev, false); + rdev->pm.planned_action =PM_ACTION_DEFAULT ; +radeon_pm_set_clocks (rdev, true);DRM_DEBUG ("radeon: dynamic power management deactivated\n" ); }
@@ -374,7 +385,7 @@ void radeon_pm_compute_clocks(struct radeon_device *rdev)if (rdev->pm.state ==PM_STATE_MINIMUM ) { rdev->pm.state =PM_STATE_ACTIVE ; rdev->pm.planned_action =PM_ACTION_UPCLOCK ; -radeon_pm_set_clocks (rdev, false); +radeon_pm_set_clocks (rdev, true);queue_delayed_work (rdev->wq, &rdev->pm.idle_work,msecs_to_jiffies (RADEON_IDLE_LOOP_MS ));
@@ -390,7 +401,7 @@ void radeon_pm_compute_clocks(struct radeon_device *rdev) rdev->pm.state =PM_STATE_MINIMUM ; rdev->pm.planned_action =PM_ACTION_MINIMUM ; -radeon_pm_set_clocks (rdev, false); +radeon_pm_set_clocks (rdev, true); } }
@@ -526,6 +537,9 @@ static void radeon_pm_idle_work_handler(struct work_struct *work) } } +/* Note, radeon_pm_set_clocks is called with static_switch set +* to false since we want to wait for vbl to avoid flicker. +*/ if (rdev->pm.planned_action !=PM_ACTION_NONE && jiffies > rdev->pm.action_timeout) {radeon_pm_set_clocks (rdev, false);
Signature · 1 line
1.5.6.3
PATCH 8/9 drm/radeon/kms/pm: rework power management
- Separate dynpm and profile based power management methods. You can select the pm method by echoing the selected method ("dynpm" or "profile") to power_method in sysfs.
- Expose basic 4 profile in profile method
"default" - default clocks
"auto" - select between low and high based on ac/dc state
"low" - DC, low power mode
"high" - AC, performance mode
The current base profile is "default", but it should switched to "auto" once we've tested on more systems. Switching the state is a matter of echoing the requested profile to power_profile in sysfs. The lowest power states are selected automatically when dpms turns the monitors off in all states but default.
- Remove dynamic fence-based reclocking for the moment. We can revisit this later once we have basic pm in.
- Move pm init/fini to modesetting path. pm is tightly coupled with display state. Make sure display side is initialized before pm.
- Add pm suspend/resume functions to make sure pm state is properly reinitialized on resume.
- Remove dynpm module option. It's now selectable via sysfs.
--- drivers/gpu/drm/radeon/Kconfig | 1 + drivers/gpu/drm/radeon/evergreen.c | 3 - drivers/gpu/drm/radeon/r100.c | 128 ++----- drivers/gpu/drm/radeon/r300.c | 3 - drivers/gpu/drm/radeon/r420.c | 32 ++- drivers/gpu/drm/radeon/r520.c | 2 - drivers/gpu/drm/radeon/r600.c | 332 ++++++++++++----- drivers/gpu/drm/radeon/radeon.h | 87 +++-- drivers/gpu/drm/radeon/radeon_asic.c | 56 ++-- drivers/gpu/drm/radeon/radeon_asic.h | 12 +- drivers/gpu/drm/radeon/radeon_device.c | 2 + drivers/gpu/drm/radeon/radeon_display.c | 4 + drivers/gpu/drm/radeon/radeon_drv.c | 4 - drivers/gpu/drm/radeon/radeon_pm.c | 628 +++++++++++++++++++------------ drivers/gpu/drm/radeon/rs400.c | 3 - drivers/gpu/drm/radeon/rs600.c | 3 - drivers/gpu/drm/radeon/rs690.c | 3 - drivers/gpu/drm/radeon/rv515.c | 3 - drivers/gpu/drm/radeon/rv770.c | 3 - 19 files changed, 790 insertions(+), 519 deletions(-)
drivers/gpu/drm/radeon/Kconfig +1 -0
@@ -1,6 +1,7 @@ config DRM_RADEON_KMS bool "Enable modesetting on radeon by default - NEW DRIVER" depends on DRM_RADEON + depends on POWER_SUPPLY help Choose this option if you want kernel modesetting enabled by default.
drivers/gpu/drm/radeon/evergreen.c +0 -3
@@ -2115,8 +2115,6 @@ int evergreen_init(struct radeon_device *rdev) r =radeon_clocks_init (rdev);if (r)return r; -/* Initialize power management */ -radeon_pm_init (rdev);/* Fence driver */ r =radeon_fence_driver_init (rdev);if (r)
@@ -2178,7 +2176,6 @@ int evergreen_init(struct radeon_device *rdev)void evergreen_fini (struct radeon_device *rdev) { -radeon_pm_fini (rdev);/*r600_blit_fini(rdev);*/ r700_cp_fini (rdev);r600_wb_fini (rdev);
drivers/gpu/drm/radeon/r100.c +40 -88
175 lines not on this page · raw message
drivers/gpu/drm/radeon/r300.c +0 -3
@@ -1345,7 +1345,6 @@ int r300_suspend(struct radeon_device *rdev)void r300_fini (struct radeon_device *rdev) { -radeon_pm_fini (rdev);r100_cp_fini (rdev);r100_wb_fini (rdev);r100_ib_fini (rdev);
@@ -1401,8 +1400,6 @@ int r300_init(struct radeon_device *rdev)r300_errata (rdev);/* Initialize clocks */ radeon_get_clock_info (rdev->ddev); -/* Initialize power management */ -radeon_pm_init (rdev);/* initialize AGP */ if (rdev->flags &RADEON_IS_AGP ) { r =radeon_agp_init (rdev);
drivers/gpu/drm/radeon/r420.c +29 -3
@@ -36,6 +36,35 @@#include "r420d.h" #include "r420_reg_safe.h" +void r420_pm_init_profile (struct radeon_device *rdev) +{ +/* default */ + rdev->pm.profiles[PM_PROFILE_DEFAULT_IDX ].dpms_off_ps_idx = rdev->pm.default_power_state_index; + rdev->pm.profiles[PM_PROFILE_DEFAULT_IDX ].dpms_on_ps_idx = rdev->pm.default_power_state_index; + rdev->pm.profiles[PM_PROFILE_DEFAULT_IDX ].dpms_off_cm_idx =0 ; + rdev->pm.profiles[PM_PROFILE_DEFAULT_IDX ].dpms_on_cm_idx =0 ; +/* low sh */ + rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX ].dpms_off_ps_idx =0 ; + rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX ].dpms_on_ps_idx =1 ; + rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX ].dpms_off_cm_idx =0 ; + rdev->pm.profiles[PM_PROFILE_LOW_SH_IDX ].dpms_on_cm_idx =0 ; +/* high sh */ + rdev->pm.profiles[PM_PROFILE_HIGH_SH_IDX ].dpms_off_ps_idx =0 ; + rdev->pm.profiles[PM_PROFILE_HIGH_SH_IDX ].dpms_on_ps_idx = rdev->pm.default_power_state_index; + rdev->pm.profiles[PM_PROFILE_HIGH_SH_IDX ].dpms_off_cm_idx =0 ; + rdev->pm.profiles[PM_PROFILE_HIGH_SH_IDX ].dpms_on_cm_idx =0 ; +/* low mh */ + rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX ].dpms_off_ps_idx =0 ; + rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX ].dpms_on_ps_idx = rdev->pm.default_power_state_index; + rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX ].dpms_off_cm_idx =0 ; + rdev->pm.profiles[PM_PROFILE_LOW_MH_IDX ].dpms_on_cm_idx =0 ; +/* high mh */ + rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX ].dpms_off_ps_idx =0 ; + rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX ].dpms_on_ps_idx = rdev->pm.default_power_state_index; + rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX ].dpms_off_cm_idx =0 ; + rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX ].dpms_on_cm_idx =0 ; +} +static void r420_set_reg_safe (struct radeon_device *rdev) { rdev->config.r300.reg_safe_bm = r420_reg_safe_bm;
@@ -268,7 +297,6 @@ int r420_suspend(struct radeon_device *rdev)void r420_fini (struct radeon_device *rdev) { -radeon_pm_fini (rdev);r100_cp_fini (rdev);r100_wb_fini (rdev);r100_ib_fini (rdev);
@@ -328,8 +356,6 @@ int r420_init(struct radeon_device *rdev)/* Initialize clocks */ radeon_get_clock_info (rdev->ddev); -/* Initialize power management */ -radeon_pm_init (rdev);/* initialize AGP */ if (rdev->flags &RADEON_IS_AGP ) { r =radeon_agp_init (rdev);
drivers/gpu/drm/radeon/r520.c +0 -2
@@ -261,8 +261,6 @@ int r520_init(struct radeon_device *rdev) }/* Initialize clocks */ radeon_get_clock_info (rdev->ddev); -/* Initialize power management */ -radeon_pm_init (rdev);/* initialize AGP */ if (rdev->flags &RADEON_IS_AGP ) { r =radeon_agp_init (rdev);
drivers/gpu/drm/radeon/r600.c +240 -92
428 lines not on this page · raw message
drivers/gpu/drm/radeon/radeon.h +57 -30
150 lines not on this page · raw message
drivers/gpu/drm/radeon/radeon_asic.c +28 -28
182 lines not on this page · raw message
drivers/gpu/drm/radeon/radeon_asic.h +6 -6
@@ -127,12 +127,11 @@ void r100_enable_bm(struct radeon_device *rdev);void r100_set_common_regs (struct radeon_device *rdev);void r100_bm_disable (struct radeon_device *rdev);extern bool r100_gui_idle (struct radeon_device *rdev); -extern void r100_set_power_state (struct radeon_device *rdev,bool static_switch); -extern void r100_get_power_state (struct radeon_device *rdev, -enum radeon_pm_action action);extern void r100_pm_misc (struct radeon_device *rdev);extern void r100_pm_prepare (struct radeon_device *rdev);extern void r100_pm_finish (struct radeon_device *rdev); +extern void r100_pm_init_profile (struct radeon_device *rdev); +extern void r100_pm_get_dynpm_state (struct radeon_device *rdev);/* * r200,rv250,rs300,rv280
@@ -170,6 +169,7 @@ extern int r420_init(struct radeon_device *rdev);extern void r420_fini (struct radeon_device *rdev);extern int r420_suspend (struct radeon_device *rdev);extern int r420_resume (struct radeon_device *rdev); +extern void r420_pm_init_profile (struct radeon_device *rdev);/* * rs400,rs480
@@ -281,10 +281,10 @@ void r600_hpd_set_polarity(struct radeon_device *rdev, enum radeon_hpd_id hpd);extern void r600_ioctl_wait_idle (struct radeon_device *rdev,struct radeon_bo *bo);extern bool r600_gui_idle (struct radeon_device *rdev); -extern void r600_set_power_state (struct radeon_device *rdev,bool static_switch); -extern void r600_get_power_state (struct radeon_device *rdev, -enum radeon_pm_action action);extern void r600_pm_misc (struct radeon_device *rdev); +extern void r600_pm_init_profile (struct radeon_device *rdev); +extern void rs780_pm_init_profile (struct radeon_device *rdev); +extern void r600_pm_get_dynpm_state (struct radeon_device *rdev);/* * rv770,rv730,rv710,rv740
drivers/gpu/drm/radeon/radeon_device.c +2 -0
@@ -748,6 +748,7 @@ int radeon_suspend_kms(struct drm_device *dev, pm_message_t state)radeon_save_bios_scratch_regs (rdev); +radeon_pm_suspend (rdev);radeon_suspend (rdev);radeon_hpd_fini (rdev);/* evict remaining vram memory */
@@ -783,6 +784,7 @@ int radeon_resume_kms(struct drm_device *dev)/* resume AGP if in use */ radeon_agp_resume (rdev);radeon_resume (rdev); +radeon_pm_resume (rdev);radeon_restore_bios_scratch_regs (rdev);radeon_fbdev_set_suspend (rdev,0 );release_console_sem ();
drivers/gpu/drm/radeon/radeon_display.c +4 -0
@@ -1030,6 +1030,9 @@ int radeon_modeset_init(struct radeon_device *rdev)/* initialize hpd */ radeon_hpd_init (rdev); +/* Initialize power management */ +radeon_pm_init (rdev); +radeon_fbdev_init (rdev);return 0 ; }
@@ -1038,6 +1041,7 @@ void radeon_modeset_fini(struct radeon_device *rdev) {radeon_fbdev_fini (rdev);kfree (rdev->mode_info.bios_hardcoded_edid); +radeon_pm_fini (rdev);if (rdev->mode_info.mode_config_initialized) {radeon_hpd_fini (rdev);
drivers/gpu/drm/radeon/radeon_drv.c +0 -4
@@ -91,7 +91,6 @@ int radeon_testing = 0;int radeon_connector_table =0 ;int radeon_tv =1 ;int radeon_new_pll =-1 ; -int radeon_dynpm =-1 ;int radeon_audio =1 ;int radeon_disp_priority =0 ;int radeon_hw_i2c =0 ;
@@ -132,9 +131,6 @@ module_param_named(tv, radeon_tv, int, 0444);MODULE_PARM_DESC (new_pll,"Select new PLL code" );module_param_named (new_pll, radeon_new_pll, int,0444 ); -MODULE_PARM_DESC (dynpm,"Disable/Enable dynamic power management (1 = enable)" ); -module_param_named (dynpm, radeon_dynpm, int,0444 ); -MODULE_PARM_DESC (audio,"Audio enable (0 = disable)" );module_param_named (audio, radeon_audio, int,0444 );
drivers/gpu/drm/radeon/radeon_pm.c +383 -245
804 lines not on this page · raw message
drivers/gpu/drm/radeon/rs400.c +0 -3
@@ -456,7 +456,6 @@ int rs400_suspend(struct radeon_device *rdev)void rs400_fini (struct radeon_device *rdev) { -radeon_pm_fini (rdev);r100_cp_fini (rdev);r100_wb_fini (rdev);r100_ib_fini (rdev);
@@ -507,8 +506,6 @@ int rs400_init(struct radeon_device *rdev)/* Initialize clocks */ radeon_get_clock_info (rdev->ddev); -/* Initialize power management */ -radeon_pm_init (rdev);/* initialize memory controller */ rs400_mc_init (rdev);/* Fence driver */
drivers/gpu/drm/radeon/rs600.c +0 -3
@@ -846,7 +846,6 @@ int rs600_suspend(struct radeon_device *rdev)void rs600_fini (struct radeon_device *rdev) { -radeon_pm_fini (rdev);r100_cp_fini (rdev);r100_wb_fini (rdev);r100_ib_fini (rdev);
@@ -896,8 +895,6 @@ int rs600_init(struct radeon_device *rdev)/* Initialize clocks */ radeon_get_clock_info (rdev->ddev); -/* Initialize power management */ -radeon_pm_init (rdev);/* initialize memory controller */ rs600_mc_init (rdev);rs600_debugfs (rdev);
drivers/gpu/drm/radeon/rs690.c +0 -3
@@ -676,7 +676,6 @@ int rs690_suspend(struct radeon_device *rdev)void rs690_fini (struct radeon_device *rdev) { -radeon_pm_fini (rdev);r100_cp_fini (rdev);r100_wb_fini (rdev);r100_ib_fini (rdev);
@@ -727,8 +726,6 @@ int rs690_init(struct radeon_device *rdev)/* Initialize clocks */ radeon_get_clock_info (rdev->ddev); -/* Initialize power management */ -radeon_pm_init (rdev);/* initialize memory controller */ rs690_mc_init (rdev);rv515_debugfs (rdev);
drivers/gpu/drm/radeon/rv515.c +0 -3
@@ -445,7 +445,6 @@ void rv515_set_safe_registers(struct radeon_device *rdev)void rv515_fini (struct radeon_device *rdev) { -radeon_pm_fini (rdev);r100_cp_fini (rdev);r100_wb_fini (rdev);r100_ib_fini (rdev);
@@ -494,8 +493,6 @@ int rv515_init(struct radeon_device *rdev)return -EINVAL ;/* Initialize clocks */ radeon_get_clock_info (rdev->ddev); -/* Initialize power management */ -radeon_pm_init (rdev);/* initialize AGP */ if (rdev->flags &RADEON_IS_AGP ) { r =radeon_agp_init (rdev);
drivers/gpu/drm/radeon/rv770.c +0 -3
@@ -1091,8 +1091,6 @@ int rv770_init(struct radeon_device *rdev) r =radeon_clocks_init (rdev);if (r)return r; -/* Initialize power management */ -radeon_pm_init (rdev);/* Fence driver */ r =radeon_fence_driver_init (rdev);if (r)
@@ -1161,7 +1159,6 @@ int rv770_init(struct radeon_device *rdev)void rv770_fini (struct radeon_device *rdev) { -radeon_pm_fini (rdev);r600_blit_fini (rdev);r700_cp_fini (rdev);r600_wb_fini (rdev);
Signature · 1 line
1.5.6.3
PATCH 9/9 drm/radeon/kms/pm: make pm spam debug only
--- drivers/gpu/drm/radeon/r100.c | 16 ++++++++-------- drivers/gpu/drm/radeon/r600.c | 14 +++++++------- drivers/gpu/drm/radeon/radeon_pm.c | 16 ++++++++-------- drivers/gpu/drm/radeon/rs600.c | 2 +- 4 files changed, 24 insertions(+), 24 deletions(-)
drivers/gpu/drm/radeon/r100.c +8 -8
@@ -141,13 +141,13 @@ void r100_pm_get_dynpm_state(struct radeon_device *rdev)/* only one clock mode per power state */ rdev->pm.requested_clock_mode_index =0 ; -DRM_INFO ("Requested: e: %d m: %d p: %d\n" , - rdev->pm.power_state[rdev->pm.requested_power_state_index]. - clock_info[rdev->pm.requested_clock_mode_index].sclk, - rdev->pm.power_state[rdev->pm.requested_power_state_index]. - clock_info[rdev->pm.requested_clock_mode_index].mclk, - rdev->pm.power_state[rdev->pm.requested_power_state_index]. - pcie_lanes); +DRM_DEBUG ("Requested: e: %d m: %d p: %d\n" , + rdev->pm.power_state[rdev->pm.requested_power_state_index]. + clock_info[rdev->pm.requested_clock_mode_index].sclk, + rdev->pm.power_state[rdev->pm.requested_power_state_index]. + clock_info[rdev->pm.requested_clock_mode_index].mclk, + rdev->pm.power_state[rdev->pm.requested_power_state_index]. + pcie_lanes); }void r100_pm_init_profile (struct radeon_device *rdev)
@@ -266,7 +266,7 @@ void r100_pm_misc(struct radeon_device *rdev) rdev->pm.power_state[rdev->pm.current_power_state_index].pcie_lanes)) {radeon_set_pcie_lanes (rdev, ps->pcie_lanes); -DRM_INFO ("Setting: p: %d\n" , ps->pcie_lanes); +DRM_DEBUG ("Setting: p: %d\n" , ps->pcie_lanes); } }
drivers/gpu/drm/radeon/r600.c +7 -7
@@ -251,13 +251,13 @@ void r600_pm_get_dynpm_state(struct radeon_device *rdev) } } -DRM_INFO ("Requested: e: %d m: %d p: %d\n" , - rdev->pm.power_state[rdev->pm.requested_power_state_index]. - clock_info[rdev->pm.requested_clock_mode_index].sclk, - rdev->pm.power_state[rdev->pm.requested_power_state_index]. - clock_info[rdev->pm.requested_clock_mode_index].mclk, - rdev->pm.power_state[rdev->pm.requested_power_state_index]. - pcie_lanes); +DRM_DEBUG ("Requested: e: %d m: %d p: %d\n" , + rdev->pm.power_state[rdev->pm.requested_power_state_index]. + clock_info[rdev->pm.requested_clock_mode_index].sclk, + rdev->pm.power_state[rdev->pm.requested_power_state_index]. + clock_info[rdev->pm.requested_clock_mode_index].mclk, + rdev->pm.power_state[rdev->pm.requested_power_state_index]. + pcie_lanes); } static int r600_pm_get_type_index(struct radeon_device *rdev,
drivers/gpu/drm/radeon/radeon_pm.c +8 -8
@@ -52,9 +52,9 @@ static int radeon_acpi_event(struct notifier_block *nb,if (strcmp (entry->device_class,ACPI_AC_CLASS ) ==0 ) {if (power_supply_is_system_supplied () >0 ) -DRM_INFO ("pm: AC\n" ); +DRM_DEBUG ("pm: AC\n" );else -DRM_INFO ("pm: DC\n" ); +DRM_DEBUG ("pm: DC\n" );if (rdev->pm.pm_method ==PM_METHOD_PROFILE ) {if (rdev->pm.profile ==PM_PROFILE_AUTO ) {
@@ -183,7 +183,7 @@ static void radeon_set_power_state(struct radeon_device *rdev)radeon_set_engine_clock (rdev, sclk);radeon_pm_debug_check_in_vbl (rdev, true); rdev->pm.current_sclk = sclk; -DRM_INFO ("Setting: e: %d\n" , sclk); +DRM_DEBUG ("Setting: e: %d\n" , sclk); }/* set memory clock */
@@ -192,7 +192,7 @@ static void radeon_set_power_state(struct radeon_device *rdev)radeon_set_memory_clock (rdev, mclk);radeon_pm_debug_check_in_vbl (rdev, true); rdev->pm.current_mclk = mclk; -DRM_INFO ("Setting: m: %d\n" , mclk); +DRM_DEBUG ("Setting: m: %d\n" , mclk); }radeon_pm_finish (rdev); }else {
@@ -203,7 +203,7 @@ static void radeon_set_power_state(struct radeon_device *rdev)radeon_set_engine_clock (rdev, sclk);radeon_pm_finish (rdev); rdev->pm.current_sclk = sclk; -DRM_INFO ("Setting: e: %d\n" , sclk); +DRM_DEBUG ("Setting: e: %d\n" , sclk); }/* set memory clock */ if (rdev->asic->set_memory_clock && (mclk != rdev->pm.current_mclk)) {
@@ -212,14 +212,14 @@ static void radeon_set_power_state(struct radeon_device *rdev)radeon_set_memory_clock (rdev, mclk);radeon_pm_finish (rdev); rdev->pm.current_mclk = mclk; -DRM_INFO ("Setting: m: %d\n" , mclk); +DRM_DEBUG ("Setting: m: %d\n" , mclk); } } rdev->pm.current_power_state_index = rdev->pm.requested_power_state_index; rdev->pm.current_clock_mode_index = rdev->pm.requested_clock_mode_index; }else -DRM_INFO ("pm: GUI not idle!!!\n" ); +DRM_DEBUG ("pm: GUI not idle!!!\n" ); }static void radeon_pm_set_clocks (struct radeon_device *rdev)
@@ -624,7 +624,7 @@ static bool radeon_pm_debug_check_in_vbl(struct radeon_device *rdev, bool finishbool in_vbl =radeon_pm_in_vbl (rdev);if (in_vbl == false) -DRM_INFO ("not in vbl for pm change %08x at %s\n" , stat_crtc, +DRM_DEBUG ("not in vbl for pm change %08x at %s\n" , stat_crtc, finish ?"exit" :"entry" );return in_vbl; }
drivers/gpu/drm/radeon/rs600.c +1 -1
@@ -135,7 +135,7 @@ void rs600_pm_misc(struct radeon_device *rdev) rdev->pm.power_state[rdev->pm.current_power_state_index].pcie_lanes)) {radeon_set_pcie_lanes (rdev, ps->pcie_lanes); -DRM_INFO ("Setting: p: %d\n" , ps->pcie_lanes); +DRM_DEBUG ("Setting: p: %d\n" , ps->pcie_lanes); } }
Signature · 1 line
1.5.6.3
Quoted 3 lines · Alex Deucher
"auto" selects between low and high power states based on the whether the system is on battery power or not. Even lower power states are selected when the monitors are in the dpms off state.
Beyond the constraints imposed in terms of some modes not being available on battery, I'd prefer to leave the ac/battery decision up to userspace. Having it be default behaviour at the kernel level is plausibly confusing.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 10 lines · Matthew Garrett
Quoted 3 lines · Alex Deucher
"auto" selects between low and high power states based on the whether the system is on battery power or not. Even lower power states are selected when the monitors are in the dpms off state.
Beyond the constraints imposed in terms of some modes not being available on battery, I'd prefer to leave the ac/battery decision up to userspace. Having it be default behaviour at the kernel level is plausibly confusing.
Sounds fine. Just have userspace switch between the low and high profiles for battery and ac rather than using auto. auto is useful as a user option in the interim while userspace gets updated.
Alex
Quoted 12 lines · On Fri, 7 May 2010 17:16:11 -0400 Alex Deucher <[email protected]> wrote:
This set of patches applies on top of the code in drm-radeon-testing.
I've been testing this code pretty hard this week and it's been solid. In addition to some fixes on top of what's in d-r-t, it also reworks the pm code to support two basic methods:
1. "dynpm"
2. "profile"You can select the methods via sysfs. Echo "dynpm" or "profile" to
/sys/class/drm/card-0/device/power_method.
Quoted 7 lines
The "dynpm" method dynamically changes the clocks based on the number of pending fences, so performance is ramped up when running GPU intensive apps, and ramped down when the GPU is idle. The reclocking is attemped during vertical blanking periods, but due to the timing of the reclocking functions, doesn't not always complete in the blanking period, which can lead to flicker in the display. Due to this, dynpm only works when a single head is active.
Hi Alex,
I just built a new version of d-r-t with your patches from yesterday applied on top and wanted to share my experience with you and the list (Radeon 2600XT mobile):
Dynpm has gotten unusable for me as there's a noticeable effect on mouse movement (getting sluggish)
Quoted 9 lines
The "profile" method exposes 4 profiles that can be selected from:
1. "default"
2. "auto"
3. "low"
4. "high"
Select the profile by echoing the selected profile to/sys/class/drm/card-0/device/power_profile.
the profile setting works but I can't check which clock speeds are set as I don't get any feedback (dmesg) anymore (Someone have any input on this?). The temps are unaffected whether I use the low or high profile, the only way I can tell that some things are working is by a 2000 fps-difference when running glxgears (something like 4000 on low and 6000 on high). I also attached a wattmeter to my my machine and the wattage alternates but I think I'm getting something along the lines of a 10W decrease in power consumption - it's very hard to tell, though. dynpm is a bit more effective and I even get lower temps (just under 50° compared to over 53 with the profile settings) but it's unusable right now as I already mentioned.
All in all very nice work so far (this goes for all of you who've worked on radeon KMS PM!) - with the latest set of patches this is the first "revision" of KMS PM that actually "works" on my machine :)
Klaus
Signature · 9 lines
Klaus Doblmann B.A. - http://straightrazorguy.net - FSF member #7570 PGP-Key: http://www.doblmann.de/pgp_key.asc http://twitter.com/klausdoblmann A: Because it messes up the order in which people normally read text. See http://en.wikipedia.org/wiki/Posting_style Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail?
Quoted 54 lines · Klaus Doblmann B.A.
Quoted 12 lines · On Fri, 7 May 2010 17:16:11 -0400 Alex Deucher <[email protected]> wrote:
This set of patches applies on top of the code in drm-radeon-testing.
I've been testing this code pretty hard this week and it's been solid. In addition to some fixes on top of what's in d-r-t, it also reworks the pm code to support two basic methods:
1. "dynpm"
2. "profile"You can select the methods via sysfs. Echo "dynpm" or "profile" to
/sys/class/drm/card-0/device/power_method.Quoted 7 lines
The "dynpm" method dynamically changes the clocks based on the number of pending fences, so performance is ramped up when running GPU intensive apps, and ramped down when the GPU is idle. The reclocking is attemped during vertical blanking periods, but due to the timing of the reclocking functions, doesn't not always complete in the blanking period, which can lead to flicker in the display. Due to this, dynpm only works when a single head is active.
Hi Alex,
I just built a new version of d-r-t with your patches from yesterday applied on top and wanted to share my experience with you and the list (Radeon 2600XT mobile):
Dynpm has gotten unusable for me as there's a noticeable effect on mouse movement (getting sluggish)
Quoted 9 lines
The "profile" method exposes 4 profiles that can be selected from:
1. "default"
2. "auto"
3. "low"
4. "high"
Select the profile by echoing the selected profile to/sys/class/drm/card-0/device/power_profile.the profile setting works but I can't check which clock speeds are set as I don't get any feedback (dmesg) anymore (Someone have any input on this?). The temps are unaffected whether I use the low or high profile, the only way I can tell that some things are working is by a 2000 fps-difference when running glxgears (something like 4000 on low and 6000 on high). I also attached a wattmeter to my my machine and the wattage alternates but I think I'm getting something along the lines of a 10W decrease in power consumption - it's very hard to tell, though. dynpm is a bit more effective and I even get lower temps (just under 50° compared to over 53 with the profile settings) but it's unusable right now as I already mentioned.
Quoted 4 lines
All in all very nice work so far (this goes for all of you who've worked on radeon KMS PM!) - with the latest set of patches this is the first "revision" of KMS PM that actually "works" on my machine :)
Thanks for testing; we are definitely planning on further
improvements, this is just a step on the way. The power drops
further when your monitors go off so that will save additional power when your machine is idle. If you want to see the state transitions, revert this patch:
http://people.freedesktop.org/~agd5f/pm-drt/0009-drm-radeon-kms-pm-make-pm-spam-debug-only.patch
However, it will spam your kernel log.
Alex
Quoted 17 lines
Klaus
--
Klaus Doblmann B.A. - http://straightrazorguy.net - FSF member #7570
PGP-Key: http://www.doblmann.de/pgp_key.asc
http://twitter.com/klausdoblmannA: Because it messes up the order in which people normally read text. See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 28 lines · On Sat, 8 May 2010 11:29:10 -0400 Alex Deucher <[email protected]> wrote:
Quoted 12 lines · Klaus Doblmann B.A.
the profile setting works but I can't check which clock speeds are set as I don't get any feedback (dmesg) anymore (Someone have any input on this?). The temps are unaffected whether I use the low or high profile, the only way I can tell that some things are working is by a 2000 fps-difference when running glxgears (something like 4000 on low and 6000 on high). I also attached a wattmeter to my my machine and the wattage alternates but I think I'm getting something along the lines of a 10W decrease in power consumption - it's very hard to tell, though. dynpm is a bit more effective and I even get lower temps (just under 50° compared to over 53 with the profile settings) but it's unusable right now as I already mentioned.
Quoted 4 lines
All in all very nice work so far (this goes for all of you who've worked on radeon KMS PM!) - with the latest set of patches this is the first "revision" of KMS PM that actually "works" on my machine :)
Thanks for testing; we are definitely planning on further
improvements, this is just a step on the way. The power drops
further when your monitors go off so that will save additional power when your machine is idle. If you want to see the state transitions, revert this patch:
http://people.freedesktop.org/~agd5f/pm-drt/0009-drm-radeon-kms-pm-make-pm-spam-debug-only.patch
However, it will spam your kernel log.
Quoted 2 lines
Alex
Hi Alex,
thanks for the suggestion!
It seems I spoke a bit too soon about everything working. I suspended my machine and now came back after a few hours and it seems the latest patches (well, I only could test the pm code in linus' tree of -34 up to now due to display corruptions so there's a lot of changes since then) in d-r-t killed suspend for me
- the machine doesn't come back up and hardlocks. Too bad I can't find anything about it in my logs :(
Klaus
Signature · 9 lines
Klaus Doblmann B.A. - http://straightrazorguy.net - FSF member #7570 PGP-Key: http://www.doblmann.de/pgp_key.asc http://twitter.com/klausdoblmann A: Because it messes up the order in which people normally read text. See http://en.wikipedia.org/wiki/Posting_style Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail?
Quoted 7 lines · Alex Deucher
The "profile" method exposes 4 profiles that can be selected from:
1. "default"
2. "auto"
3. "low"
4. "high"
Select the profile by echoing the selected profile to/sys/class/drm/card-0/device/power_profile.
Testing on a rv670 desktop it seems that low does not force the card to low clock.
Before these patches went in I could force low by
echo 2.0 > /sys/class/drm/card0/device/power_state for 2 screens or echo 1.0 > /sys/class/drm/card0/device/power_state for one screen.
Though dmesg didn't always report setting it did work (using bench mark to verify) - I could also get dmesg to confirm by echo 2.0 echo 2.2 then echo 2.0.
Running current drt with the info -> debug patch reverted I can't get
echo low > /sys/class/drm/card0/device/power_profile
to lower the clock whatever I try - one screen, two screens forcing high then low etc. (nothing in dmesg and benchmark gives full clock results)
dynpm works as before and I do get low clock in dpms with profile.
One separate question - do I need to use the module param dynclks=1 or is it the default?
Quoted 22 lines · Andy Furniss
Quoted 7 lines · Alex Deucher
The "profile" method exposes 4 profiles that can be selected from:
1. "default"
2. "auto"
3. "low"
4. "high"
Select the profile by echoing the selected profile to/sys/class/drm/card-0/device/power_profile.Testing on a rv670 desktop it seems that low does not force the card to low clock.
Before these patches went in I could force low by
echo 2.0 >
/sys/class/drm/card0/device/power_statefor 2 screens or echo 1.0 >/sys/class/drm/card0/device/power_statefor one screen.Though dmesg didn't always report setting it did work (using bench mark to verify) - I could also get dmesg to confirm by echo 2.0 echo 2.2 then echo 2.0.
Quoted 7 lines
Running current drt with the info -> debug patch reverted I can't get
echo low > /sys/class/drm/card0/device/power_profile
to lower the clock whatever I try - one screen, two screens forcing high then low etc. (nothing in dmesg and benchmark gives full clock results)
Send me a copy of your vbios, I may need to adjust the profile table for rv670. As root:
cd /sys/bus/pci/devices/<pci bus id>
echo 1 > rom
cat rom > /tmp/vbios.rom
echo 0 > rom
Quoted 5 lines
dynpm works as before and I do get low clock in dpms with profile.
One separate question - do I need to use the module param dynclks=1 or is it the default?
The module parameter is obsolete. you can enable it dynamically via sysfs (power_method). The default pm method is profile.
Alex
Quoted 6 lines · Alex Deucher
Send me a copy of your vbios, I may need to adjust the profile table for rv670. As root:
cd /sys/bus/pci/devices/<pci bus id>
echo 1> rom
cat rom>/tmp/vbios.rom
echo 0> rom
Sent
Quoted 6 lines
Quoted 3 lines
One separate question - do I need to use the module param dynclks=1 or is it the default?
The module parameter is obsolete. you can enable it dynamically via sysfs (
power_method). The default pm method is profile.
OK, I know dynpm was removed - but this is dynclks are the two the same?
2010/5/10 Andy Furniss <[email protected]>:
Quoted 4 lines
Quoted 2 lines
The module parameter is obsolete. you can enable it dynamically via sysfs (
power_method). The default pm method is profile.OK, I know dynpm was removed - but this is dynclks are the two the same?
dynclks is for disabling clocking unused blocks. It means you don't provide clock signal to blocks and save some power. It was the case in older hardware, newer don't use that command anymore. I believe newer hardware handles that automatically.
Signature · 5 lines
Rafał _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel