summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/x11/xm_api.c
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-03-16 11:00:07 -0600
committerBrian <[email protected]>2007-03-16 11:00:07 -0600
commite5070bc3ca75dee31034cc543f3d2ee04e5dc032 (patch)
treec275438e2790d47da063fdccd7a7acbf64a3afd4 /src/mesa/drivers/x11/xm_api.c
parent7573b58db659b32f3589fc955959710d44353239 (diff)
Assorted fixes for dealing with zero-size frame/renderbuffers.
In xmesa_check_and_update_buffer_size() handle xmctx==NULL correctly: still call _mesa_resize_framebufer(). If we don't we can wind up in a situation where the framebuffer size is non-zero but an attached renderbuffer size is still initialized to zero. This inconsistancy can later cause problems. Check for zero-size renderbuffers in update_color_draw_buffers() and update_color_read_buffer(). See bug 7205.
Diffstat (limited to 'src/mesa/drivers/x11/xm_api.c')
-rw-r--r--src/mesa/drivers/x11/xm_api.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
index ba020fc3d6a..b513dc8d40a 100644
--- a/src/mesa/drivers/x11/xm_api.c
+++ b/src/mesa/drivers/x11/xm_api.c
@@ -1842,16 +1842,18 @@ XMesaDestroyBuffer(XMesaBuffer b)
* 1. the first time a buffer is bound to a context.
* 2. from glViewport to poll for window size changes
* 3. from the XMesaResizeBuffers() API function.
+ * Note: it's possible (and legal) for xmctx to be NULL. That can happen
+ * when resizing a buffer when no rendering context is bound.
*/
void
xmesa_check_and_update_buffer_size(XMesaContext xmctx, XMesaBuffer drawBuffer)
{
GLuint width, height;
- xmesa_get_window_size(xmctx->display, drawBuffer, &width, &height);
+ xmesa_get_window_size(drawBuffer->display, drawBuffer, &width, &height);
if (drawBuffer->mesa_buffer.Width != width ||
drawBuffer->mesa_buffer.Height != height) {
- _mesa_resize_framebuffer(&(xmctx->mesa),
- &(drawBuffer->mesa_buffer), width, height);
+ GLcontext *ctx = xmctx ? &xmctx->mesa : NULL;
+ _mesa_resize_framebuffer(ctx, &(drawBuffer->mesa_buffer), width, height);
}
drawBuffer->mesa_buffer.Initialized = GL_TRUE; /* XXX TEMPORARY? */
}
@@ -2175,7 +2177,7 @@ void XMesaSwapBuffers( XMesaBuffer b )
}
#endif
if (b->backxrb->ximage) {
- /* Copy Ximage from host's memory to server's window */
+ /* Copy Ximage (back buf) from client memory to server window */
#if defined(USE_XSHM) && !defined(XFree86Server)
if (b->shm) {
/*_glthread_LOCK_MUTEX(_xmesa_lock);*/
@@ -2197,8 +2199,8 @@ void XMesaSwapBuffers( XMesaBuffer b )
/*_glthread_UNLOCK_MUTEX(_xmesa_lock);*/
}
}
- else {
- /* Copy pixmap to window on server */
+ else if (b->backxrb->pixmap) {
+ /* Copy pixmap (back buf) to window (front buf) on server */
/*_glthread_LOCK_MUTEX(_xmesa_lock);*/
XMesaCopyArea( b->xm_visual->display,
b->backxrb->pixmap, /* source drawable */