pixman: Branch 'master' - 2 commits

Matt Turner mattst88 at kemper.freedesktop.org
Sun May 19 09:02:26 PDT 2013


 configure.ac        |    2 +-
 pixman/pixman-mmx.c |   23 +++++++++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)

New commits:
commit d77d75cc6e5de14d027d22b70389a4d0c71048b9
Author: Markos Chandras <markos.chandras at imgtec.com>
Date:   Wed May 15 09:51:20 2013 -0700

    Use AC_LINK_IFELSE to check if the Loongson MMI code can link
    
    The Loongson code is compiled with -march=loongson2f to enable the MMI
    instructions, but binutils refuses to link object code compiled with
    different -march settings, leading to link failures later in the
    compile. This avoids that problem by checking if we can link code
    compiled for Loongson.
    
    Reviewed-by: Matt Turner <mattst88 at gmail.com>
    Signed-off-by: Markos Chandras <markos.chandras at imgtec.com>

diff --git a/configure.ac b/configure.ac
index c43a0d2..221179f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -279,7 +279,7 @@ AC_MSG_CHECKING(whether to use Loongson MMI assembler)
 
 xserver_save_CFLAGS=$CFLAGS
 CFLAGS=" $LS_CFLAGS $CFLAGS -I$srcdir"
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+AC_LINK_IFELSE([AC_LANG_SOURCE([[
 #ifndef __mips_loongson_vector_rev
 #error "Loongson Multimedia Instructions are only available on Loongson"
 #endif
commit a74be759a18831c738dc4d1346a3f053ccdb5991
Author: Matt Turner <mattst88 at gmail.com>
Date:   Tue May 14 12:40:50 2013 -0700

    mmx: Document implementation(s) of pix_multiply().
    
    I look at that function and can never remember what it does or how it
    manages to do it.

diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c
index 14790c0..746ecd6 100644
--- a/pixman/pixman-mmx.c
+++ b/pixman/pixman-mmx.c
@@ -301,6 +301,29 @@ negate (__m64 mask)
     return _mm_xor_si64 (mask, MC (4x00ff));
 }
 
+/* Computes the product of two unsigned fixed-point 8-bit values from 0 to 1
+ * and maps its result to the same range.
+ *
+ * Jim Blinn gives multiple ways to compute this in "Jim Blinn's Corner:
+ * Notation, Notation, Notation", the first of which is
+ *
+ *   prod(a, b) = (a * b + 128) / 255.
+ *
+ * By approximating the division by 255 as 257/65536 it can be replaced by a
+ * multiply and a right shift. This is the implementation that we use in
+ * pix_multiply(), but we _mm_mulhi_pu16() by 257 (part of SSE1 or Extended
+ * 3DNow!, and unavailable at the time of the book's publication) to perform
+ * the multiplication and right shift in a single operation.
+ *
+ *   prod(a, b) = ((a * b + 128) * 257) >> 16.
+ *
+ * A third way (how pix_multiply() was implemented prior to 14208344) exists
+ * also that performs the multiplication by 257 with adds and shifts.
+ *
+ * Where temp = a * b + 128
+ *
+ *   prod(a, b) = (temp + (temp >> 8)) >> 8.
+ */
 static force_inline __m64
 pix_multiply (__m64 a, __m64 b)
 {


More information about the xorg-commit mailing list