<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hi,<div><br></div><div>I have some questions on the OSMesa code.</div><div>As you suggested, I have continue looking into the swrast code.</div><div>However, I have trouble figuring out how the code works exactly.</div><div>Now I am now only focusing on the functions which draw lines.</div><div>As I look into s_lines.c, I saw the _swrast_choose_line().</div><div>And depends on different cases, <span style="font-size: 12pt;">it will call</span></div><div><span style="font-size: 12pt;"><br></span></div><div>_swrast_choose_aa_line_function(ctx)</div><div>or </div><div> USE(general_line)</div><div>or</div><div>USE(rgba_line)</div><div>or</div><div>USE(simple_no_z_rgba_line)</div><div>etc.</div><div><br></div><div>The first thing I did is looking into the <span style="font-size: 12pt;">_swrast_choose_aa_line_function() and it direct me to s_aaline.c</span></div><div><span style="font-size: 12pt;">In that file, I saw the </span><span style="font-size: 12pt;">struct of LineInfo and other computation functions for plane.</span></div><div><span style="font-size: 12pt;">Then I looked at the </span><span style="font-size: 12pt;">_swrast_choose_aa_line_function()</span></div><div><br></div><div>and when I saw the code:</div><div>swrast->Line = aa_general_rgba_line;</div><div>and</div><div>swrast->Line = aa_rgba_line;</div><div><br></div><div>I am not sure what do they mean. And I won't be able to continue finding useful info.</div><div><br></div><div>I think the main problem I am having is I am not sure what are the steps OSMesa have to take in order to draw a line into the frame buffer. </div><div>Would you be able to explain a bit on that? (<span style="font-size: 12pt;"> </span><span style="font-size: 12pt;">what are the steps OSMesa have to take in order to draw a line into the frame buffer?)</span></div><div>Does drawing a line involve computing the plane?</div><div>What do s_aaline.c and s_aalinetemp.h actually mean? </div><div>What is <span style="font-size: 12pt;">USE(general_line) ? Where is USE() define?</span></div><div><span style="font-size: 12pt;">What is </span><span style="font-size: 12pt;">swrast->Line = aa_general_rgba_line;?</span></div><div>Would you suggest any debugging tool for me so that I can trace which functions are called while the program is running?</div><div>For example I have the code below:</div><div><div>glBegin(GL_LINES);</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>glVertex3f(0.0, 0.0, 0.0);</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>glVertex3f(15, 0, 0);</div><div><span style="font-size: 12pt;">glEnd();</span></div></div><div>Is there any debugging tool which can trace glVertex3f back in the library and see how OSMesa works?</div><div>I have tried using gdb, however, it would only by-pass the call the go to the next command.</div><div><span style="font-size: 12pt;"><br></span></div><div><span style="font-size: 12pt;">Thank you so much for your time.</span></div><div><span style="font-size: 12pt;"><br></span></div><div><span style="font-size: 12pt;">Andy.</span></div><div><span style="font-size: 12pt;"><br></span></div><div><br></div><div><div>> Date: Wed, 10 Jul 2013 12:53:19 -0600<br>> From: brianp@vmware.com<br>> To: lilapkiu@hotmail.com; mesa-dev@lists.freedesktop.org<br>> Subject: Re: [Mesa-dev] OSMesa Help<br>> <br>> Please keep your replies on the list so that others can potentially<br>> help/reply.<br>> <br>> On 07/10/2013 12:05 PM, Andy Li wrote:<br>> > Hi Brain,<br>> > <br>> > Thank you for your reply.<br>> > You were right, my plan is to use OSMesa and draw into malloc'd frame <br>> > buffer in my device, so I can display the image on the screen.<br>> > <br>> > For base functions, what i meant are the drawline() or drawpix() functions.<br>> > In other words, I am wondering which are the functions OSMesa used to <br>> > draw a line/pixel into the memory (changing the color/rgba value in <br>> > frame buffer)?<br>> <br>> <br>> In the swrast code, look at s_lines.c, s_triangle.c, etc. to see how<br>> lines and triangles are drawn. In some (simple) cases we can write<br>> directly into the framebuffer but other times we call functions like<br>> _swrast_write_rgba_span() to do fragment processing/writing.<br>> <br>> To access the framebuffer's memory we use the<br>> ctx->Driver.Map/UnmapRenderbuffer() functions.<br>> <br>> <br>> > Why am I trying to find these functions? The other part of my project is <br>> > to rewrite these functions with an accelerator, so that I can speed up <br>> > the rendering process with the embedded system I am using.<br>> > <br>> > Would you be able to give me some info/ suggestions on what I am doing?<br>> <br>> See above. Otherwise, just study the code for a while. It's not all<br>> that complicated.<br>> <br>> -Brian<br>> <br>> > <br>> > Thanks,<br>> > <br>> > Andy<br>> > <br>> > > Date: Wed, 10 Jul 2013 07:49:09 -0600<br>> > > From: brianp@vmware.com<br>> > > To: lilapkiu@hotmail.com<br>> > > CC: mesa-dev@lists.freedesktop.org<br>> > > Subject: Re: [Mesa-dev] OSMesa Help<br>> > ><br>> > > On 07/09/2013 11:20 PM, Andy Li wrote:<br>> > > > Hello everyone,<br>> > > ><br>> > > ><br>> > > > I have some questions regarding to OSMesa.<br>> > > ><br>> > > > I am currently working on a project which I have to use Mesa on an<br>> > > > embedded system.<br>> > > ><br>> > > > My current goal is to port the base functions over to the embedded<br>> > > > system, so that I can draw a line on a provided VGA screen.<br>> > > ><br>> > > > Since the embedded system I am using does not contain a GPU, <br>> > therefore I<br>> > > > have decided to use OSMesa for rendering process.<br>> > > ><br>> > > > I am wondering if there are any documentations/ specifications for <br>> > OSMesa?<br>> > ><br>> > > End users of OSMesa generally get by on the comments in osmesa.h and the<br>> > > example programs. But you're working on the driver implementation side.<br>> > ><br>> > ><br>> > > > Anyone know which are the base functions that OSMesa used for the<br>> > > > rendering process?<br>> > ><br>> > > I don't know what you mean by base functions. In Mesa/master git, the<br>> > > OSMesa can either be used with the legacy swrast driver or with the<br>> > > gallium softpipe/llvmpipe drivers.<br>> > ><br>> > ><br>> > > > I have looked into src/mesa/swrast/s_lines.c and s_drawpix.c and trying<br>> > > > to figure out how the code works, am I in the right direction?<br>> > ><br>> > > That code is used by the legacy OSMesa driver, but it's also used by the<br>> > > old Xlib driver too.<br>> > ><br>> > ><br>> > > > Moreover, for example, if I found a drawpix() function, how do I <br>> > know if<br>> > > > OSMesa actually used this function during rendering process? Is there<br>> > > > any tool/debugger I can use to confirm my findings?<br>> > ><br>> > > One would normally set a breakpoint on the function in gdb or another<br>> > > debugger.<br>> > ><br>> > > Let's take a few steps back here first. You said you want to display<br>> > > graphics on your VGA screen. OSMesa will not do that for you.<br>> > > OS=Off-Screen. The whole point of OSMesa is to draw into malloc'd<br>> > > framebuffer memory, rather than drawing to a real/displayed framebuffer.<br>> > ><br>> > > You could use OSMesa and then do some sort of memcpy of the image into<br>> > > your devices's actual frame buffer. Is that what you want to do?<br>> > ><br>> > > -Brian<br>> > ><br>> <br></div></div> </div></body>
</html>