Bug 66516

Summary: [845g regression] No output on LVDS
Product: DRI Reporter: Chris Wilson <chris>
Component: DRM/IntelAssignee: Daniel Vetter <daniel>
Status: CLOSED WORKSFORME QA Contact: Intel GFX Bugs mailing list <intel-gfx-bugs>
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
i8xx dvo pll fixes none

Description Chris Wilson 2013-07-02 17:37:05 UTC
Sigh, wandered down to see what happened to it after it fell off the network testing s2ram, and discovered that we no longer display anything on the LVDS (BIOS still shown). See bug 66464 for the dmesg with pipe assertion failures.
Comment 1 Daniel Vetter 2013-07-02 17:40:00 UTC
Wrong bug number? It links to a libre-office bug ...
Comment 2 Chris Wilson 2013-07-02 17:43:18 UTC
How many other 845g bugs have I filed this week... bug 66462.
Comment 3 Chris Wilson 2013-07-05 14:31:46 UTC
b5ea2d5681522f1b8ef886b5ac039903bf1d39fe is the first bad commit
commit b5ea2d5681522f1b8ef886b5ac039903bf1d39fe
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Thu Jun 27 17:52:15 2013 +0200

    drm/i915: fix hpd interrupt register locking
    
    Our interrupt handler (in hardirq context) could race with the timer
    (in softirq context), hence we need to hold the spinlock around the
    call to ->hdp_irq_setup in intel_hpd_irq_handler, too.
    
    But as an optimization (and more so to clarify things) we don't need
    to do the irqsave/restore dance in the hardirq context.
    
    Note also that on ilk+ the race isn't just against the hotplug
    reenable timer, but also against the fifo underrun reporting. That one
    also modifies the SDEIMR register (again protected by the same
    dev_priv->irq_lock).
    
    To lock things down again sprinkle a assert_spin_locked. But exclude
    the functions touching SDEIMR for now, I want to extract them all into
    a new helper function (like we do already for pipestate, display
    interrupts and all the various gt interrupts).
    
    v2: Add the missing 't' Egbert spotted in a comment.
    
    v3: Actually fix the right misspelled comment (Paulo).
    
    Cc: Egbert Eich <eich@suse.de>
    Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
    Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Comment 4 Chris Wilson 2013-07-05 14:32:16 UTC
(Now verifying the bisect.)
Comment 5 Chris Wilson 2013-07-05 14:54:13 UTC
Anticlimactically, no.
Comment 6 Chris Wilson 2013-07-05 16:27:17 UTC
66e3d5c09940d08d94b03e65b420fadaa7484318 is the first bad commit
commit 66e3d5c09940d08d94b03e65b420fadaa7484318
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Sun Jun 16 21:24:16 2013 +0200

    drm/i915: move i9xx dpll enabling into crtc enable function
    
    Now that we have the proper pipe config to track this, we don't need
    to write any registers any more.
    
    Note that for platforms without DPLL_MD (pre-gen4) which store the
    pixel mutliplier in the DPLL register I've decided to keep the
    seemingly "redundant" write: The comment right below saying "do this
    trice for luck" doesn't instill confidence ...
    
    v2: Drop a few now unnecessary local variables and switch the enable
    function to take a struct intel_crtc * to simply arguments.
    
    v3: Rebase on top of the newly-colored BUG_ON.
    
    v4: Amend commit message to alliviate Imre's comment about the
    redudant DPLL write for the pixel mutliplier.
    
    Cc: Imre Deak <imre.deak@intel.com>
    Cc: Jani Nikula <jani.nikula@linux.intel.com>
    Reviewed-by: Imre Deak <imre.deak@intel.com>
    Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Definitely this time.
Comment 7 Chris Wilson 2013-07-05 17:01:30 UTC
good: DPLL_A: 0xd0820000 (enabled, dvo, default clock, DAC/serial mode, p1 = 4, p2 = 4)

bad: DPLL_A: 0x90820000 (enabled, non-dvo, default clock, DAC/serial mode, p1 = 4, p2 = 4)
Comment 8 Chris Wilson 2013-07-05 17:48:42 UTC
Working hack:

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 1a8a01b..e77acf1 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3717,7 +3717,7 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
 	int pipe = intel_crtc->pipe;
 	int plane = intel_crtc->plane;
 
