Bug 66384

Summary: VDPAU playback hangs when moving window between xrandr monitors
Product: Mesa Reporter: Michał Górny <mgorny>
Component: Drivers/Gallium/r600Assignee: Default DRI bug account <dri-devel>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: david, nfxjfg, nikoli
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Attempt at making DRI2 MSC counter consistent between CRTCs

Description Michał Górny 2013-06-29 19:30:49 UTC
I'm running live xorg/mesa with Radeon HD5450. I have two monitors connected and set up side-by-side using xrandr like the following:

    $ xrandr --output VGA-0 --mode 1280x960 --right-of DVI-0

Now, when I play a movie using mplayer2 with VDPAU driver and move the movie onto second monitor without pausing it first, the playback hangs for a minute or two. Then it resumes like nothing happened, no messages neither on console nor in dmesg.

What's interesting is that it seems to happen only after moving half of the window. If I have it partially on both monitors, it plays back fine. After the hang it plays fine again, and if I then move it back to the first monitor, it again hangs after moving half of it.
Comment 1 Michel Dänzer 2013-07-12 15:46:02 UTC
I think this is because the DRI2 MSC counters differ between CRTCs, so a DRI2 buffer swap or MSC wait times out.

AFAICT it might be tricky to fix this, at least without DRI3.
Comment 2 Michel Dänzer 2013-08-02 15:49:01 UTC
Created attachment 83546 [details] [review]
Attempt at making DRI2 MSC counter consistent between CRTCs

Here's an attempt at making the DRI2 MSC counter per-window instead of per-CRTC. I couldn't quite make it work, but maybe someone can run with this and finish it.
Comment 3 Michel Dänzer 2013-12-04 04:08:53 UTC
*** Bug 72291 has been marked as a duplicate of this bug. ***
Comment 4 David Heidelberg (okias) 2013-12-05 21:01:06 UTC
Now we have DRI3, is here some code to test? Or we should test this patch?
Comment 5 Christian König 2014-04-09 07:47:26 UTC
*** Bug 77208 has been marked as a duplicate of this bug. ***
Comment 6 nfxjfg 2014-04-09 19:14:36 UTC
Shouldn't this be responsibility of the code that implements the vdpau API? Maybe it should attempt to remap the MSC counters to system time, and smooth out the differences. (Sorry I don't know anything about Mesa internals.)

IMO this issue does make the Mesa vdpau implementation very unreliable, and at least for me it has caused a lot of problems.
Comment 7 David Heidelberg (okias) 2014-10-12 09:33:36 UTC
At this moment we have working DRI3 setup (without Present for Radeon).

Is there any effort to port VDPAU to DRI3?
Comment 8 Christian König 2014-10-12 09:39:18 UTC
(In reply to David Heidelberger (okias) from comment #7)
> At this moment we have working DRI3 setup (without Present for Radeon).
> 
> Is there any effort to port VDPAU to DRI3?

Not yet, but it is on the todo list.

On the other hand it sounds like a good beginners task if somebody wants to get his hands dirty. I'm glad to help and point out the right place in the sources if somebody volunteers.
Comment 9 Michel Dänzer 2015-08-20 03:49:50 UTC
Fixed in xf86-video-ati Git master:

commit 0288a4b87b65ba54f37fbeeea3cb32238deee92e
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Wed Aug 19 16:54:14 2015 +0900

    DRI2: Keep MSC monotonic when moving window between CRTCs

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.