faster 8bpp to 24 bit depth conversion in SetImageBits_8

Vedran Rodic vedran at renata.irb.hr
Sat Mar 3 19:17:45 CST 2001


Hi
 
This is my first message to wine-patches :-)
 
I've noticed that Xshm DirectDraw is slow with 8 bpp games on my
24 bit deep display. Thanks to Ove Kaaven who helped me at #WineHQ
I managed to use 16 bpp asm code to make 32 bpp conversion
asm.
 
ChangeLog entry:
 
Made 8 bpp to 24 bit depth conversion in X11DRV_DIB_SetImageBits_8
faster by using inline asm.
 
Vedran Rodic
-------------- next part --------------
Index: graphics/x11drv/dib.c
===================================================================
RCS file: /home/wine/wine/graphics/x11drv/dib.c,v
retrieving revision 1.72
diff -u -r1.72 dib.c
--- graphics/x11drv/dib.c	2001/02/13 20:16:46	1.72
+++ graphics/x11drv/dib.c	2001/03/04 01:01:18
@@ -978,6 +978,35 @@
 	}
 	break;
 #endif
+    case 24:
+#if defined(__i386__) && defined(__GNUC__)
+	if (lines && (dstwidth!=left) && (bmpImage->bits_per_pixel == 32))
+	{
+	    for (h = lines ; h--; ) {
+		int _cl1,_cl2; /* temp outputs for asm below */
+		/* Borrowed from DirectDraw */
+		__asm__ __volatile__(
+		"xor %%eax,%%eax\n"
+		"cld\n"
+		"1:\n"
+		"    lodsb\n"
+		"    movl (%%edx,%%eax,4),%%ax\n"
+		"    stosl\n"
+		"      xor %%eax,%%eax\n"
+		"    loop 1b\n"
+		:"=S" (bits), "=D" (_cl1), "=c" (_cl2)
+		:"S" (bits),
+		 "D" (bmpImage->data+h*bmpImage->bytes_per_line+left*2),
+		 "c" (dstwidth-left),
+		 "d" (colors)
+		:"eax", "cc", "memory"
+		);
+		bits = (srcbits += linebytes) + left;
+	    }
+	    return;
+	}
+	break;
+#endif
     default:
     	break; /* use slow generic case below */
     }


More information about the wine-patches mailing list