summaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys/xlib/xm_api.c
diff options
context:
space:
mode:
authorBen Skeggs <[email protected]>2008-03-30 19:58:03 +1000
committerBen Skeggs <[email protected]>2008-03-30 19:58:03 +1000
commit03c60e0fb691d39a168a8825ace7150ef3a20e02 (patch)
treee7433c539a7584d29d4a6bf23aacdc348167aed8 /src/gallium/winsys/xlib/xm_api.c
parent68395f6726183a0776e324b900e429449ede2b22 (diff)
parenta52c0416d1f2105960b4646e2e268aed26814689 (diff)
Merge remote branch 'upstream/gallium-0.1' into nouveau-gallium-0.1
Diffstat (limited to 'src/gallium/winsys/xlib/xm_api.c')
-rw-r--r--src/gallium/winsys/xlib/xm_api.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/gallium/winsys/xlib/xm_api.c b/src/gallium/winsys/xlib/xm_api.c
index e5fef1d7a81..a82d3c990e7 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;
@@ -507,6 +511,14 @@ initialize_visual_and_buffer(XMesaVisual v, XMesaBuffer b,
return GL_FALSE;
}
v->mesa_visual.indexBits = 0;
+
+ if (v->BitsPerPixel == 32) {
+ /* We use XImages for all front/back buffers. If an X Window or
+ * X Pixmap is 32bpp, there's no guarantee that the alpha channel
+ * will be preserved. For XImages we're in luck.
+ */
+ v->mesa_visual.alphaBits = 8;
+ }
}
/*
@@ -528,7 +540,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 +782,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 +815,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;