summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2013-07-31 08:46:21 +1000
committerDave Airlie <airlied@redhat.com>2013-07-31 08:46:21 +1000
commitf34f516a8daa2517ac19916b88aff60e82d7e13d (patch)
treea9def5d5c9078047fb17a9fb5a81cff42aa4ea10 /include
parente9e3c8a20b2ac89a5770a6bb0a1d0dafc7f0edb0 (diff)
parent5a344dda944b4eea5a95e47a49ae5b53ce4f49b6 (diff)
downloadlinux-f34f516a8daa2517ac19916b88aff60e82d7e13d.tar.bz2
Merge branch 'drm-fixes-3.11' of git://people.freedesktop.org/~agd5f/linux
Alex writes: - more fixes for SI dpm - fix DP on some rv6xx boards * 'drm-fixes-3.11' of git://people.freedesktop.org/~agd5f/linux: drm/radeon/dpm: re-enable cac control on SI drm/radeon/dpm: fix calculations in si_calculate_leakage_for_v_and_t_formula drm: fix 64 bit drm fixed point helpers drm/radeon/atom: initialize more atom interpretor elements to 0
Diffstat (limited to 'include')
-rw-r--r--include/drm/drm_fixed.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/include/drm/drm_fixed.h b/include/drm/drm_fixed.h
index f5e1168c7647..d639049a613d 100644
--- a/include/drm/drm_fixed.h
+++ b/include/drm/drm_fixed.h
@@ -84,12 +84,12 @@ static inline int drm_fixp2int(int64_t a)
return ((s64)a) >> DRM_FIXED_POINT;
}
-static inline s64 drm_fixp_msbset(int64_t a)
+static inline unsigned drm_fixp_msbset(int64_t a)
{
unsigned shift, sign = (a >> 63) & 1;
for (shift = 62; shift > 0; --shift)
- if ((a >> shift) != sign)
+ if (((a >> shift) & 1) != sign)
return shift;
return 0;
@@ -100,9 +100,9 @@ static inline s64 drm_fixp_mul(s64 a, s64 b)
unsigned shift = drm_fixp_msbset(a) + drm_fixp_msbset(b);
s64 result;
- if (shift > 63) {
- shift = shift - 63;
- a >>= shift >> 1;
+ if (shift > 61) {
+ shift = shift - 61;
+ a >>= (shift >> 1) + (shift & 1);
b >>= shift >> 1;
} else
shift = 0;
@@ -120,7 +120,7 @@ static inline s64 drm_fixp_mul(s64 a, s64 b)
static inline s64 drm_fixp_div(s64 a, s64 b)
{
- unsigned shift = 63 - drm_fixp_msbset(a);
+ unsigned shift = 62 - drm_fixp_msbset(a);
s64 result;
a <<= shift;
@@ -154,7 +154,7 @@ static inline s64 drm_fixp_exp(s64 x)
}
if (x < 0)
- sum = drm_fixp_div(1, sum);
+ sum = drm_fixp_div(DRM_FIXED_ONE, sum);
return sum;
}