Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 159216 Details for
Bug 220629
GLcore segfault in xmesa_check_and_update_buffer_size
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Patch for Mesa fixing the null-context bug
mesa-6.5.2-zerosize.patch (text/plain), 7.33 KB, created by
Ian Collier
on 2007-07-13 17:23:54 UTC
(
hide
)
Description:
Patch for Mesa fixing the null-context bug
Filename:
MIME Type:
Creator:
Ian Collier
Created:
2007-07-13 17:23:54 UTC
Size:
7.33 KB
patch
obsolete
>Assorted fixes for dealing with zero-size frame/renderbuffers. > >This is a backport of: http://gitweb.freedesktop.org/?p=mesa/mesa.git;a=commitdiff;h=e5070bc3ca75dee31034cc543f3d2ee04e5dc032 > >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(). > >--- Mesa-6.5.2/src/mesa/drivers/x11/xm_api.c.orig 2006-10-17 21:40:38.000000000 +0100 >+++ Mesa-6.5.2/src/mesa/drivers/x11/xm_api.c 2007-07-13 17:42:17.000000000 +0100 >@@ -1879,16 +1879,18 @@ > * 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? */ > } >@@ -2212,7 +2214,7 @@ > } > #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);*/ >@@ -2234,8 +2236,8 @@ > /*_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 */ >--- Mesa-6.5.2/src/mesa/drivers/x11/xm_buffer.c.orig 2006-10-16 17:40:14.000000000 +0100 >+++ Mesa-6.5.2/src/mesa/drivers/x11/xm_buffer.c 2007-07-13 17:42:17.000000000 +0100 >@@ -167,9 +167,6 @@ > static void > alloc_back_buffer(XMesaBuffer b, GLuint width, GLuint height) > { >- if (width == 0 || height == 0) >- return; >- > if (b->db_mode == BACK_XIMAGE) { > /* Deallocate the old backxrb->ximage, if any */ > if (b->backxrb->ximage) { >@@ -185,6 +182,9 @@ > b->backxrb->ximage = NULL; > } > >+ if (width == 0 || height == 0) >+ return; >+ > /* Allocate new back buffer */ > #ifdef XFree86Server > /* Allocate a regular XImage for the back buffer. */ >@@ -217,20 +217,20 @@ > b->backxrb->pixmap = None; > } > else if (b->db_mode == BACK_PIXMAP) { >- if (!width) >- width = 1; >- if (!height) >- height = 1; >- > /* Free the old back pixmap */ > if (b->backxrb->pixmap) { >- XMesaFreePixmap(b->xm_visual->display, b->backxrb->pixmap); >+ XMesaFreePixmap(b->xm_visual->display, b->backxrb->pixmap); >+ b->backxrb->pixmap = 0; > } >- /* Allocate new back pixmap */ >- b->backxrb->pixmap = XMesaCreatePixmap(b->xm_visual->display, >- b->frontxrb->drawable, >- width, height, >- GET_VISUAL_DEPTH(b->xm_visual)); >+ >+ if (width > 0 && height > 0) { >+ /* Allocate new back pixmap */ >+ b->backxrb->pixmap = XMesaCreatePixmap(b->xm_visual->display, >+ b->frontxrb->drawable, >+ width, height, >+ GET_VISUAL_DEPTH(b->xm_visual)); >+ } >+ > b->backxrb->ximage = NULL; > } > } >@@ -249,6 +249,7 @@ > > /** > * Reallocate renderbuffer storage for front color buffer. >+ * Called via gl_renderbuffer::AllocStorage() > */ > static GLboolean > xmesa_alloc_front_storage(GLcontext *ctx, struct gl_renderbuffer *rb, >@@ -259,6 +260,7 @@ > /* just clear these to be sure we don't accidentally use them */ > xrb->origin1 = NULL; > xrb->origin2 = NULL; >+ xrb->origin3 = NULL; > xrb->origin4 = NULL; > > /* for the FLIP macro: */ >@@ -274,6 +276,7 @@ > > /** > * Reallocate renderbuffer storage for back color buffer. >+ * Called via gl_renderbuffer::AllocStorage() > */ > static GLboolean > xmesa_alloc_back_storage(GLcontext *ctx, struct gl_renderbuffer *rb, >@@ -308,8 +311,12 @@ > xrb->origin4 = (GLuint *) xrb->ximage->data + xrb->width4 * (height - 1); > } > else { >- /* this assertion will fail if we happend to run out of memory */ >- /*assert(xrb->pixmap);*/ >+ /* out of memory or buffer size is 0 x 0 */ >+ xrb->width1 = xrb->width2 = xrb->width3 = xrb->width4 = 0; >+ xrb->origin1 = NULL; >+ xrb->origin2 = NULL; >+ xrb->origin3 = NULL; >+ xrb->origin4 = NULL; > } > > return GL_TRUE; >--- Mesa-6.5.2/src/mesa/main/framebuffer.c.orig 2006-10-17 18:00:23.000000000 +0100 >+++ Mesa-6.5.2/src/mesa/main/framebuffer.c 2007-07-13 17:43:59.000000000 +0100 >@@ -612,7 +612,7 @@ > const GLuint bufferBit = 1 << i; > if (bufferBit & bufferMask) { > struct gl_renderbuffer *rb = fb->Attachment[i].Renderbuffer; >- if (rb) { >+ if (rb && rb->Width > 0 && rb->Height > 0) { > fb->_ColorDrawBuffers[output][count] = rb; > count++; > } >@@ -635,7 +635,9 @@ > update_color_read_buffer(GLcontext *ctx, struct gl_framebuffer *fb) > { > (void) ctx; >- if (fb->_ColorReadBufferIndex == -1) { >+ if (fb->_ColorReadBufferIndex == -1 || >+ fb->Width == 0 || >+ fb->Height == 0) { > fb->_ColorReadBuffer = NULL; /* legal! */ > } > else { >--- Mesa-6.5.2/src/mesa/main/renderbuffer.c.orig 2006-05-20 16:17:46.000000000 +0100 >+++ Mesa-6.5.2/src/mesa/main/renderbuffer.c 2007-07-13 17:42:17.000000000 +0100 >@@ -1192,18 +1192,22 @@ > ASSERT(rb->PutMonoValues); > > /* free old buffer storage */ >- if (rb->Data) >+ if (rb->Data) { > _mesa_free(rb->Data); >+ rb->Data = NULL; >+ } > >- /* allocate new buffer storage */ >- rb->Data = _mesa_malloc(width * height * pixelSize); >- if (rb->Data == NULL) { >- rb->Width = 0; >- rb->Height = 0; >- _mesa_error(ctx, GL_OUT_OF_MEMORY, >- "software renderbuffer allocation (%d x %d x %d)", >- width, height, pixelSize); >- return GL_FALSE; >+ if (width > 0 && height > 0) { >+ /* allocate new buffer storage */ >+ rb->Data = _mesa_malloc(width * height * pixelSize); >+ if (rb->Data == NULL) { >+ rb->Width = 0; >+ rb->Height = 0; >+ _mesa_error(ctx, GL_OUT_OF_MEMORY, >+ "software renderbuffer allocation (%d x %d x %d)", >+ width, height, pixelSize); >+ return GL_FALSE; >+ } > } > > rb->Width = width;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 220629
:
144298
|
144472
|
144474
|
159076
| 159216