xserver/fb fbcompose.c,1.31,1.32 fbmmx.c,1.3,1.4

Lars Knoll xserver-commit at pdx.freedesktop.org
Wed Jul 13 17:13:22 EST 2005


Committed by: lars

Update of /cvs/xserver/xserver/fb
In directory gabe:/tmp/cvs-serv15860

Modified Files:
	fbcompose.c fbmmx.c 
Log Message:
fix compilation


Index: fbcompose.c
===================================================================
RCS file: /cvs/xserver/xserver/fb/fbcompose.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- fbcompose.c	12 Jul 2005 09:57:00 -0000	1.31
+++ fbcompose.c	13 Jul 2005 07:13:20 -0000	1.32
@@ -3207,11 +3207,15 @@
 static void fbFetchExternalAlpha(PicturePtr pict, int x, int y, int width, CARD32 *buffer)
 {
     int i;
-    CARD32 alpha_buffer[SCANLINE_BUFFER_LENGTH];
+    CARD32 _alpha_buffer[SCANLINE_BUFFER_LENGTH];
+    CARD32 *alpha_buffer = _alpha_buffer;
 
     if (!pict->alphaMap)
         return fbFetchTransformed(pict, x, y, width, buffer);
 
+    if (width > SCANLINE_BUFFER_LENGTH)
+        alpha_buffer = malloc(width*sizeof(CARD32));
+    
     fbFetchTransformed(pict, x, y, width, buffer);
     fbFetchTransformed(pict->alphaMap, x - pict->alphaOrigin.x, y - pict->alphaOrigin.y, width, alpha_buffer);
     for (i = 0; i < width; ++i) {
@@ -3221,6 +3225,9 @@
                  | (div_255(Green(buffer[i]) * a) << 8)
                  | (div_255(Blue(buffer[i]) * a));
     }
+
+    if (alpha_buffer != _alpha_buffer)
+        free(alpha_buffer);
 }
 
 static void fbStore(PicturePtr pict, int x, int y, int width, CARD32 *buffer)

Index: fbmmx.c
===================================================================
RCS file: /cvs/xserver/xserver/fb/fbmmx.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- fbmmx.c	12 Jul 2005 09:57:00 -0000	1.3
+++ fbmmx.c	13 Jul 2005 07:13:20 -0000	1.4
@@ -2410,46 +2410,46 @@
     CMOV = 0x10
 };
 
-static uint detectCPUFeatures(void) {
-    uint result;
+static unsigned int detectCPUFeatures(void) {
+    unsigned int result;
     char vendor[13];
     vendor[0] = 0;
     vendor[12] = 0;
     /* see p. 118 of amd64 instruction set manual Vol3 */
-    asm ("push %%ebx\n"
-         "pushf\n"
-         "pop %%eax\n"
-         "mov %%eax, %%ebx\n"
-         "xor $0x00200000, %%eax\n"
-         "push %%eax\n"
-         "popf\n"
-         "pushf\n"
-         "pop %%eax\n"
-         "mov $0x0, %%edx\n"
-         "xor %%ebx, %%eax\n"
-         "jz skip\n"
+    __asm__ ("push %%ebx\n"
+             "pushf\n"
+             "pop %%eax\n"
+             "mov %%eax, %%ebx\n"
+             "xor $0x00200000, %%eax\n"
+             "push %%eax\n"
+             "popf\n"
+             "pushf\n"
+             "pop %%eax\n"
+             "mov $0x0, %%edx\n"
+             "xor %%ebx, %%eax\n"
+             "jz skip\n"
 
-         "mov $0x00000000, %%eax\n"
-         "cpuid\n"
-         "mov %%ebx, %1\n"
-         "mov %%edx, %2\n"
-         "mov %%ecx, %3\n"
-         "mov $0x00000001, %%eax\n"
-         "cpuid\n"
-         "skip:\n"
-         "pop %%ebx\n"
-         "mov %%edx, %0\n"
-        : "=r" (result), 
-          "=m" (vendor[0]), 
-          "=m" (vendor[4]), 
-          "=m" (vendor[8])
-        :
-        : "%eax", "%ebx", "%ecx", "%edx"
+             "mov $0x00000000, %%eax\n"
+             "cpuid\n"
+             "mov %%ebx, %1\n"
+             "mov %%edx, %2\n"
+             "mov %%ecx, %3\n"
+             "mov $0x00000001, %%eax\n"
+             "cpuid\n"
+             "skip:\n"
+             "pop %%ebx\n"
+             "mov %%edx, %0\n"
+             : "=r" (result), 
+               "=m" (vendor[0]), 
+               "=m" (vendor[4]), 
+               "=m" (vendor[8])
+             :
+             : "%eax", "%ebx", "%ecx", "%edx"
         );
 
-    uint features = 0;
+    unsigned int features = 0;
     if (result) {
-        // result now contains the standard feature bits
+        /* result now contains the standard feature bits */
         if (result & (1 << 15))
             features |= CMOV;
         if (result & (1 << 23))
@@ -2461,19 +2461,19 @@
         if ((result & MMX) && !(result & SSE) && (strcmp(vendor, "AuthenticAMD") == 0)) {
             /* check for AMD MMX extensions */
 
-            uint result;            
-            asm("mov $0x80000000, %%eax\n"
-                "cpuid\n"
-                "xor %%edx, %%edx\n"
-                "cmp $0x1, %%eax\n"
-                "jge skip2\n"
-                "mov $0x80000001, %%eax\n"
-                "cpuid\n"
-                "skip2:\n"
-                "mov %%edx, %0\n"
-                : "=r" (result)
-                :
-                : "%eax", "%ebx", "%ecx", "%edx"
+            unsigned int result;            
+            __asm__("mov $0x80000000, %%eax\n"
+                    "cpuid\n"
+                    "xor %%edx, %%edx\n"
+                    "cmp $0x1, %%eax\n"
+                    "jge skip2\n"
+                    "mov $0x80000001, %%eax\n"
+                    "cpuid\n"
+                    "skip2:\n"
+                    "mov %%edx, %0\n"
+                    : "=r" (result)
+                    :
+                    : "%eax", "%ebx", "%ecx", "%edx"
                 );
             if (result & (1<<22))
                 features |= MMX_Extensions;
@@ -2490,7 +2490,7 @@
 
     if (!initialized)
     {
-        uint features = detectCPUFeatures();
+        unsigned int features = detectCPUFeatures();
 	mmx_present = (features & (MMX|MMX_Extensions)) == (MMX|MMX_Extensions);
         initialized = TRUE;
     }