[Intel-gfx] Regression in i965 Mesa driver caused by commit c7c64d97836c71eaf2ee3fc6d384877170b8c844

Simon Farnsworth simon.farnsworth at onelan.com
Tue Jun 22 19:37:46 CEST 2010


Hello Kristian,

Your commit:
commit c7c64d97836c71eaf2ee3fc6d384877170b8c844
Author: Kristian Høgsberg <krh at bitplanet.net>
Date:   Tue Jun 1 14:33:43 2010 -0400

    intel: Fallback to meta if we're asked to CopyTexImage2D from RGB to RGBA
    
    The pixel transfer rules state that we must set alpha to 1.0 in this case
    which we can't easily do with the blitter.  We can do to passes: one that
    sets the alpha to 0xff and one that copies the RGB bits or we can just
    use the 3D engine.  Neither approach seems worth it for this case.

has broken my use of Mesa to snapshot the display using an FBO. In my code, I 
do (where width and height are the size of the screen, snapshot_width and 
snapshot_height are the target size of my snapshot):
    glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 
                          framebuffer_object );
    glBindRenderbufferEXT( GL_RENDERBUFFER_EXT,
                           renderbuffer );
    glRenderbufferStorageEXT( GL_RENDERBUFFER_EXT,
                              GL_RGB8,
                              snapshot_width,
                              snapshot_height );
    glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT,
                                  GL_COLOR_ATTACHMENT0_EXT,
                                  GL_RENDERBUFFER_EXT,
                                  renderbuffer );
    glBindFramebufferEXT( GL_READ_FRAMEBUFFER_EXT,
                          0 );
    glBlitFramebufferEXT( 0, 0,
                          width, height,
                          0, snapshot_height,
                          snapshot_width, 0,
                          GL_COLOR_BUFFER_BIT,
                          GL_LINEAR );
    glBindFramebufferEXT( GL_FRAMEBUFFER_EXT,
                          0 );

to get a snapshot of the current screen contents in my FBO. I then have a 
separate thread (using its own GL context) get the pixel contents of the FBO 
with glReadPixels() and turn it into a PNG file.

With current Mesa master (eb7ef433bbbeabda963e74adf0ef61c47883f292), the 
glBlitFramebufferEXT() call causes my fullscreen application to get stuck - the 
front buffer and back buffer at the time of the glBlitFramebufferEXT() call swap 
back and forth as I call glXSwapBuffers(), but no further changes to screen 
contents occur. The FBO appears to have the correct contents the first time I 
do this, but not on future attempts to snapshot the screen.

git bisect fingered this commit as the cause - reverting just this commit makes 
things work as they used to. Is there a better fix (either to my code or to 
Mesa) that I should work on; I can't glReadPixels() directly from the main 
framebuffer, as (not entirely surprisingly) this causes my rendering thread to 
stall for a short but visible period - and while I can stall the snapshotting 
thread indefinitely, I'm not permitted to stall the rendering thread.

I've tried using both GL_RGBA8 and GL_RGB8 renderbuffers, which hasn't helped - 
but it looks from the code like it's the format of the source buffer (the 
system framebuffer) that matters, not the format of the destination buffer.
-- 
Thanks in advance for any advice you can offer,

Simon Farnsworth



More information about the Intel-gfx mailing list