summaryrefslogtreecommitdiff
path: root/src/glx
diff options
context:
space:
mode:
authorNicolai Hähnle <nhaehnle@gmail.com>2009-09-21 13:26:50 +0200
committerNicolai Hähnle <nhaehnle@gmail.com>2009-09-21 13:26:50 +0200
commit81c7561d9d3faf70ac22c6a5f3fbea18f53eed92 (patch)
tree5ec097e0e1fe99804104d3a56923c16edf1533aa /src/glx
parentf02f63997ce65530788a6dfcb28f11790a14d938 (diff)
parent3083ba38f4c884b32cd0460607b5064b6b7008d2 (diff)
Merge branch 'master' into r300-compiler
There were additional non-textual conflicts. Conflicts: src/gallium/drivers/r300/r300_tgsi_to_rc.c src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c src/mesa/drivers/dri/r300/compiler/radeon_program.c src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c
Diffstat (limited to 'src/glx')
-rw-r--r--src/glx/x11/glx_pbuffer.c28
-rw-r--r--src/glx/x11/glxhash.c10
2 files changed, 35 insertions, 3 deletions
diff --git a/src/glx/x11/glx_pbuffer.c b/src/glx/x11/glx_pbuffer.c
index 88a17df6f8..01569213f2 100644
--- a/src/glx/x11/glx_pbuffer.c
+++ b/src/glx/x11/glx_pbuffer.c
@@ -41,6 +41,23 @@
/**
+ * Emit a warning when clients use GLX 1.3 functions on pre-1.3 systems.
+ */
+static void
+warn_GLX_1_3(Display *dpy, const char *function_name)
+{
+ __GLXdisplayPrivate *priv = __glXInitialize(dpy);
+
+ if (priv->minorVersion < 3) {
+ fprintf(stderr,
+ "WARNING: Application calling GLX 1.3 function \"%s\" "
+ "when GLX 1.3 is not supported! This is an application bug!\n",
+ function_name);
+ }
+}
+
+
+/**
* Change a drawable's attribute.
*
* This function is used to implement \c glXSelectEvent and
@@ -559,6 +576,8 @@ glXCreatePbuffer(Display * dpy, GLXFBConfig config, const int *attrib_list)
width = 0;
height = 0;
+ warn_GLX_1_3(dpy, __func__);
+
for (i = 0; attrib_list[i * 2]; i++) {
switch (attrib_list[i * 2]) {
case GLX_PBUFFER_WIDTH:
@@ -592,6 +611,7 @@ PUBLIC void
glXQueryDrawable(Display * dpy, GLXDrawable drawable,
int attribute, unsigned int *value)
{
+ warn_GLX_1_3(dpy, __func__);
GetDrawableAttribute(dpy, drawable, attribute, value);
}
@@ -645,6 +665,8 @@ PUBLIC GLXPixmap
glXCreatePixmap(Display * dpy, GLXFBConfig config, Pixmap pixmap,
const int *attrib_list)
{
+ warn_GLX_1_3(dpy, __func__);
+
return CreateDrawable(dpy, (__GLcontextModes *) config,
(Drawable) pixmap, attrib_list, X_GLXCreatePixmap);
}
@@ -654,6 +676,8 @@ PUBLIC GLXWindow
glXCreateWindow(Display * dpy, GLXFBConfig config, Window win,
const int *attrib_list)
{
+ warn_GLX_1_3(dpy, __func__);
+
return CreateDrawable(dpy, (__GLcontextModes *) config,
(Drawable) win, attrib_list, X_GLXCreateWindow);
}
@@ -662,6 +686,8 @@ glXCreateWindow(Display * dpy, GLXFBConfig config, Window win,
PUBLIC void
glXDestroyPixmap(Display * dpy, GLXPixmap pixmap)
{
+ warn_GLX_1_3(dpy, __func__);
+
DestroyDrawable(dpy, (GLXDrawable) pixmap, X_GLXDestroyPixmap);
}
@@ -669,6 +695,8 @@ glXDestroyPixmap(Display * dpy, GLXPixmap pixmap)
PUBLIC void
glXDestroyWindow(Display * dpy, GLXWindow win)
{
+ warn_GLX_1_3(dpy, __func__);
+
DestroyDrawable(dpy, (GLXDrawable) win, X_GLXDestroyWindow);
}
diff --git a/src/glx/x11/glxhash.c b/src/glx/x11/glxhash.c
index 74cd4f344d..7d28ada49c 100644
--- a/src/glx/x11/glxhash.c
+++ b/src/glx/x11/glxhash.c
@@ -87,9 +87,13 @@
#define HASH_ALLOC malloc
#define HASH_FREE free
-#define HASH_RANDOM_DECL
-#define HASH_RANDOM_INIT(seed) srandom(seed)
-#define HASH_RANDOM random()
+#define HASH_RANDOM_DECL struct random_data rd; int32_t rv; char rs[256]
+#define HASH_RANDOM_INIT(seed) \
+ do { \
+ (void) memset(&rd, 0, sizeof(rd)); \
+ (void) initstate_r(seed, rs, sizeof(rs), &rd); \
+ } while(0)
+#define HASH_RANDOM ((void) random_r(&rd, &rv), rv)
#define HASH_RANDOM_DESTROY
typedef struct __glxHashBucket