Bug 97392

Summary: blank/dpms off causes X freezing on Redwood with commit 9090309e057dc703d1a5bffd88e6cae14108cfc3
Product: xorg Reporter: mkgmafbt
Component: Driver/RadeonAssignee: xf86-video-ati maintainers <xorg-driver-ati>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium    
Version: git   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
Xorg log after terminating X
none
X bt
none
Add some debugging output
none
X log with patch applied
none
Call drmmode_clear_pending_flip first in drmmode_flip_handler/abort none

Description mkgmafbt 2016-08-18 11:55:12 UTC
Created attachment 125872 [details]
Xorg log after terminating X

blank/dpms off causes X freezing. Freezing in this case means no unblanking, keyboard and mouse not working. (dead lock while unblanking?)
When I kill X via ssh, the two displays unblank and I can start X just fine. 

I did a git bisect and commit 9090309e057dc703d1a5bffd88e6cae14108cfc3 "Wait for pending flips to complete before turning off an output or CRTC" causes the issue here.

AMD Redwood aka HD5670 (retail), Linux 4.7.x, amd64, mesa and libdrm git, llvm svn
Comment 1 Michel Dänzer 2016-08-19 01:53:24 UTC
(In reply to mkgmafbt from comment #0)
> blank/dpms off causes X freezing.

Does it matter how DPMS off is entered (timeout, locking the display, xset dpms force off, ...), or does it happen in all cases? Which desktop environment are you using?


> Freezing in this case means no unblanking, keyboard and mouse not working. 

Can you attach gdb to Xorg and get a backtrace when it's in this state?
Comment 2 mkgmafbt 2016-08-19 10:28:04 UTC
(In reply to Michel Dänzer from comment #1)
> (In reply to mkgmafbt from comment #0)
> > blank/dpms off causes X freezing.
> 
> Does it matter how DPMS off is entered (timeout, locking the display, xset
> dpms force off, ...), or does it happen in all cases? Which desktop
> environment are you using?

I haven't tested locking, but it doesn't make a difference if it times out or I use xset. I'm using lxqt (openbox+compton by default)
What makes a different is how I end X. If I kill X and start X unblanking/dpms on usually works, if I end X (log out) and start x, the displays doesn't wake up after dpms off.

> 
> > Freezing in this case means no unblanking, keyboard and mouse not working. 
> 
> Can you attach gdb to Xorg and get a backtrace when it's in this state?

I strip debugging symbols on this machine, but I can rebuild stuff if needed. I did rebuild X, libdrm and ddx, do you need something else too?
Comment 3 mkgmafbt 2016-08-19 10:30:34 UTC
Created attachment 125908 [details]
X bt
Comment 4 mkgmafbt 2016-08-19 11:14:58 UTC
(In reply to mkgmafbt from comment #2)
> What makes a different is how I end X. If I kill X and start X
> unblanking/dpms on usually works, if I end X (log out) and start x, the
> displays doesn't wake up after dpms off.
Well after a coffee break X hang too, so the only difference seems to be time...
Comment 5 Michel Dänzer 2016-08-24 08:28:14 UTC
Created attachment 125991 [details] [review]
Add some debugging output

Please reproduce the problem with this patch applied and then attach the corresponding log file. Note that this will generate a lot of debugging output, so the faster you can reproduce, the better. :)
Comment 6 mkgmafbt 2016-08-24 09:53:26 UTC
Created attachment 125997 [details]
X log with patch applied

Here it is. I didn't force dpms off, just let it time out.
Comment 7 Michel Dänzer 2016-08-24 13:55:19 UTC
Created attachment 126005 [details] [review]
Call drmmode_clear_pending_flip first in  drmmode_flip_handler/abort

This patch should fix the problem, please test.
Comment 8 mkgmafbt 2016-08-24 18:38:56 UTC
Yes works. Thanks
Comment 9 Michel Dänzer 2016-08-25 06:32:31 UTC
Excellent, thanks for testing, but bug reports should only be resolved when the fix has landed in Git.
Comment 10 Michel Dänzer 2016-08-26 08:32:51 UTC
Ended up landing a slightly different fix:

commit a36fdaff40d5b4795a1400c348a80eee94892212
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Wed Aug 24 22:52:11 2016 +0900

    Don't override crtc parameter value in drmmode_flip_handler/abort

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.