Bug 13196 - [915 G33] server leaves pipe disabled at shutdown / vt switch
Summary: [915 G33] server leaves pipe disabled at shutdown / vt switch
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Driver/intel (show other bugs)
Version: git
Hardware: x86 (IA32) Linux (All)
: high major
Assignee: Jesse Barnes
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
: 13297 13328 13399 13744 (view as bug list)
Depends on:
Blocks: 13493
  Show dependency treegraph
 
Reported: 2007-11-12 05:38 UTC by Oswald Buddenhagen
Modified: 2008-02-01 11:16 UTC (History)
11 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Restore pipeconf fix (2.06 KB, patch)
2007-11-28 08:36 UTC, Jesse Barnes
no flags Details | Splinter Review
Pipe & plane enable fix (4.53 KB, patch)
2007-12-11 10:53 UTC, Jesse Barnes
no flags Details | Splinter Review
Updated patch incorporating Peter's feedback (4.63 KB, patch)
2007-12-11 12:58 UTC, Jesse Barnes
no flags Details | Splinter Review
Let PLLs settle longer (5.83 KB, patch)
2007-12-17 14:31 UTC, Jesse Barnes
no flags Details | Splinter Review

Description Oswald Buddenhagen 2007-11-12 05:38:25 UTC
(II) intel(0): Comparing regs from server start up to After LeaveVT
(WW) intel(0): Register 0x70008 (PIPEACONF) changed from 0x80000000 to 0x00000000
(WW) intel(0): PIPEACONF before: enabled, single-wide
(WW) intel(0): PIPEACONF after: disabled, single-wide

that's most probably because RestoreHWState() calls crtc->funcs->dpms(crtc, DPMSModeOff) and no corresponding save/restore functions are called - or even exist, fwiw:

