Win Kodi occasionally switches monitors during playback of some movies
#1
Hello!

I have a crazy bug in Kodi Jarvis 16.1 RC2
My setup:
Intel-based PC with NVidia Geforce 460GTX GPU
1 PC monitor connected with DVI / 1 TV connected with HDMI

I've set up to run Kodi on "screen #2" which is my TV
Sometimes during playback (onplay event) of some movies it occasionally switches to my PC monitor "screen 1".
I've tried even switching PC monitor off so TV is the only one active display - still it happens.

I've reproduced this behaviour using 2 Blu-ray movies - 47 Ronin and Wolf of Wall Street.
On 47 Ronin it plays fine on the same screen as set in Kodi.
When launched "Wolf.." it switches to screen #1.

I don't remember having this issue on Jarvis 16.1 RC1

Here is my debug log.
Kodi Debug Log

I guess something happens here:
Code:
05:59:52 T:7228   DEBUG: Thread DelayedMessage start, auto delete: true
05:59:52 T:13928   DEBUG: CRenderSystemDX::SetMonitor - Selected \\.\DISPLAY1 output.
05:59:52 T:13928   DEBUG: CWinSystemWin32::SetFullScreenEx (windowed fullscreen) on screen 0 with size 1920x1080, refresh 50.000000
then reverts back here
Code:
06:00:21 T:13928   DEBUG: CRenderSystemDX::SetMonitor - Selected \\.\DISPLAY2 output.
06:00:21 T:13928   DEBUG: CWinSystemWin32::SetFullScreenEx (windowed fullscreen) on screen 1 with size 1920x1080, refresh 60.000000
I have the option "Adjust display reftesh rate" set to "On start/stop" with delay set to 5.5 sec
If I turn off this option - the above behavior is no more a concern. Everything plays on the same display as GUI.
I'm sure that TV supports 1920x1080 50hz refresh.

Any clues or do I have to pos a bug on bugtracker?

Thanks.
Reply
#2
Nobody got any clues?
Is it seems a bug? Should I post is somewhere else?
Reply
#3
Not sure it's a 'real' bug. Looks like for some reason (unknown at this point) you're losing handshaking, and Kodi defaults to the original launch monitor. I suspect this wouldn't happen if your TV was also your desktop and you launched Kodi from that. There are numerous threads on this subject, and the realization that Kodi was designed as a HTPC on one display and was not built for multi-tasking seems to fly over most users as unimportant. Open up both displays using extended... open Kodi in windowed mode on screen 2 and I doubt you will have issues.

Something in your system is probably taking the focus from Kodi in full screen mode (HDCP could be the issue).
Quote:I've reproduced this behaviour using 2 Blu-ray movies - 47 Ronin and Wolf of Wall Street.
On 47 Ronin it plays fine on the same screen as set in Kodi.
When launched "Wolf.." it switches to screen #1.
If you set-up a non multi-tasking desktop using display switch to the TV and launch Kodi, you'll find sucess, (there are scripts/batch files that will flip back to your monitor on exit of Kodi). I've been using an AVR that handles this automatically without incident.

There is so many different configurations of hardware, that's it's almost impossible to point at one fix. http://forum.kodi.tv/showthread.php?tid=158432 for all.

Suggestion: If you need to multi-task use windowed mode, or buy a second computer.
Reply
#4
(2016-03-30, 19:03)PatK Wrote: Something in your system is probably taking the focus from Kodi in full screen mode (HDCP could be the issue).
Suggestion: If you need to multi-task use windowed mode, or buy a second computer.

I'm sorry, but I think the problem is not in multitasking.
As you may have noticed, this problem appears only when Kodi tries to set refresh rate from 60 to 50hz.
With 25hz movies that doesn't happen. It doesn't happen also when "Adjust display refresh rate" is turned off.
So that in my opinion doesn't have anything to do with focus.

By the way, your suggestion is also wrong, because that problem persists even when I turn off/disconnect PC monitor from GFX card.
Also, from my point, no matter how Kodi is designed, you cannot force people to buy a new PC just to get rid of that problem.

But thanks for the suggestion anyway.
I just hope some1 from Kodi Team watches these topics and can fix this if possible.
Reply
#5
Quote:Kodi tries to set refresh rate from 60 to 50hz.
and it's at that point you probably lose the handshake. Turning off the monitor doesn't change the handshake. Can't force you to do anything, but bet this works " Open up both displays using extended... open Kodi in windowed mode on screen 2 and I doubt you will have issues." which would point back at my diagnosis. Check that link out for potential solve.
Reply
#6
(2016-03-30, 23:49)PatK Wrote:
Quote:Kodi tries to set refresh rate from 60 to 50hz.
and it's at that point you probably lose the handshake. Turning off the monitor doesn't change the handshake. Can't force you to do anything, but bet this works " Open up both displays using extended... open Kodi in windowed mode on screen 2 and I doubt you will have issues." which would point back at my diagnosis. Check that link out for potential solve.

Yep, I've read everything from there.
The problem described was something with TV being turned on/off and Windows recognizing that 2nd monitor is on/off.

