summaryrefslogtreecommitdiff
path: root/src/glx
diff options
context:
space:
mode:
Diffstat (limited to 'src/glx')
-rw-r--r--src/glx/x11/dri_glx.c4
-rw-r--r--src/glx/x11/drisw_glx.c4
-rw-r--r--src/glx/x11/glx_pbuffer.c20
-rw-r--r--src/glx/x11/glxcmds.c43
-rw-r--r--src/glx/x11/glxextensions.c5
-rw-r--r--src/glx/x11/glxextensions.h5
-rw-r--r--src/glx/x11/glxhash.c18
-rw-r--r--src/glx/x11/indirect.c66
-rw-r--r--src/glx/x11/indirect.h3
-rw-r--r--src/glx/x11/indirect_init.c12
10 files changed, 156 insertions, 24 deletions
diff --git a/src/glx/x11/dri_glx.c b/src/glx/x11/dri_glx.c
index ab24bd8ffe..4f7acb6cc3 100644
--- a/src/glx/x11/dri_glx.c
+++ b/src/glx/x11/dri_glx.c
@@ -596,8 +596,10 @@ driCreateDrawable(__GLXscreenConfigs * psc,
pdraw->drawable = drawable;
pdraw->psc = psc;
- if (!XF86DRICreateDrawable(psc->dpy, psc->scr, drawable, &hwDrawable))
+ if (!XF86DRICreateDrawable(psc->dpy, psc->scr, drawable, &hwDrawable)) {
+ Xfree(pdraw);
return NULL;
+ }
/* Create a new drawable */
pdraw->driDrawable =
diff --git a/src/glx/x11/drisw_glx.c b/src/glx/x11/drisw_glx.c
index 15e1586658..1866b2cc87 100644
--- a/src/glx/x11/drisw_glx.c
+++ b/src/glx/x11/drisw_glx.c
@@ -250,12 +250,14 @@ driCreateContext(__GLXscreenConfigs * psc,
{
__GLXDRIcontextPrivate *pcp, *pcp_shared;
__GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) mode;
- const __DRIcoreExtension *core = psc->core;
+ const __DRIcoreExtension *core;
__DRIcontext *shared = NULL;
if (!psc || !psc->driScreen)
return NULL;
+ core = psc->core;
+
if (shareList) {
pcp_shared = (__GLXDRIcontextPrivate *) shareList->driContext;
shared = pcp_shared->driContext;
diff --git a/src/glx/x11/glx_pbuffer.c b/src/glx/x11/glx_pbuffer.c
index 01569213f2..501500afc3 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);
}
@@ -716,3 +723,4 @@ GLX_ALIAS_VOID(glXGetSelectedEventSGIX,
(Display * dpy, GLXDrawable drawable,
unsigned long *mask), (dpy, drawable, mask),
glXGetSelectedEvent)
+
diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c
index ea55cc49ef..daa9076471 100644
--- a/src/glx/x11/glxcmds.c
+++ b/src/glx/x11/glxcmds.c
@@ -50,7 +50,7 @@
#include <xcb/glx.h>
#endif
-static const char __glXGLXClientVendorName[] = "SGI";
+static const char __glXGLXClientVendorName[] = "Mesa Project and SGI";
static const char __glXGLXClientVersion[] = "1.4";
@@ -398,6 +398,10 @@ CreateContext(Display * dpy, XVisualInfo * vis,
_XError(dpy, &error);
return None;
}
+ if (renderType == 0) {
+ /* Initialize renderType now */
+ renderType = mode->rgbMode ? GLX_RGBA_TYPE : GLX_COLOR_INDEX_TYPE;
+ }
}
else {
mode = fbconfig;
@@ -484,6 +488,8 @@ CreateContext(Display * dpy, XVisualInfo * vis,
gc->imported = GL_TRUE;
}
+ gc->renderType = renderType;
+
return gc;
}
@@ -534,6 +540,16 @@ DestroyContext(Display * dpy, GLXContext gc)
imported = gc->imported;
gc->xid = None;
+ if (gc->currentDpy) {
+ /* This context is bound to some thread. According to the man page,
+ * we should not actually delete the context until it's unbound.
+ * Note that we set gc->xid = None above. In MakeContextCurrent()
+ * we check for that and delete the context there.
+ */
+ __glXUnlock();
+ return;
+ }
+
#ifdef GLX_DIRECT_RENDERING
/* Destroy the direct rendering context */
if (gc->driContext) {
@@ -1575,7 +1591,7 @@ GLX_ALIAS(Display *, glXGetCurrentDisplayEXT, (void), (),
* This function dynamically determines whether to use the EXT_import_context
* version of the protocol or the GLX 1.3 version of the protocol.
*/
- static int __glXQueryContextInfo(Display * dpy, GLXContext ctx)
+static int __glXQueryContextInfo(Display * dpy, GLXContext ctx)
{
__GLXdisplayPrivate *priv = __glXInitialize(dpy);
xGLXQueryContextReply reply;
@@ -1713,7 +1729,7 @@ GLX_ALIAS(int, glXQueryContextInfoEXT,
(Display * dpy, GLXContext ctx, int attribute, int *value),
(dpy, ctx, attribute, value), glXQueryContext)
- PUBLIC GLXContextID glXGetContextIDEXT(const GLXContext ctx)
+PUBLIC GLXContextID glXGetContextIDEXT(const GLXContext ctx)
{
return ctx->xid;
}
@@ -2159,18 +2175,19 @@ GLX_ALIAS(int, glXGetFBConfigAttribSGIX,
(Display * dpy, GLXFBConfigSGIX config, int attribute, int *value),
(dpy, config, attribute, value), glXGetFBConfigAttrib)
- PUBLIC GLX_ALIAS(GLXFBConfigSGIX *, glXChooseFBConfigSGIX,
- (Display * dpy, int screen, int *attrib_list,
- int *nelements), (dpy, screen, attrib_list, nelements),
- glXChooseFBConfig)
+PUBLIC GLX_ALIAS(GLXFBConfigSGIX *, glXChooseFBConfigSGIX,
+ (Display * dpy, int screen, int *attrib_list,
+ int *nelements), (dpy, screen, attrib_list, nelements),
+ glXChooseFBConfig)
- PUBLIC GLX_ALIAS(XVisualInfo *, glXGetVisualFromFBConfigSGIX,
- (Display * dpy, GLXFBConfigSGIX config),
- (dpy, config), glXGetVisualFromFBConfig)
+PUBLIC GLX_ALIAS(XVisualInfo *, glXGetVisualFromFBConfigSGIX,
+ (Display * dpy, GLXFBConfigSGIX config),
+ (dpy, config), glXGetVisualFromFBConfig)
- PUBLIC GLXPixmap glXCreateGLXPixmapWithConfigSGIX(Display * dpy,
- GLXFBConfigSGIX config,
- Pixmap pixmap)
+PUBLIC GLXPixmap
+glXCreateGLXPixmapWithConfigSGIX(Display * dpy,
+ GLXFBConfigSGIX config,
+ Pixmap pixmap)
{
xGLXVendorPrivateWithReplyReq *vpreq;
xGLXCreateGLXPixmapWithConfigSGIXReq *req;
diff --git a/src/glx/x11/glxextensions.c b/src/glx/x11/glxextensions.c
index 473f46d1e5..6852128e2a 100644
--- a/src/glx/x11/glxextensions.c
+++ b/src/glx/x11/glxextensions.c
@@ -112,6 +112,7 @@ static const struct extension_info known_gl_extensions[] = {
{ GL(ARB_draw_buffers), VER(0,0), Y, N, N, N },
{ GL(ARB_fragment_program), VER(0,0), Y, N, N, N },
{ GL(ARB_fragment_program_shadow), VER(0,0), Y, N, N, N },
+ { GL(ARB_framebuffer_object), VER(0,0), Y, N, N, N },
{ GL(ARB_imaging), VER(0,0), Y, N, N, N },
{ GL(ARB_multisample), VER(1,3), Y, N, N, N },
{ GL(ARB_multitexture), VER(1,3), Y, N, N, N },
@@ -150,8 +151,11 @@ static const struct extension_info known_gl_extensions[] = {
{ GL(EXT_depth_bounds_test), VER(0,0), N, N, N, N },
{ GL(EXT_draw_range_elements), VER(1,2), Y, N, Y, N },
{ GL(EXT_fog_coord), VER(1,4), Y, N, N, N },
+ { GL(EXT_framebuffer_blit), VER(0,0), Y, N, N, N },
+ { GL(EXT_framebuffer_multisample), VER(0,0), Y, N, N, N },
{ GL(EXT_framebuffer_object), VER(0,0), Y, N, N, N },
{ GL(EXT_multi_draw_arrays), VER(1,4), Y, N, Y, N },
+ { GL(EXT_packed_depth_stencil), VER(0,0), Y, N, N, N },
{ GL(EXT_packed_pixels), VER(1,2), Y, N, N, N },
{ GL(EXT_paletted_texture), VER(0,0), Y, N, N, N },
{ GL(EXT_pixel_buffer_object), VER(0,0), N, N, N, N },
@@ -209,6 +213,7 @@ static const struct extension_info known_gl_extensions[] = {
{ GL(NV_fragment_program2), VER(0,0), Y, N, N, N },
{ GL(NV_light_max_exponent), VER(0,0), Y, N, N, N },
{ GL(NV_multisample_filter_hint), VER(0,0), Y, N, N, N },
+ { GL(NV_packed_depth_stencil), VER(0,0), Y, N, N, N },
{ GL(NV_point_sprite), VER(0,0), Y, N, N, N },
{ GL(NV_texgen_reflection), VER(0,0), Y, N, N, N },
{ GL(NV_texture_compression_vtc), VER(0,0), Y, N, N, N },
diff --git a/src/glx/x11/glxextensions.h b/src/glx/x11/glxextensions.h
index 9f1c697487..652c5db1c8 100644
--- a/src/glx/x11/glxextensions.h
+++ b/src/glx/x11/glxextensions.h
@@ -74,6 +74,7 @@ enum
GL_ARB_draw_buffers_bit,
GL_ARB_fragment_program_bit,
GL_ARB_fragment_program_shadow_bit,
+ GL_ARB_framebuffer_object_bit,
GL_ARB_imaging_bit,
GL_ARB_multisample_bit,
GL_ARB_multitexture_bit,
@@ -112,8 +113,11 @@ enum
GL_EXT_depth_bounds_test_bit,
GL_EXT_draw_range_elements_bit,
GL_EXT_fog_coord_bit,
+ GL_EXT_framebuffer_blit_bit,
+ GL_EXT_framebuffer_multisample_bit,
GL_EXT_framebuffer_object_bit,
GL_EXT_multi_draw_arrays_bit,
+ GL_EXT_packed_depth_stencil_bit,
GL_EXT_packed_pixels_bit,
GL_EXT_paletted_texture_bit,
GL_EXT_pixel_buffer_object_bit,
@@ -164,6 +168,7 @@ enum
GL_NV_fragment_program2_bit,
GL_NV_light_max_exponent_bit,
GL_NV_multisample_filter_hint_bit,
+ GL_NV_packed_depth_stencil_bit,
GL_NV_point_sprite_bit,
GL_NV_texgen_reflection_bit,
GL_NV_texture_compression_vtc_bit,
diff --git a/src/glx/x11/glxhash.c b/src/glx/x11/glxhash.c
index 74cd4f344d..b76ec32345 100644
--- a/src/glx/x11/glxhash.c
+++ b/src/glx/x11/glxhash.c
@@ -77,6 +77,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#define HASH_MAGIC 0xdeadbeef
#define HASH_DEBUG 0
@@ -87,10 +88,21 @@
#define HASH_ALLOC malloc
#define HASH_FREE free
-#define HASH_RANDOM_DECL
-#define HASH_RANDOM_INIT(seed) srandom(seed)
-#define HASH_RANDOM random()
+#ifndef __GLIBC__
+#define HASH_RANDOM_DECL char *ps, rs[256]
+#define HASH_RANDOM_INIT(seed) ps = initstate(seed, rs, sizeof(rs))
+#define HASH_RANDOM random()
+#define HASH_RANDOM_DESTROY setstate(ps)
+#else
+#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
+#endif
typedef struct __glxHashBucket
{
diff --git a/src/glx/x11/indirect.c b/src/glx/x11/indirect.c
index e0cafd43bc..ea90ce4463 100644
--- a/src/glx/x11/indirect.c
+++ b/src/glx/x11/indirect.c
@@ -8604,6 +8604,26 @@ __indirect_glDrawBuffersARB(GLsizei n, const GLenum * bufs)
}
}
+#define X_GLrop_RenderbufferStorageMultisample 4331
+void
+__indirect_glRenderbufferStorageMultisample(GLenum target, GLsizei samples,
+ GLenum internalformat,
+ GLsizei width, GLsizei height)
+{
+ __GLXcontext *const gc = __glXGetCurrentContext();
+ const GLuint cmdlen = 24;
+ emit_header(gc->pc, X_GLrop_RenderbufferStorageMultisample, cmdlen);
+ (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+ (void) memcpy((void *) (gc->pc + 8), (void *) (&samples), 4);
+ (void) memcpy((void *) (gc->pc + 12), (void *) (&internalformat), 4);
+ (void) memcpy((void *) (gc->pc + 16), (void *) (&width), 4);
+ (void) memcpy((void *) (gc->pc + 20), (void *) (&height), 4);
+ gc->pc += cmdlen;
+ if (__builtin_expect(gc->pc > gc->limit, 0)) {
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ }
+}
+
#define X_GLrop_SampleMaskSGIS 2048
void
__indirect_glSampleMaskSGIS(GLclampf value, GLboolean invert)
@@ -10597,6 +10617,52 @@ __indirect_glRenderbufferStorageEXT(GLenum target, GLenum internalformat,
}
}
+#define X_GLrop_BlitFramebufferEXT 4330
+void
+__indirect_glBlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1,
+ GLint srcY1, GLint dstX0, GLint dstY0,
+ GLint dstX1, GLint dstY1, GLbitfield mask,
+ GLenum filter)
+{
+ __GLXcontext *const gc = __glXGetCurrentContext();
+ const GLuint cmdlen = 44;
+ emit_header(gc->pc, X_GLrop_BlitFramebufferEXT, cmdlen);
+ (void) memcpy((void *) (gc->pc + 4), (void *) (&srcX0), 4);
+ (void) memcpy((void *) (gc->pc + 8), (void *) (&srcY0), 4);
+ (void) memcpy((void *) (gc->pc + 12), (void *) (&srcX1), 4);
+ (void) memcpy((void *) (gc->pc + 16), (void *) (&srcY1), 4);
+ (void) memcpy((void *) (gc->pc + 20), (void *) (&dstX0), 4);
+ (void) memcpy((void *) (gc->pc + 24), (void *) (&dstY0), 4);
+ (void) memcpy((void *) (gc->pc + 28), (void *) (&dstX1), 4);
+ (void) memcpy((void *) (gc->pc + 32), (void *) (&dstY1), 4);
+ (void) memcpy((void *) (gc->pc + 36), (void *) (&mask), 4);
+ (void) memcpy((void *) (gc->pc + 40), (void *) (&filter), 4);
+ gc->pc += cmdlen;
+ if (__builtin_expect(gc->pc > gc->limit, 0)) {
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ }
+}
+
+#define X_GLrop_FramebufferTextureLayerEXT 237
+void
+__indirect_glFramebufferTextureLayerEXT(GLenum target, GLenum attachment,
+ GLuint texture, GLint level,
+ GLint layer)
+{
+ __GLXcontext *const gc = __glXGetCurrentContext();
+ const GLuint cmdlen = 24;
+ emit_header(gc->pc, X_GLrop_FramebufferTextureLayerEXT, cmdlen);
+ (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+ (void) memcpy((void *) (gc->pc + 8), (void *) (&attachment), 4);
+ (void) memcpy((void *) (gc->pc + 12), (void *) (&texture), 4);
+ (void) memcpy((void *) (gc->pc + 16), (void *) (&level), 4);
+ (void) memcpy((void *) (gc->pc + 20), (void *) (&layer), 4);
+ gc->pc += cmdlen;
+ if (__builtin_expect(gc->pc > gc->limit, 0)) {
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ }
+}
+
# undef FASTCALL
# undef NOINLINE
diff --git a/src/glx/x11/indirect.h b/src/glx/x11/indirect.h
index 0719a1b302..19a8c0d134 100644
--- a/src/glx/x11/indirect.h
+++ b/src/glx/x11/indirect.h
@@ -572,6 +572,7 @@ extern HIDDEN void __indirect_glGetQueryObjectuivARB(GLuint id, GLenum pname, GL
extern HIDDEN void __indirect_glGetQueryivARB(GLenum target, GLenum pname, GLint * params);
extern HIDDEN GLboolean __indirect_glIsQueryARB(GLuint id);
extern HIDDEN void __indirect_glDrawBuffersARB(GLsizei n, const GLenum * bufs);
+extern HIDDEN void __indirect_glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
extern HIDDEN void __indirect_glSampleMaskSGIS(GLclampf value, GLboolean invert);
extern HIDDEN void __indirect_glSamplePatternSGIS(GLenum pattern);
extern HIDDEN void __indirect_glColorPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer);
@@ -710,6 +711,8 @@ extern HIDDEN void __indirect_glGetRenderbufferParameterivEXT(GLenum target, GLe
extern HIDDEN GLboolean __indirect_glIsFramebufferEXT(GLuint framebuffer);
extern HIDDEN GLboolean __indirect_glIsRenderbufferEXT(GLuint renderbuffer);
extern HIDDEN void __indirect_glRenderbufferStorageEXT(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+extern HIDDEN void __indirect_glBlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+extern HIDDEN void __indirect_glFramebufferTextureLayerEXT(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
# undef HIDDEN
# undef FASTCALL
diff --git a/src/glx/x11/indirect_init.c b/src/glx/x11/indirect_init.c
index 852fe712c6..73ca993027 100644
--- a/src/glx/x11/indirect_init.c
+++ b/src/glx/x11/indirect_init.c
@@ -588,6 +588,10 @@ __GLapi * __glXNewIndirectAPI( void )
glAPI->DrawBuffersARB = __indirect_glDrawBuffersARB;
+ /* 45. GL_ARB_framebuffer_object */
+
+ glAPI->RenderbufferStorageMultisample = __indirect_glRenderbufferStorageMultisample;
+
/* 25. GL_SGIS_multisample */
glAPI->SampleMaskSGIS = __indirect_glSampleMaskSGIS;
@@ -768,6 +772,14 @@ __GLapi * __glXNewIndirectAPI( void )
glAPI->IsRenderbufferEXT = __indirect_glIsRenderbufferEXT;
glAPI->RenderbufferStorageEXT = __indirect_glRenderbufferStorageEXT;
+ /* 316. GL_EXT_framebuffer_blit */
+
+ glAPI->BlitFramebufferEXT = __indirect_glBlitFramebufferEXT;
+
+ /* 329. GL_EXT_texture_array */
+
+ glAPI->FramebufferTextureLayerEXT = __indirect_glFramebufferTextureLayerEXT;
+
return glAPI;
}