summaryrefslogtreecommitdiff
path: root/src/gallium/winsys/xlib/xm_api.c
diff options
context:
space:
mode:
authorIan Romanick <idr@us.ibm.com>2008-03-25 18:07:56 -0700
committerIan Romanick <idr@us.ibm.com>2008-03-25 18:15:58 -0700
commitb09de96a17028c3c936f6a196e048c4f224da89f (patch)
tree756a5d150f77debf6dd9acc8e4c955400925a672 /src/gallium/winsys/xlib/xm_api.c
parent84d8030735844785c3c97679db2bc1892a9c8c70 (diff)
xlib: Add support for MIT-SHM in xlib winsys driver
Gives about a 3% performance increase in gears on x86-64 (non-tiled) and about 10% performance increase in gears on Cell (tiled). I actually expected more of a boost. :(
Diffstat (limited to 'src/gallium/winsys/xlib/xm_api.c')
-rw-r--r--src/gallium/winsys/xlib/xm_api.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/gallium/winsys/xlib/xm_api.c b/src/gallium/winsys/xlib/xm_api.c
index e5fef1d7a8..6b46327e21 100644
--- a/src/gallium/winsys/xlib/xm_api.c
+++ b/src/gallium/winsys/xlib/xm_api.c
@@ -104,12 +104,16 @@ static int host_byte_order( void )
* 1 = shared XImage support available
* 2 = shared Pixmap support available also
*/
-static int check_for_xshm( XMesaDisplay *display )
+int xmesa_check_for_xshm( XMesaDisplay *display )
{
#if defined(USE_XSHM) && !defined(XFree86Server)
int major, minor, ignore;
Bool pixmaps;
+ if (getenv("MESA_NOSHM")) {
+ return 0;
+ }
+
if (XQueryExtension( display, "MIT-SHM", &ignore, &ignore, &ignore )) {
if (XShmQueryVersion( display, &major, &minor, &pixmaps )==True) {
return (pixmaps==True) ? 2 : 1;
@@ -528,7 +532,7 @@ initialize_visual_and_buffer(XMesaVisual v, XMesaBuffer b,
/* Setup for single/double buffering */
if (v->mesa_visual.doubleBufferMode) {
/* Double buffered */
- b->shm = check_for_xshm( v->display );
+ b->shm = xmesa_check_for_xshm( v->display );
}
/* X11 graphics context */
@@ -770,13 +774,16 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
pf = choose_pixel_format(v);
assert(pf);
+ c->xm_visual = v;
+ c->xm_buffer = NULL; /* set later by XMesaMakeCurrent */
+
if (!getenv("XM_AUB")) {
xmesa_mode = XMESA_SOFTPIPE;
pipe = xmesa_create_pipe_context( c, pf );
}
else {
xmesa_mode = XMESA_AUB;
- pipe = xmesa_create_i965simple( xmesa_get_pipe_winsys_aub() );
+ pipe = xmesa_create_i965simple(xmesa_get_pipe_winsys_aub(v));
}
c->st = st_create_context(pipe, &v->mesa_visual,
@@ -800,9 +807,6 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
#endif
/* finish up xmesa context initializations */
- c->xm_visual = v;
- c->xm_buffer = NULL; /* set later by XMesaMakeCurrent */
-
c->st->haveFramebufferSurfaces = GL_TRUE;
return c;