diff options
author | Keith Whitwell <[email protected]> | 2007-01-16 11:22:57 +0000 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2007-01-16 11:22:57 +0000 |
commit | 6a3fdc3a1ea6c306d9543791bf172dd1052d7382 (patch) | |
tree | c372c6daff13e435e79914c2e40dfe9d370c337b /src/glx | |
parent | 0b412f8f156b46b0e7220a2b61e0f41781769f66 (diff) | |
parent | a03fc8277180e2171519165a724849e2254ef0b7 (diff) |
Merge branch 'master' of git+ssh://[email protected]/git/mesa/mesa into vbo-0.2
Conflicts:
src/mesa/array_cache/sources
src/mesa/drivers/dri/i965/brw_context.c
src/mesa/drivers/dri/i965/brw_draw.c
src/mesa/drivers/dri/i965/brw_fallback.c
src/mesa/drivers/dri/i965/brw_vs_emit.c
src/mesa/drivers/dri/i965/brw_vs_tnl.c
src/mesa/drivers/dri/mach64/mach64_context.c
src/mesa/main/extensions.c
src/mesa/main/getstring.c
src/mesa/tnl/sources
src/mesa/tnl/t_save_api.c
src/mesa/tnl/t_save_playback.c
src/mesa/tnl/t_vtx_api.c
src/mesa/tnl/t_vtx_exec.c
src/mesa/vbo/vbo_attrib.h
src/mesa/vbo/vbo_exec_api.c
src/mesa/vbo/vbo_save_api.c
src/mesa/vbo/vbo_save_draw.c
Diffstat (limited to 'src/glx')
-rw-r--r-- | src/glx/mini/miniglx.c | 16 | ||||
-rw-r--r-- | src/glx/x11/.gitignore | 1 | ||||
-rw-r--r-- | src/glx/x11/XF86dri.c | 4 | ||||
-rw-r--r-- | src/glx/x11/glxcmds.c | 3 | ||||
-rw-r--r-- | src/glx/x11/glxext.c | 128 | ||||
-rw-r--r-- | src/glx/x11/indirect.c | 2 | ||||
-rw-r--r-- | src/glx/x11/indirect_vertex_array.c | 12 |
7 files changed, 91 insertions, 75 deletions
diff --git a/src/glx/mini/miniglx.c b/src/glx/mini/miniglx.c index d4b29508632..ce45d374646 100644 --- a/src/glx/mini/miniglx.c +++ b/src/glx/mini/miniglx.c @@ -2310,7 +2310,9 @@ __glXGetDrawableInfo(__DRInativeDisplay *dpy, int scrn, GLXDrawable drawable = (GLXDrawable) draw; drm_clip_rect_t * cliprect; Display* display = (Display*)dpy; + __DRIscreenPrivate *psp = display->driScreen.private; __DRIcontextPrivate *pcp = (__DRIcontextPrivate *)CurrentContext->driContext.private; + __DRIdrawablePrivate *pdp = pcp->driDrawablePriv; if (drawable == 0) { return GL_FALSE; } @@ -2325,6 +2327,7 @@ __glXGetDrawableInfo(__DRInativeDisplay *dpy, int scrn, *index = display->clientID; *stamp = pcp->driScreenPriv->pSAREA->drawableTable[display->clientID].stamp; + drmUpdateDrawableInfo(psp->fd, pdp->hHWDrawable, DRM_DRAWABLE_CLIPRECTS, 1, cliprect); *x = drawable->x; *y = drawable->y; *width = drawable->w; @@ -2352,14 +2355,23 @@ static GLboolean xf86DRI_CreateDrawable(__DRInativeDisplay *dpy, int screen, __DRIid drawable, drm_drawable_t *hHWDrawable ) { - return GL_TRUE; + + Display *display = (Display *)dpy; + __DRIscreenPrivate *psp = display->driScreen.private; + int ret; + ret = drmCreateDrawable(psp->fd, hHWDrawable); + + fprintf(stderr, "drawable is %d %08X ret is %d\n", *hHWDrawable, drawable, -ret); + if (ret != 0) + return GL_FALSE; + return GL_TRUE; } static GLboolean xf86DRI_DestroyDrawable(__DRInativeDisplay *dpy, int screen, __DRIid drawable) { - return GL_TRUE; + return GL_TRUE; } diff --git a/src/glx/x11/.gitignore b/src/glx/x11/.gitignore new file mode 100644 index 00000000000..ffc14ab7660 --- /dev/null +++ b/src/glx/x11/.gitignore @@ -0,0 +1 @@ +glcontextmodes.c diff --git a/src/glx/x11/XF86dri.c b/src/glx/x11/XF86dri.c index 0ce588276be..8909a047721 100644 --- a/src/glx/x11/XF86dri.c +++ b/src/glx/x11/XF86dri.c @@ -203,7 +203,7 @@ PUBLIC Bool XF86DRIOpenConnection(dpy, screen, hSAREA, busIdString) *hSAREA = rep.hSAREALow; if (sizeof(drm_handle_t) == 8) { - const int shift = 32; /* var to prevent warning on next line */ + int shift = 32; /* var to prevent warning on next line */ *hSAREA |= ((drm_handle_t) rep.hSAREAHigh) << shift; } @@ -566,7 +566,7 @@ PUBLIC Bool XF86DRIGetDeviceInfo(dpy, screen, hFrameBuffer, *hFrameBuffer = rep.hFrameBufferLow; if (sizeof(drm_handle_t) == 8) { - const int shift = 32; /* var to prevent warning on next line */ + int shift = 32; /* var to prevent warning on next line */ *hFrameBuffer |= ((drm_handle_t) rep.hFrameBufferHigh) << shift; } 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 bad09ce4ccf..7f3857360d0 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); + XDamageAdd(dpy, drawable, region); + XFixesDestroyRegion(dpy, region); +#endif +} /** * Table of functions exported by the loader to the driver. @@ -720,70 +784,10 @@ static const __DRIinterfaceMethods interface_methods = { __glXGetUST, __glXGetMscRateOML, -}; - -#define DRM_MAX_FDS 16 -static struct { - char *BusID; - int fd; - int refcount; -} connection[DRM_MAX_FDS]; - -static int nr_fds = 0; -int drmOpenOnce(void *unused, - const char *BusID, - int *newlyopened) -{ - int i; - int fd; - - for (i = 0; i < nr_fds; i++) - if (strcmp(BusID, connection[i].BusID) == 0) { - connection[i].refcount++; - *newlyopened = 0; - return connection[i].fd; - } - - fd = drmOpen(unused, BusID); - if (fd <= 0 || nr_fds == DRM_MAX_FDS) - return fd; - - connection[nr_fds].BusID = strdup(BusID); - connection[nr_fds].fd = fd; - connection[nr_fds].refcount = 1; - *newlyopened = 1; - - if (0) - fprintf(stderr, "saved connection %d for %s %d\n", - nr_fds, connection[nr_fds].BusID, - strcmp(BusID, connection[nr_fds].BusID)); - - nr_fds++; - - return fd; -} + __glXReportDamage, +}; -void drmCloseOnce(int fd) -{ - int i; - - - - for (i = 0; i < nr_fds; i++) { - if (fd == connection[i].fd) { - if (--connection[i].refcount == 0) { - drmClose(connection[i].fd); - free(connection[i].BusID); - - if (i < --nr_fds) - connection[i] = connection[nr_fds]; - - return; - } - } - } -} /** diff --git a/src/glx/x11/indirect.c b/src/glx/x11/indirect.c index b62f2a3a174..b5c306c562d 100644 --- a/src/glx/x11/indirect.c +++ b/src/glx/x11/indirect.c @@ -31,8 +31,8 @@ #include "glxclient.h" #include "indirect_size.h" #include "dispatch.h" -#include "glthread.h" #include "glapi.h" +#include "glthread.h" #include <GL/glxproto.h> #ifdef USE_XCB #include <X11/Xlib-xcb.h> diff --git a/src/glx/x11/indirect_vertex_array.c b/src/glx/x11/indirect_vertex_array.c index 5a5cd6697ea..1855547dced 100644 --- a/src/glx/x11/indirect_vertex_array.c +++ b/src/glx/x11/indirect_vertex_array.c @@ -123,10 +123,8 @@ __glXInitVertexArrayState( __GLXcontext * gc ) struct array_state_vector * arrays; unsigned array_count; - unsigned texture_units = 1; - unsigned i; - unsigned j; - unsigned vertex_program_attribs = 0; + int texture_units = 1, vertex_program_attribs = 0; + unsigned i, j; GLboolean got_fog = GL_FALSE; GLboolean got_secondary_color = GL_FALSE; @@ -529,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; @@ -642,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; @@ -772,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; |