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