First I want to thank all the developers for their efforts and time. Sadly I have run into some unexpected behavior with the automatic adjusting of the refresh rate. I have collected five different cases with debug logs.
Summary: When playing a video the refresh rate switches like expected. When exiting the full screen mode (back to the main menu) the refresh rate is unchanged, still like expected. However when re-entering full screen video mode the refresh rate changes even though the display is already at a “weight: 0.000” mode.
For all cases I have been testing with FPS_test_1080p23.976_L4.1.mkv from Samples. (wiki)
Kodi version is 2:17.0~git20170210.1529-final-0xenial from official ppa.
Case 1:
Added 23.97606Hz modeline from Xorg_Modelines (wiki) to xorg.conf.
Playing the sample and switching between full screen and main menu yields this:
DEBUG: ------ Window Init (VideoFullScreen.xml) ------
INFO: Loading skin file: VideoFullScreen.xml, load type: KEEP_IN_MEMORY
NOTICE: Display resolution ADJUST : HDMI-0: 1920x1080 @ 23.98Hz (24) (weight: 0.000)
NOTICE: CWinSystemX11::SetFullScreen - calling xrandr
...
DEBUG: ------ Window Init (VideoFullScreen.xml) ------
NOTICE: Display resolution ADJUST : HDMI-0: 1920x1080 @ 23.97Hz (29) (weight: 0.000)
NOTICE: CWinSystemX11::SetFullScreen - calling xrandr
...
DEBUG: ------ Window Init (VideoFullScreen.xml) ------
NOTICE: Display resolution ADJUST : HDMI-0: 1920x1080 @ 23.98Hz (24) (weight: 0.000)
NOTICE: CWinSystemX11::SetFullScreen - calling xrandr
...
DEBUG: ------ Window Init (VideoFullScreen.xml) ------
NOTICE: Display resolution ADJUST : HDMI-0: 1920x1080 @ 23.97Hz (29) (weight: 0.000)
NOTICE: CWinSystemX11::SetFullScreen - calling xrandr
Full debug log: http://pastebin.com/L8nUYi1w
Case 2:
Tried to add a refresh rate override to advancedsettings.xml. This is the result:
NOTICE: Contents of special://profile/advancedsettings.xml are...
<advancedsettings>
<gui>
<algorithmdirtyregions>3</algorithmdirtyregions>
<nofliptimeout>0</nofliptimeout>
</gui>
<video>
<adjustrefreshrate>
<override>
<fps>23.976</fps>
<refresh>23.976</refresh>
</override>
</adjustrefreshrate>
</video>
</advancedsettings>
...
INFO: Loading skin file: VideoFullScreen.xml, load type: KEEP_IN_MEMORY
DEBUG: CVideoPlayer::HandleMessages - player started 2
DEBUG: Found Resolution HDMI-0: 1920x1080 @ 23.98Hz (24) from override of fps 23.976 (fpsmin:23.966 fpsmax:23.986 refreshmin:23.966 refreshmax:23.986)
NOTICE: Display resolution ADJUST : HDMI-0: 1920x1080 @ 23.98Hz (24) (weight: 0.000)
NOTICE: CWinSystemX11::SetFullScreen - calling xrandr
...
DEBUG: ------ Window Init (VideoFullScreen.xml) ------
DEBUG: Found Resolution HDMI-0: 1920x1080 @ 23.97Hz (29) from override of fps 23.976 (fpsmin:23.966 fpsmax:23.986 refreshmin:23.966 refreshmax:23.986)
NOTICE: Display resolution ADJUST : HDMI-0: 1920x1080 @ 23.97Hz (29) (weight: 0.000)
NOTICE: CWinSystemX11::SetFullScreen - calling xrandr
...
DEBUG: ------ Window Init (VideoFullScreen.xml) ------
DEBUG: Found Resolution HDMI-0: 1920x1080 @ 23.98Hz (24) from override of fps 23.976 (fpsmin:23.966 fpsmax:23.986 refreshmin:23.966 refreshmax:23.986)
NOTICE: Display resolution ADJUST : HDMI-0: 1920x1080 @ 23.98Hz (24) (weight: 0.000)
NOTICE: CWinSystemX11::SetFullScreen - calling xrandr
...
DEBUG: ------ Window Init (VideoFullScreen.xml) ------
DEBUG: Found Resolution HDMI-0: 1920x1080 @ 23.97Hz (29) from override of fps 23.976 (fpsmin:23.966 fpsmax:23.986 refreshmin:23.966 refreshmax:23.986)
NOTICE: Display resolution ADJUST : HDMI-0: 1920x1080 @ 23.97Hz (29) (weight: 0.000)
NOTICE: CWinSystemX11::SetFullScreen - calling xrandr
Full debug log: http://pastebin.com/5sHAEkU7
Case 3:
Tried to adjust the override rule, only respected every other full screen toggle:
16:31:39.414 T:140348206086464 NOTICE: Contents of special://profile/advancedsettings.xml are...
<advancedsettings>
<gui>
<algorithmdirtyregions>3</algorithmdirtyregions>
<nofliptimeout>0</nofliptimeout>
</gui>
<video>
<adjustrefreshrate>
<override>
<fps>23.976</fps>
<refresh>23.981</refresh>
</override>
</adjustrefreshrate>
</video>
</advancedsettings>
...
DEBUG: ------ Window Init (VideoFullScreen.xml) ------
INFO: Loading skin file: VideoFullScreen.xml, load type: KEEP_IN_MEMORY
DEBUG: CVideoPlayer::HandleMessages - player started 2
DEBUG: CVideoPlayer::SetCaching - caching state 3
DEBUG: CDVDClock::SetSpeedAdjust - adjusted:0.000000
DEBUG: CVideoPlayer::SetCaching - caching state 0
DEBUG: CDVDClock::SetSpeedAdjust - adjusted:0.000000
DEBUG: VideoPlayer::Sync - Audio - pts: 72000.000000, cache: 295896.620834, totalcache: 550000.011921
DEBUG: VideoPlayer::Sync - Video - pts: 0.000000, cache: 50000.000000, totalcache: 100000.000000
DEBUG: CVideoPlayerAudio - CDVDMsg::GENERAL_RESYNC(-223896.620834)
DEBUG: CDVDAudio::Resume - resume audio stream
DEBUG: CVideoPlayerVideo - CDVDMsg::GENERAL_RESYNC(-223896.620834)
DEBUG: CVideoPlayerVideo::CalcDropRequirement - hurry: 0
DEBUG: ActiveAE - start sync of audio stream
DEBUG: CVideoPlayerVideo::CalcDropRequirement - hurry: 0
DEBUG: Found Resolution HDMI-0: 1920x1080 @ 23.98Hz (24) from override of fps 23.976 (fpsmin:23.966 fpsmax:23.986 refreshmin:23.971 refreshmax:23.991)
NOTICE: Display resolution ADJUST : HDMI-0: 1920x1080 @ 23.98Hz (24) (weight: 0.000)
NOTICE: CWinSystemX11::SetFullScreen - calling xrandr
...
DEBUG: ------ Window Init (VideoFullScreen.xml) ------
NOTICE: Display resolution ADJUST : HDMI-0: 1920x1080 @ 23.97Hz (29) (weight: 0.000)
NOTICE: CWinSystemX11::SetFullScreen - calling xrandr
...
DEBUG: ------ Window Init (VideoFullScreen.xml) ------
DEBUG: Found Resolution HDMI-0: 1920x1080 @ 23.98Hz (24) from override of fps 23.976 (fpsmin:23.966 fpsmax:23.986 refreshmin:23.971 refreshmax:23.991)
NOTICE: Display resolution ADJUST : HDMI-0: 1920x1080 @ 23.98Hz (24) (weight: 0.000)
NOTICE: CWinSystemX11::SetFullScreen - calling xrandr
...
DEBUG: ------ Window Init (VideoFullScreen.xml) ------
NOTICE: Display resolution ADJUST : HDMI-0: 1920x1080 @ 23.97Hz (29) (weight: 0.000)
NOTICE: CWinSystemX11::SetFullScreen - calling xrandr
Full debug log: http://pastebin.com/1mJbcmwj
Case 4:
Tried doubling the refresh rate for fun. Still same behavior. Maybe this is more to be expected? To give lower refresh rates higher priority?
NOTICE: Contents of special://profile/advancedsettings.xml are...
<advancedsettings>
<gui>
<algorithmdirtyregions>3</algorithmdirtyregions>
<nofliptimeout>0</nofliptimeout>
</gui>
<video>
<adjustrefreshrate>
<override>
<fps>23.976</fps>
<refresh>47.952</refresh>
</override>
</adjustrefreshrate>
</video>
</advancedsettings>
...
DEBUG: ------ Window Init (VideoFullScreen.xml) ------
INFO: Loading skin file: VideoFullScreen.xml, load type: KEEP_IN_MEMORY
DEBUG: Found Resolution HDMI-0: 1920x1080 @ 47.95Hz (22) from override of fps 23.976 (fpsmin:23.966 fpsmax:23.986 refreshmin:47.942 refreshmax:47.962)
NOTICE: Display resolution ADJUST : HDMI-0: 1920x1080 @ 47.95Hz (22) (weight: 0.000)
NOTICE: CWinSystemX11::SetFullScreen - calling xrandr
...
DEBUG: ------ Window Init (VideoFullScreen.xml) ------
NOTICE: Display resolution ADJUST : HDMI-0: 1920x1080 @ 23.98Hz (25) (weight: 0.000)
NOTICE: CWinSystemX11::SetFullScreen - calling xrandr
...
DEBUG: Found Resolution HDMI-0: 1920x1080 @ 47.95Hz (22) from override of fps 23.976 (fpsmin:23.966 fpsmax:23.986 refreshmin:47.942 refreshmax:47.962)
NOTICE: Display resolution ADJUST : HDMI-0: 1920x1080 @ 47.95Hz (22) (weight: 0.000)
NOTICE: CWinSystemX11::SetFullScreen - calling xrandr
...
DEBUG: ------ Window Init (VideoFullScreen.xml) ------
NOTICE: Display resolution ADJUST : HDMI-0: 1920x1080 @ 23.98Hz (25) (weight: 0.000)
NOTICE: CWinSystemX11::SetFullScreen - calling xrandr
Full debug log: http://pastebin.com/RTJ1NjZF
Case 5:
Disabled the 23.971 Hz modeline with custom EDID, used modelines with double frequency and overrides in advancedsettings.xml. So far the refresh rates Kodi has been switching between has all had weight: 0.000. Now one has 0.000 and the other 0.001. It is still only respecting the override every other time.
NOTICE: Contents of special://profile/advancedsettings.xml are...
<advancedsettings>
<gui>
<algorithmdirtyregions>3</algorithmdirtyregions>
<nofliptimeout>0</nofliptimeout>
</gui>
<video>
<adjustrefreshrate>
<override>
<fps>23.976</fps>
<refresh>47.952</refresh>
</override>
<override>
<fps>24.0</fps>
<refresh>48.0</refresh>
</override>
<override>
<fps>25.0</fps>
<refresh>50.0</refresh>
</override>
<override>
<fps>29.97</fps>
<refresh>59.94</refresh>
</override>
</adjustrefreshrate>
</video>
</advancedsettings>
...
DEBUG: ------ Window Init (VideoFullScreen.xml) ------
INFO: Loading skin file: VideoFullScreen.xml, load type: KEEP_IN_MEMORY
DEBUG: Found Resolution HDMI-0: 1920x1080 @ 47.95Hz (23) from override of fps 23.976 (fpsmin:23.966 fpsmax:23.986 refreshmin:47.942 refreshmax:47.962)
NOTICE: Display resolution ADJUST : HDMI-0: 1920x1080 @ 47.95Hz (23) (weight: 0.000)
NOTICE: CWinSystemX11::SetFullScreen - calling xrandr
...
DEBUG: ------ Window Init (VideoFullScreen.xml) ------
NOTICE: Display resolution ADJUST : HDMI-0: 1920x1080 @ 48.00Hz (22) (weight: 0.001)
NOTICE: CWinSystemX11::SetFullScreen - calling xrandr
...
DEBUG: Found Resolution HDMI-0: 1920x1080 @ 47.95Hz (23) from override of fps 23.976 (fpsmin:23.966 fpsmax:23.986 refreshmin:47.942 refreshmax:47.962)
NOTICE: Display resolution ADJUST : HDMI-0: 1920x1080 @ 47.95Hz (23) (weight: 0.000)
NOTICE: CWinSystemX11::SetFullScreen - calling xrandr
...
DEBUG: ------ Window Init (VideoFullScreen.xml) ------
NOTICE: Display resolution ADJUST : HDMI-0: 1920x1080 @ 48.00Hz (22) (weight: 0.001)
NOTICE: CWinSystemX11::SetFullScreen - calling xrandr
Full debug log: http://pastebin.com/bx7bCui9
Thanks! Any ideas?