PDA

View Full Version : EGL double buffering



mustaf
08-14-2007, 12:30 AM
When i have a EGL setup with double buffer mode, then if i create a pbuffer surface will it also have front buffer and the back buffer like we have in case of window surface.

In case of window surface, we know that we write in the back buffer of window surface and whatever content is present in front buffer, is shown on to the display.

But pbuffer contents are never shown on display.So, can any one please tell me what is the use of front buffer in case of pbuffer here?

mustaf
08-16-2007, 10:52 PM
I am little surprised to see no reply this..is the question not clear?..If not, then i can clarify if any one has doubt over the question

Xmas
08-17-2007, 06:49 AM
Pbuffers are single buffered.

mustaf
08-18-2007, 10:20 PM
Hi Xmas,

I am quite new to this domain, so excuse me if i say anything which is not correct.

Are pbuffers always single buffered or it depends on the underline EGL implementation?..Because, i hv seen mentioning of front & back buffer for pbuffers in lot of places in the EGL spec.

Also, in the ref implementation of OPENVG which is available in khronos site, talks about back mentioning back buffer when we are creating pbuffer.

Ia there any thing, which i am missing here?..please help me.

Thanks.

Xmas
08-20-2007, 04:34 AM
Are pbuffers always single buffered or it depends on the underline EGL implementation?..Because, i hv seen mentioning of front & back buffer for pbuffers in lot of places in the EGL spec.
There's no mention of front buffers in the spec. The EGL spec says that pbuffers are back buffered because the memory is managed by EGL, and there is no way you could access intermediate rendering results anyway.

So the implementation details are completely hidden.

mustaf
08-20-2007, 11:13 PM
There's no mention of front buffers in the spec. The EGL spec says that pbuffers are back buffered because the memory is managed by EGL, and there is no way you could access intermediate rendering results anyway.

So the implementation details are completely hidden.

You are right that there is no mentioning of front buffer in the spec. Actually i have seen
When the client is finished drawing a frame, the back buffer may be copied to a visible window using eglSwapBuffers (Section 2.2.2 Rendering Models in EGL spec 1.3). so i interpreted this visible window as the front buffer.

Am i wrong here in my interpretation?

Also, while discussing Rendering model in section 2.2.2, it is mentioned that
Pbuffer surfaces have a back buffer but no associated window, so the back buffer need not be copied. I did not understand what this statement means.Could you please clarify?

Xmas
08-21-2007, 01:54 AM
You are right that there is no mentioning of front buffer in the spec. Actually i have seen
When the client is finished drawing a frame, the back buffer may be copied to a visible window using eglSwapBuffers (Section 2.2.2 Rendering Models in EGL spec 1.3). so i interpreted this visible window as the front buffer.

Am i wrong here in my interpretation?
From the point of view of the application it is the front buffer. However, the window system might be doing some composition work (like the Vista Aero desktop), and in such a case the window buffer is not the actual front buffer (the buffer that is sent to the screen).


Also, while discussing Rendering model in section 2.2.2, it is mentioned that
Pbuffer surfaces have a back buffer but no associated window, so the back buffer need not be copied. I did not understand what this statement means.Could you please clarify?
It means that a pbuffer is an off-screen surface that doesn't have a front buffer (or window buffer, see above) associated with it. Thus there is no need to call eglSwapBuffers when you've finished rendering to a pbuffer.

mustaf
08-26-2007, 11:24 PM
Hi George,

Thanks for your reply, now it is getting clear.

So, that means "Is it possible that in the same EGL implementation i can have my windows surface as double-buffered whereas the pbuffer as single-buffered"?

My initial understanding was even though it depends on the underline EGL implementation but the EGL implementation would be such that if windows surface is double-buffered, then pbuffer also has to be double -buffered and, if it is single-buffered, then both the surfaces have to be single-buffered.

Thanks

