[Mesa-dev] [PATCH 2/3] mesa: fix pbuffers because internally they are front buffers

Mathias Fröhlich Mathias.Froehlich at gmx.net
Tue Apr 30 09:59:43 UTC 2019


Adam, Marek,

On Monday, 29 April 2019 18:28:21 CEST Adam Jackson wrote:
> On Fri, 2019-04-26 at 23:31 -0400, Marek Olšák wrote:
> 
> I don't claim to know what this series is trying to fix, but:
> 
> > +    * 2) Pbuffers are back buffers from the application point of view,
> > +    *    but they are front buffers from the Mesa point of view,
> > +    *    because they are always single buffered.
> > +    */
> 
> The EGL spec (back to 1.0!) says:
> 
> "The resulting pbuffer will contain color buffers and ancillary buffers
> as specified by config."
> 
> This appears to be copied from GLX, which has something more elaborate:
> 
> "The resulting pbuffer will contain color buffers and ancillary buffers
> as specified by config. It is possible to create a pbuffer with back
> buffers and to swap the front and back buffers by calling
> glXSwapBuffers. Note that pbuffers use framebuffer resources so
> applications should consider deallocating them when they are not in
> use."
> 
> So I'm not convinced that pbuffers are "always single-buffered". The
> back buffer is definitely a color buffer, and at least under GLX it
> seems like it should be possible to draw red to back, swap, draw blue
> to back, glReadBuffer(GL_FRONT), and expect glReadPixels to return red.

Hmm, probably Marek's escape could be 2.2.2 Rendering Models form the eglspec:
[...]
Pbuffer surfaces have a back buffer but no associated
window, so the back buffer need not be copied.
[...]

Not sure myself what that means in its total consequence, but can't we read that as
there is only undefined behavior associated with the pbuffer front buffer?

Why, do I get to that?
IIRC somewhere in EGL there is a note that there is basically no front buffer rendering
in EGL. And the above tells that the implementation may behave as if there is no way
to swap the back buffers content into the front buffer.

Is there some path left using egl images or egl copy buffers?
Or what else do I miss?

best

Mathias




More information about the mesa-dev mailing list