Kodi and video judder on Intel HTPC

After Kodi installation on Q1900 HTPC (Intel Bay Trail processor), everything was fine except one irritating detail. The problem was judder (hicckup) every 8 seconds showing on movies with 23.976 FPS on my LG TV model 42LD650. Solution for smooth movie playing was adding correct modelines in xorg.conf.

My Kodi was based on Fedora 22 with systemd. In order to tweak xorg.conf, HTPC should be set to runlevel 3. This way it’s possible to make changes in xorg.conf and manually start X with startx command. To bring X down, execute the following command:

# systemctl isolate multi-user.target

This command should set Linux to display terminal console where is possible to login with existing user name and password. Fedora 22 (and probably other Linux distributions) will not have /etc/X11/xorg.conf file where the main part will happen. Despite that, X server runs without xorg.conf with default settings. This fact is good to know because if X server will not start after making some changes in config file, just rename xorg.conf file and that will allow starting X server with default settings.

# mv /etc/X11/xorg.conf /etc/X11/xorg.conf.old

The best way to start editing xorg.conf is to generate one with Xorg command from the terminal in runlevel 3:

# Xorg :0 -configure

The result should be written in /root/xorg.conf.new ready for customization and copy to /etc/X11 directory. In my case the following xorg.conf produces smooth 23.976 FPS playback on Intel HTPC:

Section "Monitor"
	Identifier  "HDMI1"
	HorizSync   14.0 - 70.0
	VertRefresh 24.0 - 62.0
	Option      "DPMS" "true"
	ModeLine    "1920x1080@60" 148.800 1920 2008 2052 2185 1080 1084 1089 1135 +hsync +vsync #INTEL
	ModeLine    "1920x1080@23.976" 74.057 1920 2558 2602 2719 1080 1084 1089 1136 +hsync +vsync #INTEL
EndSection

Section "Device"
	Identifier  "Card0"
	Driver      "intel"
	BusID       "PCI:0:2:0"
	Option      "AccelMethod" "sna"
EndSection

Section "Screen"
	Identifier "Screen0"
	Device     "Card0"
	Monitor    "HDMI1"
	DefaultDepth 24
	SubSection "Display"
		Depth     24
		Modes "1920x1080@60" "1920x1080@23.976"
	EndSubSection
EndSection

Section "Extensions"
	# fixes tearing
	Option "Composite" "Disable"
EndSection

Modeline lines were copied from Kodi Wiki page for Intel processor:

http://kodi.wiki/view/Xorg_Modelines

In first version I had only one modeline for 23.976 FPS and that forced Kodi to use this modeline all the time. I’m not sure but GUI with only “1920×1080@23.976” modeline was not so crisp/sharp/depth and mouse movement was slow. I tried to find content regarding described symptom but without any luck. The output of kodi-xrandr in this case was the following:

<screen id="0" minimum_w="8" minimum_h="8" current_w="1920" current_h="1080" maximum_w="32767" maximum_h="
32767">
  <output name="DP1" connected="false">
  </output>
  <output name="DP2" connected="false">
  </output>
  <output name="HDMI1" connected="true" w="1920" h="1080" x="0" y="0" crtc="0" wmm="160" hmm="90">
    <mode id="0x49" name="1920x1080@23.976" w="1920" h="1080" hz="23.97610" current="true" preferred="true"/>
    <mode id="0x4a" name="1920x1080" w="1920" h="1080" hz="60.00000" current="false" preferred="true"/>
    <mode id="0xfc" name="1920x1080" w="1920" h="1080" hz="60.00060" current="false" preferred="false"/>
    <mode id="0x4b" name="1920x1080" w="1920" h="1080" hz="50.00000" current="false" preferred="false"/>
    <mode id="0x4c" name="1920x1080" w="1920" h="1080" hz="59.94020" current="false" preferred="false"/>
    <mode id="0x4f" name="1920x1080" w="1920" h="1080" hz="30.00000" current="false" preferred="false"/>
    <mode id="0x50" name="1920x1080" w="1920" h="1080" hz="25.00000" current="false" preferred="false"/>
    <mode id="0x51" name="1920x1080" w="1920" h="1080" hz="24.00000" current="false" preferred="false"/>
    <mode id="0x53" name="1920x1080" w="1920" h="1080" hz="29.97010" current="false" preferred="false"/>
    <mode id="0x54" name="1920x1080" w="1920" h="1080" hz="23.97608" current="false" preferred="false"/>
    ...
    ...

