From: Jesse Barnes <jbarnes@virtuousgeek.org>
To: Lukas Wunner <lukas@wunner.de>,
dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org
Cc: Andreas Heider <andreas@meetr.de>,
Bruno Bierbaumer <bruno@bierbaumer.net>,
William Brown <william@blackhats.net.au>,
Paul Hordiienko <pvt.gord@gmail.com>,
Matthew Garrett <mjg59@coreos.com>,
Dave Airlie <airlied@redhat.com>
Subject: Re: [PATCH v2 12/22] drm/i915: Preserve SSC earlier
Date: Mon, 31 Aug 2015 13:23:00 -0700 [thread overview]
Message-ID: <55E4B7A4.4080100@virtuousgeek.org> (raw)
In-Reply-To: <88b49891e95ced43bfb57cc8472bb69985827153.1439288957.git.lukas@wunner.de>
On 07/15/2015 04:57 AM, Lukas Wunner wrote:
> Commit 92122789b2d6 ("drm/i915: preserve SSC if previously set v3")
> added code to intel_modeset_gem_init to override the SSC status read
> from VBT with the SSC status set by BIOS.
>
> However, intel_modeset_gem_init is invoked *after* intel_modeset_init,
> which calls intel_setup_outputs, which *modifies* SSC status by way of
> intel_init_pch_refclk. So unlike advertised, intel_modeset_gem_init
> doesn't preserve the SSC status set by BIOS but whatever
> intel_init_pch_refclk decided on.
>
> This is a problem on dual gpu laptops such as the MacBook Pro which
> require either a handler to switch DDC lines, or the discrete gpu
> to proxy DDC/AUX communication: Both the handler and the discrete
> gpu may initialize after the i915 driver, and consequently, an LVDS
> connector may initially seem disconnected and the SSC therefore
> is disabled by intel_init_pch_refclk, but on reprobe the connector
> may turn out to be connected and the SSC must then be enabled.
>
> Due to 92122789b2d6 however, the SSC is not enabled on reprobe since
> it is assumed BIOS disabled it while in fact it was disabled by
> intel_init_pch_refclk.
>
> Also, because the SSC status is preserved so late, the preserved value
> only ever gets used on resume but not on panel initialization:
> intel_modeset_init calls intel_init_display which indirectly calls
> intel_panel_use_ssc via multiple subroutines, *before* the BIOS value
> overrides the VBT value in intel_modeset_gem_init (intel_panel_use_ssc
> is the sole user of dev_priv->vbt.lvds_use_ssc).
>
> Fix this by moving the code introduced by 92122789b2d6 from
> intel_modeset_gem_init to intel_modeset_init before the invocation
> of intel_setup_outputs and intel_init_display.
>
> Add a DRM_DEBUG_KMS as suggested way back by Jani:
> http://lists.freedesktop.org/archives/intel-gfx/2014-June/046666.html
>
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=88861
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=61115
> Tested-by: Paul Hordiienko <pvt.gord@gmail.com>
> [MBP 6,2 2010 intel ILK + nvidia GT216 pre-retina]
> Tested-by: William Brown <william@blackhats.net.au>
> [MBP 8,2 2011 intel SNB + amd turks pre-retina]
> Tested-by: Lukas Wunner <lukas@wunner.de>
> [MBP 9,1 2012 intel IVB + nvidia GK107 pre-retina]
> Tested-by: Bruno Bierbaumer <bruno@bierbaumer.net>
> [MBP 11,3 2013 intel HSW + nvidia GK107 retina -- work in progress]
>
> Fixes: 92122789b2d6 ("drm/i915: preserve SSC if previously set v3")
> Signed-off-by: Lukas Wunner <lukas@wunner.de>
> ---
> drivers/gpu/drm/i915/intel_display.c | 29 ++++++++++++++++++-----------
> 1 file changed, 18 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index af0bcfe..6335883 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -14893,6 +14893,24 @@ void intel_modeset_init(struct drm_device *dev)
> if (INTEL_INFO(dev)->num_pipes == 0)
> return;
>
> + /*
> + * There may be no VBT; and if the BIOS enabled SSC we can
> + * just keep using it to avoid unnecessary flicker. Whereas if the
> + * BIOS isn't using it, don't assume it will work even if the VBT
> + * indicates as much.
> + */
> + if (HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev)) {
> + bool bios_lvds_use_ssc = !!(I915_READ(PCH_DREF_CONTROL) &
> + DREF_SSC1_ENABLE);
> +
> + if (dev_priv->vbt.lvds_use_ssc != bios_lvds_use_ssc) {
> + DRM_DEBUG_KMS("SSC %sabled by BIOS, overriding VBT which says %sabled\n",
> + bios_lvds_use_ssc ? "en" : "dis",
> + dev_priv->vbt.lvds_use_ssc ? "en" : "dis");
> + dev_priv->vbt.lvds_use_ssc = bios_lvds_use_ssc;
> + }
> + }
> +
> intel_init_display(dev);
> intel_init_audio(dev);
>
> @@ -15446,7 +15464,6 @@ err:
>
> void intel_modeset_gem_init(struct drm_device *dev)
> {
> - struct drm_i915_private *dev_priv = dev->dev_private;
> struct drm_crtc *c;
> struct drm_i915_gem_object *obj;
> int ret;
> @@ -15455,16 +15472,6 @@ void intel_modeset_gem_init(struct drm_device *dev)
> intel_init_gt_powersave(dev);
> mutex_unlock(&dev->struct_mutex);
>
> - /*
> - * There may be no VBT; and if the BIOS enabled SSC we can
> - * just keep using it to avoid unnecessary flicker. Whereas if the
> - * BIOS isn't using it, don't assume it will work even if the VBT
> - * indicates as much.
> - */
> - if (HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev))
> - dev_priv->vbt.lvds_use_ssc = !!(I915_READ(PCH_DREF_CONTROL) &
> - DREF_SSC1_ENABLE);
> -
> intel_modeset_init_hw(dev);
>
> intel_setup_overlay(dev);
>
Yeah looks good (and I'm having deja vu here; I thought I ran into the same ordering issue at one point in a report from krh, but I guess I never fixed it; didn't have test hw at the time).
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Thanks,
Jesse
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-08-31 20:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-11 10:29 [PATCH v2 00/22] Enable gpu switching on the MacBook Pro Lukas Wunner
[not found] ` <29bed586baf62f6be77b7ab0ba1b8f5cb3be3aad.1439288957.git.lukas@wunner.de>
[not found] ` <164b43588e80baaddb7a4d1081785c4d03a89c4b.1439288957.git.lukas@wunner.de>
[not found] ` <27944adb13aa1ab246ee4a1ebb833e397324d073.1439288957.git.lukas@wunner.de>
[not found] ` <2ac3eca0759cedd1009221cbef908605f8d29e1e.1439288957.git.lukas@wunner.de>
[not found] ` <dc9642f97141bea03ec9f34f721cd0545c841d8c.1439288957.git.lukas@wunner.de>
[not found] ` <ec399430bb382373e8b4edaa5f773563ebc6aaa9.1439288957.git.lukas@wunner.de>
[not found] ` <f081b2513e26998c6f994305564e4a10e65ca820.1439288957.git.lukas@wunner.de>
[not found] ` <dc446cd3b3dd3aab07bb6df9e291bef2a71d6352.1439288957.git.lukas@wunner.de>
[not found] ` <de29004d1a3c4b192aaa18697f511d1e5b9f7bad.1439288957.git.lukas@wunner.de>
[not found] ` <832f1cfceab9d9403b541b51733b87110fd8e019.1439288957.git.lukas@wunner.de>
[not found] ` <e14b2b0ba7d6248edbdb74935f5743a705a62bb6.1439288957.git.lukas@wunner.de>
2015-07-15 11:57 ` [PATCH v2 12/22] drm/i915: Preserve SSC earlier Lukas Wunner
2015-04-19 15:01 ` [PATCH v2 13/22] drm/i915: Reprobe eDP and LVDS connectors on hotplug event Lukas Wunner
2015-06-30 9:06 ` [PATCH v2 14/22 RESEND] drm/i915: Fix failure paths around initial fbdev allocation Lukas Wunner
2015-07-04 9:50 ` [PATCH v2 15/22 RESEND] drm/i915: On fb alloc failure, unref gem object where it gets refed Lukas Wunner
2015-08-31 20:23 ` Jesse Barnes [this message]
2015-09-01 6:46 ` [PATCH v2 12/22] drm/i915: Preserve SSC earlier Jani Nikula
[not found] ` <cover.1439288957.git.lukas-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2015-08-12 14:16 ` [Intel-gfx] [PATCH v2 00/22] Enable gpu switching on the MacBook Pro Daniel Vetter
2015-08-12 23:37 ` Lukas Wunner
[not found] ` <20150812233711.GA6002-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2015-08-13 6:50 ` [Intel-gfx] " Daniel Vetter
2015-08-16 19:10 ` Lukas Wunner
2015-08-29 14:15 ` Lukas Wunner
2015-08-31 19:15 ` Jani Nikula
2015-09-01 6:48 ` Jani Nikula
2015-09-04 14:00 ` Lukas Wunner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55E4B7A4.4080100@virtuousgeek.org \
--to=jbarnes@virtuousgeek.org \
--cc=airlied@redhat.com \
--cc=andreas@meetr.de \
--cc=bruno@bierbaumer.net \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=lukas@wunner.de \
--cc=mjg59@coreos.com \
--cc=pvt.gord@gmail.com \
--cc=william@blackhats.net.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox