Bug 27297

Summary: [r300g] xscreensaver "endgame" hack runs much slower than under classic Mesa.
Product: Mesa Reporter: Chris Rankin <rankincj>
Component: Drivers/DRI/r300Assignee: Corbin Simpson <MostAwesomedude>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: medium    
Version: git   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Chris Rankin 2010-03-24 15:34:16 UTC
Using Mesa from git and Radeon 9550 (RV350). Under "classic" Mesa, the "endgame" OpenGL hack from xscreensaver runs at between 15 fps and 20 fps. However, it only runs at between 3 fps and 5 fps under Gallium. The CPU load under Gallium is considerably higher too.
Comment 1 Chris Rankin 2010-03-24 18:57:47 UTC
This is with vanilla Linux 2.6.33.1, libdrm-2.4.18 and xf86-drv-ati from git.
Comment 2 Chris Rankin 2010-03-25 06:48:20 UTC
The glschool screensaver behaves similarly (when invoked from the command line as a standalone application):

Classic Mesa: Load ~40% and ~30 fps
Gallium:      Load ~50% and ~25 fps

This screensaver is in package xscreensaver-gl-extras-5.10-6.1.fc12.1.i686
Comment 3 Corbin Simpson 2010-03-26 05:50:57 UTC
Hm. It hits the immediate drawing path a lot. Changing the immd threshold from 10 to 6 fixes the colors, but slows down rendering even more. This probably warrants further examination.
Comment 4 Corbin Simpson 2010-03-27 14:20:01 UTC
Renaming for easier finding.

Profile shows nothing out of the ordinary. We must be making bad decisions somewhere else along the line.
Comment 5 Marek Olšák 2010-03-27 15:21:48 UTC
FWIW there are several software fallbacks buried in st/mesa which can't be resolved in the driver. One of them is glCopyTexImage for formats other than GL_RGBA and GL_RGB, and when the source and destination format don't match. Also, glean/depthStencil fallbacks to software too.
Comment 6 Chris Rankin 2010-04-26 13:44:49 UTC
With a fresh 2.6.33.3 kernel and xorg-xf86-drv-ati from git, I now get:

Classic Mesa: 14 - 20 fps (>= 60% load)
Gallium:       2 - 4.5 fps (> 90% load)

The screensaver package has moved on to xscreensaver-gl-extras-5.11-1.fc12.i686
Comment 7 Marek Olšák 2010-06-21 21:57:32 UTC
Some news. Endgame uses immediate mode for rendering tens of thousands of triangles, which is always slow. r300g happens to suffer more because it hits the hardware immediate mode path pretty much all the time.

st/mesa seems to call draw_arrays once for each triangle, which is totally crazy.
Comment 8 Marek Olšák 2010-06-21 23:12:56 UTC
More news. For each model, the screensaver stores each triangle in a separate display list. When rendering, it calls all display lists in a for loop. Mesa is not (and won't be) optimized for such a retarded OpenGL usage. Closing.
Comment 9 Chris Rankin 2010-06-22 00:50:32 UTC
(In reply to comment #8)
> Mesa is not (and won't be) optimized for such a retarded OpenGL usage.

OK, but I'm currently more worried about bug 28656 ;-). This screensaver may be inefficient, but it still shouldn't crash.

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.