I have concluded that Kodi forces GUI to use 23.976 modeline all the time and that may result with non sharp picture (or picture with low depth). In Helix installation (before Kodi), I had only one modeline without such problem. Anyway, after adding modeline with 60 FPS on the first place, everything looks excellent and the /usr/lib64/kodi/kodi-xrandr gives the following output:

<screen id="0" minimum_w="8" minimum_h="8" current_w="1920" current_h="1080" maximum_w="32767" maximum_h="
32767">
  <output name="DP1" connected="false">
  </output>
  <output name="DP2" connected="false">
  </output>
  <output name="HDMI1" connected="true" w="1920" h="1080" x="0" y="0" crtc="0" wmm="160" hmm="90">
    <mode id="0x49" name="1920x1080@60" w="1920" h="1080" hz="60.00060" current="true" preferred="true"/>
    <mode id="0x4a" name="1920x1080" w="1920" h="1080" hz="60.00000" current="false" preferred="true"/>
    <mode id="0xfc" name="1920x1080" w="1920" h="1080" hz="60.00060" current="false" preferred="false"/>
    <mode id="0x4b" name="1920x1080" w="1920" h="1080" hz="50.00000" current="false" preferred="false"/>
    <mode id="0x4c" name="1920x1080" w="1920" h="1080" hz="59.94020" current="false" preferred="false"/>
    <mode id="0x4f" name="1920x1080" w="1920" h="1080" hz="30.00000" current="false" preferred="false"/>
    <mode id="0x50" name="1920x1080" w="1920" h="1080" hz="25.00000" current="false" preferred="false"/>
    <mode id="0x51" name="1920x1080" w="1920" h="1080" hz="24.00000" current="false" preferred="false"/>
    <mode id="0x53" name="1920x1080" w="1920" h="1080" hz="29.97010" current="false" preferred="false"/>
    <mode id="0x54" name="1920x1080" w="1920" h="1080" hz="23.97608" current="false" preferred="false"/>
    <mode id="0x4d" name="1920x1080i" w="1920" h="1080" hz="30.00000" current="false" preferred="false"/>
    <mode id="0x4e" name="1920x1080i" w="1920" h="1080" hz="25.00000" current="false" preferred="false"/>
    <mode id="0x52" name="1920x1080i" w="1920" h="1080" hz="29.97010" current="false" preferred="false"/>
    <mode id="0x55" name="1920x1080@23.976" w="1920" h="1080" hz="23.97610" current="false" preferred="false"/>
    ...
    ...
se"/>

Final step to get rid of judder (hiccups) is to set system options in Kodi (try to play with the following settings):

  • enable “Adjust Refreshrate to match video” “On Start / Stop”
  • enable Sync Playback to Display with Method Video Clock (Drop / Dupe Audio)
  • keep the Vertical-Blank-Sync to “Let driver decide” (System -> Settings -> System -> Video Hardware) for Intel PC

While movie is playing, just press “o” and Kodi will display details about current playing. In the 4th line you’ll find frame rate (FPS) info the most important in this context (e.g fr:23.976).

With all this applied, I’m very satisfied with Kodi. Smooth playback and no freezing. Well, freezing on Q1900 is another story and temporary “CPU C State Support” in BIOS is set to C1 (instead of C7) until this kernel bug will be resolved:

http://forum.kodi.tv/showthread.php?tid=214838

In this post are mentioned two main threads – one in freedesktop/Xorg and second on GitHub/OpenElec with described freezing on Q1900 machines. Anyway, I hope this info here will save your time and help you to watch movies without video judder.

Leave a Comment