summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <sandmann@redhat.com>2009-09-14 23:47:39 -0400
committerSøren Sandmann Pedersen <sandmann@redhat.com>2010-02-14 11:12:16 -0500
commit543a04a3bbd2c622842739ab923ff8761c05ed83 (patch)
treecf8f6b6193d609c4fca63e94e2d02f38587d0006
parent376f2a3f853f829c78983a51bffc1bacb9bec9a3 (diff)
Store a pointer to the array of fast paths in the implementation struct.
Also add an empty fast path table to the vmx implementation, so that we can assume sure the pointer is never NULL.
-rw-r--r--pixman/pixman-arm-neon.c7
-rw-r--r--pixman/pixman-arm-simd.c6
-rw-r--r--pixman/pixman-fast-path.c2
-rw-r--r--pixman/pixman-general.c13
-rw-r--r--pixman/pixman-implementation.c7
-rw-r--r--pixman/pixman-mmx.c2
-rw-r--r--pixman/pixman-private.h52
-rw-r--r--pixman/pixman-sse2.c2
-rw-r--r--pixman/pixman-vmx.c7
9 files changed, 51 insertions, 47 deletions
diff --git a/pixman/pixman-arm-neon.c b/pixman/pixman-arm-neon.c
index 26f7267c..c0a75d58 100644
--- a/pixman/pixman-arm-neon.c
+++ b/pixman/pixman-arm-neon.c
@@ -383,7 +383,7 @@ pixman_blt_neon (uint32_t *src_bits,
}
}
-static const pixman_fast_path_t arm_neon_fast_path_array[] =
+static const pixman_fast_path_t arm_neon_fast_paths[] =
{
PIXMAN_STD_FAST_PATH (SRC, r5g6b5, null, r5g6b5, neon_composite_src_0565_0565),
PIXMAN_STD_FAST_PATH (SRC, b5g6r5, null, b5g6r5, neon_composite_src_0565_0565),
@@ -435,8 +435,6 @@ static const pixman_fast_path_t arm_neon_fast_path_array[] =
{ PIXMAN_OP_NONE },
};
-const pixman_fast_path_t *const arm_neon_fast_paths = arm_neon_fast_path_array;
-
static void
arm_neon_composite (pixman_implementation_t *imp,
pixman_op_t op,
@@ -551,7 +549,8 @@ pixman_implementation_t *
_pixman_implementation_create_arm_neon (void)
{
pixman_implementation_t *general = _pixman_implementation_create_fast_path ();
- pixman_implementation_t *imp = _pixman_implementation_create (general);
+ pixman_implementation_t *imp =
+ _pixman_implementation_create (general, arm_neon_fast_paths);
imp->combine_32[PIXMAN_OP_OVER] = neon_combine_over_u;
imp->combine_32[PIXMAN_OP_ADD] = neon_combine_add_u;
diff --git a/pixman/pixman-arm-simd.c b/pixman/pixman-arm-simd.c
index dd8dc5c0..965f810b 100644
--- a/pixman/pixman-arm-simd.c
+++ b/pixman/pixman-arm-simd.c
@@ -419,7 +419,7 @@ arm_composite_over_n_8_8888 (pixman_implementation_t * impl,
}
}
-static const pixman_fast_path_t arm_simd_fast_path_array[] =
+static const pixman_fast_path_t arm_simd_fast_paths[] =
{
PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, null, a8r8g8b8, arm_composite_over_8888_8888),
PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, null, x8r8g8b8, arm_composite_over_8888_8888),
@@ -438,8 +438,6 @@ static const pixman_fast_path_t arm_simd_fast_path_array[] =
{ PIXMAN_OP_NONE },
};
-const pixman_fast_path_t *const arm_simd_fast_paths = arm_simd_fast_path_array;
-
static void
arm_simd_composite (pixman_implementation_t *imp,
pixman_op_t op,
@@ -477,7 +475,7 @@ pixman_implementation_t *
_pixman_implementation_create_arm_simd (void)
{
pixman_implementation_t *general = _pixman_implementation_create_fast_path ();
- pixman_implementation_t *imp = _pixman_implementation_create (general);
+ pixman_implementation_t *imp = _pixman_implementation_create (general, arm_simd_fast_paths);
imp->composite = arm_simd_composite;
diff --git a/pixman/pixman-fast-path.c b/pixman/pixman-fast-path.c
index 72630b41..642848ef 100644
--- a/pixman/pixman-fast-path.c
+++ b/pixman/pixman-fast-path.c
@@ -1770,7 +1770,7 @@ pixman_implementation_t *
_pixman_implementation_create_fast_path (void)
{
pixman_implementation_t *general = _pixman_implementation_create_general ();
- pixman_implementation_t *imp = _pixman_implementation_create (general);
+ pixman_implementation_t *imp = _pixman_implementation_create (general, c_fast_paths);
imp->composite = fast_path_composite;
imp->fill = fast_path_fill;
diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c
index 83500b99..32afd2e4 100644
--- a/pixman/pixman-general.c
+++ b/pixman/pixman-general.c
@@ -266,13 +266,8 @@ general_composite_rect (pixman_implementation_t *imp,
static const pixman_fast_path_t general_fast_path[] =
{
- { PIXMAN_OP_any,
- PIXMAN_any, 0,
- PIXMAN_any, 0,
- PIXMAN_any, 0,
- general_composite_rect,
- },
- { PIXMAN_OP_NONE }
+ { PIXMAN_OP_any, PIXMAN_any, 0, PIXMAN_any, 0, PIXMAN_any, 0, general_composite_rect },
+ { PIXMAN_OP_NONE }
};
static void
@@ -298,7 +293,7 @@ general_composite (pixman_implementation_t * imp,
mask_x, mask_y,
dest_x, dest_y,
width, height);
-
+
assert (result);
}
@@ -339,7 +334,7 @@ general_fill (pixman_implementation_t *imp,
pixman_implementation_t *
_pixman_implementation_create_general (void)
{
- pixman_implementation_t *imp = _pixman_implementation_create (NULL);
+ pixman_implementation_t *imp = _pixman_implementation_create (NULL, general_fast_path);
_pixman_setup_combiner_functions_32 (imp);
_pixman_setup_combiner_functions_64 (imp);
diff --git a/pixman/pixman-implementation.c b/pixman/pixman-implementation.c
index 6488332b..ca1e18f3 100644
--- a/pixman/pixman-implementation.c
+++ b/pixman/pixman-implementation.c
@@ -136,7 +136,8 @@ delegate_fill (pixman_implementation_t *imp,
}
pixman_implementation_t *
-_pixman_implementation_create (pixman_implementation_t *delegate)
+_pixman_implementation_create (pixman_implementation_t *delegate,
+ const pixman_fast_path_t *fast_paths)
{
pixman_implementation_t *imp = malloc (sizeof (pixman_implementation_t));
pixman_implementation_t *d;
@@ -145,6 +146,8 @@ _pixman_implementation_create (pixman_implementation_t *delegate)
if (!imp)
return NULL;
+ assert (fast_paths);
+
/* Make sure the whole delegate chain has the right toplevel */
imp->delegate = delegate;
for (d = imp; d != NULL; d = d->delegate)
@@ -164,6 +167,8 @@ _pixman_implementation_create (pixman_implementation_t *delegate)
imp->combine_64_ca[i] = delegate_combine_64_ca;
}
+ imp->fast_paths = fast_paths;
+
return imp;
}
diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c
index a4affa57..9bbe3179 100644
--- a/pixman/pixman-mmx.c
+++ b/pixman/pixman-mmx.c
@@ -3372,7 +3372,7 @@ pixman_implementation_t *
_pixman_implementation_create_mmx (void)
{
pixman_implementation_t *general = _pixman_implementation_create_fast_path ();
- pixman_implementation_t *imp = _pixman_implementation_create (general);
+ pixman_implementation_t *imp = _pixman_implementation_create (general, 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;
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 8910526c..c956f49e 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -372,7 +372,6 @@ pixman_rasterize_edges_accessors (pixman_image_t *image,
/*
* Implementations
*/
-
typedef struct pixman_implementation_t pixman_implementation_t;
typedef void (*pixman_combine_32_func_t) (pixman_implementation_t *imp,
@@ -428,23 +427,37 @@ typedef pixman_bool_t (*pixman_fill_func_t) (pixman_implementation_t *imp,
void _pixman_setup_combiner_functions_32 (pixman_implementation_t *imp);
void _pixman_setup_combiner_functions_64 (pixman_implementation_t *imp);
-struct pixman_implementation_t
+typedef struct
{
- pixman_implementation_t *toplevel;
- pixman_implementation_t *delegate;
-
- pixman_composite_func_t composite;
- pixman_blt_func_t blt;
- pixman_fill_func_t fill;
+ pixman_op_t op;
+ pixman_format_code_t src_format;
+ uint32_t src_flags;
+ pixman_format_code_t mask_format;
+ uint32_t mask_flags;
+ pixman_format_code_t dest_format;
+ uint32_t dest_flags;
+ pixman_composite_func_t func;
+} pixman_fast_path_t;
- pixman_combine_32_func_t combine_32[PIXMAN_N_OPERATORS];
- pixman_combine_32_func_t combine_32_ca[PIXMAN_N_OPERATORS];
- pixman_combine_64_func_t combine_64[PIXMAN_N_OPERATORS];
- pixman_combine_64_func_t combine_64_ca[PIXMAN_N_OPERATORS];
+struct pixman_implementation_t
+{
+ pixman_implementation_t * toplevel;
+ pixman_implementation_t * delegate;
+ const pixman_fast_path_t * fast_paths;
+
+ pixman_composite_func_t composite;
+ pixman_blt_func_t blt;
+ pixman_fill_func_t fill;
+
+ pixman_combine_32_func_t combine_32[PIXMAN_N_OPERATORS];
+ pixman_combine_32_func_t combine_32_ca[PIXMAN_N_OPERATORS];
+ pixman_combine_64_func_t combine_64[PIXMAN_N_OPERATORS];
+ pixman_combine_64_func_t combine_64_ca[PIXMAN_N_OPERATORS];
};
pixman_implementation_t *
-_pixman_implementation_create (pixman_implementation_t *delegate);
+_pixman_implementation_create (pixman_implementation_t *delegate,
+ const pixman_fast_path_t *fast_paths);
void
_pixman_implementation_combine_32 (pixman_implementation_t *imp,
@@ -489,6 +502,7 @@ _pixman_implementation_composite (pixman_implementation_t *imp,
int32_t width,
int32_t height);
+
pixman_bool_t
_pixman_implementation_blt (pixman_implementation_t *imp,
uint32_t * src_bits,
@@ -603,18 +617,6 @@ _pixman_choose_implementation (void);
(FAST_PATH_NO_ACCESSORS | \
FAST_PATH_NO_WIDE_FORMAT)
-typedef struct
-{
- pixman_op_t op;
- pixman_format_code_t src_format;
- uint32_t src_flags;
- pixman_format_code_t mask_format;
- uint32_t mask_flags;
- pixman_format_code_t dest_format;
- uint32_t dest_flags;
- pixman_composite_func_t func;
-} pixman_fast_path_t;
-
#define FAST_PATH(op, src, src_flags, mask, mask_flags, dest, dest_flags, func) \
PIXMAN_OP_ ## op, \
PIXMAN_ ## src, \
diff --git a/pixman/pixman-sse2.c b/pixman/pixman-sse2.c
index 2bade747..85fb8971 100644
--- a/pixman/pixman-sse2.c
+++ b/pixman/pixman-sse2.c
@@ -5956,7 +5956,7 @@ pixman_implementation_t *
_pixman_implementation_create_sse2 (void)
{
pixman_implementation_t *mmx = _pixman_implementation_create_mmx ();
- pixman_implementation_t *imp = _pixman_implementation_create (mmx);
+ pixman_implementation_t *imp = _pixman_implementation_create (mmx, sse2_fast_paths);
/* SSE2 constants */
mask_565_r = create_mask_2x32_128 (0x00f80000, 0x00f80000);
diff --git a/pixman/pixman-vmx.c b/pixman/pixman-vmx.c
index 06325a7c..e811cf73 100644
--- a/pixman/pixman-vmx.c
+++ b/pixman/pixman-vmx.c
@@ -1607,11 +1607,16 @@ vmx_combine_add_ca (pixman_implementation_t *imp,
}
}
+static const pixman_fast_path_t vmx_fast_paths[] =
+{
+ { PIXMAN_OP_NONE },
+};
+
pixman_implementation_t *
_pixman_implementation_create_vmx (void)
{
pixman_implementation_t *fast = _pixman_implementation_create_fast_path ();
- pixman_implementation_t *imp = _pixman_implementation_create (fast);
+ pixman_implementation_t *imp = _pixman_implementation_create (fast, vmx_fast_paths);
/* Set up function pointers */