summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancisco Jerez <currojerez@riseup.net>2010-03-01 20:21:09 +0100
committerKristian Høgsberg <krh@bitplanet.net>2010-03-22 16:22:54 -0400
commitd5390478ae791a1a6b0f98684bdcc910c437f00a (patch)
tree9c0b71485e38b0cb717881a99854a1b5f6480b96
parent4b9cdc474ab5aeac93fcd5eefbf723f5bb8a7de0 (diff)
glx/dri2: Notify the driver when its buffers become invalid.dri2-invalidate
Signed-off-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
-rw-r--r--glx/glxdri2.c45
1 files changed, 30 insertions, 15 deletions
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index edd29b0e1..79d7767cc 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -95,6 +95,7 @@ struct __GLXDRIdrawable {
int height;
__DRIbuffer buffers[MAX_DRAWABLE_BUFFERS];
int count;
+ XID dri2ref;
};
static void
@@ -107,8 +108,10 @@ __glXDRIdrawableDestroy(__GLXdrawable *drawable)
/* If the X window was destroyed, the dri DestroyWindow hook will
* aready have taken care of this, so only call if pDraw isn't NULL. */
- if (drawable->pDraw != NULL)
+ if (drawable->pDraw != NULL) {
+ FreeResource(private->dri2ref, RT_NONE);
DRI2DestroyDrawable(drawable->pDraw);
+ }
__glXDrawableRelease(drawable);
@@ -217,15 +220,8 @@ __glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable *drawable)
__GLXDRIscreen *screen = priv->screen;
CARD64 unused;
-#if __DRI2_FLUSH_VERSION >= 3
- if (screen->flush) {
- (*screen->flush->flush)(priv->driDrawable);
- (*screen->flush->invalidate)(priv->driDrawable);
- }
-#else
if (screen->flush)
- (*screen->flush->flushInvalidate)(priv->driDrawable);
-#endif
+ (*screen->flush->flush)(priv->driDrawable);
if (DRI2SwapBuffers(client, drawable->pDraw, 0, 0, 0, &unused,
__glXdriSwapEvent, drawable->pDraw) != Success)
@@ -474,6 +470,16 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen,
return &private->base;
}
+static void
+__glXDRIinvalidateEvent(DrawablePtr pDraw, void *priv)
+{
+ __GLXDRIdrawable *draw = priv;
+ __GLXDRIscreen *screen = draw->screen;
+
+ if (screen->flush)
+ screen->flush->invalidate(draw->driDrawable);
+}
+
static __DRIbuffer *
dri2GetBuffers(__DRIdrawable *driDrawable,
int *width, int *height,
@@ -482,16 +488,20 @@ dri2GetBuffers(__DRIdrawable *driDrawable,
{
__GLXDRIdrawable *private = loaderPrivate;
DRI2BufferPtr *buffers;
- int i;
- int j;
+ int i, j, ret;
- buffers = DRI2GetBuffers(private->base.pDraw,
- width, height, attachments, count, out_count);
+ buffers = DRI2GetBuffers(private->base.pDraw, width, height, attachments,
+ count, out_count);
if (*out_count > MAX_DRAWABLE_BUFFERS) {
*out_count = 0;
return NULL;
}
-
+
+ ret = DRI2TrackClient(private->base.pDraw, serverClient,
+ __glXDRIinvalidateEvent, private, &private->dri2ref);
+ if (ret != Success)
+ return NULL;
+
private->width = *width;
private->height = *height;
@@ -526,7 +536,7 @@ dri2GetBuffersWithFormat(__DRIdrawable *driDrawable,
{
__GLXDRIdrawable *private = loaderPrivate;
DRI2BufferPtr *buffers;
- int i;
+ int i, ret;
int j = 0;
buffers = DRI2GetBuffersWithFormat(private->base.pDraw,
@@ -537,6 +547,11 @@ dri2GetBuffersWithFormat(__DRIdrawable *driDrawable,
return NULL;
}
+ ret = DRI2TrackClient(private->base.pDraw, serverClient,
+ __glXDRIinvalidateEvent, private, &private->dri2ref);
+ if (ret != Success)
+ return NULL;
+
private->width = *width;
private->height = *height;