Certain tests (e.g. piglit's crossbar) crash because they do (possibly 
somewhat weird things) with glReadBuffer().

What happens is this:
- Context gets set up, made current
- Stuff gets rendered
- glReadBuffer() is called to change the read buffer
- glReadPixels() crashes because now ctx->ReadBuffer->_ColorReadBuffer has no 
corresponding buffer object

The issue is that the front buffer's buffer object is never opened. Buffer 
objects for renderbuffers are opened in radeon_update_renderbuffers(), but the 
front buffer buffer object is only opened if we are in single-buffer mode or 
rendering to the front buffer. This just seems incorrect, since clearly *read* 
and *draw* buffer may be different.

On the other hand, there was probably a reason to put this check there in the 
first place, and I would like to understand that reason before blindly 
changing the code. Can somebody enlighten me?

In the meantime, the attached patch fixes the crash for me.

cu,
Nicolai
diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c
index eb0e5b3..009859f 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c
@@ -487,8 +487,7 @@ radeon_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable)
 		struct radeon_renderbuffer *stencil_rb;
 
 		i = 0;
-		if ((radeon->is_front_buffer_rendering || !draw->color_rb[1])
-			&& draw->color_rb[0]) {
+		if (draw->color_rb[0]) {
 			attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
 			attachments[i++] = radeon_bits_per_pixel(draw->color_rb[0]);
 		}
------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to