[Mesa-dev] Why are pbuffers backed by a pixmaps (Was Re: [PATCH] egl: Fix leak of X11 pixmaps backing pbuffers in DRI3.)

Adam Jackson ajax at redhat.com
Tue Aug 14 17:42:14 UTC 2018

On Mon, 2018-08-13 at 16:32 -0700, Kristian Høgsberg wrote:
> On Mon, Aug 13, 2018 at 3:53 AM Emil Velikov <emil.l.velikov at gmail.com> wrote:
> > 
> > So if I understood you correctly [and the spec] there is no
> > requirement (nor ban) on rendering to pbuffers from X11.
> > It's an implementation decision to allow it.
> You can't render to the underlying pixmaps, since the drawable ID is
> internal to the GLX implementation.

This might be a desirable property, but it's not what xserver
implements. req->pbuffer is the last argument (glxDrawableId) to
DoCreatePbuffer, which has:

    /* Assign the pixmap the same id as the pbuffer and add it as a
     * resource so it and the DRI2 drawable will be reclaimed when the
     * pbuffer is destroyed. */
    pPixmap->drawable.id = glxDrawableId;
    if (!AddResource(pPixmap->drawable.id, RT_PIXMAP, pPixmap))
        return BadAlloc;

See obviously bogus demo (attached), which succeeds instead of throwing

- ajax
-------------- next part --------------
A non-text attachment was scrubbed...
Name: glx-wacky-pbuffer.c
Type: text/x-csrc
Size: 558 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180814/a7054d52/attachment.c>

More information about the mesa-dev mailing list