From df50350ec56d648475e54c4205748a8f6c749648 Mon Sep 17 00:00:00 2001 From: Yuanhan Liu Date: Fri, 18 Mar 2011 11:13:20 +0800 Subject: [PATCH] Fix compute error while enable self-refresh mask & (mask - 1) == 0 to make sure we have only one bit set. use fls instead of ffs to find the right pipe. Signed-off-by: Yuanhan Liu --- drivers/gpu/drm/i915/intel_display.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 3106c0d..dc52dc1 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -3885,7 +3885,7 @@ static bool g4x_compute_srwm(struct drm_device *dev, static inline bool single_plane_enabled(unsigned int mask) { - return mask && (mask & -mask) == 0; + return mask && (mask & (mask - 1)) == 0; } static void g4x_update_wm(struct drm_device *dev) @@ -3910,7 +3910,7 @@ static void g4x_update_wm(struct drm_device *dev) plane_sr = cursor_sr = 0; if (single_plane_enabled(enabled) && - g4x_compute_srwm(dev, ffs(enabled) - 1, + g4x_compute_srwm(dev, fls(enabled) - 1, sr_latency_ns, &g4x_wm_info, &g4x_cursor_wm_info, @@ -4335,7 +4335,7 @@ static void ironlake_update_wm(struct drm_device *dev) if (!single_plane_enabled(enabled)) return; - enabled = ffs(enabled) - 1; + enabled = fls(enabled) - 1; /* WM1 */ if (!ironlake_compute_srwm(dev, 1, enabled, @@ -4421,7 +4421,7 @@ static void sandybridge_update_wm(struct drm_device *dev) if (!single_plane_enabled(enabled)) return; - enabled = ffs(enabled) - 1; + enabled = fls(enabled) - 1; /* WM1 */ if (!ironlake_compute_srwm(dev, 1, enabled, -- 1.7.4