Xmas
08-28-2007, 03:42 AM
So, that means "Is it possible that in the same EGL implementation i can have my windows surface as double-buffered whereas the pbuffer as single-buffered"?
Yes, that is what the EGL spec says.

mustaf
08-29-2007, 12:01 AM
Hi,

So, is there any implementation where we have double buffered pbuffer?I have some question regarding the double buffered pbuffer

1>Can we specify which buffer of pbuffer is used for writing to pbuffer and which for reading from pbuffer?
2>Who takes care of the synchronization issue i.e. whether simultaneously reading and writing is possible.
3>Do i need to explicitly call eglswapbuffers on pbuffer to transfer the content from back buffer to front buffer?


What is the effect if i call eglswapbuffers on single buffered pbuffer?My opinion is it is a NOP, but just want to confirm.I have verified in the rasteroid (Hybrid) exmaple that it is a NOP.

In case of single buffered pbuffer, how is the synchronization happen i.e. we are not reading and writing to/from pbuffer simultaneously.

Thanks,

Xmas
08-29-2007, 02:14 AM
Hi,

So, is there any implementation where we have double buffered pbuffer?I have some question regarding the double buffered pbuffer

1>Can we specify which buffer of pbuffer is used for writing to pbuffer and which for reading from pbuffer?
2>Who takes care of the synchronization issue i.e. whether simultaneously reading and writing is possible.
3>Do i need to explicitly call eglswapbuffers on pbuffer to transfer the content from back buffer to front buffer?
Even if there were an implementation that used double buffered pbuffers for whatever reason (though I can't think of any right now), that would be completely hidden. It would behave as if single-buffered.


What is the effect if i call eglswapbuffers on single buffered pbuffer?My opinion is it is a NOP, but just want to confirm.I have verified in the rasteroid (Hybrid) exmaple that it is a NOP.
EGL spec, section 3.9.1: "If surface is a single-buffered window, pixmap, or pbuffer surface, eglSwapBuffers has no effect."


In case of single buffered pbuffer, how is the synchronization happen i.e. we are not reading and writing to/from pbuffer simultaneously.
The same way it happens for window surfaces: a read operation from the surface causes a flush of all rendering commands to that surface. I.e. it will block until all rendering has been completed.

mustaf
08-29-2007, 11:47 PM
Even if there were an implementation that used double buffered pbuffers for whatever reason (though I can't think of any right now), that would be completely hidden. It would behave as if single-buffered.

Somewhere, i read over the net(i dont exactly remember where) that when we need two pbuffers for texturing or whatever purpose, it is better to use a double buffered pbuffer in stead of two pbuffer so that context switching will be reduced and as a result, performance will be enhanced.

So, i was thinking there might be some usefulness of double buffered pbuffer.Do you have any idea on this?

Xmas
08-30-2007, 04:58 AM
Somewhere, i read over the net(i dont exactly remember where) that when we need two pbuffers for texturing or whatever purpose, it is better to use a double buffered pbuffer in stead of two pbuffer so that context switching will be reduced and as a result, performance will be enhanced.
Then whoever wrote that is wrong. There are no double-buffered pbuffers.

shiraz
08-15-2011, 06:20 AM
Hi,

I'm having problems understanding how double buffering works in OpenGL ES and on the iPhone. I suspect it it is supported implictly, but it would help my understanding if I knew how to enable and disable it. Its fairly obvious how it works on traditional openGL - we draw to a back buffer, swap it (just a pointer swap) with the front buffer and draw the front buffer (the old back buffer).

Mandy56
09-21-2011, 01:36 AM
As far as I know, there is no way to specify that you want to work in single buffer mode.

jpilon
01-06-2012, 08:47 PM
When you create your egl window surface you can pass an attribute list. You can set EGL_RENDER_BUFFER to EGL_BACK_BUFFER for a double buffered window or you can set it to EGL_SINGLE_BUFFER for a single buffered window. Some windowing systems, will even let you have X number of buffers for EGL_BACK_BUFFER, by setting the buffer count on the native window.