Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Bad screen refresh in Kodi with external screen
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
bugalo
n00b
n00b


Joined: 05 Jul 2015
Posts: 37

PostPosted: Sat Sep 23, 2017 7:55 pm    Post subject: Bad screen refresh in Kodi with external screen Reply with quote

Hi, I've been having this problem in Kodi for a while. When playing a video on my TV, connected by HDMI, the upper right third of my screen refreshes at a different speed than the rest of the screen. It is very obvious in videos with a lot of motion, when a very sharp edge between both areas is very prominent.

This problem appears only under very specific conditions:

- Only with Kodi, I've tried other video players like VLC, and the artifact does not appear.
- Only in Full Screen: it does not appear in windowed mode, neither in maximized nor smaller window size.
- Only when using an external monitor, it does not happen in the laptop screen.

I've tested with different HDMI cables, and the problem persists. Right now, I am using Kodi 17.4-r1, but it appears in each Kodi version I've tried.

I've not been able to find a solution for the problem, and I would be very thankful if anyone could point me in the good direction.

Thanks in advance.

Edit: just to add more information, this happens also in the menus, not only in video reproduction.


Last edited by bugalo on Sun Sep 24, 2017 8:38 am; edited 1 time in total
Back to top
View user's profile Send private message
LIsLinuxIsSogood
Veteran
Veteran


Joined: 13 Feb 2016
Posts: 1179

PostPosted: Sun Sep 24, 2017 7:00 am    Post subject: Reply with quote

Did you try searching the larger audience of Kodi, outside this forum...there's no certainty that this is a problem with linux or the installation in any way. If you do want help, from this group though it is advised that you include some more information, like the following:

emerge --info kodi

It will also help to know whether or not the graphics driver you use is open source or proprietary, but really to me it doesn't sound like anything other than a defect or setting within the application.
Back to top
View user's profile Send private message
LIsLinuxIsSogood
Veteran
Veteran


Joined: 13 Feb 2016
Posts: 1179

PostPosted: Sun Sep 24, 2017 7:06 am    Post subject: Reply with quote

Does the problem happen immediately with the application start, or after a brief while of playing video? And does it go away if you pause video?
Back to top
View user's profile Send private message
bugalo
n00b
n00b


Joined: 05 Jul 2015
Posts: 37

PostPosted: Sun Sep 24, 2017 8:58 am    Post subject: Reply with quote

Thanks for responding. As you suggested, I will also seek advice in the Kodi forums. They will probably be able to provide more information.

I am currently using the nouveau graphics driver.

Also, the problem happens both in video reproduction and in the menus. If I scroll quickly through the items, the edge appears clearly. It starts right after launching Kodi, and it does go away when pausing the video.

Let me add the output of emerge --info kodi

Code:
 

