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 c28c481bb813c7078b5b807cec5c78389317d201..7d6c8377530e1343ae12d5fc4567ab5a53368367 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 dc2f471e3d7b98d814abf5527c10de5a78fd272f..6bbc1094dcd093c7e1bf6a75a1e96f76d6507385 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 70253d1eaedead74c28d202a13a765c663d2cdde..0e14ecb6fc0644ddbff426594f50bf6840748249 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 2f9f176961ac9b6619111f472c85676c51eedd90..eb09715862bbcb6bba4847d5fa76012c2ce8ade9 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 6daa364fbca3e378ab0e4a916a1e98b04e5aaffa..027234773e266174b55dd812b3f14f6a1df7d37f 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 1662d2c464b9ddfc0ad5ac730cfc10c68d60f2fa..664260b9f3ef72d48d86948cd43c0ca0e0db25bf 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 3c0a42f412b941a0fcaecbe0a9136b445c3dc9e1..ae5545604239100e244132dc52d93a330834c785 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 e811cf73328e48e74d990c2db87de420894bcf5f..6868704a875a3bfd097c0e6e00ba0093f6474611 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 */