[Mesa-dev] [PATCH 09/10] Float fbconfigs frontend patch [2/3] Creation of dummy X pixmap associated with float buffer.

Ian Romanick idr at freedesktop.org
Thu Aug 22 15:11:06 PDT 2013


On 07/17/2013 04:49 AM, Tomasz Lis wrote:
> From: Tomasz Lis <tomasz.lis at intel.com>
>
> glx: Creation of dummy X pixmap associated with float buffer.
>
> This change addresses the fact that float configs can be only used for pbuffers,
> and that 2D driver may not allow creation of an associated pixmap.
> It wouldn't be needed if 2D driver could always support 128 bpp buffers,
> but even then, there wouldn't be any point in allocating full-size associated
> pixmap which can never be used.

Okay... I talked to Kristian about this code and your patch.  He 
confirmed my suspicion that this is not the right way to fix this, but 
the bigger picture is quite different than my understanding.

This code came to life with Mesa commit 5a43dbac.  This added support 
for direct-rendering pbuffers.  We had previously supported 
indirect-rendering pbuffers (in Mesa's libGL) for some time.  When 
Kristian implemented DRI2, we got direct rendering to pixmaps 
essentially for free.  To get pbuffers, he just allocated a pixmap and 
called it a pbuffer. :)  All of the pixmap rendering code would "just work."

In this mechanism, the pixmap is the storage for the pbuffer.  As such, 
allocated a 1bpp pixmap to hold 128bpp data is definitely wrong.

All of this occurred long before the invention of __DRIimage.  Kristian 
suggested that we modify the code here and in src/glx/dri2_glx.c to use 
__DRIimage for pbuffers instead.  There's conceptually similar code in 
src/egl/drivers/dri2/platform_drm.c.  I've looked at the existing 
dri2_glx.c code, and this seems like a plausible approach.

Hopefully Kristian will reply with a more fleshed out proposal. :)

> Signed-off-by: Tomasz Lis <listom at gmail.com>
> ---
>   src/glx/glx_pbuffer.c |   19 +++++++++++++++++--
>   1 file changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c
> index f11305a..67776c4 100644
> --- a/src/glx/glx_pbuffer.c
> +++ b/src/glx/glx_pbuffer.c
> @@ -554,8 +554,23 @@ CreatePbuffer(Display * dpy, struct glx_config *config,
>      UnlockDisplay(dpy);
>      SyncHandle();
>
> -   pixmap = XCreatePixmap(dpy, RootWindow(dpy, config->screen),
> -			  width, height, config->rgbBits);
> +   /* From SGIX_pbuffer spec:
> +    * GLXPbuffers are equivalent to GLXPixmaps with the following exceptions:
> +    * There is no associated X pixmap. Also, since a GLXPbuffer is a GLX
> +    * resource, it may not be possible to render to it using X or an
> +    * X extension other than GLX.
> +    */
> +   if (config->floatMode) {
> +       /* There are no float X pixmaps - create a dummy one, with 1 BPP.
> +        * The 1 BPP is a special value which disables BPP verification
> +        * in XServer. */
> +       pixmap = XCreatePixmap(dpy, RootWindow(dpy, config->screen),
> +                  width, height, 1);
> +   } else {
> +       /* If it is possible to associate an X pixmap, do it. */
> +       pixmap = XCreatePixmap(dpy, RootWindow(dpy, config->screen),
> +                  width, height, config->rgbBits);
> +   }
>
>      if (!CreateDRIDrawable(dpy, config, pixmap, id, attrib_list, i)) {
>         CARD32 o = glx_1_3 ? X_GLXDestroyPbuffer : X_GLXvop_DestroyGLXPbufferSGIX;
>



More information about the mesa-dev mailing list