[PATCH] dri2: Don't throw an error on glXSwapBuffers() when single-buffered.

Eric Anholt eric at anholt.net
Wed Jun 1 17:50:02 PDT 2011


On Thu, 2 Jun 2011 01:16:33 +0300, Ville Syrjälä <syrjala at sci.fi> wrote:
> On Wed, Jun 01, 2011 at 02:49:03PM -0700, Eric Anholt wrote:
> > This fixes piglit glx-swap-singlebuffer (but not glx-swap-pixmap,
> > which hits a BadMatch elsewhere that I haven't tracked down), and the
> > original bug report of glean clipFlat, which was trying to do exactly
> > this.
> > 
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=32589
> > ---
> >  hw/xfree86/dri2/dri2.c |   18 ++++++++++++++++--
> >  1 files changed, 16 insertions(+), 2 deletions(-)
> > 
> > diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
> > index 9ca378f..571f7cf 100644
> > --- a/hw/xfree86/dri2/dri2.c
> > +++ b/hw/xfree86/dri2/dri2.c
> > @@ -802,9 +802,23 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
> >  	if (pPriv->buffers[i]->attachment == DRI2BufferBackLeft)
> >  	    pSrcBuffer = (DRI2BufferPtr) pPriv->buffers[i];
> >      }
> > -    if (pSrcBuffer == NULL || pDestBuffer == NULL) {
> > +
> > +    /* From the GLX 1.4 specification page 34 (page 40 of the PDF):
> > +     *
> > +     *     This operation is a no-op if draw was created with a
> > +     *     non-double-buffered GLXFBConfig, or if draw is a GLXPixmap.
> > +     *
> > +     * We interpret this as "anything with no backbuffer does nothing
> > +     * for glXSwapBuffers().  See piglit glx-swap-pixmap and
> > +     * glx-swap-singlebuffer.
> > +     */
> 
> Shouldn't this be handled in some GLX code? Doing it client side would
> also avoid the pointless X request.

This is a client doing something stupid that we don't care to optimize.
I also don't trust the client to have an accurate representation of the
current set of attached buffers in the case of drawable sharing (that
unfortunate feature of GLX that makes everything about it painful).

And, this ErrorF was clearly "I dunno what should happen here, think
about it when you get the message".  We hit it, and I think this is the
correct response (do nothing) for any case where there is no backbuffer
present.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg/attachments/20110601/d55b32ef/attachment.pgp>


More information about the xorg mailing list