Mesa (master): st/glx: Fix endless loop in drawable validation

Thomas Hellstrom thomash at kemper.freedesktop.org
Mon Jul 4 08:00:54 UTC 2011


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

Author: Thomas Hellstrom <thellstrom at vmware.com>
Date:   Sat Jul  2 10:37:17 2011 +0200

st/glx: Fix endless loop in drawable validation

This fixes a regression introduced with commit

"st-api: Rework how drawables are invalidated v3"

where the glx state tracker manager would invalidate a drawable each time it
checks the drawable dimensions, even during a validate call, which
resulted in an endless loop, since the state tracker would immediately
detect the new invalidation and rerun the validate...

This change marks the drawable invalid only if the drawable dimensions actually
changed during the validate, which will result in at most a single
unnecessary validate by the context running a validate during which the
dimensions changed.

To avoid unnecessary validates altogether, we need to implement yet another
st-api change: Returning the current time stamp from the validate function,
as suggested by Chia-I Wu. The glx state tracker manager could then return
the stamp resulting from the last drawable dimension check.

Signed-off-by: Thomas Hellstrom <thellstrom at vmware.com>

---

 src/gallium/state_trackers/glx/xlib/xm_api.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c
index 1be6dd9..8f6406d 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.c
@@ -1124,11 +1124,18 @@ xmesa_notify_invalid_buffer(XMesaBuffer b)
 void
 xmesa_check_buffer_size(XMesaBuffer b)
 {
+   GLuint old_width, old_height;
+
    if (b->type == PBUFFER)
       return;
 
+   old_width = b->width;
+   old_height = b->height;
+
    xmesa_get_window_size(b->xm_visual->display, b, &b->width, &b->height);
-   xmesa_notify_invalid_buffer(b);
+
+   if (b->width != old_width || b->height != old_height)
+      xmesa_notify_invalid_buffer(b);
 }
 
 




More information about the mesa-commit mailing list