Have you set ‘Unredirect Fullscreen Windows’ under gnome 3? I imagine that’s the issue here.
I thought that was a option in compiz. My gnome setup dosn't use that.
GNOME 3 automatically unredirects some full-screen windows. Games (or SDL2) don't set the recently added _NET_WM_BYPASS_COMPOSITOR hint, so we fall back to heuristics: a non-ARGB32 full-screen / monitor-sized window that does 100 full-screen redraws in a row. If that happens, then the window should be unredirected. I'll see if I can test this in TF2, once I manage to get it working.
Has this netwm hint been implemented yet in current SDL2?
No. I wanted to submit a patch to the list, but I haven't been able to get SDL from hg to compile properly. It has some weird linker issues.
I investigated this with the beta of Portal and I can confirm that it does unredirect windows. However, with my crummy Ironlake, it takes around 10 seconds of uninterrupted full-screen display for it to unredirect.
Are you sure that you have the game playing full-screen and that you do not see the same delays with metacity?
How are you confirming an unredirected window? As I (dimly) understand it, mutter/clutter should detect an override redirect attribute on the window, disable the compositor(?), and avoid redirecting the window. This doesn't appear to happen for me on Ubuntu Gnome (gnome 3.6 and 3.8). I need to export CLUTTER_PAINT=disable-clipped-redraws:disable-culling to eliminate tearing if running gnome-shell. i'd assume SDL2 full-screen windows would need _NET_WM_BYPASS_COMPOSITOR and such to make this happen consistently.
I've done some rudimentary benchmarks with Lost Coast:
Gnome fall-back session - 156 fps
Gnome session - 110 fps
Gnome session with clutter variable - 135 fps
This is with vblank disabled for both the driver and the game.
Processor Information:
Vendor: GenuineIntel
Speed: 2393 Mhz
4 logical processors
4 physical processors
HyperThreading: Unsupported
FCMOV: Supported
SSE2: Supported
SSE3: Supported
SSSE3: Supported
SSE4a: Unsupported
SSE41: Unsupported
SSE42: Unsupported
Network Information:
Network Speed:
Operating System Version:
Ubuntu 13.04 (64 bit)
Kernel Name: Linux
Kernel Version: 3.8.0-19-generic
X Server Vendor: The X.Org Foundation
X Server Release: 11303000
X Window Manager: GNOME Shell
Steam Runtime Version: steam-runtime-release-i386_2013-05-08
Video Card:
Driver: NVIDIA Corporation GeForce GTS 250/PCIe/SSE2
Driver Version: 3.3.0 NVIDIA 310.44
Desktop Color Depth: 24 bits per pixel
Monitor Refresh Rate: 59 Hz
VendorID: 0x10de
DeviceID: 0x615
Number of Monitors: 1
Number of Logical Video Cards: 1
Primary Display Resolution: 1680 x 1050
Desktop Resolution: 1680 x 1050
Primary Display Size: 18.66" x 11.65" (21.97" diag)
47.4cm x 29.6cm (55.8cm diag)
Primary Bus: PCI Express 16x
Primary VRAM: 1024 MB
Supported MSAA Modes: 2x 4x 8x 16x
Sound card:
Audio device: AV200
Memory:
RAM: 3888 Mb
Miscellaneous:
UI Language: English
LANG: en_CA.UTF-8
Microphone: Not set
Total Hard Disk Space Available: 447150 Mb
Largest Free Hard Disk Block: 326700 Mb
Installed software:
Recent Failure Reports:
I patched mutter to print out when a window becomes redirected, and ran Portal for a bit. It's possible there's a bug in the X server or in mutter that causes unredirection not to work.
Also, are those numbers with GNOME 3.6 or with 3.8? The workaround that's supposed to detect Source games has only been implemented in 3.8.
I managed to get SDL2 compiled and running and filed a patch at http://bugzilla.libsdl.org/show_bug.cgi?id=1852 .
Nice! Numbers are from Gnome 3.6. I'd had 3.8 installed via a testing repo, but downgraded.
Check again with GNOME 3.8. Both the heuristic and hint are only implemented there.
Three runs of Lost Coast with no demanding processes:
Gnome 3.8.1 - 156 fps
Openbox 3.5.x - 156 fps
It also seems I no longer need the clutter environment variable. I'd have sworn the compositor-related tearing was present under both 3.6 and 3.8. Either I missed something, or updates have fixed the issue.
Good to know it's fixed in GNOME 3.8.
Seems I hadn't missed anything. I'm now back to reduced fps and tearing resulting from what I assume is mutter/clutter redirecting the window.
Under 3.8? Have you waited for 10 or so seconds of the window being full-screen to be unredirected?
Yes, 3.8 and multiple changes to try to track what was happening. Back to 110 fps in the Loast Coast stress test and tearing identical to [#627](https://github.com/ValveSoftware/Source-1-Games/issues/627)
I've just moved to Nvidia's 313 series driver from 310 and the tearing is gone. However, frame rate is at 132 fps.
Does the Clutter environment variable affect FPS under the new driver?
Indeed, the clutter environment variable puts the frame rate back up toward parity with Openbox (155-ish).
https://git.gnome.org/browse/mutter/commit/?id=90f2a3ae4ca205f7cbbc2daeba2ab7cfa5ed1613 is the relevant change to gnome 3.
The issue has been found and fixed upstream: https://bugzilla.gnome.org/show_bug.cgi?id=701224
Well that bug report explains much of my confusion. Good news!
Or not. The Gnome 3.8.x repo I'm using finally started pushing Gnome 3.8.3 packages, which I assume have the patches mentioned in https://bugzilla.gnome.org/show_bug.cgi?id=701224
I'm still losing ~20 fps under Mutter+Gnome Shell
@nmirthes
It got broken in 3.8.3 again due to another patch. I have fixed it again (fix is in the 3.8 branch but 3.8.4 has not been released yet).
You can apply this mutter patch: https://git.gnome.org/browse/mutter/commit/?h=gnome-3-8&id=7b36dcf4a06bbb69231ab360356c269f9e7ccce8 to fix it.
Closing loose ends, works fine in Arch, Gnome 3.10.
Nothing extracted yet.
I have noticed that the standard Gnome 3 shell (3.6) has a large performance drop on source based games vs the bundled gnome classic. Not sure at which end the problem lies.