drm/radeon/kms/pm: bail early if nothing's changing
authorAlex Deucher <alexdeucher@gmail.com>
Fri, 13 Aug 2010 14:53:35 +0000 (10:53 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 26 Aug 2010 23:46:20 +0000 (16:46 -0700)
commit 4e186b2d6c878793587c35d7f06c94565d76e9b8 upstream.

If we aren't changing the power state, no need to take
locks and schedule fences, etc.

There seem to be lock ordering issues in the CP and
fence code in some cases; see bug 29140 below.

Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=29140
Possibly also:
https://bugzilla.kernel.org/show_bug.cgi?id=16581

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/gpu/drm/radeon/radeon_pm.c

index 3fa6984d9896094c3b0318ff486186c6cdf7ebdd..c91b741d5b4fafd145b54f2c73540913f5d6490e 100644 (file)
@@ -224,6 +224,11 @@ static void radeon_pm_set_clocks(struct radeon_device *rdev)
 {
        int i;
 
+       /* no need to take locks, etc. if nothing's going to change */
+       if ((rdev->pm.requested_clock_mode_index == rdev->pm.current_clock_mode_index) &&
+           (rdev->pm.requested_power_state_index == rdev->pm.current_power_state_index))
+               return;
+
        mutex_lock(&rdev->ddev->struct_mutex);
        mutex_lock(&rdev->vram_mutex);
        mutex_lock(&rdev->cp.mutex);