Move fallback decisions from implementations into pixman-cpu.c.
authorSøren Sandmann Pedersen <ssp@redhat.com>
Mon, 24 Jan 2011 17:24:42 +0000 (12:24 -0500)
committerSøren Sandmann Pedersen <ssp@redhat.com>
Wed, 26 Jan 2011 22:07:35 +0000 (17:07 -0500)
Instead of having each individual implementation decide which fallback
to use, move it into pixman-cpu.c, where a more global decision can be
made.

This is accomplished by adding a "fallback" argument to all the
pixman_implementation_create_*() implementations, and then in
_pixman_choose_implementation() pass in the desired fallback.

pixman/pixman-arm-neon.c
pixman/pixman-arm-simd.c
pixman/pixman-cpu.c
pixman/pixman-fast-path.c
pixman/pixman-mmx.c
pixman/pixman-private.h
pixman/pixman-sse2.c
pixman/pixman-vmx.c

index c28c481..7d6c837 100644 (file)
@@ -414,13 +414,8 @@ BIND_COMBINE_U (add)
 BIND_COMBINE_U (out_reverse)
 
 pixman_implementation_t *
-_pixman_implementation_create_arm_neon (void)
+_pixman_implementation_create_arm_neon (pixman_implementation_t *fallback)
 {
-#ifdef USE_ARM_SIMD
-    pixman_implementation_t *fallback = _pixman_implementation_create_arm_simd ();
-#else
-    pixman_implementation_t *fallback = _pixman_implementation_create_fast_path ();
-#endif
     pixman_implementation_t *imp =
        _pixman_implementation_create (fallback, arm_neon_fast_paths);
 
index dc2f471..6bbc109 100644 (file)
@@ -415,10 +415,9 @@ static const pixman_fast_path_t arm_simd_fast_paths[] =
 };
 
 pixman_implementation_t *
-_pixman_implementation_create_arm_simd (void)
+_pixman_implementation_create_arm_simd (pixman_implementation_t *fallback)
 {
-    pixman_implementation_t *general = _pixman_implementation_create_fast_path ();
-    pixman_implementation_t *imp = _pixman_implementation_create (general, arm_simd_fast_paths);
+    pixman_implementation_t *imp = _pixman_implementation_create (fallback, arm_simd_fast_paths);
 
     return imp;
 }
index 70253d1..0e14ecb 100644 (file)
@@ -576,28 +576,36 @@ pixman_have_sse2 (void)
 pixman_implementation_t *
 _pixman_choose_implementation (void)
 {
-#ifdef USE_SSE2
-    if (pixman_have_sse2 ())
-       return _pixman_implementation_create_sse2 ();
-#endif
+    pixman_implementation_t *imp;
+
+    imp = _pixman_implementation_create_general();
+    imp = _pixman_implementation_create_fast_path (imp);
+    
 #ifdef USE_MMX
     if (pixman_have_mmx ())
-       return _pixman_implementation_create_mmx ();
+       imp = _pixman_implementation_create_mmx (imp);
 #endif
 
-#ifdef USE_ARM_NEON
-    if (pixman_have_arm_neon ())
-       return _pixman_implementation_create_arm_neon ();
+#ifdef USE_SSE2
+    if (pixman_have_sse2 ())
+       imp = _pixman_implementation_create_sse2 (imp);
 #endif
+
 #ifdef USE_ARM_SIMD
     if (pixman_have_arm_simd ())
-       return _pixman_implementation_create_arm_simd ();
+       imp = _pixman_implementation_create_arm_simd (imp);
+#endif
+
+#ifdef USE_ARM_NEON
+    if (pixman_have_arm_neon ())
+       imp = _pixman_implementation_create_arm_neon (imp);
 #endif
+    
 #ifdef USE_VMX
     if (pixman_have_vmx ())
-       return _pixman_implementation_create_vmx ();
+       imp = _pixman_implementation_create_vmx (imp);
 #endif
 
-    return _pixman_implementation_create_fast_path ();
+    return imp;
 }
 
index 2f9f176..eb09715 100644 (file)
@@ -1925,10 +1925,9 @@ fast_path_fill (pixman_implementation_t *imp,
 }
 
 pixman_implementation_t *
