Re: How to bind X display to graphics hardware?
I finally got a solution with the help of Nvidia support team. Here is a sum up:
Let's assume we have 2 identical Nvidia graphics cards with 3 physical ports for monitors on each card.
Let's assume that we want to use 3 Xscreens or DISPLAYs (as linux environment variable), but physically connect only 1 monitor to one of the graphics cards.
Physically connecting 3 monitors to the Nvidia cards (2 monitors on 1 card and 1 monitor on the other card) and then running the command line `nvidia-xconfig --enable-all-gpus --seperate-x-screens` creates /etx/X11/xorg.conf which gives us 3 monitors working on 3 seperate Xscreens, and therefore 3 seperate DISPLAYs. To check it, on can use the command line `nvidia-settings -q screens -q gpus` which gives :
nvidia-settings -q screens -q gpus
3 X Screens on obelix:0
 obelix:0.0 (Quadro FX 3800)
 obelix:0.1 (Quadro FX 3800)
 obelix:0.2 (Quadro FX 3800)
2 GPUs on obelix:0
 obelix:0[gpu:0] (Quadro FX 3800)
 obelix:0[gpu:1] (Quadro FX 3800)
The DISPLAYs are 0.0, 0.1 and 0.2
Now the problem is that one does NOT want to connect 3 monitors but only 1.
In our use case which is using a software in off-screen rendering mode, a useless black Xwindow is created when the application is launched. Until graphics hardware becomes completely separate from the concept of having an attached display, this situation will remain. But one still can open that useless Xwindow in a dedicated DISPLAY (attached to a specific graphics hardware), without needing to visualise this DISPLAY with a monitor (because the only thing to see is a useless black window). This has also the advantage to isolate the graphical application process in a specific DISPLAY.
In order to do this, reusing the previously generated xorg.conf is not enough. When the X server starts, the Nvidia driver auto-detects if monitors are connected. If they are not, 2 DISPLAYs instead of 3 are created.
The trick consists in modifying the xorg.conf file. More specifically using
Option "ConnectedMonitor" "DFP,DFP"
in "Device0" which in our case corresponds to the one with a physically connected monitor.
This makes the driver act like 2 DFPs (flat LCD screens) are connected to that board.
Note that the "ConnectedMonitor" option overrides any monitors that are actually detected by the board, so if there is a CRT (cathodic tube) connected, setting "DFP,DFP" will cause the CRT to not be driven correctly. Instead it would probably best to use "CRT,CRT".
Please have a look at the final xorg.conf file attached to this post.