From 843964ee791452b197e41dacb0146f5b456ffaa5 Mon Sep 17 00:00:00 2001 From: marha Date: Fri, 15 May 2015 19:14:42 +0200 Subject: randrproto fontconfig libfontenc libxcb mesalib xserver pixman xkeyboard-config git update 15 May 2015 xserver commit bf6344e1913a5d24c2d68eaca999ea3d71e1b707 libxcb commit cb621341a62e6d2233db3e337611f6fdd4f675a6 libxcb/xcb-proto commit 4c550465934164aab2449a125f75f4ca07816233 xkeyboard-config commit 5da6d510b460cad1b31288618cc364e586576826 libX11 commit d3415d1f052530760b4617db45affcb984cfe35c libXdmcp commit b10f382e3aa2e86cd5a2bc27d6758da55f0ab1f6 libXext commit efdcbb7634501e1117d422636a0a75d7ea84b16b libfontenc commit 42f3a39c3085afd9ef904ae39102fd49bbc2e4a5 libXinerama commit edd95182b26eb5d576d4878c559e0f17dddaa909 libXau commit 1e4635be11154dd8262f37b379511bd627defa2a xkbcomp commit 1ae525b3d236b59e6437b2b5433d460e18370973 pixman commit 82f9b4faaf1aa63ec26b0dfd227f1a8e5e139ae2 xextproto commit 66afec3f49e8eb0d4c2e9af7088fc3116d4bafd7 randrproto commit 895ee5264524c7c239ee4ef5e39c4e295323fb51 glproto commit bd3d751e1eb17efb39f65093271bb4ac071aa9e0 mkfontscale commit 87d628f8eec170ec13bb9feefb1ce05aed07d1d6 xwininfo commit 0c49f8f2bd56b1e77721e81030ea948386dcdf4e libXft commit e8a83226bc10afb587f6f34daac44d2ef809c85e libXmu commit 4459e6940fe3fdf26a8d5d4c71989498bc400a62 libxtrans commit 7cbad9fe2e61cd9d5caeaf361826a6f4bd320f03 fontconfig commit 55ff8419274fd5ce59675f220b85035a3986d6cf mesa commit 3687d752e51829b4723c9abb07ae56d2bbcda570 --- pixman/.gitignore | 45 +---- pixman/pixman/pixman-mips-dspr2-asm.h | 2 - pixman/test/Makefile.sources | 1 + pixman/test/solid-test.c | 350 ++++++++++++++++++++++++++++++++++ 4 files changed, 356 insertions(+), 42 deletions(-) create mode 100644 pixman/test/solid-test.c (limited to 'pixman') diff --git a/pixman/.gitignore b/pixman/.gitignore index 7da6b6f79..a245b69f0 100644 --- a/pixman/.gitignore +++ b/pixman/.gitignore @@ -26,62 +26,27 @@ stamp-h? config.h config.h.in .*.swp -demos/alpha-test +demos/*-test demos/checkerboard demos/clip-in -demos/clip-test -demos/composite-test -demos/conical-test -demos/convolution-test -demos/gradient-test demos/linear-gradient demos/quad2quad -demos/radial-test demos/scale -demos/screen-test -demos/srgb-test -demos/srgb-trap-test -demos/trap-test -demos/tri-test pixman/pixman-srgb.c pixman/pixman-version.h -test/a1-trap-test +test/*-test test/affine-bench -test/affine-test test/alpha-loop test/alphamap -test/alpha-test -test/blitters-test +test/check-formats test/clip-in -test/clip-test -test/combiner-test test/composite -test/composite-test -test/composite-traps-test -test/convolution-test -test/fetch-test -test/glyph-test -test/gradient-crash-test -test/gradient-test test/infinite-loop test/lowlevel-blt-bench -test/oob-test -test/pdf-op-test -test/prng-test -test/radial-perf-test -test/region-contains-test -test/region-test +test/radial-invalid test/region-translate -test/region-translate-test -test/rotate-test -test/scaling-crash-test -test/scaling-helpers-test -test/scaling-test -test/screen-test -test/stress-test +test/scaling-bench test/trap-crasher -test/trap-test -test/window-test *.pdb *.dll *.lib diff --git a/pixman/pixman/pixman-mips-dspr2-asm.h b/pixman/pixman/pixman-mips-dspr2-asm.h index 11849bd66..e44edd695 100644 --- a/pixman/pixman/pixman-mips-dspr2-asm.h +++ b/pixman/pixman/pixman-mips-dspr2-asm.h @@ -72,10 +72,8 @@ #define LEAF_MIPS32R2(symbol) \ .globl symbol; \ .align 2; \ -#ifdef __ELF__ .hidden symbol; \ .type symbol, @function; \ -#endif .ent symbol, 0; \ symbol: .frame sp, 0, ra; \ .set push; \ diff --git a/pixman/test/Makefile.sources b/pixman/test/Makefile.sources index 8b0e855e2..d0d79287c 100644 --- a/pixman/test/Makefile.sources +++ b/pixman/test/Makefile.sources @@ -23,6 +23,7 @@ TESTPROGRAMS = \ composite-traps-test \ region-contains-test \ glyph-test \ + solid-test \ stress-test \ blitters-test \ affine-test \ diff --git a/pixman/test/solid-test.c b/pixman/test/solid-test.c new file mode 100644 index 000000000..7be546678 --- /dev/null +++ b/pixman/test/solid-test.c @@ -0,0 +1,350 @@ +/* + * Copyright © 2015 RISC OS Open Ltd + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of the copyright holders not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. The copyright holders make no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * + * Author: Ben Avison (bavison@riscosopen.org) + * + */ + +#include "utils.h" +#include +#include + +#define WIDTH 32 +#define HEIGHT 32 + +static const pixman_op_t op_list[] = { + PIXMAN_OP_SRC, + PIXMAN_OP_OVER, + PIXMAN_OP_ADD, + PIXMAN_OP_CLEAR, + PIXMAN_OP_SRC, + PIXMAN_OP_DST, + PIXMAN_OP_OVER, + PIXMAN_OP_OVER_REVERSE, + PIXMAN_OP_IN, + PIXMAN_OP_IN_REVERSE, + PIXMAN_OP_OUT, + PIXMAN_OP_OUT_REVERSE, + PIXMAN_OP_ATOP, + PIXMAN_OP_ATOP_REVERSE, + PIXMAN_OP_XOR, + PIXMAN_OP_ADD, + PIXMAN_OP_MULTIPLY, + PIXMAN_OP_SCREEN, + PIXMAN_OP_OVERLAY, + PIXMAN_OP_DARKEN, + PIXMAN_OP_LIGHTEN, + PIXMAN_OP_HARD_LIGHT, + PIXMAN_OP_DIFFERENCE, + PIXMAN_OP_EXCLUSION, +#if 0 /* these use floating point math and are not always bitexact on different platforms */ + PIXMAN_OP_SATURATE, + PIXMAN_OP_DISJOINT_CLEAR, + PIXMAN_OP_DISJOINT_SRC, + PIXMAN_OP_DISJOINT_DST, + PIXMAN_OP_DISJOINT_OVER, + PIXMAN_OP_DISJOINT_OVER_REVERSE, + PIXMAN_OP_DISJOINT_IN, + PIXMAN_OP_DISJOINT_IN_REVERSE, + PIXMAN_OP_DISJOINT_OUT, + PIXMAN_OP_DISJOINT_OUT_REVERSE, + PIXMAN_OP_DISJOINT_ATOP, + PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_OP_DISJOINT_XOR, + PIXMAN_OP_CONJOINT_CLEAR, + PIXMAN_OP_CONJOINT_SRC, + PIXMAN_OP_CONJOINT_DST, + PIXMAN_OP_CONJOINT_OVER, + PIXMAN_OP_CONJOINT_OVER_REVERSE, + PIXMAN_OP_CONJOINT_IN, + PIXMAN_OP_CONJOINT_IN_REVERSE, + PIXMAN_OP_CONJOINT_OUT, + PIXMAN_OP_CONJOINT_OUT_REVERSE, + PIXMAN_OP_CONJOINT_ATOP, + PIXMAN_OP_CONJOINT_ATOP_REVERSE, + PIXMAN_OP_CONJOINT_XOR, + PIXMAN_OP_COLOR_DODGE, + PIXMAN_OP_COLOR_BURN, + PIXMAN_OP_SOFT_LIGHT, + PIXMAN_OP_HSL_HUE, + PIXMAN_OP_HSL_SATURATION, + PIXMAN_OP_HSL_COLOR, + PIXMAN_OP_HSL_LUMINOSITY, +#endif +}; + +/* The first eight format in the list are by far the most widely + * used formats, so we test those more than the others + */ +#define N_MOST_LIKELY_FORMATS 8 + +static const pixman_format_code_t img_fmt_list[] = { + PIXMAN_a8r8g8b8, + PIXMAN_a8b8g8r8, + PIXMAN_x8r8g8b8, + PIXMAN_x8b8g8r8, + PIXMAN_r5g6b5, + PIXMAN_b5g6r5, + PIXMAN_a8, + PIXMAN_a1, + PIXMAN_r3g3b2, + PIXMAN_b8g8r8a8, + PIXMAN_b8g8r8x8, + PIXMAN_r8g8b8a8, + PIXMAN_r8g8b8x8, + PIXMAN_x14r6g6b6, + PIXMAN_r8g8b8, + PIXMAN_b8g8r8, +#if 0 /* These are going to use floating point in the near future */ + PIXMAN_x2r10g10b10, + PIXMAN_a2r10g10b10, + PIXMAN_x2b10g10r10, + PIXMAN_a2b10g10r10, +#endif + PIXMAN_a1r5g5b5, + PIXMAN_x1r5g5b5, + PIXMAN_a1b5g5r5, + PIXMAN_x1b5g5r5, + PIXMAN_a4r4g4b4, + PIXMAN_x4r4g4b4, + PIXMAN_a4b4g4r4, + PIXMAN_x4b4g4r4, + PIXMAN_r3g3b2, + PIXMAN_b2g3r3, + PIXMAN_a2r2g2b2, + PIXMAN_a2b2g2r2, + PIXMAN_c8, + PIXMAN_g8, + PIXMAN_x4c4, + PIXMAN_x4g4, + PIXMAN_c4, + PIXMAN_g4, + PIXMAN_g1, + PIXMAN_x4a4, + PIXMAN_a4, + PIXMAN_r1g2b1, + PIXMAN_b1g2r1, + PIXMAN_a1r1g1b1, + PIXMAN_a1b1g1r1, + PIXMAN_null +}; + +static const pixman_format_code_t mask_fmt_list[] = { + PIXMAN_a8r8g8b8, + PIXMAN_a8, + PIXMAN_a4, + PIXMAN_a1, + PIXMAN_null +}; + +static pixman_indexed_t rgb_palette[9]; +static pixman_indexed_t y_palette[9]; + +static pixman_format_code_t +random_format (const pixman_format_code_t *allowed_formats) +{ + int n = 0; + + while (allowed_formats[n] != PIXMAN_null) + n++; + + if (n > N_MOST_LIKELY_FORMATS && prng_rand_n (4) != 0) + n = N_MOST_LIKELY_FORMATS; + + return allowed_formats[prng_rand_n (n)]; +} + +static pixman_image_t * +create_multi_pixel_image (const pixman_format_code_t *allowed_formats, + uint32_t *buffer, + pixman_format_code_t *used_fmt) +{ + pixman_format_code_t fmt; + pixman_image_t *img; + int stride; + + fmt = random_format (allowed_formats); + stride = (WIDTH * PIXMAN_FORMAT_BPP (fmt) + 31) / 32 * 4; + img = pixman_image_create_bits (fmt, WIDTH, HEIGHT, buffer, stride); + + if (PIXMAN_FORMAT_TYPE (fmt) == PIXMAN_TYPE_COLOR) + pixman_image_set_indexed (img, &(rgb_palette[PIXMAN_FORMAT_BPP (fmt)])); + else if (PIXMAN_FORMAT_TYPE (fmt) == PIXMAN_TYPE_GRAY) + pixman_image_set_indexed (img, &(y_palette[PIXMAN_FORMAT_BPP (fmt)])); + + prng_randmemset (buffer, WIDTH * HEIGHT * 4, 0); + image_endian_swap (img); + + if (used_fmt) + *used_fmt = fmt; + + return img; +} + +static pixman_image_t * +create_solid_image (const pixman_format_code_t *allowed_formats, + uint32_t *buffer, + pixman_format_code_t *used_fmt) +{ + if (prng_rand_n (2)) + { + /* Use a repeating 1x1 bitmap image for solid */ + pixman_format_code_t fmt; + pixman_image_t *img, *dummy_img; + uint32_t bpp, dummy_buf; + + fmt = random_format (allowed_formats); + bpp = PIXMAN_FORMAT_BPP (fmt); + img = pixman_image_create_bits (fmt, 1, 1, buffer, 4); + pixman_image_set_repeat (img, PIXMAN_REPEAT_NORMAL); + + if (PIXMAN_FORMAT_TYPE (fmt) == PIXMAN_TYPE_COLOR) + pixman_image_set_indexed (img, &(rgb_palette[bpp])); + else if (PIXMAN_FORMAT_TYPE (fmt) == PIXMAN_TYPE_GRAY) + pixman_image_set_indexed (img, &(y_palette[bpp])); + + /* Force the flags to be calculated for image with initial + * bitmap contents of 0 or 2^bpp-1 by plotting from it into a + * separate throwaway image. It is simplest to write all 0s + * or all 1s to the first word irrespective of the colour + * depth even though we actually only care about the first + * pixel since the stride has to be a whole number of words. + */ + *buffer = prng_rand_n (2) ? 0xFFFFFFFFu : 0; + dummy_img = pixman_image_create_bits (PIXMAN_a8r8g8b8, 1, 1, + &dummy_buf, 4); + pixman_image_composite (PIXMAN_OP_SRC, img, NULL, dummy_img, + 0, 0, 0, 0, 0, 0, 1, 1); + pixman_image_unref (dummy_img); + + /* Now set the bitmap contents to a random value */ + *buffer = prng_rand (); + image_endian_swap (img); + + if (used_fmt) + *used_fmt = fmt; + + return img; + } + else + { + /* Use a native solid image */ + pixman_color_t color; + pixman_image_t *img; + + prng_randmemset (&color, sizeof color, 0); + img = pixman_image_create_solid_fill (&color); + + if (used_fmt) + *used_fmt = PIXMAN_solid; + + return img; + } +} + +static uint32_t +test_solid (int testnum, int verbose) +{ + pixman_op_t op; + uint32_t src_buf[WIDTH * HEIGHT]; + uint32_t dst_buf[WIDTH * HEIGHT]; + uint32_t mask_buf[WIDTH * HEIGHT]; + pixman_image_t *src_img; + pixman_image_t *dst_img; + pixman_image_t *mask_img = NULL; + pixman_format_code_t src_fmt, dst_fmt, mask_fmt = PIXMAN_null; + pixman_bool_t ca = 0; + uint32_t crc32; + + prng_srand (testnum); + + op = op_list[prng_rand_n (ARRAY_LENGTH (op_list))]; + + dst_img = create_multi_pixel_image (img_fmt_list, dst_buf, &dst_fmt); + switch (prng_rand_n (3)) + { + case 0: /* Solid source, no mask */ + src_img = create_solid_image (img_fmt_list, src_buf, &src_fmt); + break; + case 1: /* Solid source, bitmap mask */ + src_img = create_solid_image (img_fmt_list, src_buf, &src_fmt); + mask_img = create_multi_pixel_image (mask_fmt_list, mask_buf, &mask_fmt); + break; + case 2: /* Bitmap image, solid mask */ + src_img = create_multi_pixel_image (img_fmt_list, src_buf, &src_fmt); + mask_img = create_solid_image (mask_fmt_list, mask_buf, &mask_fmt); + break; + default: + abort (); + } + + if (mask_img) + { + ca = prng_rand_n (2); + pixman_image_set_component_alpha (mask_img, ca); + } + + if (verbose) + { + printf ("op=%s\n", operator_name (op)); + printf ("src_fmt=%s, dst_fmt=%s, mask_fmt=%s\n", + format_name (src_fmt), format_name (dst_fmt), + format_name (mask_fmt)); + printf ("src_size=%u, mask_size=%u, component_alpha=%u\n", + src_fmt == PIXMAN_solid ? 1 : src_img->bits.width, + !mask_img || mask_fmt == PIXMAN_solid ? 1 : mask_img->bits.width, + ca); + } + + pixman_image_composite (op, src_img, mask_img, dst_img, + 0, 0, 0, 0, 0, 0, WIDTH, HEIGHT); + + if (verbose) + print_image (dst_img); + + crc32 = compute_crc32_for_image (0, dst_img); + + pixman_image_unref (src_img); + pixman_image_unref (dst_img); + if (mask_img) + pixman_image_unref (mask_img); + + return crc32; +} + +int +main (int argc, const char *argv[]) +{ + int i; + + prng_srand (0); + + for (i = 1; i <= 8; i++) + { + initialize_palette (&(rgb_palette[i]), i, TRUE); + initialize_palette (&(y_palette[i]), i, FALSE); + } + + return fuzzer_test_main ("solid", 500000, + 0x1B6DFF8D, + test_solid, argc, argv); +} -- cgit v1.2.3