Mesa (7.9): st/xlib: Notify the context when the front/ back buffers are swapped.

Chia-I Wu olv at kemper.freedesktop.org
Thu Sep 16 06:25:09 UTC 2010


Module: Mesa
Branch: 7.9
Commit: 5d02503467f8caf0dfadce5512e2e9de48e24fdc
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5d02503467f8caf0dfadce5512e2e9de48e24fdc

Author: Chia-I Wu <olv at lunarg.com>
Date:   Wed Sep  8 00:30:27 2010 +0800

st/xlib: Notify the context when the front/back buffers are swapped.

The current context should be notified when the the front/back buffers
of the current drawable are swapped.  The notification was skipped when
xmesa_strict_invalidate is false (the default).

This fixes fdo bug #29774.
(cherry picked from commit 03224f492dc9cee179ff9ed961be0443a3669dd1)

---

 src/gallium/state_trackers/glx/xlib/xm_api.c |   18 ++++++++++++++----
 src/gallium/state_trackers/glx/xlib/xm_api.h |    3 +++
 src/gallium/state_trackers/glx/xlib/xm_st.c  |    4 ++++
 3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c
index 36d63c3..f950c88 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.c
@@ -1087,19 +1087,29 @@ XMesaDestroyBuffer(XMesaBuffer b)
 
 
 /**
- * Query the current drawable size and notify the binding context.
+ * Notify the binding context to validate the buffer.
  */
 void
-xmesa_check_buffer_size(XMesaBuffer b)
+xmesa_notify_invalid_buffer(XMesaBuffer b)
 {
    XMesaContext xmctx = XMesaGetCurrentContext();
 
+   if (xmctx && xmctx->xm_buffer == b)
+      xmctx->st->notify_invalid_framebuffer(xmctx->st, b->stfb);
+}
+
+
+/**
+ * Query the current drawable size and notify the binding context.
+ */
+void
+xmesa_check_buffer_size(XMesaBuffer b)
+{
    if (b->type == PBUFFER)
       return;
 
    xmesa_get_window_size(b->xm_visual->display, b, &b->width, &b->height);
-   if (xmctx && xmctx->xm_buffer == b)
-      xmctx->st->notify_invalid_framebuffer(xmctx->st, b->stfb);
+   xmesa_notify_invalid_buffer(b);
 }
 
 
diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.h b/src/gallium/state_trackers/glx/xlib/xm_api.h
index f209b14..fedf2b2 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.h
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.h
@@ -361,6 +361,9 @@ xmesa_get_window_size(Display *dpy, XMesaBuffer b,
                       GLuint *width, GLuint *height);
 
 extern void
+xmesa_notify_invalid_buffer(XMesaBuffer b);
+
+extern void
 xmesa_check_buffer_size(XMesaBuffer b);
 
 extern void
diff --git a/src/gallium/state_trackers/glx/xlib/xm_st.c b/src/gallium/state_trackers/glx/xlib/xm_st.c
index 4c0ce07..4d0f5e6 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_st.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_st.c
@@ -339,6 +339,10 @@ xmesa_swap_st_framebuffer(struct st_framebuffer_iface *stfbi)
          tmp = *front;
          *front = *back;
          *back = tmp;
+
+         /* the current context should validate the buffer after swapping */
+         if (!xmesa_strict_invalidate)
+            xmesa_notify_invalid_buffer(xstfb->buffer);
       }
 
       if (xmesa_strict_invalidate)




More information about the mesa-commit mailing list