In this situation, I only want to have the game be displayed on my left monitor (1920x1200). But when I launch the game at this resolution, it sits the game's display smack in the center of the intersection of the two displays, making me stare straight at the edges of the two monitors. Why? Because my video card thinks I am using one giant monitor and so it sits the game directly in the center according to that resolution. So how do we fix this? Well, one option is to not make the game full screen and just play the game maximized on the screen we want it to display on. But that's hardly a solution. Let's take a look at our X11 config file (/etc/X11/xorg.conf). If you scroll down to section "Screen", you'll see something that looks like the following:
Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
Option "TwinView" "1"
Option "TwinViewXineramaInfoOrder" "DFP-0"
Option "metamodes" "DFP-0: nvidia-auto-select +0+0,DFP-1: nvidia-auto-select +1920+0"
SubSection "Display"
Depth 24
EndSubSection
EndSection
If it looks a little different, don't worry. These settings are usually automatically created when you use NVIDIA X Server Settings or a similar tool to configure your dual monitors. So the settings of interest here is the metamodes. The format for this option is: "metamodes" "resolution of left most monitor, resolution of right most monitor". In my automatically created settings, my left most monitor has been titled DFP-0 and given an automatic resolution at location (0,0), and my right most monitor has been given an automatic resolution at location (1920,0). To solve our problem, we add two new "metamodes":
Option "metamodes" "DFP-0: nvidia-auto-select +0+0,DFP-1: nvidia-auto-select +1920+0;1920x1200,NULL;NULL,1920x1080"
Each semicolon indicates another "metamode". The "1920x1200,NULL" mode is used when a resolution of 1920x1200 is requested, resulting in the left most monitor only being used. The "NULL,1920x1080" mode is used when a resolution of 1920x1080 is request, resulting in the right most monitor only being used. In the case where both of your monitors are the same resolution, there would only be reason to create one extra mode instead of two since only one other type of resolution would ever be requested besides the default.
Now when I launch Trine at 1920x1200, I don't have to stare at the split between my two monitors! Leave a comment if this helps or you have any questions. Happy gaming Linux fans!
Thanks for sharing!
ReplyDeleteExactly what I needed, thanks!
ReplyDeleteI'm trying to get this done but it's not working right now. I'll see any errors i might have and post here, do you usually comment back? Thank you for the post
ReplyDeleteThanks a lot, worked nicely!
ReplyDeleteEasy-peasy. Thanks! Is there way to apply these changes without a full restart of your display manager(lightdm, etc.)?
ReplyDeleteDave, you only need to restart X, so that'll depend on the shortcut in your distribution and setup. I know history that has been Ctrl + Alt + Backspace but I have also seen it as Alt + PrtScn/SysReq + K. The newer version of Xorg has disabled this shortcut to restart by default. It looks like you could restore that functionality as documented here: https://wiki.archlinux.org/index.php/Xorg#Ctrl.2BAlt.2BBackspace_does_not_work
Delete3 stars blog post !
ReplyDeleteThanks to it and the good ranking in google for 'metamodes' 'nvidia' 'linux' 'gaming' keywords, I could finally play non-windowed my game and so, enjoy a high FPS. So cool for Nexuiz :D
It doesn't work for me. I think I'm doing something wrong. My games are still over both screens.
ReplyDeleteThanks - this was helpful. Unfortunately, I needed to do more research since my system doesn't have an xorg.conf file by default.
ReplyDelete