Problem summary
---------------
When first logging in to Gnome or Unity from lightdm my external monitors
is set to the wrong resolution. If I run the Displays setting application
or xrandr the screens resolution will be correctly recognized and set
without me typing anything. The desktop background will look messed up, or
be completely black instead.
Hardware
--------
* Dell Precision 5510 laptop
* Nvidia Optimus graphics, with an Quadro M1000M discreet graphics card, and an Intel P530 integrated GPU.
* Dell P2415Q 4k external monitor connected via HDMI.
Video Card configuration
------------------------
* Bumblebee is installed and configured.
Video pacakges installed
------------------------
bbswitch-dkms Interface for toggling the power on NVIDIA Optimus video cards
bumblebee NVIDIA Optimus support for Linux
bumblebee-nvidia NVIDIA Optimus support using the proprietary NVIDIA driver
libcuda1-304 NVIDIA CUDA runtime library
libegl1-mesa:amd64 free implementation of the EGL API -- runtime
libgl1-mesa-dri:amd64 free implementation of the OpenGL API -- DRI modules
libgl1-mesa-dri:i386 free implementation of the OpenGL API -- DRI modules
libgl1-mesa-glx:amd64 free implementation of the OpenGL API -- GLX runtime
libgl1-mesa-glx:i386 free implementation of the OpenGL API -- GLX runtime
libglapi-mesa:amd64 free implementation of the GL API -- shared library
libglapi-mesa:i386 free implementation of the GL API -- shared library
libgles1-mesa:amd64 free implementation of the OpenGL|ES 1.x API -- runtime
libgles2-mesa:amd64 free implementation of the OpenGL|ES 2.x API -- runtime
libglu1-mesa:amd64 Mesa OpenGL utility library (GLU)
libtxc-dxtn-s2tc0:amd64 Texture compression library for Mesa
libtxc-dxtn-s2tc0:i386 Texture compression library for Mesa
libwayland-egl1-mesa:amd64 implementation of the Wayland EGL platform -- runtime
mesa-utils Miscellaneous Mesa GL utilities
mesa-vdpau-drivers:amd64 Mesa VDPAU video acceleration drivers
nvidia-304 NVIDIA legacy binary driver - version 304.131
nvidia-current Transitional package for nvidia-current
nvidia-opencl-icd-304 NVIDIA OpenCL ICD
nvidia-prime Tools to enable NVIDIAs Prime
nvidia-settings Tool for configuring the NVIDIA graphics driver
primus client-side GPU offloading for NVIDIA Optimus
Desktop environment
-------------------
* The issue is present on both Gnome and Unity desktop environments.
Xrandr output before recognizing the monitor
--------------------------------------------
chris ~ xrandr
Screen 0: minimum 8 x 8, current 5200 x 2160, maximum 32767 x 32767
HDMI1 connected primary 1360x768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
1360x768 59.80*+
After running xrandr the first time, the resolution goes back to normal, and I get this
---------------------------------------------------------------------------------------
chris ~ xrandr
Screen 0: minimum 8 x 8, current 7680 x 2160, maximum 32767 x 32767
HDMI1 connected primary 3840x2160+0+0 (normal left inverted right x axis y axis) 527mm x 296mm
3840x2160 29.98*+ 30.00 25.00 24.00 29.97 23.98
2560x1440 59.95
2048x1280 59.99
1920x1080 60.00 60.00 50.00 59.94 30.00 25.00 24.00 29.97 23.98
1920x1080i 60.00 50.00 59.94 50.00
1600x1200 60.00
1600x900 60.00
1280x1024 75.02 60.02
1152x864 75.00
1280x720 60.00 50.00 59.94
1024x768 75.03 60.00
800x600 75.00 60.32
720x576 50.00
720x576i 50.00
720x480 60.00 59.94
720x480i 60.00 59.94
640x480 75.00 60.00 59.94
720x400 70.08