gfx/cairo/libpixman/src/pixman-mips.c
author Jeff Muizelaar <jmuizelaar@mozilla.com>
Mon, 04 Feb 2013 15:16:01 -0500
changeset 130670 17b8b22c24f89516062a27af9b2d434fc4d5314b
parent 128202 bb755890ec697fc2aa3ce5745ac99749a822ccb5
permissions -rw-r--r--
Bug 836171. Update pixman to 0.27.4 Andrea Canciani (2): mmx: Fix x86 build on MSVC build: Improve win32 build system Benny Siegert (1): configure.ac: PIXMAN_LINK_WITH_ENV fix Matt Turner (3): build: Remove useless DEP_CFLAGS/DEP_LIBS variables sse2: mark pack_565_2x128_128 as static force_inline iwmmxt: Don't define dummy _mm_empty for >=gcc-4.8 Nemanja Lukic (7): MIPS: DSPr2: Added fast-paths for OVER operation: - over_8888_n_8888 - over_8888_8_8888 MIPS: DSPr2: Added fast-paths for OVER operation: - over_8888_n_0565 - over_8888_8_0565 MIPS: DSPr2: Added fast-paths for OVER operation: - over_0565_n_0565 - over_0565_8_0565 MIPS: DSPr2: Added OVER combiner and two new fast paths: - over_8888_8888 - over_8888_8888_8888 MIPS: DSPr2: Added fast-paths for ADD operation: - add_n_8_8 - add_n_8_8888 - add_8_8_8 MIPS: DSPr2: Added more fast-paths for ADD operation: - add_0565_8_0565 - add_8888_8_8888 - add_8888_n_8888 MIPS: DSPr2: Added more fast-paths for ADD operation: - add_8888_8888_8888 - add_8_8 - add_8888_8888 Siarhei Siamashka (4): Add scaled nearest repeat fast paths MIPS: skip runtime detection for DSPr2 if -mdspr2 option is in CFLAGS Add missing force_inline to in() function used for C fast paths Workaround for FTBFS with gcc 4.6 (http://gcc.gnu.org/PR54965) Søren Sandmann Pedersen (44): Post-release version bump to 0.27.3 Define TIMER_BEGIN and TIMER_END even when timers are not enabled Make show_image() cope with more formats demos: Add srgb_trap_test.c Remove pointless declaration of _pixman_image_get_scanline_generic_64() Remove obsolete TODO file pixel_checker: Move sRGB conversion into get_limits() test/utils.c: Use pow(), not powf() in sRGB conversion routines implementation: Write lookup_combiner() in a less convoluted way. Move blt delegation into pixman-implementation.c Move fill delegation into pixman-implementation.c Move delegation of src/dest iter init into pixman-implementation.c Rename _pixman_lookup_composite_function() to _pixman_implementation_lookup_composite() _pixman_implementation_create(): Initialize implementation with memset() implementation: Rename delegate to fallback Add PIXMAN_x8b8g8r8 and PIXMAN_a8b8g8r8 formats to scaling-test Fix bug in fast_composite_scaled_nearest() Fix bugs in component alpha combiners for separable PDF operators Add rotate-test.c test program Fix bugs in pixman-image.c pixman-combine.c.template: Formatting clean-ups affine-test: Print out the transformation matrix when verbose test: Add inifinite-loop test Fix for infinite-loop test rotate-test: Call image_endian_swap() in make_image() Make pixman.h more const-correct glyph-test: Prepare for floating point blitters-test: Prepare for floating point Add pixman-combine-float.c Add combiner test pixman-utils.c, pixman-private.h: Add floating point conversion routines pixman-access.c: Add floating point accessor functions Switch the wide pipeline over to using floating point Remove 64 bit pipeline Don't auto-generate pixman-combine32.[ch] anymore Speed up pixman_expand_to_float() Remove BUILT_SOURCES Only regard images as pixbufs if they have identity transformations region: Formatting fix region: Remove overlap argument from pixman_op() Add new pixman_image_create_bits_no_clear() API pixman_composite_trapezoids(): Factor out extents computation pixman_composite_trapezoids(): don't clip to extents for some operators Pre-release version bump to 0.27.4

/*
 * Copyright © 2000 SuSE, Inc.
 * Copyright © 2007 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 SuSE not be used in advertising or
 * publicity pertaining to distribution of the software without specific,
 * written prior permission.  SuSE makes no representations about the
 * suitability of this software for any purpose.  It is provided "as is"
 * without express or implied warranty.
 *
 * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
 * 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 "pixman-private.h"

#if defined(USE_MIPS_DSPR2) || defined(USE_LOONGSON_MMI)

#include <string.h>
#include <stdlib.h>

static pixman_bool_t
have_feature (const char *search_string)
{
#if defined (__linux__) /* linux ELF */
    /* Simple detection of MIPS features at runtime for Linux.
     * It is based on /proc/cpuinfo, which reveals hardware configuration
     * to user-space applications.  According to MIPS (early 2010), no similar
     * facility is universally available on the MIPS architectures, so it's up
     * to individual OSes to provide such.
     */
    const char *file_name = "/proc/cpuinfo";
    char cpuinfo_line[256];
    FILE *f = NULL;

    if ((f = fopen (file_name, "r")) == NULL)
        return FALSE;

    while (fgets (cpuinfo_line, sizeof (cpuinfo_line), f) != NULL)
    {
        if (strstr (cpuinfo_line, search_string) != NULL)
        {
            fclose (f);
            return TRUE;
        }
    }

    fclose (f);
#endif

    /* Did not find string in the proc file, or not Linux ELF. */
    return FALSE;
}

#endif

pixman_implementation_t *
_pixman_mips_get_implementations (pixman_implementation_t *imp)
{
#ifdef USE_LOONGSON_MMI
    /* I really don't know if some Loongson CPUs don't have MMI. */
    if (!_pixman_disabled ("loongson-mmi") && have_feature ("Loongson"))
	imp = _pixman_implementation_create_mmx (imp);
#endif

#ifdef USE_MIPS_DSPR2
    if (!_pixman_disabled ("mips-dspr2"))
    {
	int already_compiling_everything_for_dspr2 = 0;
#if defined(__mips_dsp) && (__mips_dsp_rev >= 2)
	already_compiling_everything_for_dspr2 = 1;
#endif
	if (already_compiling_everything_for_dspr2 ||
	    /* Only currently available MIPS core that supports DSPr2 is 74K. */
	    have_feature ("MIPS 74K"))
	{
	    imp = _pixman_implementation_create_mips_dspr2 (imp);
	}
    }
#endif

    return imp;
}