Mesa (mesa_7_6_branch): GLX: Warn only once about applications calling GLX 1.3 functions

Brian Paul brianp at kemper.freedesktop.org
Tue Sep 22 19:48:35 UTC 2009


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

Author: Tormod Volden <debian.tormod at gmail.com>
Date:   Sun Sep 20 20:20:01 2009 +0200

GLX: Warn only once about applications calling GLX 1.3 functions

The warnings introduced in 1f309c40b8065b8729fce631540c66e4b50b84df
would pour out generously from some applications. This patch adds a
"warn once" wrapper macro, heavily inspired by
src/mesa/drivers/dri/r600/radeon_debug.h

Signed-off-by: Tormod Volden <debian.tormod at gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

---

 src/glx/x11/glx_pbuffer.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/glx/x11/glx_pbuffer.c b/src/glx/x11/glx_pbuffer.c
index 37459f8..0ff25bf 100644
--- a/src/glx/x11/glx_pbuffer.c
+++ b/src/glx/x11/glx_pbuffer.c
@@ -39,6 +39,13 @@
 #include "glxextensions.h"
 #include "glcontextmodes.h"
 
+#define WARN_ONCE_GLX_1_3(a, b) {		\
+		static int warned=1;		\
+		if(warned) {			\
+			warn_GLX_1_3((a), b );	\
+			warned=0;		\
+		}				\
+	}
 
 /**
  * Emit a warning when clients use GLX 1.3 functions on pre-1.3 systems.
@@ -576,7 +583,7 @@ glXCreatePbuffer(Display * dpy, GLXFBConfig config, const int *attrib_list)
    width = 0;
    height = 0;
 
-   warn_GLX_1_3(dpy, __func__);
+   WARN_ONCE_GLX_1_3(dpy, __func__);
 
    for (i = 0; attrib_list[i * 2]; i++) {
       switch (attrib_list[i * 2]) {
@@ -611,7 +618,7 @@ PUBLIC void
 glXQueryDrawable(Display * dpy, GLXDrawable drawable,
                  int attribute, unsigned int *value)
 {
-   warn_GLX_1_3(dpy, __func__);
+   WARN_ONCE_GLX_1_3(dpy, __func__);
    GetDrawableAttribute(dpy, drawable, attribute, value);
 }
 
@@ -665,7 +672,7 @@ PUBLIC GLXPixmap
 glXCreatePixmap(Display * dpy, GLXFBConfig config, Pixmap pixmap,
                 const int *attrib_list)
 {
-   warn_GLX_1_3(dpy, __func__);
+   WARN_ONCE_GLX_1_3(dpy, __func__);
 
    return CreateDrawable(dpy, (__GLcontextModes *) config,
                          (Drawable) pixmap, attrib_list, X_GLXCreatePixmap);
@@ -676,7 +683,7 @@ PUBLIC GLXWindow
 glXCreateWindow(Display * dpy, GLXFBConfig config, Window win,
                 const int *attrib_list)
 {
-   warn_GLX_1_3(dpy, __func__);
+   WARN_ONCE_GLX_1_3(dpy, __func__);
 
    return CreateDrawable(dpy, (__GLcontextModes *) config,
                          (Drawable) win, attrib_list, X_GLXCreateWindow);
@@ -686,7 +693,7 @@ glXCreateWindow(Display * dpy, GLXFBConfig config, Window win,
 PUBLIC void
 glXDestroyPixmap(Display * dpy, GLXPixmap pixmap)
 {
-   warn_GLX_1_3(dpy, __func__);
+   WARN_ONCE_GLX_1_3(dpy, __func__);
 
    DestroyDrawable(dpy, (GLXDrawable) pixmap, X_GLXDestroyPixmap);
 }
@@ -695,7 +702,7 @@ glXDestroyPixmap(Display * dpy, GLXPixmap pixmap)
 PUBLIC void
 glXDestroyWindow(Display * dpy, GLXWindow win)
 {
-   warn_GLX_1_3(dpy, __func__);
+   WARN_ONCE_GLX_1_3(dpy, __func__);
 
    DestroyDrawable(dpy, (GLXDrawable) win, X_GLXDestroyWindow);
 }
@@ -717,3 +724,4 @@ GLX_ALIAS_VOID(glXGetSelectedEventSGIX,
                (Display * dpy, GLXDrawable drawable,
                 unsigned long *mask), (dpy, drawable, mask),
                glXGetSelectedEvent)
+




More information about the mesa-commit mailing list