Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 540712 - x11-libs/pixman - add USE=cpudetection / SIMD for ARM / translate USE=cpu_flags_x86_mmxext to internal flag "mmx"
Summary: x11-libs/pixman - add USE=cpudetection / SIMD for ARM / translate USE=cpu_fla...
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo X packagers
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2015-02-19 22:48 UTC by INODE64 Sistemas
Modified: 2015-02-28 15:53 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
pixman-0.32.6.diff (pixman-0.32.6.diff,1.90 KB, patch)
2015-02-19 22:48 UTC, INODE64 Sistemas
Details | Diff
pixman-0.32.6.ebuild.diff (pixman-0.32.6.ebuild.diff,1.87 KB, patch)
2015-02-20 18:50 UTC, INODE64 Sistemas
Details | Diff
pixman-0.32.6.ebuild.diff (pixman-0.32.6.ebuild.diff,1.93 KB, patch)
2015-02-28 15:53 UTC, INODE64 Sistemas
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description INODE64 Sistemas 2015-02-19 22:48:05 UTC
1º Include support for cpudetection
2º Fix mmx not mmxext
3º include support for simd in arm

I test in same computer with / without sse2 and ssse3 and run fine
See the code for validate:

pixman/pixman-x86.c - line 232
----------------------------------------------------------
#ifdef USE_X86_MMX
    if (!_pixman_disabled ("mmx") && have_feature (MMX_BITS))
        imp = _pixman_implementation_create_mmx (imp);
#endif

#ifdef USE_SSE2
    if (!_pixman_disabled ("sse2") && have_feature (SSE2_BITS))
        imp = _pixman_implementation_create_sse2 (imp);
#endif

#ifdef USE_SSSE3
    if (!_pixman_disabled ("ssse3") && have_feature (SSSE3_BITS))
        imp = _pixman_implementation_create_ssse3 (imp);
#endif


pixman/pixman-arm.c - line 209
----------------------------------------------------------
#ifdef USE_ARM_SIMD
    if (!_pixman_disabled ("arm-simd") && have_feature (ARM_V6))
        imp = _pixman_implementation_create_arm_simd (imp);
#endif

#ifdef USE_ARM_IWMMXT
    if (!_pixman_disabled ("arm-iwmmxt") && have_feature (ARM_IWMMXT))
        imp = _pixman_implementation_create_mmx (imp);
#endif

#ifdef USE_ARM_NEON
    if (!_pixman_disabled ("arm-neon") && have_feature (ARM_NEON))
        imp = _pixman_implementation_create_arm_neon (imp);
#endif


pixman/pixman-mips.c - line 77
----------------------------------------------------------
#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



pixman/pixman-ppc.c - line 149
----------------------------------------------------------
#ifdef USE_VMX
    if (!_pixman_disabled ("vmx") && pixman_have_vmx ())
        imp = _pixman_implementation_create_vmx (imp);
#endif

TODO
* Support dspr2 in mips
* Use of cpu_flags arm,ppc and mips

Reproducible: Always
Comment 1 INODE64 Sistemas 2015-02-19 22:48:43 UTC
Created attachment 397014 [details, diff]
pixman-0.32.6.diff
Comment 2 Jeroen Roovers (RETIRED) gentoo-dev 2015-02-20 07:52:36 UTC
USE=cpudetection is commonly used to denote run-time CPU detection, not compile-time CPU detection. The entire exercise seems to mirror what CPU_FLAGS is doing already.
Comment 3 INODE64 Sistemas 2015-02-20 12:18:53 UTC
Yes, the pixman check in run-time CPU detection 

see the code in pixman/pixman-x86.c line 163

    /* Get feature bits */
    pixman_cpuid (0x01, &a, &b, &c, &d);
    if (d & (1 << 15))
        features |= X86_CMOV;
    if (d & (1 << 23))
        features |= X86_MMX;
    if (d & (1 << 25))
        features |= X86_SSE;
    if (d & (1 << 26))
        features |= X86_SSE2;
    if (c & (1 << 9))
        features |= X86_SSSE3;