My situation is a bit different. I don't have that problem, because I'm using an HDMI extender to send signal from PC to TV in bedroom. HDMI extender is always on, so that keeps PC thinks TV is always on.
Right now I'm thinking on how I can investigate this problem further.. What steps to take to find out the cause.
Also I'm not able to post a bug on Trac somehow Sad something wrong happens during login... Guess I'm stuck here.
Reply
#7
(2016-03-30, 15:11)mToeJam Wrote: Nobody got any clues?
Is it seems a bug? Should I post is somewhere else?
Related to http://trac.kodi.tv/ticket/16638 in a multi dispay setup. Again not proper handling of WM_DISPLAYCHANGE and related events. Just another symptom of the same thing. This time a hotplugging event takes place when it shouldn't.

Depending on your GPU/drivers/os version and stuff in your display chain a display might be disconnected during a refresh rate change. This is out of specs but sadly not uncommon.

Kodi naturally goes to the next display. It defaults back to primary if the previous display is not available anymore. So far so good in theory, but this has some sideffects on multi display setups as you described.

In a correct handling the move must not happen if we are doing a refresh rate change ourselves. So we know that some stuff might happen.

So in the missing handling of WM_DISPLAYCHANGE and the following MW_MOVE and WM_SIZE messages must deal with the specific case of a refresh rate change in progress and override what ever Windows is telling us. Basically ignore any window repositioning during a refresh rate change and once completed verify if the window is still visible or if a move is really needed because something failed.

When fixing the above mentioned issue this problem goes away as a nice side effect.

Man, this issue is getting more prominent as it seems. Still my time is very limited to provide a PR, but I know exactly how stuff needs to be handled here as I fixed this issue years ago for MediaPortal with all the same effects (bugged these days again, because of other changes the devs made in the following years).

But I try my best to provide a test binary as soon as possible to make sure all the symptoms of the same root cause are fixed before providing the PR to devs for inclusion.
Reply
#8
(2016-03-31, 09:52)Scythe42 Wrote: Related to http://trac.kodi.tv/ticket/16638 in a multi dispay setup. Again not proper handling of WM_DISPLAYCHANGE and related events. Just another symptom of the same thing. This time a hotplugging event takes place when it shouldn't.

Ok, that sounds related.
My thoughts was that happens because, when display refresh command is initiated, somehow Kodi doesn't recieve a timely answer for availiability of the current display after refresh rate been changed. Or it recieves info, that it somehow turned off during a call, when it only finishing refresh change process. So it falls back to another monitor.

I guess i will test the same behavior with only TV connected to PC to be sure that this wont happen in that case. If it does, than the root of the problem lies somewhere else..
Reply
#9
Well technically when you change a refresh rate a change of the display configuration happens, though it is not very common to see a display disconnected during that time, but not unheared of. My old 55" Samy with an Onkyo Receiver showed the same behaviour (display hotplugging takes place on refresh rate change).

As said, if Kodi is in a refresh rate change (or has a delay waiting for it to be finished) it should simply override any window repositioning request Windows is doing (if any) and once the RR change is finished check if the display is really available as a sanity check as it default Windows behavior was overridden prior.

If the display is still not available not then re-positioning is perfectly fine as a Window that was visible should stay visible and never somewhere where a user cannot interact with it (e.g. RR change failed totally and display has no picture anymore because of unsupported refresh rate). And fallback would always be primary as there are currently no special options for multi display setups to define a preferred order or even exclude certain displays.

Check the ticket when I provide a test binary and hopefully it fixed that issue for you as well; if not I log all the stuff Kodi is currently not logging that will help to deal with special cased in the future as well that are related to any kind of display configuration changes. I am sure there will be some.

And all this is very likely related to the often posted black screen problem, which I cannot reproduce, but we will see in testing if it goes away as a side effect. I have a hunch here in regards to the handling of WM_ACTIVATE, which I need to fix anyway for the display configuration change. Fingers crossed.
Reply
#10
Count me in for testing, Scythe42.
Will wait for your patch.
Reply
#11
Same problem here. projector connected with HDMI as screen 1 and imon display in pc case connected through dvi-->vga. Intel i3 with nvidia GTX950. When switching from 60 to 50 fps it reverts to the small imon vga display. if I turn display refresh rate change everything works as it should. Really annoying stuff. If there is any beta stuff to try count me in.
Reply
#12
try latest 16.1RC2
Reply
#13
I tried 16.1RC2, still the same problem. What worked for me is press Windows key and P and select only monitor 1. So the internal screen is disabled and the video defaults to the projector.
Reply
#14
(2016-04-23, 19:18)afedchin Wrote: try latest 16.1RC2

There's no reason. It's the build my testing was based on.

There is a bug reported by Scythe42 on that relating to some display event handling. He promised to provide a PR but i guess this will take a very long time...
Maybe you can have a look at it.I will try to test this on 16.1 final, but seems there are no changes since 16.1rc2 that influence this behaviour.
Reply
#15
I had similar problem. I have to use dual monitor because my HTPC also used for Karaoke purpose(monitor 1 for selecting MTVs, monitor 2 TV for presenting the MTV video). Kodi is set to monitor 2 (TV). Kodi has no problem to stay on TV in most case. In very rare case, when I hit play a movie, it switched to monitor 1 although the setting is still configured to "Full Screen #2". Just experienced one case on Kodi-16.1 release.
Reply

Logout Mark Read Team Forum Stats Members Help
Kodi occasionally switches monitors during playback of some movies0