drm/radeon: add support for 3d perf states on older asics
authorAlex Deucher <alexander.deucher@amd.com>
Fri, 5 Jul 2013 15:48:31 +0000 (11:48 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 5 Jul 2013 22:09:02 +0000 (18:09 -0400)
Certain older rv770 asics have both a performance and
a 3D performance state rather than just multiple performance
levels in the state power state.  The current code would
select the performance state rather than the 3D performance
state when the "performance" profile was selected.  This change
switches to the "balanced" profile by default which ends up being
the internal performance profile.  When the user selects the
"performance" profile, it selects the internal 3D performance
state so the user can select the higher performance modes.

For most asics this changes nothing.  For certain rv770 asics
with static performance and 3D performance states, this allows
you to select between then using by selecting the "balanced"
and "performance" dpm profiles.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/radeon/radeon.h
drivers/gpu/drm/radeon/radeon_pm.c

index f51807f..08cecec 100644 (file)
@@ -1100,6 +1100,7 @@ enum radeon_pm_state_type {
        POWER_STATE_TYPE_INTERNAL_THERMAL,
        POWER_STATE_TYPE_INTERNAL_ACPI,
        POWER_STATE_TYPE_INTERNAL_ULV,
+       POWER_STATE_TYPE_INTERNAL_3DPERF,
 };
 
 enum radeon_pm_profile_type {
index c3e5e11..aaafb93 100644 (file)
@@ -586,11 +586,16 @@ static struct radeon_ps *radeon_dpm_pick_power_state(struct radeon_device *rdev,
        struct radeon_ps *ps;
        u32 ui_class;
 
-restart_search:
+       /* certain older asics have a separare 3D performance state,
+        * so try that first if the user selected performance
+        */
+       if (dpm_state == POWER_STATE_TYPE_PERFORMANCE)
+               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;
 
+restart_search:
        /* Pick the best power state based on current conditions */
        for (i = 0; i < rdev->pm.dpm.num_ps; i++) {
                ps = &rdev->pm.dpm.ps[i];
@@ -657,6 +662,10 @@ restart_search:
                        if (ps->class2 & ATOM_PPLIB_CLASSIFICATION2_ULV)
                                return ps;
                        break;
+               case POWER_STATE_TYPE_INTERNAL_3DPERF:
+                       if (ps->class & ATOM_PPLIB_CLASSIFICATION_3DPERFORMANCE)
+                               return ps;
+                       break;
                default:
                        break;
                }
@@ -675,6 +684,8 @@ restart_search:
                dpm_state = POWER_STATE_TYPE_BATTERY;
                goto restart_search;
        case POWER_STATE_TYPE_BATTERY:
+       case POWER_STATE_TYPE_BALANCED:
+       case POWER_STATE_TYPE_INTERNAL_3DPERF:
                dpm_state = POWER_STATE_TYPE_PERFORMANCE;
                goto restart_search;
        default:
@@ -1003,8 +1014,8 @@ static int radeon_pm_init_dpm(struct radeon_device *rdev)
        int ret;
 
        /* default to performance state */
-       rdev->pm.dpm.state = POWER_STATE_TYPE_PERFORMANCE;
-       rdev->pm.dpm.user_state = POWER_STATE_TYPE_PERFORMANCE;
+       rdev->pm.dpm.state = POWER_STATE_TYPE_BALANCED;
+       rdev->pm.dpm.user_state = POWER_STATE_TYPE_BALANCED;
        rdev->pm.default_sclk = rdev->clock.default_sclk;
        rdev->pm.default_mclk = rdev->clock.default_mclk;
        rdev->pm.current_sclk = rdev->clock.default_sclk;