Comment 4 Matt Turner gentoo-dev 2015-02-20 16:52:07 UTC
(In reply to INODE64 Sistemas from comment #0)
> 1º Include support for cpudetection

Pixman supports CPU detection. Adding a cpudetection flag would do... what exactly? There's not a configure knob to disable cpudetection. 

> 2º Fix mmx not mmxext

No, it's supposed to be mmxext.

> 3º include support for simd in arm

I'm not sure it's worth it. The overwhelming majority of Gentoo ARM systems are v6+.

Maybe some explanation why you think these should be done would help?
Comment 5 Matt Turner gentoo-dev 2015-02-20 16:56:09 UTC
(In reply to Matt Turner from comment #4)
> (In reply to INODE64 Sistemas from comment #0)
> > 3º include support for simd in arm
> 
> I'm not sure it's worth it. The overwhelming majority of Gentoo ARM systems
> are v6+.

I should note that ffmpeg does have an armv6 flag, so adding one to pixman wouldn't be covering new ground.
Comment 6 INODE64 Sistemas 2015-02-20 18:19:10 UTC
(In reply to Matt Turner from comment #4)
> (In reply to INODE64 Sistemas from comment #0)
> > 1º Include support for cpudetection
> 
> Pixman supports CPU detection. Adding a cpudetection flag would do... what
> exactly? There's not a configure knob to disable cpudetection. 
> 
> > 2º Fix mmx not mmxext
> 
> No, it's supposed to be mmxext.
> 
> > 3º include support for simd in arm
> 
> I'm not sure it's worth it. The overwhelming majority of Gentoo ARM systems
> are v6+.
> 
> Maybe some explanation why you think these should be done would help?

The pixman check in run-time the features of CPU (sse, mmx and ssse3)
If you enable this in configure, pixman always this feature before run the appropriate optimize code

mmxext is not used only mmx in pixman
Comment 7 INODE64 Sistemas 2015-02-20 18:50:01 UTC
Created attachment 397082 [details, diff]
pixman-0.32.6.ebuild.diff

Change simd for armv6
Comment 8 Matt Turner gentoo-dev 2015-02-20 19:09:53 UTC
(In reply to INODE64 Sistemas from comment #6)
> mmxext is not used only mmx in pixman

You're arguing with the person who made pixman use mmxext instructions.

The thing you're missing is that three lines above

#ifdef USE_X86_MMX
    if (!_pixman_disabled ("mmx") && have_feature (MMX_BITS))
        imp = _pixman_implementation_create_mmx (imp);
#endif

is

#define MMX_BITS  (X86_MMX | X86_MMX_EXTENSIONS)
Comment 9 Matt Turner gentoo-dev 2015-02-20 19:12:57 UTC
Comment on attachment 397082 [details, diff]
pixman-0.32.6.ebuild.diff

Thanks for the patch, but this is too much. We don't need to protect all of these flags with use {mips,ppc,arm,...}. The flags are masked by the profiles, so they cannot be set on the wrong platforms.

If you want to send a patch to simply add an armv6 use flag (and to add <flag name="armv6">Enables optimizations for armv6 processors.</flag> to metadata.xml) I'd happily accept that.
Comment 10 INODE64 Sistemas 2015-02-20 19:24:50 UTC
(In reply to Matt Turner from comment #8)
> (In reply to INODE64 Sistemas from comment #6)
> > mmxext is not used only mmx in pixman
> 
> You're arguing with the person who made pixman use mmxext instructions.
> 
> The thing you're missing is that three lines above
> 
> #ifdef USE_X86_MMX
>     if (!_pixman_disabled ("mmx") && have_feature (MMX_BITS))
>         imp = _pixman_implementation_create_mmx (imp);
> #endif
> 
> is
> 
> #define MMX_BITS  (X86_MMX | X86_MMX_EXTENSIONS)

| is or. X86_MMX or X86_MMX_EXTENSIONS

MMX_EXTENSIONS include cpu instructions of MMX too

in the code no use exclusive MMX_EXTENSIONS
Comment 11 INODE64 Sistemas 2015-02-20 19:27:43 UTC
(In reply to Matt Turner from comment #9)
> Comment on attachment 397082 [details, diff] [details, diff]
> pixman-0.32.6.ebuild.diff
> 
> Thanks for the patch, but this is too much. We don't need to protect all of
> these flags with use {mips,ppc,arm,...}. The flags are masked by the
> profiles, so they cannot be set on the wrong platforms.
> 
> If you want to send a patch to simply add an armv6 use flag (and to add
> <flag name="armv6">Enables optimizations for armv6 processors.</flag> to
> metadata.xml) I'd happily accept that.

This flags are masked by arch.

Other question is make syntax for each arch, similar to cpu_flags_x86

cpu_flags_arm_armv6
cpu_flags_arm_neon
.
.
.
Comment 12 Matt Turner gentoo-dev 2015-02-20 19:50:34 UTC
(In reply to INODE64 Sistemas from comment #10)
> (In reply to Matt Turner from comment #8)
> > (In reply to INODE64 Sistemas from comment #6)
> > > mmxext is not used only mmx in pixman
> > 
> > You're arguing with the person who made pixman use mmxext instructions.
> > 
> > The thing you're missing is that three lines above
> > 
> > #ifdef USE_X86_MMX
> >     if (!_pixman_disabled ("mmx") && have_feature (MMX_BITS))
> >         imp = _pixman_implementation_create_mmx (imp);
> > #endif
> > 
> > is
> > 
> > #define MMX_BITS  (X86_MMX | X86_MMX_EXTENSIONS)
> 
> | is or. X86_MMX or X86_MMX_EXTENSIONS
> 
> MMX_EXTENSIONS include cpu instructions of MMX too
> 
> in the code no use exclusive MMX_EXTENSIONS

Are you serious? Read the code, specifically have_feature(). I'm not going to argue with you about this other than to point you to

http://cgit.freedesktop.org/pixman/commit/?id=14208344964f341a7b4a704b05cf4804c23792e9

http://cgit.freedesktop.org/pixman/commit/?id=84221f4c1687b8ea14e9cbdc78b2ba7258e62c9e
Comment 13 Matt Turner gentoo-dev 2015-02-20 19:53:02 UTC
(In reply to INODE64 Sistemas from comment #11)
> (In reply to Matt Turner from comment #9)
> > Comment on attachment 397082 [details, diff] [details, diff] [details, diff]
> > pixman-0.32.6.ebuild.diff
> > 
> > Thanks for the patch, but this is too much. We don't need to protect all of
> > these flags with use {mips,ppc,arm,...}. The flags are masked by the
> > profiles, so they cannot be set on the wrong platforms.
> > 
> > If you want to send a patch to simply add an armv6 use flag (and to add
> > <flag name="armv6">Enables optimizations for armv6 processors.</flag> to
> > metadata.xml) I'd happily accept that.
> 
> This flags are masked by arch.

I'm not sure if you're agreeing with me or...

> Other question is make syntax for each arch, similar to cpu_flags_x86
> 
> cpu_flags_arm_armv6
> cpu_flags_arm_neon
> .
> .
> .

That needs to happen outside of pixman first, like CPU_FLAGS_X86 did.
Comment 14 INODE64 Sistemas 2015-02-20 21:29:45 UTC
(In reply to Matt Turner from comment #12)
> (In reply to INODE64 Sistemas from comment #10)
> > (In reply to Matt Turner from comment #8)
> > > (In reply to INODE64 Sistemas from comment #6)
> > > > mmxext is not used only mmx in pixman
> > > 
> > > You're arguing with the person who made pixman use mmxext instructions.
> > > 
> > > The thing you're missing is that three lines above
> > > 
> > > #ifdef USE_X86_MMX
> > >     if (!_pixman_disabled ("mmx") && have_feature (MMX_BITS))
> > >         imp = _pixman_implementation_create_mmx (imp);
> > > #endif
> > > 
> > > is
> > > 
> > > #define MMX_BITS  (X86_MMX | X86_MMX_EXTENSIONS)
> > 
> > | is or. X86_MMX or X86_MMX_EXTENSIONS
> > 
> > MMX_EXTENSIONS include cpu instructions of MMX too
> > 
> > in the code no use exclusive MMX_EXTENSIONS
> 
> Are you serious? Read the code, specifically have_feature(). I'm not going
> to argue with you about this other than to point you to
> 
> http://cgit.freedesktop.org/pixman/commit/
> ?id=14208344964f341a7b4a704b05cf4804c23792e9
> 
> http://cgit.freedesktop.org/pixman/commit/
> ?id=84221f4c1687b8ea14e9cbdc78b2ba7258e62c9e

Well according to SSE2 code is also would need MMX, MMXEXT and SSE, the INTEL processors do not support AMD MMXEXT only
Comment 15 Matt Turner gentoo-dev 2015-02-21 21:12:03 UTC
(In reply to INODE64 Sistemas from comment #14)
> Well according to SSE2 code is also would need MMX, MMXEXT and SSE, the
> INTEL processors do not support AMD MMXEXT only

No again. The value of X86_SSE, which gets set if the SSE CPUID bit is set, is

>    X86_SSE			= (1 << 2) | X86_MMX_EXTENSIONS,

I'll plan to add an armv6 flag to the next version bump of pixman. Thanks for pointing that out. I'm going to mark the bug UPSTREAM (because there's not a "WILLFIX") so I don't have to think about arguing with you anymore.
Comment 16 INODE64 Sistemas 2015-02-28 15:53:15 UTC
Created attachment 397680 [details, diff]
pixman-0.32.6.ebuild.diff

Sorry, you're right is MMXEXT:-(
I filtered the mmx and sse flags for intefieran in her process of automatic processor at runtime