Bug 85203 - [DRI2][RadeonSI] Pageflip completion event has impossible msc.
Summary: [DRI2][RadeonSI] Pageflip completion event has impossible msc.
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-19 18:59 UTC by Aaron B
Modified: 2015-08-11 21:56 UTC (History)
5 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Xorg.0.log (58.14 KB, text/plain)
2014-11-23 15:39 UTC, Alex Xu (Hello71)
Details
sanitized dmesg (47.21 KB, text/plain)
2014-11-23 15:42 UTC, Alex Xu (Hello71)
Details
Xorg.log (59.45 KB, text/plain)
2015-02-03 23:23 UTC, Lorenzo Bona
Details

Description Aaron B 2014-10-19 18:59:09 UTC
[    35.454] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip completion event has impossible msc 1863 < target_msc 1864
[    40.254] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip completion event has impossible msc 2150 < target_msc 2151
[    45.388] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip completion event has impossible msc 2457 < target_msc 2458
[    49.721] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip completion event has impossible msc 2716 < target_msc 2717
[    49.905] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip completion event has impossible msc 2726 < target_msc 2727
[    51.138] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip completion event has impossible msc 2799 < target_msc 2800
[    51.771] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip completion event has impossible msc 2836 < target_msc 2837
[    54.621] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip completion event has impossible msc 3006 < target_msc 3007
[   606.838] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip completion event has impossible msc 36134 < target_msc 36135
[   609.805] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip completion event has impossible msc 36311 < target_msc 36312
[   609.971] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip completion event has impossible msc 36320 < target_msc 36321
[   612.288] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip completion event has impossible msc 36458 < target_msc 36459
[   613.155] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip completion event has impossible msc 36509 < target_msc 36510
[   613.821] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip completion event has impossible msc 36548 < target_msc 36549
[   624.555] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip completion event has impossible msc 37191 < target_msc 37192

Randomly happens in logs. I'm separating all my radeon bugs in to each topic, if found to be related we can close them in pairs, but for now making sure all have their own topics so we can get help finding others with the same problems.

Searching this same problem, this was supposed to be fixed for other radeon hardware a while back, but they still exist in my log. I found a firefox user with random crashes who reports these also.

My drivers are for RadeonSI, R9 270X 2GB card. Linux kernel 3.17 RC from Oct 6th. I've had these in my logs for a long, long time though.

What does MSC stand for?

Have fun. :)
Comment 1 Alex Deucher 2014-10-20 15:56:27 UTC
Please attach your xorg log and dmesg output.
Comment 2 Alex Xu (Hello71) 2014-11-23 15:39:19 UTC
Created attachment 109902 [details]
Xorg.0.log
Comment 3 Alex Xu (Hello71) 2014-11-23 15:42:00 UTC
Created attachment 109903 [details]
sanitized dmesg
Comment 4 Michel Dänzer 2014-11-25 07:44:55 UTC
Mario, any ideas?

These are possible scenarios I can think of where this could still happen:

1. The pflip interrupt triggers before the corresponding vblank interrupt
2. The page flip is queued just before the vertical blank period, such that it's
   too late for the corresponding vblank interrupt to trigger, but early enough
   for the flip to complete in the same vertical blank period.
3. Race condition when enabling the vblank interrupt, causing the vertical blank
   counter to be off by 1.

