summaryrefslogtreecommitdiffstats
path: root/src/glx/x11
diff options
context:
space:
mode:
Diffstat (limited to 'src/glx/x11')
-rw-r--r--src/glx/x11/dri_glx.c24
-rw-r--r--src/glx/x11/glxcmds.c3
-rw-r--r--src/glx/x11/glxext.c71
-rw-r--r--src/glx/x11/indirect.c50
-rw-r--r--src/glx/x11/indirect.h2
-rw-r--r--src/glx/x11/indirect_vertex_array.c6
6 files changed, 123 insertions, 33 deletions
diff --git a/src/glx/x11/dri_glx.c b/src/glx/x11/dri_glx.c
index 0875361d0b6..d88ce913644 100644
--- a/src/glx/x11/dri_glx.c
+++ b/src/glx/x11/dri_glx.c
@@ -376,7 +376,7 @@ const char *glXGetDriverConfig (const char *driverName) {
}
-/* This function isn't currently used.
+/* Called from __glXFreeDisplayPrivate.
*/
static void driDestroyDisplay(Display *dpy, void *private)
{
@@ -386,8 +386,26 @@ static void driDestroyDisplay(Display *dpy, void *private)
const int numScreens = ScreenCount(dpy);
int i;
for (i = 0; i < numScreens; i++) {
- if (pdpyp->libraryHandles[i])
- dlclose(pdpyp->libraryHandles[i]);
+ if (pdpyp->libraryHandles[i]) {
+ __DRIdriver *driver, *prev;
+
+ /* Remove driver from Drivers list */
+ for (prev = NULL, driver = Drivers; driver;
+ prev = driver, driver = driver->next) {
+ if (driver->handle == pdpyp->libraryHandles[i]) {
+ if (prev)
+ prev->next = driver->next;
+ else
+ Drivers = driver->next;
+
+ Xfree(driver->name);
+ Xfree(driver);
+ break;
+ }
+ }
+
+ dlclose(pdpyp->libraryHandles[i]);
+ }
}
Xfree(pdpyp->libraryHandles);
Xfree(pdpyp);
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..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,
};
diff --git a/src/glx/x11/indirect.c b/src/glx/x11/indirect.c
index b5c306c562d..87c523383b5 100644
--- a/src/glx/x11/indirect.c
+++ b/src/glx/x11/indirect.c
@@ -474,7 +474,7 @@ __indirect_glBegin(GLenum mode)
void
__indirect_glBitmap(GLsizei width, GLsizei height, GLfloat xorig,
GLfloat yorig, GLfloat xmove, GLfloat ymove,
- const GLubyte * bitmap)
+ const GLubyte *bitmap)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint compsize =
@@ -541,7 +541,7 @@ __indirect_glColor3b(GLbyte red, GLbyte green, GLbyte blue)
#define X_GLrop_Color3bv 6
void
-__indirect_glColor3bv(const GLbyte * v)
+__indirect_glColor3bv(const GLbyte *v)
{
generic_3_byte(X_GLrop_Color3bv, v);
}
@@ -656,7 +656,7 @@ __indirect_glColor3ub(GLubyte red, GLubyte green, GLubyte blue)
#define X_GLrop_Color3ubv 11
void
-__indirect_glColor3ubv(const GLubyte * v)
+__indirect_glColor3ubv(const GLubyte *v)
{
generic_3_byte(X_GLrop_Color3ubv, v);
}
@@ -726,7 +726,7 @@ __indirect_glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha)
#define X_GLrop_Color4bv 14
void
-__indirect_glColor4bv(const GLbyte * v)
+__indirect_glColor4bv(const GLbyte *v)
{
generic_4_byte(X_GLrop_Color4bv, v);
}
@@ -847,7 +847,7 @@ __indirect_glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
#define X_GLrop_Color4ubv 19
void
-__indirect_glColor4ubv(const GLubyte * v)
+__indirect_glColor4ubv(const GLubyte *v)
{
generic_4_byte(X_GLrop_Color4ubv, v);
}
@@ -1051,7 +1051,7 @@ __indirect_glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz)
#define X_GLrop_Normal3bv 28
void
-__indirect_glNormal3bv(const GLbyte * v)
+__indirect_glNormal3bv(const GLbyte *v)
{
generic_3_byte(X_GLrop_Normal3bv, v);
}
@@ -2584,7 +2584,7 @@ __indirect_glPolygonMode(GLenum face, GLenum mode)
#define X_GLrop_PolygonStipple 102
void
-__indirect_glPolygonStipple(const GLubyte * mask)
+__indirect_glPolygonStipple(const GLubyte *mask)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint compsize =
@@ -4207,7 +4207,7 @@ __indirect_glGetPixelMapusv(GLenum map, GLushort * values)
#define X_GLsop_GetPolygonStipple 128
void
-__indirect_glGetPolygonStipple(GLubyte * mask)
+__indirect_glGetPolygonStipple(GLubyte *mask)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const __GLXattribute *const state = gc->client_state_private;
@@ -4977,7 +4977,7 @@ __indirect_glIndexub(GLubyte c)
#define X_GLrop_Indexubv 194
void
-__indirect_glIndexubv(const GLubyte * c)
+__indirect_glIndexubv(const GLubyte *c)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 8;
@@ -7935,7 +7935,7 @@ __indirect_glVertexAttrib3svARB(GLuint index, const GLshort * v)
#define X_GLrop_VertexAttrib4NbvARB 4235
void
-__indirect_glVertexAttrib4NbvARB(GLuint index, const GLbyte * v)
+__indirect_glVertexAttrib4NbvARB(GLuint index, const GLbyte *v)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 12;
@@ -7999,7 +7999,7 @@ __indirect_glVertexAttrib4NubARB(GLuint index, GLubyte x, GLubyte y,
#define X_GLrop_VertexAttrib4NubvARB 4201
void
-__indirect_glVertexAttrib4NubvARB(GLuint index, const GLubyte * v)
+__indirect_glVertexAttrib4NubvARB(GLuint index, const GLubyte *v)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 12;
@@ -8044,7 +8044,7 @@ __indirect_glVertexAttrib4NusvARB(GLuint index, const GLushort * v)
#define X_GLrop_VertexAttrib4bvARB 4230
void
-__indirect_glVertexAttrib4bvARB(GLuint index, const GLbyte * v)
+__indirect_glVertexAttrib4bvARB(GLuint index, const GLbyte *v)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 12;
@@ -8176,7 +8176,7 @@ __indirect_glVertexAttrib4svARB(GLuint index, const GLshort * v)
#define X_GLrop_VertexAttrib4ubvARB 4232
void
-__indirect_glVertexAttrib4ubvARB(GLuint index, const GLubyte * v)
+__indirect_glVertexAttrib4ubvARB(GLuint index, const GLubyte *v)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 12;
@@ -8556,7 +8556,7 @@ __indirect_glSecondaryColor3bEXT(GLbyte red, GLbyte green, GLbyte blue)
#define X_GLrop_SecondaryColor3bvEXT 4126
void
-__indirect_glSecondaryColor3bvEXT(const GLbyte * v)
+__indirect_glSecondaryColor3bvEXT(const GLbyte *v)
{
generic_3_byte(X_GLrop_SecondaryColor3bvEXT, v);
}
@@ -8671,7 +8671,7 @@ __indirect_glSecondaryColor3ubEXT(GLubyte red, GLubyte green, GLubyte blue)
#define X_GLrop_SecondaryColor3ubvEXT 4131
void
-__indirect_glSecondaryColor3ubvEXT(const GLubyte * v)
+__indirect_glSecondaryColor3ubvEXT(const GLubyte *v)
{
generic_3_byte(X_GLrop_SecondaryColor3ubvEXT, v);
}
@@ -8943,7 +8943,7 @@ __indirect_glGetProgramParameterfvNV(GLenum target, GLuint index,
#define X_GLvop_GetProgramStringNV 1299
void
-__indirect_glGetProgramStringNV(GLuint id, GLenum pname, GLubyte * program)
+__indirect_glGetProgramStringNV(GLuint id, GLenum pname, GLubyte *program)
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
@@ -9087,7 +9087,7 @@ __indirect_glIsProgramNV(GLuint program)
#define X_GLrop_LoadProgramNV 4183
void
__indirect_glLoadProgramNV(GLenum target, GLuint id, GLsizei len,
- const GLubyte * program)
+ const GLubyte *program)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 16 + __GLX_PAD(len);
@@ -9656,7 +9656,7 @@ __indirect_glVertexAttrib4ubNV(GLuint index, GLubyte x, GLubyte y, GLubyte z,
#define X_GLrop_VertexAttrib4ubvNV 4277
void
-__indirect_glVertexAttrib4ubvNV(GLuint index, const GLubyte * v)
+__indirect_glVertexAttrib4ubvNV(GLuint index, const GLubyte *v)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 12;
@@ -9887,7 +9887,7 @@ __indirect_glVertexAttribs4svNV(GLuint index, GLsizei n, const GLshort * v)
#define X_GLrop_VertexAttribs4ubvNV 4214
void
-__indirect_glVertexAttribs4ubvNV(GLuint index, GLsizei n, const GLubyte * v)
+__indirect_glVertexAttribs4ubvNV(GLuint index, GLsizei n, const GLubyte *v)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 12 + __GLX_PAD((n * 4));
@@ -9951,7 +9951,7 @@ __indirect_glActiveStencilFaceEXT(GLenum face)
#define X_GLvop_GetProgramNamedParameterdvNV 1311
void
__indirect_glGetProgramNamedParameterdvNV(GLuint id, GLsizei len,
- const GLubyte * name,
+ const GLubyte *name,
GLdouble * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
@@ -9975,7 +9975,7 @@ __indirect_glGetProgramNamedParameterdvNV(GLuint id, GLsizei len,
#define X_GLvop_GetProgramNamedParameterfvNV 1310
void
__indirect_glGetProgramNamedParameterfvNV(GLuint id, GLsizei len,
- const GLubyte * name,
+ const GLubyte *name,
GLfloat * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
@@ -9999,7 +9999,7 @@ __indirect_glGetProgramNamedParameterfvNV(GLuint id, GLsizei len,
#define X_GLrop_ProgramNamedParameter4dvNV 4219
void
__indirect_glProgramNamedParameter4dNV(GLuint id, GLsizei len,
- const GLubyte * name, GLdouble x,
+ const GLubyte *name, GLdouble x,
GLdouble y, GLdouble z, GLdouble w)
{
__GLXcontext *const gc = __glXGetCurrentContext();
@@ -10023,7 +10023,7 @@ __indirect_glProgramNamedParameter4dNV(GLuint id, GLsizei len,
#define X_GLrop_ProgramNamedParameter4dvNV 4219
void
__indirect_glProgramNamedParameter4dvNV(GLuint id, GLsizei len,
- const GLubyte * name,
+ const GLubyte *name,
const GLdouble * v)
{
__GLXcontext *const gc = __glXGetCurrentContext();
@@ -10044,7 +10044,7 @@ __indirect_glProgramNamedParameter4dvNV(GLuint id, GLsizei len,
#define X_GLrop_ProgramNamedParameter4fvNV 4218
void
__indirect_glProgramNamedParameter4fNV(GLuint id, GLsizei len,
- const GLubyte * name, GLfloat x,
+ const GLubyte *name, GLfloat x,
GLfloat y, GLfloat z, GLfloat w)
{
__GLXcontext *const gc = __glXGetCurrentContext();
@@ -10068,7 +10068,7 @@ __indirect_glProgramNamedParameter4fNV(GLuint id, GLsizei len,
#define X_GLrop_ProgramNamedParameter4fvNV 4218
void
__indirect_glProgramNamedParameter4fvNV(GLuint id, GLsizei len,
- const GLubyte * name,
+ const GLubyte *name,
const GLfloat * v)
{
__GLXcontext *const gc = __glXGetCurrentContext();
diff --git a/src/glx/x11/indirect.h b/src/glx/x11/indirect.h
index e5b1fadf2b9..630062e2335 100644
--- a/src/glx/x11/indirect.h
+++ b/src/glx/x11/indirect.h
@@ -633,7 +633,7 @@ extern HIDDEN void __indirect_glGetProgramParameterfvNV(GLenum target, GLuint in
extern HIDDEN void __indirect_glGetProgramStringNV(GLuint id, GLenum pname, GLubyte * program);
extern HIDDEN void __indirect_glGetProgramivNV(GLuint id, GLenum pname, GLint * params);
extern HIDDEN void __indirect_glGetTrackMatrixivNV(GLenum target, GLuint address, GLenum pname, GLint * params);
-extern HIDDEN void __indirect_glGetVertexAttribPointervNV(GLuint index, GLenum pname, GLvoid ** params);
+extern HIDDEN void __indirect_glGetVertexAttribPointervNV(GLuint index, GLenum pname, GLvoid ** pointer);
extern HIDDEN void __indirect_glGetVertexAttribdvNV(GLuint index, GLenum pname, GLdouble * params);
extern HIDDEN void __indirect_glGetVertexAttribfvNV(GLuint index, GLenum pname, GLfloat * params);
extern HIDDEN void __indirect_glGetVertexAttribivNV(GLuint index, GLenum pname, GLint * params);
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;