First of all, after many years I have finally been able to run intel iGPU as a primary display while I can use CUDA or OpenGL on nvidia card. So thanks for that to the developers.
Intel i7 3770 with intel HD 4000 iGPU.
nvidia GTX 960 - 440.59 driver from PPA
Kubuntu Linux 20.04 (beta)
As I had said, I was finally able to use intel iGPU by default and nvidia on demand by following these steps and this xorg.conf configuration:
I have a monitor connected to iGPU via DVI cable. I have another monitor connected to nvidia card via HDMI cable.
Only one consideration before posing the problem. I have GPU Multi Monitor=Enabled configured from the BIOS. But if from “Primary GPU” option I have chosen “PCIe”, then nvidia settings GUI does not show the options related to PRIME. I have to choose from the BIOS as Primary GPU to iGPU so that then nvidia settings GUI shows options related to PRIME. After selecting On Demand from PRIME settings, and having configured xorg.conf as shown in the previous link guide, I can then configure PCIe as primary GPU from the BIOS. That said, surely many users will have PCIe configured as a primary display in the BIOS and will not be able to see PRIME options, which could be problematic for users who do not know how to configure the BIOS.
Now the problem related to multiple monitors.
As I had said. I have connected to iGPU a monitor through DVI cable. I have another monitor connected to nvidia card via HDMI cable. Only the monitor connected to the iGPU via DVI cable is detected and working. Nvidia settings shows something related to the HDMI screen connected to nvidia, but this does not allow you to configure the screens:
This is the output of xrandr:
$ xrandr Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 16384 x 16384 VGA-1 disconnected (normal left inverted right x axis y axis) HDMI-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 475mm x 267mm 1920x1080 60.00*+ 1280x1024 75.02 60.02 1152x864 75.00 1024x768 75.03 60.00 800x600 75.00 60.32 640x480 75.00 59.94 720x400 70.08 HDMI-2 disconnected (normal left inverted right x axis y axis) DP-1 disconnected (normal left inverted right x axis y axis) DP-2 disconnected (normal left inverted right x axis y axis)
It is strange that information related to HDMI monitor is displayed, but only DVI monitor is working.
How can I make HDMI monitor connected to nvidia card work?