Win Screen tearing when using G-Sync - Workaround
#1
Hi guys. This is my first post here. I've been a long time XBMC/Kodi user and an occasional lurker on the forums (when I had issues).

I'm not sure whether this is the right place to post this, but I had a problem I've seen no mention of so far. I've recently upgraded my desktop PC with a G-sync monitor, and since then I've had screen tearing when playing videos. The test patterns (Settings/System/Display/Test Patterns) were also blinking way faster than it did on my old monitor.

After a bit of troubleshooting, I've found that G-sync was the cause. This is my gaming rig, so I wanted to keep G-sync on. As a workaround, I've added a profile for Kodi in the Nvidia Control Panel and set the Monitor Technology to Fixed Refresh Rate. It has been working perfectly since then.

It took me a few days to figure out, as I tried ignoring it at first. I don't think this is a common problem, as this is likely not a typical use case for Kodi. As such I don't see this issue as a bug or something worth following up on. This post might just help someone else out if they have a similar issue, and this might also apply to AMD's FreeSync.

My system:
Kodi 17.3 (Windows Store), Windows 10 Home 64-bit
Core i5 4570, Geforce GTX 1070, Dell S2716DG
Reply
#2
@kriz2

Thank you for sharing your experience and solution with the community.

I am sure it will help others. Smile
My Signature
Links to : Official:Forum rules (wiki) | Official:Forum rules/Banned add-ons (wiki) | Debug Log (wiki)
Links to : HOW-TO:Create Music Library (wiki) | HOW-TO:Create_Video_Library (wiki)  ||  Artwork (wiki) | Basic controls (wiki) | Import-export library (wiki) | Movie sets (wiki) | Movie universe (wiki) | NFO files (wiki) | Quick start guide (wiki)
Reply
#3
Welcome on the boat!

Here is what I can tell you about my experience with Kodi and G-Sync:

- seems to work a long time ago
- then stop working
- open a thread to talk about it
- only answer I got was that no matter what my screen was reporting it had in reality never work
- took the decision to disable G-Sync when using kodi

Here is the result that I seem to have when activating G-Sync:

- laggy UI
- fps in UI goes up and down depending if you move or not through the UI
- CPU usage goes up as soon as you move through the UI
- video playback goes to the max frequency of your screen no matter what video you try to play (in my case goes to 144HZ no matter if the file I play is 24, 25, 30 or any other fps)
Moanbag is in da place!
Reply
#4
(2017-06-25, 00:22)Gracus Wrote: Welcome on the boat!

Here is what I can tell you about my experience with Kodi and G-Sync:

- seems to work a long time ago
- then stop working
- open a thread to talk about it
- only answer I got was that no matter what my screen was reporting it had in reality never work
- took the decision to disable G-Sync when using kodi

Here is the result that I seem to have when activating G-Sync:

- laggy UI
- fps in UI goes up and down depending if you move or not through the UI
- CPU usage goes up as soon as you move through the UI
- video playback goes to the max frequency of your screen no matter what video you try to play (in my case goes to 144HZ no matter if the file I play is 24, 25, 30 or any other fps)

The latter is not correct. Kodi chooes the highest fps with the best match, depending on the fps available and punishes refreshrates > 60:

Code:
// punish higher refreshrates and prefer better matching
  // e.g. 30 fps content at 60 hz is better than
  // 30 fps at 120 hz - as we sometimes don't know if
  // the content is interlaced at the start, only
  // punish when refreshrate > 60 hz to not have to switch
  // twice for 30i content
  if (refresh > 60 && round > 1)
    weight += round / 10000.0;

  return weight;
So if you would play 60 fps content and had 60 hz and 120 hz available, it would choose 60.
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply
#5
(2017-06-25, 10:10)fritsch Wrote:
(2017-06-25, 00:22)Gracus Wrote: Welcome on the boat!

Here is what I can tell you about my experience with Kodi and G-Sync:

- seems to work a long time ago
- then stop working
- open a thread to talk about it
- only answer I got was that no matter what my screen was reporting it had in reality never work
- took the decision to disable G-Sync when using kodi

Here is the result that I seem to have when activating G-Sync:

- laggy UI
- fps in UI goes up and down depending if you move or not through the UI
- CPU usage goes up as soon as you move through the UI
- video playback goes to the max frequency of your screen no matter what video you try to play (in my case goes to 144HZ no matter if the file I play is 24, 25, 30 or any other fps)

The latter is not correct. Kodi chooes the highest fps with the best match, depending on the fps available and punishes refreshrates > 60:

Code:
// punish higher refreshrates and prefer better matching
  // e.g. 30 fps content at 60 hz is better than
  // 30 fps at 120 hz - as we sometimes don't know if
  // the content is interlaced at the start, only
  // punish when refreshrate > 60 hz to not have to switch
  // twice for 30i content
  if (refresh > 60 && round > 1)
    weight += round / 10000.0;

  return weight;