-_pixman_implementation_create_fast_path (void)
+_pixman_implementation_create_fast_path (pixman_implementation_t *fallback)
 {
-    pixman_implementation_t *general = _pixman_implementation_create_general ();
-    pixman_implementation_t *imp = _pixman_implementation_create (general, c_fast_paths);
+    pixman_implementation_t *imp = _pixman_implementation_create (fallback, c_fast_paths);
 
     imp->fill = fast_path_fill;
 
index 6daa364..0272347 100644 (file)
@@ -3340,10 +3340,9 @@ mmx_fill (pixman_implementation_t *imp,
 }
 
 pixman_implementation_t *
-_pixman_implementation_create_mmx (void)
+_pixman_implementation_create_mmx (pixman_implementation_t *fallback)
 {
-    pixman_implementation_t *general = _pixman_implementation_create_fast_path ();
-    pixman_implementation_t *imp = _pixman_implementation_create (general, mmx_fast_paths);
+    pixman_implementation_t *imp = _pixman_implementation_create (fallback, mmx_fast_paths);
 
     imp->combine_32[PIXMAN_OP_OVER] = mmx_combine_over_u;
     imp->combine_32[PIXMAN_OP_OVER_REVERSE] = mmx_combine_over_reverse_u;
index 1662d2c..664260b 100644 (file)
@@ -534,31 +534,31 @@ pixman_implementation_t *
 _pixman_implementation_create_general (void);
 
 pixman_implementation_t *
-_pixman_implementation_create_fast_path (void);
+_pixman_implementation_create_fast_path (pixman_implementation_t *fallback);
 
 #ifdef USE_MMX
 pixman_implementation_t *
-_pixman_implementation_create_mmx (void);
+_pixman_implementation_create_mmx (pixman_implementation_t *fallback);
 #endif
 
 #ifdef USE_SSE2
 pixman_implementation_t *
-_pixman_implementation_create_sse2 (void);
+_pixman_implementation_create_sse2 (pixman_implementation_t *fallback);
 #endif
 
 #ifdef USE_ARM_SIMD
 pixman_implementation_t *
-_pixman_implementation_create_arm_simd (void);
+_pixman_implementation_create_arm_simd (pixman_implementation_t *fallback);
 #endif
 
 #ifdef USE_ARM_NEON
 pixman_implementation_t *
-_pixman_implementation_create_arm_neon (void);
+_pixman_implementation_create_arm_neon (pixman_implementation_t *fallback);
 #endif
 
 #ifdef USE_VMX
 pixman_implementation_t *
-_pixman_implementation_create_vmx (void);
+_pixman_implementation_create_vmx (pixman_implementation_t *fallback);
 #endif
 
 pixman_implementation_t *
index 3c0a42f..ae55456 100644 (file)
@@ -5957,13 +5957,8 @@ sse2_fill (pixman_implementation_t *imp,
 __attribute__((__force_align_arg_pointer__))
 #endif
 pixman_implementation_t *
-_pixman_implementation_create_sse2 (void)
+_pixman_implementation_create_sse2 (pixman_implementation_t *fallback)
 {
-#ifdef USE_MMX
-    pixman_implementation_t *fallback = _pixman_implementation_create_mmx ();
-#else
-    pixman_implementation_t *fallback = _pixman_implementation_create_fast_path ();
-#endif
     pixman_implementation_t *imp = _pixman_implementation_create (fallback, sse2_fast_paths);
 
     /* SSE2 constants */
index e811cf7..6868704 100644 (file)
@@ -1613,10 +1613,9 @@ static const pixman_fast_path_t vmx_fast_paths[] =
 };
 
 pixman_implementation_t *
-_pixman_implementation_create_vmx (void)
+_pixman_implementation_create_vmx (pixman_implementation_t *fallback)
 {
-    pixman_implementation_t *fast = _pixman_implementation_create_fast_path ();
-    pixman_implementation_t *imp = _pixman_implementation_create (fast, vmx_fast_paths);
+    pixman_implementation_t *imp = _pixman_implementation_create (fallback, vmx_fast_paths);
 
     /* Set up function pointers */