[Pixman] [PATCH 1/2] MIPS: DSPr2: Basic infrastructure for MIPS architecture

Søren Sandmann sandmann at cs.au.dk
Wed Feb 15 17:58:45 PST 2012


Nemanja Lukic <nlukic at mips.com> writes:

> From: Nemanja Lukic <nemanja.lukic at rt-rk.com>
>
> MIPS DSP instruction set extensions
> ---
>  configure.ac               |   42 ++++++++++++++++++++++++++++
>  pixman/Makefile.am         |   13 ++++++++
>  pixman/pixman-cpu.c        |   66 ++++++++++++++++++++++++++++++++++++++++++++
>  pixman/pixman-mips-dspr2.c |   51 ++++++++++++++++++++++++++++++++++
>  pixman/pixman-mips-dspr2.h |   38 +++++++++++++++++++++++++
>  pixman/pixman-private.h    |    5 +++
>  6 files changed, 215 insertions(+), 0 deletions(-)
>  create mode 100644 pixman/pixman-mips-dspr2.c
>  create mode 100644 pixman/pixman-mips-dspr2.h
>
> diff --git a/configure.ac b/configure.ac
> index 2eded70..3d035b0 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -591,6 +591,48 @@ fi
>  
>  AM_CONDITIONAL(USE_ARM_IWMMXT, test $have_iwmmxt_intrinsics = yes)
>  
> +dnl ==========================================================================
> +dnl Check if assembler is gas compatible and supports MIPS DSPr2 instructions
> +have_mips_dspr2=no
> +AC_MSG_CHECKING(whether to use MIPS DSPr2 assembler)
> +xserver_save_CFLAGS=$CFLAGS
> +AC_COMPILE_IFELSE([[
> +#if defined(__mips__) && defined(__mips_dsp) && (__mips_dsp_rev < 2)
> +#error MIPS DSPr2 is required (-mdspr2 flag must be added to CFLAGS)

If the -mdspr2 flag is required, shouldn't the configure script just add
it, similarly to -msse2 for SSE2 for example?

> +#if defined(USE_MIPS_DSPR2)
> +
> +#if defined (__linux__) /* linux ELF */
> +
> +pixman_bool_t
> +pixman_have_mips_dspr2 (void)
> +{
> +    const char *search_string = "dsp";
> +    const char *file_name = "/proc/cpuinfo";
> +    /* Simple detection of MIPS DSP ASE 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.

I'm not sure what the point of this runtime detection is if it doesn't
actually detect DSPr2. Or is there no hardware out there with DSPr1, but
not DSPr2?

The only real reason to have runtime detection is if people want to ship
binaries that can run on multiple chips, but I don't think that's very
common for MIPS at this point. So if it doesn't work, we might as well
just always enable the DSPr2 support and let people disable it at
configure time if they want to ship pixman on hardware without it.


Søren


More information about the Pixman mailing list