On Friday 15 May 2015, Fredrik Höglund wrote: > On Friday 15 May 2015, Michel Dänzer wrote: > > On 14.05.2015 22:52, fred...@kemper.freedesktop.org (Fredrik HXXglund) > > wrote: > > > > > > URL: > > http://cgit.freedesktop.org/mesa/mesa/commit/?id=6b284f08ab399154ad10e2166440b44cbbdcb2c5 > > > Author: Laura Ekstrand <la...@jlekstrand.net> > > > Date: Tue Feb 3 14:47:00 2015 -0800 > > > > > > main: _mesa_blit_framebuffer updates its arbitrary framebuffers. > > > > > > Previously, we used _mesa_update_state to update the currently bound > > > framebuffers prior to performing a blit. Now that > > > _mesa_blit_framebuffer > > > uses arbitrary framebuffers, _mesa_update_state is not specific > > > enough. > > > > > > Reviewed-by: Fredrik Höglund <fred...@kde.org> > > > Signed-off-by: Fredrik Höglund <fred...@kde.org> > > > > This commit broke the piglit test > > spec@ext_framebuffer_multisample@bitmap with the radeonsi driver: > > > > Probe color at (224,0) > > Left: 0.000000 0.000000 0.000000 1.000000 > > Right: 1.000000 1.000000 1.000000 1.000000 > > > > Looks like it's because the bottom right squares of the Xs are missing, > > see the attached picture. > > > > Any ideas? > > I did notice that failure as well, but when I ran the test manually it > passed for me, leading me to think that it was a spurious failure. > > The output looks exactly the same for me. But the test works by > comparing the left and right halves of the framebuffer, so if the > bottom right squares are missing on both sides, the test should > pass. > > The left side is the test image, and the right side is the reference > image.
Okay, so I've finished analyzing the failure. The glBindFramebuffer() calls that precede the glBlitFramebuffer() call cause _NEW_BUFFERS to be set. This used to result in _mesa_update_state() being called from _mesa_blit_framebuffer(), which in turn would call st_invalidate_state(), which would mark the framebuffer state as invalid. st_BlitFramebuffer() would then call st_validate_state() which would call update_framebuffer_state() which would call st_flush_bitmap_cache(). That call to st_flush_bitmap_cache() is what caused the rendering by the last glBitmap() call to land in the framebuffer. The attached patch fixes the problem by restoring the _mesa_update_state() call. The bug can also be fixed by calling st_flush_bitmap_cache() from st_BlitFramebuffer(). Fredrik
From 9bb1d8faaa0e943292d333ba315c21b96cb4ca4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=B6glund?= <fred...@kde.org> Date: Fri, 15 May 2015 17:35:52 +0200 Subject: [PATCH] mesa: Restore the _mesa_update_state call in _mesa_blit_framebuffer We have to set _NEW_BUFFERS and call _mesa_update_state() to ensure that rendering is flushed to the read framebuffer before the blit. --- src/mesa/main/blit.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/mesa/main/blit.c b/src/mesa/main/blit.c index fac9724..bc01ad7 100644 --- a/src/mesa/main/blit.c +++ b/src/mesa/main/blit.c @@ -161,13 +161,22 @@ _mesa_blit_framebuffer(struct gl_context *ctx, GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); - FLUSH_VERTICES(ctx, 0); + /* We have to set _NEW_BUFFERS to make drivers aware that we're about + * to render to/from a different set of buffers. + */ + FLUSH_VERTICES(ctx, (readFb != ctx->ReadBuffer || + drawFb != ctx->DrawBuffer) ? _NEW_BUFFERS : 0); + + if (ctx->NewState) + _mesa_update_state(ctx); /* Update completeness status of readFb and drawFb. */ - _mesa_update_framebuffer(ctx, readFb, drawFb); + if (readFb != ctx->ReadBuffer || drawFb != ctx->DrawBuffer) + _mesa_update_framebuffer(ctx, readFb, drawFb); /* Make sure drawFb has an initialized bounding box. */ - _mesa_update_draw_buffer_bounds(ctx, drawFb); + if (drawFb != ctx->DrawBuffer) + _mesa_update_draw_buffer_bounds(ctx, drawFb); if (!readFb || !drawFb) { /* This will normally never happen but someday we may want to -- 2.1.4
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev