diff options
author | Maarten Maathuis <madman2003@gmail.com> | 2008-07-01 16:00:09 +0200 |
---|---|---|
committer | Maarten Maathuis <madman2003@gmail.com> | 2008-07-01 16:00:09 +0200 |
commit | 2b9c5719c09226a36a4a1e9869e6075b8ec08824 (patch) | |
tree | 50b0868d30b341425dc06b5f0dc8060dbf295af2 /linux-core | |
parent | bc32d1798a213d7701b20feb95781eb51a42e945 (diff) |
NV50: switch to fixed point scale factor calculations
Diffstat (limited to 'linux-core')
-rw-r--r-- | linux-core/nv50_crtc.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/linux-core/nv50_crtc.c b/linux-core/nv50_crtc.c index fd2ad38a..c9745e08 100644 --- a/linux-core/nv50_crtc.c +++ b/linux-core/nv50_crtc.c @@ -232,17 +232,18 @@ static int nv50_crtc_set_dither(struct nv50_crtc *crtc) static void nv50_crtc_calc_scale(struct nv50_crtc *crtc, uint32_t *outX, uint32_t *outY) { - float hor_scale, ver_scale; + uint32_t hor_scale, ver_scale; - hor_scale = (float)crtc->native_mode->hdisplay/(float)crtc->mode->hdisplay; - ver_scale = (float)crtc->native_mode->vdisplay/(float)crtc->mode->vdisplay; + /* max res is 8192, which is 2^13, which leaves 19 bits */ + hor_scale = (crtc->native_mode->hdisplay << 19)/crtc->mode->hdisplay; + ver_scale = (crtc->native_mode->vdisplay << 19)/crtc->mode->vdisplay; if (ver_scale > hor_scale) { - *outX = crtc->mode->hdisplay * hor_scale; - *outY = crtc->mode->vdisplay * hor_scale; + *outX = (crtc->mode->hdisplay * hor_scale) >> 19; + *outY = (crtc->mode->vdisplay * hor_scale) >> 19; } else { - *outX = crtc->mode->hdisplay * ver_scale; - *outY = crtc->mode->vdisplay * ver_scale; + *outX = (crtc->mode->hdisplay * ver_scale) >> 19; + *outY = (crtc->mode->vdisplay * ver_scale) >> 19; } } |