Bug 40554 - r200 falls back to software when clearing FBOs
Summary: r200 falls back to software when clearing FBOs
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/r200 (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: Default DRI bug account
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-01 08:20 UTC by Stefan Dösinger
Modified: 2012-12-05 15:20 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Sample application (2.32 KB, text/x-csrc)
2011-09-01 08:20 UTC, Stefan Dösinger
Details

Description Stefan Dösinger 2011-09-01 08:20:02 UTC
Created attachment 50814 [details]
Sample application

glClear(GL_COLOR_BUFFER_BIT) causes a software fallback when a FBO is bound. The line in the debug output that signals this fallback is

r200Clear: swrast clear, mask: 100

0x100 is BUFFER_BIT_COLOR0 as far as I can see, which is indeed not handled in that function. I have attached a sample application that is a side product of attempting to reproduce bug 40552. The sample doesn't crash(yet), but it reproduces the software fallback.
Comment 1 Roland Scheidegger 2011-09-02 17:21:26 UTC
Hmm I guess at least when using the kernel_mm path (which is just _mesa_meta_Clear) there shouldn't be any swrast fallback. Not quite sure though how well fbos will actually work...
The old kernel clear path is quite a mess anyway (though it has to be said fastzclear was fast...).
Comment 2 Stefan Dösinger 2012-12-03 00:30:40 UTC
This bug appears to have been fixed. I no longer get any software fallback debug output in my sample application, and the performance of Wine with FBOs is too high to suspect that there are any SW fallbacks.
Comment 3 Roland Scheidegger 2012-12-04 18:19:59 UTC
FWIW the relevant commit fixing this bug was de694b6b10b7ce23a00cd7296a955f162704ee62.
Comment 4 Stefan Dösinger 2012-12-05 09:39:55 UTC
Clearing by drawing geometry? Isn't that somewhat inefficient? Doesn't the hardware have a nicer way to deal with this?

It's now also applying ATI_fragment_shader shaders when clearing. I'll send a patch for that.
Comment 5 Roland Scheidegger 2012-12-05 15:20:41 UTC
(In reply to comment #4)
> Clearing by drawing geometry? Isn't that somewhat inefficient? Doesn't the
> hardware have a nicer way to deal with this?
There are two normal methods how you can do ordinary buffer clears on this hw.
1) With the 2d blitter.
2) With the 3d engine (by drawing a tri/quad).
In practice, both should most likely have the same performance, as it should be limited by memory bandwidth. I believe in theory the 2d blitter might be faster for this class of hardware, but IIRC you also get problems with 3d engine caches etc. Also, if you use 2d blit, you need to clear color and depth buffer separately.
For depth/stencil buffer, you could use fast z clears (in some cases - it is tricky, for instance can't clear depth and stencil individually and not with pixel granularity viewport), which just sets a bit per tile saying this block is cleared. All hyperz functionality (which fast z clear is) is however defunct since dri2 (dri1 had it working mostly, was never enabled by default).

> 
> It's now also applying ATI_fragment_shader shaders when clearing. I'll send
> a patch for that.
Hmm yes that sounds wrong.


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.