EGL double buffering

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?

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

Pbuffers are single buffered.

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.

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

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

I did not understand what this statement means.Could you please clarify?

so i interpreted this visible window as the front buffer.

Am i wrong here in my interpretation?[/quote]
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

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.

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

Yes, that is what the EGL spec says.

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,

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.

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?

Then whoever wrote that is wrong. There are no double-buffered pbuffers.

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.