All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH] Fix compute error while enable self-refresh
Date: Fri, 18 Mar 2011 11:18:21 +0800	[thread overview]
Message-ID: <1300418301-26092-1-git-send-email-yuanhan.liu@linux.intel.com> (raw)

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 <yuanhan.liu@linux.intel.com>
---
 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

                 reply	other threads:[~2011-03-18  3:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1300418301-26092-1-git-send-email-yuanhan.liu@linux.intel.com \
    --to=yuanhan.liu@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.