static const xf86CrtcFuncsRec i830_crtc_funcs = {
    .dpms = i830_crtc_dpms,
    .save = NULL, /* XXX */
    .restore = NULL, /* XXX */
...
Comment 1 Eric Anholt 2007-11-12 14:31:30 UTC
May have been fixed by 10988c5e6ec0f3c40d56bbf209b7976627cca706 today
Comment 2 Oswald Buddenhagen 2007-11-12 15:19:56 UTC
nope :(
Comment 3 Oswald Buddenhagen 2007-11-20 01:58:03 UTC
*** Bug 13297 has been marked as a duplicate of this bug. ***
Comment 4 Oswald Buddenhagen 2007-11-20 02:12:09 UTC
btw, what might contribute to the problem is this pretty bold behavior:

(**) Option "dpms" "off"
(**) intel(0): DPMS enabled

:-D

so the problem might have existed for a longer time, but didn't become apparent for dpms being properly disabled.
Comment 5 Jesse Barnes 2007-11-27 17:32:07 UTC
We actually do restore PIPEACONF after calling the DPMS off functions:
   if ((pI830->saveDPLL_A & DPLL_VCO_ENABLE) &&
       (pI830->saveDPLL_A & DPLL_VGA_MODE_DIS))
           OUTREG(PIPEACONF, pI830->savePIPEACONF);
but maybe one of the saveDPLL_A checks is failing on your machine...  Does the
log have the value of DPLL_A somewhere?
Comment 6 Oswald Buddenhagen 2007-11-28 00:31:17 UTC
at startup, there is this:
(II) intel(0):            PIPEACONF: 0x80000000 (enabled, single-wide)
(II) intel(0):               DPLL_A: 0x808b0000 (enabled, non-dvo, VGA, default clock, DAC/serial mode, p1 = 13, p2 = 4)

the complete log is attached to bug #13312.

well, yes ... *of course* the check is failing - after all, all vts *are* in vga text mode.
i'm not sure whether the pipeaconf restoration should be duplicated with the inverse condition to after the *VGA* registers are set or just completely moved down and the condition removed. or maybe the vga restore should be moved in front of restoring the other registers.
Comment 7 Jesse Barnes 2007-11-28 08:35:05 UTC
Yeah, this is clearly a problem.  However, we'll need to be careful about the fix if we're going to prevent yet another regression...

I think we just need to restore the VGA clock divisor regs before restoring the PIPEnCONF regs, but we may also need to restore the VGA MSR reg as well.

Cc'ing Peter Clifton so he can test (or find a tester hopefully) so we don't regress on 8xx chips.

Please try the attached patch.
Comment 8 Jesse Barnes 2007-11-28 08:36:43 UTC
Created attachment 12783 [details] [review]
Restore pipeconf fix

Move VGA clock restore to where the rest of the clock stuff is done and remove the VGA checks prior to restoring the PIPEnCONF regs.
Comment 9 Jesse Barnes 2007-11-28 08:38:04 UTC
Adding Peter to make sure we don't regress.  Peter, please see the last few comments.
Comment 10 Oswald Buddenhagen 2007-11-28 09:02:24 UTC
works like a charm. :-)

i still wonder what this dpll condition is good for at all - i mean, we are restoring the old state, so why try to fix it?
Comment 11 Jesse Barnes 2007-11-28 09:08:52 UTC
The clock corresponding to the pipe we're about to enable has to be on before we can enable the pipe, or the chip will hang.  The checks are there to protect against a possibly bad initial state (maybe one where the BIOS enabled both clocks & pipes, then turned off a clock w/o disabling its pipe or something).
Comment 12 Peter Clifton 2007-11-28 09:20:51 UTC
I've contacted the user who was seeing crashes before, and will see if he can test a package with the patch attached here.
Comment 13 Pi, Fengming 2007-11-28 18:22:54 UTC
No,this patch didn't work on G33 and 965,after VT to console,i still got a dark screen
Comment 14 Oswald Buddenhagen 2007-11-29 02:02:48 UTC
have you rebooted in between? remember that this restores the state prior to starting the server, so it won't help if a bad server disabled the pipe previously.
Comment 15 Jesse Barnes 2007-11-29 12:39:35 UTC
*** Bug 13399 has been marked as a duplicate of this bug. ***
Comment 16 Pi, Fengming 2007-12-02 20:55:06 UTC
Ok,today I re-test Jesse's patch with latest git code on G33 and 965,it works,so Jesse you could commit it now.
Comment 17 Jesse Barnes 2007-12-03 10:54:00 UTC
Ok, I just want to make sure Peter's contact tests this before I commit.  I don't want to fix a regression by adding one. :)
Comment 18 Jesse Barnes 2007-12-04 09:06:20 UTC
*** Bug 13328 has been marked as a duplicate of this bug. ***
Comment 19 Ben Gamari 2007-12-06 19:19:50 UTC
Has anyone else observed that this patch breaks VT support (VTs turn into a black screen with vertical technicolor stripes)? Maybe it's another patch, I don't know. Other than this, what is preventing the merging of this patch at the moment?
Comment 20 Jesse Barnes 2007-12-07 10:02:17 UTC
I'm waiting on Peter's tester to make sure we don't regress 8xx users.

Ben, can you narrow down your VT switch problem a little more?  If it really is this patch causing your problem, I'd definitely want to get it fixed before pushing...
Comment 21 Jesse Barnes 2007-12-11 10:53:11 UTC
Created attachment 13032 [details] [review]
Pipe & plane enable fix