-	if (!intel_crtc->active)
+	if (!intel_crtc->active && 0)
 		return;
 
 	for_each_encoder_on_crtc(dev, crtc, encoder)
@@ -4597,6 +4597,7 @@ static void i8xx_update_pll(struct intel_crtc *crtc,
 	if (intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_LVDS)) {
 		dpll |= (1 << (clock->p1 - 1)) << DPLL_FPA01_P1_POST_DIV_SHIFT;
 	} else {
+		dpll |= DPLL_DVO_HIGH_SPEED;
 		if (clock->p1 == 2)
 			dpll |= PLL_P1_DIVIDE_BY_TWO;
 		else
@@ -9431,7 +9432,7 @@ static struct intel_quirk intel_quirks[] = {
 	{ 0x2782, 0x17aa, 0x201a, quirk_pipea_force },
 
 	/* 830/845 need to leave pipe A & dpll A up */
-	{ 0x2562, PCI_ANY_ID, PCI_ANY_ID, quirk_pipea_force },
+	//{ 0x2562, PCI_ANY_ID, PCI_ANY_ID, quirk_pipea_force },
 	{ 0x3577, PCI_ANY_ID, PCI_ANY_ID, quirk_pipea_force },
 
 	/* Lenovo U160 cannot use SSC on LVDS */
Comment 9 Chris Wilson 2013-07-05 18:58:12 UTC
And now no output on resume.
Comment 10 Daniel Vetter 2013-07-05 21:23:21 UTC
Created attachment 82095 [details] [review]
i8xx dvo pll fixes

quick hack to check whether I'm right ... If you can test so, I'd be very interested in low-res dvo modes (i.e. below the dotclock limit where we'd currently use a P2=4 divisor).
Comment 11 Chris Wilson 2013-07-06 08:38:53 UTC
No noticeable improvement. What I suspect is that we are simply not restoring the backlight - this is one of the machines where we do not know the maximum backlight value so disable our interface. And in this case, we have no other interfaces.
Comment 12 Chris Wilson 2013-07-06 16:11:50 UTC
Doing a full save/restore across suspend isn't enough. (I was hoping that preserving the backlight register even if we can't understand them would be sufficient.) Not even poking 0xff into the PCI backlight control word.

So not backlight, and not a difference in final registers... Even a missing register or incorrect sequence.
Comment 13 Chris Wilson 2013-07-06 17:24:11 UTC
Remaining hack required to lit up the LVDS:

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_d
index 2fedc3e..bab3a52 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -10212,6 +10212,11 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc
                        encoder->base.crtc = NULL;
                }
        }
+
+       if (!crtc->active) {
+               crtc->active = true;
+               intel_crtc_disable(crtc);
+       }
 }
 
 static void intel_sanitize_encoder(struct intel_encoder *encoder)

(no word on resume issues yet)
Comment 14 Daniel Vetter 2013-07-09 06:23:27 UTC
On Sat, Jul 6, 2013 at 7:24 PM,  <bugzilla-daemon@freedesktop.org> wrote:
> https://bugs.freedesktop.org/show_bug.cgi?id=66516
>
> --- Comment #13 from Chris Wilson <chris@chris-wilson.co.uk> ---
> Remaining hack required to lit up the LVDS:
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c
> b/drivers/gpu/drm/i915/intel_d
> index 2fedc3e..bab3a52 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -10212,6 +10212,11 @@ static void intel_sanitize_crtc(struct intel_crtc
> *crtc
>                         encoder->base.crtc = NULL;
>                 }
>         }
> +
> +       if (!crtc->active) {
> +               crtc->active = true;
> +               intel_crtc_disable(crtc);
> +       }
>  }
>
>  static void intel_sanitize_encoder(struct intel_encoder *encoder)

Hm, since the pipe A quirk in effect this just means that we leave pll
and pipe running, but kill everything else. Which probably means we've
broken a subtile ordering constraint somewhere recently ... no idea
what yet.
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
Comment 15 Chris Wilson 2013-09-29 21:07:36 UTC
845g is currently happy - until resume...

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.