X server crashes when no HDMI is connected with 319.xx drivers

My laptop is an Asus UX51VZ with GT650M on LUbuntu, I know that the HDMI connector is wired to the NVIDIA board.

I managed to setup the 319.23 drivers using an external HDMI Monitor.
From there, I also managed deactivate the HDMI output using xrandr and use the laptop display only, just for proof of concept purposes, and it works !!! ;-)
(BTW I have huge differences of performance when executing glxspheres on HDMI vs laptop internal display, see logs)

However, I can’t get the driver to work when no HDMI output is connected to the laptop.
I uncommented the Option “UseDisplayDevice” “none” line in my xorg.conf but it does not work for me.

Also, I noticed that only if using gdm (with lightdm does not work) it will allow me to send xrandr commands to the X server from a tty (when X is started but nothing shows up)
Example : DISPLAY=:0 sudo xrandr --setprovideroutputsource modesetting NVIDIA-0

I just did a fresh install and now the X server is crashing with a segfault (see attached logs) but at some point after executing xrandr --setprovideroutputsource modesetting NVIDIA-0 I was able to see a new eDP-0 device using xrandr but still the UI will not show up. (see log here https://devtalk.nvidia.com/default/topic/539322/linux/blank-screen-with-319-12-on-optimus-laptop/5/)

I have a feeling it comes from this section of the Xorg.0.log :

(II) NVIDIA(0): Validated MetaModes:
(II) NVIDIA(0): “nvidia-auto-select”
(II) NVIDIA(0): Virtual screen size determined to be 640 x 480
(WW) NVIDIA(0): Unable to get display device for DPI computation.
(==) NVIDIA(0): DPI set to (75, 75); computed from built-in default

which sets the size of the screen to 640x480 by default and then higher resolutions are not supported.
I tried many options in xorg like Metamodes, UseEdid, ConnectedMonitor, but did not work either.

Thanks for your help!
nvidia-bug-report.log.gz (83.7 KB)
glxspheres_hdmi_only.log (682 Bytes)
glxspheres_laptop_only.log (706 Bytes)
Xorg.0.hdmi_connected.log (46.4 KB)
Xorg.0.laptop_only.log (31.1 KB)
xorg.conf.txt (665 Bytes)

I was finally able to make it working thanks to this thread : https://devtalk.nvidia.com/default/topic/542119/linux/optimus-laptop-319-12-screen-1-deleted-because-of-no-matching-config-section/

Switched to intel driver and enabled autologin in lightdm using :
sudo /usr/lib/lightdm/lightdm-set-defaults --autologin

A big thanks to @pogopuschel again !!!