diff options
Diffstat (limited to 'libs/pixman-0.40.0/test')
46 files changed, 17575 insertions, 0 deletions
diff --git a/libs/pixman-0.40.0/test/Makefile.am b/libs/pixman-0.40.0/test/Makefile.am new file mode 100644 index 0000000..6dbed88 --- /dev/null +++ b/libs/pixman-0.40.0/test/Makefile.am @@ -0,0 +1,17 @@ +include $(top_srcdir)/test/Makefile.sources + +AM_CFLAGS = $(OPENMP_CFLAGS) $(PTHREAD_CFLAGS) +AM_LDFLAGS = $(OPENMP_CFLAGS) $(TESTPROGS_EXTRA_LDFLAGS) $(PTHREAD_LDFLAGS) +LDADD = libutils.la $(top_builddir)/pixman/libpixman-1.la -lm $(PNG_LIBS) $(PTHREAD_LIBS) +AM_CPPFLAGS = -I$(top_srcdir)/pixman -I$(top_builddir)/pixman $(PNG_CFLAGS) + +libutils_la_SOURCES = $(libutils_sources) $(libutils_headers) + +noinst_LTLIBRARIES = libutils.la +noinst_PROGRAMS = $(TESTPROGRAMS) $(OTHERPROGRAMS) + +TESTS = $(TESTPROGRAMS) + +EXTRA_DIST = \ + meson.build \ + $(NULL) diff --git a/libs/pixman-0.40.0/test/Makefile.in b/libs/pixman-0.40.0/test/Makefile.in new file mode 100644 index 0000000..3f8c517 --- /dev/null +++ b/libs/pixman-0.40.0/test/Makefile.in @@ -0,0 +1,1864 @@ +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +noinst_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) +TESTS = $(am__EXEEXT_1) +subdir = test +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__EXEEXT_1 = oob-test$(EXEEXT) infinite-loop$(EXEEXT) \ + trap-crasher$(EXEEXT) fence-image-self-test$(EXEEXT) \ + region-translate-test$(EXEEXT) fetch-test$(EXEEXT) \ + a1-trap-test$(EXEEXT) prng-test$(EXEEXT) \ + radial-invalid$(EXEEXT) pdf-op-test$(EXEEXT) \ + region-test$(EXEEXT) combiner-test$(EXEEXT) \ + scaling-crash-test$(EXEEXT) alpha-loop$(EXEEXT) \ + scaling-helpers-test$(EXEEXT) thread-test$(EXEEXT) \ + rotate-test$(EXEEXT) alphamap$(EXEEXT) \ + gradient-crash-test$(EXEEXT) pixel-test$(EXEEXT) \ + matrix-test$(EXEEXT) filter-reduction-test$(EXEEXT) \ + composite-traps-test$(EXEEXT) region-contains-test$(EXEEXT) \ + glyph-test$(EXEEXT) solid-test$(EXEEXT) stress-test$(EXEEXT) \ + cover-test$(EXEEXT) blitters-test$(EXEEXT) \ + affine-test$(EXEEXT) scaling-test$(EXEEXT) composite$(EXEEXT) \ + tolerance-test$(EXEEXT) +am__EXEEXT_2 = lowlevel-blt-bench$(EXEEXT) radial-perf-test$(EXEEXT) \ + check-formats$(EXEEXT) scaling-bench$(EXEEXT) \ + affine-bench$(EXEEXT) +PROGRAMS = $(noinst_PROGRAMS) +LTLIBRARIES = $(noinst_LTLIBRARIES) +libutils_la_LIBADD = +am__objects_1 = utils.lo utils-prng.lo +am__objects_2 = +am_libutils_la_OBJECTS = $(am__objects_1) $(am__objects_2) +libutils_la_OBJECTS = $(am_libutils_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +a1_trap_test_SOURCES = a1-trap-test.c +a1_trap_test_OBJECTS = a1-trap-test.$(OBJEXT) +a1_trap_test_LDADD = $(LDADD) +am__DEPENDENCIES_1 = +a1_trap_test_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +affine_bench_SOURCES = affine-bench.c +affine_bench_OBJECTS = affine-bench.$(OBJEXT) +affine_bench_LDADD = $(LDADD) +affine_bench_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +affine_test_SOURCES = affine-test.c +affine_test_OBJECTS = affine-test.$(OBJEXT) +affine_test_LDADD = $(LDADD) +affine_test_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +alpha_loop_SOURCES = alpha-loop.c +alpha_loop_OBJECTS = alpha-loop.$(OBJEXT) +alpha_loop_LDADD = $(LDADD) +alpha_loop_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +alphamap_SOURCES = alphamap.c +alphamap_OBJECTS = alphamap.$(OBJEXT) +alphamap_LDADD = $(LDADD) +alphamap_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +blitters_test_SOURCES = blitters-test.c +blitters_test_OBJECTS = blitters-test.$(OBJEXT) +blitters_test_LDADD = $(LDADD) +blitters_test_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +check_formats_SOURCES = check-formats.c +check_formats_OBJECTS = check-formats.$(OBJEXT) +check_formats_LDADD = $(LDADD) +check_formats_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +combiner_test_SOURCES = combiner-test.c +combiner_test_OBJECTS = combiner-test.$(OBJEXT) +combiner_test_LDADD = $(LDADD) +combiner_test_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +composite_SOURCES = composite.c +composite_OBJECTS = composite.$(OBJEXT) +composite_LDADD = $(LDADD) +composite_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +composite_traps_test_SOURCES = composite-traps-test.c +composite_traps_test_OBJECTS = composite-traps-test.$(OBJEXT) +composite_traps_test_LDADD = $(LDADD) +composite_traps_test_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +cover_test_SOURCES = cover-test.c +cover_test_OBJECTS = cover-test.$(OBJEXT) +cover_test_LDADD = $(LDADD) +cover_test_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +fence_image_self_test_SOURCES = fence-image-self-test.c +fence_image_self_test_OBJECTS = fence-image-self-test.$(OBJEXT) +fence_image_self_test_LDADD = $(LDADD) +fence_image_self_test_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +fetch_test_SOURCES = fetch-test.c +fetch_test_OBJECTS = fetch-test.$(OBJEXT) +fetch_test_LDADD = $(LDADD) +fetch_test_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +filter_reduction_test_SOURCES = filter-reduction-test.c +filter_reduction_test_OBJECTS = filter-reduction-test.$(OBJEXT) +filter_reduction_test_LDADD = $(LDADD) +filter_reduction_test_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +glyph_test_SOURCES = glyph-test.c +glyph_test_OBJECTS = glyph-test.$(OBJEXT) +glyph_test_LDADD = $(LDADD) +glyph_test_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +gradient_crash_test_SOURCES = gradient-crash-test.c +gradient_crash_test_OBJECTS = gradient-crash-test.$(OBJEXT) +gradient_crash_test_LDADD = $(LDADD) +gradient_crash_test_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +infinite_loop_SOURCES = infinite-loop.c +infinite_loop_OBJECTS = infinite-loop.$(OBJEXT) +infinite_loop_LDADD = $(LDADD) +infinite_loop_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +lowlevel_blt_bench_SOURCES = lowlevel-blt-bench.c +lowlevel_blt_bench_OBJECTS = lowlevel-blt-bench.$(OBJEXT) +lowlevel_blt_bench_LDADD = $(LDADD) +lowlevel_blt_bench_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +matrix_test_SOURCES = matrix-test.c +matrix_test_OBJECTS = matrix-test.$(OBJEXT) +matrix_test_LDADD = $(LDADD) +matrix_test_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +oob_test_SOURCES = oob-test.c +oob_test_OBJECTS = oob-test.$(OBJEXT) +oob_test_LDADD = $(LDADD) +oob_test_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +pdf_op_test_SOURCES = pdf-op-test.c +pdf_op_test_OBJECTS = pdf-op-test.$(OBJEXT) +pdf_op_test_LDADD = $(LDADD) +pdf_op_test_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +pixel_test_SOURCES = pixel-test.c +pixel_test_OBJECTS = pixel-test.$(OBJEXT) +pixel_test_LDADD = $(LDADD) +pixel_test_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +prng_test_SOURCES = prng-test.c +prng_test_OBJECTS = prng-test.$(OBJEXT) +prng_test_LDADD = $(LDADD) +prng_test_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +radial_invalid_SOURCES = radial-invalid.c +radial_invalid_OBJECTS = radial-invalid.$(OBJEXT) +radial_invalid_LDADD = $(LDADD) +radial_invalid_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +radial_perf_test_SOURCES = radial-perf-test.c +radial_perf_test_OBJECTS = radial-perf-test.$(OBJEXT) +radial_perf_test_LDADD = $(LDADD) +radial_perf_test_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +region_contains_test_SOURCES = region-contains-test.c +region_contains_test_OBJECTS = region-contains-test.$(OBJEXT) +region_contains_test_LDADD = $(LDADD) +region_contains_test_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +region_test_SOURCES = region-test.c +region_test_OBJECTS = region-test.$(OBJEXT) +region_test_LDADD = $(LDADD) +region_test_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +region_translate_test_SOURCES = region-translate-test.c +region_translate_test_OBJECTS = region-translate-test.$(OBJEXT) +region_translate_test_LDADD = $(LDADD) +region_translate_test_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +rotate_test_SOURCES = rotate-test.c +rotate_test_OBJECTS = rotate-test.$(OBJEXT) +rotate_test_LDADD = $(LDADD) +rotate_test_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +scaling_bench_SOURCES = scaling-bench.c +scaling_bench_OBJECTS = scaling-bench.$(OBJEXT) +scaling_bench_LDADD = $(LDADD) +scaling_bench_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +scaling_crash_test_SOURCES = scaling-crash-test.c +scaling_crash_test_OBJECTS = scaling-crash-test.$(OBJEXT) +scaling_crash_test_LDADD = $(LDADD) +scaling_crash_test_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +scaling_helpers_test_SOURCES = scaling-helpers-test.c +scaling_helpers_test_OBJECTS = scaling-helpers-test.$(OBJEXT) +scaling_helpers_test_LDADD = $(LDADD) +scaling_helpers_test_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +scaling_test_SOURCES = scaling-test.c +scaling_test_OBJECTS = scaling-test.$(OBJEXT) +scaling_test_LDADD = $(LDADD) +scaling_test_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +solid_test_SOURCES = solid-test.c +solid_test_OBJECTS = solid-test.$(OBJEXT) +solid_test_LDADD = $(LDADD) +solid_test_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +stress_test_SOURCES = stress-test.c +stress_test_OBJECTS = stress-test.$(OBJEXT) +stress_test_LDADD = $(LDADD) +stress_test_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +thread_test_SOURCES = thread-test.c +thread_test_OBJECTS = thread-test.$(OBJEXT) +thread_test_LDADD = $(LDADD) +thread_test_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +tolerance_test_SOURCES = tolerance-test.c +tolerance_test_OBJECTS = tolerance-test.$(OBJEXT) +tolerance_test_LDADD = $(LDADD) +tolerance_test_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +trap_crasher_SOURCES = trap-crasher.c +trap_crasher_OBJECTS = trap-crasher.$(OBJEXT) +trap_crasher_LDADD = $(LDADD) +trap_crasher_DEPENDENCIES = libutils.la \ + $(top_builddir)/pixman/libpixman-1.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/a1-trap-test.Po \ + ./$(DEPDIR)/affine-bench.Po ./$(DEPDIR)/affine-test.Po \ + ./$(DEPDIR)/alpha-loop.Po ./$(DEPDIR)/alphamap.Po \ + ./$(DEPDIR)/blitters-test.Po ./$(DEPDIR)/check-formats.Po \ + ./$(DEPDIR)/combiner-test.Po \ + ./$(DEPDIR)/composite-traps-test.Po ./$(DEPDIR)/composite.Po \ + ./$(DEPDIR)/cover-test.Po ./$(DEPDIR)/fence-image-self-test.Po \ + ./$(DEPDIR)/fetch-test.Po ./$(DEPDIR)/filter-reduction-test.Po \ + ./$(DEPDIR)/glyph-test.Po ./$(DEPDIR)/gradient-crash-test.Po \ + ./$(DEPDIR)/infinite-loop.Po ./$(DEPDIR)/lowlevel-blt-bench.Po \ + ./$(DEPDIR)/matrix-test.Po ./$(DEPDIR)/oob-test.Po \ + ./$(DEPDIR)/pdf-op-test.Po ./$(DEPDIR)/pixel-test.Po \ + ./$(DEPDIR)/prng-test.Po ./$(DEPDIR)/radial-invalid.Po \ + ./$(DEPDIR)/radial-perf-test.Po \ + ./$(DEPDIR)/region-contains-test.Po ./$(DEPDIR)/region-test.Po \ + ./$(DEPDIR)/region-translate-test.Po \ + ./$(DEPDIR)/rotate-test.Po ./$(DEPDIR)/scaling-bench.Po \ + ./$(DEPDIR)/scaling-crash-test.Po \ + ./$(DEPDIR)/scaling-helpers-test.Po \ + ./$(DEPDIR)/scaling-test.Po ./$(DEPDIR)/solid-test.Po \ + ./$(DEPDIR)/stress-test.Po ./$(DEPDIR)/thread-test.Po \ + ./$(DEPDIR)/tolerance-test.Po ./$(DEPDIR)/trap-crasher.Po \ + ./$(DEPDIR)/utils-prng.Plo ./$(DEPDIR)/utils.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libutils_la_SOURCES) a1-trap-test.c affine-bench.c \ + affine-test.c alpha-loop.c alphamap.c blitters-test.c \ + check-formats.c combiner-test.c composite.c \ + composite-traps-test.c cover-test.c fence-image-self-test.c \ + fetch-test.c filter-reduction-test.c glyph-test.c \ + gradient-crash-test.c infinite-loop.c lowlevel-blt-bench.c \ + matrix-test.c oob-test.c pdf-op-test.c pixel-test.c \ + prng-test.c radial-invalid.c radial-perf-test.c \ + region-contains-test.c region-test.c region-translate-test.c \ + rotate-test.c scaling-bench.c scaling-crash-test.c \ + scaling-helpers-test.c scaling-test.c solid-test.c \ + stress-test.c thread-test.c tolerance-test.c trap-crasher.c +DIST_SOURCES = $(libutils_la_SOURCES) a1-trap-test.c affine-bench.c \ + affine-test.c alpha-loop.c alphamap.c blitters-test.c \ + check-formats.c combiner-test.c composite.c \ + composite-traps-test.c cover-test.c fence-image-self-test.c \ + fetch-test.c filter-reduction-test.c glyph-test.c \ + gradient-crash-test.c infinite-loop.c lowlevel-blt-bench.c \ + matrix-test.c oob-test.c pdf-op-test.c pixel-test.c \ + prng-test.c radial-invalid.c radial-perf-test.c \ + region-contains-test.c region-test.c region-translate-test.c \ + rotate-test.c scaling-bench.c scaling-crash-test.c \ + scaling-helpers-test.c scaling-test.c solid-test.c \ + stress-test.c thread-test.c tolerance-test.c trap-crasher.c +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__tty_colors_dummy = \ + mgn= red= grn= lgn= blu= brg= std=; \ + am__color_tests=no +am__tty_colors = { \ + $(am__tty_colors_dummy); \ + if test "X$(AM_COLOR_TESTS)" = Xno; then \ + am__color_tests=no; \ + elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ + am__color_tests=yes; \ + elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ + am__color_tests=yes; \ + fi; \ + if test $$am__color_tests = yes; then \ + red='[0;31m'; \ + grn='[0;32m'; \ + lgn='[1;32m'; \ + blu='[1;34m'; \ + mgn='[0;35m'; \ + brg='[1m'; \ + std='[m'; \ + fi; \ +} +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__recheck_rx = ^[ ]*:recheck:[ ]* +am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* +am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* +# A command that, given a newline-separated list of test names on the +# standard input, print the name of the tests that are to be re-run +# upon "make recheck". +am__list_recheck_tests = $(AWK) '{ \ + recheck = 1; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + { \ + if ((getline line2 < ($$0 ".log")) < 0) \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ + { \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ + { \ + break; \ + } \ + }; \ + if (recheck) \ + print $$0; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# A command that, given a newline-separated list of test names on the +# standard input, create the global log from their .trs and .log files. +am__create_global_log = $(AWK) ' \ +function fatal(msg) \ +{ \ + print "fatal: making $@: " msg | "cat >&2"; \ + exit 1; \ +} \ +function rst_section(header) \ +{ \ + print header; \ + len = length(header); \ + for (i = 1; i <= len; i = i + 1) \ + printf "="; \ + printf "\n\n"; \ +} \ +{ \ + copy_in_global_log = 1; \ + global_test_result = "RUN"; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".trs"); \ + if (line ~ /$(am__global_test_result_rx)/) \ + { \ + sub("$(am__global_test_result_rx)", "", line); \ + sub("[ ]*$$", "", line); \ + global_test_result = line; \ + } \ + else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ + copy_in_global_log = 0; \ + }; \ + if (copy_in_global_log) \ + { \ + rst_section(global_test_result ": " $$0); \ + while ((rc = (getline line < ($$0 ".log"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".log"); \ + print line; \ + }; \ + printf "\n"; \ + }; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# Restructured Text title. +am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } +# Solaris 10 'make', and several other traditional 'make' implementations, +# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it +# by disabling -e (using the XSI extension "set +e") if it's set. +am__sh_e_setup = case $$- in *e*) set +e;; esac +# Default flags passed to test drivers. +am__common_driver_flags = \ + --color-tests "$$am__color_tests" \ + --enable-hard-errors "$$am__enable_hard_errors" \ + --expect-failure "$$am__expect_failure" +# To be inserted before the command running the test. Creates the +# directory for the log if needed. Stores in $dir the directory +# containing $f, in $tst the test, in $log the log. Executes the +# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and +# passes TESTS_ENVIRONMENT. Set up options for the wrapper that +# will run the test scripts (or their associated LOG_COMPILER, if +# thy have one). +am__check_pre = \ +$(am__sh_e_setup); \ +$(am__vpath_adj_setup) $(am__vpath_adj) \ +$(am__tty_colors); \ +srcdir=$(srcdir); export srcdir; \ +case "$@" in \ + */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ + *) am__odir=.;; \ +esac; \ +test "x$$am__odir" = x"." || test -d "$$am__odir" \ + || $(MKDIR_P) "$$am__odir" || exit $$?; \ +if test -f "./$$f"; then dir=./; \ +elif test -f "$$f"; then dir=; \ +else dir="$(srcdir)/"; fi; \ +tst=$$dir$$f; log='$@'; \ +if test -n '$(DISABLE_HARD_ERRORS)'; then \ + am__enable_hard_errors=no; \ +else \ + am__enable_hard_errors=yes; \ +fi; \ +case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ + am__expect_failure=yes;; \ + *) \ + am__expect_failure=no;; \ +esac; \ +$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) +# A shell command to get the names of the tests scripts with any registered +# extension removed (i.e., equivalently, the names of the test logs, with +# the '.log' extension removed). The result is saved in the shell variable +# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, +# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", +# since that might cause problem with VPATH rewrites for suffix-less tests. +# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. +am__set_TESTS_bases = \ + bases='$(TEST_LOGS)'; \ + bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ + bases=`echo $$bases` +RECHECK_LOGS = $(TEST_LOGS) +AM_RECURSIVE_TARGETS = check recheck +TEST_SUITE_LOG = test-suite.log +TEST_EXTENSIONS = @EXEEXT@ .test +LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver +LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) +am__set_b = \ + case '$@' in \ + */*) \ + case '$*' in \ + */*) b='$*';; \ + *) b=`echo '$@' | sed 's/\.log$$//'`; \ + esac;; \ + *) \ + b='$*';; \ + esac +am__test_logs1 = $(TESTS:=.log) +am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) +TEST_LOGS = $(am__test_logs2:.test.log=.log) +TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver +TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ + $(TEST_LOG_FLAGS) +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ + $(top_srcdir)/test-driver $(top_srcdir)/test/Makefile.sources +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +HAVE_LIBPNG = @HAVE_LIBPNG@ +HAVE_PTHREADS = @HAVE_PTHREADS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +IWMMXT_CFLAGS = @IWMMXT_CFLAGS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LS_CFLAGS = @LS_CFLAGS@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +LT_VERSION_INFO = @LT_VERSION_INFO@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MMX_CFLAGS = @MMX_CFLAGS@ +MMX_LDFLAGS = @MMX_LDFLAGS@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENMP_CFLAGS = @OPENMP_CFLAGS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXMAN_GNUPLOT = @PIXMAN_GNUPLOT@ +PIXMAN_TIMERS = @PIXMAN_TIMERS@ +PIXMAN_VERSION_MAJOR = @PIXMAN_VERSION_MAJOR@ +PIXMAN_VERSION_MICRO = @PIXMAN_VERSION_MICRO@ +PIXMAN_VERSION_MINOR = @PIXMAN_VERSION_MINOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PNG_CFLAGS = @PNG_CFLAGS@ +PNG_LIBS = @PNG_LIBS@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LDFLAGS = @PTHREAD_LDFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSE2_CFLAGS = @SSE2_CFLAGS@ +SSE2_LDFLAGS = @SSE2_LDFLAGS@ +SSSE3_CFLAGS = @SSSE3_CFLAGS@ +STRIP = @STRIP@ +TESTPROGS_EXTRA_LDFLAGS = @TESTPROGS_EXTRA_LDFLAGS@ +TOOLCHAIN_SUPPORTS_ATTRIBUTE_CONSTRUCTOR = @TOOLCHAIN_SUPPORTS_ATTRIBUTE_CONSTRUCTOR@ +TOOLCHAIN_SUPPORTS__THREAD = @TOOLCHAIN_SUPPORTS__THREAD@ +VERSION = @VERSION@ +VMX_CFLAGS = @VMX_CFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +# Tests (sorted by expected completion time) +TESTPROGRAMS = \ + oob-test \ + infinite-loop \ + trap-crasher \ + fence-image-self-test \ + region-translate-test \ + fetch-test \ + a1-trap-test \ + prng-test \ + radial-invalid \ + pdf-op-test \ + region-test \ + combiner-test \ + scaling-crash-test \ + alpha-loop \ + scaling-helpers-test \ + thread-test \ + rotate-test \ + alphamap \ + gradient-crash-test \ + pixel-test \ + matrix-test \ + filter-reduction-test \ + composite-traps-test \ + region-contains-test \ + glyph-test \ + solid-test \ + stress-test \ + cover-test \ + blitters-test \ + affine-test \ + scaling-test \ + composite \ + tolerance-test \ + $(NULL) + + +# Other programs +OTHERPROGRAMS = \ + lowlevel-blt-bench \ + radial-perf-test \ + check-formats \ + scaling-bench \ + affine-bench \ + $(NULL) + + +# Utility functions +libutils_sources = \ + utils.c \ + utils-prng.c \ + $(NULL) + +libutils_headers = \ + utils.h \ + utils-prng.h \ + $(NULL) + +AM_CFLAGS = $(OPENMP_CFLAGS) $(PTHREAD_CFLAGS) +AM_LDFLAGS = $(OPENMP_CFLAGS) $(TESTPROGS_EXTRA_LDFLAGS) $(PTHREAD_LDFLAGS) +LDADD = libutils.la $(top_builddir)/pixman/libpixman-1.la -lm $(PNG_LIBS) $(PTHREAD_LIBS) +AM_CPPFLAGS = -I$(top_srcdir)/pixman -I$(top_builddir)/pixman $(PNG_CFLAGS) +libutils_la_SOURCES = $(libutils_sources) $(libutils_headers) +noinst_LTLIBRARIES = libutils.la +EXTRA_DIST = \ + meson.build \ + $(NULL) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/test/Makefile.sources $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign test/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; +$(top_srcdir)/test/Makefile.sources $(am__empty): + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libutils.la: $(libutils_la_OBJECTS) $(libutils_la_DEPENDENCIES) $(EXTRA_libutils_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(libutils_la_OBJECTS) $(libutils_la_LIBADD) $(LIBS) + +a1-trap-test$(EXEEXT): $(a1_trap_test_OBJECTS) $(a1_trap_test_DEPENDENCIES) $(EXTRA_a1_trap_test_DEPENDENCIES) + @rm -f a1-trap-test$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(a1_trap_test_OBJECTS) $(a1_trap_test_LDADD) $(LIBS) + +affine-bench$(EXEEXT): $(affine_bench_OBJECTS) $(affine_bench_DEPENDENCIES) $(EXTRA_affine_bench_DEPENDENCIES) + @rm -f affine-bench$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(affine_bench_OBJECTS) $(affine_bench_LDADD) $(LIBS) + +affine-test$(EXEEXT): $(affine_test_OBJECTS) $(affine_test_DEPENDENCIES) $(EXTRA_affine_test_DEPENDENCIES) + @rm -f affine-test$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(affine_test_OBJECTS) $(affine_test_LDADD) $(LIBS) + +alpha-loop$(EXEEXT): $(alpha_loop_OBJECTS) $(alpha_loop_DEPENDENCIES) $(EXTRA_alpha_loop_DEPENDENCIES) + @rm -f alpha-loop$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(alpha_loop_OBJECTS) $(alpha_loop_LDADD) $(LIBS) + +alphamap$(EXEEXT): $(alphamap_OBJECTS) $(alphamap_DEPENDENCIES) $(EXTRA_alphamap_DEPENDENCIES) + @rm -f alphamap$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(alphamap_OBJECTS) $(alphamap_LDADD) $(LIBS) + +blitters-test$(EXEEXT): $(blitters_test_OBJECTS) $(blitters_test_DEPENDENCIES) $(EXTRA_blitters_test_DEPENDENCIES) + @rm -f blitters-test$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(blitters_test_OBJECTS) $(blitters_test_LDADD) $(LIBS) + +check-formats$(EXEEXT): $(check_formats_OBJECTS) $(check_formats_DEPENDENCIES) $(EXTRA_check_formats_DEPENDENCIES) + @rm -f check-formats$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(check_formats_OBJECTS) $(check_formats_LDADD) $(LIBS) + +combiner-test$(EXEEXT): $(combiner_test_OBJECTS) $(combiner_test_DEPENDENCIES) $(EXTRA_combiner_test_DEPENDENCIES) + @rm -f combiner-test$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(combiner_test_OBJECTS) $(combiner_test_LDADD) $(LIBS) + +composite$(EXEEXT): $(composite_OBJECTS) $(composite_DEPENDENCIES) $(EXTRA_composite_DEPENDENCIES) + @rm -f composite$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(composite_OBJECTS) $(composite_LDADD) $(LIBS) + +composite-traps-test$(EXEEXT): $(composite_traps_test_OBJECTS) $(composite_traps_test_DEPENDENCIES) $(EXTRA_composite_traps_test_DEPENDENCIES) + @rm -f composite-traps-test$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(composite_traps_test_OBJECTS) $(composite_traps_test_LDADD) $(LIBS) + +cover-test$(EXEEXT): $(cover_test_OBJECTS) $(cover_test_DEPENDENCIES) $(EXTRA_cover_test_DEPENDENCIES) + @rm -f cover-test$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(cover_test_OBJECTS) $(cover_test_LDADD) $(LIBS) + +fence-image-self-test$(EXEEXT): $(fence_image_self_test_OBJECTS) $(fence_image_self_test_DEPENDENCIES) $(EXTRA_fence_image_self_test_DEPENDENCIES) + @rm -f fence-image-self-test$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(fence_image_self_test_OBJECTS) $(fence_image_self_test_LDADD) $(LIBS) + +fetch-test$(EXEEXT): $(fetch_test_OBJECTS) $(fetch_test_DEPENDENCIES) $(EXTRA_fetch_test_DEPENDENCIES) + @rm -f fetch-test$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(fetch_test_OBJECTS) $(fetch_test_LDADD) $(LIBS) + +filter-reduction-test$(EXEEXT): $(filter_reduction_test_OBJECTS) $(filter_reduction_test_DEPENDENCIES) $(EXTRA_filter_reduction_test_DEPENDENCIES) + @rm -f filter-reduction-test$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(filter_reduction_test_OBJECTS) $(filter_reduction_test_LDADD) $(LIBS) + +glyph-test$(EXEEXT): $(glyph_test_OBJECTS) $(glyph_test_DEPENDENCIES) $(EXTRA_glyph_test_DEPENDENCIES) + @rm -f glyph-test$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(glyph_test_OBJECTS) $(glyph_test_LDADD) $(LIBS) + +gradient-crash-test$(EXEEXT): $(gradient_crash_test_OBJECTS) $(gradient_crash_test_DEPENDENCIES) $(EXTRA_gradient_crash_test_DEPENDENCIES) + @rm -f gradient-crash-test$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gradient_crash_test_OBJECTS) $(gradient_crash_test_LDADD) $(LIBS) + +infinite-loop$(EXEEXT): $(infinite_loop_OBJECTS) $(infinite_loop_DEPENDENCIES) $(EXTRA_infinite_loop_DEPENDENCIES) + @rm -f infinite-loop$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(infinite_loop_OBJECTS) $(infinite_loop_LDADD) $(LIBS) + +lowlevel-blt-bench$(EXEEXT): $(lowlevel_blt_bench_OBJECTS) $(lowlevel_blt_bench_DEPENDENCIES) $(EXTRA_lowlevel_blt_bench_DEPENDENCIES) + @rm -f lowlevel-blt-bench$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(lowlevel_blt_bench_OBJECTS) $(lowlevel_blt_bench_LDADD) $(LIBS) + +matrix-test$(EXEEXT): $(matrix_test_OBJECTS) $(matrix_test_DEPENDENCIES) $(EXTRA_matrix_test_DEPENDENCIES) + @rm -f matrix-test$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(matrix_test_OBJECTS) $(matrix_test_LDADD) $(LIBS) + +oob-test$(EXEEXT): $(oob_test_OBJECTS) $(oob_test_DEPENDENCIES) $(EXTRA_oob_test_DEPENDENCIES) + @rm -f oob-test$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(oob_test_OBJECTS) $(oob_test_LDADD) $(LIBS) + +pdf-op-test$(EXEEXT): $(pdf_op_test_OBJECTS) $(pdf_op_test_DEPENDENCIES) $(EXTRA_pdf_op_test_DEPENDENCIES) + @rm -f pdf-op-test$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(pdf_op_test_OBJECTS) $(pdf_op_test_LDADD) $(LIBS) + +pixel-test$(EXEEXT): $(pixel_test_OBJECTS) $(pixel_test_DEPENDENCIES) $(EXTRA_pixel_test_DEPENDENCIES) + @rm -f pixel-test$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(pixel_test_OBJECTS) $(pixel_test_LDADD) $(LIBS) + +prng-test$(EXEEXT): $(prng_test_OBJECTS) $(prng_test_DEPENDENCIES) $(EXTRA_prng_test_DEPENDENCIES) + @rm -f prng-test$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(prng_test_OBJECTS) $(prng_test_LDADD) $(LIBS) + +radial-invalid$(EXEEXT): $(radial_invalid_OBJECTS) $(radial_invalid_DEPENDENCIES) $(EXTRA_radial_invalid_DEPENDENCIES) + @rm -f radial-invalid$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(radial_invalid_OBJECTS) $(radial_invalid_LDADD) $(LIBS) + +radial-perf-test$(EXEEXT): $(radial_perf_test_OBJECTS) $(radial_perf_test_DEPENDENCIES) $(EXTRA_radial_perf_test_DEPENDENCIES) + @rm -f radial-perf-test$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(radial_perf_test_OBJECTS) $(radial_perf_test_LDADD) $(LIBS) + +region-contains-test$(EXEEXT): $(region_contains_test_OBJECTS) $(region_contains_test_DEPENDENCIES) $(EXTRA_region_contains_test_DEPENDENCIES) + @rm -f region-contains-test$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(region_contains_test_OBJECTS) $(region_contains_test_LDADD) $(LIBS) + +region-test$(EXEEXT): $(region_test_OBJECTS) $(region_test_DEPENDENCIES) $(EXTRA_region_test_DEPENDENCIES) + @rm -f region-test$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(region_test_OBJECTS) $(region_test_LDADD) $(LIBS) + +region-translate-test$(EXEEXT): $(region_translate_test_OBJECTS) $(region_translate_test_DEPENDENCIES) $(EXTRA_region_translate_test_DEPENDENCIES) + @rm -f region-translate-test$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(region_translate_test_OBJECTS) $(region_translate_test_LDADD) $(LIBS) + +rotate-test$(EXEEXT): $(rotate_test_OBJECTS) $(rotate_test_DEPENDENCIES) $(EXTRA_rotate_test_DEPENDENCIES) + @rm -f rotate-test$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(rotate_test_OBJECTS) $(rotate_test_LDADD) $(LIBS) + +scaling-bench$(EXEEXT): $(scaling_bench_OBJECTS) $(scaling_bench_DEPENDENCIES) $(EXTRA_scaling_bench_DEPENDENCIES) + @rm -f scaling-bench$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(scaling_bench_OBJECTS) $(scaling_bench_LDADD) $(LIBS) + +scaling-crash-test$(EXEEXT): $(scaling_crash_test_OBJECTS) $(scaling_crash_test_DEPENDENCIES) $(EXTRA_scaling_crash_test_DEPENDENCIES) + @rm -f scaling-crash-test$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(scaling_crash_test_OBJECTS) $(scaling_crash_test_LDADD) $(LIBS) + +scaling-helpers-test$(EXEEXT): $(scaling_helpers_test_OBJECTS) $(scaling_helpers_test_DEPENDENCIES) $(EXTRA_scaling_helpers_test_DEPENDENCIES) + @rm -f scaling-helpers-test$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(scaling_helpers_test_OBJECTS) $(scaling_helpers_test_LDADD) $(LIBS) + +scaling-test$(EXEEXT): $(scaling_test_OBJECTS) $(scaling_test_DEPENDENCIES) $(EXTRA_scaling_test_DEPENDENCIES) + @rm -f scaling-test$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(scaling_test_OBJECTS) $(scaling_test_LDADD) $(LIBS) + +solid-test$(EXEEXT): $(solid_test_OBJECTS) $(solid_test_DEPENDENCIES) $(EXTRA_solid_test_DEPENDENCIES) + @rm -f solid-test$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(solid_test_OBJECTS) $(solid_test_LDADD) $(LIBS) + +stress-test$(EXEEXT): $(stress_test_OBJECTS) $(stress_test_DEPENDENCIES) $(EXTRA_stress_test_DEPENDENCIES) + @rm -f stress-test$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(stress_test_OBJECTS) $(stress_test_LDADD) $(LIBS) + +thread-test$(EXEEXT): $(thread_test_OBJECTS) $(thread_test_DEPENDENCIES) $(EXTRA_thread_test_DEPENDENCIES) + @rm -f thread-test$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(thread_test_OBJECTS) $(thread_test_LDADD) $(LIBS) + +tolerance-test$(EXEEXT): $(tolerance_test_OBJECTS) $(tolerance_test_DEPENDENCIES) $(EXTRA_tolerance_test_DEPENDENCIES) + @rm -f tolerance-test$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(tolerance_test_OBJECTS) $(tolerance_test_LDADD) $(LIBS) + +trap-crasher$(EXEEXT): $(trap_crasher_OBJECTS) $(trap_crasher_DEPENDENCIES) $(EXTRA_trap_crasher_DEPENDENCIES) + @rm -f trap-crasher$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(trap_crasher_OBJECTS) $(trap_crasher_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/a1-trap-test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/affine-bench.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/affine-test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alpha-loop.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alphamap.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/blitters-test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check-formats.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/combiner-test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/composite-traps-test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/composite.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cover-test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fence-image-self-test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fetch-test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter-reduction-test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glyph-test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gradient-crash-test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/infinite-loop.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lowlevel-blt-bench.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/matrix-test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oob-test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdf-op-test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pixel-test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prng-test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/radial-invalid.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/radial-perf-test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/region-contains-test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/region-test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/region-translate-test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rotate-test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scaling-bench.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scaling-crash-test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scaling-helpers-test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scaling-test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/solid-test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stress-test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thread-test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tolerance-test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trap-crasher.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils-prng.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +# Recover from deleted '.trs' file; this should ensure that +# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create +# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells +# to avoid problems with "make -n". +.log.trs: + rm -f $< $@ + $(MAKE) $(AM_MAKEFLAGS) $< + +# Leading 'am--fnord' is there to ensure the list of targets does not +# expand to empty, as could happen e.g. with make check TESTS=''. +am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) +am--force-recheck: + @: + +$(TEST_SUITE_LOG): $(TEST_LOGS) + @$(am__set_TESTS_bases); \ + am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ + redo_bases=`for i in $$bases; do \ + am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ + done`; \ + if test -n "$$redo_bases"; then \ + redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ + redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ + if $(am__make_dryrun); then :; else \ + rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ + fi; \ + fi; \ + if test -n "$$am__remaking_logs"; then \ + echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ + "recursion detected" >&2; \ + elif test -n "$$redo_logs"; then \ + am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ + fi; \ + if $(am__make_dryrun); then :; else \ + st=0; \ + errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ + for i in $$redo_bases; do \ + test -f $$i.trs && test -r $$i.trs \ + || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ + test -f $$i.log && test -r $$i.log \ + || { echo "$$errmsg $$i.log" >&2; st=1; }; \ + done; \ + test $$st -eq 0 || exit 1; \ + fi + @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ + ws='[ ]'; \ + results=`for b in $$bases; do echo $$b.trs; done`; \ + test -n "$$results" || results=/dev/null; \ + all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ + pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ + fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ + skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ + xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ + xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ + error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ + if test `expr $$fail + $$xpass + $$error` -eq 0; then \ + success=true; \ + else \ + success=false; \ + fi; \ + br='==================='; br=$$br$$br$$br$$br; \ + result_count () \ + { \ + if test x"$$1" = x"--maybe-color"; then \ + maybe_colorize=yes; \ + elif test x"$$1" = x"--no-color"; then \ + maybe_colorize=no; \ + else \ + echo "$@: invalid 'result_count' usage" >&2; exit 4; \ + fi; \ + shift; \ + desc=$$1 count=$$2; \ + if test $$maybe_colorize = yes && test $$count -gt 0; then \ + color_start=$$3 color_end=$$std; \ + else \ + color_start= color_end=; \ + fi; \ + echo "$${color_start}# $$desc $$count$${color_end}"; \ + }; \ + create_testsuite_report () \ + { \ + result_count $$1 "TOTAL:" $$all "$$brg"; \ + result_count $$1 "PASS: " $$pass "$$grn"; \ + result_count $$1 "SKIP: " $$skip "$$blu"; \ + result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ + result_count $$1 "FAIL: " $$fail "$$red"; \ + result_count $$1 "XPASS:" $$xpass "$$red"; \ + result_count $$1 "ERROR:" $$error "$$mgn"; \ + }; \ + { \ + echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ + $(am__rst_title); \ + create_testsuite_report --no-color; \ + echo; \ + echo ".. contents:: :depth: 2"; \ + echo; \ + for b in $$bases; do echo $$b; done \ + | $(am__create_global_log); \ + } >$(TEST_SUITE_LOG).tmp || exit 1; \ + mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ + if $$success; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ + fi; \ + echo "$${col}$$br$${std}"; \ + echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ + echo "$${col}$$br$${std}"; \ + create_testsuite_report --maybe-color; \ + echo "$$col$$br$$std"; \ + if $$success; then :; else \ + echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ + if test -n "$(PACKAGE_BUGREPORT)"; then \ + echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ + fi; \ + echo "$$col$$br$$std"; \ + fi; \ + $$success || exit 1 + +check-TESTS: + @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list + @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + trs_list=`for i in $$bases; do echo $$i.trs; done`; \ + log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ + exit $$?; +recheck: all + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + bases=`for i in $$bases; do echo $$i; done \ + | $(am__list_recheck_tests)` || exit 1; \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + log_list=`echo $$log_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ + am__force_recheck=am--force-recheck \ + TEST_LOGS="$$log_list"; \ + exit $$? +oob-test.log: oob-test$(EXEEXT) + @p='oob-test$(EXEEXT)'; \ + b='oob-test'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +infinite-loop.log: infinite-loop$(EXEEXT) + @p='infinite-loop$(EXEEXT)'; \ + b='infinite-loop'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +trap-crasher.log: trap-crasher$(EXEEXT) + @p='trap-crasher$(EXEEXT)'; \ + b='trap-crasher'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +fence-image-self-test.log: fence-image-self-test$(EXEEXT) + @p='fence-image-self-test$(EXEEXT)'; \ + b='fence-image-self-test'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +region-translate-test.log: region-translate-test$(EXEEXT) + @p='region-translate-test$(EXEEXT)'; \ + b='region-translate-test'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +fetch-test.log: fetch-test$(EXEEXT) + @p='fetch-test$(EXEEXT)'; \ + b='fetch-test'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +a1-trap-test.log: a1-trap-test$(EXEEXT) + @p='a1-trap-test$(EXEEXT)'; \ + b='a1-trap-test'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +prng-test.log: prng-test$(EXEEXT) + @p='prng-test$(EXEEXT)'; \ + b='prng-test'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +radial-invalid.log: radial-invalid$(EXEEXT) + @p='radial-invalid$(EXEEXT)'; \ + b='radial-invalid'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +pdf-op-test.log: pdf-op-test$(EXEEXT) + @p='pdf-op-test$(EXEEXT)'; \ + b='pdf-op-test'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +region-test.log: region-test$(EXEEXT) + @p='region-test$(EXEEXT)'; \ + b='region-test'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +combiner-test.log: combiner-test$(EXEEXT) + @p='combiner-test$(EXEEXT)'; \ + b='combiner-test'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +scaling-crash-test.log: scaling-crash-test$(EXEEXT) + @p='scaling-crash-test$(EXEEXT)'; \ + b='scaling-crash-test'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +alpha-loop.log: alpha-loop$(EXEEXT) + @p='alpha-loop$(EXEEXT)'; \ + b='alpha-loop'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +scaling-helpers-test.log: scaling-helpers-test$(EXEEXT) + @p='scaling-helpers-test$(EXEEXT)'; \ + b='scaling-helpers-test'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +thread-test.log: thread-test$(EXEEXT) + @p='thread-test$(EXEEXT)'; \ + b='thread-test'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +rotate-test.log: rotate-test$(EXEEXT) + @p='rotate-test$(EXEEXT)'; \ + b='rotate-test'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +alphamap.log: alphamap$(EXEEXT) + @p='alphamap$(EXEEXT)'; \ + b='alphamap'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +gradient-crash-test.log: gradient-crash-test$(EXEEXT) + @p='gradient-crash-test$(EXEEXT)'; \ + b='gradient-crash-test'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +pixel-test.log: pixel-test$(EXEEXT) + @p='pixel-test$(EXEEXT)'; \ + b='pixel-test'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +matrix-test.log: matrix-test$(EXEEXT) + @p='matrix-test$(EXEEXT)'; \ + b='matrix-test'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +filter-reduction-test.log: filter-reduction-test$(EXEEXT) + @p='filter-reduction-test$(EXEEXT)'; \ + b='filter-reduction-test'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +composite-traps-test.log: composite-traps-test$(EXEEXT) + @p='composite-traps-test$(EXEEXT)'; \ + b='composite-traps-test'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +region-contains-test.log: region-contains-test$(EXEEXT) + @p='region-contains-test$(EXEEXT)'; \ + b='region-contains-test'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +glyph-test.log: glyph-test$(EXEEXT) + @p='glyph-test$(EXEEXT)'; \ + b='glyph-test'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +solid-test.log: solid-test$(EXEEXT) + @p='solid-test$(EXEEXT)'; \ + b='solid-test'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +stress-test.log: stress-test$(EXEEXT) + @p='stress-test$(EXEEXT)'; \ + b='stress-test'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +cover-test.log: cover-test$(EXEEXT) + @p='cover-test$(EXEEXT)'; \ + b='cover-test'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +blitters-test.log: blitters-test$(EXEEXT) + @p='blitters-test$(EXEEXT)'; \ + b='blitters-test'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +affine-test.log: affine-test$(EXEEXT) + @p='affine-test$(EXEEXT)'; \ + b='affine-test'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +scaling-test.log: scaling-test$(EXEEXT) + @p='scaling-test$(EXEEXT)'; \ + b='scaling-test'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +composite.log: composite$(EXEEXT) + @p='composite$(EXEEXT)'; \ + b='composite'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +tolerance-test.log: tolerance-test$(EXEEXT) + @p='tolerance-test$(EXEEXT)'; \ + b='tolerance-test'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +.test.log: + @p='$<'; \ + $(am__set_b); \ + $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +@am__EXEEXT_TRUE@.test$(EXEEXT).log: +@am__EXEEXT_TRUE@ @p='$<'; \ +@am__EXEEXT_TRUE@ $(am__set_b); \ +@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ +@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ +@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ +@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile $(PROGRAMS) $(LTLIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) + -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) + -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + clean-noinstPROGRAMS mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/a1-trap-test.Po + -rm -f ./$(DEPDIR)/affine-bench.Po + -rm -f ./$(DEPDIR)/affine-test.Po + -rm -f ./$(DEPDIR)/alpha-loop.Po + -rm -f ./$(DEPDIR)/alphamap.Po + -rm -f ./$(DEPDIR)/blitters-test.Po + -rm -f ./$(DEPDIR)/check-formats.Po + -rm -f ./$(DEPDIR)/combiner-test.Po + -rm -f ./$(DEPDIR)/composite-traps-test.Po + -rm -f ./$(DEPDIR)/composite.Po + -rm -f ./$(DEPDIR)/cover-test.Po + -rm -f ./$(DEPDIR)/fence-image-self-test.Po + -rm -f ./$(DEPDIR)/fetch-test.Po + -rm -f ./$(DEPDIR)/filter-reduction-test.Po + -rm -f ./$(DEPDIR)/glyph-test.Po + -rm -f ./$(DEPDIR)/gradient-crash-test.Po + -rm -f ./$(DEPDIR)/infinite-loop.Po + -rm -f ./$(DEPDIR)/lowlevel-blt-bench.Po + -rm -f ./$(DEPDIR)/matrix-test.Po + -rm -f ./$(DEPDIR)/oob-test.Po + -rm -f ./$(DEPDIR)/pdf-op-test.Po + -rm -f ./$(DEPDIR)/pixel-test.Po + -rm -f ./$(DEPDIR)/prng-test.Po + -rm -f ./$(DEPDIR)/radial-invalid.Po + -rm -f ./$(DEPDIR)/radial-perf-test.Po + -rm -f ./$(DEPDIR)/region-contains-test.Po + -rm -f ./$(DEPDIR)/region-test.Po + -rm -f ./$(DEPDIR)/region-translate-test.Po + -rm -f ./$(DEPDIR)/rotate-test.Po + -rm -f ./$(DEPDIR)/scaling-bench.Po + -rm -f ./$(DEPDIR)/scaling-crash-test.Po + -rm -f ./$(DEPDIR)/scaling-helpers-test.Po + -rm -f ./$(DEPDIR)/scaling-test.Po + -rm -f ./$(DEPDIR)/solid-test.Po + -rm -f ./$(DEPDIR)/stress-test.Po + -rm -f ./$(DEPDIR)/thread-test.Po + -rm -f ./$(DEPDIR)/tolerance-test.Po + -rm -f ./$(DEPDIR)/trap-crasher.Po + -rm -f ./$(DEPDIR)/utils-prng.Plo + -rm -f ./$(DEPDIR)/utils.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/a1-trap-test.Po + -rm -f ./$(DEPDIR)/affine-bench.Po + -rm -f ./$(DEPDIR)/affine-test.Po + -rm -f ./$(DEPDIR)/alpha-loop.Po + -rm -f ./$(DEPDIR)/alphamap.Po + -rm -f ./$(DEPDIR)/blitters-test.Po + -rm -f ./$(DEPDIR)/check-formats.Po + -rm -f ./$(DEPDIR)/combiner-test.Po + -rm -f ./$(DEPDIR)/composite-traps-test.Po + -rm -f ./$(DEPDIR)/composite.Po + -rm -f ./$(DEPDIR)/cover-test.Po + -rm -f ./$(DEPDIR)/fence-image-self-test.Po + -rm -f ./$(DEPDIR)/fetch-test.Po + -rm -f ./$(DEPDIR)/filter-reduction-test.Po + -rm -f ./$(DEPDIR)/glyph-test.Po + -rm -f ./$(DEPDIR)/gradient-crash-test.Po + -rm -f ./$(DEPDIR)/infinite-loop.Po + -rm -f ./$(DEPDIR)/lowlevel-blt-bench.Po + -rm -f ./$(DEPDIR)/matrix-test.Po + -rm -f ./$(DEPDIR)/oob-test.Po + -rm -f ./$(DEPDIR)/pdf-op-test.Po + -rm -f ./$(DEPDIR)/pixel-test.Po + -rm -f ./$(DEPDIR)/prng-test.Po + -rm -f ./$(DEPDIR)/radial-invalid.Po + -rm -f ./$(DEPDIR)/radial-perf-test.Po + -rm -f ./$(DEPDIR)/region-contains-test.Po + -rm -f ./$(DEPDIR)/region-test.Po + -rm -f ./$(DEPDIR)/region-translate-test.Po + -rm -f ./$(DEPDIR)/rotate-test.Po + -rm -f ./$(DEPDIR)/scaling-bench.Po + -rm -f ./$(DEPDIR)/scaling-crash-test.Po + -rm -f ./$(DEPDIR)/scaling-helpers-test.Po + -rm -f ./$(DEPDIR)/scaling-test.Po + -rm -f ./$(DEPDIR)/solid-test.Po + -rm -f ./$(DEPDIR)/stress-test.Po + -rm -f ./$(DEPDIR)/thread-test.Po + -rm -f ./$(DEPDIR)/tolerance-test.Po + -rm -f ./$(DEPDIR)/trap-crasher.Po + -rm -f ./$(DEPDIR)/utils-prng.Plo + -rm -f ./$(DEPDIR)/utils.Plo + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \ + check-am clean clean-generic clean-libtool \ + clean-noinstLTLIBRARIES clean-noinstPROGRAMS cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + recheck tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libs/pixman-0.40.0/test/Makefile.sources b/libs/pixman-0.40.0/test/Makefile.sources new file mode 100644 index 0000000..0a56231 --- /dev/null +++ b/libs/pixman-0.40.0/test/Makefile.sources @@ -0,0 +1,56 @@ +# Tests (sorted by expected completion time) +TESTPROGRAMS = \ + oob-test \ + infinite-loop \ + trap-crasher \ + fence-image-self-test \ + region-translate-test \ + fetch-test \ + a1-trap-test \ + prng-test \ + radial-invalid \ + pdf-op-test \ + region-test \ + combiner-test \ + scaling-crash-test \ + alpha-loop \ + scaling-helpers-test \ + thread-test \ + rotate-test \ + alphamap \ + gradient-crash-test \ + pixel-test \ + matrix-test \ + filter-reduction-test \ + composite-traps-test \ + region-contains-test \ + glyph-test \ + solid-test \ + stress-test \ + cover-test \ + blitters-test \ + affine-test \ + scaling-test \ + composite \ + tolerance-test \ + $(NULL) + +# Other programs +OTHERPROGRAMS = \ + lowlevel-blt-bench \ + radial-perf-test \ + check-formats \ + scaling-bench \ + affine-bench \ + $(NULL) + +# Utility functions +libutils_sources = \ + utils.c \ + utils-prng.c \ + $(NULL) + +libutils_headers = \ + utils.h \ + utils-prng.h \ + $(NULL) diff --git a/libs/pixman-0.40.0/test/a1-trap-test.c b/libs/pixman-0.40.0/test/a1-trap-test.c new file mode 100644 index 0000000..c2b4883 --- /dev/null +++ b/libs/pixman-0.40.0/test/a1-trap-test.c @@ -0,0 +1,58 @@ +#include <assert.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "utils.h" + +int +main (int argc, char **argv) +{ +#define WIDTH 20 +#define HEIGHT 20 + + pixman_image_t *src_img; + pixman_image_t *mask_img; + pixman_image_t *dest_img; + pixman_trap_t trap; + pixman_color_t red = { 0xffff, 0x0000, 0x0000, 0xffff }; + uint32_t *bits = malloc (WIDTH * HEIGHT * 4); + uint32_t *mbits = malloc (WIDTH * HEIGHT); + + memset (mbits, 0, WIDTH * HEIGHT); + memset (bits, 0xff, WIDTH * HEIGHT * 4); + + trap.top.l = pixman_double_to_fixed (0.5); + trap.top.r = pixman_double_to_fixed (1.5); + trap.top.y = pixman_double_to_fixed (0.5); + + trap.bot.l = pixman_double_to_fixed (0.5); + trap.bot.r = pixman_double_to_fixed (1.5); + trap.bot.y = pixman_double_to_fixed (1.5); + + mask_img = pixman_image_create_bits ( + PIXMAN_a1, WIDTH, HEIGHT, mbits, WIDTH); + src_img = pixman_image_create_solid_fill (&red); + dest_img = pixman_image_create_bits ( + PIXMAN_a8r8g8b8, WIDTH, HEIGHT, bits, WIDTH * 4); + + pixman_add_traps (mask_img, 0, 0, 1, &trap); + + pixman_image_composite (PIXMAN_OP_OVER, + src_img, mask_img, dest_img, + 0, 0, 0, 0, 0, 0, WIDTH, HEIGHT); + + assert (bits[0] == 0xffff0000); + assert (bits[1] == 0xffffffff); + assert (bits[1 * WIDTH + 0] == 0xffffffff); + assert (bits[1 * WIDTH + 1] == 0xffffffff); + + /* The check-formats test depends on operator_name() and format_name() returning + * these precise formats, so if those change, check-formats.c must be updated too. + */ + assert ( + strcmp (operator_name (PIXMAN_OP_DISJOINT_OVER), "PIXMAN_OP_DISJOINT_OVER") == 0); + assert ( + strcmp (format_name (PIXMAN_r5g6b5), "r5g6b5") == 0); + + return 0; +} diff --git a/libs/pixman-0.40.0/test/affine-bench.c b/libs/pixman-0.40.0/test/affine-bench.c new file mode 100644 index 0000000..86bf46e --- /dev/null +++ b/libs/pixman-0.40.0/test/affine-bench.c @@ -0,0 +1,448 @@ +/* + * Copyright © 2014 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 <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <stdint.h> +#include "utils.h" + +#ifdef HAVE_GETTIMEOFDAY +#include <sys/time.h> +#else +#include <time.h> +#endif + +#define WIDTH 1920 +#define HEIGHT 1080 + +/* How much data to read to flush all cached data to RAM */ +#define MAX_L2CACHE_SIZE (8 * 1024 * 1024) + +#define PAGE_SIZE (4 * 1024) + +struct bench_info +{ + pixman_op_t op; + pixman_transform_t transform; + pixman_image_t *src_image; + pixman_image_t *mask_image; + pixman_image_t *dest_image; + int32_t src_x; + int32_t src_y; +}; + +typedef struct bench_info bench_info_t; + +struct box_48_16 +{ + pixman_fixed_48_16_t x1; + pixman_fixed_48_16_t y1; + pixman_fixed_48_16_t x2; + pixman_fixed_48_16_t y2; +}; + +typedef struct box_48_16 box_48_16_t; + +/* This function is copied verbatim from pixman.c. */ +static pixman_bool_t +compute_transformed_extents (pixman_transform_t *transform, + const pixman_box32_t *extents, + box_48_16_t *transformed) +{ + pixman_fixed_48_16_t tx1, ty1, tx2, ty2; + pixman_fixed_t x1, y1, x2, y2; + int i; + + x1 = pixman_int_to_fixed (extents->x1) + pixman_fixed_1 / 2; + y1 = pixman_int_to_fixed (extents->y1) + pixman_fixed_1 / 2; + x2 = pixman_int_to_fixed (extents->x2) - pixman_fixed_1 / 2; + y2 = pixman_int_to_fixed (extents->y2) - pixman_fixed_1 / 2; + + if (!transform) + { + transformed->x1 = x1; + transformed->y1 = y1; + transformed->x2 = x2; + transformed->y2 = y2; + + return TRUE; + } + + tx1 = ty1 = INT64_MAX; + tx2 = ty2 = INT64_MIN; + + for (i = 0; i < 4; ++i) + { + pixman_fixed_48_16_t tx, ty; + pixman_vector_t v; + + v.vector[0] = (i & 0x01)? x1 : x2; + v.vector[1] = (i & 0x02)? y1 : y2; + v.vector[2] = pixman_fixed_1; + + if (!pixman_transform_point (transform, &v)) + return FALSE; + + tx = (pixman_fixed_48_16_t)v.vector[0]; + ty = (pixman_fixed_48_16_t)v.vector[1]; + + if (tx < tx1) + tx1 = tx; + if (ty < ty1) + ty1 = ty; + if (tx > tx2) + tx2 = tx; + if (ty > ty2) + ty2 = ty; + } + + transformed->x1 = tx1; + transformed->y1 = ty1; + transformed->x2 = tx2; + transformed->y2 = ty2; + + return TRUE; +} + +static void +create_image (uint32_t width, + uint32_t height, + pixman_format_code_t format, + pixman_filter_t filter, + uint32_t **bits, + pixman_image_t **image) +{ + uint32_t stride = (width * PIXMAN_FORMAT_BPP (format) + 31) / 32 * 4; + + *bits = aligned_malloc (PAGE_SIZE, stride * height); + memset (*bits, 0xCC, stride * height); + *image = pixman_image_create_bits (format, width, height, *bits, stride); + pixman_image_set_repeat (*image, PIXMAN_REPEAT_NORMAL); + pixman_image_set_filter (*image, filter, NULL, 0); +} + +/* This needs to match the shortest cacheline length we expect to encounter */ +#define CACHE_CLEAN_INCREMENT 32 + +static void +flush_cache (void) +{ + static const char clean_space[MAX_L2CACHE_SIZE]; + volatile const char *x = clean_space; + const char *clean_end = clean_space + sizeof clean_space; + + while (x < clean_end) + { + (void) *x; + x += CACHE_CLEAN_INCREMENT; + } +} + +/* Obtain current time in microseconds modulo 2^32 */ +uint32_t +gettimei (void) +{ +#ifdef HAVE_GETTIMEOFDAY + struct timeval tv; + + gettimeofday (&tv, NULL); + return tv.tv_sec * 1000000 + tv.tv_usec; +#else + return (uint64_t) clock () * 1000000 / CLOCKS_PER_SEC; +#endif +} + +static void +pixman_image_composite_wrapper (const pixman_composite_info_t *info) +{ + pixman_image_composite (info->op, + info->src_image, info->mask_image, info->dest_image, + info->src_x, info->src_y, + info->mask_x, info->mask_y, + info->dest_x, info->dest_y, + info->width, info->height); +} + +static void +pixman_image_composite_empty (const pixman_composite_info_t *info) +{ + pixman_image_composite (info->op, + info->src_image, info->mask_image, info->dest_image, + info->src_x, info->src_y, + info->mask_x, info->mask_y, + info->dest_x, info->dest_y, + 1, 1); +} + +static void +bench (const bench_info_t *bi, + uint32_t max_n, + uint32_t max_time, + uint32_t *ret_n, + uint32_t *ret_time, + void (*func) (const pixman_composite_info_t *info)) +{ + uint32_t n = 0; + uint32_t t0; + uint32_t t1; + uint32_t x = 0; + pixman_transform_t t; + pixman_composite_info_t info; + + t = bi->transform; + info.op = bi->op; + info.src_image = bi->src_image; + info.mask_image = bi->mask_image; + info.dest_image = bi->dest_image; + info.src_x = 0; + info.src_y = 0; + info.mask_x = 0; + info.mask_y = 0; + /* info.dest_x set below */ + info.dest_y = 0; + info.width = WIDTH; + info.height = HEIGHT; + + t0 = gettimei (); + + do + { + + if (++x >= 64) + x = 0; + + info.dest_x = 63 - x; + + t.matrix[0][2] = pixman_int_to_fixed (bi->src_x + x); + t.matrix[1][2] = pixman_int_to_fixed (bi->src_y); + pixman_image_set_transform (bi->src_image, &t); + + if (bi->mask_image) + pixman_image_set_transform (bi->mask_image, &t); + + func (&info); + t1 = gettimei (); + } + while (++n < max_n && (t1 - t0) < max_time); + + if (ret_n) + *ret_n = n; + + *ret_time = t1 - t0; +} + +int +parse_fixed_argument (char *arg, pixman_fixed_t *value) +{ + char *tailptr; + + *value = pixman_double_to_fixed (strtod (arg, &tailptr)); + + return *tailptr == '\0'; +} + +int +parse_arguments (int argc, + char *argv[], + pixman_transform_t *t, + pixman_op_t *op, + pixman_format_code_t *src_format, + pixman_format_code_t *mask_format, + pixman_format_code_t *dest_format) +{ + if (!parse_fixed_argument (*argv, &t->matrix[0][0])) + return 0; + + if (*++argv == NULL) + return 1; + + if (!parse_fixed_argument (*argv, &t->matrix[0][1])) + return 0; + + if (*++argv == NULL) + return 1; + + if (!parse_fixed_argument (*argv, &t->matrix[1][0])) + return 0; + + if (*++argv == NULL) + return 1; + + if (!parse_fixed_argument (*argv, &t->matrix[1][1])) + return 0; + + if (*++argv == NULL) + return 1; + + *op = operator_from_string (*argv); + if (*op == PIXMAN_OP_NONE) + return 0; + + if (*++argv == NULL) + return 1; + + *src_format = format_from_string (*argv); + if (*src_format == PIXMAN_null) + return 0; + + ++argv; + if (argv[0] && argv[1]) + { + *mask_format = format_from_string (*argv); + if (*mask_format == PIXMAN_null) + return 0; + ++argv; + } + if (*argv) + { + *dest_format = format_from_string (*argv); + if (*dest_format == PIXMAN_null) + return 0; + } + return 1; +} + +static void +run_benchmark (const bench_info_t *bi) +{ + uint32_t n; /* number of iterations in at least 5 seconds */ + uint32_t t1; /* time taken to do n iterations, microseconds */ + uint32_t t2; /* calling overhead for n iterations, microseconds */ + + flush_cache (); + bench (bi, UINT32_MAX, 5000000, &n, &t1, pixman_image_composite_wrapper); + bench (bi, n, UINT32_MAX, NULL, &t2, pixman_image_composite_empty); + + /* The result indicates the output rate in megapixels/second */ + printf ("%6.2f\n", (double) n * WIDTH * HEIGHT / (t1 - t2)); +} + + +int +main (int argc, char *argv[]) +{ + bench_info_t binfo; + pixman_filter_t filter = PIXMAN_FILTER_NEAREST; + pixman_format_code_t src_format = PIXMAN_a8r8g8b8; + pixman_format_code_t mask_format = 0; + pixman_format_code_t dest_format = PIXMAN_a8r8g8b8; + pixman_box32_t dest_box = { 0, 0, WIDTH, HEIGHT }; + box_48_16_t transformed = { 0 }; + int32_t xmin, ymin, xmax, ymax; + uint32_t *src, *mask, *dest; + + binfo.op = PIXMAN_OP_SRC; + binfo.mask_image = NULL; + pixman_transform_init_identity (&binfo.transform); + + ++argv; + if (*argv && (*argv)[0] == '-' && (*argv)[1] == 'n') + { + filter = PIXMAN_FILTER_NEAREST; + ++argv; + --argc; + } + + if (*argv && (*argv)[0] == '-' && (*argv)[1] == 'b') + { + filter = PIXMAN_FILTER_BILINEAR; + ++argv; + --argc; + } + + if (argc == 1 || + !parse_arguments (argc, argv, &binfo.transform, &binfo.op, + &src_format, &mask_format, &dest_format)) + { + printf ("Usage: affine-bench [-n] [-b] axx [axy] [ayx] [ayy] [combine type]\n"); + printf (" [src format] [mask format] [dest format]\n"); + printf (" -n : nearest scaling (default)\n"); + printf (" -b : bilinear scaling\n"); + printf (" axx : x_out:x_in factor\n"); + printf (" axy : x_out:y_in factor (default 0)\n"); + printf (" ayx : y_out:x_in factor (default 0)\n"); + printf (" ayy : y_out:y_in factor (default 1)\n"); + printf (" combine type : src, over, in etc (default src)\n"); + printf (" src format : a8r8g8b8, r5g6b5 etc (default a8r8g8b8)\n"); + printf (" mask format : as for src format, but no mask used if omitted\n"); + printf (" dest format : as for src format (default a8r8g8b8)\n"); + printf ("The output is a single number in megapixels/second.\n"); + + return EXIT_FAILURE; + } + + /* Compute required extents for source and mask image so they qualify + * for COVER fast paths and get the flags in pixman.c:analyze_extent(). + * These computations are for FAST_PATH_SAMPLES_COVER_CLIP_BILINEAR, + * but at the same time they also allow COVER_CLIP_NEAREST. + */ + compute_transformed_extents (&binfo.transform, &dest_box, &transformed); + xmin = pixman_fixed_to_int (transformed.x1 - pixman_fixed_1 / 2); + ymin = pixman_fixed_to_int (transformed.y1 - pixman_fixed_1 / 2); + xmax = pixman_fixed_to_int (transformed.x2 + pixman_fixed_1 / 2); + ymax = pixman_fixed_to_int (transformed.y2 + pixman_fixed_1 / 2); + /* Note: + * The upper limits can be reduced to the following when fetchers + * are guaranteed to not access pixels with zero weight. This concerns + * particularly all bilinear samplers. + * + * xmax = pixman_fixed_to_int (transformed.x2 + pixman_fixed_1 / 2 - pixman_fixed_e); + * ymax = pixman_fixed_to_int (transformed.y2 + pixman_fixed_1 / 2 - pixman_fixed_e); + * This is equivalent to subtracting 0.5 and rounding up, rather than + * subtracting 0.5, rounding down and adding 1. + */ + binfo.src_x = -xmin; + binfo.src_y = -ymin; + + /* Always over-allocate width by 64 pixels for all src, mask and dst, + * so that we can iterate over an x-offset 0..63 in bench (). + * This is similar to lowlevel-blt-bench, which uses the same method + * to hit different cacheline misalignments. + */ + create_image (xmax - xmin + 64, ymax - ymin + 1, src_format, filter, + &src, &binfo.src_image); + + if (mask_format) + { + create_image (xmax - xmin + 64, ymax - ymin + 1, mask_format, filter, + &mask, &binfo.mask_image); + + if ((PIXMAN_FORMAT_R(mask_format) || + PIXMAN_FORMAT_G(mask_format) || + PIXMAN_FORMAT_B(mask_format))) + { + pixman_image_set_component_alpha (binfo.mask_image, 1); + } + } + + create_image (WIDTH + 64, HEIGHT, dest_format, filter, + &dest, &binfo.dest_image); + + run_benchmark (&binfo); + + return EXIT_SUCCESS; +} diff --git a/libs/pixman-0.40.0/test/affine-test.c b/libs/pixman-0.40.0/test/affine-test.c new file mode 100644 index 0000000..f516856 --- /dev/null +++ b/libs/pixman-0.40.0/test/affine-test.c @@ -0,0 +1,324 @@ +/* + * Test program, which can detect some problems with affine transformations + * in pixman. Testing is done by running lots of random SRC and OVER + * compositing operations a8r8g8b8, x8a8r8g8b8, r5g6b5 and a8 color formats + * with random scaled, rotated and translated transforms. + * + * Script 'fuzzer-find-diff.pl' can be used to narrow down the problem in + * the case of test failure. + */ +#include <assert.h> +#include <stdlib.h> +#include <stdio.h> +#include "utils.h" + +#define MAX_SRC_WIDTH 16 +#define MAX_SRC_HEIGHT 16 +#define MAX_DST_WIDTH 16 +#define MAX_DST_HEIGHT 16 +#define MAX_STRIDE 4 + +/* + * Composite operation with pseudorandom images + */ +uint32_t +test_composite (int testnum, + int verbose) +{ + int i; + pixman_image_t * src_img; + pixman_image_t * dst_img; + pixman_transform_t transform; + pixman_region16_t clip; + int src_width, src_height; + int dst_width, dst_height; + int src_stride, dst_stride; + int src_x, src_y; + int dst_x, dst_y; + int src_bpp; + int dst_bpp; + int w, h; + pixman_fixed_t scale_x = 65536, scale_y = 65536; + pixman_fixed_t translate_x = 0, translate_y = 0; + pixman_op_t op; + pixman_repeat_t repeat = PIXMAN_REPEAT_NONE; + pixman_format_code_t src_fmt, dst_fmt; + uint32_t * srcbuf; + uint32_t * dstbuf; + uint32_t crc32; + FLOAT_REGS_CORRUPTION_DETECTOR_START (); + + prng_srand (testnum); + + src_bpp = (prng_rand_n (2) == 0) ? 2 : 4; + dst_bpp = (prng_rand_n (2) == 0) ? 2 : 4; + op = (prng_rand_n (2) == 0) ? PIXMAN_OP_SRC : PIXMAN_OP_OVER; + + src_width = prng_rand_n (MAX_SRC_WIDTH) + 1; + src_height = prng_rand_n (MAX_SRC_HEIGHT) + 1; + dst_width = prng_rand_n (MAX_DST_WIDTH) + 1; + dst_height = prng_rand_n (MAX_DST_HEIGHT) + 1; + src_stride = src_width * src_bpp + prng_rand_n (MAX_STRIDE) * src_bpp; + dst_stride = dst_width * dst_bpp + prng_rand_n (MAX_STRIDE) * dst_bpp; + + if (src_stride & 3) + src_stride += 2; + + if (dst_stride & 3) + dst_stride += 2; + + src_x = -(src_width / 4) + prng_rand_n (src_width * 3 / 2); + src_y = -(src_height / 4) + prng_rand_n (src_height * 3 / 2); + dst_x = -(dst_width / 4) + prng_rand_n (dst_width * 3 / 2); + dst_y = -(dst_height / 4) + prng_rand_n (dst_height * 3 / 2); + w = prng_rand_n (dst_width * 3 / 2 - dst_x); + h = prng_rand_n (dst_height * 3 / 2 - dst_y); + + srcbuf = (uint32_t *)malloc (src_stride * src_height); + dstbuf = (uint32_t *)malloc (dst_stride * dst_height); + + prng_randmemset (srcbuf, src_stride * src_height, 0); + prng_randmemset (dstbuf, dst_stride * dst_height, 0); + + if (prng_rand_n (2) == 0) + { + srcbuf += (src_stride / 4) * (src_height - 1); + src_stride = - src_stride; + } + + if (prng_rand_n (2) == 0) + { + dstbuf += (dst_stride / 4) * (dst_height - 1); + dst_stride = - dst_stride; + } + + src_fmt = src_bpp == 4 ? (prng_rand_n (2) == 0 ? + PIXMAN_a8r8g8b8 : PIXMAN_x8r8g8b8) : PIXMAN_r5g6b5; + + dst_fmt = dst_bpp == 4 ? (prng_rand_n (2) == 0 ? + PIXMAN_a8r8g8b8 : PIXMAN_x8r8g8b8) : PIXMAN_r5g6b5; + + src_img = pixman_image_create_bits ( + src_fmt, src_width, src_height, srcbuf, src_stride); + + dst_img = pixman_image_create_bits ( + dst_fmt, dst_width, dst_height, dstbuf, dst_stride); + + image_endian_swap (src_img); + image_endian_swap (dst_img); + + pixman_transform_init_identity (&transform); + + if (prng_rand_n (3) > 0) + { + scale_x = -65536 * 3 + prng_rand_n (65536 * 6); + if (prng_rand_n (2)) + scale_y = -65536 * 3 + prng_rand_n (65536 * 6); + else + scale_y = scale_x; + pixman_transform_init_scale (&transform, scale_x, scale_y); + } + if (prng_rand_n (3) > 0) + { + translate_x = -65536 * 3 + prng_rand_n (6 * 65536); + if (prng_rand_n (2)) + translate_y = -65536 * 3 + prng_rand_n (6 * 65536); + else + translate_y = translate_x; + pixman_transform_translate (&transform, NULL, translate_x, translate_y); + } + + if (prng_rand_n (4) > 0) + { + int c, s, tx = 0, ty = 0; + switch (prng_rand_n (4)) + { + case 0: + /* 90 degrees */ + c = 0; + s = pixman_fixed_1; + tx = pixman_int_to_fixed (MAX_SRC_HEIGHT); + break; + case 1: + /* 180 degrees */ + c = -pixman_fixed_1; + s = 0; + tx = pixman_int_to_fixed (MAX_SRC_WIDTH); + ty = pixman_int_to_fixed (MAX_SRC_HEIGHT); + break; + case 2: + /* 270 degrees */ + c = 0; + s = -pixman_fixed_1; + ty = pixman_int_to_fixed (MAX_SRC_WIDTH); + break; + default: + /* arbitrary rotation */ + c = prng_rand_n (2 * 65536) - 65536; + s = prng_rand_n (2 * 65536) - 65536; + break; + } + pixman_transform_rotate (&transform, NULL, c, s); + pixman_transform_translate (&transform, NULL, tx, ty); + } + + if (prng_rand_n (8) == 0) + { + /* Flip random bits */ + int maxflipcount = 8; + while (maxflipcount--) + { + int i = prng_rand_n (2); + int j = prng_rand_n (3); + int bitnum = prng_rand_n (32); + transform.matrix[i][j] ^= 1U << bitnum; + if (prng_rand_n (2)) + break; + } + } + + pixman_image_set_transform (src_img, &transform); + + switch (prng_rand_n (4)) + { + case 0: + repeat = PIXMAN_REPEAT_NONE; + break; + + case 1: + repeat = PIXMAN_REPEAT_NORMAL; + break; + + case 2: + repeat = PIXMAN_REPEAT_PAD; + break; + + case 3: + repeat = PIXMAN_REPEAT_REFLECT; + break; + + default: + break; + } + pixman_image_set_repeat (src_img, repeat); + + if (prng_rand_n (2)) + pixman_image_set_filter (src_img, PIXMAN_FILTER_NEAREST, NULL, 0); + else + pixman_image_set_filter (src_img, PIXMAN_FILTER_BILINEAR, NULL, 0); + + if (verbose) + { +#define M(r,c) \ + transform.matrix[r][c] + + printf ("src_fmt=%s, dst_fmt=%s\n", format_name (src_fmt), format_name (dst_fmt)); + printf ("op=%s, repeat=%d, transform=\n", + operator_name (op), repeat); + printf (" { { { 0x%08x, 0x%08x, 0x%08x },\n" + " { 0x%08x, 0x%08x, 0x%08x },\n" + " { 0x%08x, 0x%08x, 0x%08x },\n" + " } };\n", + M(0,0), M(0,1), M(0,2), + M(1,0), M(1,1), M(1,2), + M(2,0), M(2,1), M(2,2)); + printf ("src_width=%d, src_height=%d, dst_width=%d, dst_height=%d\n", + src_width, src_height, dst_width, dst_height); + printf ("src_x=%d, src_y=%d, dst_x=%d, dst_y=%d\n", + src_x, src_y, dst_x, dst_y); + printf ("w=%d, h=%d\n", w, h); + } + + if (prng_rand_n (8) == 0) + { + pixman_box16_t clip_boxes[2]; + int n = prng_rand_n (2) + 1; + + for (i = 0; i < n; i++) + { + clip_boxes[i].x1 = prng_rand_n (src_width); + clip_boxes[i].y1 = prng_rand_n (src_height); + clip_boxes[i].x2 = + clip_boxes[i].x1 + prng_rand_n (src_width - clip_boxes[i].x1); + clip_boxes[i].y2 = + clip_boxes[i].y1 + prng_rand_n (src_height - clip_boxes[i].y1); + + if (verbose) + { + printf ("source clip box: [%d,%d-%d,%d]\n", + clip_boxes[i].x1, clip_boxes[i].y1, + clip_boxes[i].x2, clip_boxes[i].y2); + } + } + + pixman_region_init_rects (&clip, clip_boxes, n); + pixman_image_set_clip_region (src_img, &clip); + pixman_image_set_source_clipping (src_img, 1); + pixman_region_fini (&clip); + } + + if (prng_rand_n (8) == 0) + { + pixman_box16_t clip_boxes[2]; + int n = prng_rand_n (2) + 1; + for (i = 0; i < n; i++) + { + clip_boxes[i].x1 = prng_rand_n (dst_width); + clip_boxes[i].y1 = prng_rand_n (dst_height); + clip_boxes[i].x2 = + clip_boxes[i].x1 + prng_rand_n (dst_width - clip_boxes[i].x1); + clip_boxes[i].y2 = + clip_boxes[i].y1 + prng_rand_n (dst_height - clip_boxes[i].y1); + + if (verbose) + { + printf ("destination clip box: [%d,%d-%d,%d]\n", + clip_boxes[i].x1, clip_boxes[i].y1, + clip_boxes[i].x2, clip_boxes[i].y2); + } + } + pixman_region_init_rects (&clip, clip_boxes, n); + pixman_image_set_clip_region (dst_img, &clip); + pixman_region_fini (&clip); + } + + pixman_image_composite (op, src_img, NULL, dst_img, + src_x, src_y, 0, 0, dst_x, dst_y, w, h); + + crc32 = compute_crc32_for_image (0, dst_img); + + if (verbose) + print_image (dst_img); + + pixman_image_unref (src_img); + pixman_image_unref (dst_img); + + if (src_stride < 0) + srcbuf += (src_stride / 4) * (src_height - 1); + + if (dst_stride < 0) + dstbuf += (dst_stride / 4) * (dst_height - 1); + + free (srcbuf); + free (dstbuf); + + FLOAT_REGS_CORRUPTION_DETECTOR_FINISH (); + return crc32; +} + +#if BILINEAR_INTERPOLATION_BITS == 7 +#define CHECKSUM 0xBE724CFE +#elif BILINEAR_INTERPOLATION_BITS == 4 +#define CHECKSUM 0x79BBE501 +#else +#define CHECKSUM 0x00000000 +#endif + +int +main (int argc, const char *argv[]) +{ + pixman_disable_out_of_bounds_workaround (); + + return fuzzer_test_main ("affine", 8000000, CHECKSUM, + test_composite, argc, argv); +} diff --git a/libs/pixman-0.40.0/test/alpha-loop.c b/libs/pixman-0.40.0/test/alpha-loop.c new file mode 100644 index 0000000..4d4384d --- /dev/null +++ b/libs/pixman-0.40.0/test/alpha-loop.c @@ -0,0 +1,35 @@ +#include <stdio.h> +#include <stdlib.h> +#include "utils.h" + +#define WIDTH 400 +#define HEIGHT 200 + +int +main (int argc, char **argv) +{ + pixman_image_t *a, *d, *s; + uint8_t *alpha; + uint32_t *src, *dest; + + prng_srand (0); + + alpha = make_random_bytes (WIDTH * HEIGHT); + src = (uint32_t *)make_random_bytes (WIDTH * HEIGHT * 4); + dest = (uint32_t *)make_random_bytes (WIDTH * HEIGHT * 4); + + a = pixman_image_create_bits (PIXMAN_a8, WIDTH, HEIGHT, (uint32_t *)alpha, WIDTH); + d = pixman_image_create_bits (PIXMAN_a8r8g8b8, WIDTH, HEIGHT, dest, WIDTH * 4); + s = pixman_image_create_bits (PIXMAN_a2r10g10b10, WIDTH, HEIGHT, src, WIDTH * 4); + + fail_after (5, "Infinite loop detected: 5 seconds without progress\n"); + + pixman_image_set_alpha_map (s, a, 0, 0); + pixman_image_set_alpha_map (a, s, 0, 0); + + pixman_image_composite (PIXMAN_OP_SRC, s, NULL, d, 0, 0, 0, 0, 0, 0, WIDTH, HEIGHT); + + pixman_image_unref (s); + + return 0; +} diff --git a/libs/pixman-0.40.0/test/alphamap.c b/libs/pixman-0.40.0/test/alphamap.c new file mode 100644 index 0000000..150d33e --- /dev/null +++ b/libs/pixman-0.40.0/test/alphamap.c @@ -0,0 +1,346 @@ +#include <stdio.h> +#include <stdlib.h> +#include "utils.h" + +#define WIDTH 48 +#define HEIGHT 48 + +static const pixman_format_code_t formats[] = +{ + PIXMAN_a8r8g8b8, + PIXMAN_a2r10g10b10, + PIXMAN_a4r4g4b4, + PIXMAN_a8, + PIXMAN_rgba_float, +}; + +static const pixman_format_code_t alpha_formats[] = +{ + PIXMAN_null, + PIXMAN_a8, + PIXMAN_a2r10g10b10, + PIXMAN_a4r4g4b4, + PIXMAN_rgba_float, +}; + +static const int origins[] = +{ + 0, 10, -100 +}; + +static void +on_destroy (pixman_image_t *image, void *data) +{ + uint32_t *bits = pixman_image_get_data (image); + + fence_free (bits); +} + +static pixman_image_t * +make_image (pixman_format_code_t format) +{ + uint32_t *bits; + uint8_t bpp = PIXMAN_FORMAT_BPP (format) / 8; + pixman_image_t *image; + + if (format != PIXMAN_rgba_float) + bits = (uint32_t *)make_random_bytes (WIDTH * HEIGHT * bpp); + else + bits = (uint32_t *)make_random_floats (WIDTH * HEIGHT * bpp); + + image = pixman_image_create_bits (format, WIDTH, HEIGHT, bits, WIDTH * bpp); + + if (image && bits) + pixman_image_set_destroy_function (image, on_destroy, NULL); + + return image; +} + +static float +get_alpha (pixman_image_t *image, int x, int y, int orig_x, int orig_y) +{ + uint8_t *bits; + uint32_t r; + + if (image->common.alpha_map) + { + if (x - orig_x >= 0 && x - orig_x < WIDTH && + y - orig_y >= 0 && y - orig_y < HEIGHT) + { + image = (pixman_image_t *)image->common.alpha_map; + + x -= orig_x; + y -= orig_y; + } + else + { + return 0.f; + } + } + + bits = (uint8_t *)image->bits.bits; + + if (image->bits.format == PIXMAN_a8) + { + r = bits[y * WIDTH + x]; + return r / 255.f; + } + else if (image->bits.format == PIXMAN_a2r10g10b10) + { + r = ((uint32_t *)bits)[y * WIDTH + x] >> 30; + return r / 3.f; + } + else if (image->bits.format == PIXMAN_a8r8g8b8) + { + r = ((uint32_t *)bits)[y * WIDTH + x] >> 24; + return r / 255.f; + } + else if (image->bits.format == PIXMAN_a4r4g4b4) + { + r = ((uint16_t *)bits)[y * WIDTH + x] >> 12; + return r / 15.f; + } + else if (image->bits.format == PIXMAN_rgba_float) + { + return ((float *)bits)[y * WIDTH * 4 + x * 4 + 3]; + } + else + { + assert (0); + return 0.f; + } +} + +static uint16_t +get_red (pixman_image_t *image, int x, int y, int orig_x, int orig_y) +{ + uint8_t *bits; + uint16_t r; + + bits = (uint8_t *)image->bits.bits; + + if (image->bits.format == PIXMAN_a8) + { + r = 0x00; + } + else if (image->bits.format == PIXMAN_a2r10g10b10) + { + r = ((uint32_t *)bits)[y * WIDTH + x] >> 14; + r &= 0xffc0; + r |= (r >> 10); + } + else if (image->bits.format == PIXMAN_a8r8g8b8) + { + r = ((uint32_t *)bits)[y * WIDTH + x] >> 16; + r &= 0xff; + r |= r << 8; + } + else if (image->bits.format == PIXMAN_a4r4g4b4) + { + r = ((uint16_t *)bits)[y * WIDTH + x] >> 8; + r &= 0xf; + r |= r << 4; + r |= r << 8; + } + else if (image->bits.format == PIXMAN_rgba_float) + { + double tmp = ((float *)bits)[y * WIDTH * 4 + x * 4]; + return tmp * 65535.; + } + else + { + assert (0); + } + + return r; +} + +static float get_alpha_err(pixman_format_code_t sf, pixman_format_code_t saf, + pixman_format_code_t df, pixman_format_code_t daf) +{ + pixman_format_code_t s = saf != PIXMAN_null ? saf : sf; + pixman_format_code_t d = daf != PIXMAN_null ? daf : df; + + /* There are cases where we go through the 8 bit compositing + * path even with 10bpc and higher formats. + */ + if (PIXMAN_FORMAT_A(s) == PIXMAN_FORMAT_A(d)) + return 1.f / 255.f; + else if (PIXMAN_FORMAT_A(s) > PIXMAN_FORMAT_A(d)) + return 1.f / ((1 << PIXMAN_FORMAT_A(d)) - 1); + else + return 1.f / ((1 << PIXMAN_FORMAT_A(s)) - 1); +} + +static int +run_test (int s, int d, int sa, int da, int soff, int doff) +{ + pixman_format_code_t sf = formats[s]; + pixman_format_code_t df = formats[d]; + pixman_format_code_t saf = alpha_formats[sa]; + pixman_format_code_t daf = alpha_formats[da]; + pixman_image_t *src, *dst, *orig_dst, *alpha, *orig_alpha; + pixman_transform_t t1; + int j, k; + int n_red_bits; + + soff = origins[soff]; + doff = origins[doff]; + + n_red_bits = PIXMAN_FORMAT_R (df); + + /* Source */ + src = make_image (sf); + if (saf != PIXMAN_null) + { + alpha = make_image (saf); + pixman_image_set_alpha_map (src, alpha, soff, soff); + pixman_image_unref (alpha); + } + + /* Destination */ + orig_dst = make_image (df); + dst = make_image (df); + pixman_image_composite (PIXMAN_OP_SRC, orig_dst, NULL, dst, + 0, 0, 0, 0, 0, 0, WIDTH, HEIGHT); + + if (daf != PIXMAN_null) + { + orig_alpha = make_image (daf); + alpha = make_image (daf); + + pixman_image_composite (PIXMAN_OP_SRC, orig_alpha, NULL, alpha, + 0, 0, 0, 0, 0, 0, WIDTH, HEIGHT); + + pixman_image_set_alpha_map (orig_dst, orig_alpha, doff, doff); + pixman_image_set_alpha_map (dst, alpha, doff, doff); + + pixman_image_unref (orig_alpha); + pixman_image_unref (alpha); + } + + /* Transformations, repeats and filters on destinations should be ignored, + * so just set some random ones. + */ + pixman_transform_init_identity (&t1); + pixman_transform_scale (&t1, NULL, pixman_int_to_fixed (100), pixman_int_to_fixed (11)); + pixman_transform_rotate (&t1, NULL, pixman_double_to_fixed (0.5), pixman_double_to_fixed (0.11)); + pixman_transform_translate (&t1, NULL, pixman_int_to_fixed (11), pixman_int_to_fixed (17)); + + pixman_image_set_transform (dst, &t1); + pixman_image_set_filter (dst, PIXMAN_FILTER_BILINEAR, NULL, 0); + pixman_image_set_repeat (dst, PIXMAN_REPEAT_REFLECT); + + pixman_image_composite (PIXMAN_OP_ADD, src, NULL, dst, + 0, 0, 0, 0, 0, 0, WIDTH, HEIGHT); + + for (j = MAX (doff, 0); j < MIN (HEIGHT, HEIGHT + doff); ++j) + { + for (k = MAX (doff, 0); k < MIN (WIDTH, WIDTH + doff); ++k) + { + float sa, da, oda, refa; + uint16_t sr, dr, odr, refr; + float err; + + err = get_alpha_err(sf, saf, df, daf); + + sa = get_alpha (src, k, j, soff, soff); + da = get_alpha (dst, k, j, doff, doff); + oda = get_alpha (orig_dst, k, j, doff, doff); + + if (sa + oda > 1.f) + refa = 1.f; + else + refa = sa + oda; + + if (da - err > refa || + da + err < refa) + { + printf ("\nWrong alpha value at (%d, %d). Should be %g; got %g. Source was %g, original dest was %g\n", + k, j, refa, da, sa, oda); + + printf ("src: %s, alpha: %s, origin %d %d\ndst: %s, alpha: %s, origin: %d %d\n\n", + format_name (sf), + format_name (saf), + soff, soff, + format_name (df), + format_name (daf), + doff, doff); + return 1; + } + + /* There are cases where we go through the 8 bit compositing + * path even with 10bpc formats. This results in incorrect + * results here, so only do the red check for narrow formats + */ + if (n_red_bits <= 8) + { + sr = get_red (src, k, j, soff, soff); + dr = get_red (dst, k, j, doff, doff); + odr = get_red (orig_dst, k, j, doff, doff); + + if (sr + odr > 0xffff) + refr = 0xffff; + else + refr = sr + odr; + + if (abs ((dr >> (16 - n_red_bits)) - (refr >> (16 - n_red_bits))) > 1) + { + printf ("%d red bits\n", n_red_bits); + printf ("\nWrong red value at (%d, %d). Should be 0x%x; got 0x%x. Source was 0x%x, original dest was 0x%x\n", + k, j, refr, dr, sr, odr); + + printf ("src: %s, alpha: %s, origin %d %d\ndst: %s, alpha: %s, origin: %d %d\n\n", + format_name (sf), + format_name (saf), + soff, soff, + format_name (df), + format_name (daf), + doff, doff); + return 1; + } + } + } + } + + pixman_image_set_alpha_map (src, NULL, 0, 0); + pixman_image_set_alpha_map (dst, NULL, 0, 0); + pixman_image_set_alpha_map (orig_dst, NULL, 0, 0); + + pixman_image_unref (src); + pixman_image_unref (dst); + pixman_image_unref (orig_dst); + + return 0; +} + +int +main (int argc, char **argv) +{ + int i, j, a, b, x, y; + + prng_srand (0); + + for (i = 0; i < ARRAY_LENGTH (formats); ++i) + { + for (j = 0; j < ARRAY_LENGTH (formats); ++j) + { + for (a = 0; a < ARRAY_LENGTH (alpha_formats); ++a) + { + for (b = 0; b < ARRAY_LENGTH (alpha_formats); ++b) + { + for (x = 0; x < ARRAY_LENGTH (origins); ++x) + { + for (y = 0; y < ARRAY_LENGTH (origins); ++y) + { + if (run_test (i, j, a, b, x, y) != 0) + return 1; + } + } + } + } + } + } + + return 0; +} diff --git a/libs/pixman-0.40.0/test/blitters-test.c b/libs/pixman-0.40.0/test/blitters-test.c new file mode 100644 index 0000000..026f4b0 --- /dev/null +++ b/libs/pixman-0.40.0/test/blitters-test.c @@ -0,0 +1,399 @@ +/* + * Test program, which stresses the use of different color formats and + * compositing operations. + * + * Script 'fuzzer-find-diff.pl' can be used to narrow down the problem in + * the case of test failure. + */ +#include <stdlib.h> +#include <stdio.h> +#include "utils.h" + +static pixman_indexed_t rgb_palette[9]; +static pixman_indexed_t y_palette[9]; + +/* 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 + +/* Create random image for testing purposes */ +static pixman_image_t * +create_random_image (pixman_format_code_t *allowed_formats, + int max_width, + int max_height, + int max_extra_stride, + pixman_format_code_t *used_fmt) +{ + int n = 0, width, height, stride; + pixman_format_code_t fmt; + uint32_t *buf; + pixman_image_t *img; + + while (allowed_formats[n] != PIXMAN_null) + n++; + + if (n > N_MOST_LIKELY_FORMATS && prng_rand_n (4) != 0) + n = N_MOST_LIKELY_FORMATS; + fmt = allowed_formats[prng_rand_n (n)]; + + width = prng_rand_n (max_width) + 1; + height = prng_rand_n (max_height) + 1; + stride = (width * PIXMAN_FORMAT_BPP (fmt) + 7) / 8 + + prng_rand_n (max_extra_stride + 1); + stride = (stride + 3) & ~3; + + /* do the allocation */ + buf = aligned_malloc (64, stride * height); + + if (prng_rand_n (4) == 0) + { + /* uniform distribution */ + prng_randmemset (buf, stride * height, 0); + } + else + { + /* significantly increased probability for 0x00 and 0xFF */ + prng_randmemset (buf, stride * height, RANDMEMSET_MORE_00_AND_FF); + } + + /* test negative stride */ + if (prng_rand_n (4) == 0) + { + buf += (stride / 4) * (height - 1); + stride = - stride; + } + + img = pixman_image_create_bits (fmt, width, height, buf, 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)])); + } + + if (prng_rand_n (16) == 0) + pixman_image_set_filter (img, PIXMAN_FILTER_BILINEAR, NULL, 0); + + image_endian_swap (img); + + if (used_fmt) *used_fmt = fmt; + return img; +} + +/* Free random image, and optionally update crc32 based on its data */ +static uint32_t +free_random_image (uint32_t initcrc, + pixman_image_t *img, + pixman_format_code_t fmt) +{ + uint32_t crc32 = 0; + uint32_t *data = pixman_image_get_data (img); + + if (fmt != PIXMAN_null) + crc32 = compute_crc32_for_image (initcrc, img); + + if (img->bits.rowstride < 0) + data += img->bits.rowstride * (img->bits.height - 1); + + pixman_image_unref (img); + free (data); + + return crc32; +} + +static 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 +}; + +static 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 pixman_format_code_t mask_fmt_list[] = { + PIXMAN_a8r8g8b8, + PIXMAN_a8, + PIXMAN_a4, + PIXMAN_a1, + PIXMAN_null +}; + + +/* + * Composite operation with pseudorandom images + */ +uint32_t +test_composite (int testnum, int verbose) +{ + pixman_image_t *src_img = NULL; + pixman_image_t *dst_img = NULL; + pixman_image_t *mask_img = NULL; + int src_width, src_height; + int dst_width, dst_height; + int src_stride, dst_stride; + int src_x, src_y; + int dst_x, dst_y; + int mask_x, mask_y; + int w, h; + pixman_op_t op; + pixman_format_code_t src_fmt, dst_fmt, mask_fmt; + uint32_t *srcbuf, *maskbuf; + uint32_t crc32; + int max_width, max_height, max_extra_stride; + FLOAT_REGS_CORRUPTION_DETECTOR_START (); + + max_width = max_height = 24 + testnum / 10000; + max_extra_stride = 4 + testnum / 1000000; + + if (max_width > 256) + max_width = 256; + + if (max_height > 16) + max_height = 16; + + if (max_extra_stride > 8) + max_extra_stride = 8; + + prng_srand (testnum); + + op = op_list[prng_rand_n (ARRAY_LENGTH (op_list))]; + + if (prng_rand_n (8)) + { + /* normal image */ + src_img = create_random_image (img_fmt_list, max_width, max_height, + max_extra_stride, &src_fmt); + } + else + { + /* solid case */ + src_img = create_random_image (img_fmt_list, 1, 1, + max_extra_stride, &src_fmt); + + pixman_image_set_repeat (src_img, PIXMAN_REPEAT_NORMAL); + } + + dst_img = create_random_image (img_fmt_list, max_width, max_height, + max_extra_stride, &dst_fmt); + + src_width = pixman_image_get_width (src_img); + src_height = pixman_image_get_height (src_img); + src_stride = pixman_image_get_stride (src_img); + + dst_width = pixman_image_get_width (dst_img); + dst_height = pixman_image_get_height (dst_img); + dst_stride = pixman_image_get_stride (dst_img); + + srcbuf = pixman_image_get_data (src_img); + + src_x = prng_rand_n (src_width); + src_y = prng_rand_n (src_height); + dst_x = prng_rand_n (dst_width); + dst_y = prng_rand_n (dst_height); + + mask_img = NULL; + mask_fmt = PIXMAN_null; + mask_x = 0; + mask_y = 0; + maskbuf = NULL; + + if ((src_fmt == PIXMAN_x8r8g8b8 || src_fmt == PIXMAN_x8b8g8r8) && + (prng_rand_n (4) == 0)) + { + /* PIXBUF */ + mask_fmt = prng_rand_n (2) ? PIXMAN_a8r8g8b8 : PIXMAN_a8b8g8r8; + mask_img = pixman_image_create_bits (mask_fmt, + src_width, + src_height, + srcbuf, + src_stride); + mask_x = src_x; + mask_y = src_y; + maskbuf = srcbuf; + } + else if (prng_rand_n (2)) + { + if (prng_rand_n (2)) + { + mask_img = create_random_image (mask_fmt_list, max_width, max_height, + max_extra_stride, &mask_fmt); + } + else + { + /* solid case */ + mask_img = create_random_image (mask_fmt_list, 1, 1, + max_extra_stride, &mask_fmt); + pixman_image_set_repeat (mask_img, PIXMAN_REPEAT_NORMAL); + } + + if (prng_rand_n (2)) + pixman_image_set_component_alpha (mask_img, 1); + + mask_x = prng_rand_n (pixman_image_get_width (mask_img)); + mask_y = prng_rand_n (pixman_image_get_height (mask_img)); + } + + + w = prng_rand_n (dst_width - dst_x + 1); + h = prng_rand_n (dst_height - dst_y + 1); + + 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_width=%d, src_height=%d, dst_width=%d, dst_height=%d\n", + src_width, src_height, dst_width, dst_height); + printf ("src_x=%d, src_y=%d, dst_x=%d, dst_y=%d\n", + src_x, src_y, dst_x, dst_y); + printf ("src_stride=%d, dst_stride=%d\n", + src_stride, dst_stride); + printf ("w=%d, h=%d\n", w, h); + } + + pixman_image_composite (op, src_img, mask_img, dst_img, + src_x, src_y, mask_x, mask_y, dst_x, dst_y, w, h); + + if (verbose) + print_image (dst_img); + + free_random_image (0, src_img, PIXMAN_null); + crc32 = free_random_image (0, dst_img, dst_fmt); + + if (mask_img) + { + if (srcbuf == maskbuf) + pixman_image_unref(mask_img); + else + free_random_image (0, mask_img, PIXMAN_null); + } + + FLOAT_REGS_CORRUPTION_DETECTOR_FINISH (); + 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("blitters", 2000000, + 0xCC21DDF0, + test_composite, argc, argv); +} diff --git a/libs/pixman-0.40.0/test/check-formats.c b/libs/pixman-0.40.0/test/check-formats.c new file mode 100644 index 0000000..4e2633c --- /dev/null +++ b/libs/pixman-0.40.0/test/check-formats.c @@ -0,0 +1,176 @@ +#include <ctype.h> +#include "utils.h" + +static int +check_op (pixman_op_t op, + pixman_format_code_t src_format, + pixman_format_code_t dest_format) +{ + uint32_t src_alpha_mask, src_green_mask; + uint32_t dest_alpha_mask, dest_green_mask; + pixel_checker_t src_checker, dest_checker; + pixman_image_t *si, *di; + uint32_t sa, sg, da, dg; + uint32_t s, d; + int retval = 0; + + pixel_checker_init (&src_checker, src_format); + pixel_checker_init (&dest_checker, dest_format); + + pixel_checker_get_masks ( + &src_checker, &src_alpha_mask, NULL, &src_green_mask, NULL); + pixel_checker_get_masks ( + &dest_checker, &dest_alpha_mask, NULL, &dest_green_mask, NULL); + + /* printf ("masks: %x %x %x %x\n", */ + /* src_alpha_mask, src_green_mask, */ + /* dest_alpha_mask, dest_green_mask); */ + + si = pixman_image_create_bits (src_format, 1, 1, &s, 4); + di = pixman_image_create_bits (dest_format, 1, 1, &d, 4); + + sa = 0; + do + { + sg = 0; + do + { + da = 0; + do + { + dg = 0; + do + { + color_t src_color, dest_color, result_color; + uint32_t orig_d; + + s = sa | sg; + d = da | dg; + + orig_d = d; + + pixel_checker_convert_pixel_to_color (&src_checker, s, &src_color); + pixel_checker_convert_pixel_to_color (&dest_checker, d, &dest_color); + + do_composite (op, &src_color, NULL, &dest_color, &result_color, FALSE); + + + if (!is_little_endian()) + { + s <<= 32 - PIXMAN_FORMAT_BPP (src_format); + d <<= 32 - PIXMAN_FORMAT_BPP (dest_format); + } + + pixman_image_composite32 (op, si, NULL, di, + 0, 0, 0, 0, 0, 0, 1, 1); + + if (!is_little_endian()) + d >>= (32 - PIXMAN_FORMAT_BPP (dest_format)); + + if (!pixel_checker_check (&dest_checker, d, &result_color)) + { + printf ("---- test failed ----\n"); + printf ("operator: %-32s\n", operator_name (op)); + printf ("source: %-12s pixel: %08x\n", format_name (src_format), s); + printf ("dest: %-12s pixel: %08x\n", format_name (dest_format), orig_d); + printf ("got: %-12s pixel: %08x\n", format_name (dest_format), d); + + retval = 1; + } + + dg -= dest_green_mask; + dg &= dest_green_mask; + } + while (dg != 0); + + da -= dest_alpha_mask; + da &= dest_alpha_mask; + } + while (da != 0); + + sg -= src_green_mask; + sg &= src_green_mask; + } + while (sg != 0); + + sa -= src_alpha_mask; + sa &= src_alpha_mask; + } + while (sa != 0); + + pixman_image_unref (si); + pixman_image_unref (di); + + return retval; +} + +int +main (int argc, char **argv) +{ + enum { OPTION_OP, OPTION_SRC, OPTION_DEST, LAST_OPTION } option; + pixman_format_code_t src_fmt, dest_fmt; + pixman_op_t op; + + op = PIXMAN_OP_NONE; + src_fmt = PIXMAN_null; + dest_fmt = PIXMAN_null; + + argc--; + argv++; + + for (option = OPTION_OP; option < LAST_OPTION; ++option) + { + char *arg = NULL; + + if (argc) + { + argc--; + arg = *argv++; + } + + switch (option) + { + case OPTION_OP: + if (!arg) + printf (" - missing operator\n"); + else if ((op = operator_from_string (arg)) == PIXMAN_OP_NONE) + printf (" - unknown operator %s\n", arg); + break; + + case OPTION_SRC: + if (!arg) + printf (" - missing source format\n"); + else if ((src_fmt = format_from_string (arg)) == PIXMAN_null) + printf (" - unknown source format %s\n", arg); + break; + + case OPTION_DEST: + if (!arg) + printf (" - missing destination format\n"); + else if ((dest_fmt = format_from_string (arg)) == PIXMAN_null) + printf (" - unknown destination format %s\n", arg); + break; + + default: + assert (0); + break; + } + } + + while (argc--) + { + op = PIXMAN_OP_NONE; + printf (" - unexpected argument: %s\n", *argv++); + } + + if (op == PIXMAN_OP_NONE || src_fmt == PIXMAN_null || dest_fmt == PIXMAN_null) + { + printf ("\nUsage:\n check-formats <operator> <src-format> <dest-format>\n\n"); + list_operators(); + list_formats(); + + return -1; + } + + return check_op (op, src_fmt, dest_fmt); +} diff --git a/libs/pixman-0.40.0/test/combiner-test.c b/libs/pixman-0.40.0/test/combiner-test.c new file mode 100644 index 0000000..01f63a5 --- /dev/null +++ b/libs/pixman-0.40.0/test/combiner-test.c @@ -0,0 +1,151 @@ +#include <stdio.h> +#include <stdlib.h> +#include "utils.h" +#include <sys/types.h> +#include "pixman-private.h" + +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_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_MULTIPLY, + PIXMAN_OP_SCREEN, + PIXMAN_OP_OVERLAY, + PIXMAN_OP_DARKEN, + PIXMAN_OP_LIGHTEN, + PIXMAN_OP_COLOR_DODGE, + PIXMAN_OP_COLOR_BURN, + PIXMAN_OP_HARD_LIGHT, + PIXMAN_OP_DIFFERENCE, + PIXMAN_OP_EXCLUSION, + PIXMAN_OP_SOFT_LIGHT, + PIXMAN_OP_HSL_HUE, + PIXMAN_OP_HSL_SATURATION, + PIXMAN_OP_HSL_COLOR, + PIXMAN_OP_HSL_LUMINOSITY, +}; + +static float +rand_float (void) +{ + uint32_t u = prng_rand(); + + return *(float *)&u; +} + +static void +random_floats (argb_t *argb, int width) +{ + int i; + + for (i = 0; i < width; ++i) + { + argb_t *p = argb + i; + + p->a = rand_float(); + p->r = rand_float(); + p->g = rand_float(); + p->b = rand_float(); + } +} + +#define WIDTH 512 + +static pixman_combine_float_func_t +lookup_combiner (pixman_implementation_t *imp, pixman_op_t op, + pixman_bool_t component_alpha) +{ + pixman_combine_float_func_t f; + + do + { + if (component_alpha) + f = imp->combine_float_ca[op]; + else + f = imp->combine_float[op]; + + imp = imp->fallback; + } + while (!f); + + return f; +} + +int +main () +{ + pixman_implementation_t *impl; + argb_t *src_bytes = malloc (WIDTH * sizeof (argb_t)); + argb_t *mask_bytes = malloc (WIDTH * sizeof (argb_t)); + argb_t *dest_bytes = malloc (WIDTH * sizeof (argb_t)); + int i; + + enable_divbyzero_exceptions(); + + impl = _pixman_internal_only_get_implementation(); + + prng_srand (0); + + for (i = 0; i < ARRAY_LENGTH (op_list); ++i) + { + pixman_op_t op = op_list[i]; + pixman_combine_float_func_t combiner; + int ca; + + for (ca = 0; ca < 2; ++ca) + { + combiner = lookup_combiner (impl, op, ca); + + random_floats (src_bytes, WIDTH); + random_floats (mask_bytes, WIDTH); + random_floats (dest_bytes, WIDTH); + + combiner (impl, op, + (float *)dest_bytes, + (float *)mask_bytes, + (float *)src_bytes, + WIDTH); + } + } + + return 0; +} diff --git a/libs/pixman-0.40.0/test/composite-traps-test.c b/libs/pixman-0.40.0/test/composite-traps-test.c new file mode 100644 index 0000000..86a0355 --- /dev/null +++ b/libs/pixman-0.40.0/test/composite-traps-test.c @@ -0,0 +1,252 @@ +/* Based loosely on scaling-test */ + +#include <stdlib.h> +#include <stdio.h> +#include "utils.h" + +#define MAX_SRC_WIDTH 48 +#define MAX_SRC_HEIGHT 48 +#define MAX_DST_WIDTH 48 +#define MAX_DST_HEIGHT 48 +#define MAX_STRIDE 4 + +static pixman_format_code_t formats[] = +{ + PIXMAN_a8r8g8b8, PIXMAN_a8, PIXMAN_r5g6b5, PIXMAN_a1, PIXMAN_a4 +}; + +static pixman_format_code_t mask_formats[] = +{ + PIXMAN_a1, PIXMAN_a4, PIXMAN_a8, +}; + +static pixman_op_t operators[] = +{ + PIXMAN_OP_OVER, PIXMAN_OP_ADD, PIXMAN_OP_SRC, PIXMAN_OP_IN +}; + +#define RANDOM_ELT(array) \ + ((array)[prng_rand_n(ARRAY_LENGTH((array)))]) + +static void +destroy_bits (pixman_image_t *image, void *data) +{ + fence_free (data); +} + +static pixman_fixed_t +random_fixed (int n) +{ + return prng_rand_n (n << 16); +} + +/* + * Composite operation with pseudorandom images + */ +uint32_t +test_composite (int testnum, + int verbose) +{ + int i; + pixman_image_t * src_img; + pixman_image_t * dst_img; + pixman_region16_t clip; + int dst_width, dst_height; + int dst_stride; + int dst_x, dst_y; + int dst_bpp; + pixman_op_t op; + uint32_t * dst_bits; + uint32_t crc32; + pixman_format_code_t mask_format, dst_format; + pixman_trapezoid_t *traps; + int src_x, src_y; + int n_traps; + + static pixman_color_t colors[] = + { + { 0xffff, 0xffff, 0xffff, 0xffff }, + { 0x0000, 0x0000, 0x0000, 0x0000 }, + { 0xabcd, 0xabcd, 0x0000, 0xabcd }, + { 0x0000, 0x0000, 0x0000, 0xffff }, + { 0x0101, 0x0101, 0x0101, 0x0101 }, + { 0x7777, 0x6666, 0x5555, 0x9999 }, + }; + + FLOAT_REGS_CORRUPTION_DETECTOR_START (); + + prng_srand (testnum); + + op = RANDOM_ELT (operators); + mask_format = RANDOM_ELT (mask_formats); + + /* Create source image */ + + if (prng_rand_n (4) == 0) + { + src_img = pixman_image_create_solid_fill ( + &(colors[prng_rand_n (ARRAY_LENGTH (colors))])); + + src_x = 10; + src_y = 234; + } + else + { + pixman_format_code_t src_format = RANDOM_ELT(formats); + int src_bpp = (PIXMAN_FORMAT_BPP (src_format) + 7) / 8; + int src_width = prng_rand_n (MAX_SRC_WIDTH) + 1; + int src_height = prng_rand_n (MAX_SRC_HEIGHT) + 1; + int src_stride = src_width * src_bpp + prng_rand_n (MAX_STRIDE) * src_bpp; + uint32_t *bits, *orig; + + src_x = -(src_width / 4) + prng_rand_n (src_width * 3 / 2); + src_y = -(src_height / 4) + prng_rand_n (src_height * 3 / 2); + + src_stride = (src_stride + 3) & ~3; + + orig = bits = (uint32_t *)make_random_bytes (src_stride * src_height); + + if (prng_rand_n (2) == 0) + { + bits += (src_stride / 4) * (src_height - 1); + src_stride = - src_stride; + } + + src_img = pixman_image_create_bits ( + src_format, src_width, src_height, bits, src_stride); + + pixman_image_set_destroy_function (src_img, destroy_bits, orig); + + if (prng_rand_n (8) == 0) + { + pixman_box16_t clip_boxes[2]; + int n = prng_rand_n (2) + 1; + + for (i = 0; i < n; i++) + { + clip_boxes[i].x1 = prng_rand_n (src_width); + clip_boxes[i].y1 = prng_rand_n (src_height); + clip_boxes[i].x2 = + clip_boxes[i].x1 + prng_rand_n (src_width - clip_boxes[i].x1); + clip_boxes[i].y2 = + clip_boxes[i].y1 + prng_rand_n (src_height - clip_boxes[i].y1); + + if (verbose) + { + printf ("source clip box: [%d,%d-%d,%d]\n", + clip_boxes[i].x1, clip_boxes[i].y1, + clip_boxes[i].x2, clip_boxes[i].y2); + } + } + + pixman_region_init_rects (&clip, clip_boxes, n); + pixman_image_set_clip_region (src_img, &clip); + pixman_image_set_source_clipping (src_img, 1); + pixman_region_fini (&clip); + } + + image_endian_swap (src_img); + } + + /* Create destination image */ + { + dst_format = RANDOM_ELT(formats); + dst_bpp = (PIXMAN_FORMAT_BPP (dst_format) + 7) / 8; + dst_width = prng_rand_n (MAX_DST_WIDTH) + 1; + dst_height = prng_rand_n (MAX_DST_HEIGHT) + 1; + dst_stride = dst_width * dst_bpp + prng_rand_n (MAX_STRIDE) * dst_bpp; + dst_stride = (dst_stride + 3) & ~3; + + dst_bits = (uint32_t *)make_random_bytes (dst_stride * dst_height); + + if (prng_rand_n (2) == 0) + { + dst_bits += (dst_stride / 4) * (dst_height - 1); + dst_stride = - dst_stride; + } + + dst_x = -(dst_width / 4) + prng_rand_n (dst_width * 3 / 2); + dst_y = -(dst_height / 4) + prng_rand_n (dst_height * 3 / 2); + + dst_img = pixman_image_create_bits ( + dst_format, dst_width, dst_height, dst_bits, dst_stride); + + image_endian_swap (dst_img); + } + + /* Create traps */ + { + int i; + + n_traps = prng_rand_n (25); + traps = fence_malloc (n_traps * sizeof (pixman_trapezoid_t)); + + for (i = 0; i < n_traps; ++i) + { + pixman_trapezoid_t *t = &(traps[i]); + + t->top = random_fixed (MAX_DST_HEIGHT) - MAX_DST_HEIGHT / 2; + t->bottom = t->top + random_fixed (MAX_DST_HEIGHT); + t->left.p1.x = random_fixed (MAX_DST_WIDTH) - MAX_DST_WIDTH / 2; + t->left.p1.y = t->top - random_fixed (50); + t->left.p2.x = random_fixed (MAX_DST_WIDTH) - MAX_DST_WIDTH / 2; + t->left.p2.y = t->bottom + random_fixed (50); + t->right.p1.x = t->left.p1.x + random_fixed (MAX_DST_WIDTH); + t->right.p1.y = t->top - random_fixed (50); + t->right.p2.x = t->left.p2.x + random_fixed (MAX_DST_WIDTH); + t->right.p2.y = t->bottom - random_fixed (50); + } + } + + if (prng_rand_n (8) == 0) + { + pixman_box16_t clip_boxes[2]; + int n = prng_rand_n (2) + 1; + for (i = 0; i < n; i++) + { + clip_boxes[i].x1 = prng_rand_n (dst_width); + clip_boxes[i].y1 = prng_rand_n (dst_height); + clip_boxes[i].x2 = + clip_boxes[i].x1 + prng_rand_n (dst_width - clip_boxes[i].x1); + clip_boxes[i].y2 = + clip_boxes[i].y1 + prng_rand_n (dst_height - clip_boxes[i].y1); + + if (verbose) + { + printf ("destination clip box: [%d,%d-%d,%d]\n", + clip_boxes[i].x1, clip_boxes[i].y1, + clip_boxes[i].x2, clip_boxes[i].y2); + } + } + pixman_region_init_rects (&clip, clip_boxes, n); + pixman_image_set_clip_region (dst_img, &clip); + pixman_region_fini (&clip); + } + + pixman_composite_trapezoids (op, src_img, dst_img, mask_format, + src_x, src_y, dst_x, dst_y, n_traps, traps); + + crc32 = compute_crc32_for_image (0, dst_img); + + if (verbose) + print_image (dst_img); + + if (dst_stride < 0) + dst_bits += (dst_stride / 4) * (dst_height - 1); + + fence_free (dst_bits); + + pixman_image_unref (src_img); + pixman_image_unref (dst_img); + fence_free (traps); + + FLOAT_REGS_CORRUPTION_DETECTOR_FINISH (); + return crc32; +} + +int +main (int argc, const char *argv[]) +{ + return fuzzer_test_main("composite traps", 40000, 0xAF41D210, + test_composite, argc, argv); +} diff --git a/libs/pixman-0.40.0/test/composite.c b/libs/pixman-0.40.0/test/composite.c new file mode 100644 index 0000000..594c697 --- /dev/null +++ b/libs/pixman-0.40.0/test/composite.c @@ -0,0 +1,525 @@ +/* + * Copyright © 2005 Eric Anholt + * Copyright © 2009 Chris Wilson + * Copyright © 2010 Soeren Sandmann + * Copyright © 2010 Red Hat, Inc. + * + * 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 Eric Anholt not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Eric Anholt makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ERIC ANHOLT 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. + */ +#include <stdio.h> +#include <stdlib.h> /* abort() */ +#include <math.h> +#include <time.h> +#include "utils.h" + +typedef struct image_t image_t; + +static const color_t colors[] = +{ + { 1.0, 1.0, 1.0, 1.0 }, + { 1.0, 1.0, 1.0, 0.0 }, + { 0.0, 0.0, 0.0, 1.0 }, + { 0.0, 0.0, 0.0, 0.0 }, + { 1.0, 0.0, 0.0, 1.0 }, + { 0.0, 1.0, 0.0, 1.0 }, + { 0.0, 0.0, 1.0, 1.0 }, + { 0.5, 0.0, 0.0, 0.5 }, +}; + +static uint16_t +_color_double_to_short (double d) +{ + uint32_t i; + + i = (uint32_t) (d * 65536); + i -= (i >> 16); + + return i; +} + +static void +compute_pixman_color (const color_t *color, + pixman_color_t *out) +{ + out->red = _color_double_to_short (color->r); + out->green = _color_double_to_short (color->g); + out->blue = _color_double_to_short (color->b); + out->alpha = _color_double_to_short (color->a); +} + +#define REPEAT 0x01000000 +#define FLAGS 0xff000000 + +static const int sizes[] = +{ + 0, + 1, + 1 | REPEAT, + 10 +}; + +static const pixman_format_code_t formats[] = +{ + /* 32 bpp formats */ + PIXMAN_a8r8g8b8, + PIXMAN_x8r8g8b8, + PIXMAN_a8b8g8r8, + PIXMAN_x8b8g8r8, + PIXMAN_b8g8r8a8, + PIXMAN_b8g8r8x8, + PIXMAN_r8g8b8a8, + PIXMAN_r8g8b8x8, + PIXMAN_x2r10g10b10, + PIXMAN_x2b10g10r10, + PIXMAN_a2r10g10b10, + PIXMAN_a2b10g10r10, + + /* sRGB formats */ + PIXMAN_a8r8g8b8_sRGB, + + /* 24 bpp formats */ + PIXMAN_r8g8b8, + PIXMAN_b8g8r8, + PIXMAN_r5g6b5, + PIXMAN_b5g6r5, + + /* 16 bpp formats */ + PIXMAN_x1r5g5b5, + PIXMAN_x1b5g5r5, + PIXMAN_a1r5g5b5, + PIXMAN_a1b5g5r5, + PIXMAN_a4b4g4r4, + PIXMAN_x4b4g4r4, + PIXMAN_a4r4g4b4, + PIXMAN_x4r4g4b4, + + /* 8 bpp formats */ + PIXMAN_a8, + PIXMAN_r3g3b2, + PIXMAN_b2g3r3, + PIXMAN_a2r2g2b2, + PIXMAN_a2b2g2r2, + PIXMAN_x4a4, + + /* 4 bpp formats */ + PIXMAN_a4, + PIXMAN_r1g2b1, + PIXMAN_b1g2r1, + PIXMAN_a1r1g1b1, + PIXMAN_a1b1g1r1, + + /* 1 bpp formats */ + PIXMAN_a1, +}; + +struct image_t +{ + pixman_image_t *image; + pixman_format_code_t format; + const color_t *color; + pixman_repeat_t repeat; + int size; +}; + +static const pixman_op_t operators[] = +{ + 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_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, +}; + +static uint32_t +get_value (pixman_image_t *image) +{ + uint32_t value = *(uint32_t *)pixman_image_get_data (image); + +#ifdef WORDS_BIGENDIAN + { + pixman_format_code_t format = pixman_image_get_format (image); + value >>= 8 * sizeof(value) - PIXMAN_FORMAT_BPP (format); + } +#endif + + return value; +} + +static char * +describe_image (image_t *info, char *buf) +{ + if (info->size) + { + sprintf (buf, "%s, %dx%d%s", + format_name (info->format), + info->size, info->size, + info->repeat ? " R" :""); + } + else + { + sprintf (buf, "solid"); + } + + return buf; +} + +static char * +describe_color (const color_t *color, char *buf) +{ + sprintf (buf, "%.3f %.3f %.3f %.3f", + color->r, color->g, color->b, color->a); + + return buf; +} + +static pixman_bool_t +composite_test (image_t *dst, + pixman_op_t op, + image_t *src, + image_t *mask, + pixman_bool_t component_alpha, + int testno) +{ + color_t expected, tdst, tsrc, tmsk; + pixel_checker_t checker; + + if (mask) + { + pixman_image_set_component_alpha (mask->image, component_alpha); + + pixman_image_composite (op, src->image, mask->image, dst->image, + 0, 0, 0, 0, 0, 0, dst->size, dst->size); + } + else + { + pixman_image_composite (op, src->image, NULL, dst->image, + 0, 0, + 0, 0, + 0, 0, + dst->size, dst->size); + } + + tdst = *dst->color; + tsrc = *src->color; + + if (mask) + { + tmsk = *mask->color; + } + + /* It turns out that by construction all source, mask etc. colors are + * linear because they are made from fills, and fills are always in linear + * color space. However, if they have been converted to bitmaps, we need + * to simulate the sRGB approximation to pass the test cases. + */ + if (src->size) + { + if (PIXMAN_FORMAT_TYPE (src->format) == PIXMAN_TYPE_ARGB_SRGB) + { + tsrc.r = convert_linear_to_srgb (tsrc.r); + tsrc.g = convert_linear_to_srgb (tsrc.g); + tsrc.b = convert_linear_to_srgb (tsrc.b); + round_color (src->format, &tsrc); + tsrc.r = convert_srgb_to_linear (tsrc.r); + tsrc.g = convert_srgb_to_linear (tsrc.g); + tsrc.b = convert_srgb_to_linear (tsrc.b); + } + else + { + round_color (src->format, &tsrc); + } + } + + if (mask && mask->size) + { + if (PIXMAN_FORMAT_TYPE (mask->format) == PIXMAN_TYPE_ARGB_SRGB) + { + tmsk.r = convert_linear_to_srgb (tmsk.r); + tmsk.g = convert_linear_to_srgb (tmsk.g); + tmsk.b = convert_linear_to_srgb (tmsk.b); + round_color (mask->format, &tmsk); + tmsk.r = convert_srgb_to_linear (tmsk.r); + tmsk.g = convert_srgb_to_linear (tmsk.g); + tmsk.b = convert_srgb_to_linear (tmsk.b); + } + else + { + round_color (mask->format, &tmsk); + } + } + + if (PIXMAN_FORMAT_TYPE (dst->format) == PIXMAN_TYPE_ARGB_SRGB) + { + tdst.r = convert_linear_to_srgb (tdst.r); + tdst.g = convert_linear_to_srgb (tdst.g); + tdst.b = convert_linear_to_srgb (tdst.b); + round_color (dst->format, &tdst); + tdst.r = convert_srgb_to_linear (tdst.r); + tdst.g = convert_srgb_to_linear (tdst.g); + tdst.b = convert_srgb_to_linear (tdst.b); + } + else + { + round_color (dst->format, &tdst); + } + + do_composite (op, + &tsrc, + mask? &tmsk : NULL, + &tdst, + &expected, + component_alpha); + + pixel_checker_init (&checker, dst->format); + + if (!pixel_checker_check (&checker, get_value (dst->image), &expected)) + { + char buf[40], buf2[40]; + int a, r, g, b; + uint32_t pixel; + + printf ("---- Test %d failed ----\n", testno); + printf ("Operator: %s %s\n", + operator_name (op), component_alpha ? "CA" : ""); + + printf ("Source: %s\n", describe_image (src, buf)); + if (mask != NULL) + printf ("Mask: %s\n", describe_image (mask, buf)); + + printf ("Destination: %s\n\n", describe_image (dst, buf)); + printf (" R G B A Rounded\n"); + printf ("Source color: %s %s\n", + describe_color (src->color, buf), + describe_color (&tsrc, buf2)); + if (mask) + { + printf ("Mask color: %s %s\n", + describe_color (mask->color, buf), + describe_color (&tmsk, buf2)); + } + printf ("Dest. color: %s %s\n", + describe_color (dst->color, buf), + describe_color (&tdst, buf2)); + + pixel = get_value (dst->image); + + printf ("Expected: %s\n", describe_color (&expected, buf)); + + pixel_checker_split_pixel (&checker, pixel, &a, &r, &g, &b); + + printf ("Got: %5d %5d %5d %5d [pixel: 0x%08x]\n", r, g, b, a, pixel); + pixel_checker_get_min (&checker, &expected, &a, &r, &g, &b); + printf ("Min accepted: %5d %5d %5d %5d\n", r, g, b, a); + pixel_checker_get_max (&checker, &expected, &a, &r, &g, &b); + printf ("Max accepted: %5d %5d %5d %5d\n", r, g, b, a); + + return FALSE; + } + return TRUE; +} + +static void +image_init (image_t *info, + int color, + int format, + int size) +{ + pixman_color_t fill; + + info->color = &colors[color]; + compute_pixman_color (info->color, &fill); + + info->format = formats[format]; + info->size = sizes[size] & ~FLAGS; + info->repeat = PIXMAN_REPEAT_NONE; + + if (info->size) + { + pixman_image_t *solid; + + info->image = pixman_image_create_bits (info->format, + info->size, info->size, + NULL, 0); + + solid = pixman_image_create_solid_fill (&fill); + pixman_image_composite32 (PIXMAN_OP_SRC, solid, NULL, info->image, + 0, 0, 0, 0, 0, 0, info->size, info->size); + pixman_image_unref (solid); + + if (sizes[size] & REPEAT) + { + pixman_image_set_repeat (info->image, PIXMAN_REPEAT_NORMAL); + info->repeat = PIXMAN_REPEAT_NORMAL; + } + } + else + { + info->image = pixman_image_create_solid_fill (&fill); + } +} + +static void +image_fini (image_t *info) +{ + pixman_image_unref (info->image); +} + +static int +random_size (void) +{ + return prng_rand_n (ARRAY_LENGTH (sizes)); +} + +static int +random_color (void) +{ + return prng_rand_n (ARRAY_LENGTH (colors)); +} + +static int +random_format (void) +{ + return prng_rand_n (ARRAY_LENGTH (formats)); +} + +static pixman_bool_t +run_test (uint32_t seed) +{ + image_t src, mask, dst; + pixman_op_t op; + int ca; + int ok; + + prng_srand (seed); + + image_init (&dst, random_color(), random_format(), 1); + image_init (&src, random_color(), random_format(), random_size()); + image_init (&mask, random_color(), random_format(), random_size()); + + op = operators [prng_rand_n (ARRAY_LENGTH (operators))]; + + ca = prng_rand_n (3); + + switch (ca) + { + case 0: + ok = composite_test (&dst, op, &src, NULL, FALSE, seed); + break; + case 1: + ok = composite_test (&dst, op, &src, &mask, FALSE, seed); + break; + case 2: + ok = composite_test (&dst, op, &src, &mask, + mask.size? TRUE : FALSE, seed); + break; + default: + ok = FALSE; + break; + } + + image_fini (&src); + image_fini (&mask); + image_fini (&dst); + + return ok; +} + +int +main (int argc, char **argv) +{ +#define N_TESTS (8 * 1024 * 1024) + int result = 0; + uint32_t seed; + int32_t i; + + if (argc > 1) + { + char *end; + + i = strtol (argv[1], &end, 0); + + if (end != argv[1]) + { + if (!run_test (i)) + return 1; + else + return 0; + } + else + { + printf ("Usage:\n\n %s <number>\n\n", argv[0]); + return -1; + } + } + + if (getenv ("PIXMAN_RANDOMIZE_TESTS")) + seed = get_random_seed(); + else + seed = 1; + +#ifdef USE_OPENMP +# pragma omp parallel for default(none) shared(result, argv, seed) +#endif + for (i = 0; i <= N_TESTS; ++i) + { + if (!result && !run_test (i + seed)) + { + printf ("Test 0x%08X failed.\n", seed + i); + + result = seed + i; + } + } + + return result; +} diff --git a/libs/pixman-0.40.0/test/cover-test.c b/libs/pixman-0.40.0/test/cover-test.c new file mode 100644 index 0000000..83e2972 --- /dev/null +++ b/libs/pixman-0.40.0/test/cover-test.c @@ -0,0 +1,449 @@ +/* + * 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) + * + */ + +/* + * This test aims to verify both numerical correctness and the honouring of + * array bounds for scaled plots (both nearest-neighbour and bilinear) at or + * close to the boundary conditions for applicability of "cover" type fast paths + * and iter fetch routines. + * + * It has a secondary purpose: by setting the env var EXACT (to any value) it + * will only test plots that are exactly on the boundary condition. This makes + * it possible to ensure that "cover" routines are being used to the maximum, + * although this requires the use of a debugger or code instrumentation to + * verify. + */ + +#include "utils.h" +#include <stdlib.h> +#include <stdio.h> + +/* Approximate limits for random scale factor generation - these ensure we can + * get at least 8x reduction and 8x enlargement. + */ +#define LOG2_MAX_FACTOR (3) + +/* 1/sqrt(2) (or sqrt(0.5), or 2^-0.5) as a 0.32 fixed-point number */ +#define INV_SQRT_2_0POINT32_FIXED (0xB504F334u) + +/* The largest increment that can be generated by random_scale_factor(). + * This occurs when the "mantissa" part is 0xFFFFFFFF and the "exponent" + * part is -LOG2_MAX_FACTOR. + */ +#define MAX_INC ((pixman_fixed_t) \ + (INV_SQRT_2_0POINT32_FIXED >> (31 - 16 - LOG2_MAX_FACTOR))) + +/* Minimum source width (in pixels) based on a typical page size of 4K and + * maximum colour depth of 32bpp. + */ +#define MIN_SRC_WIDTH (4096 / 4) + +/* Derive the destination width so that at max increment we fit within source */ +#define DST_WIDTH (MIN_SRC_WIDTH * pixman_fixed_1 / MAX_INC) + +/* Calculate heights the other way round. + * No limits due to page alignment here. + */ +#define DST_HEIGHT 3 +#define SRC_HEIGHT ((DST_HEIGHT * MAX_INC + pixman_fixed_1 - 1) / pixman_fixed_1) + +/* At the time of writing, all the scaled fast paths use SRC, OVER or ADD + * Porter-Duff operators. XOR is included in the list to ensure good + * representation of iter scanline fetch routines. + */ +static const pixman_op_t op_list[] = { + PIXMAN_OP_SRC, + PIXMAN_OP_OVER, + PIXMAN_OP_ADD, + PIXMAN_OP_XOR, +}; + +/* At the time of writing, all the scaled fast paths use a8r8g8b8, x8r8g8b8 + * or r5g6b5, or red-blue swapped versions of the same. When a mask channel is + * used, it is always a8 (and so implicitly not component alpha). a1r5g5b5 is + * included because it is the only other format to feature in any iters. */ +static const pixman_format_code_t img_fmt_list[] = { + PIXMAN_a8r8g8b8, + PIXMAN_x8r8g8b8, + PIXMAN_r5g6b5, + PIXMAN_a1r5g5b5 +}; + +/* This is a flag reflecting the environment variable EXACT. It can be used + * to ensure that source coordinates corresponding exactly to the "cover" limits + * are used, rather than any "near misses". This can, for example, be used in + * conjunction with a debugger to ensure that only COVER fast paths are used. + */ +static int exact; + +static pixman_image_t * +create_src_image (pixman_format_code_t fmt) +{ + pixman_image_t *tmp_img, *img; + + /* We need the left-most and right-most MIN_SRC_WIDTH pixels to have + * predictable values, even though fence_image_create_bits() may allocate + * an image somewhat larger than that, by an amount that varies depending + * upon the page size on the current platform. The solution is to create a + * temporary non-fenced image that is exactly MIN_SRC_WIDTH wide and blit it + * into the fenced image. + */ + tmp_img = pixman_image_create_bits (fmt, MIN_SRC_WIDTH, SRC_HEIGHT, + NULL, 0); + if (tmp_img == NULL) + return NULL; + + img = fence_image_create_bits (fmt, MIN_SRC_WIDTH, SRC_HEIGHT, TRUE); + if (img == NULL) + { + pixman_image_unref (tmp_img); + return NULL; + } + + prng_randmemset (tmp_img->bits.bits, + tmp_img->bits.rowstride * SRC_HEIGHT * sizeof (uint32_t), + 0); + image_endian_swap (tmp_img); + + pixman_image_composite (PIXMAN_OP_SRC, tmp_img, NULL, img, + 0, 0, 0, 0, 0, 0, + MIN_SRC_WIDTH, SRC_HEIGHT); + pixman_image_composite (PIXMAN_OP_SRC, tmp_img, NULL, img, + 0, 0, 0, 0, img->bits.width - MIN_SRC_WIDTH, 0, + MIN_SRC_WIDTH, SRC_HEIGHT); + + pixman_image_unref (tmp_img); + + return img; +} + +static pixman_fixed_t +random_scale_factor(void) +{ + /* Get a random number with top bit set. */ + uint32_t f = prng_rand () | 0x80000000u; + + /* In log(2) space, this is still approximately evenly spread between 31 + * and 32. Divide by sqrt(2) to centre the distribution on 2^31. + */ + f = ((uint64_t) f * INV_SQRT_2_0POINT32_FIXED) >> 32; + + /* Now shift right (ie divide by an integer power of 2) to spread the + * distribution between centres at 2^(16 +/- LOG2_MAX_FACTOR). + */ + f >>= 31 - 16 + prng_rand_n (2 * LOG2_MAX_FACTOR + 1) - LOG2_MAX_FACTOR; + + return f; +} + +static pixman_fixed_t +calc_translate (int dst_size, + int src_size, + pixman_fixed_t scale, + pixman_bool_t low_align, + pixman_bool_t bilinear) +{ + pixman_fixed_t ref_src, ref_dst, scaled_dst; + + if (low_align) + { + ref_src = bilinear ? pixman_fixed_1 / 2 : pixman_fixed_e; + ref_dst = pixman_fixed_1 / 2; + } + else + { + ref_src = pixman_int_to_fixed (src_size) - + bilinear * pixman_fixed_1 / 2; + ref_dst = pixman_int_to_fixed (dst_size) - pixman_fixed_1 / 2; + } + + scaled_dst = ((uint64_t) ref_dst * scale + pixman_fixed_1 / 2) / + pixman_fixed_1; + + /* We need the translation to be set such that when ref_dst is fed through + * the transformation matrix, we get ref_src as the result. + */ + return ref_src - scaled_dst; +} + +static pixman_fixed_t +random_offset (void) +{ + pixman_fixed_t offset = 0; + + /* Ensure we test the exact case quite a lot */ + if (prng_rand_n (2)) + return offset; + + /* What happens when we are close to the edge of the first + * interpolation step? + */ + if (prng_rand_n (2)) + offset += (pixman_fixed_1 >> BILINEAR_INTERPOLATION_BITS) - 16; + + /* Try fine-grained variations */ + offset += prng_rand_n (32); + + /* Test in both directions */ + if (prng_rand_n (2)) + offset = -offset; + + return offset; +} + +static void +check_transform (pixman_image_t *dst_img, + pixman_image_t *src_img, + pixman_transform_t *transform, + pixman_bool_t bilinear) +{ + pixman_vector_t v1, v2; + + v1.vector[0] = pixman_fixed_1 / 2; + v1.vector[1] = pixman_fixed_1 / 2; + v1.vector[2] = pixman_fixed_1; + assert (pixman_transform_point (transform, &v1)); + + v2.vector[0] = pixman_int_to_fixed (dst_img->bits.width) - + pixman_fixed_1 / 2; + v2.vector[1] = pixman_int_to_fixed (dst_img->bits.height) - + pixman_fixed_1 / 2; + v2.vector[2] = pixman_fixed_1; + assert (pixman_transform_point (transform, &v2)); + + if (bilinear) + { + assert (v1.vector[0] >= pixman_fixed_1 / 2); + assert (v1.vector[1] >= pixman_fixed_1 / 2); + assert (v2.vector[0] <= pixman_int_to_fixed (src_img->bits.width) - + pixman_fixed_1 / 2); + assert (v2.vector[1] <= pixman_int_to_fixed (src_img->bits.height) - + pixman_fixed_1 / 2); + } + else + { + assert (v1.vector[0] >= pixman_fixed_e); + assert (v1.vector[1] >= pixman_fixed_e); + assert (v2.vector[0] <= pixman_int_to_fixed (src_img->bits.width)); + assert (v2.vector[1] <= pixman_int_to_fixed (src_img->bits.height)); + } +} + +static uint32_t +test_cover (int testnum, int verbose) +{ + pixman_fixed_t x_scale, y_scale; + pixman_bool_t left_align, top_align; + pixman_bool_t bilinear; + pixman_filter_t filter; + pixman_op_t op; + size_t src_fmt_index; + pixman_format_code_t src_fmt, dst_fmt, mask_fmt; + pixman_image_t *src_img, *dst_img, *mask_img; + pixman_transform_t src_transform, mask_transform; + pixman_fixed_t fuzz[4]; + uint32_t crc32; + + /* We allocate one fenced image for each pixel format up-front. This is to + * avoid spending a lot of time on memory management rather than on testing + * Pixman optimisations. We need one per thread because the transformation + * matrices and filtering are properties of the source and mask images. + */ + static pixman_image_t *src_imgs[ARRAY_LENGTH (img_fmt_list)]; + static pixman_image_t *mask_bits_img; + static pixman_bool_t fence_images_created; +#ifdef USE_OPENMP +#pragma omp threadprivate (src_imgs) +#pragma omp threadprivate (mask_bits_img) +#pragma omp threadprivate (fence_images_created) +#endif + + if (!fence_images_created) + { + int i; + + prng_srand (0); + + for (i = 0; i < ARRAY_LENGTH (img_fmt_list); i++) + src_imgs[i] = create_src_image (img_fmt_list[i]); + + mask_bits_img = create_src_image (PIXMAN_a8); + + fence_images_created = TRUE; + } + + prng_srand (testnum); + + x_scale = random_scale_factor (); + y_scale = random_scale_factor (); + left_align = prng_rand_n (2); + top_align = prng_rand_n (2); + bilinear = prng_rand_n (2); + filter = bilinear ? PIXMAN_FILTER_BILINEAR : PIXMAN_FILTER_NEAREST; + + op = op_list[prng_rand_n (ARRAY_LENGTH (op_list))]; + + dst_fmt = img_fmt_list[prng_rand_n (ARRAY_LENGTH (img_fmt_list))]; + dst_img = pixman_image_create_bits (dst_fmt, DST_WIDTH, DST_HEIGHT, + NULL, 0); + prng_randmemset (dst_img->bits.bits, + dst_img->bits.rowstride * DST_HEIGHT * sizeof (uint32_t), + 0); + image_endian_swap (dst_img); + + src_fmt_index = prng_rand_n (ARRAY_LENGTH (img_fmt_list)); + src_fmt = img_fmt_list[src_fmt_index]; + src_img = src_imgs[src_fmt_index]; + pixman_image_set_filter (src_img, filter, NULL, 0); + pixman_transform_init_scale (&src_transform, x_scale, y_scale); + src_transform.matrix[0][2] = calc_translate (dst_img->bits.width, + src_img->bits.width, + x_scale, left_align, bilinear); + src_transform.matrix[1][2] = calc_translate (dst_img->bits.height, + src_img->bits.height, + y_scale, top_align, bilinear); + + if (prng_rand_n (2)) + { + /* No mask */ + mask_fmt = PIXMAN_null; + mask_img = NULL; + } + else if (prng_rand_n (2)) + { + /* a8 bitmap mask */ + mask_fmt = PIXMAN_a8; + mask_img = mask_bits_img; + pixman_image_set_filter (mask_img, filter, NULL, 0); + pixman_transform_init_scale (&mask_transform, x_scale, y_scale); + mask_transform.matrix[0][2] = calc_translate (dst_img->bits.width, + mask_img->bits.width, + x_scale, left_align, + bilinear); + mask_transform.matrix[1][2] = calc_translate (dst_img->bits.height, + mask_img->bits.height, + y_scale, top_align, + bilinear); + } + else + { + /* Solid mask */ + pixman_color_t color; + memset (&color, 0xAA, sizeof color); + mask_fmt = PIXMAN_solid; + mask_img = pixman_image_create_solid_fill (&color); + } + + if (!exact) + { + int i = 0; + + while (i < 4) + fuzz[i++] = random_offset (); + + src_transform.matrix[0][2] += fuzz[0]; + src_transform.matrix[1][2] += fuzz[1]; + mask_transform.matrix[0][2] += fuzz[2]; + mask_transform.matrix[1][2] += fuzz[3]; + } + + pixman_image_set_transform (src_img, &src_transform); + if (mask_fmt == PIXMAN_a8) + pixman_image_set_transform (mask_img, &mask_transform); + + 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 ("x_scale=0x%08X, y_scale=0x%08X, align %s/%s, %s\n", + x_scale, y_scale, + left_align ? "left" : "right", top_align ? "top" : "bottom", + bilinear ? "bilinear" : "nearest"); + + if (!exact) + { + int i = 0; + + printf ("fuzz factors"); + while (i < 4) + printf (" %d", fuzz[i++]); + printf ("\n"); + } + } + + if (exact) + { + check_transform (dst_img, src_img, &src_transform, bilinear); + if (mask_fmt == PIXMAN_a8) + check_transform (dst_img, mask_img, &mask_transform, bilinear); + } + + pixman_image_composite (op, src_img, mask_img, dst_img, + 0, 0, 0, 0, 0, 0, + dst_img->bits.width, dst_img->bits.height); + + if (verbose) + print_image (dst_img); + + crc32 = compute_crc32_for_image (0, dst_img); + + pixman_image_unref (dst_img); + if (mask_fmt == PIXMAN_solid) + pixman_image_unref (mask_img); + + return crc32; +} + +#if BILINEAR_INTERPOLATION_BITS == 7 +#define CHECKSUM_FUZZ 0x6B56F607 +#define CHECKSUM_EXACT 0xA669F4A3 +#elif BILINEAR_INTERPOLATION_BITS == 4 +#define CHECKSUM_FUZZ 0x83119ED0 +#define CHECKSUM_EXACT 0x0D3382CD +#else +#define CHECKSUM_FUZZ 0x00000000 +#define CHECKSUM_EXACT 0x00000000 +#endif + +int +main (int argc, const char *argv[]) +{ + unsigned long page_size; + + page_size = fence_get_page_size (); + if (page_size == 0 || page_size > 16 * 1024) + return 77; /* automake SKIP */ + + exact = getenv ("EXACT") != NULL; + if (exact) + printf ("Doing plots that are exactly aligned to boundaries\n"); + + return fuzzer_test_main ("cover", 2000000, + exact ? CHECKSUM_EXACT : CHECKSUM_FUZZ, + test_cover, argc, argv); +} diff --git a/libs/pixman-0.40.0/test/fence-image-self-test.c b/libs/pixman-0.40.0/test/fence-image-self-test.c new file mode 100644 index 0000000..c80b3cf --- /dev/null +++ b/libs/pixman-0.40.0/test/fence-image-self-test.c @@ -0,0 +1,239 @@ +/* + * Copyright © 2015 Raspberry Pi Foundation + * + * 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. + * + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "utils.h" + + +#if FENCE_MALLOC_ACTIVE && defined (HAVE_SIGACTION) + +#include <stdlib.h> +#include <stdio.h> +#include <stdarg.h> +#include <errno.h> +#include <signal.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/wait.h> + +pixman_bool_t verbose; + +static void +segv_handler (int sig, siginfo_t *si, void *unused) +{ + _exit (EXIT_SUCCESS); +} + +static void +die (const char *msg, int err) +{ + if (err) + perror (msg); + else + fprintf (stderr, "%s\n", msg); + + abort (); +} + +static void +prinfo (const char *fmt, ...) +{ + va_list ap; + + if (!verbose) + return; + + va_start (ap, fmt); + vfprintf (stderr, fmt, ap); + va_end (ap); +} + +static void +do_expect_signal (void (*fn)(void *), void *data) +{ + struct sigaction sa; + + sa.sa_flags = SA_SIGINFO; + sigemptyset (&sa.sa_mask); + sa.sa_sigaction = segv_handler; + if (sigaction (SIGSEGV, &sa, NULL) == -1) + die ("sigaction failed", errno); + if (sigaction (SIGBUS, &sa, NULL) == -1) + die ("sigaction failed", errno); + + (*fn)(data); + + _exit (EXIT_FAILURE); +} + +/* Check that calling fn(data) causes a segmentation fault. + * + * You cannot portably return from a SIGSEGV handler in any way, + * so we fork, and do the test in the child process. Child's + * exit status will reflect the result. Its SEGV handler causes it + * to exit with success, and return failure otherwise. + */ +static pixman_bool_t +expect_signal (void (*fn)(void *), void *data) +{ + pid_t pid, wp; + int status; + + pid = fork (); + if (pid == -1) + die ("fork failed", errno); + + if (pid == 0) + do_expect_signal (fn, data); /* never returns */ + + wp = waitpid (pid, &status, 0); + if (wp != pid) + die ("waitpid did not work", wp == -1 ? errno : 0); + + if (WIFEXITED (status) && WEXITSTATUS (status) == EXIT_SUCCESS) + return TRUE; + + return FALSE; +} + +static void +read_u8 (void *data) +{ + volatile uint8_t *p = data; + + *p; +} + +static pixman_bool_t +test_read_fault (uint8_t *p, int offset) +{ + prinfo ("*(uint8_t *)(%p + %d)", p, offset); + + if (expect_signal (read_u8, p + offset)) + { + prinfo ("\tsignal OK\n"); + + return TRUE; + } + + prinfo ("\tFAILED\n"); + + return FALSE; +} + +static void +test_read_ok (uint8_t *p, int offset) +{ + prinfo ("*(uint8_t *)(%p + %d)", p, offset); + + /* If fails, SEGV. */ + read_u8 (p + offset); + + prinfo ("\tOK\n"); +} + +static pixman_bool_t +test_read_faults (pixman_image_t *image) +{ + pixman_bool_t ok = TRUE; + pixman_format_code_t format = pixman_image_get_format (image); + int width = pixman_image_get_width (image); + int height = pixman_image_get_height (image); + int stride = pixman_image_get_stride (image); + uint8_t *p = (void *)pixman_image_get_data (image); + int row_bytes = width * PIXMAN_FORMAT_BPP (format) / 8; + + prinfo ("%s %dx%d, row %d B, stride %d B:\n", + format_name (format), width, height, row_bytes, stride); + + assert (height > 3); + + test_read_ok (p, 0); + test_read_ok (p, row_bytes - 1); + test_read_ok (p, stride); + test_read_ok (p, stride + row_bytes - 1); + test_read_ok (p, 2 * stride); + test_read_ok (p, 2 * stride + row_bytes - 1); + test_read_ok (p, 3 * stride); + test_read_ok (p, (height - 1) * stride + row_bytes - 1); + + ok &= test_read_fault (p, -1); + ok &= test_read_fault (p, row_bytes); + ok &= test_read_fault (p, stride - 1); + ok &= test_read_fault (p, stride + row_bytes); + ok &= test_read_fault (p, 2 * stride - 1); + ok &= test_read_fault (p, 2 * stride + row_bytes); + ok &= test_read_fault (p, 3 * stride - 1); + ok &= test_read_fault (p, height * stride); + + return ok; +} + +static pixman_bool_t +test_image_faults (pixman_format_code_t format, int min_width, int height) +{ + pixman_bool_t ok; + pixman_image_t *image; + + image = fence_image_create_bits (format, min_width, height, TRUE); + ok = test_read_faults (image); + pixman_image_unref (image); + + return ok; +} + +int +main (int argc, char **argv) +{ + pixman_bool_t ok = TRUE; + + if (getenv ("VERBOSE") != NULL) + verbose = TRUE; + + ok &= test_image_faults (PIXMAN_a8r8g8b8, 7, 5); + ok &= test_image_faults (PIXMAN_r8g8b8, 7, 5); + ok &= test_image_faults (PIXMAN_r5g6b5, 7, 5); + ok &= test_image_faults (PIXMAN_a8, 7, 5); + ok &= test_image_faults (PIXMAN_a4, 7, 5); + ok &= test_image_faults (PIXMAN_a1, 7, 5); + + if (ok) + return EXIT_SUCCESS; + + return EXIT_FAILURE; +} + +#else /* FENCE_MALLOC_ACTIVE */ + +int +main (int argc, char **argv) +{ + /* Automake return code for test SKIP. */ + return 77; +} + +#endif /* FENCE_MALLOC_ACTIVE */ diff --git a/libs/pixman-0.40.0/test/fetch-test.c b/libs/pixman-0.40.0/test/fetch-test.c new file mode 100644 index 0000000..04e8cc5 --- /dev/null +++ b/libs/pixman-0.40.0/test/fetch-test.c @@ -0,0 +1,205 @@ +#include <assert.h> +#include <stdlib.h> +#include <stdio.h> +#include "utils.h" + +#define SIZE 1024 + +static pixman_indexed_t mono_palette = +{ + 0, { 0x00000000, 0x00ffffff }, +}; + + +typedef struct { + pixman_format_code_t format; + int width, height; + int stride; + uint32_t src[SIZE]; + uint32_t dst[SIZE]; + pixman_indexed_t *indexed; +} testcase_t; + +static testcase_t testcases[] = +{ + { + PIXMAN_a8r8g8b8, + 2, 2, + 8, + { 0x00112233, 0x44556677, + 0x8899aabb, 0xccddeeff }, + { 0x00112233, 0x44556677, + 0x8899aabb, 0xccddeeff }, + NULL, + }, + { + PIXMAN_r8g8b8a8, + 2, 2, + 8, + { 0x11223300, 0x55667744, + 0x99aabb88, 0xddeeffcc }, + { 0x00112233, 0x44556677, + 0x8899aabb, 0xccddeeff }, + NULL, + }, + { + PIXMAN_g1, + 8, 2, + 4, +#ifdef WORDS_BIGENDIAN + { + 0xaa000000, + 0x55000000 + }, +#else + { + 0x00000055, + 0x000000aa + }, +#endif + { + 0x00ffffff, 0x00000000, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00000000, + 0x00000000, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00000000, 0x00ffffff + }, + &mono_palette, + }, +#if 0 + { + PIXMAN_g8, + 4, 2, + 4, + { 0x01234567, + 0x89abcdef }, + { 0x00010101, 0x00232323, 0x00454545, 0x00676767, + 0x00898989, 0x00ababab, 0x00cdcdcd, 0x00efefef, }, + }, +#endif + /* FIXME: make this work on big endian */ + { + PIXMAN_yv12, + 8, 2, + 8, +#ifdef WORDS_BIGENDIAN + { + 0x00ff00ff, 0x00ff00ff, + 0xff00ff00, 0xff00ff00, + 0x80ff8000, + 0x800080ff + }, +#else + { + 0xff00ff00, 0xff00ff00, + 0x00ff00ff, 0x00ff00ff, + 0x0080ff80, + 0xff800080 + }, +#endif + { + 0xff000000, 0xffffffff, 0xffb80000, 0xffffe113, + 0xff000000, 0xffffffff, 0xff0023ee, 0xff4affff, + 0xffffffff, 0xff000000, 0xffffe113, 0xffb80000, + 0xffffffff, 0xff000000, 0xff4affff, 0xff0023ee, + }, + }, +}; + +int n_test_cases = ARRAY_LENGTH (testcases); + + +static uint32_t +reader (const void *src, int size) +{ + switch (size) + { + case 1: + return *(uint8_t *)src; + case 2: + return *(uint16_t *)src; + case 4: + return *(uint32_t *)src; + default: + assert(0); + return 0; /* silence MSVC */ + } +} + + +static void +writer (void *src, uint32_t value, int size) +{ + switch (size) + { + case 1: + *(uint8_t *)src = value; + break; + case 2: + *(uint16_t *)src = value; + break; + case 4: + *(uint32_t *)src = value; + break; + default: + assert(0); + } +} + + +int +main (int argc, char **argv) +{ + uint32_t dst[SIZE]; + pixman_image_t *src_img; + pixman_image_t *dst_img; + int i, j, x, y; + int ret = 0; + + for (i = 0; i < n_test_cases; ++i) + { + for (j = 0; j < 2; ++j) + { + src_img = pixman_image_create_bits (testcases[i].format, + testcases[i].width, + testcases[i].height, + testcases[i].src, + testcases[i].stride); + pixman_image_set_indexed(src_img, testcases[i].indexed); + + dst_img = pixman_image_create_bits (PIXMAN_a8r8g8b8, + testcases[i].width, + testcases[i].height, + dst, + testcases[i].width*4); + + if (j) + { + pixman_image_set_accessors (src_img, reader, writer); + pixman_image_set_accessors (dst_img, reader, writer); + } + + pixman_image_composite (PIXMAN_OP_SRC, src_img, NULL, dst_img, + 0, 0, 0, 0, 0, 0, testcases[i].width, testcases[i].height); + + pixman_image_unref (src_img); + pixman_image_unref (dst_img); + + for (y = 0; y < testcases[i].height; ++y) + { + for (x = 0; x < testcases[i].width; ++x) + { + int offset = y * testcases[i].width + x; + + if (dst[offset] != testcases[i].dst[offset]) + { + printf ("test %i%c: pixel mismatch at (x=%d,y=%d): %08x expected, %08x obtained\n", + i + 1, 'a' + j, + x, y, + testcases[i].dst[offset], dst[offset]); + ret = 1; + } + } + } + } + } + + return ret; +} diff --git a/libs/pixman-0.40.0/test/filter-reduction-test.c b/libs/pixman-0.40.0/test/filter-reduction-test.c new file mode 100644 index 0000000..705fa4b --- /dev/null +++ b/libs/pixman-0.40.0/test/filter-reduction-test.c @@ -0,0 +1,112 @@ +#include <stdlib.h> +#include <stdio.h> +#include "utils.h" + +static const pixman_fixed_t entries[] = +{ + pixman_double_to_fixed (-1.0), + pixman_double_to_fixed (-0.5), + pixman_double_to_fixed (-1/3.0), + pixman_double_to_fixed (0.0), + pixman_double_to_fixed (0.5), + pixman_double_to_fixed (1.0), + pixman_double_to_fixed (1.5), + pixman_double_to_fixed (2.0), + pixman_double_to_fixed (3.0), +}; + +#define SIZE 12 + +static uint32_t +test_scale (const pixman_transform_t *xform, uint32_t crc) +{ + uint32_t *srcbuf, *dstbuf; + pixman_image_t *src, *dest; + + srcbuf = malloc (SIZE * SIZE * 4); + prng_randmemset (srcbuf, SIZE * SIZE * 4, 0); + src = pixman_image_create_bits ( + PIXMAN_a8r8g8b8, SIZE, SIZE, srcbuf, SIZE * 4); + + dstbuf = malloc (SIZE * SIZE * 4); + prng_randmemset (dstbuf, SIZE * SIZE * 4, 0); + dest = pixman_image_create_bits ( + PIXMAN_a8r8g8b8, SIZE, SIZE, dstbuf, SIZE * 4); + + pixman_image_set_transform (src, xform); + pixman_image_set_repeat (src, PIXMAN_REPEAT_NORMAL); + pixman_image_set_filter (src, PIXMAN_FILTER_BILINEAR, NULL, 0); + + image_endian_swap (src); + image_endian_swap (dest); + + pixman_image_composite (PIXMAN_OP_SRC, + src, NULL, dest, + 0, 0, 0, 0, 0, 0, + SIZE, SIZE); + + crc = compute_crc32_for_image (crc, dest); + + pixman_image_unref (src); + pixman_image_unref (dest); + + free (srcbuf); + free (dstbuf); + + return crc; +} + +#if BILINEAR_INTERPOLATION_BITS == 7 +#define CHECKSUM 0x02169677 +#elif BILINEAR_INTERPOLATION_BITS == 4 +#define CHECKSUM 0xE44B29AC +#else +#define CHECKSUM 0x00000000 +#endif + +int +main (int argc, const char *argv[]) +{ + const pixman_fixed_t *end = entries + ARRAY_LENGTH (entries); + const pixman_fixed_t *t0, *t1, *t2, *t3, *t4, *t5; + uint32_t crc = 0; + + prng_srand (0x56EA1DBD); + + for (t0 = entries; t0 < end; ++t0) + { + for (t1 = entries; t1 < end; ++t1) + { + for (t2 = entries; t2 < end; ++t2) + { + for (t3 = entries; t3 < end; ++t3) + { + for (t4 = entries; t4 < end; ++t4) + { + for (t5 = entries; t5 < end; ++t5) + { + pixman_transform_t xform = { + { { *t0, *t1, *t2 }, + { *t3, *t4, *t5 }, + { 0, 0, pixman_fixed_1 } } + }; + + crc = test_scale (&xform, crc); + } + } + } + } + } + } + + if (crc != CHECKSUM) + { + printf ("filter-reduction-test failed! (checksum=0x%08X, expected 0x%08X)\n", crc, CHECKSUM); + return 1; + } + else + { + printf ("filter-reduction-test passed (checksum=0x%08X)\n", crc); + return 0; + } +} diff --git a/libs/pixman-0.40.0/test/glyph-test.c b/libs/pixman-0.40.0/test/glyph-test.c new file mode 100644 index 0000000..1811add --- /dev/null +++ b/libs/pixman-0.40.0/test/glyph-test.c @@ -0,0 +1,332 @@ +#include <stdlib.h> +#include "utils.h" + +static const pixman_format_code_t glyph_formats[] = +{ + PIXMAN_a8r8g8b8, + PIXMAN_a8, + PIXMAN_a4, + PIXMAN_a1, + PIXMAN_x8r8g8b8, + PIXMAN_r3g3b2, + PIXMAN_null, +}; + +static const pixman_format_code_t formats[] = +{ + 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 use floating point */ + 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_x4a4, + PIXMAN_a4, + PIXMAN_r1g2b1, + PIXMAN_b1g2r1, + PIXMAN_a1r1g1b1, + PIXMAN_a1b1g1r1, + PIXMAN_null, +}; + +static const pixman_op_t operators[] = +{ + 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 +}; + +enum +{ + ALLOW_CLIPPED = (1 << 0), + ALLOW_ALPHA_MAP = (1 << 1), + ALLOW_SOURCE_CLIPPING = (1 << 2), + ALLOW_REPEAT = (1 << 3), + ALLOW_SOLID = (1 << 4), + ALLOW_FENCED_MEMORY = (1 << 5), +}; + +static void +destroy_fenced (pixman_image_t *image, void *data) +{ + fence_free (data); +} + +static void +destroy_malloced (pixman_image_t *image, void *data) +{ + free (data); +} + +static pixman_format_code_t +random_format (const pixman_format_code_t *formats) +{ + int i; + i = 0; + while (formats[i] != PIXMAN_null) + ++i; + return formats[prng_rand_n (i)]; +} + +static pixman_image_t * +create_image (int max_size, const pixman_format_code_t *formats, uint32_t flags) +{ + int width, height; + pixman_image_t *image; + pixman_format_code_t format; + uint32_t *data; + int bpp; + int stride; + int i; + pixman_image_destroy_func_t destroy; + + if ((flags & ALLOW_SOLID) && prng_rand_n (4) == 0) + { + pixman_color_t color; + + color.alpha = prng_rand(); + color.red = prng_rand(); + color.green = prng_rand(); + color.blue = prng_rand(); + + return pixman_image_create_solid_fill (&color); + } + + width = prng_rand_n (max_size) + 1; + height = prng_rand_n (max_size) + 1; + format = random_format (formats); + + bpp = PIXMAN_FORMAT_BPP (format); + stride = (width * bpp + 7) / 8 + prng_rand_n (17); + stride = (stride + 3) & ~3; + + if (prng_rand_n (64) == 0) + { + if (!(data = (uint32_t *)make_random_bytes (stride * height))) + { + fprintf (stderr, "Out of memory\n"); + abort (); + } + destroy = destroy_fenced; + } + else + { + data = malloc (stride * height); + prng_randmemset (data, height * stride, 0); + destroy = destroy_malloced; + } + + image = pixman_image_create_bits (format, width, height, data, stride); + pixman_image_set_destroy_function (image, destroy, data); + + if ((flags & ALLOW_CLIPPED) && prng_rand_n (8) == 0) + { + pixman_box16_t clip_boxes[8]; + pixman_region16_t clip; + int n = prng_rand_n (8) + 1; + + for (i = 0; i < n; i++) + { + clip_boxes[i].x1 = prng_rand_n (width); + clip_boxes[i].y1 = prng_rand_n (height); + clip_boxes[i].x2 = + clip_boxes[i].x1 + prng_rand_n (width - clip_boxes[i].x1); + clip_boxes[i].y2 = + clip_boxes[i].y1 + prng_rand_n (height - clip_boxes[i].y1); + } + + pixman_region_init_rects (&clip, clip_boxes, n); + pixman_image_set_clip_region (image, &clip); + pixman_region_fini (&clip); + } + + if ((flags & ALLOW_SOURCE_CLIPPING) && prng_rand_n (4) == 0) + { + pixman_image_set_source_clipping (image, TRUE); + pixman_image_set_has_client_clip (image, TRUE); + } + + if ((flags & ALLOW_ALPHA_MAP) && prng_rand_n (16) == 0) + { + pixman_image_t *alpha_map; + int alpha_x, alpha_y; + + alpha_x = prng_rand_n (width); + alpha_y = prng_rand_n (height); + alpha_map = + create_image (max_size, formats, (flags & ~(ALLOW_ALPHA_MAP | ALLOW_SOLID))); + pixman_image_set_alpha_map (image, alpha_map, alpha_x, alpha_y); + pixman_image_unref (alpha_map); + } + + if ((flags & ALLOW_REPEAT) && prng_rand_n (2) == 0) + pixman_image_set_repeat (image, prng_rand_n (4)); + + image_endian_swap (image); + + return image; +} + +#define KEY1(p) ((void *)(((uintptr_t)p) ^ (0xa7e23dfaUL))) +#define KEY2(p) ((void *)(((uintptr_t)p) ^ (0xabcd9876UL))) + +#define MAX_GLYPHS 32 + +uint32_t +test_glyphs (int testnum, int verbose) +{ + pixman_image_t *glyph_images[MAX_GLYPHS]; + pixman_glyph_t glyphs[4 * MAX_GLYPHS]; + uint32_t crc32 = 0; + pixman_image_t *source, *dest; + int n_glyphs, i; + pixman_glyph_cache_t *cache; + + prng_srand (testnum); + + cache = pixman_glyph_cache_create (); + + source = create_image (300, formats, + ALLOW_CLIPPED | ALLOW_ALPHA_MAP | + ALLOW_SOURCE_CLIPPING | + ALLOW_REPEAT | ALLOW_SOLID); + + dest = create_image (128, formats, + ALLOW_CLIPPED | ALLOW_ALPHA_MAP | + ALLOW_SOURCE_CLIPPING); + + pixman_glyph_cache_freeze (cache); + + n_glyphs = prng_rand_n (MAX_GLYPHS); + for (i = 0; i < n_glyphs; ++i) + glyph_images[i] = create_image (32, glyph_formats, 0); + + for (i = 0; i < 4 * n_glyphs; ++i) + { + int g = prng_rand_n (n_glyphs); + pixman_image_t *glyph_img = glyph_images[g]; + void *key1 = KEY1 (glyph_img); + void *key2 = KEY2 (glyph_img); + const void *glyph; + + if (!(glyph = pixman_glyph_cache_lookup (cache, key1, key2))) + { + glyph = + pixman_glyph_cache_insert (cache, key1, key2, 5, 8, glyph_img); + } + + glyphs[i].glyph = glyph; + glyphs[i].x = prng_rand_n (128); + glyphs[i].y = prng_rand_n (128); + } + + if (prng_rand_n (2) == 0) + { + int src_x = prng_rand_n (300) - 150; + int src_y = prng_rand_n (300) - 150; + int mask_x = prng_rand_n (64) - 32; + int mask_y = prng_rand_n (64) - 32; + int dest_x = prng_rand_n (64) - 32; + int dest_y = prng_rand_n (64) - 32; + int width = prng_rand_n (64); + int height = prng_rand_n (64); + pixman_op_t op = operators[prng_rand_n (ARRAY_LENGTH (operators))]; + pixman_format_code_t format = random_format (glyph_formats); + + pixman_composite_glyphs ( + op, + source, dest, format, + src_x, src_y, + mask_x, mask_y, + dest_x, dest_y, + width, height, + cache, 4 * n_glyphs, glyphs); + } + else + { + pixman_op_t op = operators[prng_rand_n (ARRAY_LENGTH (operators))]; + int src_x = prng_rand_n (300) - 150; + int src_y = prng_rand_n (300) - 150; + int dest_x = prng_rand_n (64) - 32; + int dest_y = prng_rand_n (64) - 32; + + pixman_composite_glyphs_no_mask ( + op, source, dest, + src_x, src_y, + dest_x, dest_y, + cache, 4 * n_glyphs, glyphs); + } + + pixman_glyph_cache_thaw (cache); + + for (i = 0; i < n_glyphs; ++i) + { + pixman_image_t *img = glyph_images[i]; + void *key1, *key2; + + key1 = KEY1 (img); + key2 = KEY2 (img); + + pixman_glyph_cache_remove (cache, key1, key2); + pixman_image_unref (glyph_images[i]); + } + + crc32 = compute_crc32_for_image (0, dest); + + pixman_image_unref (source); + pixman_image_unref (dest); + + pixman_glyph_cache_destroy (cache); + + return crc32; +} + +int +main (int argc, const char *argv[]) +{ + return fuzzer_test_main ("glyph", 30000, + 0xFA478A79, + test_glyphs, argc, argv); +} diff --git a/libs/pixman-0.40.0/test/gradient-crash-test.c b/libs/pixman-0.40.0/test/gradient-crash-test.c new file mode 100644 index 0000000..962d1cb --- /dev/null +++ b/libs/pixman-0.40.0/test/gradient-crash-test.c @@ -0,0 +1,158 @@ +#include <stdio.h> +#include <stdlib.h> +#include "utils.h" + +int +main (int argc, char **argv) +{ +#define WIDTH 400 +#define HEIGHT 200 + + uint32_t *dest = malloc (WIDTH * HEIGHT * 4); + pixman_image_t *src_img; + pixman_image_t *dest_img; + int i, j, k, p; + + typedef struct + { + pixman_point_fixed_t p0; + pixman_point_fixed_t p1; + } point_pair_t; + + pixman_gradient_stop_t onestop[1] = + { + { pixman_int_to_fixed (1), { 0xffff, 0xeeee, 0xeeee, 0xeeee } }, + }; + + pixman_gradient_stop_t subsetstops[2] = + { + { pixman_int_to_fixed (1), { 0xffff, 0xeeee, 0xeeee, 0xeeee } }, + { pixman_int_to_fixed (1), { 0xffff, 0xeeee, 0xeeee, 0xeeee } }, + }; + + pixman_gradient_stop_t stops01[2] = + { + { pixman_int_to_fixed (0), { 0xffff, 0xeeee, 0xeeee, 0xeeee } }, + { pixman_int_to_fixed (1), { 0xffff, 0x1111, 0x1111, 0x1111 } } + }; + + point_pair_t point_pairs [] = + { { { pixman_double_to_fixed (0), 0 }, + { pixman_double_to_fixed (WIDTH / 8.), pixman_int_to_fixed (0) } }, + { { pixman_double_to_fixed (WIDTH / 2.0), pixman_double_to_fixed (HEIGHT / 2.0) }, + { pixman_double_to_fixed (WIDTH / 2.0), pixman_double_to_fixed (HEIGHT / 2.0) } } + }; + + pixman_transform_t transformations[] = { + { + { { pixman_double_to_fixed (2), pixman_double_to_fixed (0.5), pixman_double_to_fixed (-100), }, + { pixman_double_to_fixed (0), pixman_double_to_fixed (3), pixman_double_to_fixed (0), }, + { pixman_double_to_fixed (0), pixman_double_to_fixed (0.000), pixman_double_to_fixed (1.0) } + } + }, + { + { { pixman_double_to_fixed (1), pixman_double_to_fixed (0), pixman_double_to_fixed (0), }, + { pixman_double_to_fixed (0), pixman_double_to_fixed (1), pixman_double_to_fixed (0), }, + { pixman_double_to_fixed (0), pixman_double_to_fixed (0.000), pixman_double_to_fixed (1.0) } + } + }, + { + { { pixman_double_to_fixed (2), pixman_double_to_fixed (1), pixman_double_to_fixed (0), }, + { pixman_double_to_fixed (1), pixman_double_to_fixed (1), pixman_double_to_fixed (0), }, + { pixman_double_to_fixed (2), pixman_double_to_fixed (1.000), pixman_double_to_fixed (1.0) } + } + }, + { + { { pixman_double_to_fixed (2), pixman_double_to_fixed (1), pixman_double_to_fixed (0), }, + { pixman_double_to_fixed (1), pixman_double_to_fixed (1), pixman_double_to_fixed (0), }, + { pixman_double_to_fixed (0), pixman_double_to_fixed (0), pixman_double_to_fixed (0) } + } + }, + { + { { pixman_double_to_fixed (2), pixman_double_to_fixed (1), pixman_double_to_fixed (0), }, + { pixman_double_to_fixed (1), pixman_double_to_fixed (1), pixman_double_to_fixed (0), }, + { pixman_double_to_fixed (2), pixman_double_to_fixed (-1), pixman_double_to_fixed (0) } + } + }, + { + { { pixman_double_to_fixed (2), pixman_double_to_fixed (1), pixman_double_to_fixed (3), }, + { pixman_double_to_fixed (1), pixman_double_to_fixed (1), pixman_double_to_fixed (0), }, + { pixman_double_to_fixed (2), pixman_double_to_fixed (-1), pixman_double_to_fixed (0) } + } + }, + }; + + pixman_fixed_t r_inner; + pixman_fixed_t r_outer; + + enable_divbyzero_exceptions(); + + for (i = 0; i < WIDTH * HEIGHT; ++i) + dest[i] = 0x4f00004f; /* pale blue */ + + dest_img = pixman_image_create_bits (PIXMAN_a8r8g8b8, + WIDTH, HEIGHT, + dest, + WIDTH * 4); + + r_inner = 0; + r_outer = pixman_double_to_fixed (50.0); + + for (i = 0; i < 3; ++i) + { + pixman_gradient_stop_t *stops; + int num_stops; + + if (i == 0) + { + stops = onestop; + num_stops = ARRAY_LENGTH (onestop); + } + else if (i == 1) + { + stops = subsetstops; + num_stops = ARRAY_LENGTH (subsetstops); + } + else + { + stops = stops01; + num_stops = ARRAY_LENGTH (stops01); + } + + for (j = 0; j < 3; ++j) + { + for (p = 0; p < ARRAY_LENGTH (point_pairs); ++p) + { + point_pair_t *pair = &(point_pairs[p]); + + if (j == 0) + src_img = pixman_image_create_conical_gradient (&(pair->p0), r_inner, + stops, num_stops); + else if (j == 1) + src_img = pixman_image_create_radial_gradient (&(pair->p0), &(pair->p1), + r_inner, r_outer, + stops, num_stops); + else + src_img = pixman_image_create_linear_gradient (&(pair->p0), &(pair->p1), + stops, num_stops); + + for (k = 0; k < ARRAY_LENGTH (transformations); ++k) + { + pixman_image_set_transform (src_img, &transformations[k]); + + pixman_image_set_repeat (src_img, PIXMAN_REPEAT_NONE); + pixman_image_composite (PIXMAN_OP_OVER, src_img, NULL, dest_img, + 0, 0, 0, 0, 0, 0, 10 * WIDTH, HEIGHT); + } + + pixman_image_unref (src_img); + } + + } + } + + pixman_image_unref (dest_img); + free (dest); + + return 0; +} diff --git a/libs/pixman-0.40.0/test/infinite-loop.c b/libs/pixman-0.40.0/test/infinite-loop.c new file mode 100644 index 0000000..02addaa --- /dev/null +++ b/libs/pixman-0.40.0/test/infinite-loop.c @@ -0,0 +1,39 @@ +#include <assert.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "utils.h" + +int +main (int argc, char **argv) +{ +#define SRC_WIDTH 16 +#define SRC_HEIGHT 12 +#define DST_WIDTH 7 +#define DST_HEIGHT 2 + + static const pixman_transform_t transform = { + { { 0x200017bd, 0x00000000, 0x000e6465 }, + { 0x00000000, 0x000a42fd, 0x000e6465 }, + { 0x00000000, 0x00000000, 0x00010000 }, + } + }; + pixman_image_t *src, *dest; + + src = pixman_image_create_bits ( + PIXMAN_a8r8g8b8, SRC_WIDTH, SRC_HEIGHT, NULL, -1); + dest = pixman_image_create_bits ( + PIXMAN_a8r8g8b8, DST_WIDTH, DST_HEIGHT, NULL, -1); + + pixman_image_set_transform (src, &transform); + pixman_image_set_repeat (src, PIXMAN_REPEAT_NORMAL); + pixman_image_set_filter (src, PIXMAN_FILTER_BILINEAR, NULL, 0); + + if (argc == 1 || strcmp (argv[1], "-nf") != 0) + fail_after (1, "infinite loop detected"); + + pixman_image_composite ( + PIXMAN_OP_OVER, src, NULL, dest, -3, -3, 0, 0, 0, 0, 6, 2); + + return 0; +} diff --git a/libs/pixman-0.40.0/test/lowlevel-blt-bench.c b/libs/pixman-0.40.0/test/lowlevel-blt-bench.c new file mode 100644 index 0000000..7ba2986 --- /dev/null +++ b/libs/pixman-0.40.0/test/lowlevel-blt-bench.c @@ -0,0 +1,1161 @@ +/* + * Copyright © 2009 Nokia Corporation + * Copyright © 2010 Movial Creative Technologies Oy + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "utils.h" + +#define SOLID_FLAG 1 +#define CA_FLAG 2 + +#define L1CACHE_SIZE (8 * 1024) +#define L2CACHE_SIZE (128 * 1024) + +/* This is applied to both L1 and L2 tests - alternatively, you could + * parameterise bench_L or split it into two functions. It could be + * read at runtime on some architectures, but it only really matters + * that it's a number that's an integer divisor of both cacheline + * lengths, and further, it only really matters for caches that don't + * do allocate0on-write. */ +#define CACHELINE_LENGTH (32) /* bytes */ + +#define WIDTH 1920 +#define HEIGHT 1080 +#define BUFSIZE (WIDTH * HEIGHT * 4) +#define XWIDTH 256 +#define XHEIGHT 256 +#define TILEWIDTH 32 +#define TINYWIDTH 8 + +#define EXCLUDE_OVERHEAD 1 + +uint32_t *dst; +uint32_t *src; +uint32_t *mask; + +double bandwidth = 0.0; + +double +bench_memcpy () +{ + int64_t n = 0, total; + double t1, t2; + int x = 0; + + t1 = gettime (); + while (1) + { + memcpy (dst, src, BUFSIZE - 64); + memcpy (src, dst, BUFSIZE - 64); + n += 4 * (BUFSIZE - 64); + t2 = gettime (); + if (t2 - t1 > 0.5) + break; + } + n = total = n * 5; + t1 = gettime (); + while (n > 0) + { + if (++x >= 64) + x = 0; + memcpy ((char *)dst + 1, (char *)src + x, BUFSIZE - 64); + memcpy ((char *)src + 1, (char *)dst + x, BUFSIZE - 64); + n -= 4 * (BUFSIZE - 64); + } + t2 = gettime (); + return (double)total / (t2 - t1); +} + +static pixman_bool_t use_scaling = FALSE; +static pixman_filter_t filter = PIXMAN_FILTER_NEAREST; +static pixman_bool_t use_csv_output = FALSE; + +/* nearly 1x scale factor */ +static pixman_transform_t m = +{ + { + { pixman_fixed_1 + 1, 0, 0 }, + { 0, pixman_fixed_1, 0 }, + { 0, 0, pixman_fixed_1 } + } +}; + +static void +pixman_image_composite_wrapper (pixman_implementation_t *impl, + pixman_composite_info_t *info) +{ + if (use_scaling) + { + pixman_image_set_filter (info->src_image, filter, NULL, 0); + pixman_image_set_transform(info->src_image, &m); + } + pixman_image_composite (info->op, + info->src_image, info->mask_image, info->dest_image, + info->src_x, info->src_y, + info->mask_x, info->mask_y, + info->dest_x, info->dest_y, + info->width, info->height); +} + +static void +pixman_image_composite_empty (pixman_implementation_t *impl, + pixman_composite_info_t *info) +{ + if (use_scaling) + { + pixman_image_set_filter (info->src_image, filter, NULL, 0); + pixman_image_set_transform(info->src_image, &m); + } + pixman_image_composite (info->op, + info->src_image, info->mask_image, info->dest_image, + 0, 0, 0, 0, 0, 0, 1, 1); +} + +static inline void +call_func (pixman_composite_func_t func, + pixman_op_t op, + pixman_image_t * src_image, + pixman_image_t * mask_image, + pixman_image_t * dest_image, + int32_t src_x, + int32_t src_y, + int32_t mask_x, + int32_t mask_y, + int32_t dest_x, + int32_t dest_y, + int32_t width, + int32_t height) +{ + pixman_composite_info_t info; + + info.op = op; + info.src_image = src_image; + info.mask_image = mask_image; + info.dest_image = dest_image; + info.src_x = src_x; + info.src_y = src_y; + info.mask_x = mask_x; + info.mask_y = mask_y; + info.dest_x = dest_x; + info.dest_y = dest_y; + info.width = width; + info.height = height; + + func (0, &info); +} + +double +noinline +bench_L (pixman_op_t op, + pixman_image_t * src_img, + pixman_image_t * mask_img, + pixman_image_t * dst_img, + int64_t n, + pixman_composite_func_t func, + int width, + int lines_count) +{ + int64_t i, j, k; + int x = 0; + int q = 0; + + for (i = 0; i < n; i++) + { + /* For caches without allocate-on-write, we need to force the + * destination buffer back into the cache on each iteration, + * otherwise if they are evicted during the test, they remain + * uncached. This doesn't matter for tests which read the + * destination buffer, or for caches that do allocate-on-write, + * but in those cases this loop just adds constant time, which + * should be successfully cancelled out. + */ + for (j = 0; j < lines_count; j++) + { + for (k = 0; k < width + 62; k += CACHELINE_LENGTH / sizeof *dst) + { + q += dst[j * WIDTH + k]; + } + q += dst[j * WIDTH + width + 62]; + } + if (++x >= 64) + x = 0; + call_func (func, op, src_img, mask_img, dst_img, x, 0, x, 0, 63 - x, 0, width, lines_count); + } + + return (double)n * lines_count * width; +} + +double +noinline +bench_M (pixman_op_t op, + pixman_image_t * src_img, + pixman_image_t * mask_img, + pixman_image_t * dst_img, + int64_t n, + pixman_composite_func_t func) +{ + int64_t i; + int x = 0; + + for (i = 0; i < n; i++) + { + if (++x >= 64) + x = 0; + call_func (func, op, src_img, mask_img, dst_img, x, 0, x, 0, 1, 0, WIDTH - 64, HEIGHT); + } + + return (double)n * (WIDTH - 64) * HEIGHT; +} + +double +noinline +bench_HT (pixman_op_t op, + pixman_image_t * src_img, + pixman_image_t * mask_img, + pixman_image_t * dst_img, + int64_t n, + pixman_composite_func_t func) +{ + double pix_cnt = 0; + int x = 0; + int y = 0; + int64_t i; + + srand (0); + for (i = 0; i < n; i++) + { + int w = (rand () % (TILEWIDTH * 2)) + 1; + int h = (rand () % (TILEWIDTH * 2)) + 1; + if (x + w > WIDTH) + { + x = 0; + y += TILEWIDTH * 2; + } + if (y + h > HEIGHT) + { + y = 0; + } + call_func (func, op, src_img, mask_img, dst_img, x, y, x, y, x, y, w, h); + x += w; + pix_cnt += w * h; + } + return pix_cnt; +} + +double +noinline +bench_VT (pixman_op_t op, + pixman_image_t * src_img, + pixman_image_t * mask_img, + pixman_image_t * dst_img, + int64_t n, + pixman_composite_func_t func) +{ + double pix_cnt = 0; + int x = 0; + int y = 0; + int64_t i; + + srand (0); + for (i = 0; i < n; i++) + { + int w = (rand () % (TILEWIDTH * 2)) + 1; + int h = (rand () % (TILEWIDTH * 2)) + 1; + if (y + h > HEIGHT) + { + y = 0; + x += TILEWIDTH * 2; + } + if (x + w > WIDTH) + { + x = 0; + } + call_func (func, op, src_img, mask_img, dst_img, x, y, x, y, x, y, w, h); + y += h; + pix_cnt += w * h; + } + return pix_cnt; +} + +double +noinline +bench_R (pixman_op_t op, + pixman_image_t * src_img, + pixman_image_t * mask_img, + pixman_image_t * dst_img, + int64_t n, + pixman_composite_func_t func, + int maxw, + int maxh) +{ + double pix_cnt = 0; + int64_t i; + + if (maxw <= TILEWIDTH * 2 || maxh <= TILEWIDTH * 2) + { + printf("error: maxw <= TILEWIDTH * 2 || maxh <= TILEWIDTH * 2\n"); + return 0; + } + + srand (0); + for (i = 0; i < n; i++) + { + int w = (rand () % (TILEWIDTH * 2)) + 1; + int h = (rand () % (TILEWIDTH * 2)) + 1; + int sx = rand () % (maxw - TILEWIDTH * 2); + int sy = rand () % (maxh - TILEWIDTH * 2); + int dx = rand () % (maxw - TILEWIDTH * 2); + int dy = rand () % (maxh - TILEWIDTH * 2); + call_func (func, op, src_img, mask_img, dst_img, sx, sy, sx, sy, dx, dy, w, h); + pix_cnt += w * h; + } + return pix_cnt; +} + +double +noinline +bench_RT (pixman_op_t op, + pixman_image_t * src_img, + pixman_image_t * mask_img, + pixman_image_t * dst_img, + int64_t n, + pixman_composite_func_t func, + int maxw, + int maxh) +{ + double pix_cnt = 0; + int64_t i; + + if (maxw <= TINYWIDTH * 2 || maxh <= TINYWIDTH * 2) + { + printf("error: maxw <= TINYWIDTH * 2 || maxh <= TINYWIDTH * 2\n"); + return 0; + } + + srand (0); + for (i = 0; i < n; i++) + { + int w = (rand () % (TINYWIDTH * 2)) + 1; + int h = (rand () % (TINYWIDTH * 2)) + 1; + int sx = rand () % (maxw - TINYWIDTH * 2); + int sy = rand () % (maxh - TINYWIDTH * 2); + int dx = rand () % (maxw - TINYWIDTH * 2); + int dy = rand () % (maxh - TINYWIDTH * 2); + call_func (func, op, src_img, mask_img, dst_img, sx, sy, sx, sy, dx, dy, w, h); + pix_cnt += w * h; + } + return pix_cnt; +} + +static double +Mpx_per_sec (double pix_cnt, double t1, double t2, double t3) +{ + double overhead = t2 - t1; + double testtime = t3 - t2; + + return pix_cnt / (testtime - overhead) / 1e6; +} + +void +bench_composite (const char *testname, + int src_fmt, + int src_flags, + int op, + int mask_fmt, + int mask_flags, + int dst_fmt, + double npix) +{ + pixman_image_t * src_img; + pixman_image_t * dst_img; + pixman_image_t * mask_img; + pixman_image_t * xsrc_img; + pixman_image_t * xdst_img; + pixman_image_t * xmask_img; + double t1, t2, t3, pix_cnt; + int64_t n, l1test_width, nlines; + double bytes_per_pix = 0; + pixman_bool_t bench_pixbuf = FALSE; + + pixman_composite_func_t func = pixman_image_composite_wrapper; + + if (!(src_flags & SOLID_FLAG)) + { + bytes_per_pix += (src_fmt >> 24) / 8.0; + src_img = pixman_image_create_bits (src_fmt, + WIDTH, HEIGHT, + src, + WIDTH * 4); + xsrc_img = pixman_image_create_bits (src_fmt, + XWIDTH, XHEIGHT, + src, + XWIDTH * 4); + } + else + { + src_img = pixman_image_create_bits (src_fmt, + 1, 1, + src, + 4); + xsrc_img = pixman_image_create_bits (src_fmt, + 1, 1, + src, + 4); + pixman_image_set_repeat (src_img, PIXMAN_REPEAT_NORMAL); + pixman_image_set_repeat (xsrc_img, PIXMAN_REPEAT_NORMAL); + } + + bytes_per_pix += (dst_fmt >> 24) / 8.0; + dst_img = pixman_image_create_bits (dst_fmt, + WIDTH, HEIGHT, + dst, + WIDTH * 4); + + mask_img = NULL; + xmask_img = NULL; + if (strcmp (testname, "pixbuf") == 0 || strcmp (testname, "rpixbuf") == 0) + { + bench_pixbuf = TRUE; + } + if (!(mask_flags & SOLID_FLAG) && mask_fmt != PIXMAN_null) + { + bytes_per_pix += (mask_fmt >> 24) / ((op == PIXMAN_OP_SRC) ? 8.0 : 4.0); + mask_img = pixman_image_create_bits (mask_fmt, + WIDTH, HEIGHT, + bench_pixbuf ? src : mask, + WIDTH * 4); + xmask_img = pixman_image_create_bits (mask_fmt, + XWIDTH, XHEIGHT, + bench_pixbuf ? src : mask, + XWIDTH * 4); + } + else if (mask_fmt != PIXMAN_null) + { + mask_img = pixman_image_create_bits (mask_fmt, + 1, 1, + mask, + 4); + xmask_img = pixman_image_create_bits (mask_fmt, + 1, 1, + mask, + 4 * 4); + pixman_image_set_repeat (mask_img, PIXMAN_REPEAT_NORMAL); + pixman_image_set_repeat (xmask_img, PIXMAN_REPEAT_NORMAL); + } + if ((mask_flags & CA_FLAG) && mask_fmt != PIXMAN_null) + { + pixman_image_set_component_alpha (mask_img, 1); + } + xdst_img = pixman_image_create_bits (dst_fmt, + XWIDTH, XHEIGHT, + dst, + XWIDTH * 4); + + if (!use_csv_output) + printf ("%24s %c", testname, func != pixman_image_composite_wrapper ? + '-' : '='); + + memcpy (dst, src, BUFSIZE); + memcpy (src, dst, BUFSIZE); + + l1test_width = L1CACHE_SIZE / 8 - 64; + if (l1test_width < 1) + l1test_width = 1; + if (l1test_width > WIDTH - 64) + l1test_width = WIDTH - 64; + n = 1 + npix / (l1test_width * 8); + t1 = gettime (); +#if EXCLUDE_OVERHEAD + pix_cnt = bench_L (op, src_img, mask_img, dst_img, n, pixman_image_composite_empty, l1test_width, 1); +#endif + t2 = gettime (); + pix_cnt = bench_L (op, src_img, mask_img, dst_img, n, func, l1test_width, 1); + t3 = gettime (); + if (use_csv_output) + printf ("%g,", Mpx_per_sec (pix_cnt, t1, t2, t3)); + else + printf (" L1:%7.2f", Mpx_per_sec (pix_cnt, t1, t2, t3)); + fflush (stdout); + + memcpy (dst, src, BUFSIZE); + memcpy (src, dst, BUFSIZE); + + nlines = (L2CACHE_SIZE / l1test_width) / + ((PIXMAN_FORMAT_BPP(src_fmt) + PIXMAN_FORMAT_BPP(dst_fmt)) / 8); + if (nlines < 1) + nlines = 1; + n = 1 + npix / (l1test_width * nlines); + t1 = gettime (); +#if EXCLUDE_OVERHEAD + pix_cnt = bench_L (op, src_img, mask_img, dst_img, n, pixman_image_composite_empty, l1test_width, nlines); +#endif + t2 = gettime (); + pix_cnt = bench_L (op, src_img, mask_img, dst_img, n, func, l1test_width, nlines); + t3 = gettime (); + if (use_csv_output) + printf ("%g,", Mpx_per_sec (pix_cnt, t1, t2, t3)); + else + printf (" L2:%7.2f", Mpx_per_sec (pix_cnt, t1, t2, t3)); + fflush (stdout); + + memcpy (dst, src, BUFSIZE); + memcpy (src, dst, BUFSIZE); + + n = 1 + npix / (WIDTH * HEIGHT); + t1 = gettime (); +#if EXCLUDE_OVERHEAD + pix_cnt = bench_M (op, src_img, mask_img, dst_img, n, pixman_image_composite_empty); +#endif + t2 = gettime (); + pix_cnt = bench_M (op, src_img, mask_img, dst_img, n, func); + t3 = gettime (); + if (use_csv_output) + printf ("%g,", Mpx_per_sec (pix_cnt, t1, t2, t3)); + else + printf (" M:%6.2f (%6.2f%%)", Mpx_per_sec (pix_cnt, t1, t2, t3), + (pix_cnt / ((t3 - t2) - (t2 - t1)) * bytes_per_pix) * (100.0 / bandwidth) ); + fflush (stdout); + + memcpy (dst, src, BUFSIZE); + memcpy (src, dst, BUFSIZE); + + n = 1 + npix / (8 * TILEWIDTH * TILEWIDTH); + t1 = gettime (); +#if EXCLUDE_OVERHEAD + pix_cnt = bench_HT (op, src_img, mask_img, dst_img, n, pixman_image_composite_empty); +#endif + t2 = gettime (); + pix_cnt = bench_HT (op, src_img, mask_img, dst_img, n, func); + t3 = gettime (); + if (use_csv_output) + printf ("%g,", Mpx_per_sec (pix_cnt, t1, t2, t3)); + else + printf (" HT:%6.2f", Mpx_per_sec (pix_cnt, t1, t2, t3)); + fflush (stdout); + + memcpy (dst, src, BUFSIZE); + memcpy (src, dst, BUFSIZE); + + n = 1 + npix / (8 * TILEWIDTH * TILEWIDTH); + t1 = gettime (); +#if EXCLUDE_OVERHEAD + pix_cnt = bench_VT (op, src_img, mask_img, dst_img, n, pixman_image_composite_empty); +#endif + t2 = gettime (); + pix_cnt = bench_VT (op, src_img, mask_img, dst_img, n, func); + t3 = gettime (); + if (use_csv_output) + printf ("%g,", Mpx_per_sec (pix_cnt, t1, t2, t3)); + else + printf (" VT:%6.2f", Mpx_per_sec (pix_cnt, t1, t2, t3)); + fflush (stdout); + + memcpy (dst, src, BUFSIZE); + memcpy (src, dst, BUFSIZE); + + n = 1 + npix / (8 * TILEWIDTH * TILEWIDTH); + t1 = gettime (); +#if EXCLUDE_OVERHEAD + pix_cnt = bench_R (op, src_img, mask_img, dst_img, n, pixman_image_composite_empty, WIDTH, HEIGHT); +#endif + t2 = gettime (); + pix_cnt = bench_R (op, src_img, mask_img, dst_img, n, func, WIDTH, HEIGHT); + t3 = gettime (); + if (use_csv_output) + printf ("%g,", Mpx_per_sec (pix_cnt, t1, t2, t3)); + else + printf (" R:%6.2f", Mpx_per_sec (pix_cnt, t1, t2, t3)); + fflush (stdout); + + memcpy (dst, src, BUFSIZE); + memcpy (src, dst, BUFSIZE); + + n = 1 + npix / (16 * TINYWIDTH * TINYWIDTH); + t1 = gettime (); +#if EXCLUDE_OVERHEAD + pix_cnt = bench_RT (op, src_img, mask_img, dst_img, n, pixman_image_composite_empty, WIDTH, HEIGHT); +#endif + t2 = gettime (); + pix_cnt = bench_RT (op, src_img, mask_img, dst_img, n, func, WIDTH, HEIGHT); + t3 = gettime (); + if (use_csv_output) + printf ("%g\n", Mpx_per_sec (pix_cnt, t1, t2, t3)); + else + printf (" RT:%6.2f (%4.0fKops/s)\n", Mpx_per_sec (pix_cnt, t1, t2, t3), (double) n / ((t3 - t2) * 1000)); + + if (mask_img) { + pixman_image_unref (mask_img); + pixman_image_unref (xmask_img); + } + pixman_image_unref (src_img); + pixman_image_unref (dst_img); + pixman_image_unref (xsrc_img); + pixman_image_unref (xdst_img); +} + +#define PIXMAN_OP_OUT_REV (PIXMAN_OP_OUT_REVERSE) + +struct test_entry +{ + const char *testname; + int src_fmt; + int src_flags; + int op; + int mask_fmt; + int mask_flags; + int dst_fmt; +}; + +typedef struct test_entry test_entry_t; + +static const test_entry_t tests_tbl[] = +{ + { "add_8_8_8", PIXMAN_a8, 0, PIXMAN_OP_ADD, PIXMAN_a8, 0, PIXMAN_a8 }, + { "add_n_8_8", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_ADD, PIXMAN_a8, 0, PIXMAN_a8 }, + { "add_n_8_8888", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_ADD, PIXMAN_a8, 0, PIXMAN_a8r8g8b8 }, + { "add_n_8_x888", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_ADD, PIXMAN_a8, 0, PIXMAN_x8r8g8b8 }, + { "add_n_8_0565", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_ADD, PIXMAN_a8, 0, PIXMAN_r5g6b5 }, + { "add_n_8_1555", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_ADD, PIXMAN_a8, 0, PIXMAN_a1r5g5b5 }, + { "add_n_8_4444", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_ADD, PIXMAN_a8, 0, PIXMAN_a4r4g4b4 }, + { "add_n_8_2222", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_ADD, PIXMAN_a8, 0, PIXMAN_a2r2g2b2 }, + { "add_n_8_2x10", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_ADD, PIXMAN_a8, 0, PIXMAN_x2r10g10b10 }, + { "add_n_8_2a10", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_ADD, PIXMAN_a8, 0, PIXMAN_a2r10g10b10 }, + { "add_n_8", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_ADD, PIXMAN_null, 0, PIXMAN_a8 }, + { "add_n_8888", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_ADD, PIXMAN_null, 0, PIXMAN_a8r8g8b8 }, + { "add_n_x888", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_ADD, PIXMAN_null, 0, PIXMAN_x8r8g8b8 }, + { "add_n_0565", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_ADD, PIXMAN_null, 0, PIXMAN_r5g6b5 }, + { "add_n_1555", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_ADD, PIXMAN_null, 0, PIXMAN_a1r5g5b5 }, + { "add_n_4444", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_ADD, PIXMAN_null, 0, PIXMAN_a4r4g4b4 }, + { "add_n_2222", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_ADD, PIXMAN_null, 0, PIXMAN_a2r2g2b2 }, + { "add_n_2x10", PIXMAN_a2r10g10b10, 1, PIXMAN_OP_ADD, PIXMAN_null, 0, PIXMAN_x2r10g10b10 }, + { "add_n_2a10", PIXMAN_a2r10g10b10, 1, PIXMAN_OP_ADD, PIXMAN_null, 0, PIXMAN_a2r10g10b10 }, + { "add_8_8", PIXMAN_a8, 0, PIXMAN_OP_ADD, PIXMAN_null, 0, PIXMAN_a8 }, + { "add_x888_x888", PIXMAN_x8r8g8b8, 0, PIXMAN_OP_ADD, PIXMAN_null, 0, PIXMAN_x8r8g8b8 }, + { "add_8888_8888", PIXMAN_a8r8g8b8, 0, PIXMAN_OP_ADD, PIXMAN_null, 0, PIXMAN_a8r8g8b8 }, + { "add_8888_0565", PIXMAN_a8r8g8b8, 0, PIXMAN_OP_ADD, PIXMAN_null, 0, PIXMAN_r5g6b5 }, + { "add_8888_1555", PIXMAN_a8r8g8b8, 0, PIXMAN_OP_ADD, PIXMAN_null, 0, PIXMAN_a1r5g5b5 }, + { "add_8888_4444", PIXMAN_a8r8g8b8, 0, PIXMAN_OP_ADD, PIXMAN_null, 0, PIXMAN_a4r4g4b4 }, + { "add_8888_2222", PIXMAN_a8r8g8b8, 0, PIXMAN_OP_ADD, PIXMAN_null, 0, PIXMAN_a2r2g2b2 }, + { "add_0565_0565", PIXMAN_r5g6b5, 0, PIXMAN_OP_ADD, PIXMAN_null, 0, PIXMAN_r5g6b5 }, + { "add_1555_1555", PIXMAN_a1r5g5b5, 0, PIXMAN_OP_ADD, PIXMAN_null, 0, PIXMAN_a1r5g5b5 }, + { "add_0565_2x10", PIXMAN_r5g6b5, 0, PIXMAN_OP_ADD, PIXMAN_null, 0, PIXMAN_x2r10g10b10 }, + { "add_2a10_2a10", PIXMAN_a2r10g10b10, 0, PIXMAN_OP_ADD, PIXMAN_null, 0, PIXMAN_a2r10g10b10 }, + { "in_n_8_8", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_IN, PIXMAN_a8, 0, PIXMAN_a8 }, + { "in_8_8", PIXMAN_a8, 0, PIXMAN_OP_IN, PIXMAN_null, 0, PIXMAN_a8 }, + { "src_n_2222", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_a2r2g2b2 }, + { "src_n_0565", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_r5g6b5 }, + { "src_n_1555", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_a1r5g5b5 }, + { "src_n_4444", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_a4r4g4b4 }, + { "src_n_x888", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_x8r8g8b8 }, + { "src_n_8888", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_a8r8g8b8 }, + { "src_n_2x10", PIXMAN_a2r10g10b10, 1, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_x2r10g10b10 }, + { "src_n_2a10", PIXMAN_a2r10g10b10, 1, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_a2r10g10b10 }, + { "src_8888_0565", PIXMAN_a8r8g8b8, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_r5g6b5 }, + { "src_0565_8888", PIXMAN_r5g6b5, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_a8r8g8b8 }, + { "src_8888_4444", PIXMAN_a8r8g8b8, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_a4r4g4b4 }, + { "src_8888_2222", PIXMAN_a8r8g8b8, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_a2r2g2b2 }, + { "src_8888_2x10", PIXMAN_a8r8g8b8, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_x2r10g10b10 }, + { "src_8888_2a10", PIXMAN_a8r8g8b8, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_a2r10g10b10 }, + { "src_0888_0565", PIXMAN_r8g8b8, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_r5g6b5 }, + { "src_0888_8888", PIXMAN_r8g8b8, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_a8r8g8b8 }, + { "src_0888_x888", PIXMAN_r8g8b8, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_x8r8g8b8 }, + { "src_0888_8888_rev", PIXMAN_b8g8r8, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_x8r8g8b8 }, + { "src_0888_0565_rev", PIXMAN_b8g8r8, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_r5g6b5 }, + { "src_x888_x888", PIXMAN_x8r8g8b8, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_x8r8g8b8 }, + { "src_x888_8888", PIXMAN_x8r8g8b8, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_a8r8g8b8 }, + { "src_8888_8888", PIXMAN_a8r8g8b8, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_a8r8g8b8 }, + { "src_0565_0565", PIXMAN_r5g6b5, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_r5g6b5 }, + { "src_1555_0565", PIXMAN_a1r5g5b5, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_r5g6b5 }, + { "src_0565_1555", PIXMAN_r5g6b5, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_a1r5g5b5 }, + { "src_8_8", PIXMAN_a8, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_a8 }, + { "src_n_8", PIXMAN_a8, 1, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_a8 }, + { "src_n_8_0565", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_SRC, PIXMAN_a8, 0, PIXMAN_r5g6b5 }, + { "src_n_8_1555", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_SRC, PIXMAN_a8, 0, PIXMAN_a1r5g5b5 }, + { "src_n_8_4444", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_SRC, PIXMAN_a8, 0, PIXMAN_a4r4g4b4 }, + { "src_n_8_2222", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_SRC, PIXMAN_a8, 0, PIXMAN_a2r2g2b2 }, + { "src_n_8_x888", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_SRC, PIXMAN_a8, 0, PIXMAN_x8r8g8b8 }, + { "src_n_8_8888", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_SRC, PIXMAN_a8, 0, PIXMAN_a8r8g8b8 }, + { "src_n_8_2x10", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_SRC, PIXMAN_a8, 0, PIXMAN_x2r10g10b10 }, + { "src_n_8_2a10", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_SRC, PIXMAN_a8, 0, PIXMAN_a2r10g10b10 }, + { "src_8888_8_0565", PIXMAN_a8r8g8b8, 0, PIXMAN_OP_SRC, PIXMAN_a8, 0, PIXMAN_r5g6b5 }, + { "src_0888_8_0565", PIXMAN_r8g8b8, 0, PIXMAN_OP_SRC, PIXMAN_a8, 0, PIXMAN_r5g6b5 }, + { "src_0888_8_8888", PIXMAN_r8g8b8, 0, PIXMAN_OP_SRC, PIXMAN_a8, 0, PIXMAN_a8r8g8b8 }, + { "src_0888_8_x888", PIXMAN_r8g8b8, 0, PIXMAN_OP_SRC, PIXMAN_a8, 0, PIXMAN_x8r8g8b8 }, + { "src_x888_8_x888", PIXMAN_x8r8g8b8, 0, PIXMAN_OP_SRC, PIXMAN_a8, 0, PIXMAN_x8r8g8b8 }, + { "src_x888_8_8888", PIXMAN_x8r8g8b8, 0, PIXMAN_OP_SRC, PIXMAN_a8, 0, PIXMAN_a8r8g8b8 }, + { "src_0565_8_0565", PIXMAN_r5g6b5, 0, PIXMAN_OP_SRC, PIXMAN_a8, 0, PIXMAN_r5g6b5 }, + { "src_1555_8_0565", PIXMAN_a1r5g5b5, 0, PIXMAN_OP_SRC, PIXMAN_a8, 0, PIXMAN_r5g6b5 }, + { "src_0565_8_1555", PIXMAN_r5g6b5, 0, PIXMAN_OP_SRC, PIXMAN_a8, 0, PIXMAN_a1r5g5b5 }, + { "over_n_x888", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_OVER, PIXMAN_null, 0, PIXMAN_x8r8g8b8 }, + { "over_n_8888", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_OVER, PIXMAN_null, 0, PIXMAN_a8r8g8b8 }, + { "over_n_0565", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_OVER, PIXMAN_null, 0, PIXMAN_r5g6b5 }, + { "over_n_1555", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_OVER, PIXMAN_null, 0, PIXMAN_a1r5g5b5 }, + { "over_8888_0565", PIXMAN_a8r8g8b8, 0, PIXMAN_OP_OVER, PIXMAN_null, 0, PIXMAN_r5g6b5 }, + { "over_8888_8888", PIXMAN_a8r8g8b8, 0, PIXMAN_OP_OVER, PIXMAN_null, 0, PIXMAN_a8r8g8b8 }, + { "over_8888_x888", PIXMAN_a8r8g8b8, 0, PIXMAN_OP_OVER, PIXMAN_null, 0, PIXMAN_x8r8g8b8 }, + { "over_x888_8_0565", PIXMAN_x8r8g8b8, 0, PIXMAN_OP_OVER, PIXMAN_a8, 0, PIXMAN_r5g6b5 }, + { "over_x888_8_8888", PIXMAN_x8r8g8b8, 0, PIXMAN_OP_OVER, PIXMAN_a8, 0, PIXMAN_a8r8g8b8 }, + { "over_n_8_0565", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_OVER, PIXMAN_a8, 0, PIXMAN_r5g6b5 }, + { "over_n_8_1555", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_OVER, PIXMAN_a8, 0, PIXMAN_a1r5g5b5 }, + { "over_n_8_4444", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_OVER, PIXMAN_a8, 0, PIXMAN_a4r4g4b4 }, + { "over_n_8_2222", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_OVER, PIXMAN_a8, 0, PIXMAN_a2r2g2b2 }, + { "over_n_8_x888", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_OVER, PIXMAN_a8, 0, PIXMAN_x8r8g8b8 }, + { "over_n_8_8888", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_OVER, PIXMAN_a8, 0, PIXMAN_a8r8g8b8 }, + { "over_n_8_2x10", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_OVER, PIXMAN_a8, 0, PIXMAN_x2r10g10b10 }, + { "over_n_8_2a10", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_OVER, PIXMAN_a8, 0, PIXMAN_a2r10g10b10 }, + { "over_n_8888_8888_ca", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_OVER, PIXMAN_a8r8g8b8, 2, PIXMAN_a8r8g8b8 }, + { "over_n_8888_x888_ca", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_OVER, PIXMAN_a8r8g8b8, 2, PIXMAN_x8r8g8b8 }, + { "over_n_8888_0565_ca", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_OVER, PIXMAN_a8r8g8b8, 2, PIXMAN_r5g6b5 }, + { "over_n_8888_1555_ca", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_OVER, PIXMAN_a8r8g8b8, 2, PIXMAN_a1r5g5b5 }, + { "over_n_8888_4444_ca", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_OVER, PIXMAN_a8r8g8b8, 2, PIXMAN_a4r4g4b4 }, + { "over_n_8888_2222_ca", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_OVER, PIXMAN_a8r8g8b8, 2, PIXMAN_a2r2g2b2 }, + { "over_n_8888_2x10_ca", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_OVER, PIXMAN_a8r8g8b8, 2, PIXMAN_x2r10g10b10 }, + { "over_n_8888_2a10_ca", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_OVER, PIXMAN_a8r8g8b8, 2, PIXMAN_a2r10g10b10 }, + { "over_8888_n_8888", PIXMAN_a8r8g8b8, 0, PIXMAN_OP_OVER, PIXMAN_a8, 1, PIXMAN_a8r8g8b8 }, + { "over_8888_n_x888", PIXMAN_a8r8g8b8, 0, PIXMAN_OP_OVER, PIXMAN_a8, 1, PIXMAN_x8r8g8b8 }, + { "over_8888_n_0565", PIXMAN_a8r8g8b8, 0, PIXMAN_OP_OVER, PIXMAN_a8, 1, PIXMAN_r5g6b5 }, + { "over_8888_n_1555", PIXMAN_a8r8g8b8, 0, PIXMAN_OP_OVER, PIXMAN_a8, 1, PIXMAN_a1r5g5b5 }, + { "over_x888_n_8888", PIXMAN_x8r8g8b8, 0, PIXMAN_OP_OVER, PIXMAN_a8, 1, PIXMAN_a8r8g8b8 }, + { "outrev_n_8_0565", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_OUT_REV, PIXMAN_a8, 0, PIXMAN_r5g6b5 }, + { "outrev_n_8_1555", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_OUT_REV, PIXMAN_a8, 0, PIXMAN_a1r5g5b5 }, + { "outrev_n_8_x888", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_OUT_REV, PIXMAN_a8, 0, PIXMAN_x8r8g8b8 }, + { "outrev_n_8_8888", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_OUT_REV, PIXMAN_a8, 0, PIXMAN_a8r8g8b8 }, + { "outrev_n_8888_0565_ca", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_OUT_REV, PIXMAN_a8r8g8b8, 2, PIXMAN_r5g6b5 }, + { "outrev_n_8888_1555_ca", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_OUT_REV, PIXMAN_a8r8g8b8, 2, PIXMAN_a1r5g5b5 }, + { "outrev_n_8888_x888_ca", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_OUT_REV, PIXMAN_a8r8g8b8, 2, PIXMAN_x8r8g8b8 }, + { "outrev_n_8888_8888_ca", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_OUT_REV, PIXMAN_a8r8g8b8, 2, PIXMAN_a8r8g8b8 }, + { "over_reverse_n_8888", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_OVER_REVERSE, PIXMAN_null, 0, PIXMAN_a8r8g8b8 }, + { "in_reverse_8888_8888", PIXMAN_a8r8g8b8, 0, PIXMAN_OP_IN_REVERSE, PIXMAN_null, 0, PIXMAN_a8r8g8b8 }, + { "pixbuf", PIXMAN_x8b8g8r8, 0, PIXMAN_OP_SRC, PIXMAN_a8b8g8r8, 0, PIXMAN_a8r8g8b8 }, + { "rpixbuf", PIXMAN_x8b8g8r8, 0, PIXMAN_OP_SRC, PIXMAN_a8b8g8r8, 0, PIXMAN_a8b8g8r8 }, +}; + +static const test_entry_t special_patterns[] = +{ + { "add_n_2x10", PIXMAN_a2r10g10b10, 1, PIXMAN_OP_ADD, PIXMAN_null, 0, PIXMAN_x2r10g10b10 }, + { "add_n_2a10", PIXMAN_a2r10g10b10, 1, PIXMAN_OP_ADD, PIXMAN_null, 0, PIXMAN_a2r10g10b10 }, + { "src_n_2x10", PIXMAN_a2r10g10b10, 1, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_x2r10g10b10 }, + { "src_n_2a10", PIXMAN_a2r10g10b10, 1, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_a2r10g10b10 }, + { "src_0888_8888_rev", PIXMAN_b8g8r8, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_x8r8g8b8 }, + { "src_0888_0565_rev", PIXMAN_b8g8r8, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_r5g6b5 }, + { "src_n_8", PIXMAN_a8, 1, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_a8 }, + { "pixbuf", PIXMAN_x8b8g8r8, 0, PIXMAN_OP_SRC, PIXMAN_a8b8g8r8, 0, PIXMAN_a8r8g8b8 }, + { "rpixbuf", PIXMAN_x8b8g8r8, 0, PIXMAN_OP_SRC, PIXMAN_a8b8g8r8, 0, PIXMAN_a8b8g8r8 }, +}; + +/* Returns the sub-string's end pointer in string. */ +static const char * +copy_sub_string (char *buf, + const char *string, + const char *scan_from, + const char *end) +{ + const char *delim; + size_t n; + + delim = strchr (scan_from, '_'); + if (!delim) + delim = end; + + n = delim - string; + strncpy(buf, string, n); + buf[n] = '\0'; + + return delim; +} + +static pixman_op_t +parse_longest_operator (char *buf, const char **strp, const char *end) +{ + const char *p = *strp; + const char *sub_end; + const char *best_end = p; + pixman_op_t best_op = PIXMAN_OP_NONE; + pixman_op_t op; + + while (p < end) + { + sub_end = copy_sub_string (buf, *strp, p, end); + op = operator_from_string (buf); + p = sub_end + 1; + + if (op != PIXMAN_OP_NONE) + { + best_end = p; + best_op = op; + } + } + + *strp = best_end; + return best_op; +} + +static pixman_format_code_t +parse_format (char *buf, const char **p, const char *end) +{ + pixman_format_code_t format; + const char *delim; + + if (*p >= end) + return PIXMAN_null; + + delim = copy_sub_string (buf, *p, *p, end); + format = format_from_string (buf); + + if (format != PIXMAN_null) + *p = delim + 1; + + return format; +} + +static int +parse_test_pattern (test_entry_t *test, const char *pattern) +{ + const char *p = pattern; + const char *end = pattern + strlen (pattern); + char buf[1024]; + pixman_format_code_t format[3]; + int i; + + if (strlen (pattern) > sizeof (buf) - 1) + return -1; + + /* Special cases that the parser cannot produce. */ + for (i = 0; i < ARRAY_LENGTH (special_patterns); i++) + { + if (strcmp (pattern, special_patterns[i].testname) == 0) + { + *test = special_patterns[i]; + return 0; + } + } + + test->testname = pattern; + + /* Extract operator, may contain delimiters, + * so take the longest string that matches. + */ + test->op = parse_longest_operator (buf, &p, end); + if (test->op == PIXMAN_OP_NONE) + return -1; + + /* extract up to three pixel formats */ + format[0] = parse_format (buf, &p, end); + format[1] = parse_format (buf, &p, end); + format[2] = parse_format (buf, &p, end); + + if (format[0] == PIXMAN_null || format[1] == PIXMAN_null) + return -1; + + /* recognize CA flag */ + test->mask_flags = 0; + if (p < end) + { + if (strcmp (p, "ca") == 0) + test->mask_flags |= CA_FLAG; + else + return -1; /* trailing garbage */ + } + + test->src_fmt = format[0]; + if (format[2] == PIXMAN_null) + { + test->mask_fmt = PIXMAN_null; + test->dst_fmt = format[1]; + } + else + { + test->mask_fmt = format[1]; + test->dst_fmt = format[2]; + } + + test->src_flags = 0; + if (test->src_fmt == PIXMAN_solid) + { + test->src_fmt = PIXMAN_a8r8g8b8; + test->src_flags |= SOLID_FLAG; + } + + if (test->mask_fmt == PIXMAN_solid) + { + if (test->mask_flags & CA_FLAG) + test->mask_fmt = PIXMAN_a8r8g8b8; + else + test->mask_fmt = PIXMAN_a8; + + test->mask_flags |= SOLID_FLAG; + } + + return 0; +} + +static int +check_int (int got, int expected, const char *name, const char *field) +{ + if (got == expected) + return 0; + + printf ("%s: %s failure: expected %d, got %d.\n", + name, field, expected, got); + + return 1; +} + +static int +check_format (int got, int expected, const char *name, const char *field) +{ + if (got == expected) + return 0; + + printf ("%s: %s failure: expected %s (%#x), got %s (%#x).\n", + name, field, + format_name (expected), expected, + format_name (got), got); + + return 1; +} + +static void +parser_self_test (void) +{ + const test_entry_t *ent; + test_entry_t test; + int fails = 0; + int i; + + for (i = 0; i < ARRAY_LENGTH (tests_tbl); i++) + { + ent = &tests_tbl[i]; + + if (parse_test_pattern (&test, ent->testname) < 0) + { + printf ("parsing failed for '%s'\n", ent->testname); + fails++; + continue; + } + + fails += check_format (test.src_fmt, ent->src_fmt, + ent->testname, "src_fmt"); + fails += check_format (test.mask_fmt, ent->mask_fmt, + ent->testname, "mask_fmt"); + fails += check_format (test.dst_fmt, ent->dst_fmt, + ent->testname, "dst_fmt"); + fails += check_int (test.src_flags, ent->src_flags, + ent->testname, "src_flags"); + fails += check_int (test.mask_flags, ent->mask_flags, + ent->testname, "mask_flags"); + fails += check_int (test.op, ent->op, ent->testname, "op"); + } + + if (fails) + { + printf ("Parser self-test failed.\n"); + exit (EXIT_FAILURE); + } + + if (!use_csv_output) + printf ("Parser self-test complete.\n"); +} + +static void +print_test_details (const test_entry_t *test) +{ + printf ("%s: %s, src %s%s, mask %s%s%s, dst %s\n", + test->testname, + operator_name (test->op), + format_name (test->src_fmt), + test->src_flags & SOLID_FLAG ? " solid" : "", + format_name (test->mask_fmt), + test->mask_flags & SOLID_FLAG ? " solid" : "", + test->mask_flags & CA_FLAG ? " CA" : "", + format_name (test->dst_fmt)); +} + +static void +run_one_test (const char *pattern, double bandwidth_, pixman_bool_t prdetails) +{ + test_entry_t test; + + if (parse_test_pattern (&test, pattern) < 0) + { + printf ("Error: Could not parse the test pattern '%s'.\n", pattern); + return; + } + + if (prdetails) + { + print_test_details (&test); + printf ("---\n"); + } + + bench_composite (pattern, + test.src_fmt, + test.src_flags, + test.op, + test.mask_fmt, + test.mask_flags, + test.dst_fmt, + bandwidth_ / 8); +} + +static void +run_default_tests (double bandwidth_) +{ + int i; + + for (i = 0; i < ARRAY_LENGTH (tests_tbl); i++) + run_one_test (tests_tbl[i].testname, bandwidth_, FALSE); +} + +static void +print_explanation (void) +{ + printf ("Benchmark for a set of most commonly used functions\n"); + printf ("---\n"); + printf ("All results are presented in millions of pixels per second\n"); + printf ("L1 - small Xx1 rectangle (fitting L1 cache), always blitted at the same\n"); + printf (" memory location with small drift in horizontal direction\n"); + printf ("L2 - small XxY rectangle (fitting L2 cache), always blitted at the same\n"); + printf (" memory location with small drift in horizontal direction\n"); + printf ("M - large %dx%d rectangle, always blitted at the same\n", + WIDTH - 64, HEIGHT); + printf (" memory location with small drift in horizontal direction\n"); + printf ("HT - random rectangles with %dx%d average size are copied from\n", + TILEWIDTH, TILEWIDTH); + printf (" one %dx%d buffer to another, traversing from left to right\n", + WIDTH, HEIGHT); + printf (" and from top to bottom\n"); + printf ("VT - random rectangles with %dx%d average size are copied from\n", + TILEWIDTH, TILEWIDTH); + printf (" one %dx%d buffer to another, traversing from top to bottom\n", + WIDTH, HEIGHT); + printf (" and from left to right\n"); + printf ("R - random rectangles with %dx%d average size are copied from\n", + TILEWIDTH, TILEWIDTH); + printf (" random locations of one %dx%d buffer to another\n", + WIDTH, HEIGHT); + printf ("RT - as R, but %dx%d average sized rectangles are copied\n", + TINYWIDTH, TINYWIDTH); + printf ("---\n"); +} + +static void +print_speed_scaling (double bw) +{ + printf ("reference memcpy speed = %.1fMB/s (%.1fMP/s for 32bpp fills)\n", + bw / 1000000., bw / 4000000); + + if (use_scaling) + { + printf ("---\n"); + if (filter == PIXMAN_FILTER_BILINEAR) + printf ("BILINEAR scaling\n"); + else if (filter == PIXMAN_FILTER_NEAREST) + printf ("NEAREST scaling\n"); + else + printf ("UNKNOWN scaling\n"); + } + + printf ("---\n"); +} + +static void +usage (const char *progname) +{ + printf ("Usage: %s [-b] [-n] [-c] [-m M] pattern\n", progname); + printf (" -n : benchmark nearest scaling\n"); + printf (" -b : benchmark bilinear scaling\n"); + printf (" -c : print output as CSV data\n"); + printf (" -m M : set reference memcpy speed to M MB/s instead of measuring it\n"); +} + +int +main (int argc, char *argv[]) +{ + int i; + const char *pattern = NULL; + + for (i = 1; i < argc; i++) + { + if (argv[i][0] == '-') + { + if (strchr (argv[i] + 1, 'b')) + { + use_scaling = TRUE; + filter = PIXMAN_FILTER_BILINEAR; + } + else if (strchr (argv[i] + 1, 'n')) + { + use_scaling = TRUE; + filter = PIXMAN_FILTER_NEAREST; + } + + if (strchr (argv[i] + 1, 'c')) + use_csv_output = TRUE; + + if (strcmp (argv[i], "-m") == 0 && i + 1 < argc) + bandwidth = atof (argv[++i]) * 1e6; + } + else + { + if (pattern) + { + pattern = NULL; + printf ("Error: extra arguments given.\n"); + break; + } + pattern = argv[i]; + } + } + + if (!pattern) + { + usage (argv[0]); + return 1; + } + + parser_self_test (); + + src = aligned_malloc (4096, BUFSIZE * 3); + memset (src, 0xCC, BUFSIZE * 3); + dst = src + (BUFSIZE / 4); + mask = dst + (BUFSIZE / 4); + + if (!use_csv_output) + print_explanation (); + + if (bandwidth < 1.0) + bandwidth = bench_memcpy (); + if (!use_csv_output) + print_speed_scaling (bandwidth); + + if (strcmp (pattern, "all") == 0) + run_default_tests (bandwidth); + else + run_one_test (pattern, bandwidth, !use_csv_output); + + free (src); + return 0; +} diff --git a/libs/pixman-0.40.0/test/matrix-test.c b/libs/pixman-0.40.0/test/matrix-test.c new file mode 100644 index 0000000..0a5f203 --- /dev/null +++ b/libs/pixman-0.40.0/test/matrix-test.c @@ -0,0 +1,235 @@ +/* + * Copyright © 2012 Siarhei Siamashka <siarhei.siamashka@gmail.com> + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include "utils.h" +#include <assert.h> +#include <stdlib.h> +#include <stdio.h> +#include <math.h> + +#ifdef HAVE_FLOAT128 + +#define pixman_fixed_to_float128(x) (((__float128)(x)) / 65536.0Q) + +typedef struct { __float128 v[3]; } pixman_vector_f128_t; +typedef struct { __float128 m[3][3]; } pixman_transform_f128_t; + +pixman_bool_t +pixman_transform_point_f128 (const pixman_transform_f128_t *t, + const pixman_vector_f128_t *v, + pixman_vector_f128_t *result) +{ + int i; + for (i = 0; i < 3; i++) + { + result->v[i] = t->m[i][0] * v->v[0] + + t->m[i][1] * v->v[1] + + t->m[i][2] * v->v[2]; + } + if (result->v[2] != 0) + { + result->v[0] /= result->v[2]; + result->v[1] /= result->v[2]; + result->v[2] = 1; + return TRUE; + } + else + { + return FALSE; + } +} + +pixman_bool_t does_it_fit_fixed_48_16 (__float128 x) +{ + if (x >= 65536.0Q * 65536.0Q * 32768.0Q) + return FALSE; + if (x <= -65536.0Q * 65536.0Q * 32768.0Q) + return FALSE; + return TRUE; +} + +#endif + +static inline uint32_t +byteswap32 (uint32_t x) +{ + return ((x & ((uint32_t)0xFF << 24)) >> 24) | + ((x & ((uint32_t)0xFF << 16)) >> 8) | + ((x & ((uint32_t)0xFF << 8)) << 8) | + ((x & ((uint32_t)0xFF << 0)) << 24); +} + +static inline uint64_t +byteswap64 (uint64_t x) +{ + return ((x & ((uint64_t)0xFF << 56)) >> 56) | + ((x & ((uint64_t)0xFF << 48)) >> 40) | + ((x & ((uint64_t)0xFF << 40)) >> 24) | + ((x & ((uint64_t)0xFF << 32)) >> 8) | + ((x & ((uint64_t)0xFF << 24)) << 8) | + ((x & ((uint64_t)0xFF << 16)) << 24) | + ((x & ((uint64_t)0xFF << 8)) << 40) | + ((x & ((uint64_t)0xFF << 0)) << 56); +} + +static void +byteswap_transform (pixman_transform_t *t) +{ + int i, j; + + if (is_little_endian ()) + return; + + for (i = 0; i < 3; i++) + for (j = 0; j < 3; j++) + t->matrix[i][j] = byteswap32 (t->matrix[i][j]); +} + +static void +byteswap_vector_48_16 (pixman_vector_48_16_t *v) +{ + int i; + + if (is_little_endian ()) + return; + + for (i = 0; i < 3; i++) + v->v[i] = byteswap64 (v->v[i]); +} + +uint32_t +test_matrix (int testnum, int verbose) +{ + uint32_t crc32 = 0; + int i, j, k; + pixman_bool_t is_affine; + + prng_srand (testnum); + + for (i = 0; i < 100; i++) + { + pixman_bool_t transform_ok; + pixman_transform_t ti; + pixman_vector_48_16_t vi, result_i; +#ifdef HAVE_FLOAT128 + pixman_transform_f128_t tf; + pixman_vector_f128_t vf, result_f; +#endif + prng_randmemset (&ti, sizeof(ti), 0); + prng_randmemset (&vi, sizeof(vi), 0); + byteswap_transform (&ti); + byteswap_vector_48_16 (&vi); + + for (j = 0; j < 3; j++) + { + /* make sure that "vi" contains 31.16 fixed point data */ + vi.v[j] >>= 17; + /* and apply random shift */ + if (prng_rand_n (3) == 0) + vi.v[j] >>= prng_rand_n (46); + } + + if (prng_rand_n (2)) + { + /* random shift for the matrix */ + for (j = 0; j < 3; j++) + for (k = 0; k < 3; k++) + ti.matrix[j][k] >>= prng_rand_n (30); + } + + if (prng_rand_n (2)) + { + /* affine matrix */ + ti.matrix[2][0] = 0; + ti.matrix[2][1] = 0; + ti.matrix[2][2] = pixman_fixed_1; + } + + if (prng_rand_n (2)) + { + /* cartesian coordinates */ + vi.v[2] = pixman_fixed_1; + } + + is_affine = (ti.matrix[2][0] == 0 && ti.matrix[2][1] == 0 && + ti.matrix[2][2] == pixman_fixed_1 && + vi.v[2] == pixman_fixed_1); + + transform_ok = TRUE; + if (is_affine && prng_rand_n (2)) + pixman_transform_point_31_16_affine (&ti, &vi, &result_i); + else + transform_ok = pixman_transform_point_31_16 (&ti, &vi, &result_i); + +#ifdef HAVE_FLOAT128 + /* compare with a reference 128-bit floating point implementation */ + for (j = 0; j < 3; j++) + { + vf.v[j] = pixman_fixed_to_float128 (vi.v[j]); + for (k = 0; k < 3; k++) + { + tf.m[j][k] = pixman_fixed_to_float128 (ti.matrix[j][k]); + } + } + + if (pixman_transform_point_f128 (&tf, &vf, &result_f)) + { + if (transform_ok || + (does_it_fit_fixed_48_16 (result_f.v[0]) && + does_it_fit_fixed_48_16 (result_f.v[1]) && + does_it_fit_fixed_48_16 (result_f.v[2]))) + { + for (j = 0; j < 3; j++) + { + double diff = fabs (result_f.v[j] - + pixman_fixed_to_float128 (result_i.v[j])); + + if (is_affine && diff > (0.51 / 65536.0)) + { + printf ("%d:%d: bad precision for affine (%.12f)\n", + testnum, i, diff); + abort (); + } + else if (diff > (0.71 / 65536.0)) + { + printf ("%d:%d: bad precision for projective (%.12f)\n", + testnum, i, diff); + abort (); + } + } + } + } +#endif + byteswap_vector_48_16 (&result_i); + crc32 = compute_crc32 (crc32, &result_i, sizeof (result_i)); + } + return crc32; +} + +int +main (int argc, const char *argv[]) +{ + return fuzzer_test_main ("matrix", 20000, + 0xBEBF98C3, + test_matrix, argc, argv); +} diff --git a/libs/pixman-0.40.0/test/meson.build b/libs/pixman-0.40.0/test/meson.build new file mode 100644 index 0000000..59a0d42 --- /dev/null +++ b/libs/pixman-0.40.0/test/meson.build @@ -0,0 +1,97 @@ +# Copyright © 2018 Intel Corporation + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +tests = [ + 'oob-test', + 'infinite-loop', + 'trap-crasher', + 'fence-image-self-test', + 'region-translate-test', + 'fetch-test', + 'a1-trap-test', + 'prng-test', + 'radial-invalid', + 'pdf-op-test', + 'region-test', + 'combiner-test', + 'scaling-crash-test', + 'alpha-loop', + 'scaling-helpers-test', + 'rotate-test', + 'alphamap', + 'gradient-crash-test', + 'pixel-test', + 'matrix-test', + 'filter-reduction-test', + 'composite-traps-test', + 'region-contains-test', + 'glyph-test', + 'solid-test', + 'stress-test', + 'cover-test', + 'blitters-test', + 'affine-test', + 'scaling-test', + 'composite', + 'tolerance-test', +] + +# Remove/update this once thread-test.c supports threading methods +# other than PThreads and Windows threads +if pthreads_found or host_machine.system() == 'windows' + tests += 'thread-test' +endif + +progs = [ + 'lowlevel-blt-bench', + 'radial-perf-test', + 'check-formats', + 'scaling-bench', + 'affine-bench', +] + +libtestutils = static_library( + 'testutils', + ['utils.c', 'utils-prng.c', config_h], + dependencies : [dep_openmp, dep_m, dep_png, idep_pixman], +) + +foreach t : tests + test( + t, + executable( + t, + [t + '.c', config_h], + link_with : libtestutils, + dependencies : [dep_threads, dep_openmp, idep_pixman], + ), + timeout : 120, + is_parallel : true, + ) +endforeach + +foreach p : progs + executable( + p, + p + '.c', + link_with : libtestutils, + dependencies : [dep_openmp, idep_pixman], + ) +endforeach diff --git a/libs/pixman-0.40.0/test/oob-test.c b/libs/pixman-0.40.0/test/oob-test.c new file mode 100644 index 0000000..0d19b50 --- /dev/null +++ b/libs/pixman-0.40.0/test/oob-test.c @@ -0,0 +1,101 @@ +#include <stdio.h> +#include <stdlib.h> +#include "utils.h" + +typedef struct +{ + int width; + int height; + int stride; + pixman_format_code_t format; + +} image_info_t; + +typedef struct +{ + pixman_op_t op; + + image_info_t src; + image_info_t dest; + + int src_x; + int src_y; + int dest_x; + int dest_y; + int width; + int height; +} composite_info_t; + +const composite_info_t info[] = +{ + { + PIXMAN_OP_SRC, + { 3, 6, 16, PIXMAN_a8r8g8b8 }, + { 5, 7, 20, PIXMAN_x8r8g8b8 }, + 1, 8, + 1, -1, + 1, 8 + }, + { + PIXMAN_OP_SRC, + { 7, 5, 36, PIXMAN_a8r8g8b8 }, + { 6, 5, 28, PIXMAN_x8r8g8b8 }, + 8, 5, + 5, 3, + 1, 2 + }, + { + PIXMAN_OP_OVER, + { 10, 10, 40, PIXMAN_a2b10g10r10 }, + { 10, 10, 40, PIXMAN_a2b10g10r10 }, + 0, 0, + 0, 0, + 10, 10 + }, + { + PIXMAN_OP_OVER, + { 10, 10, 40, PIXMAN_x2b10g10r10 }, + { 10, 10, 40, PIXMAN_x2b10g10r10 }, + 0, 0, + 0, 0, + 10, 10 + }, +}; + +static pixman_image_t * +make_image (const image_info_t *info) +{ + char *data = malloc (info->stride * info->height); + int i; + + for (i = 0; i < info->height * info->stride; ++i) + data[i] = (i % 255) ^ (((i % 16) << 4) | (i & 0xf0)); + + return pixman_image_create_bits (info->format, info->width, info->height, (uint32_t *)data, info->stride); +} + +static void +test_composite (const composite_info_t *info) +{ + pixman_image_t *src = make_image (&info->src); + pixman_image_t *dest = make_image (&info->dest); + + pixman_image_composite (PIXMAN_OP_SRC, src, NULL, dest, + info->src_x, info->src_y, + 0, 0, + info->dest_x, info->dest_y, + info->width, info->height); +} + + + +int +main (int argc, char **argv) +{ + int i; + + for (i = 0; i < ARRAY_LENGTH (info); ++i) + test_composite (&info[i]); + + return 0; +} diff --git a/libs/pixman-0.40.0/test/pdf-op-test.c b/libs/pixman-0.40.0/test/pdf-op-test.c new file mode 100644 index 0000000..dcb3a60 --- /dev/null +++ b/libs/pixman-0.40.0/test/pdf-op-test.c @@ -0,0 +1,83 @@ +#include <stdlib.h> +#include "utils.h" + +static const pixman_op_t pdf_ops[] = +{ + PIXMAN_OP_MULTIPLY, + PIXMAN_OP_SCREEN, + PIXMAN_OP_OVERLAY, + PIXMAN_OP_DARKEN, + PIXMAN_OP_LIGHTEN, + PIXMAN_OP_COLOR_DODGE, + PIXMAN_OP_COLOR_BURN, + PIXMAN_OP_HARD_LIGHT, + PIXMAN_OP_SOFT_LIGHT, + PIXMAN_OP_DIFFERENCE, + PIXMAN_OP_EXCLUSION, + PIXMAN_OP_HSL_HUE, + PIXMAN_OP_HSL_SATURATION, + PIXMAN_OP_HSL_COLOR, + PIXMAN_OP_HSL_LUMINOSITY +}; + +static const uint32_t pixels[] = +{ + 0x00808080, + 0x80123456, + 0x00000000, + 0xffffffff, + 0x00ffffff, + 0x80808080, + 0x00123456, +}; + +int +main () +{ + int o, s, m, d; + + enable_divbyzero_exceptions(); + + for (o = 0; o < ARRAY_LENGTH (pdf_ops); ++o) + { + pixman_op_t op = pdf_ops[o]; + + for (s = 0; s < ARRAY_LENGTH (pixels); ++s) + { + pixman_image_t *src; + + src = pixman_image_create_bits ( + PIXMAN_a8r8g8b8, 1, 1, (uint32_t *)&(pixels[s]), 4); + + for (m = -1; m < ARRAY_LENGTH (pixels); ++m) + { + pixman_image_t *msk = NULL; + if (m >= 0) + { + msk = pixman_image_create_bits ( + PIXMAN_a8r8g8b8, 1, 1, (uint32_t *)&(pixels[m]), 4); + } + + for (d = 0; d < ARRAY_LENGTH (pixels); ++d) + { + pixman_image_t *dst; + uint32_t dp = pixels[d]; + + dst = pixman_image_create_bits ( + PIXMAN_a8r8g8b8, 1, 1, &dp, 4); + + pixman_image_composite (op, src, msk, dst, + 0, 0, 0, 0, 0, 0, 1, 1); + + pixman_image_unref (dst); + } + if (msk) + pixman_image_unref (msk); + } + + pixman_image_unref (src); + } + } + + return 0; +} diff --git a/libs/pixman-0.40.0/test/pixel-test.c b/libs/pixman-0.40.0/test/pixel-test.c new file mode 100644 index 0000000..7dc0eff --- /dev/null +++ b/libs/pixman-0.40.0/test/pixel-test.c @@ -0,0 +1,3023 @@ +/* + * Copyright © 2013 Soeren Sandmann + * Copyright © 2013 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +#include <stdio.h> +#include <stdlib.h> /* abort() */ +#include <math.h> +#include <time.h> +#include "utils.h" + +typedef struct pixel_combination_t pixel_combination_t; +struct pixel_combination_t +{ + pixman_op_t op; + pixman_format_code_t src_format; + uint32_t src_pixel; + pixman_format_code_t mask_format; + uint32_t mask_pixel; + pixman_format_code_t dest_format; + uint32_t dest_pixel; +}; + +static const pixel_combination_t regressions[] = +{ + { PIXMAN_OP_DISJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x1ffc3ff, + PIXMAN_a8, 0x7b, + PIXMAN_a8r8g8b8, 0xff00c300, + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a2r2g2b2, 0xb5, + PIXMAN_a4r4g4b4, 0xe3ff, + PIXMAN_a2r2g2b2, 0x2e + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a2r2g2b2, 0xa6, + PIXMAN_a8r8g8b8, 0x2b00ff00, + PIXMAN_a4r4g4b4, 0x7e + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a8r8g8b8, 0x27000013, + PIXMAN_a2r2g2b2, 0x80, + PIXMAN_a4r4g4b4, 0x9d + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a4r4g4b4, 0xe6f7, + PIXMAN_a2r2g2b2, 0xad, + PIXMAN_a4r4g4b4, 0x71 + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a8r8g8b8, 0xff4f70ff, + PIXMAN_r5g6b5, 0xb828, + PIXMAN_a8r8g8b8, 0xcac400 + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a2r2g2b2, 0xa9, + PIXMAN_a4r4g4b4, 0x41c2, + PIXMAN_a8r8g8b8, 0xffff2b + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a2r2g2b2, 0x89, + PIXMAN_a8r8g8b8, 0x977cff61, + PIXMAN_a4r4g4b4, 0x36 + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a2r2g2b2, 0x81, + PIXMAN_r5g6b5, 0x6f9e, + PIXMAN_a4r4g4b4, 0x1eb + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a2r2g2b2, 0xb5, + PIXMAN_a4r4g4b4, 0xe247, + PIXMAN_a8r8g8b8, 0xffbaff + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a2r2g2b2, 0x97, + PIXMAN_a2r2g2b2, 0x9d, + PIXMAN_a2r2g2b2, 0x21 + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a2r2g2b2, 0xb4, + PIXMAN_a2r2g2b2, 0x90, + PIXMAN_a8r8g8b8, 0xc0fd5c + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a8r8g8b8, 0xdf00ff70, + PIXMAN_a8r8g8b8, 0x2597ff27, + PIXMAN_a4r4g4b4, 0xf3 + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a2r2g2b2, 0xb7, + PIXMAN_r3g3b2, 0xb1, + PIXMAN_a8r8g8b8, 0x9f4bcc + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a4r4g4b4, 0xf39e, + PIXMAN_r5g6b5, 0x34, + PIXMAN_a8r8g8b8, 0xf6ae00 + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a8r8g8b8, 0x3aff1dff, + PIXMAN_a2r2g2b2, 0x64, + PIXMAN_a8r8g8b8, 0x94ffb4 + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a2r2g2b2, 0xa4, + PIXMAN_a2r2g2b2, 0x8a, + PIXMAN_a4r4g4b4, 0xff + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a2r2g2b2, 0xa5, + PIXMAN_a4r4g4b4, 0x1a, + PIXMAN_a4r4g4b4, 0xff + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a2r2g2b2, 0xb4, + PIXMAN_a2r2g2b2, 0xca, + PIXMAN_a4r4g4b4, 0x7b + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a2r2g2b2, 0xbd, + PIXMAN_a4r4g4b4, 0xff37, + PIXMAN_a4r4g4b4, 0xff + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a2r2g2b2, 0x96, + PIXMAN_a2r2g2b2, 0xbb, + PIXMAN_a8r8g8b8, 0x96ffff + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a2r2g2b2, 0x89, + PIXMAN_r3g3b2, 0x92, + PIXMAN_a4r4g4b4, 0xa8c + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a4r4g4b4, 0xa95b, + PIXMAN_a2r2g2b2, 0x68, + PIXMAN_a8r8g8b8, 0x38ff + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a2r2g2b2, 0x90, + PIXMAN_a8r8g8b8, 0x53bd00ef, + PIXMAN_a8r8g8b8, 0xff0003 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x1f5ffff, + PIXMAN_r3g3b2, 0x22, + PIXMAN_r5g6b5, 0x2000 + }, + { PIXMAN_OP_DISJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x10000b6, + PIXMAN_a8r8g8b8, 0x9645, + PIXMAN_r5g6b5, 0x6 + }, + { PIXMAN_OP_SATURATE, + PIXMAN_a8r8g8b8, 0x172ff00, + PIXMAN_a4r4g4b4, 0xff61, + PIXMAN_r3g3b2, 0xc + }, + { PIXMAN_OP_DISJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x281ffc8, + PIXMAN_r5g6b5, 0x39b8, + PIXMAN_r5g6b5, 0x13 + }, + { PIXMAN_OP_CONJOINT_IN, + PIXMAN_a8r8g8b8, 0x100a2ff, + PIXMAN_a4r4g4b4, 0x6500, + PIXMAN_a2r2g2b2, 0x5 + }, + { PIXMAN_OP_CONJOINT_IN, + PIXMAN_a8r8g8b8, 0x1ffff51, + PIXMAN_r5g6b5, 0x52ff, + PIXMAN_a2r2g2b2, 0x14 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x150d500, + PIXMAN_a8r8g8b8, 0x6200b7ff, + PIXMAN_a8r8g8b8, 0x1f5200 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x2a9a700, + PIXMAN_a8r8g8b8, 0xf7003400, + PIXMAN_a8r8g8b8, 0x2200 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x200ffff, + PIXMAN_r5g6b5, 0x81ff, + PIXMAN_r5g6b5, 0x1f + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x2ff00ff, + PIXMAN_r5g6b5, 0x3f00, + PIXMAN_r3g3b2, 0x20 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x3ff1aa4, + PIXMAN_a4r4g4b4, 0x2200, + PIXMAN_r5g6b5, 0x2000 + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x280ff2c, + PIXMAN_r3g3b2, 0xc6, + PIXMAN_a8r8g8b8, 0xfdfd44fe + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x13aff1d, + PIXMAN_a2r2g2b2, 0x4b, + PIXMAN_r5g6b5, 0x12a1 + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x2ffff88, + PIXMAN_a8r8g8b8, 0xff3a49, + PIXMAN_r5g6b5, 0xf7df + }, + { PIXMAN_OP_CONJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x1009700, + PIXMAN_a2r2g2b2, 0x56, + PIXMAN_a8r8g8b8, 0x0 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x1aacbff, + PIXMAN_a4r4g4b4, 0x84, + PIXMAN_r3g3b2, 0x1 + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x100b1ff, + PIXMAN_a2r2g2b2, 0xf5, + PIXMAN_a8r8g8b8, 0xfea89cff + }, + { PIXMAN_OP_CONJOINT_XOR, + PIXMAN_a8r8g8b8, 0x1ff0000, + PIXMAN_r5g6b5, 0x6800, + PIXMAN_a4r4g4b4, 0x0 + }, + { PIXMAN_OP_CONJOINT_XOR, + PIXMAN_a8r8g8b8, 0x10064ff, + PIXMAN_r3g3b2, 0x61, + PIXMAN_a4r4g4b4, 0x0 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x1bb00ff, + PIXMAN_r5g6b5, 0x76b5, + PIXMAN_a4r4g4b4, 0x500 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x2ffff41, + PIXMAN_r5g6b5, 0x7100, + PIXMAN_a4r4g4b4, 0x20 + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x1ff1231, + PIXMAN_a8r8g8b8, 0x381089, + PIXMAN_r5g6b5, 0x38a5 + }, + { PIXMAN_OP_CONJOINT_IN, + PIXMAN_a8r8g8b8, 0x16e5c49, + PIXMAN_a8r8g8b8, 0x4dfa3694, + PIXMAN_a8r8g8b8, 0x211c16 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x134ff62, + PIXMAN_a2r2g2b2, 0x14, + PIXMAN_r3g3b2, 0x8 + }, + { PIXMAN_OP_CONJOINT_IN, + PIXMAN_a8r8g8b8, 0x300ffeb, + PIXMAN_r3g3b2, 0xc7, + PIXMAN_a4r4g4b4, 0x20 + }, + { PIXMAN_OP_CONJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x3ff8bff, + PIXMAN_r3g3b2, 0x3e, + PIXMAN_a8r8g8b8, 0x3008baa + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x1ff00ff, + PIXMAN_a4r4g4b4, 0x3466, + PIXMAN_a4r4g4b4, 0x406 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x1ddc027, + PIXMAN_a4r4g4b4, 0x7d00, + PIXMAN_r5g6b5, 0x0 + }, + { PIXMAN_OP_CONJOINT_IN, + PIXMAN_a8r8g8b8, 0x2ffff00, + PIXMAN_a8r8g8b8, 0xc92cfb52, + PIXMAN_a4r4g4b4, 0x200 + }, + { PIXMAN_OP_CONJOINT_XOR, + PIXMAN_a8r8g8b8, 0x1ff116a, + PIXMAN_a4r4g4b4, 0x6000, + PIXMAN_a4r4g4b4, 0x0 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x1ffffff, + PIXMAN_r5g6b5, 0x2f95, + PIXMAN_r5g6b5, 0x795 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x2ffff00, + PIXMAN_a4r4g4b4, 0x354a, + PIXMAN_r5g6b5, 0x3180 + }, + { PIXMAN_OP_SATURATE, + PIXMAN_a8r8g8b8, 0x1d7ff00, + PIXMAN_a4r4g4b4, 0xd6ff, + PIXMAN_a8r8g8b8, 0xffff0700 + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x1bc5db7, + PIXMAN_r5g6b5, 0x944f, + PIXMAN_a4r4g4b4, 0xff05 + }, + { PIXMAN_OP_SATURATE, + PIXMAN_a8r8g8b8, 0x185ffd9, + PIXMAN_a2r2g2b2, 0x9c, + PIXMAN_r5g6b5, 0x3c07 + }, + { PIXMAN_OP_DISJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x1fa7f61, + PIXMAN_a8r8g8b8, 0xff31ff00, + PIXMAN_r3g3b2, 0xd2 + }, + { PIXMAN_OP_CONJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x1c4ff00, + PIXMAN_r3g3b2, 0xb, + PIXMAN_a4r4g4b4, 0x0 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x2ff00ff, + PIXMAN_a8r8g8b8, 0x3f3caeda, + PIXMAN_r3g3b2, 0x20 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x100ff00, + PIXMAN_r5g6b5, 0xff, + PIXMAN_r5g6b5, 0xe0 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x1ff68ff, + PIXMAN_a4r4g4b4, 0x8046, + PIXMAN_r5g6b5, 0xec + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x100ff28, + PIXMAN_a8r8g8b8, 0x4c00, + PIXMAN_r5g6b5, 0x260 + }, + { PIXMAN_OP_CONJOINT_IN, + PIXMAN_a8r8g8b8, 0x1ffff00, + PIXMAN_a4r4g4b4, 0xd92a, + PIXMAN_a8r8g8b8, 0x2200 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x100289a, + PIXMAN_a8r8g8b8, 0x74ffb8ff, + PIXMAN_r5g6b5, 0x0 + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x1baff00, + PIXMAN_r5g6b5, 0x4e9d, + PIXMAN_r5g6b5, 0x3000 + }, + { PIXMAN_OP_CONJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x1fcffad, + PIXMAN_r5g6b5, 0x42d7, + PIXMAN_a8r8g8b8, 0x1c6ffe5 + }, + { PIXMAN_OP_CONJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x183ff00, + PIXMAN_r3g3b2, 0x7e, + PIXMAN_a4r4g4b4, 0xff + }, + { PIXMAN_OP_SATURATE, + PIXMAN_a8r8g8b8, 0x2ff0076, + PIXMAN_a8r8g8b8, 0x2a0000, + PIXMAN_r3g3b2, 0x20 + }, + { PIXMAN_OP_CONJOINT_OUT, + PIXMAN_a8r8g8b8, 0x3d8bbff, + PIXMAN_r5g6b5, 0x6900, + PIXMAN_a8r8g8b8, 0x35b0000 + }, + { PIXMAN_OP_CONJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x14f00ff, + PIXMAN_r5g6b5, 0xd48, + PIXMAN_a4r4g4b4, 0x0 + }, + { PIXMAN_OP_CONJOINT_IN, + PIXMAN_a8r8g8b8, 0x28c72df, + PIXMAN_a8r8g8b8, 0xff5cff31, + PIXMAN_a4r4g4b4, 0x2 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x2ffffff, + PIXMAN_a8r8g8b8, 0xffad8020, + PIXMAN_r5g6b5, 0x4 + }, + { PIXMAN_OP_DISJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x100ff00, + PIXMAN_a2r2g2b2, 0x76, + PIXMAN_r3g3b2, 0x0 + }, + { PIXMAN_OP_CONJOINT_XOR, + PIXMAN_a8r8g8b8, 0x1005d00, + PIXMAN_r5g6b5, 0x7b04, + PIXMAN_a8r8g8b8, 0x1000000 + }, + { PIXMAN_OP_CONJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x3cdfc3e, + PIXMAN_a8r8g8b8, 0x69ec21d3, + PIXMAN_a4r4g4b4, 0x20 + }, + { PIXMAN_OP_DISJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x200ffff, + PIXMAN_r5g6b5, 0x30ff, + PIXMAN_r5g6b5, 0x60ff + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x532fff4, + PIXMAN_r5g6b5, 0xcb, + PIXMAN_r5g6b5, 0xd9a1 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x1ffffff, + PIXMAN_r3g3b2, 0x5f, + PIXMAN_a2r2g2b2, 0x10 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x1ffffff, + PIXMAN_a8r8g8b8, 0xffd60052, + PIXMAN_r3g3b2, 0x1 + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x1ff6491, + PIXMAN_a8r8g8b8, 0x1e53ff00, + PIXMAN_r5g6b5, 0x1862 + }, + { PIXMAN_OP_CONJOINT_IN, + PIXMAN_a8r8g8b8, 0x1ffff00, + PIXMAN_r3g3b2, 0xc7, + PIXMAN_a4r4g4b4, 0x20 + }, + { PIXMAN_OP_CONJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x29d0fff, + PIXMAN_a4r4g4b4, 0x25ff, + PIXMAN_a8r8g8b8, 0x0 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x141760a, + PIXMAN_a4r4g4b4, 0x7ec2, + PIXMAN_a4r4g4b4, 0x130 + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x1abedff, + PIXMAN_a8r8g8b8, 0x75520068, + PIXMAN_r3g3b2, 0x87 + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x10000ff, + PIXMAN_a8r8g8b8, 0xff00e652, + PIXMAN_r3g3b2, 0x1 + }, + { PIXMAN_OP_CONJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x16006075, + PIXMAN_r5g6b5, 0xc00, + PIXMAN_a8r8g8b8, 0x27f0900 + }, + { PIXMAN_OP_DISJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x200ff00, + PIXMAN_a8r8g8b8, 0xd1b83f57, + PIXMAN_a4r4g4b4, 0xff75 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x14000c4, + PIXMAN_a4r4g4b4, 0x96, + PIXMAN_a2r2g2b2, 0x1 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x1ff00d1, + PIXMAN_r3g3b2, 0x79, + PIXMAN_a2r2g2b2, 0x0 + }, + { PIXMAN_OP_CONJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x1ff00dc, + PIXMAN_a4r4g4b4, 0xc5ff, + PIXMAN_a2r2g2b2, 0x10 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x1ffffb2, + PIXMAN_a8r8g8b8, 0x4cff5700, + PIXMAN_r3g3b2, 0x48 + }, + { PIXMAN_OP_CONJOINT_XOR, + PIXMAN_a8r8g8b8, 0x1327482, + PIXMAN_a8r8g8b8, 0x247ff, + PIXMAN_a8r8g8b8, 0x82 + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x1d0ff00, + PIXMAN_r3g3b2, 0xc9, + PIXMAN_r5g6b5, 0x240 + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x13d35ff, + PIXMAN_a2r2g2b2, 0x6d, + PIXMAN_r3g3b2, 0x1 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x1ffc6b2, + PIXMAN_a8r8g8b8, 0x5abe8e3c, + PIXMAN_r5g6b5, 0x5a27 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x15700ff, + PIXMAN_r3g3b2, 0xdd, + PIXMAN_a8r8g8b8, 0x55 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x1ff11ff, + PIXMAN_r3g3b2, 0x30, + PIXMAN_r5g6b5, 0x2000 + }, + { PIXMAN_OP_DISJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x1ff00ff, + PIXMAN_a2r2g2b2, 0x6d, + PIXMAN_r3g3b2, 0x0 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x1421d5f, + PIXMAN_a4r4g4b4, 0xff85, + PIXMAN_a8r8g8b8, 0x1420f00 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x1d2ffff, + PIXMAN_r5g6b5, 0xfc, + PIXMAN_r5g6b5, 0x1c + }, + { PIXMAN_OP_CONJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x1ffff42, + PIXMAN_a4r4g4b4, 0x7100, + PIXMAN_a4r4g4b4, 0x771 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x25ae3d4, + PIXMAN_a8r8g8b8, 0x39ffc99a, + PIXMAN_a8r8g8b8, 0x14332f + }, + { PIXMAN_OP_DISJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x1ff0643, + PIXMAN_a8r8g8b8, 0x4c000000, + PIXMAN_r5g6b5, 0x4802 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x1966a00, + PIXMAN_r3g3b2, 0x46, + PIXMAN_r5g6b5, 0x0 + }, + { PIXMAN_OP_DISJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x387ff59, + PIXMAN_r5g6b5, 0x512c, + PIXMAN_r5g6b5, 0x120 + }, + { PIXMAN_OP_CONJOINT_XOR, + PIXMAN_a8r8g8b8, 0x1f7ffb0, + PIXMAN_r5g6b5, 0x63b8, + PIXMAN_a8r8g8b8, 0x1000089 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x185841c, + PIXMAN_a2r2g2b2, 0x5c, + PIXMAN_a8r8g8b8, 0x8400 + }, + { PIXMAN_OP_DISJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x1ffc3ff, + PIXMAN_a8r8g8b8, 0xff7b, + PIXMAN_a8r8g8b8, 0xff00c300 + }, + { PIXMAN_OP_CONJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x1ff7500, + PIXMAN_a2r2g2b2, 0x47, + PIXMAN_a4r4g4b4, 0xff + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x1002361, + PIXMAN_a2r2g2b2, 0x7e, + PIXMAN_r5g6b5, 0x64 + }, + { PIXMAN_OP_SATURATE, + PIXMAN_a8r8g8b8, 0x10000b6, + PIXMAN_a8r8g8b8, 0x59004463, + PIXMAN_a4r4g4b4, 0xffa7 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x1ff5a49, + PIXMAN_a8r8g8b8, 0xff3fff2b, + PIXMAN_a8r8g8b8, 0x13f000c + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x3ffecfc, + PIXMAN_r3g3b2, 0x3c, + PIXMAN_r5g6b5, 0x2000 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x1630044, + PIXMAN_a2r2g2b2, 0x63, + PIXMAN_r3g3b2, 0x20 + }, + { PIXMAN_OP_CONJOINT_OUT, + PIXMAN_a8r8g8b8, 0x1d2ff58, + PIXMAN_a8r8g8b8, 0x8f77ff, + PIXMAN_a4r4g4b4, 0x705 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x14dffff, + PIXMAN_a2r2g2b2, 0x9a, + PIXMAN_a8r8g8b8, 0x1a0000 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x100ff92, + PIXMAN_a4r4g4b4, 0x540c, + PIXMAN_r5g6b5, 0x2a6 + }, + { PIXMAN_OP_CONJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x1ffffff, + PIXMAN_a4r4g4b4, 0xddd5, + PIXMAN_a4r4g4b4, 0xdd0 + }, + { PIXMAN_OP_CONJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x1ffffff, + PIXMAN_r5g6b5, 0xff8c, + PIXMAN_a4r4g4b4, 0xff0 + }, + { PIXMAN_OP_DISJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x1ffffff, + PIXMAN_r3g3b2, 0x66, + PIXMAN_r5g6b5, 0x7d1f + }, + { PIXMAN_OP_CONJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x1ffff00, + PIXMAN_a4r4g4b4, 0xff5b, + PIXMAN_a8r8g8b8, 0x5500 + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x2ed2dff, + PIXMAN_r5g6b5, 0x7ae7, + PIXMAN_r3g3b2, 0xce + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x1b13205, + PIXMAN_a8r8g8b8, 0x35ffff00, + PIXMAN_r5g6b5, 0x2040 + }, + { PIXMAN_OP_CONJOINT_IN, + PIXMAN_a8r8g8b8, 0x1e60dff, + PIXMAN_a4r4g4b4, 0x760f, + PIXMAN_a2r2g2b2, 0x11 + }, + { PIXMAN_OP_CONJOINT_OUT, + PIXMAN_a8r8g8b8, 0x10000ff, + PIXMAN_a4r4g4b4, 0x3, + PIXMAN_a8r8g8b8, 0x0 + }, + { PIXMAN_OP_CONJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x100ffff, + PIXMAN_a8r8g8b8, 0x6600, + PIXMAN_a4r4g4b4, 0x0 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x30000fa, + PIXMAN_a4r4g4b4, 0x23b7, + PIXMAN_a8r8g8b8, 0x21 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x1ffffff, + PIXMAN_r3g3b2, 0x60, + PIXMAN_r3g3b2, 0x60 + }, + { PIXMAN_OP_CONJOINT_OUT, + PIXMAN_a8r8g8b8, 0x3b31b30, + PIXMAN_r3g3b2, 0x2e, + PIXMAN_a8r8g8b8, 0x3000c20 + }, + { PIXMAN_OP_DISJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x160ffff, + PIXMAN_a4r4g4b4, 0xff42, + PIXMAN_r3g3b2, 0xed + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x172ffff, + PIXMAN_a4r4g4b4, 0x5100, + PIXMAN_r3g3b2, 0x29 + }, + { PIXMAN_OP_CONJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x16300ff, + PIXMAN_a4r4g4b4, 0x5007, + PIXMAN_a8r8g8b8, 0x77 + }, + { PIXMAN_OP_CONJOINT_IN, + PIXMAN_a8r8g8b8, 0x2ffff3a, + PIXMAN_a8r8g8b8, 0x26640083, + PIXMAN_a4r4g4b4, 0x220 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x106ff60, + PIXMAN_r5g6b5, 0xdce, + PIXMAN_a8r8g8b8, 0x100ba00 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x100e7ff, + PIXMAN_r5g6b5, 0xa00, + PIXMAN_r5g6b5, 0x0 + }, + { PIXMAN_OP_CONJOINT_XOR, + PIXMAN_a8r8g8b8, 0x2b500f1, + PIXMAN_a4r4g4b4, 0x7339, + PIXMAN_a8r8g8b8, 0x1000091 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x1ff00ff, + PIXMAN_a4r4g4b4, 0xc863, + PIXMAN_r5g6b5, 0x6 + }, + { PIXMAN_OP_SATURATE, + PIXMAN_a8r8g8b8, 0x1ffffca, + PIXMAN_a8r8g8b8, 0x8b4cf000, + PIXMAN_r3g3b2, 0xd2 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x1fffe00, + PIXMAN_r3g3b2, 0x88, + PIXMAN_r3g3b2, 0x8 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x16f0000, + PIXMAN_a2r2g2b2, 0x59, + PIXMAN_r5g6b5, 0x2000 + }, + { PIXMAN_OP_CONJOINT_OUT, + PIXMAN_a8r8g8b8, 0x377ff43, + PIXMAN_a4r4g4b4, 0x2a, + PIXMAN_a8r8g8b8, 0x2d + }, + { PIXMAN_OP_DISJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x11dffff, + PIXMAN_r3g3b2, 0xcb, + PIXMAN_r3g3b2, 0x8 + }, + { PIXMAN_OP_CONJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x1ffffff, + PIXMAN_r5g6b5, 0xbdab, + PIXMAN_a4r4g4b4, 0xbb0 + }, + { PIXMAN_OP_CONJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x1ff3343, + PIXMAN_a8r8g8b8, 0x7a00ffff, + PIXMAN_a2r2g2b2, 0xd + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x1ebff4b, + PIXMAN_r3g3b2, 0x26, + PIXMAN_r3g3b2, 0x24 + }, + { PIXMAN_OP_DISJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x2c1b3ff, + PIXMAN_a8r8g8b8, 0x3000152a, + PIXMAN_r3g3b2, 0x24 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x1a7ffff, + PIXMAN_r3g3b2, 0x9, + PIXMAN_r5g6b5, 0x24a + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x4ff00ec, + PIXMAN_a8r8g8b8, 0x1da4961e, + PIXMAN_a8r8g8b8, 0x0 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x1ff25ff, + PIXMAN_a8r8g8b8, 0x64b0ff00, + PIXMAN_r5g6b5, 0x606c + }, + { PIXMAN_OP_DISJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x1fd62ff, + PIXMAN_a4r4g4b4, 0x76b1, + PIXMAN_r5g6b5, 0x716e + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x194ffde, + PIXMAN_r5g6b5, 0x47ff, + PIXMAN_r5g6b5, 0x2000 + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x108ffff, + PIXMAN_a8r8g8b8, 0xffffff66, + PIXMAN_r5g6b5, 0xff0c + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x5ffffff, + PIXMAN_r5g6b5, 0xdf, + PIXMAN_r5g6b5, 0xc0 + }, + { PIXMAN_OP_CONJOINT_IN, + PIXMAN_a8r8g8b8, 0x100ad31, + PIXMAN_a2r2g2b2, 0xc5, + PIXMAN_a4r4g4b4, 0x31 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x1ffff34, + PIXMAN_a8r8g8b8, 0x6a57c491, + PIXMAN_r3g3b2, 0x0 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x1fffff1, + PIXMAN_r3g3b2, 0xaf, + PIXMAN_r5g6b5, 0xb01e + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x1ff67ff, + PIXMAN_a4r4g4b4, 0x50ff, + PIXMAN_a8r8g8b8, 0x552255 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x11bffff, + PIXMAN_r5g6b5, 0xef0c, + PIXMAN_r5g6b5, 0xc + }, + { PIXMAN_OP_DISJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x16cf37d, + PIXMAN_a4r4g4b4, 0xc561, + PIXMAN_r5g6b5, 0x2301 + }, + { PIXMAN_OP_CONJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x2ffff9c, + PIXMAN_a4r4g4b4, 0x2700, + PIXMAN_a8r8g8b8, 0xffff + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x200f322, + PIXMAN_a8r8g8b8, 0xff3c7e, + PIXMAN_r5g6b5, 0x2 + }, + { PIXMAN_OP_DISJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x1f14a33, + PIXMAN_a8r8g8b8, 0x26cff79, + PIXMAN_r3g3b2, 0xf9 + }, + { PIXMAN_OP_CONJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x11d922c, + PIXMAN_r3g3b2, 0xab, + PIXMAN_a4r4g4b4, 0x20 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x100ffff, + PIXMAN_a2r2g2b2, 0xf5, + PIXMAN_r3g3b2, 0x9 + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x18697ff, + PIXMAN_a4r4g4b4, 0x5700, + PIXMAN_r5g6b5, 0xfa6d + }, + { PIXMAN_OP_CONJOINT_IN, + PIXMAN_a8r8g8b8, 0x12000fc, + PIXMAN_a2r2g2b2, 0x41, + PIXMAN_a8r8g8b8, 0xb0054 + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x100ccff, + PIXMAN_a4r4g4b4, 0x657e, + PIXMAN_r5g6b5, 0x3b1 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x1ffff1f, + PIXMAN_a2r2g2b2, 0xa6, + PIXMAN_r5g6b5, 0x2a0 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x11fff82, + PIXMAN_a4r4g4b4, 0xff94, + PIXMAN_a8r8g8b8, 0x1010123 + }, + { PIXMAN_OP_CONJOINT_XOR, + PIXMAN_a8r8g8b8, 0x154bd19, + PIXMAN_a4r4g4b4, 0xb600, + PIXMAN_a8r8g8b8, 0x1000000 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x10000ff, + PIXMAN_r5g6b5, 0x8e, + PIXMAN_r5g6b5, 0x0 + }, + { PIXMAN_OP_DISJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x21aff00, + PIXMAN_r5g6b5, 0x71ff, + PIXMAN_r3g3b2, 0xf2 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x2ad00a7, + PIXMAN_a4r4g4b4, 0x23, + PIXMAN_a8r8g8b8, 0x21 + }, + { PIXMAN_OP_SATURATE, + PIXMAN_a8r8g8b8, 0x100ff00, + PIXMAN_r5g6b5, 0xb343, + PIXMAN_r3g3b2, 0xc + }, + { PIXMAN_OP_SATURATE, + PIXMAN_a8r8g8b8, 0x3ffa500, + PIXMAN_a8r8g8b8, 0x1af5b4, + PIXMAN_a8r8g8b8, 0xff1abc00 + }, + { PIXMAN_OP_CONJOINT_OUT, + PIXMAN_a8r8g8b8, 0x2ffff11, + PIXMAN_a8r8g8b8, 0x9f334f, + PIXMAN_a8r8g8b8, 0x9f0005 + }, + { PIXMAN_OP_CONJOINT_IN, + PIXMAN_a8r8g8b8, 0x2c75971, + PIXMAN_a4r4g4b4, 0x3900, + PIXMAN_a4r4g4b4, 0x211 + }, + { PIXMAN_OP_DISJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x100ff49, + PIXMAN_a8r8g8b8, 0x813dc25e, + PIXMAN_r5g6b5, 0x667d + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x10000ff, + PIXMAN_a4r4g4b4, 0x4bff, + PIXMAN_a8r8g8b8, 0x0 + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x20ebcff, + PIXMAN_r5g6b5, 0xc9ff, + PIXMAN_r3g3b2, 0x4 + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x1ffff00, + PIXMAN_r5g6b5, 0x51ff, + PIXMAN_r3g3b2, 0x44 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x1ffd158, + PIXMAN_a8r8g8b8, 0x7d88ffce, + PIXMAN_r3g3b2, 0x6c + }, + { PIXMAN_OP_SATURATE, + PIXMAN_a8r8g8b8, 0x1425e21, + PIXMAN_a2r2g2b2, 0xa5, + PIXMAN_r5g6b5, 0xe1 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x14b00ff, + PIXMAN_a8r8g8b8, 0xbe95004b, + PIXMAN_r5g6b5, 0x9 + }, + { PIXMAN_OP_CONJOINT_OUT, + PIXMAN_a8r8g8b8, 0x14fc0cd, + PIXMAN_a8r8g8b8, 0x2d12b78b, + PIXMAN_a8r8g8b8, 0x0 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x1ff8230, + PIXMAN_a2r2g2b2, 0x4c, + PIXMAN_r3g3b2, 0x44 + }, + { PIXMAN_OP_CONJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x1ff31ff, + PIXMAN_a2r2g2b2, 0x14, + PIXMAN_a8r8g8b8, 0x551000 + }, + { PIXMAN_OP_CONJOINT_IN, + PIXMAN_a8r8g8b8, 0x17800ff, + PIXMAN_a4r4g4b4, 0x22, + PIXMAN_a8r8g8b8, 0x22 + }, + { PIXMAN_OP_SATURATE, + PIXMAN_a8r8g8b8, 0x14500ff, + PIXMAN_a4r4g4b4, 0x6400, + PIXMAN_r5g6b5, 0xff78 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x100ff9d, + PIXMAN_r3g3b2, 0xcd, + PIXMAN_r3g3b2, 0x0 + }, + { PIXMAN_OP_CONJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x3ff00ff, + PIXMAN_a4r4g4b4, 0xf269, + PIXMAN_a4r4g4b4, 0x200 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x2ff28b8, + PIXMAN_a4r4g4b4, 0x33ff, + PIXMAN_r5g6b5, 0x3000 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x1006278, + PIXMAN_a8r8g8b8, 0x8a7f18, + PIXMAN_r3g3b2, 0x4 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x1ffcb00, + PIXMAN_a4r4g4b4, 0x7900, + PIXMAN_a2r2g2b2, 0x14 + }, + { PIXMAN_OP_CONJOINT_OUT, + PIXMAN_a8r8g8b8, 0x115ff00, + PIXMAN_a8r8g8b8, 0x508d, + PIXMAN_a4r4g4b4, 0x0 + }, + { PIXMAN_OP_SATURATE, + PIXMAN_a8r8g8b8, 0x3ff30b5, + PIXMAN_r5g6b5, 0x2e60, + PIXMAN_r3g3b2, 0x20 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x182fffb, + PIXMAN_r3g3b2, 0x1, + PIXMAN_a8r8g8b8, 0x1000054 + }, + { PIXMAN_OP_CONJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x16fff00, + PIXMAN_r5g6b5, 0x7bc0, + PIXMAN_a8r8g8b8, 0x367900 + }, + { PIXMAN_OP_DISJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x1d95dd8, + PIXMAN_a4r4g4b4, 0xfff5, + PIXMAN_r5g6b5, 0xff09 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x1ff3cdc, + PIXMAN_a8r8g8b8, 0x3bda45ff, + PIXMAN_r3g3b2, 0x0 + }, + { PIXMAN_OP_DISJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x13900f8, + PIXMAN_a8r8g8b8, 0x7e00ffff, + PIXMAN_a4r4g4b4, 0xff00 + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x10ea9ff, + PIXMAN_a8r8g8b8, 0xff34ff22, + PIXMAN_r5g6b5, 0xff52 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x2002e99, + PIXMAN_a4r4g4b4, 0x3000, + PIXMAN_r5g6b5, 0x43 + }, + { PIXMAN_OP_DISJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x100ffff, + PIXMAN_r5g6b5, 0x19ff, + PIXMAN_r3g3b2, 0x3 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x1ffff00, + PIXMAN_a8r8g8b8, 0xffff4251, + PIXMAN_a2r2g2b2, 0x4 + }, + { PIXMAN_OP_CONJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x121c9ff, + PIXMAN_a4r4g4b4, 0xd2, + PIXMAN_a4r4g4b4, 0x2 + }, + { PIXMAN_OP_CONJOINT_IN, + PIXMAN_a8r8g8b8, 0x100ff4d, + PIXMAN_a2r2g2b2, 0x5e, + PIXMAN_a2r2g2b2, 0x4 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x29ab4ff, + PIXMAN_r3g3b2, 0x47, + PIXMAN_a8r8g8b8, 0x1900 + }, + { PIXMAN_OP_CONJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x1ffc1ac, + PIXMAN_a8r8g8b8, 0xee4ed0ac, + PIXMAN_a8r8g8b8, 0x1009d74 + }, + { PIXMAN_OP_CONJOINT_IN_REVERSE, + PIXMAN_a8r8g8b8, 0x269dffdc, + PIXMAN_a8r8g8b8, 0xff0b00e0, + PIXMAN_a8r8g8b8, 0x2a200ff + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x2ffffff, + PIXMAN_a4r4g4b4, 0x3200, + PIXMAN_r3g3b2, 0x24 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x100ffed, + PIXMAN_a8r8g8b8, 0x67004eff, + PIXMAN_a2r2g2b2, 0x5 + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x2fffd6a, + PIXMAN_a8r8g8b8, 0xc9003bff, + PIXMAN_r3g3b2, 0x4 + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x253ff00, + PIXMAN_r5g6b5, 0xff, + PIXMAN_r5g6b5, 0xe0 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x13600ad, + PIXMAN_r5g6b5, 0x35ae, + PIXMAN_r3g3b2, 0x1 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x1ffa8ff, + PIXMAN_a8r8g8b8, 0xff5f00, + PIXMAN_r3g3b2, 0xe0 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x10067ff, + PIXMAN_a4r4g4b4, 0x450d, + PIXMAN_a2r2g2b2, 0x1 + }, + { PIXMAN_OP_SATURATE, + PIXMAN_a8r8g8b8, 0x1ff01ff, + PIXMAN_r3g3b2, 0x77, + PIXMAN_r5g6b5, 0x6800 + }, + { PIXMAN_OP_CONJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x11da4ff, + PIXMAN_r5g6b5, 0x83c9, + PIXMAN_a4r4g4b4, 0x44 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x1ffd4ff, + PIXMAN_r3g3b2, 0xaa, + PIXMAN_r3g3b2, 0x4 + }, + { PIXMAN_OP_CONJOINT_IN, + PIXMAN_a8r8g8b8, 0x1ff0000, + PIXMAN_a8r8g8b8, 0x71002a, + PIXMAN_a4r4g4b4, 0x700 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x1d7ffff, + PIXMAN_r5g6b5, 0x3696, + PIXMAN_a4r4g4b4, 0x200 + }, + { PIXMAN_OP_CONJOINT_IN, + PIXMAN_a8r8g8b8, 0x1ffffc8, + PIXMAN_r5g6b5, 0xe900, + PIXMAN_a8r8g8b8, 0x2000 + }, + { PIXMAN_OP_CONJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x1ff004a, + PIXMAN_r3g3b2, 0x48, + PIXMAN_a8r8g8b8, 0x1000000 + }, + { PIXMAN_OP_DISJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x3ffe969, + PIXMAN_r5g6b5, 0xff, + PIXMAN_r5g6b5, 0xc0 + }, + { PIXMAN_OP_CONJOINT_XOR, + PIXMAN_a8r8g8b8, 0x300ff73, + PIXMAN_r5g6b5, 0xff, + PIXMAN_a8r8g8b8, 0x3000073 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x2ff93ff, + PIXMAN_a8r8g8b8, 0x61fc7d2b, + PIXMAN_a4r4g4b4, 0x2 + }, + { PIXMAN_OP_DISJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x11bffff, + PIXMAN_a4r4g4b4, 0xffb4, + PIXMAN_r5g6b5, 0x8 + }, + { PIXMAN_OP_CONJOINT_IN, + PIXMAN_a8r8g8b8, 0x1e9e100, + PIXMAN_a2r2g2b2, 0x56, + PIXMAN_a2r2g2b2, 0x14 + }, + { PIXMAN_OP_SATURATE, + PIXMAN_a8r8g8b8, 0x3ffb656, + PIXMAN_r3g3b2, 0x4, + PIXMAN_a4r4g4b4, 0xff99 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x100ff00, + PIXMAN_r3g3b2, 0x68, + PIXMAN_r3g3b2, 0x0 + }, + { PIXMAN_OP_SATURATE, + PIXMAN_a8r8g8b8, 0x1006dff, + PIXMAN_a2r2g2b2, 0x5d, + PIXMAN_a8r8g8b8, 0xff00ff55 + }, + { PIXMAN_OP_CONJOINT_IN, + PIXMAN_a8r8g8b8, 0x11c00cb, + PIXMAN_a2r2g2b2, 0x44, + PIXMAN_a4r4g4b4, 0x4 + }, + { PIXMAN_OP_CONJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x1d0ff86, + PIXMAN_r3g3b2, 0x5c, + PIXMAN_a8r8g8b8, 0x3c0000 + }, + { PIXMAN_OP_CONJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x2f25fff, + PIXMAN_r3g3b2, 0x36, + PIXMAN_a8r8g8b8, 0x2a444aa + }, + { PIXMAN_OP_DISJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x134af85, + PIXMAN_r3g3b2, 0x29, + PIXMAN_r5g6b5, 0xf300 + }, + { PIXMAN_OP_CONJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x13398af, + PIXMAN_r3g3b2, 0xa5, + PIXMAN_a4r4g4b4, 0x13 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x1ff57ff, + PIXMAN_a4r4g4b4, 0x252c, + PIXMAN_r3g3b2, 0x40 + }, + { PIXMAN_OP_DISJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x115ffff, + PIXMAN_r5g6b5, 0xffe3, + PIXMAN_r5g6b5, 0x3303 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x1ffff00, + PIXMAN_r5g6b5, 0x6300, + PIXMAN_r3g3b2, 0x6c + }, + { PIXMAN_OP_CONJOINT_XOR, + PIXMAN_a8r8g8b8, 0x4ccff9c, + PIXMAN_r5g6b5, 0xcc, + PIXMAN_a8r8g8b8, 0x400003d + }, + { PIXMAN_OP_DISJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x1ffc6dd, + PIXMAN_r5g6b5, 0x9bff, + PIXMAN_r5g6b5, 0x5bff + }, + { PIXMAN_OP_CONJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x14fff95, + PIXMAN_r3g3b2, 0x46, + PIXMAN_a8r8g8b8, 0x1000063 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x1e6b700, + PIXMAN_r5g6b5, 0xc1ff, + PIXMAN_r3g3b2, 0x4 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x1ffff54, + PIXMAN_a8r8g8b8, 0x2e00ff, + PIXMAN_r5g6b5, 0x2800 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x3ffffff, + PIXMAN_r5g6b5, 0xff, + PIXMAN_r5g6b5, 0xe0 + }, + { PIXMAN_OP_DISJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x1003550, + PIXMAN_r5g6b5, 0xffcc, + PIXMAN_r5g6b5, 0x1e0 + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x1ffff74, + PIXMAN_r3g3b2, 0x28, + PIXMAN_a8r8g8b8, 0xfe2f49d7 + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x1e35100, + PIXMAN_r3g3b2, 0x57, + PIXMAN_r5g6b5, 0x4000 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x268ffa3, + PIXMAN_a4r4g4b4, 0x30, + PIXMAN_a4r4g4b4, 0x0 + }, + { PIXMAN_OP_DISJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x35700f8, + PIXMAN_r5g6b5, 0xa4, + PIXMAN_r5g6b5, 0x0 + }, + { PIXMAN_OP_CONJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x3ce1dff, + PIXMAN_r5g6b5, 0x2a5e, + PIXMAN_a8r8g8b8, 0x210000 + }, + { PIXMAN_OP_CONJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x494a7ff, + PIXMAN_a8r8g8b8, 0x1bffe400, + PIXMAN_a8r8g8b8, 0x0 + }, + { PIXMAN_OP_SATURATE, + PIXMAN_a8r8g8b8, 0x10026d9, + PIXMAN_a8r8g8b8, 0xec00621f, + PIXMAN_r5g6b5, 0x63 + }, + { PIXMAN_OP_CONJOINT_IN, + PIXMAN_a8r8g8b8, 0x100ff99, + PIXMAN_a8r8g8b8, 0xf334ff, + PIXMAN_a4r4g4b4, 0x30 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x2ffc200, + PIXMAN_a8r8g8b8, 0x1e0000ff, + PIXMAN_a8r8g8b8, 0x1e1700 + }, + { PIXMAN_OP_DISJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x1ff00ff, + PIXMAN_r3g3b2, 0x4b, + PIXMAN_r5g6b5, 0x4818 + }, + { PIXMAN_OP_CONJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x2e800ff, + PIXMAN_a4r4g4b4, 0xd3, + PIXMAN_a4r4g4b4, 0xec + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x19a001f, + PIXMAN_r3g3b2, 0x76, + PIXMAN_r3g3b2, 0x0 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x1cb00c3, + PIXMAN_a4r4g4b4, 0x5cff, + PIXMAN_r5g6b5, 0x4008 + }, + { PIXMAN_OP_DISJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x1ff0000, + PIXMAN_r3g3b2, 0x2a, + PIXMAN_r5g6b5, 0xc5fb + }, + { PIXMAN_OP_DISJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x1ffffff, + PIXMAN_a8r8g8b8, 0xea005a88, + PIXMAN_r3g3b2, 0xb3 + }, + { PIXMAN_OP_CONJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x100ffea, + PIXMAN_a4r4g4b4, 0x54eb, + PIXMAN_a8r8g8b8, 0x0 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x179ffff, + PIXMAN_r3g3b2, 0xa4, + PIXMAN_a8r8g8b8, 0x2400 + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x17ad226, + PIXMAN_r3g3b2, 0xa4, + PIXMAN_r5g6b5, 0xe0 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x100ff01, + PIXMAN_a2r2g2b2, 0x25, + PIXMAN_a4r4g4b4, 0x50 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x20000ff, + PIXMAN_a8r8g8b8, 0x2b00c127, + PIXMAN_r5g6b5, 0x0 + }, + { PIXMAN_OP_SATURATE, + PIXMAN_a8r8g8b8, 0x200ff96, + PIXMAN_a4r4g4b4, 0x2300, + PIXMAN_r3g3b2, 0x6 + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x200ffff, + PIXMAN_r3g3b2, 0x87, + PIXMAN_r5g6b5, 0x5bc8 + }, + { PIXMAN_OP_CONJOINT_XOR, + PIXMAN_a8r8g8b8, 0x1fffff2, + PIXMAN_r3g3b2, 0x7e, + PIXMAN_a2r2g2b2, 0xe + }, + { PIXMAN_OP_SATURATE, + PIXMAN_a8r8g8b8, 0x1ff8b00, + PIXMAN_a4r4g4b4, 0xd500, + PIXMAN_r3g3b2, 0x40 + }, + { PIXMAN_OP_CONJOINT_XOR, + PIXMAN_a8r8g8b8, 0x1ffffff, + PIXMAN_a8r8g8b8, 0x1bff38, + PIXMAN_a4r4g4b4, 0xf0 + }, + { PIXMAN_OP_CONJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x158ff39, + PIXMAN_a4r4g4b4, 0x75dd, + PIXMAN_a8r8g8b8, 0xdd31 + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x1009b70, + PIXMAN_a4r4g4b4, 0xff40, + PIXMAN_r3g3b2, 0x4 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x12fb43f, + PIXMAN_a4r4g4b4, 0x69ff, + PIXMAN_a2r2g2b2, 0x4 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x1ffff95, + PIXMAN_a2r2g2b2, 0x84, + PIXMAN_r5g6b5, 0x0 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x200d188, + PIXMAN_r5g6b5, 0xde6, + PIXMAN_r5g6b5, 0x3 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x2c70000, + PIXMAN_r5g6b5, 0x24fa, + PIXMAN_a8r8g8b8, 0x21a0000 + }, + { PIXMAN_OP_CONJOINT_OUT, + PIXMAN_a8r8g8b8, 0x100ff24, + PIXMAN_a4r4g4b4, 0x835, + PIXMAN_a4r4g4b4, 0x0 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x10000cd, + PIXMAN_a2r2g2b2, 0x7f, + PIXMAN_a2r2g2b2, 0x1 + }, + { PIXMAN_OP_SATURATE, + PIXMAN_a8r8g8b8, 0x379ffff, + PIXMAN_a8r8g8b8, 0x23ffff00, + PIXMAN_r5g6b5, 0x4eda + }, + { PIXMAN_OP_SATURATE, + PIXMAN_a8r8g8b8, 0x172e3ff, + PIXMAN_r3g3b2, 0xa6, + PIXMAN_r5g6b5, 0x100 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x100f5ad, + PIXMAN_a4r4g4b4, 0x7908, + PIXMAN_a2r2g2b2, 0x0 + }, + { PIXMAN_OP_DISJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x100fff9, + PIXMAN_a2r2g2b2, 0xf1, + PIXMAN_r3g3b2, 0x1 + }, + { PIXMAN_OP_CONJOINT_XOR, + PIXMAN_a8r8g8b8, 0x1abff00, + PIXMAN_r5g6b5, 0x31ff, + PIXMAN_a8r8g8b8, 0x1000000 + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x112ffd1, + PIXMAN_r3g3b2, 0x9, + PIXMAN_a2r2g2b2, 0xdd + }, + { PIXMAN_OP_CONJOINT_IN, + PIXMAN_a8r8g8b8, 0x100ffbf, + PIXMAN_r3g3b2, 0x2c, + PIXMAN_a4r4g4b4, 0x60 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x1ffb7ff, + PIXMAN_r3g3b2, 0x6b, + PIXMAN_a4r4g4b4, 0x630 + }, + { PIXMAN_OP_SATURATE, + PIXMAN_a8r8g8b8, 0x20005ff, + PIXMAN_a4r4g4b4, 0x8462, + PIXMAN_r5g6b5, 0xb1e8 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x1ff5b00, + PIXMAN_r5g6b5, 0x70ff, + PIXMAN_r3g3b2, 0x60 + }, + { PIXMAN_OP_CONJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x2ffffc3, + PIXMAN_r3g3b2, 0x39, + PIXMAN_a8r8g8b8, 0x200db41 + }, + { PIXMAN_OP_CONJOINT_OUT, + PIXMAN_a8r8g8b8, 0x306ffff, + PIXMAN_a8r8g8b8, 0xdcffff1f, + PIXMAN_a8r8g8b8, 0x306ff00 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x193daff, + PIXMAN_a8r8g8b8, 0x69000000, + PIXMAN_r3g3b2, 0x0 + }, + { PIXMAN_OP_SATURATE, + PIXMAN_a8r8g8b8, 0x2a200ff, + PIXMAN_a8r8g8b8, 0x183aff00, + PIXMAN_r5g6b5, 0x2000 + }, + { PIXMAN_OP_DISJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x100f1a5, + PIXMAN_a8r8g8b8, 0xb5fc21ff, + PIXMAN_r5g6b5, 0xfe00 + }, + { PIXMAN_OP_SATURATE, + PIXMAN_a8r8g8b8, 0x1630019, + PIXMAN_a8r8g8b8, 0x6affc400, + PIXMAN_r5g6b5, 0x56ff + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x1ff8bc2, + PIXMAN_r3g3b2, 0xee, + PIXMAN_r5g6b5, 0x1c0 + }, + { PIXMAN_OP_SATURATE, + PIXMAN_a8r8g8b8, 0x260ffff, + PIXMAN_a4r4g4b4, 0x3f00, + PIXMAN_r3g3b2, 0x4 + }, + { PIXMAN_OP_CONJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x169ffed, + PIXMAN_a8r8g8b8, 0xffffff3f, + PIXMAN_a8r8g8b8, 0x169ff00 + }, + { PIXMAN_OP_CONJOINT_XOR, + PIXMAN_a8r8g8b8, 0x154c181, + PIXMAN_a4r4g4b4, 0x5100, + PIXMAN_a4r4g4b4, 0x0 + }, + { PIXMAN_OP_CONJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x1e09c00, + PIXMAN_r5g6b5, 0xca00, + PIXMAN_a4r4g4b4, 0xb00 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x2ff8dff, + PIXMAN_a8r8g8b8, 0x610038ff, + PIXMAN_a8r8g8b8, 0x1001f02 + }, + { PIXMAN_OP_SATURATE, + PIXMAN_a8r8g8b8, 0x1e400ff, + PIXMAN_a4r4g4b4, 0x66bd, + PIXMAN_r3g3b2, 0x68 + }, + { PIXMAN_OP_CONJOINT_IN, + PIXMAN_a8r8g8b8, 0x25362ff, + PIXMAN_a4r4g4b4, 0x31ff, + PIXMAN_a8r8g8b8, 0x111433 + }, + { PIXMAN_OP_CONJOINT_OUT, + PIXMAN_a8r8g8b8, 0x3ad0039, + PIXMAN_r3g3b2, 0x26, + PIXMAN_a8r8g8b8, 0x3000026 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x2e442ef, + PIXMAN_r3g3b2, 0x32, + PIXMAN_r3g3b2, 0x20 + }, + { PIXMAN_OP_SATURATE, + PIXMAN_a8r8g8b8, 0x1720000, + PIXMAN_a8r8g8b8, 0x55fdea00, + PIXMAN_r3g3b2, 0x20 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x14bb0d7, + PIXMAN_a8r8g8b8, 0x7fffff47, + PIXMAN_a2r2g2b2, 0x0 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x13dffff, + PIXMAN_a8r8g8b8, 0xa3860672, + PIXMAN_r3g3b2, 0x20 + }, + { PIXMAN_OP_CONJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x120495a, + PIXMAN_a4r4g4b4, 0x407e, + PIXMAN_a8r8g8b8, 0x54 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x1ff8fff, + PIXMAN_a2r2g2b2, 0x29, + PIXMAN_r5g6b5, 0xa + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x100a31a, + PIXMAN_a4r4g4b4, 0xde4c, + PIXMAN_a4r4g4b4, 0x1 + }, + { PIXMAN_OP_CONJOINT_OUT, + PIXMAN_a8r8g8b8, 0x1d4008c, + PIXMAN_r3g3b2, 0x79, + PIXMAN_a8r8g8b8, 0x1000000 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x1ff0000, + PIXMAN_a4r4g4b4, 0x7de4, + PIXMAN_r5g6b5, 0x0 + }, + { PIXMAN_OP_DISJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x1b27e62, + PIXMAN_a4r4g4b4, 0x7941, + PIXMAN_r3g3b2, 0x0 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x300ff00, + PIXMAN_a8r8g8b8, 0xfcff255e, + PIXMAN_r3g3b2, 0x4 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x2ff00b8, + PIXMAN_a8r8g8b8, 0x19ff718d, + PIXMAN_r5g6b5, 0x1802 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x235ff13, + PIXMAN_a8r8g8b8, 0x34bcd9ff, + PIXMAN_r3g3b2, 0x4 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x1006400, + PIXMAN_a4r4g4b4, 0x7000, + PIXMAN_a4r4g4b4, 0x20 + }, + { PIXMAN_OP_CONJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x1ff8bff, + PIXMAN_a4r4g4b4, 0xfff4, + PIXMAN_a4r4g4b4, 0xf80 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x24630ff, + PIXMAN_a8r8g8b8, 0x1f00000b, + PIXMAN_a8r8g8b8, 0x9061f + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x1ff8a00, + PIXMAN_a8r8g8b8, 0x79ffab00, + PIXMAN_r5g6b5, 0x7a00 + }, + { PIXMAN_OP_DISJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x19807ff, + PIXMAN_a4r4g4b4, 0x6794, + PIXMAN_a8r8g8b8, 0xff002e00 + }, + { PIXMAN_OP_CONJOINT_OUT, + PIXMAN_a8r8g8b8, 0x10000da, + PIXMAN_a4r4g4b4, 0xf864, + PIXMAN_a8r8g8b8, 0x1000000 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x1ffffde, + PIXMAN_a2r2g2b2, 0x94, + PIXMAN_a8r8g8b8, 0x1000000 + }, + { PIXMAN_OP_CONJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x200c800, + PIXMAN_r5g6b5, 0xe9d4, + PIXMAN_a8r8g8b8, 0x2c00 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x1ff00c9, + PIXMAN_r3g3b2, 0x4c, + PIXMAN_r5g6b5, 0x4800 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x122d5ff, + PIXMAN_r5g6b5, 0x418b, + PIXMAN_a4r4g4b4, 0x25 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x1ffff55, + PIXMAN_a2r2g2b2, 0x1c, + PIXMAN_a8r8g8b8, 0xff00 + }, + { PIXMAN_OP_DISJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x135ffff, + PIXMAN_r5g6b5, 0x39c4, + PIXMAN_r5g6b5, 0xb7 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x100d2c3, + PIXMAN_r3g3b2, 0x2a, + PIXMAN_a8r8g8b8, 0x3c00 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x17268ff, + PIXMAN_a8r8g8b8, 0x7c00ffff, + PIXMAN_r5g6b5, 0x318f + }, + { PIXMAN_OP_DISJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x1ff00ff, + PIXMAN_r3g3b2, 0x68, + PIXMAN_r3g3b2, 0xb4 + }, + { PIXMAN_OP_CONJOINT_OUT, + PIXMAN_a8r8g8b8, 0x200ffff, + PIXMAN_r5g6b5, 0xff86, + PIXMAN_a8r8g8b8, 0x200f300 + }, + { PIXMAN_OP_CONJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x18a23ff, + PIXMAN_a2r2g2b2, 0x44, + PIXMAN_a4r4g4b4, 0x205 + }, + { PIXMAN_OP_DISJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x16bff23, + PIXMAN_a8r8g8b8, 0x31fd00ff, + PIXMAN_r3g3b2, 0x7 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x137d1ff, + PIXMAN_a4r4g4b4, 0x56c1, + PIXMAN_r5g6b5, 0x0 + }, + { PIXMAN_OP_CONJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x1ff5bff, + PIXMAN_a4r4g4b4, 0xfff4, + PIXMAN_a4r4g4b4, 0xf50 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x15c6b00, + PIXMAN_a8r8g8b8, 0x7d008a, + PIXMAN_a4r4g4b4, 0x200 + }, + { PIXMAN_OP_CONJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x12091ff, + PIXMAN_a8r8g8b8, 0xb74cff6b, + PIXMAN_a2r2g2b2, 0x8 + }, + { PIXMAN_OP_CONJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x1ff5bff, + PIXMAN_a8r8g8b8, 0xff6ddce8, + PIXMAN_a2r2g2b2, 0x10 + }, + { PIXMAN_OP_CONJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x100ffff, + PIXMAN_a4r4g4b4, 0xffb7, + PIXMAN_a4r4g4b4, 0xb0 + }, + { PIXMAN_OP_CONJOINT_IN, + PIXMAN_a8r8g8b8, 0x173ffff, + PIXMAN_r5g6b5, 0xff2c, + PIXMAN_a4r4g4b4, 0x6 + }, + { PIXMAN_OP_CONJOINT_IN, + PIXMAN_a8r8g8b8, 0x17102ff, + PIXMAN_a8r8g8b8, 0x955bff66, + PIXMAN_a8r8g8b8, 0x280066 + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x3c7ff24, + PIXMAN_r5g6b5, 0xc4, + PIXMAN_r5g6b5, 0x163 + }, + { PIXMAN_OP_CONJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x100c2a6, + PIXMAN_r5g6b5, 0xa9b9, + PIXMAN_a4r4g4b4, 0x8 + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x26049ff, + PIXMAN_a4r4g4b4, 0xb2, + PIXMAN_r5g6b5, 0x8904 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x2f100ff, + PIXMAN_r3g3b2, 0x30, + PIXMAN_a8r8g8b8, 0x2220100 + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x1ffff88, + PIXMAN_r3g3b2, 0x7e, + PIXMAN_r3g3b2, 0x60 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x153ffab, + PIXMAN_a8r8g8b8, 0xfd10725a, + PIXMAN_r3g3b2, 0x0 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x1ff00d2, + PIXMAN_r5g6b5, 0xff6b, + PIXMAN_a8r8g8b8, 0x101014a + }, + { PIXMAN_OP_DISJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x100d965, + PIXMAN_a8r8g8b8, 0xff007b00, + PIXMAN_r3g3b2, 0xc + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x1ec0000, + PIXMAN_r5g6b5, 0x6fff, + PIXMAN_r5g6b5, 0x6000 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x19d59a2, + PIXMAN_a8r8g8b8, 0x4a00ff7a, + PIXMAN_a8r8g8b8, 0x2e1a2f + }, + { PIXMAN_OP_DISJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x1eb0000, + PIXMAN_a4r4g4b4, 0x72bc, + PIXMAN_r5g6b5, 0x1800 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x100ffff, + PIXMAN_a4r4g4b4, 0xc034, + PIXMAN_a4r4g4b4, 0x0 + }, + { PIXMAN_OP_SATURATE, + PIXMAN_a8r8g8b8, 0x195ff15, + PIXMAN_a4r4g4b4, 0xb7b1, + PIXMAN_r5g6b5, 0x4000 + }, + { PIXMAN_OP_DISJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x1ffdf94, + PIXMAN_a4r4g4b4, 0x78, + PIXMAN_r3g3b2, 0xc + }, + { PIXMAN_OP_DISJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x26f00ff, + PIXMAN_a4r4g4b4, 0xff93, + PIXMAN_r5g6b5, 0x1dd2 + }, + { PIXMAN_OP_CONJOINT_IN, + PIXMAN_a8r8g8b8, 0x2ff3fc5, + PIXMAN_r3g3b2, 0x2f, + PIXMAN_a8r8g8b8, 0x240000 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x1ff696e, + PIXMAN_a4r4g4b4, 0x22ff, + PIXMAN_r5g6b5, 0x34d + }, + { PIXMAN_OP_CONJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x10033d9, + PIXMAN_a8r8g8b8, 0x38650000, + PIXMAN_a8r8g8b8, 0x0 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x2ffff00, + PIXMAN_a4r4g4b4, 0x2070, + PIXMAN_r5g6b5, 0x2100 + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x1008746, + PIXMAN_a8r8g8b8, 0xb56971, + PIXMAN_r5g6b5, 0xc25c + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x144d200, + PIXMAN_a4r4g4b4, 0xff42, + PIXMAN_r3g3b2, 0x4 + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x1ffffd0, + PIXMAN_r5g6b5, 0x5b00, + PIXMAN_r3g3b2, 0x4c + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x10000ff, + PIXMAN_a8r8g8b8, 0xff006f, + PIXMAN_r5g6b5, 0xd + }, + { PIXMAN_OP_DISJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x10666ff, + PIXMAN_a4r4g4b4, 0x39b2, + PIXMAN_r5g6b5, 0xa6 + }, + { PIXMAN_OP_CONJOINT_OUT, + PIXMAN_a8r8g8b8, 0x11a007d, + PIXMAN_r3g3b2, 0xf9, + PIXMAN_a8r8g8b8, 0x11a0000 + }, + { PIXMAN_OP_CONJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x1eb90ee, + PIXMAN_r5g6b5, 0xd, + PIXMAN_a2r2g2b2, 0x1 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x1ff42d5, + PIXMAN_a4r4g4b4, 0x3400, + PIXMAN_r3g3b2, 0x40 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x1dfff00, + PIXMAN_a8r8g8b8, 0x3ffff9d2, + PIXMAN_r5g6b5, 0x0 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x1ff6500, + PIXMAN_a2r2g2b2, 0x56, + PIXMAN_r3g3b2, 0x44 + }, + { PIXMAN_OP_DISJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x119ffe6, + PIXMAN_r3g3b2, 0x8d, + PIXMAN_a4r4g4b4, 0xff00 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x100cd00, + PIXMAN_r5g6b5, 0x33ff, + PIXMAN_a4r4g4b4, 0x0 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x569ffd7, + PIXMAN_r5g6b5, 0x8cc, + PIXMAN_r5g6b5, 0xc0 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x100876a, + PIXMAN_a8r8g8b8, 0x575447a5, + PIXMAN_r5g6b5, 0x164 + }, + { PIXMAN_OP_CONJOINT_OUT, + PIXMAN_a8r8g8b8, 0x12d00ff, + PIXMAN_a4r4g4b4, 0x3fff, + PIXMAN_a4r4g4b4, 0x0 + }, + { PIXMAN_OP_DISJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x2ff953b, + PIXMAN_a4r4g4b4, 0x2914, + PIXMAN_r5g6b5, 0x20a1 + }, + { PIXMAN_OP_DISJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x1ffead4, + PIXMAN_a8r8g8b8, 0xff00ea4e, + PIXMAN_r3g3b2, 0x5a + }, + { PIXMAN_OP_DISJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x1ff6400, + PIXMAN_a2r2g2b2, 0x99, + PIXMAN_r5g6b5, 0xa620 + }, + { PIXMAN_OP_CONJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x17b0084, + PIXMAN_r3g3b2, 0xbd, + PIXMAN_a4r4g4b4, 0x500 + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x4f90bbb, + PIXMAN_a8r8g8b8, 0xff00d21f, + PIXMAN_a8r8g8b8, 0xfb00fc4a + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x1ffbb1d, + PIXMAN_a8r8g8b8, 0x2dff79ff, + PIXMAN_r5g6b5, 0x2c0 + }, + { PIXMAN_OP_CONJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x100ffff, + PIXMAN_a2r2g2b2, 0x43, + PIXMAN_a4r4g4b4, 0x6f + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x1f000ff, + PIXMAN_a4r4g4b4, 0xb393, + PIXMAN_r3g3b2, 0x20 + }, + { PIXMAN_OP_CONJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x1c60020, + PIXMAN_a8r8g8b8, 0x6bffffff, + PIXMAN_a8r8g8b8, 0x0 + }, + { PIXMAN_OP_CONJOINT_OUT, + PIXMAN_a8r8g8b8, 0x1727d00, + PIXMAN_a2r2g2b2, 0x67, + PIXMAN_a4r4g4b4, 0x400 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x14a5194, + PIXMAN_a4r4g4b4, 0xd7ff, + PIXMAN_r5g6b5, 0x2000 + }, + { PIXMAN_OP_DISJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x20003fa, + PIXMAN_a4r4g4b4, 0x24ff, + PIXMAN_a8r8g8b8, 0xffff1550 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x1a6ff83, + PIXMAN_a4r4g4b4, 0xf400, + PIXMAN_r5g6b5, 0x2800 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x2ffcf00, + PIXMAN_r5g6b5, 0x71ff, + PIXMAN_a4r4g4b4, 0x30 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x333ffff, + PIXMAN_a4r4g4b4, 0x2c00, + PIXMAN_r3g3b2, 0x4 + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x1c2ffe8, + PIXMAN_r5g6b5, 0xc200, + PIXMAN_a8r8g8b8, 0xfeca41ff + }, + { PIXMAN_OP_CONJOINT_ATOP, + PIXMAN_a2r2g2b2, 0x47, + PIXMAN_a8r8g8b8, 0x2ffff00, + PIXMAN_a8r8g8b8, 0x3aa0102 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x1ffeb00, + PIXMAN_a4r4g4b4, 0xb493, + PIXMAN_a4r4g4b4, 0x400 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x2afffff, + PIXMAN_r5g6b5, 0xcb, + PIXMAN_r5g6b5, 0xc0 + }, + { PIXMAN_OP_SATURATE, + PIXMAN_a8r8g8b8, 0x183ff00, + PIXMAN_r3g3b2, 0x87, + PIXMAN_r5g6b5, 0xae91 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x3ffff00, + PIXMAN_a4r4g4b4, 0x2ba4, + PIXMAN_r5g6b5, 0x2100 + }, + { PIXMAN_OP_CONJOINT_OUT, + PIXMAN_a8r8g8b8, 0x215cbc2, + PIXMAN_a4r4g4b4, 0xafd3, + PIXMAN_a8r8g8b8, 0x115b000 + }, + { PIXMAN_OP_SATURATE, + PIXMAN_a8r8g8b8, 0x1853f65, + PIXMAN_a8r8g8b8, 0xc68cdc41, + PIXMAN_r5g6b5, 0x3 + }, + { PIXMAN_OP_CONJOINT_IN, + PIXMAN_a8r8g8b8, 0x3ffff8f, + PIXMAN_a4r4g4b4, 0x8824, + PIXMAN_a4r4g4b4, 0x20 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x28e08e6, + PIXMAN_a8r8g8b8, 0x2cffff31, + PIXMAN_r5g6b5, 0x1805 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x1b500be, + PIXMAN_r5g6b5, 0xd946, + PIXMAN_r5g6b5, 0x9800 + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x133ffb3, + PIXMAN_a2r2g2b2, 0x42, + PIXMAN_a8r8g8b8, 0x11553c + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x21aff81, + PIXMAN_r3g3b2, 0xc7, + PIXMAN_r5g6b5, 0x120 + }, + { PIXMAN_OP_CONJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x12e004f, + PIXMAN_a4r4g4b4, 0xf617, + PIXMAN_a4r4g4b4, 0x102 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x164861f, + PIXMAN_r3g3b2, 0x4e, + PIXMAN_r5g6b5, 0x19c0 + }, + { PIXMAN_OP_DISJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x1ff0eff, + PIXMAN_a8r8g8b8, 0xff5c00aa, + PIXMAN_r5g6b5, 0x5800 + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x1e4c60f, + PIXMAN_a8r8g8b8, 0x38ff0e0c, + PIXMAN_a4r4g4b4, 0xff2a + }, + { PIXMAN_OP_DISJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x1ff0000, + PIXMAN_a8r8g8b8, 0x9f3d6700, + PIXMAN_r5g6b5, 0xf3ff + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x205ffd0, + PIXMAN_a8r8g8b8, 0xffc22b3b, + PIXMAN_a8r8g8b8, 0x2040000 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x1ff0059, + PIXMAN_r5g6b5, 0x74ff, + PIXMAN_a8r8g8b8, 0x1730101 + }, + { PIXMAN_OP_CONJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x29affb8, + PIXMAN_r5g6b5, 0xff, + PIXMAN_a8r8g8b8, 0x2d25cff + }, + { PIXMAN_OP_DISJOINT_OUT, + PIXMAN_a8r8g8b8, 0x1ffff8b, + PIXMAN_a4r4g4b4, 0xff7b, + PIXMAN_r5g6b5, 0x3a0 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x2a86ad7, + PIXMAN_a4r4g4b4, 0xdc22, + PIXMAN_a8r8g8b8, 0x2860000 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x3ff00ff, + PIXMAN_r3g3b2, 0x33, + PIXMAN_r5g6b5, 0x2000 + }, + { PIXMAN_OP_SATURATE, + PIXMAN_a8r8g8b8, 0x1e50063, + PIXMAN_a8r8g8b8, 0x35ff95d7, + PIXMAN_r3g3b2, 0x20 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x2ffe6ff, + PIXMAN_a8r8g8b8, 0x153ef297, + PIXMAN_r5g6b5, 0x6d2 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x34ffeff, + PIXMAN_a4r4g4b4, 0x2e, + PIXMAN_r5g6b5, 0x1d + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x2ffeada, + PIXMAN_r5g6b5, 0xabc6, + PIXMAN_a8r8g8b8, 0xfd15b256 + }, + { PIXMAN_OP_CONJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x100ff00, + PIXMAN_a8r8g8b8, 0xcff3f32, + PIXMAN_a8r8g8b8, 0x3f00 + }, + { PIXMAN_OP_SATURATE, + PIXMAN_a8r8g8b8, 0x1e1b0f1, + PIXMAN_a8r8g8b8, 0xff63ff54, + PIXMAN_r3g3b2, 0x5d + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0x2ffff23, + PIXMAN_a8r8g8b8, 0x380094ff, + PIXMAN_r5g6b5, 0x3a4b + }, + { PIXMAN_OP_CONJOINT_ATOP, + PIXMAN_a4r4g4b4, 0x1000, + PIXMAN_r5g6b5, 0xca, + PIXMAN_a8r8g8b8, 0x3434500 + }, + { PIXMAN_OP_DISJOINT_IN, + PIXMAN_a8r8g8b8, 0x195ffe5, + PIXMAN_a4r4g4b4, 0x3a29, + PIXMAN_a8r8g8b8, 0x0 + }, + { PIXMAN_OP_DISJOINT_ATOP, + PIXMAN_a8r8g8b8, 0x139007a, + PIXMAN_a4r4g4b4, 0x4979, + PIXMAN_r5g6b5, 0x84 + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a2r2g2b2, 0xa9, + PIXMAN_a4r4g4b4, 0xfa18, + PIXMAN_a8r8g8b8, 0xabff67ff + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a2r2g2b2, 0x94, + PIXMAN_a4r4g4b4, 0x5109, + PIXMAN_a8r8g8b8, 0x3affffff + }, + { PIXMAN_OP_COLOR_BURN, + PIXMAN_r5g6b5, 0xd038, + PIXMAN_r5g6b5, 0xff00, + PIXMAN_r5g6b5, 0xf9a5 + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a8r8g8b8, 0x543128ff, + PIXMAN_a8r8g8b8, 0x7029ff, + PIXMAN_a8r8g8b8, 0x316b1d7 + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_r5g6b5, 0x53ff, + PIXMAN_r5g6b5, 0x72ff, + PIXMAN_a8r8g8b8, 0xffffdeff + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a8r8g8b8, 0x5b00002b, + PIXMAN_a4r4g4b4, 0xc3, + PIXMAN_a8r8g8b8, 0x23530be + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a8r8g8b8, 0xcefc0041, + PIXMAN_a8r8g8b8, 0xf60d02, + PIXMAN_a8r8g8b8, 0x1f2ffe5 + }, + { PIXMAN_OP_COLOR_DODGE, + PIXMAN_r5g6b5, 0xffdb, + PIXMAN_r5g6b5, 0xc700, + PIXMAN_r5g6b5, 0x654 + }, + { PIXMAN_OP_COLOR_DODGE, + PIXMAN_r5g6b5, 0xffc6, + PIXMAN_r5g6b5, 0xff09, + PIXMAN_r5g6b5, 0xfe58 + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a2r2g2b2, 0x95, + PIXMAN_r5g6b5, 0x1b4a, + PIXMAN_a8r8g8b8, 0xab234cff + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a2r2g2b2, 0x95, + PIXMAN_a4r4g4b4, 0x5e99, + PIXMAN_a8r8g8b8, 0x3b1c1cdd + }, + { PIXMAN_OP_COLOR_BURN, + PIXMAN_r5g6b5, 0x22, + PIXMAN_r5g6b5, 0xd00, + PIXMAN_r5g6b5, 0xfbb1 + }, + { PIXMAN_OP_COLOR_DODGE, + PIXMAN_r5g6b5, 0xffc8, + PIXMAN_a8r8g8b8, 0xa1a3ffff, + PIXMAN_r5g6b5, 0x44a + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a8r8g8b8, 0xffff7cff, + PIXMAN_r5g6b5, 0x900, + PIXMAN_a8r8g8b8, 0xffff94ec + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a2r2g2b2, 0xa7, + PIXMAN_r5g6b5, 0xff, + PIXMAN_a8r8g8b8, 0xaa00cffe + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a2r2g2b2, 0x85, + PIXMAN_r5g6b5, 0xffb3, + PIXMAN_a8r8g8b8, 0xaaffff4a + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a8r8g8b8, 0x3500a118, + PIXMAN_a4r4g4b4, 0x9942, + PIXMAN_a8r8g8b8, 0x01ff405e + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a2r2g2b2, 0xb5, + PIXMAN_x4a4, 0xe, + PIXMAN_a8r8g8b8, 0xffbaff + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a4r4g4b4, 0xe872, + PIXMAN_x2r10g10b10, 0xa648ff00, + PIXMAN_a2r10g10b10, 0x14ff00e8, + }, + { PIXMAN_OP_SATURATE, + PIXMAN_a8r8g8b8, 0x4d2db34, + PIXMAN_a8, 0x19, + PIXMAN_r5g6b5, 0x9700, + }, + { PIXMAN_OP_SATURATE, + PIXMAN_a8r8g8b8, 0x2ff0076, + PIXMAN_a8r8g8b8, 0x2a0000, + PIXMAN_r3g3b2, 0x0, + }, + { PIXMAN_OP_CONJOINT_OVER_REVERSE, + PIXMAN_a8r8g8b8, 0x14f00ff, + PIXMAN_r5g6b5, 0xd48, + PIXMAN_a4r4g4b4, 0x0, + }, + { PIXMAN_OP_CONJOINT_OUT, + PIXMAN_a8r8g8b8, 0x3d8bbff, + PIXMAN_r5g6b5, 0x6900, + PIXMAN_a8r8g8b8, 0x0, + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x2ff00ff, + PIXMAN_a4r4g4b4, 0x2300, + PIXMAN_r3g3b2, 0x0, + }, + { PIXMAN_OP_SATURATE, + PIXMAN_a8r8g8b8, 0x4d2db34, + PIXMAN_a8r8g8b8, 0xff0019ff, + PIXMAN_r5g6b5, 0x9700, + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0x100ac05, + PIXMAN_r3g3b2, 0xef, + PIXMAN_a2r2g2b2, 0xff, + }, + { PIXMAN_OP_EXCLUSION, + PIXMAN_a2r2g2b2, 0xbf, + PIXMAN_null, 0x00, + PIXMAN_r5g6b5, 0x7e + }, + { PIXMAN_OP_DIFFERENCE, + PIXMAN_r5g6b5, 0xffff, + PIXMAN_null, 0x00, + PIXMAN_a2r2g2b2, 0x33 + }, + { PIXMAN_OP_HARD_LIGHT, + PIXMAN_a8r8g8b8, 0x84c4ffd7, + PIXMAN_null, 0x00, + PIXMAN_a8r8g8b8, 0xffddff + }, + { PIXMAN_OP_EXCLUSION, + PIXMAN_a8r8g8b8, 0xff6e56, + PIXMAN_null, 0x00, + PIXMAN_a8r8g8b8, 0x20ff1ade + }, + { PIXMAN_OP_OVERLAY, + PIXMAN_a4r4g4b4, 0xfe0, + PIXMAN_null, 0x00, + PIXMAN_a4r4g4b4, 0xbdff + }, + { PIXMAN_OP_SCREEN, + PIXMAN_a8r8g8b8, 0x9671ff, + PIXMAN_null, 0x00, + PIXMAN_a2r2g2b2, 0x43 + }, + { PIXMAN_OP_EXCLUSION, + PIXMAN_a2r2g2b2, 0xff, + PIXMAN_null, 0x00, + PIXMAN_a4r4g4b4, 0x39ff + }, + { PIXMAN_OP_EXCLUSION, + PIXMAN_r5g6b5, 0xffff, + PIXMAN_null, 0x00, + PIXMAN_a4r4g4b4, 0x1968 + }, + { PIXMAN_OP_EXCLUSION, + PIXMAN_a4r4g4b4, 0x4247, + PIXMAN_null, 0x00, + PIXMAN_a8r8g8b8, 0xd8ffff + }, + { PIXMAN_OP_EXCLUSION, + PIXMAN_r5g6b5, 0xff00, + PIXMAN_null, 0x00, + PIXMAN_a2r2g2b2, 0x79 + }, + { PIXMAN_OP_DIFFERENCE, + PIXMAN_r3g3b2, 0xe0, + PIXMAN_null, 0x00, + PIXMAN_a2r2g2b2, 0x39 + }, + { PIXMAN_OP_EXCLUSION, + PIXMAN_a8r8g8b8, 0xfff8, + PIXMAN_null, 0x00, + PIXMAN_r3g3b2, 0xff + }, + { PIXMAN_OP_COLOR_DODGE, + PIXMAN_r5g6b5, 0x75fc, + PIXMAN_null, 0x00, + PIXMAN_r5g6b5, 0x11ff, + }, + { PIXMAN_OP_COLOR_BURN, + PIXMAN_r3g3b2, 0x52, + PIXMAN_null, 0x00, + PIXMAN_r5g6b5, 0xc627 + }, + { PIXMAN_OP_HARD_LIGHT, + PIXMAN_r5g6b5, 0x9f2b, + PIXMAN_null, 0x00, + PIXMAN_a8r8g8b8, 0x4b00e7f5 + }, + { PIXMAN_OP_OVERLAY, + PIXMAN_a8r8g8b8, 0x00dfff5c, + PIXMAN_null, 0x00, + PIXMAN_r5g6b5, 0x5e0f, + }, + { PIXMAN_OP_COLOR_BURN, + PIXMAN_a8r8g8b8, 0xff00121b, + PIXMAN_null, 0x00, + PIXMAN_r5g6b5, 0x3776 + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_r5g6b5, 0x03e0, + PIXMAN_null, 0x00, + PIXMAN_a8r8g8b8, 0x01003c00, + }, + { PIXMAN_OP_OVER, + PIXMAN_a8r8g8b8, 0x0f00c300, + PIXMAN_null, 0x00, + PIXMAN_x14r6g6b6, 0x003c0, + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a4r4g4b4, 0xd0c0, + PIXMAN_null, 0x00, + PIXMAN_a8r8g8b8, 0x5300ea00, + }, + { PIXMAN_OP_OVER, + PIXMAN_a8r8g8b8, 0x20c6bf00, + PIXMAN_null, 0x00, + PIXMAN_r5g6b5, 0xb9ff + }, + { PIXMAN_OP_OVER, + PIXMAN_a8r8g8b8, 0x204ac7ff, + PIXMAN_null, 0x00, + PIXMAN_r5g6b5, 0xc1ff + }, + { PIXMAN_OP_OVER_REVERSE, + PIXMAN_r5g6b5, 0xffc3, + PIXMAN_null, 0x00, + PIXMAN_a8r8g8b8, 0x102d00dd + }, + { PIXMAN_OP_OVER_REVERSE, + PIXMAN_r5g6b5, 0x1f00, + PIXMAN_null, 0x00, + PIXMAN_a8r8g8b8, 0x1bdf0c89 + }, + { PIXMAN_OP_OVER_REVERSE, + PIXMAN_r5g6b5, 0xf9d2, + PIXMAN_null, 0x00, + PIXMAN_a8r8g8b8, 0x1076bcf7 + }, + { PIXMAN_OP_OVER_REVERSE, + PIXMAN_r5g6b5, 0x00c3, + PIXMAN_null, 0x00, + PIXMAN_a8r8g8b8, 0x1bfe9ae5 + }, + { PIXMAN_OP_OVER_REVERSE, + PIXMAN_r5g6b5, 0x09ff, + PIXMAN_null, 0x00, + PIXMAN_a8r8g8b8, 0x0b00c16c + }, + { PIXMAN_OP_DISJOINT_ATOP, + PIXMAN_a2r2g2b2, 0xbc, + PIXMAN_null, 0x00, + PIXMAN_a8r8g8b8, 0x9efff1ff + }, + { PIXMAN_OP_DISJOINT_ATOP, + PIXMAN_a4r4g4b4, 0xae5f, + PIXMAN_null, 0x00, + PIXMAN_a8r8g8b8, 0xf215b675 + }, + { PIXMAN_OP_DISJOINT_ATOP_REVERSE, + PIXMAN_a8r8g8b8, 0xce007980, + PIXMAN_null, 0x00, + PIXMAN_a8r8g8b8, 0x80ffe4ad + }, + { PIXMAN_OP_DISJOINT_XOR, + PIXMAN_a8r8g8b8, 0xb8b07bea, + PIXMAN_null, 0x00, + PIXMAN_a4r4g4b4, 0x939c + }, + { PIXMAN_OP_CONJOINT_ATOP_REVERSE, + PIXMAN_r5g6b5, 0x0063, + PIXMAN_null, 0x00, + PIXMAN_a8r8g8b8, 0x10bb1ed7, + }, + { PIXMAN_OP_EXCLUSION, + PIXMAN_a2r2g2b2, 0xbf, + PIXMAN_null, 0x00, + PIXMAN_r5g6b5, 0x7e + }, + { PIXMAN_OP_LIGHTEN, + PIXMAN_a8r8g8b8, 0xffffff, + PIXMAN_null, 0x00, + PIXMAN_a8r8g8b8, 0xff3fffff + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_r3g3b2, 0x38, + PIXMAN_null, 0x00, + PIXMAN_a2r2g2b2, 0x5b + }, + { PIXMAN_OP_COLOR_DODGE, + PIXMAN_a8r8g8b8, 0x2e9effff, + PIXMAN_null, 0x00, + PIXMAN_a2r2g2b2, 0x77 + }, + { PIXMAN_OP_DIFFERENCE, + PIXMAN_r5g6b5, 0xffff, + PIXMAN_null, 0x00, + PIXMAN_a2r2g2b2, 0x33 + }, + { PIXMAN_OP_OVERLAY, + PIXMAN_a8r8g8b8, 0xd0089ff, + PIXMAN_null, 0x00, + PIXMAN_r3g3b2, 0xb1 + }, + { PIXMAN_OP_OVERLAY, + PIXMAN_r3g3b2, 0x8a, + PIXMAN_null, 0x00, + PIXMAN_a8r8g8b8, 0xcd0004 + }, + { PIXMAN_OP_COLOR_BURN, + PIXMAN_a8r8g8b8, 0xffff1e3a, + PIXMAN_null, 0x00, + PIXMAN_a4r4g4b4, 0xcf00 + }, + { PIXMAN_OP_HARD_LIGHT, + PIXMAN_a8r8g8b8, 0x84c4ffd7, + PIXMAN_null, 0x00, + PIXMAN_a8r8g8b8, 0xffddff + }, + { PIXMAN_OP_DIFFERENCE, + PIXMAN_a4r4g4b4, 0xfd75, + PIXMAN_null, 0x00, + PIXMAN_a2r2g2b2, 0x7f + }, + { PIXMAN_OP_LIGHTEN, + PIXMAN_r3g3b2, 0xff, + PIXMAN_null, 0x00, + PIXMAN_a4r4g4b4, 0x63ff + }, + { PIXMAN_OP_EXCLUSION, + PIXMAN_a8r8g8b8, 0xff6e56, + PIXMAN_null, 0x00, + PIXMAN_a8r8g8b8, 0x20ff1ade + }, + { PIXMAN_OP_OVERLAY, + PIXMAN_a4r4g4b4, 0xfe0, + PIXMAN_null, 0x00, + PIXMAN_a4r4g4b4, 0xbdff + }, + { PIXMAN_OP_OVERLAY, + PIXMAN_r5g6b5, 0x9799, + PIXMAN_null, 0x00, + PIXMAN_a4r4g4b4, 0x8d + }, + { PIXMAN_OP_HARD_LIGHT, + PIXMAN_a8r8g8b8, 0xe8ff1c33, + PIXMAN_null, 0x00, + PIXMAN_r5g6b5, 0x6200 + }, + { PIXMAN_OP_DIFFERENCE, + PIXMAN_a8r8g8b8, 0x22ffffff, + PIXMAN_null, 0x00, + PIXMAN_a2r2g2b2, 0x63 + }, + { PIXMAN_OP_SCREEN, + PIXMAN_a8r8g8b8, 0x9671ff, + PIXMAN_null, 0x00, + PIXMAN_a2r2g2b2, 0x43 + }, + { PIXMAN_OP_LIGHTEN, + PIXMAN_a2r2g2b2, 0x83, + PIXMAN_null, 0x00, + PIXMAN_r5g6b5, 0xff + }, + { PIXMAN_OP_OVERLAY, + PIXMAN_r3g3b2, 0x0, + PIXMAN_null, 0x00, + PIXMAN_a2r2g2b2, 0x97 + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_r5g6b5, 0xb900, + PIXMAN_null, 0x00, + PIXMAN_a8r8g8b8, 0x6800ff00 + }, + { PIXMAN_OP_OVERLAY, + PIXMAN_a4r4g4b4, 0xff, + PIXMAN_null, 0x00, + PIXMAN_r3g3b2, 0x8e + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a4r4g4b4, 0xff00, + PIXMAN_null, 0x00, + PIXMAN_a2r2g2b2, 0xbc + }, + { PIXMAN_OP_DIFFERENCE, + PIXMAN_r5g6b5, 0xfffe, + PIXMAN_null, 0x00, + PIXMAN_a4r4g4b4, 0x90 + }, + { PIXMAN_OP_LIGHTEN, + PIXMAN_r3g3b2, 0xff, + PIXMAN_null, 0x00, + PIXMAN_a8r8g8b8, 0xc35f + }, + { PIXMAN_OP_EXCLUSION, + PIXMAN_a2r2g2b2, 0xff, + PIXMAN_null, 0x00, + PIXMAN_a4r4g4b4, 0x39ff + }, + { PIXMAN_OP_LIGHTEN, + PIXMAN_a2r2g2b2, 0x1e, + PIXMAN_null, 0x00, + PIXMAN_a4r4g4b4, 0xbaff + }, + { PIXMAN_OP_LIGHTEN, + PIXMAN_a8r8g8b8, 0xb4ffff26, + PIXMAN_null, 0x00, + PIXMAN_r5g6b5, 0xff + }, + { PIXMAN_OP_COLOR_DODGE, + PIXMAN_a4r4g4b4, 0xe3ff, + PIXMAN_null, 0x00, + PIXMAN_a4r4g4b4, 0x878b + }, + { PIXMAN_OP_OVERLAY, + PIXMAN_a8r8g8b8, 0xff700044, + PIXMAN_null, 0x00, + PIXMAN_a2r2g2b2, 0x6 + }, + { PIXMAN_OP_DARKEN, + PIXMAN_a2r2g2b2, 0xb6, + PIXMAN_null, 0x00, + PIXMAN_a4r4g4b4, 0xcd00 + }, + { PIXMAN_OP_HARD_LIGHT, + PIXMAN_a2r2g2b2, 0xfe, + PIXMAN_null, 0x00, + PIXMAN_a2r2g2b2, 0x12 + }, + { PIXMAN_OP_LIGHTEN, + PIXMAN_a8r8g8b8, 0xb1ff006c, + PIXMAN_null, 0x00, + PIXMAN_a4r4g4b4, 0xff7c + }, + { PIXMAN_OP_HARD_LIGHT, + PIXMAN_r3g3b2, 0x4e, + PIXMAN_null, 0x00, + PIXMAN_a2r2g2b2, 0x3c + }, + { PIXMAN_OP_EXCLUSION, + PIXMAN_r5g6b5, 0xffff, + PIXMAN_null, 0x00, + PIXMAN_a4r4g4b4, 0x1968 + }, + { PIXMAN_OP_COLOR_BURN, + PIXMAN_r3g3b2, 0xe7, + PIXMAN_null, 0x00, + PIXMAN_a8r8g8b8, 0x8cced6ac + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a4r4g4b4, 0xa500, + PIXMAN_null, 0x00, + PIXMAN_a8r8g8b8, 0x1bff009d + }, + { PIXMAN_OP_DIFFERENCE, + PIXMAN_r5g6b5, 0x45ff, + PIXMAN_null, 0x00, + PIXMAN_a2r2g2b2, 0x32 + }, + { PIXMAN_OP_OVERLAY, + PIXMAN_a2r2g2b2, 0x18, + PIXMAN_null, 0x00, + PIXMAN_r5g6b5, 0xdc00 + }, + { PIXMAN_OP_EXCLUSION, + PIXMAN_a4r4g4b4, 0x4247, + PIXMAN_null, 0x00, + PIXMAN_a8r8g8b8, 0xd8ffff + }, + { PIXMAN_OP_EXCLUSION, + PIXMAN_r5g6b5, 0xff00, + PIXMAN_null, 0x00, + PIXMAN_a2r2g2b2, 0x79 + }, + { PIXMAN_OP_COLOR_BURN, + PIXMAN_r3g3b2, 0xf, + PIXMAN_null, 0x00, + PIXMAN_a8r8g8b8, 0x9fff00ff + }, + { PIXMAN_OP_EXCLUSION, + PIXMAN_a2r2g2b2, 0x93, + PIXMAN_null, 0x00, + PIXMAN_a4r4g4b4, 0xff + }, + { PIXMAN_OP_LIGHTEN, + PIXMAN_a2r2g2b2, 0xa3, + PIXMAN_null, 0x00, + PIXMAN_r3g3b2, 0xca + }, + { PIXMAN_OP_DIFFERENCE, + PIXMAN_r3g3b2, 0xe0, + PIXMAN_null, 0x00, + PIXMAN_a2r2g2b2, 0x39 + }, + { PIXMAN_OP_HARD_LIGHT, + PIXMAN_r3g3b2, 0x16, + PIXMAN_null, 0x00, + PIXMAN_a8r8g8b8, 0x98ffff + }, + { PIXMAN_OP_LIGHTEN, + PIXMAN_r3g3b2, 0x96, + PIXMAN_null, 0x00, + PIXMAN_a8r8g8b8, 0x225f6c + }, + { PIXMAN_OP_HARD_LIGHT, + PIXMAN_a4r4g4b4, 0x12c7, + PIXMAN_null, 0x00, + PIXMAN_a4r4g4b4, 0xb100 + }, + { PIXMAN_OP_LIGHTEN, + PIXMAN_a8r8g8b8, 0xffda91, + PIXMAN_null, 0x00, + PIXMAN_r3g3b2, 0x6a + }, + { PIXMAN_OP_EXCLUSION, + PIXMAN_a8r8g8b8, 0xfff8, + PIXMAN_null, 0x00, + PIXMAN_r3g3b2, 0xff + }, + { PIXMAN_OP_SOFT_LIGHT, + PIXMAN_a2r2g2b2, 0xff, + PIXMAN_null, 0x00, + PIXMAN_a8r8g8b8, 0xf0ff48ca + }, + { PIXMAN_OP_HARD_LIGHT, + PIXMAN_r5g6b5, 0xf1ff, + PIXMAN_r5g6b5, 0x6eff, + PIXMAN_a8r8g8b8, 0xffffff, + }, + { PIXMAN_OP_HARD_LIGHT, + PIXMAN_r5g6b5, 0xf1ff, + PIXMAN_a8, 0xdf, + PIXMAN_a8r8g8b8, 0xffffff, + }, + { PIXMAN_OP_HARD_LIGHT, + PIXMAN_r5g6b5, 0xf1ff, + PIXMAN_null, 0x00, + PIXMAN_a8r8g8b8, 0xffffff, + }, + { PIXMAN_OP_HARD_LIGHT, + PIXMAN_r5g6b5, 0xb867, + PIXMAN_a4r4g4b4, 0x82d9, + PIXMAN_a8r8g8b8, 0xffc5, + }, + { PIXMAN_OP_HARD_LIGHT, + PIXMAN_r5g6b5, 0xa9f5, + PIXMAN_r5g6b5, 0xadff, + PIXMAN_a8r8g8b8, 0xffff00, + }, + { PIXMAN_OP_HARD_LIGHT, + PIXMAN_r5g6b5, 0x4900, + PIXMAN_r5g6b5, 0x865c, + PIXMAN_a8r8g8b8, 0xebff, + }, + { PIXMAN_OP_HARD_LIGHT, + PIXMAN_r5g6b5, 0xd9ff, + PIXMAN_a8r8g8b8, 0xffffffff, + PIXMAN_a8r8g8b8, 0x8ff0d, + }, + { PIXMAN_OP_HARD_LIGHT, + PIXMAN_r5g6b5, 0x41ff, + PIXMAN_a4r4g4b4, 0xcff, + PIXMAN_a8r8g8b8, 0xe1ff00, + }, + { PIXMAN_OP_HARD_LIGHT, + PIXMAN_r5g6b5, 0x91ff, + PIXMAN_a2r2g2b2, 0xf3, + PIXMAN_a8r8g8b8, 0xe4ffb4, + }, + { PIXMAN_OP_HARD_LIGHT, + PIXMAN_r5g6b5, 0xb9ff, + PIXMAN_a2r2g2b2, 0xff, + PIXMAN_a8r8g8b8, 0xffff, + }, + { PIXMAN_OP_OVERLAY, + PIXMAN_a8r8g8b8, 0x473affff, + PIXMAN_r5g6b5, 0x2b00, + PIXMAN_r5g6b5, 0x1ff, + }, + { PIXMAN_OP_OVERLAY, + PIXMAN_a8r8g8b8, 0xe4ff, + PIXMAN_r3g3b2, 0xff, + PIXMAN_r5g6b5, 0x89ff, + }, +}; + +static void +fill (pixman_image_t *image, uint32_t pixel) +{ + uint8_t *data = (uint8_t *)pixman_image_get_data (image); + int bytes_per_pixel = PIXMAN_FORMAT_BPP (pixman_image_get_format (image)) / 8; + int n_bytes = pixman_image_get_stride (image) * pixman_image_get_height (image); + int i; + + switch (bytes_per_pixel) + { + case 4: + for (i = 0; i < n_bytes / 4; ++i) + ((uint32_t *)data)[i] = pixel; + break; + + case 2: + pixel &= 0xffff; + for (i = 0; i < n_bytes / 2; ++i) + ((uint16_t *)data)[i] = pixel; + break; + + case 1: + pixel &= 0xff; + for (i = 0; i < n_bytes; ++i) + ((uint8_t *)data)[i] = pixel; + break; + + default: + assert (0); + break; + } +} + +static uint32_t +access (pixman_image_t *image, int x, int y) +{ + int bytes_per_pixel; + int stride; + uint32_t result; + uint8_t *location; + + if (x < 0 || x >= image->bits.width || y < 0 || y >= image->bits.height) + return 0; + + bytes_per_pixel = PIXMAN_FORMAT_BPP (image->bits.format) / 8; + stride = image->bits.rowstride * 4; + + location = (uint8_t *)image->bits.bits + y * stride + x * bytes_per_pixel; + + if (bytes_per_pixel == 4) + result = *(uint32_t *)location; + else if (bytes_per_pixel == 2) + result = *(uint16_t *)location; + else if (bytes_per_pixel == 1) + result = *(uint8_t *)location; + else + assert (0); + + return result; +} + +static pixman_bool_t +verify (int test_no, const pixel_combination_t *combination, int size, + pixman_bool_t component_alpha) +{ + pixman_image_t *src, *mask, *dest; + pixel_checker_t src_checker, mask_checker, dest_checker; + color_t source_color, mask_color, dest_color, reference_color; + pixman_bool_t have_mask = (combination->mask_format != PIXMAN_null); + pixman_bool_t result = TRUE; + int i, j; + + /* Compute reference color */ + pixel_checker_init (&src_checker, combination->src_format); + if (have_mask) + pixel_checker_init (&mask_checker, combination->mask_format); + pixel_checker_init (&dest_checker, combination->dest_format); + + pixel_checker_convert_pixel_to_color ( + &src_checker, combination->src_pixel, &source_color); + if (combination->mask_format != PIXMAN_null) + { + pixel_checker_convert_pixel_to_color ( + &mask_checker, combination->mask_pixel, &mask_color); + } + pixel_checker_convert_pixel_to_color ( + &dest_checker, combination->dest_pixel, &dest_color); + + do_composite (combination->op, + &source_color, + have_mask? &mask_color : NULL, + &dest_color, + &reference_color, component_alpha); + + src = pixman_image_create_bits ( + combination->src_format, size, size, NULL, -1); + if (have_mask) + { + mask = pixman_image_create_bits ( + combination->mask_format, size, size, NULL, -1); + + pixman_image_set_component_alpha (mask, component_alpha); + } + dest = pixman_image_create_bits ( + combination->dest_format, size, size, NULL, -1); + + fill (src, combination->src_pixel); + if (have_mask) + fill (mask, combination->mask_pixel); + fill (dest, combination->dest_pixel); + + pixman_image_composite32 ( + combination->op, src, + have_mask ? mask : NULL, + dest, 0, 0, 0, 0, 0, 0, size, size); + + for (j = 0; j < size; ++j) + { + for (i = 0; i < size; ++i) + { + uint32_t computed = access (dest, i, j); + int32_t a, r, g, b; + + if (!pixel_checker_check (&dest_checker, computed, &reference_color)) + { + printf ("----------- Test %d failed ----------\n", test_no); + + printf (" operator: %s (%s)\n", operator_name (combination->op), + have_mask? component_alpha ? "component alpha" : "unified alpha" : "no mask"); + printf (" src format: %s\n", format_name (combination->src_format)); + if (have_mask != PIXMAN_null) + printf (" mask format: %s\n", format_name (combination->mask_format)); + printf (" dest format: %s\n", format_name (combination->dest_format)); + + printf (" - source ARGB: %f %f %f %f (pixel: %8x)\n", + source_color.a, source_color.r, source_color.g, source_color.b, + combination->src_pixel); + pixel_checker_split_pixel (&src_checker, combination->src_pixel, + &a, &r, &g, &b); + printf (" %8d %8d %8d %8d\n", a, r, g, b); + + if (have_mask) + { + printf (" - mask ARGB: %f %f %f %f (pixel: %8x)\n", + mask_color.a, mask_color.r, mask_color.g, mask_color.b, + combination->mask_pixel); + pixel_checker_split_pixel (&mask_checker, combination->mask_pixel, + &a, &r, &g, &b); + printf (" %8d %8d %8d %8d\n", a, r, g, b); + } + + printf (" - dest ARGB: %f %f %f %f (pixel: %8x)\n", + dest_color.a, dest_color.r, dest_color.g, dest_color.b, + combination->dest_pixel); + pixel_checker_split_pixel (&dest_checker, combination->dest_pixel, + &a, &r, &g, &b); + printf (" %8d %8d %8d %8d\n", a, r, g, b); + + pixel_checker_split_pixel (&dest_checker, computed, &a, &r, &g, &b); + printf (" - expected ARGB: %f %f %f %f\n", + reference_color.a, reference_color.r, reference_color.g, reference_color.b); + + pixel_checker_get_min (&dest_checker, &reference_color, &a, &r, &g, &b); + printf (" min acceptable: %8d %8d %8d %8d\n", a, r, g, b); + + pixel_checker_split_pixel (&dest_checker, computed, &a, &r, &g, &b); + printf (" got: %8d %8d %8d %8d (pixel: %8x)\n", a, r, g, b, computed); + + pixel_checker_get_max (&dest_checker, &reference_color, &a, &r, &g, &b); + printf (" max acceptable: %8d %8d %8d %8d\n", a, r, g, b); + + result = FALSE; + goto done; + } + } + } + +done: + pixman_image_unref (src); + pixman_image_unref (dest); + + return result; +} + +int +main (int argc, char **argv) +{ + int result = 0; + int i, j; + int lo, hi; + + if (argc > 1) + { + lo = atoi (argv[1]); + hi = lo + 1; + } + else + { + lo = 0; + hi = ARRAY_LENGTH (regressions); + } + + for (i = lo; i < hi; ++i) + { + const pixel_combination_t *combination = &(regressions[i]); + + for (j = 1; j < 34; ++j) + { + int k, ca; + + ca = combination->mask_format == PIXMAN_null ? 1 : 2; + + for (k = 0; k < ca; ++k) + { + if (!verify (i, combination, j, k)) + { + result = 1; + goto next_regression; + } + } + } + + next_regression: + ; + } + + return result; +} diff --git a/libs/pixman-0.40.0/test/prng-test.c b/libs/pixman-0.40.0/test/prng-test.c new file mode 100644 index 0000000..c1d9320 --- /dev/null +++ b/libs/pixman-0.40.0/test/prng-test.c @@ -0,0 +1,175 @@ +/* + * Copyright © 2012 Siarhei Siamashka <siarhei.siamashka@gmail.com> + * + * Based on the public domain implementation of small noncryptographic PRNG + * authored by Bob Jenkins: http://burtleburtle.net/bob/rand/smallprng.html + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include <assert.h> +#include <stdlib.h> +#include "utils-prng.h" +#include "utils.h" + +/* The original code from http://www.burtleburtle.net/bob/rand/smallprng.html */ + +typedef uint32_t u4; +typedef struct ranctx { u4 a; u4 b; u4 c; u4 d; } ranctx; + +#define rot(x,k) (((x)<<(k))|((x)>>(32-(k)))) +u4 ranval( ranctx *x ) { + u4 e = x->a - rot(x->b, 27); + x->a = x->b ^ rot(x->c, 17); + x->b = x->c + x->d; + x->c = x->d + e; + x->d = e + x->a; + return x->d; +} + +void raninit( ranctx *x, u4 seed ) { + u4 i; + x->a = 0xf1ea5eed, x->b = x->c = x->d = seed; + for (i=0; i<20; ++i) { + (void)ranval(x); + } +} + +/*****************************************************************************/ + +#define BUFSIZE (8 * 1024 * 1024) +#define N 50 + +void bench (void) +{ + double t1, t2; + int i; + prng_t prng; + uint8_t *buf = aligned_malloc (16, BUFSIZE + 1); + + prng_srand_r (&prng, 1234); + t1 = gettime(); + for (i = 0; i < N; i++) + prng_randmemset_r (&prng, buf, BUFSIZE, 0); + t2 = gettime(); + printf ("aligned randmemset : %.2f MB/s\n", + (double)BUFSIZE * N / 1000000. / (t2 - t1)); + + t1 = gettime(); + for (i = 0; i < N; i++) + prng_randmemset_r (&prng, buf + 1, BUFSIZE, 0); + t2 = gettime(); + printf ("unaligned randmemset : %.2f MB/s\n", + (double)BUFSIZE * N / 1000000. / (t2 - t1)); + + t1 = gettime(); + for (i = 0; i < N; i++) + { + prng_randmemset_r (&prng, buf, BUFSIZE, RANDMEMSET_MORE_00_AND_FF); + } + t2 = gettime (); + printf ("aligned randmemset (more 00 and FF) : %.2f MB/s\n", + (double)BUFSIZE * N / 1000000. / (t2 - t1)); + + t1 = gettime(); + for (i = 0; i < N; i++) + { + prng_randmemset_r (&prng, buf + 1, BUFSIZE, RANDMEMSET_MORE_00_AND_FF); + } + t2 = gettime (); + printf ("unaligned randmemset (more 00 and FF) : %.2f MB/s\n", + (double)BUFSIZE * N / 1000000. / (t2 - t1)); + + free (buf); +} + +#define SMALLBUFSIZE 100 + +int main (int argc, char *argv[]) +{ + const uint32_t ref_crc[RANDMEMSET_MORE_00_AND_FF + 1] = + { + 0xBA06763D, 0x103FC550, 0x8B59ABA5, 0xD82A0F39, + 0xD2321099, 0xFD8C5420, 0xD3B7C42A, 0xFC098093, + 0x85E01DE0, 0x6680F8F7, 0x4D32DD3C, 0xAE52382B, + 0x149E6CB5, 0x8B336987, 0x15DCB2B3, 0x8A71B781 + }; + uint32_t crc1, crc2; + uint32_t ref, seed, seed0, seed1, seed2, seed3; + prng_rand_128_data_t buf; + uint8_t *bytebuf = aligned_malloc(16, SMALLBUFSIZE + 1); + ranctx x; + prng_t prng; + prng_randmemset_flags_t flags; + + if (argc > 1 && strcmp(argv[1], "-bench") == 0) + { + bench (); + return 0; + } + + /* basic test */ + raninit (&x, 0); + prng_srand_r (&prng, 0); + assert (ranval (&x) == prng_rand_r (&prng)); + + /* test for simd code */ + seed = 0; + prng_srand_r (&prng, seed); + seed0 = (seed = seed * 1103515245 + 12345); + seed1 = (seed = seed * 1103515245 + 12345); + seed2 = (seed = seed * 1103515245 + 12345); + seed3 = (seed = seed * 1103515245 + 12345); + prng_rand_128_r (&prng, &buf); + + raninit (&x, seed0); + ref = ranval (&x); + assert (ref == buf.w[0]); + + raninit (&x, seed1); + ref = ranval (&x); + assert (ref == buf.w[1]); + + raninit (&x, seed2); + ref = ranval (&x); + assert (ref == buf.w[2]); + + raninit (&x, seed3); + ref = ranval (&x); + assert (ref == buf.w[3]); + + /* test for randmemset */ + for (flags = 0; flags <= RANDMEMSET_MORE_00_AND_FF; flags++) + { + prng_srand_r (&prng, 1234); + prng_randmemset_r (&prng, bytebuf, 16, flags); + prng_randmemset_r (&prng, bytebuf + 16, SMALLBUFSIZE - 17, flags); + crc1 = compute_crc32 (0, bytebuf, SMALLBUFSIZE - 1); + prng_srand_r (&prng, 1234); + prng_randmemset_r (&prng, bytebuf + 1, SMALLBUFSIZE - 1, flags); + crc2 = compute_crc32 (0, bytebuf + 1, SMALLBUFSIZE - 1); + assert (ref_crc[flags] == crc1); + assert (ref_crc[flags] == crc2); + } + + free (bytebuf); + + return 0; +} diff --git a/libs/pixman-0.40.0/test/radial-invalid.c b/libs/pixman-0.40.0/test/radial-invalid.c new file mode 100644 index 0000000..ec85fe3 --- /dev/null +++ b/libs/pixman-0.40.0/test/radial-invalid.c @@ -0,0 +1,54 @@ +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include "utils.h" + +#define WIDTH 100 +#define HEIGHT 100 + +int +main () +{ + pixman_image_t *radial; + pixman_image_t *dest = pixman_image_create_bits ( + PIXMAN_a8r8g8b8, WIDTH, HEIGHT, NULL, -1); + + static const pixman_transform_t xform = + { + { { 0x346f7, 0x0, 0x0 }, + { 0x0, 0x346f7, 0x0 }, + { 0x0, 0x0, 0x10000 } + }, + }; + + static const pixman_gradient_stop_t stops[] = + { + { 0xde61, { 0x4481, 0x96e8, 0x1e6a, 0x29e1 } }, + { 0xfdd5, { 0xfa10, 0xcc26, 0xbc43, 0x1eb7 } }, + { 0xfe1e, { 0xd257, 0x5bac, 0x6fc2, 0xa33b } }, + }; + + static const pixman_point_fixed_t inner = { 0x320000, 0x320000 }; + static const pixman_point_fixed_t outer = { 0x320000, 0x3cb074 }; + + enable_divbyzero_exceptions (); + enable_invalid_exceptions (); + + radial = pixman_image_create_radial_gradient ( + &inner, + &outer, + 0xab074, /* inner radius */ + 0x0, /* outer radius */ + stops, sizeof (stops) / sizeof (stops[0])); + + pixman_image_set_repeat (radial, PIXMAN_REPEAT_REFLECT); + pixman_image_set_transform (radial, &xform); + + pixman_image_composite ( + PIXMAN_OP_OVER, + radial, NULL, dest, + 0, 0, 0, 0, + 0, 0, WIDTH, HEIGHT); + + return 0; +} diff --git a/libs/pixman-0.40.0/test/radial-perf-test.c b/libs/pixman-0.40.0/test/radial-perf-test.c new file mode 100644 index 0000000..71092e2 --- /dev/null +++ b/libs/pixman-0.40.0/test/radial-perf-test.c @@ -0,0 +1,58 @@ +#include "utils.h" +#include <stdio.h> + +int +main () +{ + static const pixman_point_fixed_t inner = { 0x0000, 0x0000 }; + static const pixman_point_fixed_t outer = { 0x0000, 0x0000 }; + static const pixman_fixed_t r_inner = 0; + static const pixman_fixed_t r_outer = 64 << 16; + static const pixman_gradient_stop_t stops[] = { + { 0x00000, { 0x6666, 0x6666, 0x6666, 0xffff } }, + { 0x10000, { 0x0000, 0x0000, 0x0000, 0xffff } } + }; + static const pixman_transform_t transform = { + { { 0x0, 0x26ee, 0x0}, + { 0xffffeeef, 0x0, 0x0}, + { 0x0, 0x0, 0x10000} + } + }; + static const pixman_color_t z = { 0x0000, 0x0000, 0x0000, 0x0000 }; + pixman_image_t *dest, *radial, *zero; + int i; + double before, after; + + dest = pixman_image_create_bits ( + PIXMAN_x8r8g8b8, 640, 429, NULL, -1); + zero = pixman_image_create_solid_fill (&z); + radial = pixman_image_create_radial_gradient ( + &inner, &outer, r_inner, r_outer, stops, ARRAY_LENGTH (stops)); + pixman_image_set_transform (radial, &transform); + pixman_image_set_repeat (radial, PIXMAN_REPEAT_PAD); + +#define N_COMPOSITE 500 + + before = gettime(); + for (i = 0; i < N_COMPOSITE; ++i) + { + before -= gettime(); + + pixman_image_composite ( + PIXMAN_OP_SRC, zero, NULL, dest, + 0, 0, 0, 0, 0, 0, 640, 429); + + before += gettime(); + + pixman_image_composite32 ( + PIXMAN_OP_OVER, radial, NULL, dest, + - 150, -158, 0, 0, 0, 0, 640, 361); + } + + after = gettime(); + + write_png (dest, "radial.png"); + + printf ("Average time to composite: %f\n", (after - before) / N_COMPOSITE); + return 0; +} diff --git a/libs/pixman-0.40.0/test/region-contains-test.c b/libs/pixman-0.40.0/test/region-contains-test.c new file mode 100644 index 0000000..096e651 --- /dev/null +++ b/libs/pixman-0.40.0/test/region-contains-test.c @@ -0,0 +1,169 @@ +#include <stdlib.h> +#include <stdio.h> +#include "utils.h" + +static void +make_random_region (pixman_region32_t *region) +{ + int n_boxes; + + pixman_region32_init (region); + + n_boxes = prng_rand_n (64); + while (n_boxes--) + { + int32_t x, y; + uint32_t w, h; + + x = (int32_t)prng_rand() >> 2; + y = (int32_t)prng_rand() >> 2; + w = prng_rand() >> 2; + h = prng_rand() >> 2; + + pixman_region32_union_rect (region, region, x, y, w, h); + } +} + +static void +print_box (pixman_box32_t *box) +{ + printf (" %d %d %d %d\n", box->x1, box->y1, box->x2, box->y2); +} + +static int32_t +random_coord (pixman_region32_t *region, pixman_bool_t x) +{ + pixman_box32_t *b, *bb; + int n_boxes; + int begin, end; + + if (prng_rand_n (14)) + { + bb = pixman_region32_rectangles (region, &n_boxes); + if (n_boxes == 0) + goto use_extent; + b = bb + prng_rand_n (n_boxes); + } + else + { + use_extent: + b = pixman_region32_extents (region); + n_boxes = 1; + } + + if (x) + { + begin = b->x1; + end = b->x2; + } + else + { + begin = b->y1; + end = b->y2; + } + + switch (prng_rand_n (5)) + { + case 0: + return begin - prng_rand(); + case 1: + return end + prng_rand (); + case 2: + return end; + case 3: + return begin; + default: + return (end - begin) / 2 + begin; + } + return 0; +} + +static uint32_t +compute_crc32_u32 (uint32_t crc32, uint32_t v) +{ + if (!is_little_endian()) + { + v = ((v & 0xff000000) >> 24) | + ((v & 0x00ff0000) >> 8) | + ((v & 0x0000ff00) << 8) | + ((v & 0x000000ff) << 24); + } + + return compute_crc32 (crc32, &v, sizeof (int32_t)); +} + +static uint32_t +crc32_box32 (uint32_t crc32, pixman_box32_t *box) +{ + crc32 = compute_crc32_u32 (crc32, box->x1); + crc32 = compute_crc32_u32 (crc32, box->y1); + crc32 = compute_crc32_u32 (crc32, box->x2); + crc32 = compute_crc32_u32 (crc32, box->y2); + + return crc32; +} + +static uint32_t +test_region_contains_rectangle (int i, int verbose) +{ + pixman_box32_t box; + pixman_box32_t rbox = { 0, 0, 0, 0 }; + pixman_region32_t region; + uint32_t r, r1, r2, r3, r4, crc32; + + prng_srand (i); + + make_random_region (®ion); + + box.x1 = random_coord (®ion, TRUE); + box.x2 = box.x1 + prng_rand (); + box.y1 = random_coord (®ion, FALSE); + box.y2 = box.y1 + prng_rand (); + + if (verbose) + { + int n_rects; + pixman_box32_t *boxes; + + boxes = pixman_region32_rectangles (®ion, &n_rects); + + printf ("region:\n"); + while (n_rects--) + print_box (boxes++); + printf ("box:\n"); + print_box (&box); + } + + crc32 = 0; + + r1 = pixman_region32_contains_point (®ion, box.x1, box.y1, &rbox); + crc32 = crc32_box32 (crc32, &rbox); + r2 = pixman_region32_contains_point (®ion, box.x1, box.y2, &rbox); + crc32 = crc32_box32 (crc32, &rbox); + r3 = pixman_region32_contains_point (®ion, box.x2, box.y1, &rbox); + crc32 = crc32_box32 (crc32, &rbox); + r4 = pixman_region32_contains_point (®ion, box.x2, box.y2, &rbox); + crc32 = crc32_box32 (crc32, &rbox); + + r = pixman_region32_contains_rectangle (®ion, &box); + r = (i << 8) | (r << 4) | (r1 << 3) | (r2 << 2) | (r3 << 1) | (r4 << 0); + + crc32 = compute_crc32_u32 (crc32, r); + + if (verbose) + printf ("results: %d %d %d %d %d\n", (r & 0xf0) >> 4, r1, r2, r3, r4); + + pixman_region32_fini (®ion); + + return crc32; +} + +int +main (int argc, const char *argv[]) +{ + return fuzzer_test_main ("region_contains", + 1000000, + 0x548E0F3F, + test_region_contains_rectangle, + argc, argv); +} diff --git a/libs/pixman-0.40.0/test/region-test.c b/libs/pixman-0.40.0/test/region-test.c new file mode 100644 index 0000000..bfc219b --- /dev/null +++ b/libs/pixman-0.40.0/test/region-test.c @@ -0,0 +1,125 @@ +#include <assert.h> +#include <stdlib.h> +#include <stdio.h> +#include "utils.h" + +int +main () +{ + pixman_region32_t r1; + pixman_region32_t r2; + pixman_region32_t r3; + pixman_box32_t boxes[] = { + { 10, 10, 20, 20 }, + { 30, 30, 30, 40 }, + { 50, 45, 60, 44 }, + }; + pixman_box32_t boxes2[] = { + { 2, 6, 7, 6 }, + { 4, 1, 6, 7 }, + }; + pixman_box32_t boxes3[] = { + { 2, 6, 7, 6 }, + { 4, 1, 6, 1 }, + }; + int i, j; + pixman_box32_t *b; + pixman_image_t *image, *fill; + pixman_color_t white = { + 0xffff, + 0xffff, + 0xffff, + 0xffff + }; + + prng_srand (0); + + /* This used to go into an infinite loop before pixman-region.c + * was fixed to not use explict "short" variables + */ + pixman_region32_init_rect (&r1, 0, 0, 20, 64000); + pixman_region32_init_rect (&r2, 0, 0, 20, 64000); + pixman_region32_init_rect (&r3, 0, 0, 20, 64000); + + pixman_region32_subtract (&r1, &r2, &r3); + + + /* This would produce a region containing an empty + * rectangle in it. Such regions are considered malformed, + * but using an empty rectangle for initialization should + * work. + */ + pixman_region32_init_rects (&r1, boxes, 3); + + b = pixman_region32_rectangles (&r1, &i); + + assert (i == 1); + + while (i--) + { + assert (b[i].x1 < b[i].x2); + assert (b[i].y1 < b[i].y2); + } + + /* This would produce a rectangle containing the bounding box + * of the two rectangles. The correct result is to eliminate + * the broken rectangle. + */ + pixman_region32_init_rects (&r1, boxes2, 2); + + b = pixman_region32_rectangles (&r1, &i); + + assert (i == 1); + + assert (b[0].x1 == 4); + assert (b[0].y1 == 1); + assert (b[0].x2 == 6); + assert (b[0].y2 == 7); + + /* This should produce an empty region */ + pixman_region32_init_rects (&r1, boxes3, 2); + + b = pixman_region32_rectangles (&r1, &i); + + assert (i == 0); + + fill = pixman_image_create_solid_fill (&white); + for (i = 0; i < 100; i++) + { + int image_size = 128; + + pixman_region32_init (&r1); + + /* Add some random rectangles */ + for (j = 0; j < 64; j++) + pixman_region32_union_rect (&r1, &r1, + prng_rand_n (image_size), + prng_rand_n (image_size), + prng_rand_n (25), + prng_rand_n (25)); + + /* Clip to image size */ + pixman_region32_init_rect (&r2, 0, 0, image_size, image_size); + pixman_region32_intersect (&r1, &r1, &r2); + pixman_region32_fini (&r2); + + /* render region to a1 mask */ + image = pixman_image_create_bits (PIXMAN_a1, image_size, image_size, NULL, 0); + pixman_image_set_clip_region32 (image, &r1); + pixman_image_composite32 (PIXMAN_OP_SRC, + fill, NULL, image, + 0, 0, 0, 0, 0, 0, + image_size, image_size); + pixman_region32_init_from_image (&r2, image); + + pixman_image_unref (image); + + assert (pixman_region32_equal (&r1, &r2)); + pixman_region32_fini (&r1); + pixman_region32_fini (&r2); + + } + pixman_image_unref (fill); + + return 0; +} diff --git a/libs/pixman-0.40.0/test/region-translate-test.c b/libs/pixman-0.40.0/test/region-translate-test.c new file mode 100644 index 0000000..5a03027 --- /dev/null +++ b/libs/pixman-0.40.0/test/region-translate-test.c @@ -0,0 +1,30 @@ +#include <assert.h> +#include "utils.h" + +/* Pixman had a bug where 32bit regions where clipped to 16bit sizes when + * pixman_region32_translate() was called. This test exercises that bug. + */ + +#define LARGE 32000 + +int +main (int argc, char **argv) +{ + pixman_box32_t rect = { -LARGE, -LARGE, LARGE, LARGE }; + pixman_region32_t r1, r2; + + pixman_region32_init_rects (&r1, &rect, 1); + pixman_region32_init_rect (&r2, rect.x1, rect.y1, rect.x2 - rect.x1, rect.y2 - rect.y1); + + assert (pixman_region32_equal (&r1, &r2)); + + pixman_region32_translate (&r1, -LARGE, LARGE); + pixman_region32_translate (&r1, LARGE, -LARGE); + + assert (pixman_region32_equal (&r1, &r2)); + + pixman_region32_fini (&r1); + pixman_region32_fini (&r2); + + return 0; +} diff --git a/libs/pixman-0.40.0/test/rotate-test.c b/libs/pixman-0.40.0/test/rotate-test.c new file mode 100644 index 0000000..18ca60d --- /dev/null +++ b/libs/pixman-0.40.0/test/rotate-test.c @@ -0,0 +1,120 @@ +#include <stdlib.h> +#include "utils.h" + +#define WIDTH 32 +#define HEIGHT 32 + +static const pixman_format_code_t formats[] = +{ + PIXMAN_a8r8g8b8, + PIXMAN_a8b8g8r8, + PIXMAN_x8r8g8b8, + PIXMAN_x8b8g8r8, + PIXMAN_r5g6b5, + PIXMAN_b5g6r5, + PIXMAN_a8, + PIXMAN_a1, +}; + +static const pixman_op_t ops[] = +{ + PIXMAN_OP_OVER, + PIXMAN_OP_SRC, + PIXMAN_OP_ADD, +}; + +#define TRANSFORM(v00, v01, v10, v11) \ + { { { v00, v01, WIDTH * pixman_fixed_1 / 2 }, \ + { v10, v11, HEIGHT * pixman_fixed_1 / 2 }, \ + { 0, 0, pixman_fixed_1 } } } + +#define F1 pixman_fixed_1 + +static const pixman_transform_t transforms[] = +{ + TRANSFORM (0, -1, 1, 0), /* wrong 90 degree rotation */ + TRANSFORM (0, 1, -1, 0), /* wrong 270 degree rotation */ + TRANSFORM (1, 0, 0, 1), /* wrong identity */ + TRANSFORM (-1, 0, 0, -1), /* wrong 180 degree rotation */ + TRANSFORM (0, -F1, F1, 0), /* correct 90 degree rotation */ + TRANSFORM (0, F1, -F1, 0), /* correct 270 degree rotation */ + TRANSFORM (F1, 0, 0, F1), /* correct identity */ + TRANSFORM (-F1, 0, 0, -F1), /* correct 180 degree rotation */ +}; + +#define RANDOM_FORMAT() \ + (formats[prng_rand_n (ARRAY_LENGTH (formats))]) + +#define RANDOM_OP() \ + (ops[prng_rand_n (ARRAY_LENGTH (ops))]) + +#define RANDOM_TRANSFORM() \ + (&(transforms[prng_rand_n (ARRAY_LENGTH (transforms))])) + +static void +on_destroy (pixman_image_t *image, void *data) +{ + free (data); +} + +static pixman_image_t * +make_image (void) +{ + pixman_format_code_t format = RANDOM_FORMAT(); + uint32_t *bytes, *orig; + pixman_image_t *image; + int stride; + + orig = bytes = malloc (WIDTH * HEIGHT * 4); + prng_randmemset (bytes, WIDTH * HEIGHT * 4, 0); + + stride = WIDTH * 4; + if (prng_rand_n (2) == 0) + { + bytes += (stride / 4) * (HEIGHT - 1); + stride = - stride; + } + + image = pixman_image_create_bits ( + format, WIDTH, HEIGHT, bytes, stride); + + pixman_image_set_transform (image, RANDOM_TRANSFORM()); + pixman_image_set_destroy_function (image, on_destroy, orig); + pixman_image_set_repeat (image, PIXMAN_REPEAT_NORMAL); + + image_endian_swap (image); + + return image; +} + +static uint32_t +test_transform (int testnum, int verbose) +{ + pixman_image_t *src, *dest; + uint32_t crc; + + prng_srand (testnum); + + src = make_image (); + dest = make_image (); + + pixman_image_composite (RANDOM_OP(), + src, NULL, dest, + 0, 0, 0, 0, WIDTH / 2, HEIGHT / 2, + WIDTH, HEIGHT); + + crc = compute_crc32_for_image (0, dest); + + pixman_image_unref (src); + pixman_image_unref (dest); + + return crc; +} + +int +main (int argc, const char *argv[]) +{ + return fuzzer_test_main ("rotate", 15000, + 0x81E9EC2F, + test_transform, argc, argv); +} diff --git a/libs/pixman-0.40.0/test/scaling-bench.c b/libs/pixman-0.40.0/test/scaling-bench.c new file mode 100644 index 0000000..365e798 --- /dev/null +++ b/libs/pixman-0.40.0/test/scaling-bench.c @@ -0,0 +1,80 @@ +#include <stdlib.h> +#include "utils.h" + +#define SOURCE_WIDTH 320 +#define SOURCE_HEIGHT 240 +#define TEST_REPEATS 3 + +static pixman_image_t * +make_source (void) +{ + size_t n_bytes = (SOURCE_WIDTH + 2) * (SOURCE_HEIGHT + 2) * 4; + uint32_t *data = malloc (n_bytes); + pixman_image_t *source; + + prng_randmemset (data, n_bytes, 0); + + source = pixman_image_create_bits ( + PIXMAN_a8r8g8b8, SOURCE_WIDTH + 2, SOURCE_HEIGHT + 2, + data, + (SOURCE_WIDTH + 2) * 4); + + pixman_image_set_filter (source, PIXMAN_FILTER_BILINEAR, NULL, 0); + + return source; +} + +int +main () +{ + double scale; + pixman_image_t *src; + + prng_srand (23874); + + src = make_source (); + printf ("# %-6s %-22s %-14s %-12s\n", + "ratio", + "resolutions", + "time / ms", + "time per pixel / ns"); + for (scale = 0.1; scale < 10.005; scale += 0.01) + { + int i; + int dest_width = SOURCE_WIDTH * scale + 0.5; + int dest_height = SOURCE_HEIGHT * scale + 0.5; + int dest_byte_stride = (dest_width * 4 + 15) & ~15; + pixman_fixed_t s = (1 / scale) * 65536.0 + 0.5; + pixman_transform_t transform; + pixman_image_t *dest; + double t1, t2, t = -1; + uint32_t *dest_buf = aligned_malloc (16, dest_byte_stride * dest_height); + memset (dest_buf, 0, dest_byte_stride * dest_height); + + pixman_transform_init_scale (&transform, s, s); + pixman_image_set_transform (src, &transform); + + dest = pixman_image_create_bits ( + PIXMAN_a8r8g8b8, dest_width, dest_height, dest_buf, dest_byte_stride); + + for (i = 0; i < TEST_REPEATS; i++) + { + t1 = gettime(); + pixman_image_composite ( + PIXMAN_OP_OVER, src, NULL, dest, + scale, scale, 0, 0, 0, 0, dest_width, dest_height); + t2 = gettime(); + if (t < 0 || t2 - t1 < t) + t = t2 - t1; + } + + printf ("%6.2f : %4dx%-4d => %4dx%-4d : %12.4f : %12.4f\n", + scale, SOURCE_WIDTH, SOURCE_HEIGHT, dest_width, dest_height, + t * 1000, (t / (dest_width * dest_height)) * 1000000000); + + pixman_image_unref (dest); + free (dest_buf); + } + + return 0; +} diff --git a/libs/pixman-0.40.0/test/scaling-crash-test.c b/libs/pixman-0.40.0/test/scaling-crash-test.c new file mode 100644 index 0000000..0dac892 --- /dev/null +++ b/libs/pixman-0.40.0/test/scaling-crash-test.c @@ -0,0 +1,219 @@ +#include <assert.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include "utils.h" + +/* + * We have a source image filled with solid color, set NORMAL or PAD repeat, + * and some transform which results in nearest neighbour scaling. + * + * The expected result is either that the destination image filled with this solid + * color or, if the transformation is such that we can't composite anything at + * all, that nothing has changed in the destination. + * + * The surrounding memory of the source image is a different solid color so that + * we are sure to get failures if we access it. + */ +static int +run_test (int32_t dst_width, + int32_t dst_height, + int32_t src_width, + int32_t src_height, + int32_t src_x, + int32_t src_y, + int32_t scale_x, + int32_t scale_y, + pixman_filter_t filter, + pixman_repeat_t repeat) +{ + pixman_image_t * src_img; + pixman_image_t * dst_img; + pixman_transform_t transform; + uint32_t * srcbuf; + uint32_t * dstbuf; + pixman_color_t color_cc = { 0xcccc, 0xcccc, 0xcccc, 0xcccc }; + pixman_image_t * solid; + int result; + int i; + + static const pixman_fixed_t kernel[] = + { +#define D(f) (pixman_double_to_fixed (f) + 0x0001) + + pixman_int_to_fixed (5), + pixman_int_to_fixed (5), + D(1/25.0), D(1/25.0), D(1/25.0), D(1/25.0), D(1/25.0), + D(1/25.0), D(1/25.0), D(1/25.0), D(1/25.0), D(1/25.0), + D(1/25.0), D(1/25.0), D(1/25.0), D(1/25.0), D(1/25.0), + D(1/25.0), D(1/25.0), D(1/25.0), D(1/25.0), D(1/25.0), + D(1/25.0), D(1/25.0), D(1/25.0), D(1/25.0), D(1/25.0) + }; + + result = 0; + + srcbuf = (uint32_t *)malloc ((src_width + 10) * (src_height + 10) * 4); + dstbuf = (uint32_t *)malloc (dst_width * dst_height * 4); + + memset (srcbuf, 0x88, src_width * src_height * 4); + memset (dstbuf, 0x33, dst_width * dst_height * 4); + + src_img = pixman_image_create_bits ( + PIXMAN_a8r8g8b8, src_width, src_height, + srcbuf + (src_width + 10) * 5 + 5, (src_width + 10) * 4); + + solid = pixman_image_create_solid_fill (&color_cc); + pixman_image_composite32 (PIXMAN_OP_SRC, solid, NULL, src_img, + 0, 0, 0, 0, 0, 0, src_width, src_height); + pixman_image_unref (solid); + + dst_img = pixman_image_create_bits ( + PIXMAN_a8r8g8b8, dst_width, dst_height, dstbuf, dst_width * 4); + + pixman_transform_init_scale (&transform, scale_x, scale_y); + pixman_image_set_transform (src_img, &transform); + pixman_image_set_repeat (src_img, repeat); + if (filter == PIXMAN_FILTER_CONVOLUTION) + pixman_image_set_filter (src_img, filter, kernel, 27); + else + pixman_image_set_filter (src_img, filter, NULL, 0); + + pixman_image_composite (PIXMAN_OP_SRC, src_img, NULL, dst_img, + src_x, src_y, 0, 0, 0, 0, dst_width, dst_height); + + pixman_image_unref (src_img); + pixman_image_unref (dst_img); + + for (i = 0; i < dst_width * dst_height; i++) + { + if (dstbuf[i] != 0xCCCCCCCC && dstbuf[i] != 0x33333333) + { + result = 1; + break; + } + } + + free (srcbuf); + free (dstbuf); + return result; +} + +typedef struct filter_info_t filter_info_t; +struct filter_info_t +{ + pixman_filter_t value; + char name[28]; +}; + +static const filter_info_t filters[] = +{ + { PIXMAN_FILTER_NEAREST, "NEAREST" }, + { PIXMAN_FILTER_BILINEAR, "BILINEAR" }, + { PIXMAN_FILTER_CONVOLUTION, "CONVOLUTION" }, +}; + +typedef struct repeat_info_t repeat_info_t; +struct repeat_info_t +{ + pixman_repeat_t value; + char name[28]; +}; + + +static const repeat_info_t repeats[] = +{ + { PIXMAN_REPEAT_PAD, "PAD" }, + { PIXMAN_REPEAT_REFLECT, "REFLECT" }, + { PIXMAN_REPEAT_NORMAL, "NORMAL" } +}; + +static int +do_test (int32_t dst_size, + int32_t src_size, + int32_t src_offs, + int32_t scale_factor) +{ + int i, j; + + for (i = 0; i < ARRAY_LENGTH (filters); ++i) + { + for (j = 0; j < ARRAY_LENGTH (repeats); ++j) + { + /* horizontal test */ + if (run_test (dst_size, 1, + src_size, 1, + src_offs, 0, + scale_factor, 65536, + filters[i].value, + repeats[j].value) != 0) + { + printf ("Vertical test failed with %s filter and repeat mode %s\n", + filters[i].name, repeats[j].name); + + return 1; + } + + /* vertical test */ + if (run_test (1, dst_size, + 1, src_size, + 0, src_offs, + 65536, scale_factor, + filters[i].value, + repeats[j].value) != 0) + { + printf ("Vertical test failed with %s filter and repeat mode %s\n", + filters[i].name, repeats[j].name); + + return 1; + } + } + } + + return 0; +} + +int +main (int argc, char *argv[]) +{ + int i; + + pixman_disable_out_of_bounds_workaround (); + + /* can potentially crash */ + assert (do_test ( + 48000, 32767, 1, 65536 * 128) == 0); + + /* can potentially get into a deadloop */ + assert (do_test ( + 16384, 65536, 32, 32768) == 0); + + /* can potentially access memory outside source image buffer */ + assert (do_test ( + 10, 10, 0, 1) == 0); + assert (do_test ( + 10, 10, 0, 0) == 0); + + for (i = 0; i < 100; ++i) + { + pixman_fixed_t one_seventh = + (((pixman_fixed_48_16_t)pixman_fixed_1) << 16) / (7 << 16); + + assert (do_test ( + 1, 7, 3, one_seventh + i - 50) == 0); + } + + for (i = 0; i < 100; ++i) + { + pixman_fixed_t scale = + (((pixman_fixed_48_16_t)pixman_fixed_1) << 16) / (32767 << 16); + + assert (do_test ( + 1, 32767, 16383, scale + i - 50) == 0); + } + + /* can potentially provide invalid results (out of range matrix stuff) */ + assert (do_test ( + 48000, 32767, 16384, 65536 * 128) == 0); + + return 0; +} diff --git a/libs/pixman-0.40.0/test/scaling-helpers-test.c b/libs/pixman-0.40.0/test/scaling-helpers-test.c new file mode 100644 index 0000000..cd5ace0 --- /dev/null +++ b/libs/pixman-0.40.0/test/scaling-helpers-test.c @@ -0,0 +1,92 @@ +#include <stdlib.h> +#include <stdio.h> +#include <assert.h> +#include "utils.h" +#include "pixman-inlines.h" + +/* A trivial reference implementation for + * 'bilinear_pad_repeat_get_scanline_bounds' + */ +static void +bilinear_pad_repeat_get_scanline_bounds_ref (int32_t source_image_width, + pixman_fixed_t vx_, + pixman_fixed_t unit_x, + int32_t * left_pad, + int32_t * left_tz, + int32_t * width, + int32_t * right_tz, + int32_t * right_pad) +{ + int w = *width; + int64_t vx = vx_; + *left_pad = 0; + *left_tz = 0; + *width = 0; + *right_tz = 0; + *right_pad = 0; + while (--w >= 0) + { + if (vx < 0) + { + if (vx + pixman_fixed_1 < 0) + *left_pad += 1; + else + *left_tz += 1; + } + else if (vx + pixman_fixed_1 >= pixman_int_to_fixed (source_image_width)) + { + if (vx >= pixman_int_to_fixed (source_image_width)) + *right_pad += 1; + else + *right_tz += 1; + } + else + { + *width += 1; + } + vx += unit_x; + } +} + +int +main (void) +{ + int i; + prng_srand (0); + for (i = 0; i < 10000; i++) + { + int32_t left_pad1, left_tz1, width1, right_tz1, right_pad1; + int32_t left_pad2, left_tz2, width2, right_tz2, right_pad2; + pixman_fixed_t vx = prng_rand_n(10000 << 16) - (3000 << 16); + int32_t width = prng_rand_n(10000); + int32_t source_image_width = prng_rand_n(10000) + 1; + pixman_fixed_t unit_x = prng_rand_n(10 << 16) + 1; + width1 = width2 = width; + + bilinear_pad_repeat_get_scanline_bounds_ref (source_image_width, + vx, + unit_x, + &left_pad1, + &left_tz1, + &width1, + &right_tz1, + &right_pad1); + + bilinear_pad_repeat_get_scanline_bounds (source_image_width, + vx, + unit_x, + &left_pad2, + &left_tz2, + &width2, + &right_tz2, + &right_pad2); + + assert (left_pad1 == left_pad2); + assert (left_tz1 == left_tz2); + assert (width1 == width2); + assert (right_tz1 == right_tz2); + assert (right_pad1 == right_pad2); + } + + return 0; +} diff --git a/libs/pixman-0.40.0/test/scaling-test.c b/libs/pixman-0.40.0/test/scaling-test.c new file mode 100644 index 0000000..0ece611 --- /dev/null +++ b/libs/pixman-0.40.0/test/scaling-test.c @@ -0,0 +1,424 @@ +/* + * Test program, which can detect some problems with nearest neighbour + * and bilinear scaling in pixman. Testing is done by running lots + * of random SRC and OVER compositing operations a8r8g8b8, x8a8r8g8b8 + * and r5g6b5 color formats. + * + * Script 'fuzzer-find-diff.pl' can be used to narrow down the problem in + * the case of test failure. + */ +#include <stdlib.h> +#include <stdio.h> +#include "utils.h" + +#define MAX_SRC_WIDTH 48 +#define MAX_SRC_HEIGHT 8 +#define MAX_DST_WIDTH 48 +#define MAX_DST_HEIGHT 8 +#define MAX_STRIDE 4 + +/* + * Composite operation with pseudorandom images + */ + +static pixman_format_code_t +get_format (int bpp) +{ + if (bpp == 4) + { + switch (prng_rand_n (4)) + { + default: + case 0: + return PIXMAN_a8r8g8b8; + case 1: + return PIXMAN_x8r8g8b8; + case 2: + return PIXMAN_a8b8g8r8; + case 3: + return PIXMAN_x8b8g8r8; + } + } + else + { + return PIXMAN_r5g6b5; + } +} + +uint32_t +test_composite (int testnum, + int verbose) +{ + int i; + pixman_image_t * src_img; + pixman_image_t * mask_img; + pixman_image_t * dst_img; + pixman_transform_t transform; + pixman_region16_t clip; + int src_width, src_height; + int mask_width, mask_height; + int dst_width, dst_height; + int src_stride, mask_stride, dst_stride; + int src_x, src_y; + int mask_x, mask_y; + int dst_x, dst_y; + int src_bpp; + int mask_bpp = 1; + int dst_bpp; + int w, h; + pixman_fixed_t scale_x = 65536, scale_y = 65536; + pixman_fixed_t translate_x = 0, translate_y = 0; + pixman_fixed_t mask_scale_x = 65536, mask_scale_y = 65536; + pixman_fixed_t mask_translate_x = 0, mask_translate_y = 0; + pixman_op_t op; + pixman_repeat_t repeat = PIXMAN_REPEAT_NONE; + pixman_repeat_t mask_repeat = PIXMAN_REPEAT_NONE; + pixman_format_code_t src_fmt, mask_fmt, dst_fmt; + uint32_t * srcbuf; + uint32_t * dstbuf; + uint32_t * maskbuf; + uint32_t crc32; + FLOAT_REGS_CORRUPTION_DETECTOR_START (); + + prng_srand (testnum); + + src_bpp = (prng_rand_n (2) == 0) ? 2 : 4; + dst_bpp = (prng_rand_n (2) == 0) ? 2 : 4; + switch (prng_rand_n (3)) + { + case 0: + op = PIXMAN_OP_SRC; + break; + case 1: + op = PIXMAN_OP_OVER; + break; + default: + op = PIXMAN_OP_ADD; + break; + } + + src_width = prng_rand_n (MAX_SRC_WIDTH) + 1; + src_height = prng_rand_n (MAX_SRC_HEIGHT) + 1; + + if (prng_rand_n (2)) + { + mask_width = prng_rand_n (MAX_SRC_WIDTH) + 1; + mask_height = prng_rand_n (MAX_SRC_HEIGHT) + 1; + } + else + { + mask_width = mask_height = 1; + } + + dst_width = prng_rand_n (MAX_DST_WIDTH) + 1; + dst_height = prng_rand_n (MAX_DST_HEIGHT) + 1; + src_stride = src_width * src_bpp + prng_rand_n (MAX_STRIDE) * src_bpp; + mask_stride = mask_width * mask_bpp + prng_rand_n (MAX_STRIDE) * mask_bpp; + dst_stride = dst_width * dst_bpp + prng_rand_n (MAX_STRIDE) * dst_bpp; + + if (src_stride & 3) + src_stride += 2; + + if (mask_stride & 1) + mask_stride += 1; + if (mask_stride & 2) + mask_stride += 2; + + if (dst_stride & 3) + dst_stride += 2; + + src_x = -(src_width / 4) + prng_rand_n (src_width * 3 / 2); + src_y = -(src_height / 4) + prng_rand_n (src_height * 3 / 2); + mask_x = -(mask_width / 4) + prng_rand_n (mask_width * 3 / 2); + mask_y = -(mask_height / 4) + prng_rand_n (mask_height * 3 / 2); + dst_x = -(dst_width / 4) + prng_rand_n (dst_width * 3 / 2); + dst_y = -(dst_height / 4) + prng_rand_n (dst_height * 3 / 2); + w = prng_rand_n (dst_width * 3 / 2 - dst_x); + h = prng_rand_n (dst_height * 3 / 2 - dst_y); + + srcbuf = (uint32_t *)malloc (src_stride * src_height); + maskbuf = (uint32_t *)malloc (mask_stride * mask_height); + dstbuf = (uint32_t *)malloc (dst_stride * dst_height); + + prng_randmemset (srcbuf, src_stride * src_height, 0); + prng_randmemset (maskbuf, mask_stride * mask_height, 0); + prng_randmemset (dstbuf, dst_stride * dst_height, 0); + + src_fmt = get_format (src_bpp); + mask_fmt = PIXMAN_a8; + dst_fmt = get_format (dst_bpp); + + if (prng_rand_n (2)) + { + srcbuf += (src_stride / 4) * (src_height - 1); + src_stride = - src_stride; + } + + if (prng_rand_n (2)) + { + maskbuf += (mask_stride / 4) * (mask_height - 1); + mask_stride = - mask_stride; + } + + if (prng_rand_n (2)) + { + dstbuf += (dst_stride / 4) * (dst_height - 1); + dst_stride = - dst_stride; + } + + src_img = pixman_image_create_bits ( + src_fmt, src_width, src_height, srcbuf, src_stride); + + mask_img = pixman_image_create_bits ( + mask_fmt, mask_width, mask_height, maskbuf, mask_stride); + + dst_img = pixman_image_create_bits ( + dst_fmt, dst_width, dst_height, dstbuf, dst_stride); + + image_endian_swap (src_img); + image_endian_swap (dst_img); + + if (prng_rand_n (4) > 0) + { + scale_x = -32768 * 3 + prng_rand_n (65536 * 5); + scale_y = -32768 * 3 + prng_rand_n (65536 * 5); + translate_x = prng_rand_n (65536); + translate_y = prng_rand_n (65536); + pixman_transform_init_scale (&transform, scale_x, scale_y); + pixman_transform_translate (&transform, NULL, translate_x, translate_y); + pixman_image_set_transform (src_img, &transform); + } + + if (prng_rand_n (2) > 0) + { + mask_scale_x = -32768 * 3 + prng_rand_n (65536 * 5); + mask_scale_y = -32768 * 3 + prng_rand_n (65536 * 5); + mask_translate_x = prng_rand_n (65536); + mask_translate_y = prng_rand_n (65536); + pixman_transform_init_scale (&transform, mask_scale_x, mask_scale_y); + pixman_transform_translate (&transform, NULL, mask_translate_x, mask_translate_y); + pixman_image_set_transform (mask_img, &transform); + } + + switch (prng_rand_n (4)) + { + case 0: + mask_repeat = PIXMAN_REPEAT_NONE; + break; + + case 1: + mask_repeat = PIXMAN_REPEAT_NORMAL; + break; + + case 2: + mask_repeat = PIXMAN_REPEAT_PAD; + break; + + case 3: + mask_repeat = PIXMAN_REPEAT_REFLECT; + break; + + default: + break; + } + pixman_image_set_repeat (mask_img, mask_repeat); + + switch (prng_rand_n (4)) + { + case 0: + repeat = PIXMAN_REPEAT_NONE; + break; + + case 1: + repeat = PIXMAN_REPEAT_NORMAL; + break; + + case 2: + repeat = PIXMAN_REPEAT_PAD; + break; + + case 3: + repeat = PIXMAN_REPEAT_REFLECT; + break; + + default: + break; + } + pixman_image_set_repeat (src_img, repeat); + + if (prng_rand_n (2)) + pixman_image_set_filter (src_img, PIXMAN_FILTER_NEAREST, NULL, 0); + else + pixman_image_set_filter (src_img, PIXMAN_FILTER_BILINEAR, NULL, 0); + + if (prng_rand_n (2)) + pixman_image_set_filter (mask_img, PIXMAN_FILTER_NEAREST, NULL, 0); + else + pixman_image_set_filter (mask_img, PIXMAN_FILTER_BILINEAR, NULL, 0); + + if (prng_rand_n (8) == 0) + { + pixman_box16_t clip_boxes[2]; + int n = prng_rand_n (2) + 1; + + for (i = 0; i < n; i++) + { + clip_boxes[i].x1 = prng_rand_n (src_width); + clip_boxes[i].y1 = prng_rand_n (src_height); + clip_boxes[i].x2 = + clip_boxes[i].x1 + prng_rand_n (src_width - clip_boxes[i].x1); + clip_boxes[i].y2 = + clip_boxes[i].y1 + prng_rand_n (src_height - clip_boxes[i].y1); + + if (verbose) + { + printf ("source clip box: [%d,%d-%d,%d]\n", + clip_boxes[i].x1, clip_boxes[i].y1, + clip_boxes[i].x2, clip_boxes[i].y2); + } + } + + pixman_region_init_rects (&clip, clip_boxes, n); + pixman_image_set_clip_region (src_img, &clip); + pixman_image_set_source_clipping (src_img, 1); + pixman_region_fini (&clip); + } + + if (prng_rand_n (8) == 0) + { + pixman_box16_t clip_boxes[2]; + int n = prng_rand_n (2) + 1; + + for (i = 0; i < n; i++) + { + clip_boxes[i].x1 = prng_rand_n (mask_width); + clip_boxes[i].y1 = prng_rand_n (mask_height); + clip_boxes[i].x2 = + clip_boxes[i].x1 + prng_rand_n (mask_width - clip_boxes[i].x1); + clip_boxes[i].y2 = + clip_boxes[i].y1 + prng_rand_n (mask_height - clip_boxes[i].y1); + + if (verbose) + { + printf ("mask clip box: [%d,%d-%d,%d]\n", + clip_boxes[i].x1, clip_boxes[i].y1, + clip_boxes[i].x2, clip_boxes[i].y2); + } + } + + pixman_region_init_rects (&clip, clip_boxes, n); + pixman_image_set_clip_region (mask_img, &clip); + pixman_image_set_source_clipping (mask_img, 1); + pixman_region_fini (&clip); + } + + if (prng_rand_n (8) == 0) + { + pixman_box16_t clip_boxes[2]; + int n = prng_rand_n (2) + 1; + for (i = 0; i < n; i++) + { + clip_boxes[i].x1 = prng_rand_n (dst_width); + clip_boxes[i].y1 = prng_rand_n (dst_height); + clip_boxes[i].x2 = + clip_boxes[i].x1 + prng_rand_n (dst_width - clip_boxes[i].x1); + clip_boxes[i].y2 = + clip_boxes[i].y1 + prng_rand_n (dst_height - clip_boxes[i].y1); + + if (verbose) + { + printf ("destination clip box: [%d,%d-%d,%d]\n", + clip_boxes[i].x1, clip_boxes[i].y1, + clip_boxes[i].x2, clip_boxes[i].y2); + } + } + pixman_region_init_rects (&clip, clip_boxes, n); + pixman_image_set_clip_region (dst_img, &clip); + pixman_region_fini (&clip); + } + + if (prng_rand_n (2) == 0) + { + mask_fmt = PIXMAN_null; + pixman_image_unref (mask_img); + mask_img = NULL; + mask_x = 0; + mask_y = 0; + } + + if (verbose) + { + printf ("op=%s, src_fmt=%s, mask_fmt=%s, dst_fmt=%s\n", + operator_name (op), format_name (src_fmt), + format_name (mask_fmt), format_name (dst_fmt)); + printf ("scale_x=%d, scale_y=%d, repeat=%d, filter=%d\n", + scale_x, scale_y, repeat, src_img->common.filter); + printf ("translate_x=%d, translate_y=%d\n", + translate_x, translate_y); + if (mask_fmt != PIXMAN_null) + { + printf ("mask_scale_x=%d, mask_scale_y=%d, " + "mask_repeat=%d, mask_filter=%d\n", + mask_scale_x, mask_scale_y, mask_repeat, + mask_img->common.filter); + printf ("mask_translate_x=%d, mask_translate_y=%d\n", + mask_translate_x, mask_translate_y); + } + printf ("src_width=%d, src_height=%d, src_x=%d, src_y=%d\n", + src_width, src_height, src_x, src_y); + if (mask_fmt != PIXMAN_null) + { + printf ("mask_width=%d, mask_height=%d, mask_x=%d, mask_y=%d\n", + mask_width, mask_height, mask_x, mask_y); + } + printf ("dst_width=%d, dst_height=%d, dst_x=%d, dst_y=%d\n", + dst_width, dst_height, dst_x, dst_y); + printf ("w=%d, h=%d\n", w, h); + } + + pixman_image_composite (op, src_img, mask_img, dst_img, + src_x, src_y, mask_x, mask_y, dst_x, dst_y, w, h); + + crc32 = compute_crc32_for_image (0, dst_img); + + if (verbose) + print_image (dst_img); + + pixman_image_unref (src_img); + if (mask_img != NULL) + pixman_image_unref (mask_img); + pixman_image_unref (dst_img); + + if (src_stride < 0) + srcbuf += (src_stride / 4) * (src_height - 1); + + if (mask_stride < 0) + maskbuf += (mask_stride / 4) * (mask_height - 1); + + if (dst_stride < 0) + dstbuf += (dst_stride / 4) * (dst_height - 1); + + free (srcbuf); + free (maskbuf); + free (dstbuf); + + FLOAT_REGS_CORRUPTION_DETECTOR_FINISH (); + return crc32; +} + +#if BILINEAR_INTERPOLATION_BITS == 7 +#define CHECKSUM 0x92E0F068 +#elif BILINEAR_INTERPOLATION_BITS == 4 +#define CHECKSUM 0x8EFFA1E5 +#else +#define CHECKSUM 0x00000000 +#endif + +int +main (int argc, const char *argv[]) +{ + pixman_disable_out_of_bounds_workaround (); + + return fuzzer_test_main("scaling", 8000000, CHECKSUM, + test_composite, argc, argv); +} diff --git a/libs/pixman-0.40.0/test/solid-test.c b/libs/pixman-0.40.0/test/solid-test.c new file mode 100644 index 0000000..b118d37 --- /dev/null +++ b/libs/pixman-0.40.0/test/solid-test.c @@ -0,0 +1,354 @@ +/* + * 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 <stdlib.h> +#include <stdint.h> +#include <stdio.h> + +#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 */ + prng_randmemset (buffer, 4, 0); + 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; + + color.alpha = prng_rand_n (UINT16_MAX + 1); + color.red = prng_rand_n (UINT16_MAX + 1); + color.green = prng_rand_n (UINT16_MAX + 1); + color.blue = prng_rand_n (UINT16_MAX + 1); + 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, + 0xC30FD380, + test_solid, argc, argv); +} diff --git a/libs/pixman-0.40.0/test/stress-test.c b/libs/pixman-0.40.0/test/stress-test.c new file mode 100644 index 0000000..13d9979 --- /dev/null +++ b/libs/pixman-0.40.0/test/stress-test.c @@ -0,0 +1,1077 @@ +#include <stdio.h> +#include <stdlib.h> +#include "utils.h" +#include <sys/types.h> + +#if 0 +#define fence_malloc malloc +#define fence_free free +#define make_random_bytes malloc +#endif + +static const pixman_format_code_t image_formats[] = +{ + PIXMAN_rgba_float, + PIXMAN_rgb_float, + PIXMAN_a8r8g8b8, + PIXMAN_x8r8g8b8, + PIXMAN_r5g6b5, + PIXMAN_r3g3b2, + PIXMAN_a8, + PIXMAN_a8b8g8r8, + PIXMAN_x8b8g8r8, + PIXMAN_b8g8r8a8, + PIXMAN_b8g8r8x8, + PIXMAN_r8g8b8a8, + PIXMAN_r8g8b8x8, + PIXMAN_x14r6g6b6, + PIXMAN_r8g8b8, + PIXMAN_b8g8r8, + PIXMAN_a8r8g8b8_sRGB, + PIXMAN_r5g6b5, + PIXMAN_b5g6r5, + PIXMAN_x2r10g10b10, + PIXMAN_a2r10g10b10, + PIXMAN_x2b10g10r10, + PIXMAN_a2b10g10r10, + PIXMAN_a1r5g5b5, + PIXMAN_x1r5g5b5, + PIXMAN_a1b5g5r5, + PIXMAN_x1b5g5r5, + PIXMAN_a4r4g4b4, + PIXMAN_x4r4g4b4, + PIXMAN_a4b4g4r4, + PIXMAN_x4b4g4r4, + PIXMAN_a8, + 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_a1 +}; + +static pixman_filter_t filters[] = +{ + PIXMAN_FILTER_NEAREST, + PIXMAN_FILTER_BILINEAR, + PIXMAN_FILTER_FAST, + PIXMAN_FILTER_GOOD, + PIXMAN_FILTER_BEST, + PIXMAN_FILTER_CONVOLUTION +}; + +static int +get_size (void) +{ + switch (prng_rand_n (28)) + { + case 0: + return 1; + + case 1: + return 2; + + default: + case 2: + return prng_rand_n (100); + + case 4: + return prng_rand_n (2000) + 1000; + + case 5: + return 65535; + + case 6: + return 65536; + + case 7: + return prng_rand_n (64000) + 63000; + } +} + +static uint32_t +real_reader (const void *src, int size); + +static void *xor_ptr(const void *ptr) +{ + return (void *)(((intptr_t)ptr) ^ (intptr_t)0x8000000080000000); +} + +static void +destroy (pixman_image_t *image, void *data) +{ + if (image->type == BITS && image->bits.free_me != image->bits.bits) + { + uint32_t *bits; + + if (image->bits.bits != (void *)0x01) + { + bits = image->bits.bits; + + if (image->bits.rowstride < 0) + bits -= (- image->bits.rowstride * (image->bits.height - 1)); + + if (image->bits.read_func == real_reader) + bits = xor_ptr(bits); + + fence_free (bits); + } + } + + free (data); +} + +static uint32_t +real_reader (const void *src, int size) +{ + src = xor_ptr(src); + switch (size) + { + case 1: + return *(uint8_t *)src; + case 2: + return *(uint16_t *)src; + case 4: + return *(uint32_t *)src; + default: + assert (0); + return 0; /* silence MSVC */ + } +} + +static void +real_writer (void *src, uint32_t value, int size) +{ + src = xor_ptr(src); + switch (size) + { + case 1: + *(uint8_t *)src = value; + break; + + case 2: + *(uint16_t *)src = value; + break; + + case 4: + *(uint32_t *)src = value; + break; + + default: + assert (0); + break; + } +} + +static uint32_t +fake_reader (const void *src, int size) +{ + uint32_t r = prng_rand (); + + assert (size == 1 || size == 2 || size == 4); + + return r >> (32 - (size * 8)); +} + +static void +fake_writer (void *src, uint32_t value, int size) +{ + assert (size == 1 || size == 2 || size == 4); +} + +static int32_t +log_rand (void) +{ + uint32_t mask; + + mask = (1 << prng_rand_n (10)) - 1; + + return (prng_rand () & mask) - (mask >> 1); +} + +static int32_t +rand_x (pixman_image_t *image) +{ + if (image->type == BITS) + return prng_rand_n (image->bits.width); + else + return log_rand (); +} + +static int32_t +rand_y (pixman_image_t *image) +{ + if (image->type == BITS) + return prng_rand_n (image->bits.height); + else + return log_rand (); +} + +typedef enum +{ + DONT_CARE, + PREFER_ALPHA, + REQUIRE_ALPHA +} alpha_preference_t; + +static pixman_format_code_t +random_format (alpha_preference_t alpha) +{ + pixman_format_code_t format; + int n = prng_rand_n (ARRAY_LENGTH (image_formats)); + + if (alpha >= PREFER_ALPHA && + (alpha == REQUIRE_ALPHA || prng_rand_n (4) != 0)) + { + do + { + format = image_formats[n++ % ARRAY_LENGTH (image_formats)]; + } while (PIXMAN_FORMAT_TYPE (format) != PIXMAN_TYPE_A); + } + else + { + format = image_formats[n]; + } + + return format; +} + +static pixman_image_t * +create_random_bits_image (alpha_preference_t alpha_preference) +{ + pixman_format_code_t format; + pixman_indexed_t *indexed; + pixman_image_t *image; + int width, height, stride; + uint32_t *bits; + pixman_read_memory_func_t read_func = NULL; + pixman_write_memory_func_t write_func = NULL; + pixman_filter_t filter; + pixman_fixed_t *coefficients = NULL; + int n_coefficients = 0; + int align_add, align_mask; + + /* format */ + format = random_format (alpha_preference); + switch (PIXMAN_FORMAT_BPP (format)) { + case 128: + align_mask = 15; + align_add = align_mask + prng_rand_n (65); + break; + default: + align_mask = 3; + align_add = align_mask + prng_rand_n (17); + break; + } + + indexed = NULL; + if (PIXMAN_FORMAT_TYPE (format) == PIXMAN_TYPE_COLOR) + { + indexed = malloc (sizeof (pixman_indexed_t)); + + initialize_palette (indexed, PIXMAN_FORMAT_BPP (format), TRUE); + } + else if (PIXMAN_FORMAT_TYPE (format) == PIXMAN_TYPE_GRAY) + { + indexed = malloc (sizeof (pixman_indexed_t)); + + initialize_palette (indexed, PIXMAN_FORMAT_BPP (format), FALSE); + } + else + { + indexed = NULL; + } + + /* size */ + width = get_size (); + height = get_size (); + + while ((uint64_t)width * height > 200000) + { + if (prng_rand_n(2) == 0) + height = 200000 / width; + else + width = 200000 / height; + } + + if (height == 0) + height = 1; + if (width == 0) + width = 1; + + /* bits */ + switch (prng_rand_n (7)) + { + default: + case 0: + stride = (width * PIXMAN_FORMAT_BPP (format) + 7) / 8; + stride = (stride + align_add) & (~align_mask); + if (format == PIXMAN_rgb_float || format == PIXMAN_rgba_float) + bits = (uint32_t *)make_random_floats (height * stride); + else + bits = (uint32_t *)make_random_bytes (height * stride); + break; + + case 1: + stride = 0; + bits = NULL; + break; + + case 2: /* Zero-filled */ + stride = (width * PIXMAN_FORMAT_BPP (format) + 7) / 8; + stride = (stride + align_add) & (~align_mask); + bits = fence_malloc (height * stride); + if (!bits) + return NULL; + memset (bits, 0, height * stride); + break; + + case 3: /* Filled with 0xFF */ + stride = (width * PIXMAN_FORMAT_BPP (format) + 7) / 8; + stride = (stride + align_add) & (~align_mask); + bits = fence_malloc (height * stride); + if (!bits) + return NULL; + memset (bits, 0xff, height * stride); + break; + + case 4: /* bits is a bad pointer, has read/write functions */ + if (PIXMAN_FORMAT_BPP (format) <= 32) { + stride = 232; + bits = (void *)0x01; + read_func = fake_reader; + write_func = fake_writer; + break; + } + + case 5: /* bits is a real pointer, has read/write functions */ + stride = (width * PIXMAN_FORMAT_BPP (format) + 7) / 8; + stride = (stride + align_add) & (~align_mask); + bits = fence_malloc (height * stride); + if (!bits) + return NULL; + memset (bits, 0xff, height * stride); + if (PIXMAN_FORMAT_BPP (format) <= 32) { + bits = xor_ptr(bits); + read_func = real_reader; + write_func = real_writer; + } + break; + + case 6: /* bits is a real pointer, stride is negative */ + stride = (width * PIXMAN_FORMAT_BPP (format) + 7) / 8; + stride = (stride + align_add) & (~align_mask); + if (format == PIXMAN_rgb_float || format == PIXMAN_rgba_float) + bits = (uint32_t *)make_random_floats (height * stride); + else + bits = (uint32_t *)make_random_bytes (height * stride); + if (!bits) + return NULL; + bits += ((height - 1) * stride) / 4; + stride = - stride; + break; + } + + /* Filter */ + filter = filters[prng_rand_n (ARRAY_LENGTH (filters))]; + if (filter == PIXMAN_FILTER_CONVOLUTION) + { + int width = prng_rand_n (3); + int height = prng_rand_n (4); + + n_coefficients = width * height + 2; + coefficients = malloc (n_coefficients * sizeof (pixman_fixed_t)); + + if (coefficients) + { + int i; + + for (i = 0; i < width * height; ++i) + coefficients[i + 2] = prng_rand(); + + coefficients[0] = width << 16; + coefficients[1] = height << 16; + } + else + { + filter = PIXMAN_FILTER_BEST; + } + } + + /* Finally create the image */ + image = pixman_image_create_bits (format, width, height, bits, stride); + if (!image) + return NULL; + + pixman_image_set_indexed (image, indexed); + pixman_image_set_destroy_function (image, destroy, indexed); + pixman_image_set_accessors (image, read_func, write_func); + pixman_image_set_filter (image, filter, coefficients, n_coefficients); + + return image; +} + +static pixman_repeat_t repeats[] = +{ + PIXMAN_REPEAT_NONE, + PIXMAN_REPEAT_NORMAL, + PIXMAN_REPEAT_REFLECT, + PIXMAN_REPEAT_PAD +}; + +static uint32_t +absolute (int32_t i) +{ + return i < 0? -i : i; +} + +static void +set_general_properties (pixman_image_t *image, pixman_bool_t allow_alpha_map) +{ + pixman_repeat_t repeat; + + /* Set properties that are generic to all images */ + + /* Repeat */ + repeat = repeats[prng_rand_n (ARRAY_LENGTH (repeats))]; + pixman_image_set_repeat (image, repeat); + + /* Alpha map */ + if (allow_alpha_map && prng_rand_n (4) == 0) + { + pixman_image_t *alpha_map; + int16_t x, y; + + alpha_map = create_random_bits_image (DONT_CARE); + + if (alpha_map) + { + set_general_properties (alpha_map, FALSE); + + x = rand_x (image) - image->bits.width / 2; + y = rand_y (image) - image->bits.height / 2; + + pixman_image_set_alpha_map (image, alpha_map, x, y); + + pixman_image_unref (alpha_map); + } + } + + /* Component alpha */ + pixman_image_set_component_alpha (image, prng_rand_n (3) == 0); + + /* Clip region */ + if (prng_rand_n (8) < 2) + { + pixman_region32_t region; + int i, n_rects; + + pixman_region32_init (®ion); + + switch (prng_rand_n (12)) + { + case 0: + n_rects = 0; + break; + + case 1: case 2: case 3: + n_rects = 1; + break; + + case 4: case 5: + n_rects = 2; + break; + + case 6: case 7: + n_rects = 3; + break; + + default: + n_rects = prng_rand_n (100); + break; + } + + for (i = 0; i < n_rects; ++i) + { + uint32_t width, height; + int x, y; + + x = log_rand(); + y = log_rand(); + width = absolute (log_rand ()) + 1; + height = absolute (log_rand ()) + 1; + + pixman_region32_union_rect ( + ®ion, ®ion, x, y, width, height); + } + + if (image->type == BITS && prng_rand_n (8) != 0) + { + uint32_t width, height; + uint32_t x, y; + int i; + + /* Also add a couple of clip rectangles inside the image + * so that compositing will actually take place. + */ + for (i = 0; i < 5; ++i) + { + x = prng_rand_n (2 * image->bits.width) - image->bits.width; + y = prng_rand_n (2 * image->bits.height) - image->bits.height; + width = prng_rand_n (image->bits.width) - x + 10; + height = prng_rand_n (image->bits.height) - y + 10; + + if (width + x < x) + width = INT32_MAX - x; + if (height + y < y) + height = INT32_MAX - y; + + pixman_region32_union_rect ( + ®ion, ®ion, x, y, width, height); + } + } + + pixman_image_set_clip_region32 (image, ®ion); + + pixman_region32_fini (®ion); + } + + /* Whether source clipping is enabled */ + pixman_image_set_source_clipping (image, !!prng_rand_n (2)); + + /* Client clip */ + pixman_image_set_has_client_clip (image, !!prng_rand_n (2)); + + /* Transform */ + if (prng_rand_n (5) < 2) + { + pixman_transform_t xform; + int i, j, k; + uint32_t tx, ty, sx, sy; + uint32_t c, s; + + memset (&xform, 0, sizeof xform); + xform.matrix[0][0] = pixman_fixed_1; + xform.matrix[1][1] = pixman_fixed_1; + xform.matrix[2][2] = pixman_fixed_1; + + for (k = 0; k < 3; ++k) + { + switch (prng_rand_n (4)) + { + case 0: + /* rotation */ + c = prng_rand_n (2 * 65536) - 65536; + s = prng_rand_n (2 * 65536) - 65536; + pixman_transform_rotate (&xform, NULL, c, s); + break; + + case 1: + /* translation */ + tx = prng_rand(); + ty = prng_rand(); + pixman_transform_translate (&xform, NULL, tx, ty); + break; + + case 2: + /* scale */ + sx = prng_rand(); + sy = prng_rand(); + pixman_transform_scale (&xform, NULL, sx, sy); + break; + + case 3: + if (prng_rand_n (16) == 0) + { + /* random */ + for (i = 0; i < 3; ++i) + for (j = 0; j < 3; ++j) + xform.matrix[i][j] = prng_rand(); + break; + } + else if (prng_rand_n (16) == 0) + { + /* zero */ + memset (&xform, 0, sizeof xform); + } + break; + } + } + + pixman_image_set_transform (image, &xform); + } +} + +static pixman_color_t +random_color (void) +{ + pixman_color_t color = + { + prng_rand() & 0xffff, + prng_rand() & 0xffff, + prng_rand() & 0xffff, + prng_rand() & 0xffff, + }; + + return color; +} + + +static pixman_image_t * +create_random_solid_image (void) +{ + pixman_color_t color = random_color(); + pixman_image_t *image = pixman_image_create_solid_fill (&color); + + return image; +} + +static pixman_gradient_stop_t * +create_random_stops (int *n_stops) +{ + pixman_fixed_t step; + pixman_fixed_t s; + int i; + pixman_gradient_stop_t *stops; + + *n_stops = prng_rand_n (50) + 1; + + step = pixman_fixed_1 / *n_stops; + + stops = malloc (*n_stops * sizeof (pixman_gradient_stop_t)); + + s = 0; + for (i = 0; i < (*n_stops) - 1; ++i) + { + stops[i].x = s; + stops[i].color = random_color(); + + s += step; + } + + stops[*n_stops - 1].x = pixman_fixed_1; + stops[*n_stops - 1].color = random_color(); + + return stops; +} + +static pixman_point_fixed_t +create_random_point (void) +{ + pixman_point_fixed_t p; + + p.x = log_rand (); + p.y = log_rand (); + + return p; +} + +static pixman_image_t * +create_random_linear_image (void) +{ + int n_stops; + pixman_gradient_stop_t *stops; + pixman_point_fixed_t p1, p2; + pixman_image_t *result; + + stops = create_random_stops (&n_stops); + if (!stops) + return NULL; + + p1 = create_random_point (); + p2 = create_random_point (); + + result = pixman_image_create_linear_gradient (&p1, &p2, stops, n_stops); + + free (stops); + + return result; +} + +static pixman_image_t * +create_random_radial_image (void) +{ + int n_stops; + pixman_gradient_stop_t *stops; + pixman_point_fixed_t inner_c, outer_c; + pixman_fixed_t inner_r, outer_r; + pixman_image_t *result; + + inner_c = create_random_point(); + outer_c = create_random_point(); + inner_r = prng_rand(); + outer_r = prng_rand(); + + stops = create_random_stops (&n_stops); + + if (!stops) + return NULL; + + result = pixman_image_create_radial_gradient ( + &inner_c, &outer_c, inner_r, outer_r, stops, n_stops); + + free (stops); + + return result; +} + +static pixman_image_t * +create_random_conical_image (void) +{ + pixman_gradient_stop_t *stops; + int n_stops; + pixman_point_fixed_t c; + pixman_fixed_t angle; + pixman_image_t *result; + + c = create_random_point(); + angle = prng_rand(); + + stops = create_random_stops (&n_stops); + + if (!stops) + return NULL; + + result = pixman_image_create_conical_gradient (&c, angle, stops, n_stops); + + free (stops); + + return result; +} + +static pixman_image_t * +create_random_image (void) +{ + pixman_image_t *result; + + switch (prng_rand_n (5)) + { + default: + case 0: + result = create_random_bits_image (DONT_CARE); + break; + + case 1: + result = create_random_solid_image (); + break; + + case 2: + result = create_random_linear_image (); + break; + + case 3: + result = create_random_radial_image (); + break; + + case 4: + result = create_random_conical_image (); + break; + } + + if (result) + set_general_properties (result, TRUE); + + return result; +} + +static void +random_line (pixman_line_fixed_t *line, int width, int height) +{ + line->p1.x = prng_rand_n (width) << 16; + line->p1.y = prng_rand_n (height) << 16; + line->p2.x = prng_rand_n (width) << 16; + line->p2.y = prng_rand_n (height) << 16; +} + +static pixman_trapezoid_t * +create_random_trapezoids (int *n_traps, int height, int width) +{ + pixman_trapezoid_t *trapezoids; + int i; + + *n_traps = prng_rand_n (16) + 1; + + trapezoids = malloc (sizeof (pixman_trapezoid_t) * *n_traps); + + for (i = 0; i < *n_traps; ++i) + { + pixman_trapezoid_t *t = &(trapezoids[i]); + + t->top = prng_rand_n (height) << 16; + t->bottom = prng_rand_n (height) << 16; + + random_line (&t->left, height, width); + random_line (&t->right, height, width); + } + + return trapezoids; +} + +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_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_MULTIPLY, + PIXMAN_OP_SCREEN, + PIXMAN_OP_OVERLAY, + PIXMAN_OP_DARKEN, + PIXMAN_OP_LIGHTEN, + PIXMAN_OP_COLOR_DODGE, + PIXMAN_OP_COLOR_BURN, + PIXMAN_OP_HARD_LIGHT, + PIXMAN_OP_DIFFERENCE, + PIXMAN_OP_EXCLUSION, + PIXMAN_OP_SOFT_LIGHT, + PIXMAN_OP_HSL_HUE, + PIXMAN_OP_HSL_SATURATION, + PIXMAN_OP_HSL_COLOR, + PIXMAN_OP_HSL_LUMINOSITY, +}; + +static void +run_test (uint32_t seed, pixman_bool_t verbose, uint32_t mod) +{ + pixman_image_t *source, *mask, *dest; + pixman_op_t op; + + if (verbose) + { + if (mod == 0 || (seed % mod) == 0) + printf ("Seed 0x%08x\n", seed); + } + + source = mask = dest = NULL; + + prng_srand (seed); + + if (prng_rand_n (8) == 0) + { + int n_traps; + pixman_trapezoid_t *trapezoids; + int p = prng_rand_n (3); + + if (p == 0) + dest = create_random_bits_image (DONT_CARE); + else + dest = create_random_bits_image (REQUIRE_ALPHA); + + if (!dest) + goto out; + + set_general_properties (dest, TRUE); + + if (!(trapezoids = create_random_trapezoids ( + &n_traps, dest->bits.width, dest->bits.height))) + { + goto out; + } + + switch (p) + { + case 0: + source = create_random_image (); + + if (source) + { + op = op_list [prng_rand_n (ARRAY_LENGTH (op_list))]; + + pixman_composite_trapezoids ( + op, source, dest, + random_format (REQUIRE_ALPHA), + rand_x (source), rand_y (source), + rand_x (dest), rand_y (dest), + n_traps, trapezoids); + } + break; + + case 1: + pixman_rasterize_trapezoid ( + dest, &trapezoids[prng_rand_n (n_traps)], + rand_x (dest), rand_y (dest)); + break; + + case 2: + pixman_add_trapezoids ( + dest, rand_x (dest), rand_y (dest), n_traps, trapezoids); + break; + } + + free (trapezoids); + } + else + { + dest = create_random_bits_image (DONT_CARE); + source = create_random_image (); + mask = create_random_image (); + + if (source && mask && dest) + { + set_general_properties (dest, TRUE); + + op = op_list [prng_rand_n (ARRAY_LENGTH (op_list))]; + + pixman_image_composite32 (op, + source, mask, dest, + rand_x (source), rand_y (source), + rand_x (mask), rand_y (mask), + 0, 0, + dest->bits.width, + dest->bits.height); + } + } + +out: + if (source) + pixman_image_unref (source); + if (mask) + pixman_image_unref (mask); + if (dest) + pixman_image_unref (dest); +} + +static pixman_bool_t +get_int (char *s, uint32_t *i) +{ + char *end; + int p; + + p = strtol (s, &end, 0); + + if (end != s && *end == 0) + { + *i = p; + return TRUE; + } + + return FALSE; +} + +int +main (int argc, char **argv) +{ + int verbose = FALSE; + uint32_t seed = 1; + uint32_t n_tests = 8000; + uint32_t mod = 0; + pixman_bool_t use_threads = TRUE; + int32_t i; + + pixman_disable_out_of_bounds_workaround (); + + enable_divbyzero_exceptions(); + + if (getenv ("VERBOSE") != NULL) + verbose = TRUE; + + for (i = 1; i < argc; ++i) + { + if (strcmp (argv[i], "-v") == 0) + { + verbose = TRUE; + + if (i + 1 < argc) + { + get_int (argv[i + 1], &mod); + i++; + } + } + else if (strcmp (argv[i], "-s") == 0 && i + 1 < argc) + { + get_int (argv[i + 1], &seed); + use_threads = FALSE; + i++; + } + else if (strcmp (argv[i], "-n") == 0 && i + 1 < argc) + { + get_int (argv[i + 1], &n_tests); + i++; + } + else + { + if (strcmp (argv[i], "-h") != 0) + printf ("Unknown option '%s'\n\n", argv[i]); + + printf ("Options:\n\n" + "-n <number> Number of tests to run\n" + "-s <seed> Seed of first test (ignored if PIXMAN_RANDOMIZE_TESTS is set)\n" + "-v Print out seeds\n" + "-v <n> Print out every n'th seed\n\n"); + + exit (-1); + } + } + + if (getenv ("PIXMAN_RANDOMIZE_TESTS")) + { + seed = get_random_seed(); + printf ("First seed: 0x%08x\n", seed); + } + + if (use_threads) + { +#ifdef USE_OPENMP +# pragma omp parallel for default(none) shared(verbose, n_tests, mod, seed) +#endif + for (i = 0; i < (int32_t)n_tests; ++i) + run_test (seed + i, verbose, mod); + } + else + { + for (i = 0; i < (int32_t)n_tests; ++i) + run_test (seed + i, verbose, mod); + } + + return 0; +} diff --git a/libs/pixman-0.40.0/test/thread-test.c b/libs/pixman-0.40.0/test/thread-test.c new file mode 100644 index 0000000..12c51e3 --- /dev/null +++ b/libs/pixman-0.40.0/test/thread-test.c @@ -0,0 +1,231 @@ +#include "utils.h" + +#if !defined (HAVE_PTHREADS) && !defined (_WIN32) + +int main () +{ + printf ("Skipped thread-test - pthreads or Windows Threads not supported\n"); + return 0; +} + +#else + +#include <stdlib.h> + +#ifdef HAVE_PTHREADS +# include <pthread.h> +#elif defined (_WIN32) +# define WIN32_LEAN_AND_MEAN +# include <windows.h> +#endif + +#define THREADS 16 + +typedef struct +{ + int thread_no; + uint32_t *dst_buf; + prng_t prng_state; +#if defined (_WIN32) && !defined (HAVE_PTHREADS) + uint32_t crc32; +#endif +} info_t; + +static const pixman_op_t operators[] = +{ + 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, +}; + +static const pixman_format_code_t formats[] = +{ + PIXMAN_a8r8g8b8, + PIXMAN_r5g6b5, + PIXMAN_a8, + PIXMAN_a4, + PIXMAN_a1, + PIXMAN_b5g6r5, + PIXMAN_r8g8b8a8, + PIXMAN_a4r4g4b4 +}; + +#define N_ROUNDS 8192 + +#define RAND_ELT(arr) \ + arr[prng_rand_r(&info->prng_state) % ARRAY_LENGTH (arr)] + +#define DEST_WIDTH (7) + +#ifdef HAVE_PTHREADS +static void * +thread (void *data) +#elif defined (_WIN32) +DWORD WINAPI +thread (LPVOID data) +#endif +{ + info_t *info = data; + uint32_t crc32 = 0x0; + uint32_t src_buf[64]; + pixman_image_t *dst_img, *src_img; + int i; + + prng_srand_r (&info->prng_state, info->thread_no); + + for (i = 0; i < N_ROUNDS; ++i) + { + pixman_op_t op; + int rand1, rand2; + + prng_randmemset_r (&info->prng_state, info->dst_buf, + DEST_WIDTH * sizeof (uint32_t), 0); + prng_randmemset_r (&info->prng_state, src_buf, + sizeof (src_buf), 0); + + src_img = pixman_image_create_bits ( + RAND_ELT (formats), 4, 4, src_buf, 16); + dst_img = pixman_image_create_bits ( + RAND_ELT (formats), DEST_WIDTH, 1, info->dst_buf, + DEST_WIDTH * sizeof (uint32_t)); + + image_endian_swap (src_img); + image_endian_swap (dst_img); + + rand2 = prng_rand_r (&info->prng_state) % 4; + rand1 = prng_rand_r (&info->prng_state) % 4; + op = RAND_ELT (operators); + + pixman_image_composite32 ( + op, + src_img, NULL, dst_img, + rand1, rand2, 0, 0, 0, 0, DEST_WIDTH, 1); + + crc32 = compute_crc32_for_image (crc32, dst_img); + + pixman_image_unref (src_img); + pixman_image_unref (dst_img); + } + +#ifdef HAVE_PTHREADS + return (void *)(uintptr_t)crc32; +#elif defined (_WIN32) + info->crc32 = crc32; + return 0; +#endif +} + +static inline uint32_t +byteswap32 (uint32_t x) +{ + return ((x & ((uint32_t)0xFF << 24)) >> 24) | + ((x & ((uint32_t)0xFF << 16)) >> 8) | + ((x & ((uint32_t)0xFF << 8)) << 8) | + ((x & ((uint32_t)0xFF << 0)) << 24); +} + +int +main (void) +{ + uint32_t dest[THREADS * DEST_WIDTH]; + info_t info[THREADS] = { { 0 } }; + +#ifdef HAVE_PTHREADS + pthread_t threads[THREADS]; + void *retvals[THREADS]; +#elif defined (_WIN32) + HANDLE hThreadArray[THREADS]; + DWORD dwThreadIdArray[THREADS]; +#endif + + uint32_t crc32s[THREADS], crc32; + int i; + + for (i = 0; i < THREADS; ++i) + { + info[i].thread_no = i; + info[i].dst_buf = &dest[i * DEST_WIDTH]; + } + +#ifdef HAVE_PTHREADS + for (i = 0; i < THREADS; ++i) + pthread_create (&threads[i], NULL, thread, &info[i]); + + for (i = 0; i < THREADS; ++i) + pthread_join (threads[i], &retvals[i]); + + for (i = 0; i < THREADS; ++i) + { + crc32s[i] = (uintptr_t)retvals[i]; + + if (is_little_endian()) + crc32s[i] = byteswap32 (crc32s[i]); + } + +#elif defined (_WIN32) + for (i = 0; i < THREADS; ++i) + { + hThreadArray[i] = CreateThread(NULL, + 0, + thread, + &info[i], + 0, + &dwThreadIdArray[i]); + if (hThreadArray[i] == NULL) + { + printf ("Windows thread creation failed!\n"); + return 1; + } + } + for (i = 0; i < THREADS; ++i) + { + WaitForSingleObject (hThreadArray[i], INFINITE); + CloseHandle(hThreadArray[i]); + } + + for (i = 0; i < THREADS; ++i) + { + crc32s[i] = info[i].crc32; + + if (is_little_endian()) + crc32s[i] = byteswap32 (crc32s[i]); + } +#endif + + crc32 = compute_crc32 (0, crc32s, sizeof crc32s); + +#define EXPECTED 0x82C4D9FB + + if (crc32 != EXPECTED) + { + printf ("thread-test failed. Got checksum 0x%08X, expected 0x%08X\n", + crc32, EXPECTED); + return 1; + } + + return 0; +} + +#endif + diff --git a/libs/pixman-0.40.0/test/tolerance-test.c b/libs/pixman-0.40.0/test/tolerance-test.c new file mode 100644 index 0000000..3c6e818 --- /dev/null +++ b/libs/pixman-0.40.0/test/tolerance-test.c @@ -0,0 +1,379 @@ +#include <assert.h> +#include <stdlib.h> +#include <stdio.h> +#include <float.h> +#include <math.h> +#include "utils.h" + +#define MAX_WIDTH 16 +#define MAX_HEIGHT 16 +#define MAX_STRIDE 4 + +static const pixman_format_code_t formats[] = +{ + PIXMAN_a2r10g10b10, + PIXMAN_x2r10g10b10, + PIXMAN_a8r8g8b8, + PIXMAN_a4r4g4b4, + PIXMAN_a2r2g2b2, + PIXMAN_r5g6b5, + PIXMAN_r3g3b2, +}; + +static const pixman_op_t operators[] = +{ + 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_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_MULTIPLY, + PIXMAN_OP_SCREEN, + PIXMAN_OP_OVERLAY, + PIXMAN_OP_DARKEN, + PIXMAN_OP_LIGHTEN, + PIXMAN_OP_COLOR_DODGE, + PIXMAN_OP_COLOR_BURN, + PIXMAN_OP_HARD_LIGHT, + PIXMAN_OP_SOFT_LIGHT, + PIXMAN_OP_DIFFERENCE, + PIXMAN_OP_EXCLUSION, +}; + +static const pixman_dither_t dithers[] = +{ + PIXMAN_DITHER_ORDERED_BAYER_8, + PIXMAN_DITHER_ORDERED_BLUE_NOISE_64, +}; + +#define RANDOM_ELT(array) \ + (array[prng_rand_n (ARRAY_LENGTH (array))]) + +static void +free_bits (pixman_image_t *image, void *data) +{ + free (image->bits.bits); +} + +static pixman_image_t * +create_image (pixman_image_t **clone) +{ + pixman_format_code_t format = RANDOM_ELT (formats); + pixman_image_t *image; + int width = prng_rand_n (MAX_WIDTH); + int height = prng_rand_n (MAX_HEIGHT); + int stride = ((width * (PIXMAN_FORMAT_BPP (format) / 8)) + 3) & ~3; + uint32_t *bytes = malloc (stride * height); + + prng_randmemset (bytes, stride * height, RANDMEMSET_MORE_00_AND_FF); + + image = pixman_image_create_bits ( + format, width, height, bytes, stride); + + pixman_image_set_destroy_function (image, free_bits, NULL); + + assert (image); + + if (clone) + { + uint32_t *bytes_dup = malloc (stride * height); + + memcpy (bytes_dup, bytes, stride * height); + + *clone = pixman_image_create_bits ( + format, width, height, bytes_dup, stride); + + pixman_image_set_destroy_function (*clone, free_bits, NULL); + } + + return image; +} + +static pixman_bool_t +access (pixman_image_t *image, int x, int y, uint32_t *pixel) +{ + int bytes_per_pixel; + int stride; + uint8_t *location; + + if (x < 0 || x >= image->bits.width || y < 0 || y >= image->bits.height) + return FALSE; + + bytes_per_pixel = PIXMAN_FORMAT_BPP (image->bits.format) / 8; + stride = image->bits.rowstride * 4; + + location = (uint8_t *)image->bits.bits + y * stride + x * bytes_per_pixel; + + if (bytes_per_pixel == 4) + *pixel = *(uint32_t *)location; + else if (bytes_per_pixel == 2) + *pixel = *(uint16_t *)location; + else if (bytes_per_pixel == 1) + *pixel = *(uint8_t *)location; + else + assert (0); + + return TRUE; +} + +static void +get_color (pixel_checker_t *checker, + pixman_image_t *image, + int x, int y, + color_t *color, + uint32_t *pixel) +{ + if (!access (image, x, y, pixel)) + { + color->a = 0.0; + color->r = 0.0; + color->g = 0.0; + color->b = 0.0; + } + else + { + pixel_checker_convert_pixel_to_color ( + checker, *pixel, color); + } +} + +static pixman_bool_t +verify (int test_no, + pixman_op_t op, + pixman_image_t *source, + pixman_image_t *mask, + pixman_image_t *dest, + pixman_image_t *orig_dest, + int x, int y, + int width, int height, + pixman_bool_t component_alpha, + pixman_dither_t dither) +{ + pixel_checker_t dest_checker, src_checker, mask_checker; + int i, j; + + pixel_checker_init (&src_checker, source->bits.format); + pixel_checker_init (&dest_checker, dest->bits.format); + pixel_checker_init (&mask_checker, mask->bits.format); + + if (dest->bits.dither != PIXMAN_DITHER_NONE) + pixel_checker_allow_dither (&dest_checker); + + assert (dest->bits.format == orig_dest->bits.format); + + for (j = y; j < y + height; ++j) + { + for (i = x; i < x + width; ++i) + { + color_t src_color, mask_color, orig_dest_color, result; + uint32_t dest_pixel, orig_dest_pixel, src_pixel, mask_pixel; + + access (dest, i, j, &dest_pixel); + + get_color (&src_checker, + source, i - x, j - y, + &src_color, &src_pixel); + + get_color (&mask_checker, + mask, i - x, j - y, + &mask_color, &mask_pixel); + + get_color (&dest_checker, + orig_dest, i, j, + &orig_dest_color, &orig_dest_pixel); + + do_composite (op, + &src_color, &mask_color, &orig_dest_color, + &result, component_alpha); + + if (!pixel_checker_check (&dest_checker, dest_pixel, &result)) + { + int a, r, g, b; + + printf ("--------- Test 0x%x failed ---------\n", test_no); + + printf (" operator: %s (%s alpha)\n", operator_name (op), + component_alpha? "component" : "unified"); + printf (" dither: %s\n", dither_name (dither)); + printf (" dest_x, dest_y: %d %d\n", x, y); + printf (" width, height: %d %d\n", width, height); + printf (" source: format: %-14s size: %2d x %2d\n", + format_name (source->bits.format), + source->bits.width, source->bits.height); + printf (" mask: format: %-14s size: %2d x %2d\n", + format_name (mask->bits.format), + mask->bits.width, mask->bits.height); + printf (" dest: format: %-14s size: %2d x %2d\n", + format_name (dest->bits.format), + dest->bits.width, dest->bits.height); + printf (" -- Failed pixel: (%d, %d) --\n", i, j); + printf (" source ARGB: %f %f %f %f (pixel: %x)\n", + src_color.a, src_color.r, src_color.g, src_color.b, + src_pixel); + printf (" mask ARGB: %f %f %f %f (pixel: %x)\n", + mask_color.a, mask_color.r, mask_color.g, mask_color.b, + mask_pixel); + printf (" dest ARGB: %f %f %f %f (pixel: %x)\n", + orig_dest_color.a, orig_dest_color.r, orig_dest_color.g, orig_dest_color.b, + orig_dest_pixel); + printf (" expected ARGB: %f %f %f %f\n", + result.a, result.r, result.g, result.b); + + pixel_checker_get_min (&dest_checker, &result, &a, &r, &g, &b); + printf (" min acceptable: %8d %8d %8d %8d\n", a, r, g, b); + + pixel_checker_split_pixel (&dest_checker, dest_pixel, &a, &r, &g, &b); + printf (" got: %8d %8d %8d %8d (pixel: %x)\n", a, r, g, b, dest_pixel); + + pixel_checker_get_max (&dest_checker, &result, &a, &r, &g, &b); + printf (" max acceptable: %8d %8d %8d %8d\n", a, r, g, b); + printf ("\n"); + printf (" { %s,\n", operator_name (op)); + printf (" PIXMAN_%s,\t0x%x,\n", format_name (source->bits.format), src_pixel); + printf (" PIXMAN_%s,\t0x%x,\n", format_name (mask->bits.format), mask_pixel); + printf (" PIXMAN_%s,\t0x%x\n", format_name (dest->bits.format), orig_dest_pixel); + printf (" },\n"); + return FALSE; + } + } + } + + return TRUE; +} + +static pixman_bool_t +do_check (int i) +{ + pixman_image_t *source, *dest, *mask; + pixman_op_t op; + int x, y, width, height; + pixman_image_t *dest_copy; + pixman_bool_t result = TRUE; + pixman_bool_t component_alpha; + pixman_dither_t dither = PIXMAN_DITHER_NONE; + + prng_srand (i); + op = RANDOM_ELT (operators); + x = prng_rand_n (MAX_WIDTH); + y = prng_rand_n (MAX_HEIGHT); + width = prng_rand_n (MAX_WIDTH) + 4; + height = prng_rand_n (MAX_HEIGHT) + 4; + + source = create_image (NULL); + mask = create_image (NULL); + dest = create_image (&dest_copy); + + if (x >= dest->bits.width) + x = dest->bits.width / 2; + if (y >= dest->bits.height) + y = dest->bits.height / 2; + if (x + width > dest->bits.width) + width = dest->bits.width - x; + if (y + height > dest->bits.height) + height = dest->bits.height - y; + + if (prng_rand_n (2)) + { + dither = RANDOM_ELT (dithers); + pixman_image_set_dither (dest, dither); + } + + component_alpha = prng_rand_n (2); + + pixman_image_set_component_alpha (mask, component_alpha); + + pixman_image_composite32 (op, source, mask, dest, + 0, 0, 0, 0, + x, y, width, height); + + if (!verify (i, op, source, mask, dest, dest_copy, + x, y, width, height, component_alpha, + dither)) + { + result = FALSE; + } + + pixman_image_unref (source); + pixman_image_unref (mask); + pixman_image_unref (dest); + pixman_image_unref (dest_copy); + + return result; +} + +#define N_TESTS 10000000 + +int +main (int argc, const char *argv[]) +{ + int i; + int result = 0; + + if (argc == 2) + { + if (strcmp (argv[1], "--forever") == 0) + { + uint32_t n; + + prng_srand (time (0)); + + n = prng_rand(); + + for (;;) + do_check (n++); + } + else + { + do_check (strtol (argv[1], NULL, 0)); + } + } + else + { +#ifdef USE_OPENMP +# pragma omp parallel for default(none) reduction(|:result) +#endif + for (i = 0; i < N_TESTS; ++i) + { + if (!do_check (i)) + result |= 1; + } + } + + return result; +} diff --git a/libs/pixman-0.40.0/test/trap-crasher.c b/libs/pixman-0.40.0/test/trap-crasher.c new file mode 100644 index 0000000..77be1c9 --- /dev/null +++ b/libs/pixman-0.40.0/test/trap-crasher.c @@ -0,0 +1,39 @@ +#include <stdlib.h> +#include "utils.h" + +int +main() +{ + pixman_image_t *dst; + pixman_trapezoid_t traps[] = { + { + 2147483646, + 2147483647, + { + { 0, 0 }, + { 0, 2147483647 } + }, + { + { 65536, 0 }, + { 0, 2147483647 } + } + }, + { + 32768, + - 2147483647, + { + { 0, 0 }, + { 0, 2147483647 } + }, + { + { 65536, 0 }, + { 0, 2147483647 } + } + }, + }; + + dst = pixman_image_create_bits (PIXMAN_a8, 1, 1, NULL, -1); + + pixman_add_trapezoids (dst, 0, 0, ARRAY_LENGTH (traps), traps); + return (0); +} diff --git a/libs/pixman-0.40.0/test/utils-prng.c b/libs/pixman-0.40.0/test/utils-prng.c new file mode 100644 index 0000000..0cf53dd --- /dev/null +++ b/libs/pixman-0.40.0/test/utils-prng.c @@ -0,0 +1,311 @@ +/* + * Copyright © 2012 Siarhei Siamashka <siarhei.siamashka@gmail.com> + * + * Based on the public domain implementation of small noncryptographic PRNG + * authored by Bob Jenkins: http://burtleburtle.net/bob/rand/smallprng.html + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include "utils.h" +#include "utils-prng.h" + +#if defined(HAVE_GCC_VECTOR_EXTENSIONS) && defined(__SSE2__) +#include <xmmintrin.h> +#endif + +void smallprng_srand_r (smallprng_t *x, uint32_t seed) +{ + uint32_t i; + x->a = 0xf1ea5eed, x->b = x->c = x->d = seed; + for (i = 0; i < 20; ++i) + smallprng_rand_r (x); +} + +/* + * Set a 32-bit seed for PRNG + * + * LCG is used here for generating independent seeds for different + * smallprng instances (in the case if smallprng is also used for + * generating these seeds, "Big Crush" test from TestU01 detects + * some problems in the glued 'prng_rand_128_r' output data). + * Actually we might be even better using some cryptographic + * hash for this purpose, but LCG seems to be also enough for + * passing "Big Crush". + */ +void prng_srand_r (prng_t *x, uint32_t seed) +{ +#ifdef HAVE_GCC_VECTOR_EXTENSIONS + int i; + prng_rand_128_data_t dummy; + smallprng_srand_r (&x->p0, seed); + x->a[0] = x->a[1] = x->a[2] = x->a[3] = 0xf1ea5eed; + x->b[0] = x->c[0] = x->d[0] = (seed = seed * 1103515245 + 12345); + x->b[1] = x->c[1] = x->d[1] = (seed = seed * 1103515245 + 12345); + x->b[2] = x->c[2] = x->d[2] = (seed = seed * 1103515245 + 12345); + x->b[3] = x->c[3] = x->d[3] = (seed = seed * 1103515245 + 12345); + for (i = 0; i < 20; ++i) + prng_rand_128_r (x, &dummy); +#else + smallprng_srand_r (&x->p0, seed); + smallprng_srand_r (&x->p1, (seed = seed * 1103515245 + 12345)); + smallprng_srand_r (&x->p2, (seed = seed * 1103515245 + 12345)); + smallprng_srand_r (&x->p3, (seed = seed * 1103515245 + 12345)); + smallprng_srand_r (&x->p4, (seed = seed * 1103515245 + 12345)); +#endif +} + +static force_inline void +store_rand_128_data (void *addr, prng_rand_128_data_t *d, int aligned) +{ +#ifdef HAVE_GCC_VECTOR_EXTENSIONS + if (aligned) + { + *(uint8x16 *)addr = d->vb; + return; + } + else + { +#ifdef __SSE2__ + /* workaround for http://gcc.gnu.org/PR55614 */ + _mm_storeu_si128 (addr, _mm_loadu_si128 ((__m128i *)d)); + return; +#endif + } +#endif + /* we could try something better for unaligned writes (packed attribute), + * but GCC is not very reliable: http://gcc.gnu.org/PR55454 */ + memcpy (addr, d, 16); +} + +/* + * Helper function and the actual code for "prng_randmemset_r" function + */ +static force_inline void +randmemset_internal (prng_t *prng, + uint8_t *buf, + size_t size, + prng_randmemset_flags_t flags, + int aligned) +{ + prng_t local_prng = *prng; + prng_rand_128_data_t randdata; + size_t i; + + while (size >= 16) + { + prng_rand_128_data_t t; + if (flags == 0) + { + prng_rand_128_r (&local_prng, &randdata); + } + else + { + prng_rand_128_r (&local_prng, &t); + prng_rand_128_r (&local_prng, &randdata); +#ifdef HAVE_GCC_VECTOR_EXTENSIONS + if (flags & RANDMEMSET_MORE_FF) + { + const uint8x16 const_C0 = + { + 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, + 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0 + }; + randdata.vb |= (t.vb >= const_C0); + } + if (flags & RANDMEMSET_MORE_00) + { + const uint8x16 const_40 = + { + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 + }; + randdata.vb &= (t.vb >= const_40); + } + if (flags & RANDMEMSET_MORE_FFFFFFFF) + { + const uint32x4 const_C0000000 = + { + 0xC0000000, 0xC0000000, 0xC0000000, 0xC0000000 + }; + randdata.vw |= ((t.vw << 30) >= const_C0000000); + } + if (flags & RANDMEMSET_MORE_00000000) + { + const uint32x4 const_40000000 = + { + 0x40000000, 0x40000000, 0x40000000, 0x40000000 + }; + randdata.vw &= ((t.vw << 30) >= const_40000000); + } +#else + #define PROCESS_ONE_LANE(i) \ + if (flags & RANDMEMSET_MORE_FF) \ + { \ + uint32_t mask_ff = (t.w[i] & (t.w[i] << 1)) & 0x80808080; \ + mask_ff |= mask_ff >> 1; \ + mask_ff |= mask_ff >> 2; \ + mask_ff |= mask_ff >> 4; \ + randdata.w[i] |= mask_ff; \ + } \ + if (flags & RANDMEMSET_MORE_00) \ + { \ + uint32_t mask_00 = (t.w[i] | (t.w[i] << 1)) & 0x80808080; \ + mask_00 |= mask_00 >> 1; \ + mask_00 |= mask_00 >> 2; \ + mask_00 |= mask_00 >> 4; \ + randdata.w[i] &= mask_00; \ + } \ + if (flags & RANDMEMSET_MORE_FFFFFFFF) \ + { \ + int32_t mask_ff = ((t.w[i] << 30) & (t.w[i] << 31)) & \ + 0x80000000; \ + randdata.w[i] |= mask_ff >> 31; \ + } \ + if (flags & RANDMEMSET_MORE_00000000) \ + { \ + int32_t mask_00 = ((t.w[i] << 30) | (t.w[i] << 31)) & \ + 0x80000000; \ + randdata.w[i] &= mask_00 >> 31; \ + } + + PROCESS_ONE_LANE (0) + PROCESS_ONE_LANE (1) + PROCESS_ONE_LANE (2) + PROCESS_ONE_LANE (3) +#endif + } + if (is_little_endian ()) + { + store_rand_128_data (buf, &randdata, aligned); + buf += 16; + } + else + { + +#ifndef __has_builtin +#define __has_builtin(x) 0 +#endif + +#ifdef HAVE_GCC_VECTOR_EXTENSIONS +# if __has_builtin(__builtin_shufflevector) + randdata.vb = + __builtin_shufflevector (randdata.vb, randdata.vb, + 3, 2, 1, 0, 7, 6 , 5, 4, + 11, 10, 9, 8, 15, 14, 13, 12); +# else + static const uint8x16 bswap_shufflemask = + { + 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 + }; + randdata.vb = __builtin_shuffle (randdata.vb, bswap_shufflemask); +# endif + + store_rand_128_data (buf, &randdata, aligned); + buf += 16; +#else + uint8_t t1, t2, t3, t4; + #define STORE_ONE_LANE(i) \ + t1 = randdata.b[i * 4 + 3]; \ + t2 = randdata.b[i * 4 + 2]; \ + t3 = randdata.b[i * 4 + 1]; \ + t4 = randdata.b[i * 4 + 0]; \ + *buf++ = t1; \ + *buf++ = t2; \ + *buf++ = t3; \ + *buf++ = t4; + + STORE_ONE_LANE (0) + STORE_ONE_LANE (1) + STORE_ONE_LANE (2) + STORE_ONE_LANE (3) +#endif + } + size -= 16; + } + i = 0; + while (i < size) + { + uint8_t randbyte = prng_rand_r (&local_prng) & 0xFF; + if (flags != 0) + { + uint8_t t = prng_rand_r (&local_prng) & 0xFF; + if ((flags & RANDMEMSET_MORE_FF) && (t >= 0xC0)) + randbyte = 0xFF; + if ((flags & RANDMEMSET_MORE_00) && (t < 0x40)) + randbyte = 0x00; + if (i % 4 == 0 && i + 4 <= size) + { + t = prng_rand_r (&local_prng) & 0xFF; + if ((flags & RANDMEMSET_MORE_FFFFFFFF) && (t >= 0xC0)) + { + memset(&buf[i], 0xFF, 4); + i += 4; + continue; + } + if ((flags & RANDMEMSET_MORE_00000000) && (t < 0x40)) + { + memset(&buf[i], 0x00, 4); + i += 4; + continue; + } + } + } + buf[i] = randbyte; + i++; + } + *prng = local_prng; +} + +/* + * Fill memory buffer with random data. Flags argument may be used + * to tweak some statistics properties: + * RANDMEMSET_MORE_00 - set ~25% of bytes to 0x00 + * RANDMEMSET_MORE_FF - set ~25% of bytes to 0xFF + * RANDMEMSET_MORE_00000000 - ~25% chance for 00000000 4-byte clusters + * RANDMEMSET_MORE_FFFFFFFF - ~25% chance for FFFFFFFF 4-byte clusters + */ +void prng_randmemset_r (prng_t *prng, + void *voidbuf, + size_t size, + prng_randmemset_flags_t flags) +{ + uint8_t *buf = (uint8_t *)voidbuf; + if ((uintptr_t)buf & 15) + { + /* unaligned buffer */ + if (flags == 0) + randmemset_internal (prng, buf, size, 0, 0); + else if (flags == RANDMEMSET_MORE_00_AND_FF) + randmemset_internal (prng, buf, size, RANDMEMSET_MORE_00_AND_FF, 0); + else + randmemset_internal (prng, buf, size, flags, 0); + } + else + { + /* aligned buffer */ + if (flags == 0) + randmemset_internal (prng, buf, size, 0, 1); + else if (flags == RANDMEMSET_MORE_00_AND_FF) + randmemset_internal (prng, buf, size, RANDMEMSET_MORE_00_AND_FF, 1); + else + randmemset_internal (prng, buf, size, flags, 1); + } +} diff --git a/libs/pixman-0.40.0/test/utils-prng.h b/libs/pixman-0.40.0/test/utils-prng.h new file mode 100644 index 0000000..f9ae8dd --- /dev/null +++ b/libs/pixman-0.40.0/test/utils-prng.h @@ -0,0 +1,170 @@ +/* + * Copyright © 2012 Siarhei Siamashka <siarhei.siamashka@gmail.com> + * + * Based on the public domain implementation of small noncryptographic PRNG + * authored by Bob Jenkins: http://burtleburtle.net/bob/rand/smallprng.html + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef __UTILS_PRNG_H__ +#define __UTILS_PRNG_H__ + +/* + * This file provides a fast SIMD-optimized noncryptographic PRNG (pseudorandom + * number generator), with the output good enough to pass "Big Crush" tests + * from TestU01 (http://en.wikipedia.org/wiki/TestU01). + * + * SIMD code uses http://gcc.gnu.org/onlinedocs/gcc/Vector-Extensions.html + * which is a GCC specific extension. There is also a slower alternative + * code path, which should work with any C compiler. + * + * The "prng_t" structure keeps the internal state of the random number + * generator. It is possible to have multiple instances of the random number + * generator active at the same time, in this case each of them needs to have + * its own "prng_t". All the functions take a pointer to "prng_t" + * as the first argument. + * + * Functions: + * + * ---------------------------------------------------------------------------- + * void prng_srand_r (prng_t *prng, uint32_t seed); + * + * Initialize the pseudorandom number generator. The sequence of preudorandom + * numbers is deterministic and only depends on "seed". Any two generators + * initialized with the same seed will produce exactly the same sequence. + * + * ---------------------------------------------------------------------------- + * uint32_t prng_rand_r (prng_t *prng); + * + * Generate a single uniformly distributed 32-bit pseudorandom value. + * + * ---------------------------------------------------------------------------- + * void prng_randmemset_r (prng_t *prng, + * void *buffer, + * size_t size, + * prng_randmemset_flags_t flags); + * + * Fills the memory buffer "buffer" with "size" bytes of pseudorandom data. + * The "flags" argument may be used to tweak some statistics properties: + * RANDMEMSET_MORE_00 - set ~25% of bytes to 0x00 + * RANDMEMSET_MORE_FF - set ~25% of bytes to 0xFF + * The flags can be combined. This allows a bit better simulation of typical + * pixel data, which normally contains a lot of fully transparent or fully + * opaque pixels. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "pixman-private.h" + +/*****************************************************************************/ + +#ifdef HAVE_GCC_VECTOR_EXTENSIONS +typedef uint32_t uint32x4 __attribute__ ((vector_size(16))); +typedef uint8_t uint8x16 __attribute__ ((vector_size(16))); +#endif + +typedef struct +{ + uint32_t a, b, c, d; +} smallprng_t; + +typedef struct +{ +#ifdef HAVE_GCC_VECTOR_EXTENSIONS + uint32x4 a, b, c, d; +#else + smallprng_t p1, p2, p3, p4; +#endif + smallprng_t p0; +} prng_t; + +typedef union +{ + uint8_t b[16]; + uint32_t w[4]; +#ifdef HAVE_GCC_VECTOR_EXTENSIONS + uint8x16 vb; + uint32x4 vw; +#endif +} prng_rand_128_data_t; + +/*****************************************************************************/ + +static force_inline uint32_t +smallprng_rand_r (smallprng_t *x) +{ + uint32_t e = x->a - ((x->b << 27) + (x->b >> (32 - 27))); + x->a = x->b ^ ((x->c << 17) ^ (x->c >> (32 - 17))); + x->b = x->c + x->d; + x->c = x->d + e; + x->d = e + x->a; + return x->d; +} + +/* Generate 4 bytes (32-bits) of random data */ +static force_inline uint32_t +prng_rand_r (prng_t *x) +{ + return smallprng_rand_r (&x->p0); +} + +/* Generate 16 bytes (128-bits) of random data */ +static force_inline void +prng_rand_128_r (prng_t *x, prng_rand_128_data_t *data) +{ +#ifdef HAVE_GCC_VECTOR_EXTENSIONS + uint32x4 e = x->a - ((x->b << 27) + (x->b >> (32 - 27))); + x->a = x->b ^ ((x->c << 17) ^ (x->c >> (32 - 17))); + x->b = x->c + x->d; + x->c = x->d + e; + x->d = e + x->a; + data->vw = x->d; +#else + data->w[0] = smallprng_rand_r (&x->p1); + data->w[1] = smallprng_rand_r (&x->p2); + data->w[2] = smallprng_rand_r (&x->p3); + data->w[3] = smallprng_rand_r (&x->p4); +#endif +} + +typedef enum +{ + RANDMEMSET_MORE_00 = 1, /* ~25% chance for 0x00 bytes */ + RANDMEMSET_MORE_FF = 2, /* ~25% chance for 0xFF bytes */ + RANDMEMSET_MORE_00000000 = 4, /* ~25% chance for 0x00000000 clusters */ + RANDMEMSET_MORE_FFFFFFFF = 8, /* ~25% chance for 0xFFFFFFFF clusters */ + RANDMEMSET_MORE_00_AND_FF = (RANDMEMSET_MORE_00 | RANDMEMSET_MORE_00000000 | + RANDMEMSET_MORE_FF | RANDMEMSET_MORE_FFFFFFFF) +} prng_randmemset_flags_t; + +/* Set the 32-bit seed for PRNG */ +void prng_srand_r (prng_t *prng, uint32_t seed); + +/* Fill memory buffer with random data */ +void prng_randmemset_r (prng_t *prng, + void *buffer, + size_t size, + prng_randmemset_flags_t flags); + +#endif diff --git a/libs/pixman-0.40.0/test/utils.c b/libs/pixman-0.40.0/test/utils.c new file mode 100644 index 0000000..cd9ab26 --- /dev/null +++ b/libs/pixman-0.40.0/test/utils.c @@ -0,0 +1,2288 @@ +#define _GNU_SOURCE + +#include "utils.h" +#include <math.h> +#include <signal.h> +#include <stdlib.h> +#include <float.h> +#include <ctype.h> +#include <limits.h> + +#ifdef HAVE_GETTIMEOFDAY +#include <sys/time.h> +#else +#include <time.h> +#endif + +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +#ifdef HAVE_SYS_MMAN_H +#include <sys/mman.h> +#endif + +#ifdef HAVE_FENV_H +#include <fenv.h> +#endif + +#ifdef HAVE_LIBPNG +#include <png.h> +#endif + +#define ROUND_UP(x, mult) (((x) + (mult) - 1) / (mult) * (mult)) + +/* Random number generator state + */ + +prng_t prng_state_data; +prng_t *prng_state; + +/*----------------------------------------------------------------------------*\ + * CRC-32 version 2.0.0 by Craig Bruce, 2006-04-29. + * + * This program generates the CRC-32 values for the files named in the + * command-line arguments. These are the same CRC-32 values used by GZIP, + * PKZIP, and ZMODEM. The Crc32_ComputeBuf () can also be detached and + * used independently. + * + * THIS PROGRAM IS PUBLIC-DOMAIN SOFTWARE. + * + * Based on the byte-oriented implementation "File Verification Using CRC" + * by Mark R. Nelson in Dr. Dobb's Journal, May 1992, pp. 64-67. + * + * v1.0.0: original release. + * v1.0.1: fixed printf formats. + * v1.0.2: fixed something else. + * v1.0.3: replaced CRC constant table by generator function. + * v1.0.4: reformatted code, made ANSI C. 1994-12-05. + * v2.0.0: rewrote to use memory buffer & static table, 2006-04-29. +\*----------------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------------*\ + * NAME: + * Crc32_ComputeBuf () - computes the CRC-32 value of a memory buffer + * DESCRIPTION: + * Computes or accumulates the CRC-32 value for a memory buffer. + * The 'inCrc32' gives a previously accumulated CRC-32 value to allow + * a CRC to be generated for multiple sequential buffer-fuls of data. + * The 'inCrc32' for the first buffer must be zero. + * ARGUMENTS: + * inCrc32 - accumulated CRC-32 value, must be 0 on first call + * buf - buffer to compute CRC-32 value for + * bufLen - number of bytes in buffer + * RETURNS: + * crc32 - computed CRC-32 value + * ERRORS: + * (no errors are possible) +\*----------------------------------------------------------------------------*/ + +uint32_t +compute_crc32 (uint32_t in_crc32, + const void *buf, + size_t buf_len) +{ + static const uint32_t crc_table[256] = { + 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, + 0xE963A535, 0x9E6495A3, 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, + 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2, + 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, + 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9, + 0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, + 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 0x35B5A8FA, 0x42B2986C, + 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, + 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, + 0xCFBA9599, 0xB8BDA50F, 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, + 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, 0x76DC4190, 0x01DB7106, + 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, + 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, + 0x91646C97, 0xE6635C01, 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, + 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950, + 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, + 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, + 0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, + 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, 0x5005713C, 0x270241AA, + 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, + 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, + 0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, + 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, 0xE3630B12, 0x94643B84, + 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, + 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, + 0x196C3671, 0x6E6B06E7, 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, + 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, 0xD6D6A3E8, 0xA1D1937E, + 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, + 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, + 0x316E8EEF, 0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, + 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, 0xC5BA3BBE, 0xB2BD0B28, + 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, + 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, + 0x72076785, 0x05005713, 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, + 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242, + 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, + 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, + 0x616BFFD3, 0x166CCF45, 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, + 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC, + 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, + 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693, + 0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, + 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D + }; + + uint32_t crc32; + unsigned char * byte_buf; + size_t i; + + /* accumulate crc32 for buffer */ + crc32 = in_crc32 ^ 0xFFFFFFFF; + byte_buf = (unsigned char*) buf; + + for (i = 0; i < buf_len; i++) + crc32 = (crc32 >> 8) ^ crc_table[(crc32 ^ byte_buf[i]) & 0xFF]; + + return (crc32 ^ 0xFFFFFFFF); +} + +static uint32_t +compute_crc32_for_image_internal (uint32_t crc32, + pixman_image_t *img, + pixman_bool_t remove_alpha, + pixman_bool_t remove_rgb) +{ + pixman_format_code_t fmt = pixman_image_get_format (img); + uint32_t *data = pixman_image_get_data (img); + int stride = pixman_image_get_stride (img); + int height = pixman_image_get_height (img); + uint32_t mask = 0xffffffff; + int i; + + if (stride < 0) + { + data += (stride / 4) * (height - 1); + stride = - stride; + } + + /* mask unused 'x' part */ + if (PIXMAN_FORMAT_BPP (fmt) - PIXMAN_FORMAT_DEPTH (fmt) && + PIXMAN_FORMAT_DEPTH (fmt) != 0) + { + uint32_t m = (1 << PIXMAN_FORMAT_DEPTH (fmt)) - 1; + + if (PIXMAN_FORMAT_TYPE (fmt) == PIXMAN_TYPE_BGRA || + PIXMAN_FORMAT_TYPE (fmt) == PIXMAN_TYPE_RGBA) + { + m <<= (PIXMAN_FORMAT_BPP (fmt) - PIXMAN_FORMAT_DEPTH (fmt)); + } + + mask &= m; + } + + /* mask alpha channel */ + if (remove_alpha && PIXMAN_FORMAT_A (fmt)) + { + uint32_t m; + + if (PIXMAN_FORMAT_BPP (fmt) == 32) + m = 0xffffffff; + else + m = (1 << PIXMAN_FORMAT_BPP (fmt)) - 1; + + m >>= PIXMAN_FORMAT_A (fmt); + + if (PIXMAN_FORMAT_TYPE (fmt) == PIXMAN_TYPE_BGRA || + PIXMAN_FORMAT_TYPE (fmt) == PIXMAN_TYPE_RGBA || + PIXMAN_FORMAT_TYPE (fmt) == PIXMAN_TYPE_A) + { + /* Alpha is at the bottom of the pixel */ + m <<= PIXMAN_FORMAT_A (fmt); + } + + mask &= m; + } + + /* mask rgb channels */ + if (remove_rgb && PIXMAN_FORMAT_RGB (fmt)) + { + uint32_t m = ((uint32_t)~0) >> (32 - PIXMAN_FORMAT_BPP (fmt)); + uint32_t size = PIXMAN_FORMAT_R (fmt) + PIXMAN_FORMAT_G (fmt) + PIXMAN_FORMAT_B (fmt); + + m &= ~((1 << size) - 1); + + if (PIXMAN_FORMAT_TYPE (fmt) == PIXMAN_TYPE_BGRA || + PIXMAN_FORMAT_TYPE (fmt) == PIXMAN_TYPE_RGBA) + { + /* RGB channels are at the top of the pixel */ + m >>= size; + } + + mask &= m; + } + + for (i = 0; i * PIXMAN_FORMAT_BPP (fmt) < 32; i++) + mask |= mask << (i * PIXMAN_FORMAT_BPP (fmt)); + + for (i = 0; i < stride * height / 4; i++) + data[i] &= mask; + + /* swap endiannes in order to provide identical results on both big + * and litte endian systems + */ + image_endian_swap (img); + + return compute_crc32 (crc32, data, stride * height); +} + +uint32_t +compute_crc32_for_image (uint32_t crc32, + pixman_image_t *img) +{ + if (img->common.alpha_map) + { + crc32 = compute_crc32_for_image_internal (crc32, img, TRUE, FALSE); + crc32 = compute_crc32_for_image_internal ( + crc32, (pixman_image_t *)img->common.alpha_map, FALSE, TRUE); + } + else + { + crc32 = compute_crc32_for_image_internal (crc32, img, FALSE, FALSE); + } + + return crc32; +} + +void +print_image (pixman_image_t *image) +{ + int i, j; + int width, height, stride; + pixman_format_code_t format; + uint8_t *buffer; + int s; + + width = pixman_image_get_width (image); + height = pixman_image_get_height (image); + stride = pixman_image_get_stride (image); + format = pixman_image_get_format (image); + buffer = (uint8_t *)pixman_image_get_data (image); + + s = (stride >= 0)? stride : - stride; + + printf ("---\n"); + for (i = 0; i < height; i++) + { + for (j = 0; j < s; j++) + { + if (j == (width * PIXMAN_FORMAT_BPP (format) + 7) / 8) + printf ("| "); + + printf ("%02X ", *((uint8_t *)buffer + i * stride + j)); + } + printf ("\n"); + } + printf ("---\n"); +} + +/* perform endian conversion of pixel data + */ +void +image_endian_swap (pixman_image_t *img) +{ + int stride = pixman_image_get_stride (img); + uint32_t *data = pixman_image_get_data (img); + int height = pixman_image_get_height (img); + int bpp = PIXMAN_FORMAT_BPP (pixman_image_get_format (img)); + int i, j; + + /* swap bytes only on big endian systems */ + if (is_little_endian()) + return; + + if (bpp == 8) + return; + + for (i = 0; i < height; i++) + { + uint8_t *line_data = (uint8_t *)data + stride * i; + int s = (stride >= 0)? stride : - stride; + + switch (bpp) + { + case 1: + for (j = 0; j < s; j++) + { + line_data[j] = + ((line_data[j] & 0x80) >> 7) | + ((line_data[j] & 0x40) >> 5) | + ((line_data[j] & 0x20) >> 3) | + ((line_data[j] & 0x10) >> 1) | + ((line_data[j] & 0x08) << 1) | + ((line_data[j] & 0x04) << 3) | + ((line_data[j] & 0x02) << 5) | + ((line_data[j] & 0x01) << 7); + } + break; + case 4: + for (j = 0; j < s; j++) + { + line_data[j] = (line_data[j] >> 4) | (line_data[j] << 4); + } + break; + case 16: + for (j = 0; j + 2 <= s; j += 2) + { + char t1 = line_data[j + 0]; + char t2 = line_data[j + 1]; + + line_data[j + 1] = t1; + line_data[j + 0] = t2; + } + break; + case 24: + for (j = 0; j + 3 <= s; j += 3) + { + char t1 = line_data[j + 0]; + char t2 = line_data[j + 1]; + char t3 = line_data[j + 2]; + + line_data[j + 2] = t1; + line_data[j + 1] = t2; + line_data[j + 0] = t3; + } + break; + case 32: + for (j = 0; j + 4 <= s; j += 4) + { + char t1 = line_data[j + 0]; + char t2 = line_data[j + 1]; + char t3 = line_data[j + 2]; + char t4 = line_data[j + 3]; + + line_data[j + 3] = t1; + line_data[j + 2] = t2; + line_data[j + 1] = t3; + line_data[j + 0] = t4; + } + break; + default: + assert (FALSE); + break; + } + } +} + +#define N_LEADING_PROTECTED 10 +#define N_TRAILING_PROTECTED 10 + +typedef struct +{ + void *addr; + uint32_t len; + uint8_t *trailing; + int n_bytes; +} info_t; + +#if FENCE_MALLOC_ACTIVE + +unsigned long +fence_get_page_size () +{ + /* You can fake a page size here, if you want to test e.g. 64 kB + * pages on a 4 kB page system. Just put a multiplier below. + */ + return getpagesize (); +} + +/* This is apparently necessary on at least OS X */ +#ifndef MAP_ANONYMOUS +#define MAP_ANONYMOUS MAP_ANON +#endif + +void * +fence_malloc (int64_t len) +{ + unsigned long page_size = fence_get_page_size (); + unsigned long page_mask = page_size - 1; + uint32_t n_payload_bytes = (len + page_mask) & ~page_mask; + uint32_t n_bytes = + (page_size * (N_LEADING_PROTECTED + N_TRAILING_PROTECTED + 2) + + n_payload_bytes) & ~page_mask; + uint8_t *initial_page; + uint8_t *leading_protected; + uint8_t *trailing_protected; + uint8_t *payload; + uint8_t *addr; + + if (len < 0) + abort(); + + addr = mmap (NULL, n_bytes, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, + -1, 0); + + if (addr == MAP_FAILED) + { + printf ("mmap failed on %lld %u\n", (long long int)len, n_bytes); + return NULL; + } + + initial_page = (uint8_t *)(((uintptr_t)addr + page_mask) & ~page_mask); + leading_protected = initial_page + page_size; + payload = leading_protected + N_LEADING_PROTECTED * page_size; + trailing_protected = payload + n_payload_bytes; + + ((info_t *)initial_page)->addr = addr; + ((info_t *)initial_page)->len = len; + ((info_t *)initial_page)->trailing = trailing_protected; + ((info_t *)initial_page)->n_bytes = n_bytes; + + if ((mprotect (leading_protected, N_LEADING_PROTECTED * page_size, + PROT_NONE) == -1) || + (mprotect (trailing_protected, N_TRAILING_PROTECTED * page_size, + PROT_NONE) == -1)) + { + munmap (addr, n_bytes); + return NULL; + } + + return payload; +} + +void +fence_free (void *data) +{ + uint32_t page_size = fence_get_page_size (); + uint8_t *payload = data; + uint8_t *leading_protected = payload - N_LEADING_PROTECTED * page_size; + uint8_t *initial_page = leading_protected - page_size; + info_t *info = (info_t *)initial_page; + + munmap (info->addr, info->n_bytes); +} + +static void +fence_image_destroy (pixman_image_t *image, void *data) +{ + fence_free (data); +} + +/* Create an image with fence pages. + * + * Creates an image, where the data area is allocated with fence_malloc (). + * Each row has an additional page in the stride. + * + * min_width is only a minimum width for the image. The width is aligned up + * for the row size to be divisible by both page size and pixel size. + * + * If stride_fence is true, the additional page on each row will be + * armed to cause SIGSEGV or SIGBUS on all accesses. This should catch + * all accesses outside the valid row pixels. + */ +pixman_image_t * +fence_image_create_bits (pixman_format_code_t format, + int min_width, + int height, + pixman_bool_t stride_fence) +{ + unsigned page_size = fence_get_page_size (); + unsigned page_mask = page_size - 1; + unsigned bitspp = PIXMAN_FORMAT_BPP (format); + unsigned bits_boundary; + unsigned row_bits; + int width; /* pixels */ + unsigned stride; /* bytes */ + void *pixels; + pixman_image_t *image; + int i; + + /* must be power of two */ + assert (page_size && (page_size & page_mask) == 0); + + if (bitspp < 1 || min_width < 1 || height < 1) + abort (); + + /* least common multiple between page size * 8 and bitspp */ + bits_boundary = bitspp; + while (! (bits_boundary & 1)) + bits_boundary >>= 1; + bits_boundary *= page_size * 8; + + /* round up to bits_boundary */ + row_bits = ROUND_UP ( (unsigned)min_width * bitspp, bits_boundary); + width = row_bits / bitspp; + + stride = row_bits / 8; + if (stride_fence) + stride += page_size; /* add fence page */ + + if (UINT_MAX / stride < (unsigned)height) + abort (); + + pixels = fence_malloc (stride * (unsigned)height); + if (!pixels) + return NULL; + + if (stride_fence) + { + uint8_t *guard = (uint8_t *)pixels + stride - page_size; + + /* arm row end fence pages */ + for (i = 0; i < height; i++) + { + if (mprotect (guard + i * stride, page_size, PROT_NONE) == -1) + goto out_fail; + } + } + + assert (width >= min_width); + + image = pixman_image_create_bits_no_clear (format, width, height, + pixels, stride); + if (!image) + goto out_fail; + + pixman_image_set_destroy_function (image, fence_image_destroy, pixels); + + return image; + +out_fail: + fence_free (pixels); + + return NULL; +} + +#else /* FENCE_MALLOC_ACTIVE */ + +void * +fence_malloc (int64_t len) +{ + return malloc (len); +} + +void +fence_free (void *data) +{ + free (data); +} + +pixman_image_t * +fence_image_create_bits (pixman_format_code_t format, + int min_width, + int height, + pixman_bool_t stride_fence) +{ + return pixman_image_create_bits (format, min_width, height, NULL, 0); + /* Implicitly allocated storage does not need a destroy function + * to get freed on refcount hitting zero. + */ +} + +unsigned long +fence_get_page_size () +{ + return 0; +} + +#endif /* FENCE_MALLOC_ACTIVE */ + +uint8_t * +make_random_bytes (int n_bytes) +{ + uint8_t *bytes = fence_malloc (n_bytes); + + if (!bytes) + return NULL; + + prng_randmemset (bytes, n_bytes, 0); + + return bytes; +} + +float * +make_random_floats (int n_bytes) +{ + uint8_t *bytes = fence_malloc (n_bytes); + float *vals = (float *)bytes; + + if (!bytes) + return 0; + + for (n_bytes /= 4; n_bytes; vals++, n_bytes--) + *vals = (float)rand() / (float)RAND_MAX; + + return (float *)bytes; +} + +void +a8r8g8b8_to_rgba_np (uint32_t *dst, uint32_t *src, int n_pixels) +{ + uint8_t *dst8 = (uint8_t *)dst; + int i; + + for (i = 0; i < n_pixels; ++i) + { + uint32_t p = src[i]; + uint8_t a, r, g, b; + + a = (p & 0xff000000) >> 24; + r = (p & 0x00ff0000) >> 16; + g = (p & 0x0000ff00) >> 8; + b = (p & 0x000000ff) >> 0; + + if (a != 0) + { +#define DIVIDE(c, a) \ + do \ + { \ + int t = ((c) * 255) / a; \ + (c) = t < 0? 0 : t > 255? 255 : t; \ + } while (0) + + DIVIDE (r, a); + DIVIDE (g, a); + DIVIDE (b, a); + } + + *dst8++ = r; + *dst8++ = g; + *dst8++ = b; + *dst8++ = a; + } +} + +#ifdef HAVE_LIBPNG + +pixman_bool_t +write_png (pixman_image_t *image, const char *filename) +{ + int width = pixman_image_get_width (image); + int height = pixman_image_get_height (image); + int stride = width * 4; + uint32_t *data = malloc (height * stride); + pixman_image_t *copy; + png_struct *write_struct; + png_info *info_struct; + pixman_bool_t result = FALSE; + FILE *f = fopen (filename, "wb"); + png_bytep *row_pointers; + int i; + + if (!f) + return FALSE; + + row_pointers = malloc (height * sizeof (png_bytep)); + + copy = pixman_image_create_bits ( + PIXMAN_a8r8g8b8, width, height, data, stride); + + pixman_image_composite32 ( + PIXMAN_OP_SRC, image, NULL, copy, 0, 0, 0, 0, 0, 0, width, height); + + a8r8g8b8_to_rgba_np (data, data, height * width); + + for (i = 0; i < height; ++i) + row_pointers[i] = (png_bytep)(data + i * width); + + if (!(write_struct = png_create_write_struct ( + PNG_LIBPNG_VER_STRING, NULL, NULL, NULL))) + goto out1; + + if (!(info_struct = png_create_info_struct (write_struct))) + goto out2; + + png_init_io (write_struct, f); + + png_set_IHDR (write_struct, info_struct, width, height, + 8, PNG_COLOR_TYPE_RGB_ALPHA, + PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, + PNG_FILTER_TYPE_BASE); + + png_write_info (write_struct, info_struct); + + png_write_image (write_struct, row_pointers); + + png_write_end (write_struct, NULL); + + result = TRUE; + +out2: + png_destroy_write_struct (&write_struct, &info_struct); + +out1: + if (fclose (f) != 0) + result = FALSE; + + pixman_image_unref (copy); + free (row_pointers); + free (data); + return result; +} + +#else /* no libpng */ + +pixman_bool_t +write_png (pixman_image_t *image, const char *filename) +{ + return FALSE; +} + +#endif + +static void +color8_to_color16 (uint32_t color8, pixman_color_t *color16) +{ + color16->alpha = ((color8 & 0xff000000) >> 24); + color16->red = ((color8 & 0x00ff0000) >> 16); + color16->green = ((color8 & 0x0000ff00) >> 8); + color16->blue = ((color8 & 0x000000ff) >> 0); + + color16->alpha |= color16->alpha << 8; + color16->red |= color16->red << 8; + color16->blue |= color16->blue << 8; + color16->green |= color16->green << 8; +} + +void +draw_checkerboard (pixman_image_t *image, + int check_size, + uint32_t color1, uint32_t color2) +{ + pixman_color_t check1, check2; + pixman_image_t *c1, *c2; + int n_checks_x, n_checks_y; + int i, j; + + color8_to_color16 (color1, &check1); + color8_to_color16 (color2, &check2); + + c1 = pixman_image_create_solid_fill (&check1); + c2 = pixman_image_create_solid_fill (&check2); + + n_checks_x = ( + pixman_image_get_width (image) + check_size - 1) / check_size; + n_checks_y = ( + pixman_image_get_height (image) + check_size - 1) / check_size; + + for (j = 0; j < n_checks_y; j++) + { + for (i = 0; i < n_checks_x; i++) + { + pixman_image_t *src; + + if (((i ^ j) & 1)) + src = c1; + else + src = c2; + + pixman_image_composite32 (PIXMAN_OP_SRC, src, NULL, image, + 0, 0, 0, 0, + i * check_size, j * check_size, + check_size, check_size); + } + } +} + +static uint32_t +call_test_function (uint32_t (*test_function)(int testnum, int verbose), + int testnum, + int verbose) +{ + uint32_t retval; + +#if defined (__GNUC__) && defined (_WIN32) && (defined (__i386) || defined (__i386__)) + __asm__ ( + /* Deliberately avoid aligning the stack to 16 bytes */ + "pushl %1\n\t" + "pushl %2\n\t" + "call *%3\n\t" + "addl $8, %%esp\n\t" + : "=a" (retval) + : "r" (verbose), + "r" (testnum), + "r" (test_function) + : "edx", "ecx"); /* caller save registers */ +#else + retval = test_function (testnum, verbose); +#endif + + return retval; +} + +/* + * A function, which can be used as a core part of the test programs, + * intended to detect various problems with the help of fuzzing input + * to pixman API (according to some templates, aka "smart" fuzzing). + * Some general information about such testing can be found here: + * http://en.wikipedia.org/wiki/Fuzz_testing + * + * It may help detecting: + * - crashes on bad handling of valid or reasonably invalid input to + * pixman API. + * - deviations from the behavior of older pixman releases. + * - deviations from the behavior of the same pixman release, but + * configured in a different way (for example with SIMD optimizations + * disabled), or running on a different OS or hardware. + * + * The test is performed by calling a callback function a huge number + * of times. The callback function is expected to run some snippet of + * pixman code with pseudorandom variations to the data feeded to + * pixman API. A result of running each callback function should be + * some deterministic value which depends on test number (test number + * can be used as a seed for PRNG). When 'verbose' argument is nonzero, + * callback function is expected to print to stdout some information + * about what it does. + * + * Return values from many small tests are accumulated together and + * used as final checksum, which can be compared to some expected + * value. Running the tests not individually, but in a batch helps + * to reduce process start overhead and also allows to parallelize + * testing and utilize multiple CPU cores. + * + * The resulting executable can be run without any arguments. In + * this case it runs a batch of tests starting from 1 and up to + * 'default_number_of_iterations'. The resulting checksum is + * compared with 'expected_checksum' and FAIL or PASS verdict + * depends on the result of this comparison. + * + * If the executable is run with 2 numbers provided as command line + * arguments, they specify the starting and ending numbers for a test + * batch. + * + * If the executable is run with only one number provided as a command + * line argument, then this number is used to call the callback function + * once, and also with verbose flag set. + */ +int +fuzzer_test_main (const char *test_name, + int default_number_of_iterations, + uint32_t expected_checksum, + uint32_t (*test_function)(int testnum, int verbose), + int argc, + const char *argv[]) +{ + int i, n1 = 1, n2 = 0; + uint32_t checksum = 0; + int verbose = getenv ("VERBOSE") != NULL; + + if (argc >= 3) + { + n1 = atoi (argv[1]); + n2 = atoi (argv[2]); + if (n2 < n1) + { + printf ("invalid test range\n"); + return 1; + } + } + else if (argc >= 2) + { + n2 = atoi (argv[1]); + + checksum = call_test_function (test_function, n2, 1); + + printf ("%d: checksum=%08X\n", n2, checksum); + return 0; + } + else + { + n1 = 1; + n2 = default_number_of_iterations; + } + +#ifdef USE_OPENMP + #pragma omp parallel for reduction(+:checksum) default(none) \ + shared(n1, n2, test_function, verbose) +#endif + for (i = n1; i <= n2; i++) + { + uint32_t crc = call_test_function (test_function, i, 0); + if (verbose) + printf ("%d: %08X\n", i, crc); + checksum += crc; + } + + if (n1 == 1 && n2 == default_number_of_iterations) + { + if (checksum == expected_checksum) + { + printf ("%s test passed (checksum=%08X)\n", + test_name, checksum); + } + else + { + printf ("%s test failed! (checksum=%08X, expected %08X)\n", + test_name, checksum, expected_checksum); + return 1; + } + } + else + { + printf ("%d-%d: checksum=%08X\n", n1, n2, checksum); + } + + return 0; +} + +/* Try to obtain current time in seconds */ +double +gettime (void) +{ +#ifdef HAVE_GETTIMEOFDAY + struct timeval tv; + + gettimeofday (&tv, NULL); + return (double)((int64_t)tv.tv_sec * 1000000 + tv.tv_usec) / 1000000.; +#else + return (double)clock() / (double)CLOCKS_PER_SEC; +#endif +} + +uint32_t +get_random_seed (void) +{ + union { double d; uint32_t u32; } t; + t.d = gettime(); + prng_srand (t.u32); + + return prng_rand (); +} + +#ifdef HAVE_SIGACTION +#ifdef HAVE_ALARM +static const char *global_msg; + +static void +on_alarm (int signo) +{ + printf ("%s\n", global_msg); + exit (1); +} +#endif +#endif + +void +fail_after (int seconds, const char *msg) +{ +#ifdef HAVE_SIGACTION +#ifdef HAVE_ALARM + struct sigaction action; + + global_msg = msg; + + memset (&action, 0, sizeof (action)); + action.sa_handler = on_alarm; + + alarm (seconds); + + sigaction (SIGALRM, &action, NULL); +#endif +#endif +} + +void +enable_divbyzero_exceptions (void) +{ +#ifdef HAVE_FENV_H +#ifdef HAVE_FEENABLEEXCEPT +#ifdef HAVE_FEDIVBYZERO + feenableexcept (FE_DIVBYZERO); +#endif +#endif +#endif +} + +void +enable_invalid_exceptions (void) +{ +#ifdef HAVE_FENV_H +#ifdef HAVE_FEENABLEEXCEPT +#ifdef FE_INVALID + feenableexcept (FE_INVALID); +#endif +#endif +#endif +} + +void * +aligned_malloc (size_t align, size_t size) +{ + void *result; + +#ifdef HAVE_POSIX_MEMALIGN + if (posix_memalign (&result, align, size) != 0) + result = NULL; +#else + result = malloc (size); +#endif + + return result; +} + +#define CONVERT_15(c, is_rgb) \ + (is_rgb? \ + ((((c) >> 3) & 0x001f) | \ + (((c) >> 6) & 0x03e0) | \ + (((c) >> 9) & 0x7c00)) : \ + (((((c) >> 16) & 0xff) * 153 + \ + (((c) >> 8) & 0xff) * 301 + \ + (((c) ) & 0xff) * 58) >> 2)) + +double +convert_srgb_to_linear (double c) +{ + if (c <= 0.04045) + return c / 12.92; + else + return pow ((c + 0.055) / 1.055, 2.4); +} + +double +convert_linear_to_srgb (double c) +{ + if (c <= 0.0031308) + return c * 12.92; + else + return 1.055 * pow (c, 1.0/2.4) - 0.055; +} + +void +initialize_palette (pixman_indexed_t *palette, uint32_t depth, int is_rgb) +{ + int i; + uint32_t mask = (1 << depth) - 1; + + for (i = 0; i < 32768; ++i) + palette->ent[i] = prng_rand() & mask; + + memset (palette->rgba, 0, sizeof (palette->rgba)); + + for (i = 0; i < mask + 1; ++i) + { + uint32_t rgba24; + pixman_bool_t retry; + uint32_t i15; + + /* We filled the rgb->index map with random numbers, but we + * do need the ability to round trip, that is if some indexed + * color expands to an argb24, then the 15 bit version of that + * color must map back to the index. Anything else, we don't + * care about too much. + */ + do + { + uint32_t old_idx; + + rgba24 = prng_rand(); + i15 = CONVERT_15 (rgba24, is_rgb); + + old_idx = palette->ent[i15]; + if (CONVERT_15 (palette->rgba[old_idx], is_rgb) == i15) + retry = 1; + else + retry = 0; + } while (retry); + + palette->rgba[i] = rgba24; + palette->ent[i15] = i; + } + + for (i = 0; i < mask + 1; ++i) + { + assert (palette->ent[CONVERT_15 (palette->rgba[i], is_rgb)] == i); + } +} + +struct operator_entry { + pixman_op_t op; + const char *name; + pixman_bool_t is_alias; +}; + +typedef struct operator_entry operator_entry_t; + +static const operator_entry_t op_list[] = +{ +#define ENTRY(op) \ + { PIXMAN_OP_##op, "PIXMAN_OP_" #op, FALSE } +#define ALIAS(op, nam) \ + { PIXMAN_OP_##op, nam, TRUE } + + /* operator_name () will return the first hit in this table, + * so keep the list properly ordered between entries and aliases. + * Aliases are not listed by list_operators (). + */ + + ENTRY (CLEAR), + ENTRY (SRC), + ENTRY (DST), + ENTRY (OVER), + ENTRY (OVER_REVERSE), + ALIAS (OVER_REVERSE, "overrev"), + ENTRY (IN), + ENTRY (IN_REVERSE), + ALIAS (IN_REVERSE, "inrev"), + ENTRY (OUT), + ENTRY (OUT_REVERSE), + ALIAS (OUT_REVERSE, "outrev"), + ENTRY (ATOP), + ENTRY (ATOP_REVERSE), + ALIAS (ATOP_REVERSE, "atoprev"), + ENTRY (XOR), + ENTRY (ADD), + ENTRY (SATURATE), + + ENTRY (DISJOINT_CLEAR), + ENTRY (DISJOINT_SRC), + ENTRY (DISJOINT_DST), + ENTRY (DISJOINT_OVER), + ENTRY (DISJOINT_OVER_REVERSE), + ENTRY (DISJOINT_IN), + ENTRY (DISJOINT_IN_REVERSE), + ENTRY (DISJOINT_OUT), + ENTRY (DISJOINT_OUT_REVERSE), + ENTRY (DISJOINT_ATOP), + ENTRY (DISJOINT_ATOP_REVERSE), + ENTRY (DISJOINT_XOR), + + ENTRY (CONJOINT_CLEAR), + ENTRY (CONJOINT_SRC), + ENTRY (CONJOINT_DST), + ENTRY (CONJOINT_OVER), + ENTRY (CONJOINT_OVER_REVERSE), + ENTRY (CONJOINT_IN), + ENTRY (CONJOINT_IN_REVERSE), + ENTRY (CONJOINT_OUT), + ENTRY (CONJOINT_OUT_REVERSE), + ENTRY (CONJOINT_ATOP), + ENTRY (CONJOINT_ATOP_REVERSE), + ENTRY (CONJOINT_XOR), + + ENTRY (MULTIPLY), + ENTRY (SCREEN), + ENTRY (OVERLAY), + ENTRY (DARKEN), + ENTRY (LIGHTEN), + ENTRY (COLOR_DODGE), + ENTRY (COLOR_BURN), + ENTRY (HARD_LIGHT), + ENTRY (SOFT_LIGHT), + ENTRY (DIFFERENCE), + ENTRY (EXCLUSION), + ENTRY (HSL_HUE), + ENTRY (HSL_SATURATION), + ENTRY (HSL_COLOR), + ENTRY (HSL_LUMINOSITY), + + ALIAS (NONE, "<invalid operator 'none'>") + +#undef ENTRY +#undef ALIAS +}; + +typedef struct { + pixman_dither_t dither; + const char *name; + pixman_bool_t is_alias; +} dither_entry_t; + +static const dither_entry_t dither_list[] = +{ +#define ENTRY(dither) \ + { PIXMAN_DITHER_##dither, "PIXMAN_DITHER_" #dither, FALSE } +#define ALIAS(dither, nam) \ + { PIXMAN_DITHER_##dither, nam, TRUE } + + /* dither_name () will return the first hit in this table, + * so keep the list properly ordered between entries and aliases. + * Aliases are not listed by list_dithers (). + */ + + ENTRY (ORDERED_BAYER_8), + ENTRY (ORDERED_BLUE_NOISE_64), + ENTRY (NONE), + +#undef ENTRY +#undef ALIAS +}; + +struct format_entry +{ + pixman_format_code_t format; + const char *name; + pixman_bool_t is_alias; +}; + +typedef struct format_entry format_entry_t; + +static const format_entry_t format_list[] = +{ +#define ENTRY(f) \ + { PIXMAN_##f, #f, FALSE } +#define ALIAS(f, nam) \ + { PIXMAN_##f, nam, TRUE } + + /* format_name () will return the first hit in this table, + * so keep the list properly ordered between entries and aliases. + * Aliases are not listed by list_formats (). + */ + +/* 128bpp formats */ + ENTRY (rgba_float), +/* 96bpp formats */ + ENTRY (rgb_float), + +/* 32bpp formats */ + ENTRY (a8r8g8b8), + ALIAS (a8r8g8b8, "8888"), + ENTRY (x8r8g8b8), + ALIAS (x8r8g8b8, "x888"), + ENTRY (a8b8g8r8), + ENTRY (x8b8g8r8), + ENTRY (b8g8r8a8), + ENTRY (b8g8r8x8), + ENTRY (r8g8b8a8), + ENTRY (r8g8b8x8), + ENTRY (x14r6g6b6), + ENTRY (x2r10g10b10), + ALIAS (x2r10g10b10, "2x10"), + ENTRY (a2r10g10b10), + ALIAS (a2r10g10b10, "2a10"), + ENTRY (x2b10g10r10), + ENTRY (a2b10g10r10), + +/* sRGB formats */ + ENTRY (a8r8g8b8_sRGB), + +/* 24bpp formats */ + ENTRY (r8g8b8), + ALIAS (r8g8b8, "0888"), + ENTRY (b8g8r8), + +/* 16 bpp formats */ + ENTRY (r5g6b5), + ALIAS (r5g6b5, "0565"), + ENTRY (b5g6r5), + + ENTRY (a1r5g5b5), + ALIAS (a1r5g5b5, "1555"), + ENTRY (x1r5g5b5), + ENTRY (a1b5g5r5), + ENTRY (x1b5g5r5), + ENTRY (a4r4g4b4), + ALIAS (a4r4g4b4, "4444"), + ENTRY (x4r4g4b4), + ENTRY (a4b4g4r4), + ENTRY (x4b4g4r4), + +/* 8bpp formats */ + ENTRY (a8), + ALIAS (a8, "8"), + ENTRY (r3g3b2), + ENTRY (b2g3r3), + ENTRY (a2r2g2b2), + ALIAS (a2r2g2b2, "2222"), + ENTRY (a2b2g2r2), + + ALIAS (c8, "x4c4 / c8"), + /* ENTRY (c8), */ + ALIAS (g8, "x4g4 / g8"), + /* ENTRY (g8), */ + + ENTRY (x4a4), + + /* These format codes are identical to c8 and g8, respectively. */ + /* ENTRY (x4c4), */ + /* ENTRY (x4g4), */ + +/* 4 bpp formats */ + ENTRY (a4), + ENTRY (r1g2b1), + ENTRY (b1g2r1), + ENTRY (a1r1g1b1), + ENTRY (a1b1g1r1), + + ALIAS (c4, "c4"), + /* ENTRY (c4), */ + ALIAS (g4, "g4"), + /* ENTRY (g4), */ + +/* 1bpp formats */ + ENTRY (a1), + + ALIAS (g1, "g1"), + /* ENTRY (g1), */ + +/* YUV formats */ + ALIAS (yuy2, "yuy2"), + /* ENTRY (yuy2), */ + ALIAS (yv12, "yv12"), + /* ENTRY (yv12), */ + +/* Fake formats, not in pixman_format_code_t enum */ + ALIAS (null, "null"), + ALIAS (solid, "solid"), + ALIAS (solid, "n"), + ALIAS (pixbuf, "pixbuf"), + ALIAS (rpixbuf, "rpixbuf"), + ALIAS (unknown, "unknown"), + +#undef ENTRY +#undef ALIAS +}; + +pixman_format_code_t +format_from_string (const char *s) +{ + int i; + + for (i = 0; i < ARRAY_LENGTH (format_list); ++i) + { + const format_entry_t *ent = &format_list[i]; + + if (strcasecmp (ent->name, s) == 0) + return ent->format; + } + + return PIXMAN_null; +} + +static void +emit (const char *s, int *n_chars) +{ + *n_chars += printf ("%s,", s); + if (*n_chars > 60) + { + printf ("\n "); + *n_chars = 0; + } + else + { + printf (" "); + (*n_chars)++; + } +} + +void +list_formats (void) +{ + int n_chars; + int i; + + printf ("Formats:\n "); + + n_chars = 0; + for (i = 0; i < ARRAY_LENGTH (format_list); ++i) + { + const format_entry_t *ent = &format_list[i]; + + if (ent->is_alias) + continue; + + emit (ent->name, &n_chars); + } + + printf ("\n\n"); +} + +void +list_operators (void) +{ + char short_name [128] = { 0 }; + int i, n_chars; + + printf ("Operators:\n "); + + n_chars = 0; + for (i = 0; i < ARRAY_LENGTH (op_list); ++i) + { + const operator_entry_t *ent = &op_list[i]; + int j; + + if (ent->is_alias) + continue; + + snprintf (short_name, sizeof (short_name) - 1, "%s", + ent->name + strlen ("PIXMAN_OP_")); + + for (j = 0; short_name[j] != '\0'; ++j) + short_name[j] = tolower (short_name[j]); + + emit (short_name, &n_chars); + } + + printf ("\n\n"); +} + +void +list_dithers (void) +{ + int n_chars; + int i; + + printf ("Dithers:\n "); + + n_chars = 0; + for (i = 0; i < ARRAY_LENGTH (dither_list); ++i) + { + const dither_entry_t *ent = &dither_list[i]; + + if (ent->is_alias) + continue; + + emit (ent->name, &n_chars); + } + + printf ("\n\n"); +} + +pixman_op_t +operator_from_string (const char *s) +{ + int i; + + for (i = 0; i < ARRAY_LENGTH (op_list); ++i) + { + const operator_entry_t *ent = &op_list[i]; + + if (ent->is_alias) + { + if (strcasecmp (ent->name, s) == 0) + return ent->op; + } + else + { + if (strcasecmp (ent->name + strlen ("PIXMAN_OP_"), s) == 0) + return ent->op; + } + } + + return PIXMAN_OP_NONE; +} + +pixman_dither_t +dither_from_string (const char *s) +{ + int i; + + for (i = 0; i < ARRAY_LENGTH (dither_list); ++i) + { + const dither_entry_t *ent = &dither_list[i]; + + if (strcasecmp (ent->name, s) == 0) + return ent->dither; + } + + return PIXMAN_DITHER_NONE; +} + +const char * +operator_name (pixman_op_t op) +{ + int i; + + for (i = 0; i < ARRAY_LENGTH (op_list); ++i) + { + const operator_entry_t *ent = &op_list[i]; + + if (ent->op == op) + return ent->name; + } + + return "<unknown operator>"; +} + +const char * +format_name (pixman_format_code_t format) +{ + int i; + + for (i = 0; i < ARRAY_LENGTH (format_list); ++i) + { + const format_entry_t *ent = &format_list[i]; + + if (ent->format == format) + return ent->name; + } + + return "<unknown format>"; +}; + +const char * +dither_name (pixman_dither_t dither) +{ + int i; + + for (i = 0; i < ARRAY_LENGTH (dither_list); ++i) + { + const dither_entry_t *ent = &dither_list[i]; + + if (ent->dither == dither) + return ent->name; + } + + return "<unknown dither>"; +} + +#define IS_ZERO(f) (-DBL_MIN < (f) && (f) < DBL_MIN) + +typedef double (* blend_func_t) (double as, double s, double ad, double d); + +static force_inline double +blend_multiply (double sa, double s, double da, double d) +{ + return d * s; +} + +static force_inline double +blend_screen (double sa, double s, double da, double d) +{ + return d * sa + s * da - s * d; +} + +static force_inline double +blend_overlay (double sa, double s, double da, double d) +{ + if (2 * d < da) + return 2 * s * d; + else + return sa * da - 2 * (da - d) * (sa - s); +} + +static force_inline double +blend_darken (double sa, double s, double da, double d) +{ + s = s * da; + d = d * sa; + + if (s > d) + return d; + else + return s; +} + +static force_inline double +blend_lighten (double sa, double s, double da, double d) +{ + s = s * da; + d = d * sa; + + if (s > d) + return s; + else + return d; +} + +static force_inline double +blend_color_dodge (double sa, double s, double da, double d) +{ + if (IS_ZERO (d)) + return 0.0f; + else if (d * sa >= sa * da - s * da) + return sa * da; + else if (IS_ZERO (sa - s)) + return sa * da; + else + return sa * sa * d / (sa - s); +} + +static force_inline double +blend_color_burn (double sa, double s, double da, double d) +{ + if (d >= da) + return sa * da; + else if (sa * (da - d) >= s * da) + return 0.0f; + else if (IS_ZERO (s)) + return 0.0f; + else + return sa * (da - sa * (da - d) / s); +} + +static force_inline double +blend_hard_light (double sa, double s, double da, double d) +{ + if (2 * s < sa) + return 2 * s * d; + else + return sa * da - 2 * (da - d) * (sa - s); +} + +static force_inline double +blend_soft_light (double sa, double s, double da, double d) +{ + if (2 * s <= sa) + { + if (IS_ZERO (da)) + return d * sa; + else + return d * sa - d * (da - d) * (sa - 2 * s) / da; + } + else + { + if (IS_ZERO (da)) + { + return d * sa; + } + else + { + if (4 * d <= da) + return d * sa + (2 * s - sa) * d * ((16 * d / da - 12) * d / da + 3); + else + return d * sa + (sqrt (d * da) - d) * (2 * s - sa); + } + } +} + +static force_inline double +blend_difference (double sa, double s, double da, double d) +{ + double dsa = d * sa; + double sda = s * da; + + if (sda < dsa) + return dsa - sda; + else + return sda - dsa; +} + +static force_inline double +blend_exclusion (double sa, double s, double da, double d) +{ + return s * da + d * sa - 2 * d * s; +} + +static double +clamp (double d) +{ + if (d > 1.0) + return 1.0; + else if (d < 0.0) + return 0.0; + else + return d; +} + +static double +blend_channel (double as, double s, double ad, double d, + blend_func_t blend) +{ + return clamp ((1 - ad) * s + (1 - as) * d + blend (as, s, ad, d)); +} + +static double +calc_op (pixman_op_t op, double src, double dst, double srca, double dsta) +{ +#define mult_chan(src, dst, Fa, Fb) MIN ((src) * (Fa) + (dst) * (Fb), 1.0) + + double Fa, Fb; + + switch (op) + { + case PIXMAN_OP_CLEAR: + case PIXMAN_OP_DISJOINT_CLEAR: + case PIXMAN_OP_CONJOINT_CLEAR: + return mult_chan (src, dst, 0.0, 0.0); + + case PIXMAN_OP_SRC: + case PIXMAN_OP_DISJOINT_SRC: + case PIXMAN_OP_CONJOINT_SRC: + return mult_chan (src, dst, 1.0, 0.0); + + case PIXMAN_OP_DST: + case PIXMAN_OP_DISJOINT_DST: + case PIXMAN_OP_CONJOINT_DST: + return mult_chan (src, dst, 0.0, 1.0); + + case PIXMAN_OP_OVER: + return mult_chan (src, dst, 1.0, 1.0 - srca); + + case PIXMAN_OP_OVER_REVERSE: + return mult_chan (src, dst, 1.0 - dsta, 1.0); + + case PIXMAN_OP_IN: + return mult_chan (src, dst, dsta, 0.0); + + case PIXMAN_OP_IN_REVERSE: + return mult_chan (src, dst, 0.0, srca); + + case PIXMAN_OP_OUT: + return mult_chan (src, dst, 1.0 - dsta, 0.0); + + case PIXMAN_OP_OUT_REVERSE: + return mult_chan (src, dst, 0.0, 1.0 - srca); + + case PIXMAN_OP_ATOP: + return mult_chan (src, dst, dsta, 1.0 - srca); + + case PIXMAN_OP_ATOP_REVERSE: + return mult_chan (src, dst, 1.0 - dsta, srca); + + case PIXMAN_OP_XOR: + return mult_chan (src, dst, 1.0 - dsta, 1.0 - srca); + + case PIXMAN_OP_ADD: + return mult_chan (src, dst, 1.0, 1.0); + + case PIXMAN_OP_SATURATE: + case PIXMAN_OP_DISJOINT_OVER_REVERSE: + if (srca == 0.0) + Fa = 1.0; + else + Fa = MIN (1.0, (1.0 - dsta) / srca); + return mult_chan (src, dst, Fa, 1.0); + + case PIXMAN_OP_DISJOINT_OVER: + if (dsta == 0.0) + Fb = 1.0; + else + Fb = MIN (1.0, (1.0 - srca) / dsta); + return mult_chan (src, dst, 1.0, Fb); + + case PIXMAN_OP_DISJOINT_IN: + if (srca == 0.0) + Fa = 0.0; + else + Fa = MAX (0.0, 1.0 - (1.0 - dsta) / srca); + return mult_chan (src, dst, Fa, 0.0); + + case PIXMAN_OP_DISJOINT_IN_REVERSE: + if (dsta == 0.0) + Fb = 0.0; + else + Fb = MAX (0.0, 1.0 - (1.0 - srca) / dsta); + return mult_chan (src, dst, 0.0, Fb); + + case PIXMAN_OP_DISJOINT_OUT: + if (srca == 0.0) + Fa = 1.0; + else + Fa = MIN (1.0, (1.0 - dsta) / srca); + return mult_chan (src, dst, Fa, 0.0); + + case PIXMAN_OP_DISJOINT_OUT_REVERSE: + if (dsta == 0.0) + Fb = 1.0; + else + Fb = MIN (1.0, (1.0 - srca) / dsta); + return mult_chan (src, dst, 0.0, Fb); + + case PIXMAN_OP_DISJOINT_ATOP: + if (srca == 0.0) + Fa = 0.0; + else + Fa = MAX (0.0, 1.0 - (1.0 - dsta) / srca); + if (dsta == 0.0) + Fb = 1.0; + else + Fb = MIN (1.0, (1.0 - srca) / dsta); + return mult_chan (src, dst, Fa, Fb); + + case PIXMAN_OP_DISJOINT_ATOP_REVERSE: + if (srca == 0.0) + Fa = 1.0; + else + Fa = MIN (1.0, (1.0 - dsta) / srca); + if (dsta == 0.0) + Fb = 0.0; + else + Fb = MAX (0.0, 1.0 - (1.0 - srca) / dsta); + return mult_chan (src, dst, Fa, Fb); + + case PIXMAN_OP_DISJOINT_XOR: + if (srca == 0.0) + Fa = 1.0; + else + Fa = MIN (1.0, (1.0 - dsta) / srca); + if (dsta == 0.0) + Fb = 1.0; + else + Fb = MIN (1.0, (1.0 - srca) / dsta); + return mult_chan (src, dst, Fa, Fb); + + case PIXMAN_OP_CONJOINT_OVER: + if (dsta == 0.0) + Fb = 0.0; + else + Fb = MAX (0.0, 1.0 - srca / dsta); + return mult_chan (src, dst, 1.0, Fb); + + case PIXMAN_OP_CONJOINT_OVER_REVERSE: + if (srca == 0.0) + Fa = 0.0; + else + Fa = MAX (0.0, 1.0 - dsta / srca); + return mult_chan (src, dst, Fa, 1.0); + + case PIXMAN_OP_CONJOINT_IN: + if (srca == 0.0) + Fa = 1.0; + else + Fa = MIN (1.0, dsta / srca); + return mult_chan (src, dst, Fa, 0.0); + + case PIXMAN_OP_CONJOINT_IN_REVERSE: + if (dsta == 0.0) + Fb = 1.0; + else + Fb = MIN (1.0, srca / dsta); + return mult_chan (src, dst, 0.0, Fb); + + case PIXMAN_OP_CONJOINT_OUT: + if (srca == 0.0) + Fa = 0.0; + else + Fa = MAX (0.0, 1.0 - dsta / srca); + return mult_chan (src, dst, Fa, 0.0); + + case PIXMAN_OP_CONJOINT_OUT_REVERSE: + if (dsta == 0.0) + Fb = 0.0; + else + Fb = MAX (0.0, 1.0 - srca / dsta); + return mult_chan (src, dst, 0.0, Fb); + + case PIXMAN_OP_CONJOINT_ATOP: + if (srca == 0.0) + Fa = 1.0; + else + Fa = MIN (1.0, dsta / srca); + if (dsta == 0.0) + Fb = 0.0; + else + Fb = MAX (0.0, 1.0 - srca / dsta); + return mult_chan (src, dst, Fa, Fb); + + case PIXMAN_OP_CONJOINT_ATOP_REVERSE: + if (srca == 0.0) + Fa = 0.0; + else + Fa = MAX (0.0, 1.0 - dsta / srca); + if (dsta == 0.0) + Fb = 1.0; + else + Fb = MIN (1.0, srca / dsta); + return mult_chan (src, dst, Fa, Fb); + + case PIXMAN_OP_CONJOINT_XOR: + if (srca == 0.0) + Fa = 0.0; + else + Fa = MAX (0.0, 1.0 - dsta / srca); + if (dsta == 0.0) + Fb = 0.0; + else + Fb = MAX (0.0, 1.0 - srca / dsta); + return mult_chan (src, dst, Fa, Fb); + + case PIXMAN_OP_MULTIPLY: + case PIXMAN_OP_SCREEN: + case PIXMAN_OP_OVERLAY: + case PIXMAN_OP_DARKEN: + case PIXMAN_OP_LIGHTEN: + case PIXMAN_OP_COLOR_DODGE: + case PIXMAN_OP_COLOR_BURN: + case PIXMAN_OP_HARD_LIGHT: + case PIXMAN_OP_SOFT_LIGHT: + case PIXMAN_OP_DIFFERENCE: + case PIXMAN_OP_EXCLUSION: + case PIXMAN_OP_HSL_HUE: + case PIXMAN_OP_HSL_SATURATION: + case PIXMAN_OP_HSL_COLOR: + case PIXMAN_OP_HSL_LUMINOSITY: + default: + abort(); + return 0; /* silence MSVC */ + } +#undef mult_chan +} + +void +do_composite (pixman_op_t op, + const color_t *src, + const color_t *mask, + const color_t *dst, + color_t *result, + pixman_bool_t component_alpha) +{ + color_t srcval, srcalpha; + + static const blend_func_t blend_funcs[] = + { + blend_multiply, + blend_screen, + blend_overlay, + blend_darken, + blend_lighten, + blend_color_dodge, + blend_color_burn, + blend_hard_light, + blend_soft_light, + blend_difference, + blend_exclusion, + }; + + if (mask == NULL) + { + srcval = *src; + + srcalpha.r = src->a; + srcalpha.g = src->a; + srcalpha.b = src->a; + srcalpha.a = src->a; + } + else if (component_alpha) + { + srcval.r = src->r * mask->r; + srcval.g = src->g * mask->g; + srcval.b = src->b * mask->b; + srcval.a = src->a * mask->a; + + srcalpha.r = src->a * mask->r; + srcalpha.g = src->a * mask->g; + srcalpha.b = src->a * mask->b; + srcalpha.a = src->a * mask->a; + } + else + { + srcval.r = src->r * mask->a; + srcval.g = src->g * mask->a; + srcval.b = src->b * mask->a; + srcval.a = src->a * mask->a; + + srcalpha.r = src->a * mask->a; + srcalpha.g = src->a * mask->a; + srcalpha.b = src->a * mask->a; + srcalpha.a = src->a * mask->a; + } + + if (op >= PIXMAN_OP_MULTIPLY) + { + blend_func_t func = blend_funcs[op - PIXMAN_OP_MULTIPLY]; + + result->a = srcalpha.a + dst->a - srcalpha.a * dst->a; + result->r = blend_channel (srcalpha.r, srcval.r, dst->a, dst->r, func); + result->g = blend_channel (srcalpha.g, srcval.g, dst->a, dst->g, func); + result->b = blend_channel (srcalpha.b, srcval.b, dst->a, dst->b, func); + } + else + { + result->r = calc_op (op, srcval.r, dst->r, srcalpha.r, dst->a); + result->g = calc_op (op, srcval.g, dst->g, srcalpha.g, dst->a); + result->b = calc_op (op, srcval.b, dst->b, srcalpha.b, dst->a); + result->a = calc_op (op, srcval.a, dst->a, srcalpha.a, dst->a); + } +} + +static double +round_channel (double p, int m) +{ + int t; + double r; + + t = p * ((1 << m)); + t -= t >> m; + + r = t / (double)((1 << m) - 1); + + return r; +} + +void +round_color (pixman_format_code_t format, color_t *color) +{ + if (PIXMAN_FORMAT_R (format) == 0) + { + color->r = 0.0; + color->g = 0.0; + color->b = 0.0; + } + else + { + color->r = round_channel (color->r, PIXMAN_FORMAT_R (format)); + color->g = round_channel (color->g, PIXMAN_FORMAT_G (format)); + color->b = round_channel (color->b, PIXMAN_FORMAT_B (format)); + } + + if (PIXMAN_FORMAT_A (format) == 0) + color->a = 1; + else + color->a = round_channel (color->a, PIXMAN_FORMAT_A (format)); +} + +/* The acceptable deviation in units of [0.0, 1.0] + */ +#define DEVIATION (0.0128) + +/* Check whether @pixel is a valid quantization of the a, r, g, b + * parameters. Some slack is permitted. + */ +void +pixel_checker_init (pixel_checker_t *checker, pixman_format_code_t format) +{ + assert (PIXMAN_FORMAT_VIS (format)); + + checker->format = format; + + if (format == PIXMAN_rgba_float || + format == PIXMAN_rgb_float) + return; + + switch (PIXMAN_FORMAT_TYPE (format)) + { + case PIXMAN_TYPE_A: + checker->bs = 0; + checker->gs = 0; + checker->rs = 0; + checker->as = 0; + break; + + case PIXMAN_TYPE_ARGB: + case PIXMAN_TYPE_ARGB_SRGB: + checker->bs = 0; + checker->gs = checker->bs + PIXMAN_FORMAT_B (format); + checker->rs = checker->gs + PIXMAN_FORMAT_G (format); + checker->as = checker->rs + PIXMAN_FORMAT_R (format); + break; + + case PIXMAN_TYPE_ABGR: + checker->rs = 0; + checker->gs = checker->rs + PIXMAN_FORMAT_R (format); + checker->bs = checker->gs + PIXMAN_FORMAT_G (format); + checker->as = checker->bs + PIXMAN_FORMAT_B (format); + break; + + case PIXMAN_TYPE_BGRA: + /* With BGRA formats we start counting at the high end of the pixel */ + checker->bs = PIXMAN_FORMAT_BPP (format) - PIXMAN_FORMAT_B (format); + checker->gs = checker->bs - PIXMAN_FORMAT_B (format); + checker->rs = checker->gs - PIXMAN_FORMAT_G (format); + checker->as = checker->rs - PIXMAN_FORMAT_R (format); + break; + + case PIXMAN_TYPE_RGBA: + /* With BGRA formats we start counting at the high end of the pixel */ + checker->rs = PIXMAN_FORMAT_BPP (format) - PIXMAN_FORMAT_R (format); + checker->gs = checker->rs - PIXMAN_FORMAT_R (format); + checker->bs = checker->gs - PIXMAN_FORMAT_G (format); + checker->as = checker->bs - PIXMAN_FORMAT_B (format); + break; + + default: + assert (0); + break; + } + + checker->am = ((1U << PIXMAN_FORMAT_A (format)) - 1) << checker->as; + checker->rm = ((1U << PIXMAN_FORMAT_R (format)) - 1) << checker->rs; + checker->gm = ((1U << PIXMAN_FORMAT_G (format)) - 1) << checker->gs; + checker->bm = ((1U << PIXMAN_FORMAT_B (format)) - 1) << checker->bs; + + checker->aw = PIXMAN_FORMAT_A (format); + checker->rw = PIXMAN_FORMAT_R (format); + checker->gw = PIXMAN_FORMAT_G (format); + checker->bw = PIXMAN_FORMAT_B (format); + + checker->ad = DEVIATION; + checker->rd = DEVIATION; + checker->gd = DEVIATION; + checker->bd = DEVIATION; +} + +/* When dithering is enabled, we allow one extra pixel of tolerance + */ +void +pixel_checker_allow_dither (pixel_checker_t *checker) +{ + checker->ad += 1 / (double)((1 << checker->aw) - 1); + checker->rd += 1 / (double)((1 << checker->rw) - 1); + checker->gd += 1 / (double)((1 << checker->gw) - 1); + checker->bd += 1 / (double)((1 << checker->bw) - 1); +} + +static void +pixel_checker_require_uint32_format (const pixel_checker_t *checker) +{ + assert (checker->format != PIXMAN_rgba_float && + checker->format != PIXMAN_rgb_float); +} + +void +pixel_checker_split_pixel (const pixel_checker_t *checker, uint32_t pixel, + int *a, int *r, int *g, int *b) +{ + pixel_checker_require_uint32_format(checker); + + *a = (pixel & checker->am) >> checker->as; + *r = (pixel & checker->rm) >> checker->rs; + *g = (pixel & checker->gm) >> checker->gs; + *b = (pixel & checker->bm) >> checker->bs; +} + +void +pixel_checker_get_masks (const pixel_checker_t *checker, + uint32_t *am, + uint32_t *rm, + uint32_t *gm, + uint32_t *bm) +{ + pixel_checker_require_uint32_format(checker); + + if (am) + *am = checker->am; + if (rm) + *rm = checker->rm; + if (gm) + *gm = checker->gm; + if (bm) + *bm = checker->bm; +} + +void +pixel_checker_convert_pixel_to_color (const pixel_checker_t *checker, + uint32_t pixel, color_t *color) +{ + int a, r, g, b; + + pixel_checker_require_uint32_format(checker); + + pixel_checker_split_pixel (checker, pixel, &a, &r, &g, &b); + + if (checker->am == 0) + color->a = 1.0; + else + color->a = a / (double)(checker->am >> checker->as); + + if (checker->rm == 0) + color->r = 0.0; + else + color->r = r / (double)(checker->rm >> checker->rs); + + if (checker->gm == 0) + color->g = 0.0; + else + color->g = g / (double)(checker->gm >> checker->gs); + + if (checker->bm == 0) + color->b = 0.0; + else + color->b = b / (double)(checker->bm >> checker->bs); + + if (PIXMAN_FORMAT_TYPE (checker->format) == PIXMAN_TYPE_ARGB_SRGB) + { + color->r = convert_srgb_to_linear (color->r); + color->g = convert_srgb_to_linear (color->g); + color->b = convert_srgb_to_linear (color->b); + } +} + +static int32_t +convert (double v, uint32_t width, uint32_t mask, uint32_t shift, double def) +{ + int32_t r; + + if (!mask) + v = def; + + r = (v * ((mask >> shift) + 1)); + r -= r >> width; + + return r; +} + +static void +get_limits (const pixel_checker_t *checker, double sign, + color_t *color, + int *ao, int *ro, int *go, int *bo) +{ + color_t tmp; + + if (PIXMAN_FORMAT_TYPE (checker->format) == PIXMAN_TYPE_ARGB_SRGB) + { + tmp.a = color->a; + tmp.r = convert_linear_to_srgb (color->r); + tmp.g = convert_linear_to_srgb (color->g); + tmp.b = convert_linear_to_srgb (color->b); + + color = &tmp; + } + + *ao = convert (color->a + sign * checker->ad, + checker->aw, checker->am, checker->as, 1.0); + *ro = convert (color->r + sign * checker->rd, + checker->rw, checker->rm, checker->rs, 0.0); + *go = convert (color->g + sign * checker->gd, + checker->gw, checker->gm, checker->gs, 0.0); + *bo = convert (color->b + sign * checker->bd, + checker->bw, checker->bm, checker->bs, 0.0); +} + +void +pixel_checker_get_max (const pixel_checker_t *checker, color_t *color, + int *am, int *rm, int *gm, int *bm) +{ + pixel_checker_require_uint32_format(checker); + + get_limits (checker, 1, color, am, rm, gm, bm); +} + +void +pixel_checker_get_min (const pixel_checker_t *checker, color_t *color, + int *am, int *rm, int *gm, int *bm) +{ + pixel_checker_require_uint32_format(checker); + + get_limits (checker, - 1, color, am, rm, gm, bm); +} + +pixman_bool_t +pixel_checker_check (const pixel_checker_t *checker, uint32_t pixel, + color_t *color) +{ + int32_t a_lo, a_hi, r_lo, r_hi, g_lo, g_hi, b_lo, b_hi; + int32_t ai, ri, gi, bi; + pixman_bool_t result; + + pixel_checker_require_uint32_format(checker); + + pixel_checker_get_min (checker, color, &a_lo, &r_lo, &g_lo, &b_lo); + pixel_checker_get_max (checker, color, &a_hi, &r_hi, &g_hi, &b_hi); + pixel_checker_split_pixel (checker, pixel, &ai, &ri, &gi, &bi); + + result = + a_lo <= ai && ai <= a_hi && + r_lo <= ri && ri <= r_hi && + g_lo <= gi && gi <= g_hi && + b_lo <= bi && bi <= b_hi; + + return result; +} + +static void +color_limits (const pixel_checker_t *checker, + double limit, const color_t *color, color_t *out) +{ + if (PIXMAN_FORMAT_A(checker->format)) + out->a = color->a + limit; + else + out->a = 1.; + + out->r = color->r + limit; + out->g = color->g + limit; + out->b = color->b + limit; +} + +pixman_bool_t +pixel_checker_check_color (const pixel_checker_t *checker, + const color_t *actual, const color_t *reference) +{ + color_t min, max; + pixman_bool_t result; + + color_limits(checker, -DEVIATION, reference, &min); + color_limits(checker, DEVIATION, reference, &max); + + result = + actual->a >= min.a && actual->a <= max.a && + actual->r >= min.r && actual->r <= max.r && + actual->g >= min.g && actual->g <= max.g && + actual->b >= min.b && actual->b <= max.b; + + return result; +} diff --git a/libs/pixman-0.40.0/test/utils.h b/libs/pixman-0.40.0/test/utils.h new file mode 100644 index 0000000..701417f --- /dev/null +++ b/libs/pixman-0.40.0/test/utils.h @@ -0,0 +1,295 @@ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <assert.h> +#include "pixman-private.h" /* For 'inline' definition */ +#include "utils-prng.h" + +#if defined(_MSC_VER) +#define snprintf _snprintf +#define strcasecmp _stricmp +#endif + +#define ARRAY_LENGTH(A) ((int) (sizeof (A) / sizeof ((A) [0]))) + +/* A primitive pseudorandom number generator, + * taken from POSIX.1-2001 example + */ + +extern prng_t prng_state_data; +extern prng_t *prng_state; +#ifdef USE_OPENMP +#pragma omp threadprivate(prng_state_data) +#pragma omp threadprivate(prng_state) +#endif + +static inline uint32_t +prng_rand (void) +{ + return prng_rand_r (prng_state); +} + +static inline void +prng_srand (uint32_t seed) +{ + if (!prng_state) + { + /* Without setting a seed, PRNG does not work properly (is just + * returning zeros). So we only initialize the pointer here to + * make sure that 'prng_srand' is always called before any + * other 'prng_*' function. The wrongdoers violating this order + * will get a segfault. */ + prng_state = &prng_state_data; + } + prng_srand_r (prng_state, seed); +} + +static inline uint32_t +prng_rand_n (int max) +{ + return prng_rand () % max; +} + +static inline void +prng_randmemset (void *buffer, size_t size, prng_randmemset_flags_t flags) +{ + prng_randmemset_r (prng_state, buffer, size, flags); +} + +/* CRC 32 computation + */ +uint32_t +compute_crc32 (uint32_t in_crc32, + const void *buf, + size_t buf_len); + +uint32_t +compute_crc32_for_image (uint32_t in_crc32, + pixman_image_t *image); + +/* Print the image in hexadecimal */ +void +print_image (pixman_image_t *image); + +/* Returns TRUE if running on a little endian system + */ +static force_inline pixman_bool_t +is_little_endian (void) +{ + unsigned long endian_check_var = 1; + return *(unsigned char *)&endian_check_var == 1; +} + +/* perform endian conversion of pixel data + */ +void +image_endian_swap (pixman_image_t *img); + +#if defined (HAVE_MPROTECT) && defined (HAVE_GETPAGESIZE) && \ + defined (HAVE_SYS_MMAN_H) && defined (HAVE_MMAP) +/* fence_malloc and friends have working fence implementation. + * Without this, fence_malloc still allocs but does not catch + * out-of-bounds accesses. + */ +#define FENCE_MALLOC_ACTIVE 1 +#else +#define FENCE_MALLOC_ACTIVE 0 +#endif + +/* Allocate memory that is bounded by protected pages, + * so that out-of-bounds access will cause segfaults + */ +void * +fence_malloc (int64_t len); + +void +fence_free (void *data); + +pixman_image_t * +fence_image_create_bits (pixman_format_code_t format, + int min_width, + int height, + pixman_bool_t stride_fence); + +/* Return the page size if FENCE_MALLOC_ACTIVE, or zero otherwise */ +unsigned long +fence_get_page_size (); + +/* Generate n_bytes random bytes in fence_malloced memory */ +uint8_t * +make_random_bytes (int n_bytes); +float * +make_random_floats (int n_bytes); + +/* Return current time in seconds */ +double +gettime (void); + +uint32_t +get_random_seed (void); + +/* main body of the fuzzer test */ +int +fuzzer_test_main (const char *test_name, + int default_number_of_iterations, + uint32_t expected_checksum, + uint32_t (*test_function)(int testnum, int verbose), + int argc, + const char *argv[]); + +void +fail_after (int seconds, const char *msg); + +/* If possible, enable traps for floating point exceptions */ +void enable_divbyzero_exceptions(void); +void enable_invalid_exceptions(void); + +/* Converts a8r8g8b8 pixels to pixels that + * - are not premultiplied, + * - are stored in this order in memory: R, G, B, A, regardless of + * the endianness of the computer. + * It is allowed for @src and @dst to point to the same memory buffer. + */ +void +a8r8g8b8_to_rgba_np (uint32_t *dst, uint32_t *src, int n_pixels); + +pixman_bool_t +write_png (pixman_image_t *image, const char *filename); + +void +draw_checkerboard (pixman_image_t *image, + int check_size, + uint32_t color1, uint32_t color2); + +/* A pair of macros which can help to detect corruption of + * floating point registers after a function call. This may + * happen if _mm_empty() call is forgotten in MMX/SSE2 fast + * path code, or ARM NEON assembly optimized function forgets + * to save/restore d8-d15 registers before use. + */ + +#define FLOAT_REGS_CORRUPTION_DETECTOR_START() \ + static volatile double frcd_volatile_constant1 = 123451; \ + static volatile double frcd_volatile_constant2 = 123452; \ + static volatile double frcd_volatile_constant3 = 123453; \ + static volatile double frcd_volatile_constant4 = 123454; \ + static volatile double frcd_volatile_constant5 = 123455; \ + static volatile double frcd_volatile_constant6 = 123456; \ + static volatile double frcd_volatile_constant7 = 123457; \ + static volatile double frcd_volatile_constant8 = 123458; \ + double frcd_canary_variable1 = frcd_volatile_constant1; \ + double frcd_canary_variable2 = frcd_volatile_constant2; \ + double frcd_canary_variable3 = frcd_volatile_constant3; \ + double frcd_canary_variable4 = frcd_volatile_constant4; \ + double frcd_canary_variable5 = frcd_volatile_constant5; \ + double frcd_canary_variable6 = frcd_volatile_constant6; \ + double frcd_canary_variable7 = frcd_volatile_constant7; \ + double frcd_canary_variable8 = frcd_volatile_constant8; + +#define FLOAT_REGS_CORRUPTION_DETECTOR_FINISH() \ + assert (frcd_canary_variable1 == frcd_volatile_constant1); \ + assert (frcd_canary_variable2 == frcd_volatile_constant2); \ + assert (frcd_canary_variable3 == frcd_volatile_constant3); \ + assert (frcd_canary_variable4 == frcd_volatile_constant4); \ + assert (frcd_canary_variable5 == frcd_volatile_constant5); \ + assert (frcd_canary_variable6 == frcd_volatile_constant6); \ + assert (frcd_canary_variable7 == frcd_volatile_constant7); \ + assert (frcd_canary_variable8 == frcd_volatile_constant8); + +/* Try to get an aligned memory chunk */ +void * +aligned_malloc (size_t align, size_t size); + +double +convert_srgb_to_linear (double component); + +double +convert_linear_to_srgb (double component); + +void +initialize_palette (pixman_indexed_t *palette, uint32_t depth, int is_rgb); + +pixman_format_code_t +format_from_string (const char *s); + +void +list_formats (void); + +void +list_operators (void); + +void list_dithers (void); + +pixman_op_t +operator_from_string (const char *s); + +pixman_dither_t +dither_from_string (const char *s); + +const char * +operator_name (pixman_op_t op); + +const char * +format_name (pixman_format_code_t format); + +const char * +dither_name (pixman_dither_t dither); + +typedef struct +{ + double r, g, b, a; +} color_t; + +void +do_composite (pixman_op_t op, + const color_t *src, + const color_t *mask, + const color_t *dst, + color_t *result, + pixman_bool_t component_alpha); + +void +round_color (pixman_format_code_t format, color_t *color); + +typedef struct +{ + pixman_format_code_t format; + uint32_t am, rm, gm, bm; + uint32_t as, rs, gs, bs; + uint32_t aw, rw, gw, bw; + float ad, rd, gd, bd; +} pixel_checker_t; + +void +pixel_checker_init (pixel_checker_t *checker, pixman_format_code_t format); + +void +pixel_checker_allow_dither (pixel_checker_t *checker); + +void +pixel_checker_split_pixel (const pixel_checker_t *checker, uint32_t pixel, + int *a, int *r, int *g, int *b); + +void +pixel_checker_get_max (const pixel_checker_t *checker, color_t *color, + int *a, int *r, int *g, int *b); + +void +pixel_checker_get_min (const pixel_checker_t *checker, color_t *color, + int *a, int *r, int *g, int *b); + +pixman_bool_t +pixel_checker_check (const pixel_checker_t *checker, + uint32_t pixel, color_t *color); + +void +pixel_checker_convert_pixel_to_color (const pixel_checker_t *checker, + uint32_t pixel, color_t *color); + +void +pixel_checker_get_masks (const pixel_checker_t *checker, + uint32_t *am, + uint32_t *rm, + uint32_t *gm, + uint32_t *bm); |