summaryrefslogtreecommitdiffstats
path: root/src/glx/x11/glxext.c
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-02-22 08:53:33 -0700
committerBrian <[email protected]>2007-02-22 08:53:33 -0700
commit29c471aafc6a3fef23d553e31a555d1782854a77 (patch)
tree335385fd55d510118346136c6feb4daa707988b6 /src/glx/x11/glxext.c
parent6d4cf6be4e79c3a6ab18272577df17389e3834a6 (diff)
parenta4b344baa2484c65a1618f3cce3a94c91dea8ef7 (diff)
Merge branch 'origin' into glsl-compiler-1
Conflicts: src/mesa/main/state.c src/mesa/shader/program.c src/mesa/shader/program.h src/mesa/shader/programopt.c src/mesa/shader/slang/slang_execute.c src/mesa/sources src/mesa/swrast/s_arbshader.c src/mesa/swrast/s_context.c src/mesa/swrast/s_span.c src/mesa/swrast/s_zoom.c src/mesa/tnl/t_context.c src/mesa/tnl/t_save_api.c src/mesa/tnl/t_vb_arbprogram.c src/mesa/tnl/t_vp_build.c src/mesa/tnl/t_vtx_eval.c
Diffstat (limited to 'src/glx/x11/glxext.c')
-rw-r--r--src/glx/x11/glxext.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c
index 8bec2c34c60..a039bca234d 100644
--- a/src/glx/x11/glxext.c
+++ b/src/glx/x11/glxext.c
@@ -48,6 +48,8 @@
#include <stdio.h>
#include <X11/extensions/Xext.h>
#include <X11/extensions/extutil.h>
+#include <X11/extensions/Xfixes.h>
+#include <X11/extensions/Xdamage.h>
#include <assert.h>
#include "indirect_init.h"
#include "glapi.h"
@@ -394,6 +396,10 @@ static int __glXFreeDisplayPrivate(XExtData *extension)
(*priv->driDisplay.destroyDisplay)(priv->dpy,
priv->driDisplay.private);
priv->driDisplay.private = NULL;
+ if (priv->driDisplay.createNewScreen) {
+ Xfree(priv->driDisplay.createNewScreen); /* free array of ptrs */
+ priv->driDisplay.createNewScreen = NULL;
+ }
#endif
Xfree((char*) priv);
@@ -698,6 +704,69 @@ static __DRIfuncPtr get_proc_address( const char * proc_name )
return NULL;
}
+#ifdef XDAMAGE_1_1_INTERFACE
+static GLboolean has_damage_post(__DRInativeDisplay *dpy)
+{
+ static GLboolean inited = GL_FALSE;
+ static GLboolean has_damage;
+
+ if (!inited) {
+ int major, minor;
+
+ if (XDamageQueryVersion(dpy, &major, &minor) &&
+ major == 1 && minor >= 1)
+ {
+ has_damage = GL_TRUE;
+ } else {
+ has_damage = GL_FALSE;
+ }
+ inited = GL_TRUE;
+ }
+
+ return has_damage;
+}
+#endif /* XDAMAGE_1_1_INTERFACE */
+
+static void __glXReportDamage(__DRInativeDisplay *dpy, int screen,
+ __DRIid drawable,
+ int x, int y,
+ drm_clip_rect_t *rects, int num_rects,
+ GLboolean front_buffer)
+{
+#ifdef XDAMAGE_1_1_INTERFACE
+ XRectangle *xrects;
+ XserverRegion region;
+ int i;
+ int x_off, y_off;
+
+ if (!has_damage_post(dpy))
+ return;
+
+ if (front_buffer) {
+ x_off = x;
+ y_off = y;
+ drawable = RootWindow(dpy, screen);
+ } else{
+ x_off = 0;
+ y_off = 0;
+ }
+
+ xrects = malloc(sizeof(XRectangle) * num_rects);
+ if (xrects == NULL)
+ return;
+
+ for (i = 0; i < num_rects; i++) {
+ xrects[i].x = rects[i].x1 + x_off;
+ xrects[i].y = rects[i].y1 + y_off;
+ xrects[i].width = rects[i].x2 - rects[i].x1;
+ xrects[i].height = rects[i].y2 - rects[i].y1;
+ }
+ region = XFixesCreateRegion(dpy, xrects, num_rects);
+ free(xrects);
+ XDamageAdd(dpy, drawable, region);
+ XFixesDestroyRegion(dpy, region);
+#endif
+}
/**
* Table of functions exported by the loader to the driver.
@@ -720,6 +789,8 @@ static const __DRIinterfaceMethods interface_methods = {
__glXGetUST,
__glXGetMscRateOML,
+
+ __glXReportDamage,
};