Bug 25377

Summary: Result of rendering to a texture via a framebuffer is not always ready in time
Product: Mesa Reporter: Neil Roberts <nroberts>
Component: Drivers/DRI/i965Assignee: Eric Anholt <eric>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: high    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Test case

Description Neil Roberts 2009-12-01 07:41:04 UTC
Created attachment 31624 [details]
Test case

If you render to a texture using the GL_ARB_framebuffer_object extension and then render something else using that texture immediately then the contents is not always updated in time and some artefacts show.

I think this is the cause of a breakage in tests/conform/test-texture-fbo in Clutter

The attached test case also shows the problem. It renders a red square to one texture and then renders a chain of 15 more FBOs. The texture from the previous FBO is rendered to each subsequent FBO.

If I run this on my i965 with Mesa-7.7 devel then some of the squares are different heights and there is flickering as if sometimes the top pixels are not rendered yet.

If I run with LIBGL_ALWAYS_SOFTWARE then the bug goes away. Or I can put a glFinish after rendering each FBO and this also fixes the problem. There is a '#if 0' in the test to demonstrate this.
Comment 1 Eric Anholt 2009-12-09 11:45:29 UTC
commit 16bdf593f549d3c6e0a987ad640a750024fc77ad
Author: Eric Anholt <eric@anholt.net>
Date:   Wed Dec 9 11:36:45 2009 -0800

    intel: Flush the render/texture cache when finishing render to texture.
    
    Back when we were flushing the entire batch at BindFramebuffer, the kernel
    would notice the domain transition when someone went to texture from it and
    flush for us.  We no longer do the batch flushing every time, so we get to
    do aggressive flushing until we move batchbuffer handling to libdrm.
    
    Fixes piglit fbo-flushing.  Bug #25377.  No noticeable performance loss
    on cairo-gl (so this is better than batch flushing).
Comment 2 Eric Anholt 2009-12-10 14:50:49 UTC
sorry, failed at pushing.  new commit name:

commit 539a14a1dd5a0d277b193d9cd2d06423ed98dc8a
Author: Eric Anholt <eric@anholt.net>
Date:   Wed Dec 9 11:36:45 2009 -0800

    intel: Flush the render/texture cache when finishing render to texture.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.