<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
name="PersonName"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:SimSun;
        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:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
/* Page Definitions */
@page Section1
        {size:595.3pt 841.9pt;
        margin:72.0pt 69.65pt 72.0pt 69.65pt;
        layout-grid:15.6pt;}
div.Section1
        {page:Section1;}
-->
</style>
</head>
<body lang=ZH-CN link=blue vlink=purple style='text-justify-trim:punctuation'>
<div class=Section1 style='layout-grid:15.6pt'>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>Hi<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>I think it is difficult to maintain a large list of
all ASICs, for you have to change the list from time to time when a new ASIC is
released. Actually we have provided the functionality for getting total video
memory, you can use the following code to get the total video memory with ATI
cards.<o:p></o:p></span></font></p>
<p class=MsoPlainText style='text-indent:24.0pt'><font size=3
face="Times New Roman"><span lang=EN-US style='font-size:12.0pt'>#define GL_TOTAL_PHYSICAL_MEMORY_ATI���
0x87FE<o:p></o:p></span></font></p>
<p class=MsoPlainText style='text-indent:24.0pt'><font size=3
face="Times New Roman"><span lang=EN-US style='font-size:12.0pt'>const char
*glExtensions = (const char*)glGetString(GL_EXTENSIONS);<o:p></o:p></span></font></p>
<p class=MsoPlainText style='text-indent:24.0pt'><font size=3
face="Times New Roman"><span lang=EN-US style='font-size:12.0pt'>if(strstr(glExtensions,
"GL_ATI_meminfo"))<o:p></o:p></span></font></p>
<p class=MsoPlainText style='text-indent:24.0pt'><font size=3
face="Times New Roman"><span lang=EN-US style='font-size:12.0pt'>{<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>�� �����int total_mem[4] = {0};<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>� ������glGetIntegerv(GL_TOTAL_PHYSICAL_MEMORY_ATI,
total_mem); // total_mem[0] contains the total video memory size and the value
is in Kbyte<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>�� �����vidmem = total_mem[0] / 1024; //converting
from Kbyte to Mbyte<o:p></o:p></span></font></p>
<p class=MsoPlainText style='text-indent:24.0pt'><font size=3
face="Times New Roman"><span lang=EN-US style='font-size:12.0pt'>}<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>Regards<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>Sunny<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>-----Original Message-----<br>
From: Roderick Colenbrander [mailto:thunderbird2k@gmail.com] <br>
Sent: Friday, August 14, 2009 1:44 AM<br>
To: Stefan D�singer<br>
Cc: wine-devel@winehq.org; <st1:PersonName w:st="on">Hu, Li</st1:PersonName>;
Jin, Jian-Rong; <st1:PersonName w:st="on">Wang, Robin</st1:PersonName>; <st1:PersonName
w:st="on">Guan, Xiao-Feng</st1:PersonName>; Sun, Sunny<br>
Subject: Re: about video memory detection in wine</span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>On Thu, Aug 13, 2009 at 6:59 PM, Stefan
D�singer<stefandoesinger@gmx.at> wrote:<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>> Am Wednesday 12 August 2009 10:04:10 schrieb Sun,
Sunny:<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>><o:p> </o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>>> I think you can first detect GL_ATI_meminfo
in<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>>> glGetString(GL_EXTENSIONS); if GL_ATI_meminfo
exists, then you can use<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>>> glGetIntegerv(GL_VBO_FREE_MEMORY_ATI, param)
to get the current free<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>>> video memory, you can see more info at:<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>> A minor problem with GL_ATI_meminfo is that it
doesn't report the total amount<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>> of video memory available. D3D8 and D3D9 only
report the free amount as well,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>> but DirectDraw can return the total amount. There
are some games that first<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>> query the total amount using ddraw, then continue
with d3d8 or 9. Depending<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>> on what other apps are doing, reporting the
currently free amount as total<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>> might result in the app thinking that free vidmem
> total vidmem, running<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>> into all sorts of troubles. (For example, another
app frees a lot of textures<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>> between the ddraw vidmem query and the d3d9
vidmem query)<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>It is even worse. Even OpenGL apps like WoW use ddraw
for querying the<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>amount of video memory at startup!<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>In case of Nvidia the amount of video memory and the
pci ids are<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>advertised using the NV-CONTROL extension. At some point
I plan on<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>adding code for that. Even when using such extension
the current<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>fallback is still needed. The list needs some updates.<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>> The other issue is that if some other apps use
lots of video memory(like<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>> Compiz, etc), then we can still run into the same
out of memory issue if<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>> other apps consume too much video memory.<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>><o:p> </o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>> We should probably also fall back to a saner
default on newer d3d10 class<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>> cards - a radeon 9500 isn't really representative
for them any more.<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>><o:p> </o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>I still have to update that part but haven't had time
for it yet.<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>Roderick<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'><o:p> </o:p></span></font></p>
</div>
</body>
</html>