Portage 2.3.8 (python 3.4.6-final-0, default/linux/amd64/13.0/desktop/gnome/systemd, gcc-6.4.0, glibc-2.23-r4, 4.13.2-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-4.13.2-gentoo-x86_64-Intel-R-_Core-TM-_i7-4870HQ_CPU_@_2.50GHz-with-gentoo-2.3
KiB Mem:    16336324 total,    171920 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Sat, 23 Sep 2017 08:30:01 +0000
Head commit of repository gentoo: 35f9397620e56656e4f0faa4e09a45192247e46b
Timestamp of repository poly-c: Wed, 20 Sep 2017 20:10:56 +0000
sh bash 4.3_p48-r1
ld GNU ld (Gentoo 2.28.1 p1.0) 2.28.1
app-shells/bash:          4.3_p48-r1::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.24.1-r2::gentoo
dev-lang/python:          2.7.14::gentoo, 3.4.6::gentoo
dev-util/cmake:           3.9.3::gentoo
dev-util/pkgconfig:       0.28-r2::gentoo
sys-apps/baselayout:      2.3::gentoo
sys-apps/openrc:          0.28::gentoo
sys-apps/sandbox:         2.10-r3::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69::gentoo
sys-devel/automake:       1.11.6-r1::gentoo, 1.15-r2::gentoo
sys-devel/binutils:       2.28.1::gentoo
sys-devel/gcc:            5.4.0-r3::gentoo, 6.4.0::gentoo
sys-devel/gcc-config:     1.7.3::gentoo
sys-devel/libtool:        2.4.6-r3::gentoo
sys-devel/make:           4.2.1::gentoo
sys-kernel/linux-headers: 4.4::gentoo (virtual/os-headers)
sys-libs/glibc:           2.23-r4::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000

betagarden
    location: /var/lib/layman/betagarden
    masters: gentoo
    priority: 50

c2p-overlay
    location: /var/lib/layman/c2p-overlay
    masters: gentoo
    priority: 50

didactic-duck
    location: /var/lib/layman/didactic-duck
    masters: gentoo
    priority: 50

gnome
    location: /var/lib/layman/gnome
    masters: gentoo
    priority: 50

ixit
    location: /var/lib/layman/ixit
    masters: gentoo
    priority: 50

jorgicio
    location: /var/lib/layman/jorgicio
    masters: gentoo
    priority: 50

poly-c
    location: /var/lib/layman/poly-c
    masters: gentoo
    priority: 50

science
    location: /var/lib/layman/science
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=core-avx2 -fomit-frame-pointer -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/chromium/policies/managed/chrome-gnome-shell.json /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/opt/chrome/policies/managed/chrome-gnome-shell.json /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=core-avx2 -fomit-frame-pointer -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--complete-graph --with-bdeps=y"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync multilib-strict news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j8"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/tmp"
USE="X a52 aac acl acpi alsa amd64 berkdb bindist bluetooth branding bzip2 cairo cdda cdr cli colord cracklib crypt cups cxx dbus dri dts dvd dvdr eds egl emboss encode evo exif fam firefox flac fortran gdbm gif git glamor gnome gnome-keyring gnome-online-accounts gpm gstreamer gtk gtk3 hpcups iconv icu introspection ipv6 jpeg lcms ldap libnotify libsecret mad mng modules mp3 mp4 mpeg multilib nautilus ncurses networkmanager nls nptl ogg opengl openmp pam pango pcre pdf png policykit ppds pulseaudio qt3support qt4 readline sdl seccomp session spell ssl startup-notification subversion svg systemd tcpd tiff tracker truetype udev udisks unicode upower usb vaapi vorbis wxwidgets x264 xattr xcb xml xv xvid xvmc zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="avx avx2 fma3 mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="evdev libinput" KERNEL="linux" L10N="de en es es-ES" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="de en es es_ES" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" POSTGRES_TARGETS="postgres9_5" PYTHON_SINGLE_TARGET="python3_4" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby22" SANE_BACKENDS="hpaio" USERLAND="GNU" VIDEO_CARDS="intel i965 nouveau" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

=================================================================
                        Package Settings
=================================================================

media-tv/kodi-17.4-r1::gentoo was built with the following:
USE="X alsa bluetooth css dbus dvd lcms opengl pulseaudio (system-ffmpeg) systemd udev udisks upower vaapi xslt -airplay -bluray -caps -cec -debug -gles -java -libressl -libusb -lirc -mysql -nfs -nonfree -samba -sftp -test -upnp -vdpau -webserver -zeroconf" ABI_X86="(64)" PYTHON_TARGETS="python2_7"


 
Back to top
View user's profile Send private message
LIsLinuxIsSogood
Veteran
Veteran


Joined: 13 Feb 2016
Posts: 1179

PostPosted: Sun Sep 24, 2017 9:09 am    Post subject: Reply with quote

You may want to search forum for graphics card (nvidia) there is a way to change the refresh rate to match that of the TV but obviously for the open source driver you can just most likely also do it.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54244
Location: 56N 3W

PostPosted: Sun Sep 24, 2017 9:33 am    Post subject: Reply with quote

bugalo,

It this upper third static or does it move up and down?

Heres a theory. Video systems normally use two (or more) buffers.
One buffer is used to refresh the screen while the next frame is rendered in the off screen buffer.
In the blank time between the two frames, the buffers are switched, so the new buffer is ready to be read out to the screen.
You don't see the switch because nothing is being read to the display when it happens.

Horrible video artefacts like the one you describe happen when the the above mechanism fails.
If the new frame is not rendered in time, the video system can throw it away (frame dropping) or display it anyway (some of the old data).

Does it help if you set the laptop to external display only?

Do you have all the right video acceleration options for Kodi?

You have
Code:
VIDEO_CARDS="intel i965 nouveau"
That, and the word 'laptop' suggests that you have an Optimus graphics system.
Which graphics chip is doing the rendering?

Kodi is built with USE=-vdpau. If you can use vdpau, its a good thing to have.

Run Kodi from a console. When Kodi exits there will be some messages in the console window. Post them, they may be useful.
Put your /var/log/Xorg.0.log onto a pastebin site just after you have confirmed the artefact.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
bugalo
n00b
n00b


Joined: 05 Jul 2015
Posts: 37

PostPosted: Sun Sep 24, 2017 11:28 am    Post subject: Reply with quote

Thank you, NeddySeagoon, for your response. I think that your guess is correct: I disabled the laptop screen, and the artifacts disappeared.

Quote:
It this upper third static or does it move up and down?


I cannot see it moving, but the area is definitely different in different situations: it is taller in the Kodi interface, shorter in videos.

I don't know if it is important, but the area is not rectangular. The upper, left and lower borders are the sides of a rectangle, the left side comes at 45 degrees from the upper-left corner of the screen, making it a "right trapezoid".

Quote:

Heres a theory. Video systems normally use two (or more) buffers.
One buffer is used to refresh the screen while the next frame is rendered in the off screen buffer.
In the blank time between the two frames, the buffers are switched, so the new buffer is ready to be read out to the screen.
You don't see the switch because nothing is being read to the display when it happens.

Horrible video artefacts like the one you describe happen when the the above mechanism fails.
If the new frame is not rendered in time, the video system can throw it away (frame dropping) or display it anyway (some of the old data).


If I understand your explanation correctly, this could explain why I don't see the artifact in windowed mode. Due to the window border, there are less pixels to update. Although I might be wrong on this one.

I've played with a setting called "Number of buffers used by graphics driver", I can change between 2 and 3, but it does not have any appreciable effect.

Also, when using VLC, I don't see the artifact.

Quote:
Does it help if you set the laptop to external display only?


Yes, it does. After turning off the laptop screen, the artifact disappears.

Quote:
Do you have all the right video acceleration options for Kodi?


I believe so, I've tried switching on and off all the video related options in Kodi's interface, and I was not able to find anyone that helped.

Quote:

You have
Code:
VIDEO_CARDS="intel i965 nouveau"
That, and the word 'laptop' suggests that you have an Optimus graphics system.
Which graphics chip is doing the rendering?


It's a bit more complicated than that. I have a Macbook Pro 15-inch 11,3, that cannot make use of the NVIDIA Optimus technology. I am not sure which chip is doing the rendering, but Kodi indicates that the Nouveau driver is in use.

Quote:
Kodi is built with USE=-vdpau. If you can use vdpau, its a good thing to have.


I've already rebuilt Kodi with vdpau support, thanks for the advice.

Quote:
Run Kodi from a console. When Kodi exits there will be some messages in the console window. Post them, they may be useful.


I did not get any messages in the console. I can provide the Kodi log

https://pastebin.com/BJAmwRKN

Quote:
Put your /var/log/Xorg.0.log onto a pastebin site just after you have confirmed the artefact.


This is my Xorg.0.log

https://pastebin.com/9jj0MHBm
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54244
Location: 56N 3W

PostPosted: Sun Sep 24, 2017 12:31 pm    Post subject: Reply with quote

bugalo,

Turn off the debug logging in Kodi. Thats hard work for Kodi and as you say, there is nothing there.

I was expecting to see something a little different in the Xorg.0.log.
Code:
[    12.995] (==) modeset(G0): Backing store enabled
[    12.995] (==) modeset(G0): Silken mouse enabled
[    12.996] (II) modeset(G0): RandR 1.2 enabled, ignore the following RandR disabled message.
[    12.996] (==) modeset(G0): DPMS enabled
[    12.996] (WW) modeset(G0): Option "DRI" is not used
[    12.996] (II) modeset(G0): [DRI2] Setup complete
[    12.996] (II) modeset(G0): [DRI2]   DRI driver: i965
[    12.996] (II) modeset(G0): [DRI2]   VDPAU driver: i965
[    13.038] (==) modeset(0): Backing store enabled
[    13.038] (==) modeset(0): Silken mouse enabled
[    13.038] (II) modeset(0): RandR 1.2 enabled, ignore the following RandR disabled message.
[    13.095] (==) modeset(0): DPMS enabled
[    13.095] (WW) modeset(0): Option "DRI" is not used
[    13.095] (II) modeset(0): [DRI2] Setup complete
[    13.095] (II) modeset(0): [DRI2]   DRI driver: nouveau
[    13.095] (II) modeset(0): [DRI2]   VDPAU driver: nouveau

This suggests that the modeset driver is in use everywhere. That's a bad thing as it does not have any hardware acceleration at all.
However, it goes on to say that the expected DRI and VDPAU drivers are in use, so I don't know what to make of that.

When you turned on USE=vdpau, how did you do it and what did you rebuild?
The right answer is that you set USE=vdpau in make.conf and rebuilt at least mesa and Kodi.
Code:
equery h vdpau
will list all your installed packages that can use vdpau.

At least one of your displays is 4k. That's hard work for the Intel chip, I would expect results to vary depending on how hard the graphics system had to work to upscale the video.
That depends on the input stream.
Try native 4k, bluray (1920x1080) and DVD (analogue broadcast TV resolution) streams. Is the artefact there all the time?
By disabling the internal display, the graphics system does not need to work as hard as its only rendering a single image.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Sun Sep 24, 2017 12:56 pm    Post subject: Reply with quote

Neddy, Intel can do VDPAU with x11-libs/libva-vdpau-driver, probably that's what is happening. VLC not having this problem means it is using different output method. Is it set to AUTO?
_________________
My Gentoo installation notes.
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
bugalo
n00b
n00b


Joined: 05 Jul 2015
Posts: 37

PostPosted: Sun Sep 24, 2017 5:07 pm    Post subject: Reply with quote

Quote:

When you turned on USE=vdpau, how did you do it and what did you rebuild?
The right answer is that you set USE=vdpau in make.conf and rebuilt at least mesa and Kodi.
Code:
equery h vdpau
will list all your installed packages that can use vdpau.


I had not set the USE=vdpau flag globally in make.conf, but on a per-package basis, because when I do it, I start having problems with other packages. For example, VLC stops outputting video with the default settings. For debugging this issue, I have just set USE=vdpau in make.conf and re-emerged all the packages that make use of this flag.

Quote:

At least one of your displays is 4k. That's hard work for the Intel chip, I would expect results to vary depending on how hard the graphics system had to work to upscale the video.
That depends on the input stream.
Try native 4k, bluray (1920x1080) and DVD (analogue broadcast TV resolution) streams. Is the artefact there all the time?
By disabling the internal display, the graphics system does not need to work as hard as its only rendering a single image.


Yes, the external screen is 4k. I have tried different input streams, a 4k video, a 1080p movie and a DVD, and the issue persists. The 4k video is a very hard load on the Intel chip (as you said), it is reproduced very slowly, and the artifact doesn't appear until after 30seconds or so.
Also, I have played with the Screen Resolution setting in Kodi. I have tried 3840x2160 and the artifact is there. I reduced it to 1920x1080 and the artifact disappears in Kodi's interface, but it is present in the videos.

Quote:
Neddy, Intel can do VDPAU with x11-libs/libva-vdpau-driver, probably that's what is happening. VLC not having this problem means it is using different output method. Is it set to AUTO?


Yes, output in VLC is set to Automatic.
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Sun Sep 24, 2017 5:11 pm    Post subject: Reply with quote

What output method is chosen in Kodi? VA-API, VDPAU, something else?
_________________
My Gentoo installation notes.
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
bugalo
n00b
n00b


Joined: 05 Jul 2015
Posts: 37

PostPosted: Sun Sep 24, 2017 5:46 pm    Post subject: Reply with quote

Quote:
What output method is chosen in Kodi? VA-API, VDPAU, something else?


The artifact persist with VA-API and VDPAU activated and deactivated within the Kodi GUI. I don't really know how to choose any other output setting for Kodi.
Back to top
View user's profile Send private message
LIsLinuxIsSogood
Veteran
Veteran


Joined: 13 Feb 2016
Posts: 1179

PostPosted: Mon Sep 25, 2017 5:54 am    Post subject: Reply with quote

Maybe it's NOT with Kodi, but related to the graphics card?!

I don't see any reason why you shouldn't be also trying with the use of the proprietary driver (from nvidia) at this point, if only to see if the problem is removed. Then you could try to go back to the open source driver always.

EDIT: Wanted to include this as well, since it seems like it could be worth looking into from the application settings side of things...
http://kodi.wiki/view/Linux_FAQ
scroll down to 2.4 Video tearing on Nvidia GPUs
Back to top
View user's profile Send private message
LIsLinuxIsSogood
Veteran
Veteran


Joined: 13 Feb 2016
Posts: 1179

PostPosted: Mon Sep 25, 2017 6:05 am    Post subject: Reply with quote

Have you tried disabling compositing?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum