After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 618497 - huge performance hit / slowdown when using openGL games on top of the shell
huge performance hit / slowdown when using openGL games on top of the shell
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other Linux
: Normal major
: ---
Assigned To: Owen Taylor
gnome-shell-maint
Depends on: 597014
Blocks:
 
 
Reported: 2010-05-13 01:28 UTC by Jean-François Fortin Tam
Modified: 2011-08-29 22:16 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Make use of mutter's auto_unredirect feature (2.92 KB, patch)
2010-06-11 19:31 UTC, drago01
none Details | Review
Make use of mutter's auto_unredirect feature (3.00 KB, patch)
2010-06-19 11:44 UTC, drago01
needs-work Details | Review
Toggle mutter's unredirect features on/off depending on the situation (3.38 KB, patch)
2011-07-20 20:38 UTC, drago01
none Details | Review
Toggle mutter's unredirect features on/off depending on the situation (3.67 KB, patch)
2011-08-29 21:59 UTC, drago01
needs-work Details | Review
Toggle mutter's unredirect features on/off depending on the situation (2.38 KB, patch)
2011-08-29 22:12 UTC, drago01
none Details | Review
Toggle mutter's unredirect features on/off depending on the situation (2.10 KB, patch)
2011-08-29 22:13 UTC, drago01
none Details | Review
Toggle mutter's unredirect features on/off depending on the situation (1.99 KB, patch)
2011-08-29 22:15 UTC, drago01
committed Details | Review

Description Jean-François Fortin Tam 2010-05-13 01:28:57 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.
Comment 1 drago01 2010-05-13 11:38:02 UTC
(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?
Comment 2 Jean-François Fortin Tam 2010-05-13 23:38:22 UTC
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).
Comment 3 drago01 2010-05-16 09:52:06 UTC
(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).
Comment 4 drago01 2010-06-11 19:31:08 UTC
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.
Comment 5 drago01 2010-06-11 20:32:35 UTC
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
Comment 6 drago01 2010-06-19 11:44:43 UTC
Created attachment 164073 [details] [review]
Make use of mutter's auto_unredirect feature

*) Rebase to master
Comment 7 Johannes Bittner 2011-05-09 18:29:59 UTC
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.
Comment 8 drago01 2011-05-09 18:40:34 UTC
(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.
Comment 9 Jean-François Fortin Tam 2011-05-10 00:35:54 UTC
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.
Comment 10 Johannes Bittner 2011-05-13 20:20:08 UTC
Just tested again, I can't reproduce the performance hit now. Maybe it's a bug not related to this.
Comment 11 drago01 2011-07-20 19:22:33 UTC
Review of attachment 164073 [details] [review]:

Needs to be rebase and adjusted for the new suggested api.
Comment 12 drago01 2011-07-20 20:38:02 UTC
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.
Comment 13 drago01 2011-08-29 21:59:05 UTC
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
Comment 14 Owen Taylor 2011-08-29 22:09:11 UTC
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.
Comment 15 drago01 2011-08-29 22:12:37 UTC
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.
Comment 16 drago01 2011-08-29 22:13:39 UTC
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.
Comment 17 drago01 2011-08-29 22:15:36 UTC
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.
Comment 18 drago01 2011-08-29 22:16:24 UTC
Attachment 195128 [details] pushed as 1dee10c - Toggle mutter's unredirect features on/off depending on the situation