On 07/17/2013 04:49 AM, Tomasz Lis wrote:
From: Tomasz Lis <tomasz....@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.

I'm not sure this is correct. I want to do some more research and play around with some other implementations. I've pushed all of the series (with some changes) except this patch. Since this would qualify as a bug fix, this can get cherry picked to the 9.2 branch.

Signed-off-by: Tomasz Lis <lis...@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;


_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to