Secondary display not recognized

In standalone mode, Kodi won’t recognize my secondary HDMI display (TV) unless another user is already logged-in (Gnome session). As a result I see only one HDMI display in the system settings (my VGA computer display) and can’t get any sound from the TV.
The problem appeared after I upgraded from Kodi 16 stable to Kodi 17 beta5.

Process tree:

Code:
kodi   tty5     \_ /usr/libexec/gdm-x-session --run-script kodi-standalone
kodi   tty5          \_ /usr/libexec/Xorg vt5 -displayfd 3 -auth /run/user/1001/gdm/Xauthority -nolisten tcp -background none -no
kodi   tty5          \_ /bin/sh /usr/bin/kodi-standalone
kodi   tty5               \_ /bin/sh /usr/bin/kodi --standalone
kodi   tty5                   \_ /usr/lib64/kodi/kodi.bin --standalone

The kodi.log file mentions:
(note the line about the HDMI2 display)

Code:
15:51:03 T:140529758467136  NOTICE: load settings...
15:51:03 T:140529758467136  NOTICE: Found 1 Lists of Devices
15:51:03 T:140529758467136  NOTICE: Enumerated PULSE devices:
15:51:03 T:140529758467136  NOTICE:     Device 1
15:51:03 T:140529758467136  NOTICE:         m_deviceName      : Default
15:51:03 T:140529758467136  NOTICE:         m_displayName     : Default
15:51:03 T:140529758467136  NOTICE:         m_displayNameExtra: Default Output Device (PULSEAUDIO)
15:51:03 T:140529758467136  NOTICE:         m_deviceType      : AE_DEVTYPE_PCM
15:51:03 T:140529758467136  NOTICE:         m_channels        : FL,FR
15:51:03 T:140529758467136  NOTICE:         m_sampleRates     : 5512,8000,11025,16000,22050,32000,44100,48000,64000,88200,96000,176400,192000,38​4000
15:51:03 T:140529758467136  NOTICE:         m_dataFormats     : AE_FMT_U8,AE_FMT_S16NE,AE_FMT_S24NE3,AE_FMT_S24NE4,AE_FMT_S32NE,AE_FMT_FLOAT
15:51:03 T:140529758467136  NOTICE:         m_streamTypes     : No passthrough capabilities
15:51:03 T:140529758467136  NOTICE:     Device 2
15:51:03 T:140529758467136  NOTICE:         m_deviceName      : alsa_output.pci-0000_00_1b.0.hdmi-stereo
15:51:03 T:140529758467136  NOTICE:         m_displayName     : Built-in Audio Digital Stereo (HDMI)
15:51:03 T:140529758467136  NOTICE:         m_displayNameExtra: HDMI / DisplayPort (PULSEAUDIO)
15:51:03 T:140529758467136  NOTICE:         m_deviceType      : AE_DEVTYPE_PCM
15:51:03 T:140529758467136  NOTICE:         m_channels        : FL,FR
15:51:03 T:140529758467136  NOTICE:         m_sampleRates     : 5512,8000,11025,16000,22050,32000,44100,48000,64000,88200,96000,176400,192000,38​4000
15:51:03 T:140529758467136  NOTICE:         m_dataFormats     : AE_FMT_U8,AE_FMT_S16NE,AE_FMT_S24NE3,AE_FMT_S24NE4,AE_FMT_S32NE,AE_FMT_FLOAT
15:51:03 T:140529758467136  NOTICE:         m_streamTypes     : No passthrough capabilities
[...]
15:51:03 T:140529293993728  NOTICE: PulseAudio: Opened device Default in pcm mode with Buffersize 150 ms
15:51:03 T:140529758467136 WARNING: CXRandR::Query - output HDMI2 has no current mode, assuming disconnected
15:51:03 T:140529758467136  NOTICE: Checking resolution 16
15:51:03 T:140529758467136 WARNING: CWinEventsX11::Init - no input method found
15:51:03 T:140529758467136  NOTICE: Using visual 0x20
15:51:03 T:140529758467136  NOTICE: GL_VENDOR = Intel Open Source Technology Center
15:51:03 T:140529758467136  NOTICE: GL_RENDERER = Mesa DRI Intel(R) Ironlake Desktop
15:51:03 T:140529758467136  NOTICE: GL_VERSION = 2.1 Mesa 12.0.3
15:51:03 T:140529758467136  NOTICE: GL_SHADING_LANGUAGE_VERSION = 1.20
[...]

Some info about my system:

Code:
-----------------------------------------------------------------------
Starting Kodi (17.0-BETA5 Git:20161028-nogitfound). Platform: Linux x86 64-bit
Using Release Kodi x64 build
Kodi compiled Nov  4 2012 by GCC 6.2.0 for Linux x86 64-bit version 4.8.0 (264192)
Running on Fedora 25 (Workstation Edition), kernel: Linux x86 64-bit version 4.8.6-300.fc25.x86_64
FFmpeg version/source: ffmpeg-3.1-kodi
Host CPU: Intel(R) Core(TM) i5 CPU 650 @ 3.20GHz, 4 cores available
-----------------------------------------------------------------------

I made the “kodi-standalone” bash script execute the “xrandr” command before starting Kodi. Here is what I found.

Output of the “xrandr” command when Kodi is the unique opened session:

Code:
Screen 0: minimum 8 x 8, current 1680 x 1050, maximum 32767 x 32767
DP1 disconnected primary (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
HDMI1 connected 1680x1050+0+0 (normal left inverted right x axis y axis) 430mm x 270mm
   1680x1050     59.95*+
   1280x1024     75.02    60.02  
   1280x960      60.00  
   1152x864      75.00  
   1024x768      75.03    70.07    60.00  
   832x624       74.55  
   800x600       72.19    75.00    60.32    56.25  
   640x480       75.00    72.81    66.67    59.94  
   720x400       70.08  
HDMI2 connected (normal left inverted right x axis y axis)
   1920x1080     60.00 +  50.00    59.94    30.00    25.00    24.00    29.97    23.98  
   1920x1080i    60.00    50.00    59.94  
   1280x1024     60.02  
   1360x768      59.80  
   1280x720      60.00    50.00    59.94  
   1024x768      60.00  
   800x600       60.32  
   720x576       50.00  
   720x576i      50.00  
   720x480       60.00    59.94  
   720x480i      60.00    59.94  
   640x480       60.00    59.94  
VGA1 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)

Output of the “xrandr” command when the Kodi session is started while another desktop session is active:
(note the * symbol in front of both monitors)

Code:
Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 32767 x 32767
DP1 disconnected primary (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
HDMI1 connected 1680x1050+0+0 (normal left inverted right x axis y axis) 430mm x 270mm
   1680x1050     59.95*+
   1280x1024     75.02    60.02  
   1280x960      60.00  
   1152x864      75.00  
   1024x768      75.03    70.07    60.00  
   832x624       74.55  
   800x600       72.19    75.00    60.32    56.25  
   640x480       75.00    72.81    66.67    59.94  
   720x400       70.08  
HDMI2 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 640mm x 360mm
   1920x1080     60.00*+  50.00    59.94    30.00    25.00    24.00    29.97    23.98  
   1920x1080i    60.00    50.00    59.94  
   1280x1024     60.02  
   1360x768      59.80  
   1280x720      60.00    50.00    59.94  
   1024x768      60.00  
   800x600       60.32  
   720x576       50.00  
   720x576i      50.00  
   720x480       60.00    59.94  
   720x480i      60.00    59.94  
   640x480       60.00    59.94  
VGA1 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)

Did anyone face a similar issue on Linux and found a workaround?