b=383960: Upgrade cairo to 1.4.10: moz cairo: fbcompose-bandaid.patch
authorvladimir@pobox.com
Sat, 30 Jun 2007 00:47:44 -0700
changeset 2966 dd7ba12eaf0e3ddf788034d9cf63ba21108cb8cf
parent 2965 6adab9c10fb1d7cdebb40fb5f03ffff375fddcf3
child 2967 dc8c6a14f820f93b19e8a32a54b893015618aa6e
push idunknown
push userunknown
push dateunknown
bugs383960
milestone1.9a6pre
b=383960: Upgrade cairo to 1.4.10: moz cairo: fbcompose-bandaid.patch
gfx/cairo/fbcompose-bandaid.patch
gfx/cairo/libpixman/src/fbcompose.c
--- a/gfx/cairo/fbcompose-bandaid.patch
+++ b/gfx/cairo/fbcompose-bandaid.patch
@@ -1,39 +1,20 @@
-Index: fbcompose.c
-===================================================================
-RCS file: /cvsroot/mozilla/gfx/cairo/libpixman/src/fbcompose.c,v
-retrieving revision 1.6
-diff -u -8 -p -r1.6 fbcompose.c
---- pixman/src/fbcompose.c	11 Jan 2006 00:48:57 -0000	1.6
-+++ pixman/src/fbcompose.c	8 Feb 2006 00:27:16 -0000
-@@ -23,16 +23,17 @@
-  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-  * SOFTWARE.
-  */
- #ifdef HAVE_CONFIG_H
- #include <config.h>
- #endif
+diff -r 37dcf8c8ef5e gfx/cairo/libpixman/src/fbcompose.c
+--- a/gfx/cairo/libpixman/src/fbcompose.c	Fri Jun 08 17:16:14 2007 -0700
++++ b/gfx/cairo/libpixman/src/fbcompose.c	Fri Jun 08 17:18:31 2007 -0700
+@@ -28,6 +28,7 @@
+ 
  #include "pixman-xserver-compat.h"
  #include "fbpict.h"
 +#include "fbmmx.h"
  
  #ifdef RENDER
  
- #include "pixregionint.h"
- 
- #ifdef _MSC_VER
- #define _USE_MATH_DEFINES
- #endif
-@@ -3756,16 +3757,34 @@ fbCompositeRect (const FbComposeData *da
- 	data->mask->componentAlpha &&
- 	PICT_FORMAT_RGB (data->mask->format_code))
-     {
- 	CARD32 *mask_buffer = dest_buffer + data->width;
- 	CombineFuncC compose = composeFunctions.combineC[data->op];
+@@ -4093,6 +4094,24 @@ fbCompositeRect (const FbComposeData *da
  	if (!compose)
  	    return;
  
 +	/* XXX: The non-MMX version of some of the fbCompose functions
 +	 * overwrite the source or mask data (ones that use
 +	 * fbCombineMaskC, fbCombineMaskAlphaC, or fbCombineMaskValueC
 +	 * as helpers).  This causes problems with the optimization in
 +	 * this function that only fetches the source or mask once if
@@ -48,13 +29,8 @@ diff -u -8 -p -r1.6 fbcompose.c
 +	{
 +	    srcClass = SourcePictClassUnknown;
 +	    maskClass = SourcePictClassUnknown;
 +	}
 +
  	for (i = 0; i < data->height; ++i) {
  	    /* fill first half of scanline with source */
  	    if (fetchSrc)
- 	    {
- 		if (fetchMask)
- 		{
- 		    /* fetch mask before source so that fetching of
- 		       source can be optimized */
--- a/gfx/cairo/libpixman/src/fbcompose.c
+++ b/gfx/cairo/libpixman/src/fbcompose.c
@@ -23,16 +23,17 @@
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  * SOFTWARE.
  */
 
 #include "pixmanint.h"
 
 #include "pixman-xserver-compat.h"
 #include "fbpict.h"
+#include "fbmmx.h"
 
 #ifdef RENDER
 
 #include "pixregionint.h"
 
 #ifdef _MSC_VER
 #define _USE_MATH_DEFINES
 #endif
@@ -4088,16 +4089,34 @@ fbCompositeRect (const FbComposeData *da
 	data->mask->componentAlpha &&
 	PICT_FORMAT_RGB (data->mask->format_code))
     {
 	CARD32 *mask_buffer = dest_buffer + data->width;
 	CombineFuncC compose = composeFunctions.combineC[data->op];
 	if (!compose)
 	    return;
 
+	/* XXX: The non-MMX version of some of the fbCompose functions
+	 * overwrite the source or mask data (ones that use
+	 * fbCombineMaskC, fbCombineMaskAlphaC, or fbCombineMaskValueC
+	 * as helpers).  This causes problems with the optimization in
+	 * this function that only fetches the source or mask once if
+	 * possible.  If we're on a non-MMX machine, disable this
+	 * optimization as a bandaid fix.
+	 *
+	 * https://bugs.freedesktop.org/show_bug.cgi?id=5777
+	 */
+#ifdef USE_MMX
+	if (!fbHaveMMX())
+#endif
+	{
+	    srcClass = SourcePictClassUnknown;
+	    maskClass = SourcePictClassUnknown;
+	}
+
 	for (i = 0; i < data->height; ++i) {
 	    /* fill first half of scanline with source */
 	    if (fetchSrc)
 	    {
 		if (fetchMask)
 		{
 		    /* fetch mask before source so that fetching of
 		       source can be optimized */