<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"\@宋体";
panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
font-size:10.5pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
{mso-style-priority:99;
mso-style-link:"纯文本 Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:10.5pt;
font-family:"Calibri","sans-serif";}
span.Char
{mso-style-name:"纯文本 Char";
mso-style-priority:99;
mso-style-link:纯文本;
font-family:"Calibri","sans-serif";}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
/* Page Definitions */
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 80.9pt 72.0pt 80.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=ZH-CN link=blue vlink=purple style='text-justify-trim:punctuation'><div class=WordSection1><p class=MsoPlainText><span lang=EN-US><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-US><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-US>>-----Original Message-----</span></p><p class=MsoPlainText><span lang=EN-US>>From: YunQiang Su [mailto:wzssyqa@gmail.com]</span></p><p class=MsoPlainText><span lang=EN-US>>Sent: Thursday, February 27, 2020 11:38 AM</span></p><p class=MsoPlainText><span lang=EN-US>>To: Shiyou Yin</span></p><p class=MsoPlainText><span lang=EN-US>>Cc: pixman@lists.freedesktop.org</span></p><p class=MsoPlainText><span lang=EN-US>>Subject: Re: [Pixman] [PATCH v2 2/3] build: use '-mloongson-mmi' for Loongson MMI.</span></p><p class=MsoPlainText><span lang=EN-US>><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-US>></span><span style='font-family:宋体'>在</span><span lang=EN-US> 2020-02-26</span><span style='font-family:宋体'>三的</span><span lang=EN-US> 17:45 +0800</span><span style='font-family:宋体'>,</span><span lang=EN-US>Shiyou Yin</span><span style='font-family:宋体'>写道:</span></p><p class=MsoPlainText><span lang=EN-US>>> > -----Original Message-----</span></p><p class=MsoPlainText><span lang=EN-US>>> > From: YunQiang Su [mailto:wzssyqa@gmail.com]</span></p><p class=MsoPlainText><span lang=EN-US>>> > Sent: Saturday, February 22, 2020 10:20 PM</span></p><p class=MsoPlainText><span lang=EN-US>>> > To: Shiyou Yin</span></p><p class=MsoPlainText><span lang=EN-US>>> > Cc: pixman@lists.freedesktop.org</span></p><p class=MsoPlainText><span lang=EN-US>>> > Subject: Re: [Pixman] [PATCH v2 2/3] build: use '-mloongson-mmi'</span></p><p class=MsoPlainText><span lang=EN-US>>> > for Loongson MMI.</span></p><p class=MsoPlainText><span lang=EN-US>>> ></span></p><p class=MsoPlainText><span lang=EN-US>>> > Shiyou Yin <yinshiyou-hf@loongson.cn> </span><span style='font-family:宋体'>于</span><span lang=EN-US>2020</span><span style='font-family:宋体'>年</span><span lang=EN-US>2</span><span style='font-family:宋体'>月</span><span lang=EN-US>22</span><span style='font-family:宋体'>日周六</span> <span style='font-family:宋体'>下午</span><span lang=EN-US>9:19</span><span style='font-family:宋体'>写道:</span></p><p class=MsoPlainText><span lang=EN-US>>> > > First let's clarify what exactly compatibility mean, or what</span></p><p class=MsoPlainText><span lang=EN-US>>> > > specific goals we want to achieve.</span></p><p class=MsoPlainText><span lang=EN-US>>> > ></span></p><p class=MsoPlainText><span lang=EN-US>>> > > If it's just ensure the features of new code consistent with old</span></p><p class=MsoPlainText><span lang=EN-US>>> > > compilation and hardware environment, then this patch will works</span></p><p class=MsoPlainText><span lang=EN-US>>> > > well.</span></p><p class=MsoPlainText><span lang=EN-US>>> > ></span></p><p class=MsoPlainText><span lang=EN-US>>> ></span></p><p class=MsoPlainText><span lang=EN-US>>> > Of course that is not enough. If it is the only your goal, why sent</span></p><p class=MsoPlainText><span lang=EN-US>>> > this patch?</span></p><p class=MsoPlainText><span lang=EN-US>>> ></span></p><p class=MsoPlainText><span lang=EN-US>>> > > If it is going to make sure MMI can be enabled and works well on</span></p><p class=MsoPlainText><span lang=EN-US>>> > > each cases, it may be not easy.</span></p><p class=MsoPlainText><span lang=EN-US>>> > ></span></p><p class=MsoPlainText><span lang=EN-US>>> > > Guess compiler? Compiler check can only ensure the compile option</span></p><p class=MsoPlainText><span lang=EN-US>>> > > is supported or not</span></p><p class=MsoPlainText><span lang=EN-US>>> ></span></p><p class=MsoPlainText><span lang=EN-US>>> > yq@ls3b1500:~$ gcc -march=loongson3a -dM -E - < /dev/null | grep mmi</span></p><p class=MsoPlainText><span lang=EN-US>>> > #define __mips_loongson_mmi 1</span></p><p class=MsoPlainText><span lang=EN-US>>> ></span></p><p class=MsoPlainText><span lang=EN-US>>> > So, you can try to compile (-c) the bellow code to test whether the</span></p><p class=MsoPlainText><span lang=EN-US>>> > compiler has MMI enabled</span></p><p class=MsoPlainText><span lang=EN-US>>> ></span></p><p class=MsoPlainText><span lang=EN-US>>> > #ifndef __mips_loongson_mmi</span></p><p class=MsoPlainText><span lang=EN-US>>> > # error "Loongson MMI is not supported"</span></p><p class=MsoPlainText><span lang=EN-US>>> > #endif</span></p><p class=MsoPlainText><span lang=EN-US>>> ></span></p><p class=MsoPlainText><span lang=EN-US>>> > For example, mipsel-linux-gnu-gcc is a generic mips compiler and</span></p><p class=MsoPlainText><span lang=EN-US>>> > target mips32r2; and the user set CC="mipsel-linux-gnu-gcc</span></p><p class=MsoPlainText><span lang=EN-US>>> > -march=loongson3", Your test can still pass.</span></p><p class=MsoPlainText><span lang=EN-US>>> ></span></p><p class=MsoPlainText><span lang=EN-US>>> ></span></p><p class=MsoPlainText><span lang=EN-US>>> > > and then MMI instruction can be compiled. We can't ensure the</span></p><p class=MsoPlainText><span lang=EN-US>>> > > binary can works well on each hardware, especially in the case of</span></p><p class=MsoPlainText><span lang=EN-US>>> > > cross-compilation.</span></p><p class=MsoPlainText><span lang=EN-US>>> ></span></p><p class=MsoPlainText><span lang=EN-US>>> > Sure, that why you need to obey users configure, by LS_CFLAGS or CC</span></p><p class=MsoPlainText><span lang=EN-US>>> > or the default configure of compiler.</span></p><p class=MsoPlainText><span lang=EN-US>>> ></span></p><p class=MsoPlainText><span lang=EN-US>>> > > Almost all latest gcc support "-march=loongson2f" and "-</span></p><p class=MsoPlainText><span lang=EN-US>>> > > march=loongson3a"</span></p><p class=MsoPlainText><span lang=EN-US>>> > > and "-mloongson-mmi". So which kind of compiler we will set</span></p><p class=MsoPlainText><span lang=EN-US>>> > > LS_CFLAGS as -mloongson-mmi?</span></p><p class=MsoPlainText><span lang=EN-US>>> ></span></p><p class=MsoPlainText><span lang=EN-US>>> > due to history reason, the default value of LS_CFLAGS should be keep</span></p><p class=MsoPlainText><span lang=EN-US>>> > as 2f, and user can set it by</span></p><p class=MsoPlainText><span lang=EN-US>>> ></span></p><p class=MsoPlainText><span lang=EN-US>>> > LS_CFLAGS="-mloongson-mmi" ./configure -- blabla</span></p><p class=MsoPlainText><span lang=EN-US>>> ></span></p><p class=MsoPlainText><span lang=EN-US>>> > > Guess CPU is always used in runtime check, it should be added in</span></p><p class=MsoPlainText><span lang=EN-US>>> > > the optimization code but not in configure. The configure just</span></p><p class=MsoPlainText><span lang=EN-US>>> > > need to ensure the compile process can finished successfully, So</span></p><p class=MsoPlainText><span lang=EN-US>>> > > it may check compiler support some options or not and then</span></p><p class=MsoPlainText><span lang=EN-US>>> > > enable/disable the features.</span></p><p class=MsoPlainText><span lang=EN-US>>> > ></span></p><p class=MsoPlainText><span lang=EN-US>>> ></span></p><p class=MsoPlainText><span lang=EN-US>>> > Generally, we don't need to guess the BUILD_MACHINE's cpu in</span></p><p class=MsoPlainText><span lang=EN-US>>> > buildtime.</span></p><p class=MsoPlainText><span lang=EN-US>>> ></span></p><p class=MsoPlainText><span lang=EN-US>>><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-US>>> If this is what you mean, I will agree and update the patch.</span></p><p class=MsoPlainText><span lang=EN-US>>> It should be noted that we still need to manually specify appropriate</span></p><p class=MsoPlainText><span lang=EN-US>>> option to enable MMI correctly.</span></p><p class=MsoPlainText><span lang=EN-US>>> The only change is now we have two new ways(2 & 3) to specify this</span></p><p class=MsoPlainText><span lang=EN-US>>> option:</span></p><p class=MsoPlainText><span lang=EN-US>>> 1) LS_CFLAGS</span></p><p class=MsoPlainText><span lang=EN-US>>> 2) CC</span></p><p class=MsoPlainText><span lang=EN-US>>> 3)compiler's default cflags, such as COLLECT_GCC_OPTIONS of gcc.</span></p><p class=MsoPlainText><span lang=EN-US>>><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-US>>><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-US>>> Diff is as follows:</span></p><p class=MsoPlainText><span lang=EN-US>>><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-US>>> diff --git a/configure.ac b/configure.ac index 1ca3974..be9212d 100644</span></p><p class=MsoPlainText><span lang=EN-US>>> --- a/configure.ac</span></p><p class=MsoPlainText><span lang=EN-US>>> +++ b/configure.ac</span></p><p class=MsoPlainText><span lang=EN-US>>> @@ -78,7 +78,7 @@ AC_C_BIGENDIAN</span></p><p class=MsoPlainText><span lang=EN-US>>> AC_C_INLINE</span></p><p class=MsoPlainText><span lang=EN-US>>><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-US>>> dnl PIXMAN_LINK_WITH_ENV(env-setup, program, true-action, false-</span></p><p class=MsoPlainText><span lang=EN-US>>> action)</span></p><p class=MsoPlainText><span lang=EN-US>>> -dnl</span></p><p class=MsoPlainText><span lang=EN-US>>> +</span></p><p class=MsoPlainText><span lang=EN-US>>> dnl Compiles and links the given program in the environment setup by</span></p><p class=MsoPlainText><span lang=EN-US>>> env-setup dnl and executes true-action on success and false-action on</span></p><p class=MsoPlainText><span lang=EN-US>>> failure.</span></p><p class=MsoPlainText><span lang=EN-US>>> AC_DEFUN([PIXMAN_LINK_WITH_ENV],[dnl</span></p><p class=MsoPlainText><span lang=EN-US>>> @@ -273,7 +273,27 @@ dnl</span></p><p class=MsoPlainText><span lang=EN-US>>> =====================================================================</span></p><p class=MsoPlainText><span lang=EN-US>>> ======</span></p><p class=MsoPlainText><span lang=EN-US>>> dnl Check for Loongson Multimedia Instructions</span></p><p class=MsoPlainText><span lang=EN-US>>><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-US>>> if test "x$LS_CFLAGS" = "x" ; then</span></p><p class=MsoPlainText><span lang=EN-US>>> - LS_CFLAGS="-march=loongson2f"</span></p><p class=MsoPlainText><span lang=EN-US>>> + # check default cflags to set LS_CFLAGS # Has -mloongson-mmi or</span></p><p class=MsoPlainText><span lang=EN-US>>> + -march=loongson3a : LS_CFLAGS="-mloongson-</span></p><p class=MsoPlainText><span lang=EN-US>>> mmi"</span></p><p class=MsoPlainText><span lang=EN-US>>> + # else : LS_CFLAGS="-march=loongson2f"</span></p><p class=MsoPlainText><span lang=EN-US>>> + xserver_save_CFLAGS=$CFLAGS</span></p><p class=MsoPlainText><span lang=EN-US>>> + CFLAGS=" $LS_CFLAGS $CFLAGS -I$srcdir"</span></p><p class=MsoPlainText><span lang=EN-US>>> +AC_RUN_IFELSE([AC_LANG_SOURCE([[</span></p><p class=MsoPlainText><span lang=EN-US>>> +int main () {</span></p><p class=MsoPlainText><span lang=EN-US>>> + /* check default cflags */</span></p><p class=MsoPlainText><span lang=EN-US>>> + #ifndef __mips_loongson_mmi</span></p><p class=MsoPlainText><span lang=EN-US>>> + /* No -mloongson-mmi,-march=loongson3a and -march=loongson2f */</span></p><p class=MsoPlainText><span lang=EN-US>>> + return 0;</span></p><p class=MsoPlainText><span lang=EN-US>>> + #else</span></p><p class=MsoPlainText><span lang=EN-US>>> + #ifdef _MIPS_ARCH_LOONGSON2F</span></p><p class=MsoPlainText><span lang=EN-US>>> + /* Has -march=loongson2f */</span></p><p class=MsoPlainText><span lang=EN-US>>> + return 0;</span></p><p class=MsoPlainText><span lang=EN-US>>> + #else</span></p><p class=MsoPlainText><span lang=EN-US>>> + /* Has -mloongson-mmi or -march=loongson3a */</span></p><p class=MsoPlainText><span lang=EN-US>>> + return 1;</span></p><p class=MsoPlainText><span lang=EN-US>>> + #endif</span></p><p class=MsoPlainText><span lang=EN-US>>> + #endif</span></p><p class=MsoPlainText><span lang=EN-US>>> +}]])], LS_CFLAGS="-mloongson-mmi", LS_CFLAGS="-march=loongson2f")</span></p><p class=MsoPlainText><span lang=EN-US>><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-US>>I am sorry. The setting to Loongson2f by default is not done by you.</span></p><p class=MsoPlainText><span lang=EN-US>>It is my mistake.</span></p><p class=MsoPlainText><span lang=EN-US>><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-US>>Anyway, since you are working on that patch:</span></p><p class=MsoPlainText><span lang=EN-US>><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-US>>In the first patch, you setting 3A/MMI default instead of 2F. If that patch was merged, Debian/OpenWrt</span></p><p class=MsoPlainText><span lang=EN-US>>etc will be broken just now.</span></p><p class=MsoPlainText><span lang=EN-US>>In fact in most case the set 2F, it will not broken Debian, since the the next link test will fail: 2F cannot</span></p><p class=MsoPlainText><span lang=EN-US>>interlink with mips64r2/mips32r2. aka LS_CFLAGS is set to 2F will only break</span></p><p class=MsoPlainText><span lang=EN-US>>mips3/mips2 OS.</span></p><p class=MsoPlainText><span lang=EN-US>>Set LS_CFLAGS to -mloongson-mmi will break almost *ALL* os.</span></p><p class=MsoPlainText><span lang=EN-US>>Is it your mistake?</span></p><p class=MsoPlainText><span lang=EN-US>><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-US>>In the second patch: you read CPU info from /proc/cpuinfo: WTF</span></p><p class=MsoPlainText><span lang=EN-US>><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-US>>I asked that you should keep loongson options not set by default serveral times.</span></p><p class=MsoPlainText><span lang=EN-US>>In your *3rd* patch, you still keep them set by default.</span></p><p class=MsoPlainText><span lang=EN-US>><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-US>>I told you that you can determine OS/CC behivors by predefined macros, You still cannot understand after I</span></p><p class=MsoPlainText><span lang=EN-US>>have a loooooong talk with you by wechat! WTF.</span></p><p class=MsoPlainText><span lang=EN-US>><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-US>>Almost (if not all) of Loongson guys are *RUBBISH*.</span></p><p class=MsoPlainText><span lang=EN-US>>Let me sign this mail by my PGP key.</span></p><p class=MsoPlainText><span lang=EN-US>><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-US>>> fi</span></p><p class=MsoPlainText><span lang=EN-US>>><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-US>>> have_loongson_mmi=no</span></p><p class=MsoPlainText><span lang=EN-US>>><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-US>>><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-US style='color:black'><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-US style='color:black'>I really don't know what's your problem.<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US style='color:black'>Whether you're still going to be so rude or not, this will be my last reply to you.<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US style='color:black'>What I've always trying to tell you is that there is no way to set up the right LS_CFLAGS to enable MMI<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US style='color:black'>by compile check </span><b><span lang=EN-US style='font-size:15.0pt;color:black'>if the default CFLAGS doesn't contain MMI-related options.</span></b><span lang=EN-US style='color:black'><o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US style='color:black'>So, that is why you added cc_enable_mmi_2f/3a in your patch, and it will not <o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US style='color:black'>be set to yes if the default CFLAGS does not contain MMI-related options.<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US style='color:black'><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-US>What I originally wanted to do was to automatically enable MMI without specifying LS_CFLAGS/CC, <o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US>but not improving the whole default setting process, they are different things.<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US style='color:black'><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-US style='color:black'>Your patch improved the </span><span lang=EN-US>MMI configure check, It</span><span lang=EN-US style='font-family:"Courier New"'>’</span><span lang=EN-US>s good and I will submit it first.<span style='color:black'><o:p></o:p></span></span></p><p class=MsoPlainText><span lang=EN-US style='color:black'><o:p> </o:p></span></p></div></body></html>