AFAIK 1. shouldn't happen, not sure if 2. can happen.
Comment 5 Mario Kleiner 2014-11-26 05:13:45 UTC
(In reply to Michel Dänzer from comment #4)
> Mario, any ideas?
> 
> These are possible scenarios I can think of where this could still happen:
> 
> 1. The pflip interrupt triggers before the corresponding vblank interrupt
> 2. The page flip is queued just before the vertical blank period, such that
> it's
>    too late for the corresponding vblank interrupt to trigger, but early
> enough
>    for the flip to complete in the same vertical blank period.
> 3. Race condition when enabling the vblank interrupt, causing the vertical
> blank
>    counter to be off by 1.
> 
> AFAIK 1. shouldn't happen, not sure if 2. can happen.

3. Can't cause this: The ddx calls waitvblank ioctl() while preparing a swap, to queue a vblank event -> vblank irqs on. They stay on for at least 5 seconds after queueing and dispatching the vblank event to the server, and it won't take the server/ddx over 5 seconds from receiving the event to calling the pflip ioctl, and then the pending flip keeps vblank irqs on until flip completion. So if there were a off by one bug, it would consistently affect the flip completion msc and the calculated target_msc used by the check that was triggered and causing this log message.

2. Don't think this can happen either: vblank irq is enabled before queueing a flip and vblank irq fires a bit before vblank iirc, and the hw is programmed to execute and complete pageflips only at leading edge of vblank since Linux 3.16, so the order of interrupt events in the interrupt ring should be so that the vblank handler gets called before the corresponding pflip irq handler. Unless the hw wouldn't fire a vblank irq .

A variation could in theory happen: The vblank irq fires shortly before vblank (about 2 scanlines iirc) -> msc++ , then a glXSwapBuffers swap gets scheduled, ddx reads the already incremented msc for the upcoming vblank and bases its reference value for expected msc on it, queues vblank event to the kernel -> gets dispatched immediately, triggers the pageflip ioctl and the flip gets programmed into the hw before leading edge of the upcoming vblank -> flip completes and delivers a completion msc that's one smaller than the expected minimum msc -> This warning gets logged. But i don't think this is likely. All this would have to happen within a tiny time-window of maybe at most 30 microseconds at exactly the right moment, about 2 scanlines before start of vblank. From tracing this a few month ago, i seem to remember that the sequence of actions takes longer than 30 usecs.

1. Shouldn't happen if everything works correctly. But if for some reason the pageflip wouldn't be synchronized to vblank, we'd get a tearing flip and these warning messages, because the flip might get queued in the middle of the scanout and then complete immediately and report the msc of the current refresh cycle, as the pflip irq would execute long before the vblank irq.
Comment 6 Mario Kleiner 2014-11-26 05:24:26 UTC
Also looking at the current ati-ddx, there have been changes to the logic since i last touched that code a long time ago. Functions like radeon_dri2_extrapolate_msc_delay() and radeon_get_interpolated_vblanks() which seem to tinker with the values which go into the check that triggered these warnings in the log. Some kind of adjustments for dpms off periods? Maybe some off-by-one error there due to some rounding?
Comment 7 Lorenzo Bona 2015-02-03 23:22:50 UTC
I'm experiencing the same problem here.

Computer suddently hangs and I have to reboot.
In Xorg.0.log I have the same warnings.
Dmesg has no issue.

Running on drm-fixes-3.19 (rc6), mesa/ddx/xorg/drm from git, LLVM 3.6 rc2 from Debian Sid.
Comment 8 Lorenzo Bona 2015-02-03 23:23:12 UTC
Created attachment 113141 [details]
Xorg.log
Comment 9 Michel Dänzer 2015-02-04 02:39:12 UTC
(In reply to Lorenzo Bona from comment #7)
> I'm experiencing the same problem here.
> 
> Computer suddently hangs and I have to reboot.

I doubt those hangs are directly related to these messages.
Comment 10 Clément Guérin 2015-04-26 14:58:53 UTC
Same problem here. It happens as far as I remember using my HD 7950 since last summer.

I ran GNOME 3.12 to 3.16 on Arch Linux the whole time. The screen glitches for a frame and I can find the error in the logs.

Current software stack:
Linux 4.0
Mesa 10.5.4
xorg-server 1.17.1
xf86-video-ati 1:7.5.0
Comment 11 spam 2015-05-02 00:22:00 UTC
for me the system randomly hard freezes, too.

i find these warnings in Xorg.log but nothing else:

[  6064.296] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip completion event has impossible msc 362422 < target_msc 362423
[  6069.799] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip completion event has impossible msc 362751 < target_msc 362752
[  6069.868] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip completion event has impossible msc 362754 < target_msc 362755
[  6169.680] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip completion event has impossible msc 368733 < target_msc 368734


i've a Radeon HD 5750.
Comment 12 Michel Dänzer 2015-05-02 00:26:29 UTC
(In reply to spam from comment #11)
> for me the system randomly hard freezes, too.
> 
> i find these warnings in Xorg.log but nothing else:
> 
> [  6064.296] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip
> completion event has impossible msc 362422 < target_msc 362423

Once again, it's unlikely that freezes are directly related to these messages, which should be basically harmless. People experiencing freezes should file separate reports about those.
Comment 13 spam 2015-05-02 00:29:17 UTC
i can always reproduce the crash when running this tool:
https://github.com/abma/qvdpautest
Comment 14 spam 2015-05-02 00:36:26 UTC
ok, filled a new bug report: https://bugs.freedesktop.org/show_bug.cgi?id=90278
Comment 15 emilio.moretti 2015-05-10 14:03:23 UTC
I'm having the same problems in ubuntu 15.04 amd64. I trigger it by playing Dota 2.This message is the last one shown in the logs.
Comment 16 emilio.moretti 2015-05-10 20:36:30 UTC
For future reference:
I disabled vsync and lowered the game settings for Dota2. I was able to play for 2 hours without problems. I haven't tested it more than that.
Comment 17 Michel Dänzer 2015-07-07 02:39:39 UTC
http://lists.freedesktop.org/archives/dri-devel/2015-July/085663.html should fix this.
Comment 18 Aaron B 2015-07-07 02:49:20 UTC
I've long since replaced the card with a GTX 970 Superclocked. I'll mark it fixed and assume it is, thank guys for your work.


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.