summaryrefslogtreecommitdiffstats
path: root/src/glx
diff options
context:
space:
mode:
authorWang Zhenyu <[email protected]>2006-12-04 15:48:04 +0800
committerKeith Packard <[email protected]>2007-01-06 15:49:23 -0800
commitcaf8010652f77e7687c0a3b7c267ba49d0a24d74 (patch)
treeb21776131775e7ec72e5ab57c962226eaa755030 /src/glx
parentf34cad0f972ca838cb223429acab54d26c2f6a57 (diff)
parent8c1cc5fd8084e7a927b15c88709a615fa16b06a3 (diff)
Merge branch 'master' into crestline
Conflicts: src/mesa/drivers/dri/i965/brw_tex_layout.c Michel Dänzer replaced the copy of the 945 mipmap layout code with that from the 945 driver directly.
Diffstat (limited to 'src/glx')
-rw-r--r--src/glx/x11/glxcmds.c3
-rw-r--r--src/glx/x11/glxext.c66
-rw-r--r--src/glx/x11/indirect_vertex_array.c6
3 files changed, 71 insertions, 4 deletions
diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c
index 9d1bb2a0b55..f52b71ffcd2 100644
--- a/src/glx/x11/glxcmds.c
+++ b/src/glx/x11/glxcmds.c
@@ -2883,8 +2883,9 @@ int __glXGetInternalVersion(void)
* 20050727 - Gut all the old interfaces. This breaks compatability with
* any DRI driver built to any previous version.
* 20060314 - Added support for GLX_MESA_copy_sub_buffer.
+ * 20070105 - Added support for damage reporting.
*/
- return 20060314;
+ return 20070105;
}
diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c
index 8bec2c34c60..29b3a1c01c5 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"
@@ -698,6 +700,68 @@ 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);
+ XDamagePost(dpy, drawable, region);
+ XFixesDestroyRegion(dpy, region);
+#endif
+}
/**
* Table of functions exported by the loader to the driver.
@@ -720,6 +784,8 @@ static const __DRIinterfaceMethods interface_methods = {
__glXGetUST,
__glXGetMscRateOML,
+
+ __glXReportDamage,
};
diff --git a/src/glx/x11/indirect_vertex_array.c b/src/glx/x11/indirect_vertex_array.c
index 429b52ae635..1855547dced 100644
--- a/src/glx/x11/indirect_vertex_array.c
+++ b/src/glx/x11/indirect_vertex_array.c
@@ -527,7 +527,7 @@ static GLubyte *
emit_DrawArrays_header_old( __GLXcontext * gc,
struct array_state_vector * arrays,
size_t * elements_per_request,
- unsigned int * total_requests,
+ size_t * total_requests,
GLenum mode, GLsizei count )
{
size_t command_size;
@@ -640,7 +640,7 @@ emit_DrawArrays_old( GLenum mode, GLint first, GLsizei count )
GLubyte * pc;
size_t elements_per_request;
- unsigned total_requests = 0;
+ size_t total_requests = 0;
unsigned i;
size_t total_sent = 0;
@@ -770,7 +770,7 @@ emit_DrawElements_old( GLenum mode, GLsizei count, GLenum type,
GLubyte * pc;
size_t elements_per_request;
- unsigned total_requests = 0;
+ size_t total_requests = 0;
unsigned i;
unsigned req;