GNOME Bugzilla – Bug 618497
huge performance hit / slowdown when using openGL games on top of the shell
Last modified: 2011-08-29 22:16:27 UTC
Comparing a Compiz-enabled GNOME vs the GNOME Shell (git version from 2010 05 12), there is a massive slowdown for games. My test is simply running Urban Terror as a spectator. My hardware is a RadeonHD 2600 (running the open source r600 driver) on a Core2Quad machine with 4 GB of RAM. Results: - with Compiz, urban terror hovers between 45 and 70 frames per second - with GNOME Shell, it hovers between 25 and 35 fps If I recall/understand correctly, Compiz "detects" that you are trying to run games or 3D-intensive stuff on top of it and somehow solves this problem (no noticeable performance hit). The Shell should be able to do something like this, if you want to cater to the 3D-intensive user base -- be it hardcore or occasional gamers, users of Google Earth, Stellarium, Blender, etc.
(In reply to comment #0) > Comparing a Compiz-enabled GNOME vs the GNOME Shell (git version from 2010 05 > 12), there is a massive slowdown for games. > > My test is simply running Urban Terror as a spectator. My hardware is a > RadeonHD 2600 (running the open source r600 driver) on a Core2Quad machine with > 4 GB of RAM. > > Results: > - with Compiz, urban terror hovers between 45 and 70 frames per second > - with GNOME Shell, it hovers between 25 and 35 fps > > If I recall/understand correctly, Compiz "detects" that you are trying to run > games or 3D-intensive stuff on top of it and somehow solves this problem (no > noticeable performance hit). compiz does unredirect fullscreen windows but this is not enabled by default. (This removes overhead for fullscreen windows but does not help with windowed apps). Does setting CLUTTER_VBLANK=none before starting the shell improve your Urban terror performance? If yes what numbers do you get when running with this option?
Nope, it doesn't seem to have any impact on UrT performance (on today's tests, I had between about 20-22 fps, in both tests).
(In reply to comment #2) > Nope, it doesn't seem to have any impact on UrT performance (on today's tests, > I had between about 20-22 fps, in both tests). OK, thanks for testing. This https://bugzilla.gnome.org/show_bug.cgi?id=597014 should address the issue for you (assuming you run the game in fullscreen).
Created attachment 163413 [details] [review] Make use of mutter's auto_unredirect feature Currently unconditionally redirect every window which causes apps like games to take a rather big performance hit. Add an accessor to mutter's auto_unredirect feature which uses an heuristic to detect such apps and unredirect them, resulting into a significant performance boost. Disable the feature when recording a screencast, because unredirected windows cannot be recorded.
As for windowed opengl apps, we obviously can't do that but we can minimize the overhead buy only redrawing the changed parts see: http://bugzilla.openedhand.com/show_bug.cgi?id=2136
Created attachment 164073 [details] [review] Make use of mutter's auto_unredirect feature *) Rebase to master
Should this be fixed in current gnome shell? I didn't run a benchmark, but subjetively I still notice a performance hit when playing games (gnome-shell 3.0.1, with nvidia drivers). A game which ran slowly for example was Amnesia.
(In reply to comment #7) > Should this be fixed in current gnome shell? No, even though general performance should have improved since when I wrote those patches.
FWIW, I tested again a few days ago in Fedora 15 and could not see a performance impact as huge as what I initially reported (maybe there still is one, but I couldn't quite measure it with my fuzzy fps counter). I guess that if there are significant optimizations left to do however, we should keep this bug report open.
Just tested again, I can't reproduce the performance hit now. Maybe it's a bug not related to this.
Review of attachment 164073 [details] [review]: Needs to be rebase and adjusted for the new suggested api.
Created attachment 192335 [details] [review] Toggle mutter's unredirect features on/off depending on the situation We disable it when in the overview or when recording a video and otherwise leave it enabled. This patch adds shell_global_disable_unredirect and shell_global_enable_unredirect to allow toggling the state from JS.
Created attachment 195121 [details] [review] Toggle mutter's unredirect features on/off depending on the situation We disable it when in the overview or when recording a video and otherwise leave it enabled. This patch adds shell_global_disable_unredirect and shell_global_enable_unredirect to allow toggling the state from JS. -- Rebased
Review of attachment 195121 [details] [review]: On IRC I mentioned that the ShellGlobal wrapper didnt' seem necessary, beyond that: ::: js/ui/overview.js @@ +555,3 @@ + + // Disable unredirection while in the overview + global.disable_unredirect(); I'd like to see this in _animateVisible - just keep it grouped with the calls: global.window_group.hide(); this._group.show(); in both _animateVisible and correspondingly in _hideDone and then it has to be correct even in the cases where the overview key gets hit multiple times, etc.
Created attachment 195126 [details] [review] Toggle mutter's unredirect features on/off depending on the situation We disable it when in the overview or when recording a video and otherwise leave it enabled. This patch adds shell_global_disable_unredirect and shell_global_enable_unredirect to allow toggling the state from JS.
Created attachment 195127 [details] [review] Toggle mutter's unredirect features on/off depending on the situation We disable it when in the overview or when recording a video and otherwise leave it enabled. This patch adds shell_global_disable_unredirect and shell_global_enable_unredirect to allow toggling the state from JS.
Created attachment 195128 [details] [review] Toggle mutter's unredirect features on/off depending on the situation We disable it when in the overview or when recording a video and otherwise leave it enabled.
Attachment 195128 [details] pushed as 1dee10c - Toggle mutter's unredirect features on/off depending on the situation