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

Tomasz Lis listom at gmail.com
Wed Jul 17 04:49:22 PDT 2013


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.

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;
-- 
1.7.9.5



More information about the mesa-dev mailing list