xrender patch

Jeremy White jwhite at codeweavers.com
Thu May 2 12:04:04 CDT 2002


> That does fix it, though I was getting used to the client side fonts :(
> What version of XFree86 is needed to get a good xrender? I am running
> version 4.1.0.

You need 4.2.0.  You can also just build libXrender.so,
which is not that hard to pull out of CVS and build by itself.

Finally, I have attached the king daddy of all kludges that
may let you use your Xrender without modification, but
use at your own risk...  (you'll probably also need to
hand assemble the patch, it's a delta from our internal
tree and is not likely to apply).

Jer
-------------- next part --------------
Index: xrender.c
===================================================================
RCS file: /cvstrees/crossover/office/wine/dlls/x11drv/xrender.c,v
retrieving revision 1.2
retrieving revision 1.7
diff -u -r1.2 -r1.7
--- xrender.c	1 Feb 2002 18:12:24 -0000	1.2
+++ xrender.c	7 Mar 2002 15:51:51 -0000	1.7
@@ -67,6 +67,20 @@
 static int antialias = 1;
 
 /***********************************************************************
+ *   stack_kludge
+ *
+ * XRender will succeed if an automatic variable has a non zero value.
+ *  This kludge makes that more likely; we do minor tricks to attempt
+ *  to make sure we don't get optimized away.
+ *
+ */
+static void stack_kludge(void)
+{
+    volatile char clearme[20000];
+    memset((char *) clearme, 1, sizeof(clearme));
+}
+
+/***********************************************************************
  *   X11DRV_XRender_Init
  *
  * Let's see if our XServer has the extension available
@@ -81,6 +95,32 @@
         X11DRV_XRender_Installed = TRUE;
 	TRACE("Xrender is up and running error_base = %d\n", error_base);
 	screen_format = TSXRenderFindVisualFormat(gdi_display, visual);
+
+        /*--------------------------------------------------------------------
+        ** Xrender.c bug.  (Version 1.4 of Xrender.c had a bug where
+        **   an uninitialized stack variable could cause this to fail.
+        ** This is fixed in version 1.5, which seems to correspond to 
+        **   Xfree >= 4.2
+        ** In the mean time, we do a total kludge to attempt to address this:
+        **   we call it twice, and pray that the second time it is
+        **   initialized (and nudge the stack while we're at it).  
+        **   If it doesn't, we just bail.
+        ** JPW 02/12/02
+        **------------------------------------------------------------------*/
+        if (! screen_format)
+        {
+	    WARN("XRenderFindVisualFormat failed; likely XFree bug.  Retrying with stack kludge.\n");
+            stack_kludge();
+	    screen_format = TSXRenderFindVisualFormat(gdi_display, visual);
+        }
+        if (! screen_format)
+        {
+	    ERR("Your version of X has a buggy XRender extension (need >= 4.2).  Disabling XRENDER.\n");
+            X11DRV_XRender_Installed = FALSE;
+            return;
+        }
+
+
 	pf.type = PictTypeDirect;
 	pf.depth = 1;
 	pf.direct.alpha = 0;
@@ -354,7 +394,7 @@
     return;
 }
 


More information about the wine-devel mailing list