[cairo-commit] 2 commits - configure.in pixman/src

Behdad Esfahbod behdad at kemper.freedesktop.org
Sun Jan 21 12:18:03 PST 2007


 configure.in       |   38 ++++++++++++++++++++++++--------------
 pixman/src/fbmmx.c |   34 ++++++++++++++++++----------------
 2 files changed, 42 insertions(+), 30 deletions(-)

New commits:
diff-tree 1a9d3b5185f454a63bc96c2e570c931c3ecabbb5 (from 6aa8e80cc722774191c4418c9a2cd434c0538508)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Jan 21 15:11:31 2007 -0500

    [configure.in] Use AC_MSG_RESULT in PKG_CHECK_MODULES's second branch
    
    If PKG_CHECK_MODULES fails, it does not print out any check results and so, no
    newlines.  This is kinda silly, at least in the case that no second branch is
    provided, but I think that's the way it is, to let users decide what to print.
    
    We now just do a AC_MSG_RESULT(no) and continue with what we used to do.
    Inspired by Tor Lillqvist's similar change in Pango.

diff --git a/configure.in b/configure.in
index 25ae86b..ecb124b 100644
--- a/configure.in
+++ b/configure.in
@@ -231,7 +231,8 @@ dnl ====================================
 CAIRO_BACKEND_ENABLE(xlib, Xlib, xlib, XLIB_SURFACE, auto, [
   xlib_REQUIRES="x11"
   PKG_CHECK_MODULES(xlib, $xlib_REQUIRES, ,
-		    [xlib_REQUIRES=""
+		    [AC_MSG_RESULT(no)
+		     xlib_REQUIRES=""
 		     AC_PATH_XTRA
 		     if test "x$no_x" = xyes; then
 		       use_xlib="no (requires X development libraries)"
@@ -253,7 +254,8 @@ CAIRO_BACKEND_ENABLE(xlib_xrender, Xlib 
     xlib_xrender_BASE=cairo-xlib
     xlib_xrender_REQUIRES="xrender >= 0.6"
     PKG_CHECK_MODULES(xlib_xrender, $xlib_xrender_REQUIRES, ,
-		      [xlib_xrender_REQUIRES=""
+		      [AC_MSG_RESULT(no)
+		       xlib_xrender_REQUIRES=""
 		       AC_CHECK_HEADER(X11/extensions/Xrender.h,
 				       [xlib_xrender_NONPKGCONFIG_LIBS="-lXrender"],
 				       [use_xlib_xrender="no (requires Xrender http://freedesktop.org/Software/xlibs)"])])
@@ -264,7 +266,7 @@ dnl ====================================
 
 CAIRO_BACKEND_ENABLE(xcb, XCB, xcb, XCB_SURFACE, no, [
   xcb_REQUIRES="xcb >= 0.9.92 xcb-render >= 0.9.92 xcb-renderutil"
-  PKG_CHECK_MODULES(xcb, $xcb_REQUIRES, , [
+  PKG_CHECK_MODULES(xcb, $xcb_REQUIRES, , [AC_MSG_RESULT(no)
   use_xcb="no (requires XCB http://xcb.freedesktop.org)"])
 ])
 
@@ -351,7 +353,7 @@ CAIRO_BACKEND_ENABLE(png, PNG, png, PNG_
   fi
 
   if test "x$use_png" = "xyes" ; then 
-    PKG_CHECK_MODULES(png, $png_REQUIRES)
+    PKG_CHECK_MODULES(png, $png_REQUIRES, , AC_MSG_RESULT(no))
   else
     AC_MSG_WARN([Could not find libpng in the pkg-config search path])
   fi    
@@ -368,19 +370,19 @@ dnl ====================================
 GLITZ_MIN_VERSION=0.5.1
 CAIRO_BACKEND_ENABLE(glitz, glitz, glitz, GLITZ_SURFACE, no, [
   glitz_REQUIRES="glitz >= $GLITZ_MIN_VERSION"
-  PKG_CHECK_MODULES(glitz, $glitz_REQUIRES, , [
+  PKG_CHECK_MODULES(glitz, $glitz_REQUIRES, , [AC_MSG_RESULT(no)
   use_glitz="no (requires glitz http://freedesktop.org/Software/glitz)"])
 ])
 
 if test "x$use_glitz" = "xyes";then
   PKG_CHECK_MODULES(GLITZ_AGL, glitz-agl >= $GLITZ_MIN_VERSION,
-   [have_glitz_agl=yes], [have_glitz_agl=no; echo $MYSTUFF_PKG_ERRORS])
+   [have_glitz_agl=yes], [have_glitz_agl=no; AC_MSG_RESULT(no)])
   PKG_CHECK_MODULES(GLITZ_EGL, glitz-egl >= $GLITZ_MIN_VERSION,
-   [have_glitz_egl=yes], [have_glitz_egl=no; echo $MYSTUFF_PKG_ERRORS])
+   [have_glitz_egl=yes], [have_glitz_egl=no; AC_MSG_RESULT(no)])
   PKG_CHECK_MODULES(GLITZ_GLX, glitz-glx >= $GLITZ_MIN_VERSION,
-   [have_glitz_glx=yes], [have_glitz_glx=no; echo $MYSTUFF_PKG_ERRORS])
+   [have_glitz_glx=yes], [have_glitz_glx=no; AC_MSG_RESULT(no)])
   PKG_CHECK_MODULES(GLITZ_WGL, glitz-wgl >= $GLITZ_MIN_VERSION,
-   [have_glitz_wgl=yes], [have_glitz_wgl=no; echo $MYSTUFF_PKG_ERRORS])
+   [have_glitz_wgl=yes], [have_glitz_wgl=no; AC_MSG_RESULT(no)])
 
   if test "x$have_glitz_agl" = "xyes";then
     AC_DEFINE(CAIRO_CAN_TEST_GLITZ_AGL_SURFACE, 1, [define if glitz backend can be tested against agl])
@@ -405,7 +407,7 @@ dnl ====================================
 
 CAIRO_BACKEND_ENABLE(directfb, directfb, directfb, DIRECTFB_SURFACE, no, [
   directfb_REQUIRES=directfb
-  PKG_CHECK_MODULES(directfb, $directfb_REQUIRES, ,
+  PKG_CHECK_MODULES(directfb, $directfb_REQUIRES, , AC_MSG_RESULT(no)
 		    [use_directfb="no (requires directfb http://www.directfb.org)"])
 ])
 
@@ -435,11 +437,13 @@ CAIRO_BACKEND_ENABLE(ft, FreeType font, 
   ft_REQUIRES="fontconfig"
   PKG_CHECK_MODULES(FONTCONFIG, $ft_REQUIRES,
 		    [_CHECK_FUNCS_WITH_FLAGS(FcFini, $ft_CFLAGS, $ft_LIBS)],
-		    [use_ft="no (requires fontconfig"])
+		    [AC_MSG_RESULT(no); use_ft="no (requires fontconfig"])
 
   if test "x$use_ft" = "xyes"; then
     PKG_CHECK_MODULES(FREETYPE, freetype2 >= $FREETYPE_MIN_VERSION,
-                      [freetype_pkgconfig=yes], [freetype_pkgconfig=no])
+                      [freetype_pkgconfig=yes],
+		      [AC_MSG_RESULT(no)
+		       freetype_pkgconfig=no])
   
     if test "x$freetype_pkgconfig" = "xyes"; then
       ft_REQUIRES="freetype2 >= $FREETYPE_MIN_VERSION $ft_REQUIRES"
@@ -517,7 +521,10 @@ POPPLER_VERSION_REQUIRED=0.4.1
 test_pdf=no
 if test "x$use_pdf" = "xyes"; then
   poppler_DEPENDENCY="poppler-glib >= $POPPLER_VERSION_REQUIRED"
-  PKG_CHECK_MODULES(POPPLER, $poppler_DEPENDENCY pango gtk+-2.0, [test_pdf=yes], [test_pdf="no (requires $poppler_DEPENDENCY)"])
+  PKG_CHECK_MODULES(POPPLER, $poppler_DEPENDENCY pango gtk+-2.0,
+                    [test_pdf=yes],
+		    [AC_MSG_RESULT(no)
+		     test_pdf="no (requires $poppler_DEPENDENCY)"])
   if test "x$test_pdf" = "xyes"; then
     AC_DEFINE([CAIRO_CAN_TEST_PDF_SURFACE], 1, [Define to 1 if the PDF backend can be tested (need poppler and other dependencies for pdf2png)])
   else
@@ -542,7 +549,10 @@ CAIRO_BACKEND_ENABLE(svg, SVG, svg, SVG_
 LIBRSVG_VERSION_REQUIRED=2.15.0
 if test "x$use_svg" = "xyes"; then
   librsvg_DEPENDENCY="librsvg-2.0 >= $LIBRSVG_VERSION_REQUIRED"
-  PKG_CHECK_MODULES(LIBRSVG, $librsvg_DEPENDENCY gdk-2.0, [test_svg=yes], [test_svg="no (requires $librsvg_DEPENDENCY)"])
+  PKG_CHECK_MODULES(LIBRSVG, $librsvg_DEPENDENCY gdk-2.0,
+                    [test_svg=yes],
+		    [AC_MSG_RESULT(no)
+		     test_svg="no (requires $librsvg_DEPENDENCY)"])
   if test "x$test_svg" = "xyes"; then
     AC_DEFINE([CAIRO_CAN_TEST_SVG_SURFACE], 1, [Define to 1 if the SVG backend can be tested])
   else
diff-tree 6aa8e80cc722774191c4418c9a2cd434c0538508 (from 1a8d0a33ce589367f0e46006caecb544a3945048)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Jan 21 15:06:02 2007 -0500

    [pixman/src/fbmmx.c] Hide "dereferencing type-punned pointer" warnings
    
    The warning happens all the place when the code converts from ullong to __m64.
    The way the conversion is done is a C idiom: 1) get a pointer to the value, 2)
    convert it to the suitable pointer type for the target, 3) dereference it.
    That is "*(__m64*)(&m)" in this case.  This is necessarily (as opposed to just
    casting to target type) because the two types may not be "compatible" from the
    compiler's point of view.  Example of types that are not compatbile is structs
    vs anything.
    
    The "dereferencing type-punned pointer will break strict-aliasing rules" from
    gcc exactly means: "some code may be assuming that pointers with different
    types do not compare equal (or otherwise share the same target object).  If
    you case a pointer to a different type and dereference it, it may happen
    here."  However, in our usecase, it's clear that the compiler cannot make any
    false assumptions.  So we just go ahead and hide it by using a middle cast to
    "void *".  Since the compiler does not many any aliasing assumptions about
    generic pointers, it will not warn either. (Though the problems if any, will
    still occure.  So this is not an ideal solution to this problem and should be
    used very carefully, to no hide useful warnings for when things go loose on
    some weird architecture.)
    
    Another solution would have been to use gcc's "may_alias" function attribute,
    but trying to define a may_alias version of __m64 hit a bug in gcc.  That is,
    try replacing "__m64" with "m64" and define:
    
      typedef __m64 m64 __attribute__((may_alias));
    
    and see it fail to compile.  This seems to be because of the special vector
    type that __m64 has.

diff --git a/pixman/src/fbmmx.c b/pixman/src/fbmmx.c
index aa18019..abe52b9 100644
--- a/pixman/src/fbmmx.c
+++ b/pixman/src/fbmmx.c
@@ -157,6 +157,8 @@ static const MMXData c =
 #define MC(x) c.mmx_##x
 #endif
 
+#define M64(x) (*(__m64*)(void*)(&x))
+
 static __inline__ __m64
 shift (__m64 v, int s)
 {
@@ -1619,7 +1621,7 @@ fbCompositeSolidMask_nx8x8888mmx (pixman
 
 	    if (m)
 	    {
-		__m64 vdest = in_over(vsrc, vsrca, expand_alpha_rev (*(__m64*)(&m)), load8888(*dst));
+		__m64 vdest = in_over(vsrc, vsrca, expand_alpha_rev (M64(m)), load8888(*dst));
 		*dst = store8888(vdest);
 	    }
 
@@ -1647,8 +1649,8 @@ fbCompositeSolidMask_nx8x8888mmx (pixman
 
 		vdest = *(__m64 *)dst;
 
-		dest0 = in_over(vsrc, vsrca, expand_alpha_rev (*(__m64*)(&m0)), expand8888(vdest, 0));
-		dest1 = in_over(vsrc, vsrca, expand_alpha_rev (*(__m64*)(&m1)), expand8888(vdest, 1));
+		dest0 = in_over(vsrc, vsrca, expand_alpha_rev (M64(m0)), expand8888(vdest, 0));
+		dest1 = in_over(vsrc, vsrca, expand_alpha_rev (M64(m1)), expand8888(vdest, 1));
 
 		*(__m64 *)dst = pack8888(dest0, dest1);
 	    }
@@ -1667,7 +1669,7 @@ fbCompositeSolidMask_nx8x8888mmx (pixman
 	    if (m)
 	    {
 		__m64 vdest = load8888(*dst);
-		vdest = in_over(vsrc, vsrca, expand_alpha_rev (*(__m64*)(&m)), vdest);
+		vdest = in_over(vsrc, vsrca, expand_alpha_rev (M64(m)), vdest);
 		*dst = store8888(vdest);
 	    }
 
@@ -1737,7 +1739,7 @@ fbCompositeSolidMaskSrc_nx8x8888mmx (pix
 
 	    if (m)
 	    {
-		  __m64 vdest = in(vsrc, expand_alpha_rev (*(__m64*)(&m)));
+		  __m64 vdest = in(vsrc, expand_alpha_rev (M64(m)));
 		  *dst = store8888(vdest);
 	    }
 	    else
@@ -1769,8 +1771,8 @@ fbCompositeSolidMaskSrc_nx8x8888mmx (pix
 
 		vdest = *(__m64 *)dst;
 
-		dest0 = in(vsrc, expand_alpha_rev (*(__m64*)(&m0)));
-		dest1 = in(vsrc, expand_alpha_rev (*(__m64*)(&m1)));
+		dest0 = in(vsrc, expand_alpha_rev (M64(m0)));
+		dest1 = in(vsrc, expand_alpha_rev (M64(m1)));
 
 		*(__m64 *)dst = pack8888(dest0, dest1);
 	    }
@@ -1793,7 +1795,7 @@ fbCompositeSolidMaskSrc_nx8x8888mmx (pix
 	    if (m)
 	    {
 		__m64 vdest = load8888(*dst);
-		vdest = in(vsrc, expand_alpha_rev (*(__m64*)(&m)));
+		vdest = in(vsrc, expand_alpha_rev (M64(m)));
 		*dst = store8888(vdest);
 	    }
 	    else
@@ -1848,7 +1850,7 @@ fbCompositeSolidMask_nx8x0565mmx (pixman
     vsrca = expand_alpha (vsrc);
 
     vsrc16 = pack565(vsrc, _mm_setzero_si64(), 0);
-    src16 = *(ullong*)(&vsrc16);
+    src16 = *(ullong*)(void*)(&vsrc16);
 
     srcsrcsrcsrc = (ullong)src16 << 48 | (ullong)src16 << 32 |
 	(ullong)src16 << 16 | (ullong)src16;
@@ -1870,7 +1872,7 @@ fbCompositeSolidMask_nx8x0565mmx (pixman
 	    if (m)
 	    {
 		__m64 vd = _mm_cvtsi32_si64 (*dst);
-		__m64 vdest = in_over(vsrc, vsrca, expand_alpha_rev (*(__m64*)(&m)), expand565(vd, 0));
+		__m64 vdest = in_over(vsrc, vsrca, expand_alpha_rev (M64(m)), expand565(vd, 0));
 		*dst = _mm_cvtsi64_si32 (pack565(vdest, _mm_setzero_si64(), 0));
 	    }
 
@@ -1900,13 +1902,13 @@ fbCompositeSolidMask_nx8x0565mmx (pixman
 
 		vdest = *(__m64 *)dst;
 
-		vm0 = *(__m64*)(&m0);
+		vm0 = M64(m0);
 		vdest = pack565(in_over(vsrc, vsrca, expand_alpha_rev(vm0), expand565(vdest, 0)), vdest, 0);
-		vm1 = *(__m64*)(&m1);
+		vm1 = M64(m1);
 		vdest = pack565(in_over(vsrc, vsrca, expand_alpha_rev(vm1), expand565(vdest, 1)), vdest, 1);
-		vm2 = *(__m64*)(&m2);
+		vm2 = M64(m2);
 		vdest = pack565(in_over(vsrc, vsrca, expand_alpha_rev(vm2), expand565(vdest, 2)), vdest, 2);
-		vm3 = *(__m64*)(&m3);
+		vm3 = M64(m3);
 		vdest = pack565(in_over(vsrc, vsrca, expand_alpha_rev(vm3), expand565(vdest, 3)), vdest, 3);
 
 		*(__m64 *)dst = vdest;
@@ -1926,7 +1928,7 @@ fbCompositeSolidMask_nx8x0565mmx (pixman
 	    if (m)
 	    {
 		__m64 vd = _mm_cvtsi32_si64 (*dst);
-		__m64 vdest = in_over(vsrc, vsrca, expand_alpha_rev (*(__m64*)(&m)), expand565(vd, 0));
+		__m64 vdest = in_over(vsrc, vsrca, expand_alpha_rev (M64(m)), expand565(vd, 0));
 		*dst = _mm_cvtsi64_si32 (pack565(vdest, _mm_setzero_si64(), 0));
 	    }
 
@@ -2657,7 +2659,7 @@ fbSolidFillmmx (FbPixels	*pDraw,
     }
 
     fill = ((ullong)xor << 32) | xor;
-    vfill = *(__m64*)&fill;
+    vfill = M64(fill);
 
     while (height--)
     {


More information about the cairo-commit mailing list