[Pixman] [PATCH v2] build: improve control logic for enabling MMI.

Shiyou Yin yinshiyou-hf at loongson.cn
Mon Mar 9 13:43:25 UTC 2020

>-----Original Message-----
>From: Matt Turner [mailto:mattst88 at gmail.com]
>Sent: Monday, March 9, 2020 9:00 AM
>To: Shiyou Yin
>Cc: pixman
>Subject: Re: [Pixman] [PATCH v2] build: improve control logic for enabling MMI.
>Thank you for the patch!
>On Fri, Mar 6, 2020 at 3:28 AM Shiyou Yin <yinshiyou-hf at loongson.cn> wrote:
>> From: Yin Shiyou <yinshiyou-hf at loongson>
>Should be yinshiyou-hf at loongson*.cn*?

Yes, will update.

>> 1. Replace LS_CFLAGS with MMI_CFLAGS to express its intention more accurately.
>>    LS_CFLAGS is still available, but it is not recommended.
>I'm not aware of any reasons why LS_CFLAGS needs to stay for
>compatibility. Do we know of any distros that set it to override the
>-march=... value?

No, keep LS_CFLAGS is just considering that users may be used to it.

>> 2. Improve the control logic for enabling MMI.
>> Three essential conditions for enabling MMI:
>> 1) user have not specify --disable-loongson-mmi.
>> 2) MMI options has been specified by MMI_CFLAGS,CC or compiler's default setting.
>> 3) compiler supports these MMI options.
>> ---
>>  configure.ac | 69 ++++++++++++++++++++++++++++++++++++++++--------------------
>We should also update meson.build. I expect/hope that the autotools
>build system will go away sometime in the future.

Will update.

>I'm not sure I entirely understand the patch. I understand that the
>objective is to make it possible to easily build pixman for Loongson3A
>and use the pixman-mmx.c optimizations.

It's my original goal. In my first patch, I replaced '-march=loongson2f'
with -mloongson-mmi directly. But it raised objections, Yunqiang said it will
cause break on 2F for the different opcode on 2F and 3A. I tried to find a 2F
to verify this, but I havn't found yet. 

>I think it's currently possible to build pixman on mips without
>specifying -march=loongson* in CFLAGS and it will enable the
>pixman-mmx.c paths and choose them at runtime. Is part of the goal to
>keep that working? If so, could we just use the -mloongson-mmi flag to
>compile pixman-mmx.c?

Yes, from last year, compiler has add '-mloongson-mmi' to support MMI,
It's not recommended to use -march=* to build MMI any more.
What we worry about is -march=loongson2f and -mloongson-mmi will generate
different opcode.(This is not verified yet.)

>Or does that flag mean the Loongson3A variants of the instructions?
>What happens if you compile with -march=loongson2f -mloongson-mmi?
>Does GCC generate instructions compatible with 2F or 3A?

I am still trying to find out a 2F to verify this.
If -mloongson-mmi works well on 2F, maybe we can revert to the first version of my patch.
If -mloongson-mmi caused break of 2F, then this patch may be a suitable option.

More information about the Pixman mailing list