From 22ee8437f45a01c6e1d8e33dd85bb9df18ca1e8b Mon Sep 17 00:00:00 2001 From: David 'Digit' Turner Date: Fri, 8 Jul 2011 04:42:04 +0200 Subject: Fix window scaling issue. This patch fixes a bug in the MMX scaling code. The MMX state was not properly empties when we started the scaling functions. The end result was that, if the hardware FPU was in a certain state, rendering would be be erratic. Fixes http://code.google.com/p/android/issues/detail?id=18299 This bug was hard to reproduce, but the fact that it never happens when building a debug version (with -O0) of the emulator indicated a problem in the generated instruction stream. Glad this isn't a compiler error though :) Change-Id: Icea04a7152b8fa5d81cb70cc215c0cd95aed2142 --- android/skin/argb.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/android/skin/argb.h b/android/skin/argb.h index 436a9c8..d71a914 100644 --- a/android/skin/argb.h +++ b/android/skin/argb.h @@ -39,12 +39,6 @@ mmx_expand16( int value ) return _mm_packs_pi32( t1, t1 ); } -static inline int -mmx_makescale( double s ) -{ - return (int)(s*(1 << 16)); -} - static inline mmx_t mmx_mulshift( mmx_t argb, int multiplier, int rshift, mmx_t zero ) { @@ -237,6 +231,8 @@ ARGB_SCALE_GENERIC( ScaleOp* op ) int ix = op->ix; int iy = op->iy; + _mm_empty(); + src_line += (sx >> 16)*4 + (sy >> 16)*src_pitch; sx &= 0xffff; sy &= 0xffff; @@ -331,6 +327,8 @@ scale_05_to_10( ScaleOp* op ) int ix = op->ix; int iy = op->iy; + _mm_empty(); + src_line += (sx >> 16)*4 + (sy >> 16)*src_pitch; sx &= 0xffff; sy &= 0xffff; @@ -468,6 +466,8 @@ scale_up_bilinear( ScaleOp* op ) int xlimit, ylimit; int h, sx0; + _mm_empty(); + /* the center pixel is at (sx+ix/2, sy+iy/2), we then want to get */ /* the four nearest source pixels, which are at (0.5,0.5) offsets */ @@ -553,6 +553,8 @@ ARGB_SCALE_UP_QUICK_4x4( ScaleOp* op ) int xlimit, ylimit; int h, sx0; + _mm_empty(); + /* the center pixel is at (sx+ix/2, sy+iy/2), we then want to get */ /* the four nearest source pixels, which are at (0.5,0.5) offsets */ @@ -805,6 +807,8 @@ ARGB_SCALE_NEAREST( ScaleOp* op ) int xlimit, ylimit; int h, sx0; + _mm_empty(); + /* the center pixel is at (sx+ix/2, sy+iy/2), we then want to get */ /* the four nearest source pixels, which are at (0.5,0.5) offsets */ -- cgit v1.1