summaryrefslogtreecommitdiffstats
path: root/src/glx
diff options
context:
space:
mode:
Diffstat (limited to 'src/glx')
-rw-r--r--src/glx/compsize.c9
-rw-r--r--src/glx/dri2.c9
-rw-r--r--src/glx/dri2_glx.c34
-rw-r--r--src/glx/dri_common.c10
-rw-r--r--src/glx/glxclient.h3
-rw-r--r--src/glx/glxextensions.c1
-rw-r--r--src/glx/glxextensions.h1
7 files changed, 42 insertions, 25 deletions
diff --git a/src/glx/compsize.c b/src/glx/compsize.c
index 5ba6dc919e5..f69ffaba316 100644
--- a/src/glx/compsize.c
+++ b/src/glx/compsize.c
@@ -52,15 +52,11 @@ __glElementsPerGroup(GLenum format, GLenum type)
case GL_UNSIGNED_SHORT_1_5_5_5_REV:
case GL_UNSIGNED_SHORT_8_8_APPLE:
case GL_UNSIGNED_SHORT_8_8_REV_APPLE:
- case GL_UNSIGNED_SHORT_15_1_MESA:
- case GL_UNSIGNED_SHORT_1_15_REV_MESA:
case GL_UNSIGNED_INT_8_8_8_8:
case GL_UNSIGNED_INT_8_8_8_8_REV:
case GL_UNSIGNED_INT_10_10_10_2:
case GL_UNSIGNED_INT_2_10_10_10_REV:
case GL_UNSIGNED_INT_24_8_NV:
- case GL_UNSIGNED_INT_24_8_MESA:
- case GL_UNSIGNED_INT_8_24_REV_MESA:
return 1;
default:
break;
@@ -70,6 +66,7 @@ __glElementsPerGroup(GLenum format, GLenum type)
case GL_RGB:
case GL_BGR:
return 3;
+ case GL_RG:
case GL_422_EXT:
case GL_422_REV_EXT:
case GL_422_AVERAGE_EXT:
@@ -114,8 +111,6 @@ __glBytesPerElement(GLenum type)
case GL_UNSIGNED_SHORT_1_5_5_5_REV:
case GL_UNSIGNED_SHORT_8_8_APPLE:
case GL_UNSIGNED_SHORT_8_8_REV_APPLE:
- case GL_UNSIGNED_SHORT_15_1_MESA:
- case GL_UNSIGNED_SHORT_1_15_REV_MESA:
return 2;
case GL_UNSIGNED_BYTE:
case GL_BYTE:
@@ -130,8 +125,6 @@ __glBytesPerElement(GLenum type)
case GL_UNSIGNED_INT_10_10_10_2:
case GL_UNSIGNED_INT_2_10_10_10_REV:
case GL_UNSIGNED_INT_24_8_NV:
- case GL_UNSIGNED_INT_24_8_MESA:
- case GL_UNSIGNED_INT_8_24_REV_MESA:
return 4;
default:
return 0;
diff --git a/src/glx/dri2.c b/src/glx/dri2.c
index 30999c899a7..adfd3d1f7c8 100644
--- a/src/glx/dri2.c
+++ b/src/glx/dri2.c
@@ -98,16 +98,13 @@ DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire)
{
GLXBufferSwapComplete *aevent = (GLXBufferSwapComplete *)event;
xDRI2BufferSwapComplete *awire = (xDRI2BufferSwapComplete *)wire;
- __GLXDRIdrawable *pdraw;
- struct glx_display *glx_dpy = __glXInitialize(dpy);
/* Ignore swap events if we're not looking for them */
- pdraw = dri2GetGlxDrawableFromXDrawableId(dpy, awire->drawable);
- if (!pdraw || !(pdraw->eventMask & GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK))
- return False;
+ aevent->type = dri2GetSwapEventType(dpy, awire->drawable);
+ if(!aevent->type)
+ return False;
aevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *) wire);
- aevent->type = glx_dpy->codes->first_event + GLX_BufferSwapComplete;
aevent->send_event = (awire->type & 0x80) != 0;
aevent->display = dpy;
aevent->drawable = awire->drawable;
diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index 8247588e76b..b0559b24d72 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -118,6 +118,8 @@ dri2_destroy_context(struct glx_context *context)
struct dri2_context *pcp = (struct dri2_context *) context;
struct dri2_screen *psc = (struct dri2_screen *) context->psc;
+ driReleaseDrawables(&pcp->base);
+
if (context->xid)
glx_send_destroy_context(psc->base.dpy, context->xid);
@@ -136,6 +138,7 @@ dri2_bind_context(struct glx_context *context, struct glx_context *old,
struct dri2_context *pcp = (struct dri2_context *) context;
struct dri2_screen *psc = (struct dri2_screen *) pcp->base.psc;
struct dri2_drawable *pdraw, *pread;
+ struct dri2_display *pdp;
pdraw = (struct dri2_drawable *) driFetchDrawable(context, draw);
pread = (struct dri2_drawable *) driFetchDrawable(context, read);
@@ -143,11 +146,21 @@ dri2_bind_context(struct glx_context *context, struct glx_context *old,
if (pdraw == NULL || pread == NULL)
return GLXBadDrawable;
- if ((*psc->core->bindContext) (pcp->driContext,
- pdraw->driDrawable, pread->driDrawable))
- return Success;
+ if (!(*psc->core->bindContext) (pcp->driContext,
+ pdraw->driDrawable, pread->driDrawable))
+ return GLXBadContext;
+
+ /* If the server doesn't send invalidate events, we may miss a
+ * resize before the rendering starts. Invalidate the buffers now
+ * so the driver will recheck before rendering starts. */
+ pdp = (struct dri2_display *) psc->base.display;
+ if (!pdp->invalidateAvailable) {
+ dri2InvalidateBuffers(psc->base.dpy, pdraw->base.xDrawable);
+ if (pread != pdraw)
+ dri2InvalidateBuffers(psc->base.dpy, pread->base.xDrawable);
+ }
- return GLXBadContext;
+ return Success;
}
static void
@@ -158,7 +171,8 @@ dri2_unbind_context(struct glx_context *context, struct glx_context *new)
(*psc->core->unbindContext) (pcp->driContext);
- driReleaseDrawables(&pcp->base);
+ if (context == new)
+ driReleaseDrawables(&pcp->base);
}
static struct glx_context *
@@ -499,6 +513,16 @@ process_buffers(struct dri2_drawable * pdraw, DRI2Buffer * buffers,
}
+unsigned dri2GetSwapEventType(Display* dpy, XID drawable)
+{
+ struct glx_display *glx_dpy = __glXInitialize(dpy);
+ __GLXDRIdrawable *pdraw;
+ pdraw = dri2GetGlxDrawableFromXDrawableId(dpy, drawable);
+ if (!pdraw || !(pdraw->eventMask & GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK))
+ return 0;
+ return glx_dpy->codes->first_event + GLX_BufferSwapComplete;
+}
+
static int64_t
dri2SwapBuffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor,
int64_t remainder)
diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
index 5fb5255416b..83d6e3c3108 100644
--- a/src/glx/dri_common.c
+++ b/src/glx/dri_common.c
@@ -391,17 +391,19 @@ driReleaseDrawables(struct glx_context *gc)
if (__glxHashLookup(priv->drawHash,
gc->currentDrawable, (void *) &pdraw) == 0) {
- if (pdraw->drawable == pdraw->xDrawable)
+ if (pdraw->drawable == pdraw->xDrawable) {
(*pdraw->destroyDrawable)(pdraw);
- __glxHashDelete(priv->drawHash, gc->currentDrawable);
+ __glxHashDelete(priv->drawHash, gc->currentDrawable);
+ }
}
if (gc->currentDrawable != gc->currentReadable &&
__glxHashLookup(priv->drawHash,
gc->currentReadable, (void *) &pdraw) == 0) {
- if (pdraw->drawable == pdraw->xDrawable)
+ if (pdraw->drawable == pdraw->xDrawable) {
(*pdraw->destroyDrawable)(pdraw);
- __glxHashDelete(priv->drawHash, gc->currentReadable);
+ __glxHashDelete(priv->drawHash, gc->currentReadable);
+ }
}
}
diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h
index b453e6dbd04..36a0808c048 100644
--- a/src/glx/glxclient.h
+++ b/src/glx/glxclient.h
@@ -89,8 +89,6 @@ typedef struct __GLXDRIdisplayRec __GLXDRIdisplay;
typedef struct __GLXDRIscreenRec __GLXDRIscreen;
typedef struct __GLXDRIdrawableRec __GLXDRIdrawable;
-#include "glxextensions.h"
-
struct __GLXDRIdisplayRec
{
/**
@@ -150,6 +148,7 @@ extern __GLXDRIdisplay *driswCreateDisplay(Display * dpy);
extern __GLXDRIdisplay *driCreateDisplay(Display * dpy);
extern __GLXDRIdisplay *dri2CreateDisplay(Display * dpy);
extern void dri2InvalidateBuffers(Display *dpy, XID drawable);
+extern unsigned dri2GetSwapEventType(Display *dpy, XID drawable);
/*
diff --git a/src/glx/glxextensions.c b/src/glx/glxextensions.c
index 23161ef49a1..3a0e64c46d1 100644
--- a/src/glx/glxextensions.c
+++ b/src/glx/glxextensions.c
@@ -165,6 +165,7 @@ static const struct extension_info known_gl_extensions[] = {
{ GL(ARB_texture_mirrored_repeat), VER(1,4), Y, N, N, N },
{ GL(ARB_texture_non_power_of_two), VER(1,5), Y, N, N, N },
{ GL(ARB_texture_rectangle), VER(0,0), Y, N, N, N },
+ { GL(ARB_texture_rg), VER(0,0), Y, N, N, N },
{ GL(ARB_transpose_matrix), VER(1,3), Y, N, Y, N },
{ GL(ARB_vertex_buffer_object), VER(1,5), N, N, N, N },
{ GL(ARB_vertex_program), VER(0,0), Y, N, N, N },
diff --git a/src/glx/glxextensions.h b/src/glx/glxextensions.h
index a11fe88ffc9..78776618338 100644
--- a/src/glx/glxextensions.h
+++ b/src/glx/glxextensions.h
@@ -93,6 +93,7 @@ enum
GL_ARB_texture_mirrored_repeat_bit,
GL_ARB_texture_non_power_of_two_bit,
GL_ARB_texture_rectangle_bit,
+ GL_ARB_texture_rg_bit,
GL_ARB_transpose_matrix_bit,
GL_ARB_vertex_buffer_object_bit,
GL_ARB_vertex_program_bit,