I looked at the docs in some detail today (though not the 855 ones, they're still on order), and it looks like moving up the VGA register restore is the right thing to do.  However, I also noticed that we were unconditionally enabling display planes, possibly at the wrong time, so this patch tries to fix that.  I'm really hoping this one works for both 9xx and 8xx users...
Comment 22 Peter Clifton 2007-12-11 12:22:55 UTC
I'm back-porting against the older driver to see if I can get this tested on 855 hardware.

A couple of notes though..

  /* If the pipe A PLL is active, we can restore the pipe & plane config */

Was copy-pasted to the Pipe B case too, without fixing the A -> B lettering.

Should the section:

   /* If we enabled pipe B, enable its corresponding plane */

Be nested under the test similar to:

   if(xf86_config->num_crtc == 2) 
   {
   }

(Like the rest of the "B" restore code?
Comment 23 Jesse Barnes 2007-12-11 12:56:38 UTC
I fixed the comment, thanks for looking.

The pipe B restore could go under the num_crtc == 2 check, I'll move it there (and move the pipe A restore up above).  However the posted code should be safe since we check the actual reg before writing the other values; my initial thinking was to do both after everything else, but it's probably best to keep the pipe code together.
Comment 24 Jesse Barnes 2007-12-11 12:58:58 UTC
Created attachment 13038 [details] [review]
Updated patch incorporating Peter's feedback

Shuffle the code around a little and fix the comment.
Comment 25 Oswald Buddenhagen 2007-12-12 01:20:00 UTC
still works on i845g :)
Comment 26 Jesse Barnes 2007-12-17 14:31:23 UTC
Created attachment 13169 [details] [review]
Let PLLs settle longer

The last patch didn't work.  Given the logs I've seen so far, I can't see why we would crash on programming the pipe regs unless we weren't waiting long enough for the PLLs to settle after programming them.  So this patch removes the conditions around the pipeconf reg writes and adds some more delays after the PLL register writes.

I think we still have some bugs in the hardware state save/restore, but afaict they shouldn't be causing the crashes people are seeing on 855.

Please test this out and let me know how it goes.
Comment 27 Oswald Buddenhagen 2007-12-17 15:31:21 UTC
vga_mode isn't used once assigned.
isn't there some status bit to indicate that the pll has settled? several times 10ms is an awful lot of time (enough for some (more) displays to go to sleep). maybe setting up the two pipes can be interleaved once it is known to work?
Comment 28 Jesse Barnes 2007-12-17 15:42:35 UTC
Yeah, the vga_mode flag was something I thought I'd use then ended up abandoning.  It's gone in my personal tree.

Yeah, 10ms is a long time and I'm sure it could be less, but I still want to test the theory that we need to wait for the PLLs a little longer.  Unfortunately, the only way I know of to see if the PLLs are ready is to write a pipe or palette register.  If the chip crashes, it wasn't ready.  If not, it must have been. :)

If this approach works, someone with a test machine could do a binary search for a good, low value.  But we already have lots of 30+ms waits in there due to the i830WaitForVblank, so it's not like the driver will get much faster.
Comment 29 Jesse Barnes 2007-12-18 18:13:51 UTC
I pushed the last patch to at least get people with 9xx chipsets working again, but I'll leave this bug open until we fix 855GM too.
Comment 30 Oswald Buddenhagen 2007-12-19 00:05:56 UTC
fwiw, still works on i845g (deja vu?) :)
Comment 31 Alan W. Irwin 2007-12-19 15:48:59 UTC
Still works on g33.  Just to remind you of the original problem, vanilla 2.2.0 without this patch or alternatively the previous "Restore pipeconf fix" patch immediately locks X (i.e., no access to keyboard, monitor in power save mode, with the only way out to ssh in to the box and do a shutdown) for my ASUS P5K-V with g33 chipset  and no ADD2 card.  This lockup occurred even for just the X -probeonly command.  So I am very happy to see this new patch still solves the g33 problem.
Comment 32 Gordon Jin 2007-12-19 19:24:33 UTC
*** Bug 13744 has been marked as a duplicate of this bug. ***
Comment 33 Raúl 2007-12-21 18:13:38 UTC
I took the latest git head in order to test this patch, but even Xorg come up, the text consoles using framebuffer were totally black, I couldn't see anything there. When I switch to Xorg is fine.

I suspected of the patch to I reverted commit f69b48fe24ef94dac44b8123884ca71df675be4b and tried again. Now text consoles works and Xorg as well, but of course the bug is still present.

Core 2 duo, intel 965GM with Debian sid and Linux 2.6.24rc6.
Comment 34 CIJOML CIJOMLovic CIJOMLov 2007-12-29 00:45:59 UTC
Same problem as Raul in #33 but only in several times...
Comment 35 Jesse Barnes 2008-01-02 11:11:21 UTC
Sounds like this particular problem is fixed at the cost of adding a regression documented in 13867 (855 machines can't suspend/resume anymore).


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.