So if you would play 60 fps content and had 60 hz and 120 hz available, it would choose 60.

No matter what kodi should do, it does not stand anymore if you enable G-Sync

Just try yesterday before writting my previous post: play a 25fps file with G-Sync enable -> screen report 144Hz (or was it 143)

It was more or less the goal of my post: Kodi and G-Sync do not work well together

And before someone change my group name again because I already talk about the G-Sync thing: it was not a rant but just facts
Moanbag is in da place!
Reply
#6
What about posting your Debug Log to emphasize on the facts?
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply
#7
(2017-06-25, 13:05)fritsch Wrote: What about posting your Debug Log to emphasize on the facts?

Can do it if you want later today

But also have one question: do you also need a photo of my screen showing his refresh rate at the same time?

I already know that if I play a 25fps file, then the log will probably show that kodi try to set my screen to 100Hz (even if it is totaly useless with G-Sync enabled)

The issue is that if G-Sync is enable: the screen does not follow what kodi try to do
Moanbag is in da place!
Reply
#8
Okay. Then the it overwrites the standard API and does what it wants. Too bad - then there is really nothing we can do.
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply
#9
So I made the test

Here is the log: https://pastebin.com/6WyiAAYg

As expected, it shows that kodi try to set the screen to 100Hz while playing a 25fps file

And here is a screen capture where kodi report 144fps in onscreen log info:

Image

As I am not a coder and do not know a lot about G-Sync, I can not say what the issue is

Here is what I can say:

- Is there an issue? Yes
- Does it come from Kodi or from G-Sync? I do not know
- Is it fixable on Kodi's side? I do not know
- Could it be a good thing that it works? Yes as it will allow lowest refresh rate possible (and you said it is a good thing)
- Will it prevent me to use Kodi? No
Moanbag is in da place!
Reply
#10
Perhaps our windows dev has an idea how to stop what g-sync is clearly doing behind our back:

Quote:13:34:36.619 T:1632 DEBUG: CWinEventsWin32::WndProc: display change event
13:34:36.623 T:1632 DEBUG: CRenderSystemDX::FixRefreshRateIfNecessary: refreshRate: 99.9430, desired: 100.0000, deviation: 0.00057, fixRequired: true
13:34:36.623 T:1632 DEBUG: CRenderSystemDX::FixRefreshRateIfNecessary: refreshRate fix applied -> 100.000
13:34:36.745 T:1632 DEBUG: CRenderSystemDX::FixRefreshRateIfNecessary: refreshRate: 100.0000, desired: 100.0000, deviation: 0.00000, fixRequired: false
13:34:36.750 T:1632 DEBUG: CRenderSystemDX::CreateWindowSizeDependentResources - (Re)Create window size (2560x1080) dependent resources.
13:34:36.759 T:1632 DEBUG: CRenderSystemDX::FixRefreshRateIfNecessary: refreshRate: 100.0000, desired: 100.0000, deviation: 0.00000, fixRequired: false

I don't see a chance in generic parts of kodi as here everything is perfectly fine.
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply
#11
The issue is probably in what are their goal

kodi try to set the screen refresh rate when it is not needed with G-Sync

G-Sync should adapt the refresh rate to match the fps that is send to him (even if it does not match one of the fixed refresh rate of the screen)

Now there are probably some code needed to "trigger" G-sync and this code may not be freely accessible
Moanbag is in da place!
Reply
#12
(2017-06-25, 14:11)Gracus Wrote: The issue is probably in what are their goal

kodi try to set the screen refresh rate when it is not needed with G-Sync

G-Sync should adapt the refresh rate to match the fps that is send to him (even if it does not match one of the fixed refresh rate of the screen)

Now there are probably some code needed to "trigger" G-sync and this code may not be freely accessible
Kodi tries to set more siutable refresh rate from a list which is supported by a hardware i.e. from a list which is reported by a driver. If the driver said that it supports 100Hz refresh rate Kodi will use it as supported.
Reply
#13
I already know how kodi works

Made to work on fixed refresh rates when G-Sync is about adaptative refresh rates

But like I said, my previous posts was neither a "fix request" (that may not be possible) nor a "feature request" but just a description of the current situation between kodi and G-Sync
Moanbag is in da place!
Reply
#14
Some of the G-sync issues I saw was evident in the GUI even before playing media, so at least part of the problem has something to do with Kodi's engine. The problems are probably just easier to see with playback when compared to the mostly static GUI. The technology is focused purely on gaming at this stage, reducing input lag and stutter in games, which is a non-issue with fixed frame rate media playback. My opinion is that Team-Kodi should only start worrying about this when G-sync makes it into TVs (probably not very soon, if ever).
Reply
#15
If you enable debuglogging, you should also see an FPS value on the gui layer.

Btw. I think it confuses kodi with an OpenGL game and speeds it up as good it can :p
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply

Logout Mark Read Team Forum Stats Members Help
Screen tearing when using G-Sync - Workaround0