diff options
author | Lajos Molnar <lajos@ti.com> | 2012-05-21 14:30:02 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-05-21 14:30:02 -0700 |
commit | 446b2a94f2e1ac2811e1f9a00316374ea887cd93 (patch) | |
tree | a05d990fd56f83e6253eacc6372d3ad82f7b8b83 | |
parent | 13c45c2cd79855664a1cbddcd035eac354502336 (diff) | |
parent | 0af28b8e2f7230fb668574eb70fb21d9c2d0e6da (diff) | |
download | hardware_ti_omap4-446b2a94f2e1ac2811e1f9a00316374ea887cd93.zip hardware_ti_omap4-446b2a94f2e1ac2811e1f9a00316374ea887cd93.tar.gz hardware_ti_omap4-446b2a94f2e1ac2811e1f9a00316374ea887cd93.tar.bz2 |
am 16b7f6c4: hwc: Fix truncation errors in scaling decision
* commit '16b7f6c4b06ac7350c30309d0559a466097d8ae7':
hwc: Fix truncation errors in scaling decision
-rw-r--r-- | hwc/hwc.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -46,6 +46,8 @@ #define WIDTH(rect) ((rect).right - (rect).left) #define HEIGHT(rect) ((rect).bottom - (rect).top) +#define DIV_ROUND_UP(a, b) (((a) + (b) - 1) / (b)) + #include <video/dsscomp.h> #include "hal_public.h" @@ -716,6 +718,8 @@ static int omap4_hwc_can_scale(__u32 src_w, __u32 src_h, __u32 dst_w, __u32 dst_ __u32 pclk) { __u32 fclk = limits->fclk / 1000; + __u32 min_src_w = DIV_ROUND_UP(src_w, is_2d ? limits->max_xdecim_2d : limits->max_xdecim_1d); + __u32 min_src_h = DIV_ROUND_UP(src_h, is_2d ? limits->max_ydecim_2d : limits->max_ydecim_1d); /* ERRATAs */ /* cannot render 1-width layers on DSI video mode panels - we just disallow all 1-width LCD layers */ @@ -729,15 +733,15 @@ static int omap4_hwc_can_scale(__u32 src_w, __u32 src_h, __u32 dst_w, __u32 dst_ return 0; /* max downscale */ - if (dst_h < src_h / limits->max_downscale / (is_2d ? limits->max_ydecim_2d : limits->max_ydecim_1d)) + if (dst_h * limits->max_downscale < min_src_h) return 0; /* for manual panels pclk is 0, and there are no pclk based scaling limits */ if (!pclk) - return (dst_w < src_w / limits->max_downscale / (is_2d ? limits->max_xdecim_2d : limits->max_xdecim_1d)); + return !(dst_w * limits->max_downscale < min_src_w); /* :HACK: limit horizontal downscale well below theoretical limit as we saw display artifacts */ - if (dst_w < src_w / 4) + if (dst_w * 4 < src_w) return 0; /* max horizontal downscale is 4, or the fclk/pixclk */ @@ -746,7 +750,7 @@ static int omap4_hwc_can_scale(__u32 src_w, __u32 src_h, __u32 dst_w, __u32 dst_ /* for small parts, we need to use integer fclk/pixclk */ if (src_w < limits->integer_scale_ratio_limit) fclk = fclk / pclk * pclk; - if ((__u32) dst_w < src_w * pclk / fclk / (is_2d ? limits->max_xdecim_2d : limits->max_xdecim_1d)) + if ((__u32) dst_w * fclk < min_src_w * pclk) return 0; return 1; |