Mesa (master): st/egl: Fix DRI2 on old X servers

Jakob Bornecrantz wallbraker at kemper.freedesktop.org
Sun Apr 11 23:51:56 UTC 2010


Module: Mesa
Branch: master
Commit: d93c34cf70e255805a634611e971e9b0e6da1996
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d93c34cf70e255805a634611e971e9b0e6da1996

Author: Jakob Bornecrantz <wallbraker at gmail.com>
Date:   Mon Apr 12 00:28:49 2010 +0200

st/egl: Fix DRI2 on old X servers

---

 src/gallium/state_trackers/egl/x11/native_dri2.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/src/gallium/state_trackers/egl/x11/native_dri2.c b/src/gallium/state_trackers/egl/x11/native_dri2.c
index d77b9b9..dd44d60 100644
--- a/src/gallium/state_trackers/egl/x11/native_dri2.c
+++ b/src/gallium/state_trackers/egl/x11/native_dri2.c
@@ -195,6 +195,15 @@ dri2_surface_get_buffers(struct native_surface *nsurf, uint buffer_mask)
    unsigned int dri2atts[NUM_NATIVE_ATTACHMENTS];
    int num_ins, num_outs, att;
    struct x11_drawable_buffer *xbufs;
+   /* XXX check if the server supports with format */
+   boolean with_format = FALSE;
+
+
+   /* We must get the front on servers which doesn't support with format
+    * due to a silly bug in core dri2. You can't copy to/from a buffer
+    * that you haven't requested and you recive BadValue errors */
+   if (!with_format)
+      buffer_mask |= (1 << NATIVE_ATTACHMENT_FRONT_LEFT);
 
    /* prepare the attachments */
    num_ins = 0;
@@ -228,7 +237,7 @@ dri2_surface_get_buffers(struct native_surface *nsurf, uint buffer_mask)
 
    xbufs = x11_drawable_get_buffers(dri2dpy->xscr, dri2surf->drawable,
                                     &dri2surf->width, &dri2surf->height,
-                                    dri2atts, FALSE, num_ins, &num_outs);
+                                    dri2atts, with_format, num_ins, &num_outs);
 
    /* we should be able to do better... */
    if (xbufs && dri2surf->last_num_xbufs == num_outs &&




More information about the mesa-commit mailing list