>1. it breaks cross building This patch only let '-march=loongson2f' can be replaced with '-march=loongson-mmi' when compile locally on Loongson-3A. In other cases, nothing will be changed.
>2. qemu-user mode cannot make /proc/cpuinfo correct >3. sometimes, some user may want to build software in a chroot env >without /proc bind mount. If there are no '/proc/cpuinfo', grep will return nonzero, -march=loongson2f will be setted just like what it was setted before. Thanks very much, Your analysis is very comprehensive, do you have a fix to satisfy all the above cases. This patch can let us compile locally on Loongson-3A without setting option 'LS_CFLAGS=***'. In other cases like what you said, specify 'LS_CFLAGS=***' while compile may be the best approach. >-----Original Message----- >From: YunQiang Su [mailto:[email protected]] >Sent: Thursday, February 20, 2020 10:30 PM >To: Yin Shiyou >Cc: [email protected] >Subject: Re: [Pixman] [PATCH v2 2/3] build: use '-mloongson-mmi' for Loongson >MMI. > >Yin Shiyou <[email protected]> 于2020年2月20日周四 下午10:23写道: >> >> It's suggested to use '-mloongson-mmi' to enable MMI. >> To keep compatible with old processor, '-mloongson-mmi' will be >> setted for Loongson-3A only. > >Please resend the whole patch set. > >> --- >> configure.ac | 8 ++++++-- >> meson.build | 2 +- >> 2 files changed, 7 insertions(+), 3 deletions(-) >> >> diff --git a/configure.ac b/configure.ac >> index 1ca3974..2548799 100644 >> --- a/configure.ac >> +++ b/configure.ac >> @@ -271,9 +271,13 @@ PIXMAN_CHECK_CFLAG([-xldscope=hidden], [dnl >> >> dnl >> =========================================================================== >> dnl Check for Loongson Multimedia Instructions >> - >> if test "x$LS_CFLAGS" = "x" ; then >> - LS_CFLAGS="-march=loongson2f" >> + IS_LOONGSON_3A=`grep "Loongson-3A" /proc/cpuinfo` > >It is a bad way to determine CPU from cpuinfo: > >1. it breaks cross building >2. qemu-user mode cannot make /proc/cpuinfo correct >3. sometimes, some user may want to build software in a chroot env >without /proc bind mount. > >> + if test $? -eq 0 -a -n "$IS_LOONGSON_3A" ; then >> + LS_CFLAGS="-mloongson-mmi" >> + else >> + LS_CFLAGS="-march=loongson2f" >> + fi >> fi >> >> have_loongson_mmi=no >> diff --git a/meson.build b/meson.build >> index 15d3409..a45c969 100644 >> --- a/meson.build >> +++ b/meson.build >> @@ -51,7 +51,7 @@ endforeach >> >> use_loongson_mmi = get_option('loongson-mmi') >> have_loongson_mmi = false >> -loongson_mmi_flags = ['-march=loongson2f'] >> +loongson_mmi_flags = ['-mloongson-mmi'] >> if not use_loongson_mmi.disabled() >> if host_machine.cpu_family() == 'mips64' and cc.compiles(''' >> #ifndef __mips_loongson_vector_rev >> -- >> 2.1.0 >> >> _______________________________________________ >> Pixman mailing list >> [email protected] >> https://lists.freedesktop.org/mailman/listinfo/pixman > > > >-- >YunQiang Su _______________________________________________ Pixman mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/pixman
