26d3ee3
From 92c64493f41092185230c552c277b42bf6113140 Mon Sep 17 00:00:00 2001
26d3ee3
From: Jani Nikula <jani.nikula@intel.com>
26d3ee3
Date: Mon, 21 Oct 2013 10:52:07 +0300
26d3ee3
Subject: [PATCH 3/5] drm/i915/dp: workaround BIOS eDP bpp clamping issue
26d3ee3
26d3ee3
This isn't a real fix to the problem, but rather a stopgap measure while
26d3ee3
trying to find a proper solution.
26d3ee3
26d3ee3
There are several laptops out there that fail to light up the eDP panel
26d3ee3
in UEFI boot mode. They seem to be mostly IVB machines, including but
26d3ee3
apparently not limited to Dell XPS 13, Asus TX300, Asus UX31A, Asus
26d3ee3
UX32VD, Acer Aspire S7. They seem to work in CSM or legacy boot.
26d3ee3
26d3ee3
The difference between UEFI and CSM is that the BIOS provides a
26d3ee3
different VBT to the kernel. The UEFI VBT typically specifies 18 bpp and
26d3ee3
1.62 GHz link for eDP, while CSM VBT has 24 bpp and 2.7 GHz link. We end
26d3ee3
up clamping to 18 bpp in UEFI mode, which we can fit in the 1.62 Ghz
26d3ee3
link, and for reasons yet unknown fail to light up the panel.
26d3ee3
26d3ee3
Dithering from 24 to 18 bpp itself seems to work; if we use 18 bpp with
26d3ee3
2.7 GHz link, the eDP panel lights up. So essentially this is a link
26d3ee3
speed issue, and *not* a bpp clamping issue.
26d3ee3
26d3ee3
The bug raised its head since
26d3ee3
commit 657445fe8660100ad174600ebfa61536392b7624
26d3ee3
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
26d3ee3
Date:   Sat May 4 10:09:18 2013 +0200
26d3ee3
26d3ee3
    Revert "drm/i915: revert eDP bpp clamping code changes"
26d3ee3
26d3ee3
which started clamping bpp *before* computing the link requirements, and
26d3ee3
thus affecting the required bandwidth. Clamping after the computations
26d3ee3
kept the link at 2.7 GHz.
26d3ee3
26d3ee3
Even though the BIOS tells us to use 18 bpp through the VBT, it happily
26d3ee3
boots up at 24 bpp and 2.7 GHz itself! Use this information to
26d3ee3
selectively ignore the VBT provided value.
26d3ee3
26d3ee3
We can't ignore the VBT eDP bpp altogether, as there are other laptops
26d3ee3
that do require the clamping to be used due to EDID reporting higher bpp
26d3ee3
than the panel can support.
26d3ee3
26d3ee3
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=59841
26d3ee3
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67950
26d3ee3
Tested-by: Ulf Winkelvos <ulf@winkelvos.de>
26d3ee3
Tested-by: jkp <jkp@iki.fi>
26d3ee3
CC: stable@vger.kernel.org
26d3ee3
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
26d3ee3
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
26d3ee3
---
26d3ee3
 drivers/gpu/drm/i915/intel_dp.c | 20 ++++++++++++++++++++
26d3ee3
 1 file changed, 20 insertions(+)
26d3ee3
26d3ee3
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
26d3ee3
index 3aed1fe..07eb447 100644
26d3ee3
--- a/drivers/gpu/drm/i915/intel_dp.c
26d3ee3
+++ b/drivers/gpu/drm/i915/intel_dp.c
26d3ee3
@@ -1371,6 +1371,26 @@ static void intel_dp_get_config(struct intel_encoder *encoder,
26d3ee3
 	}
26d3ee3
 
26d3ee3
 	pipe_config->adjusted_mode.flags |= flags;
26d3ee3
+
26d3ee3
+	if (is_edp(intel_dp) && dev_priv->vbt.edp_bpp &&
26d3ee3
+	    pipe_config->pipe_bpp > dev_priv->vbt.edp_bpp) {
26d3ee3
+		/*
26d3ee3
+		 * This is a big fat ugly hack.
26d3ee3
+		 *
26d3ee3
+		 * Some machines in UEFI boot mode provide us a VBT that has 18
26d3ee3
+		 * bpp and 1.62 GHz link bandwidth for eDP, which for reasons
26d3ee3
+		 * unknown we fail to light up. Yet the same BIOS boots up with
26d3ee3
+		 * 24 bpp and 2.7 GHz link. Use the same bpp as the BIOS uses as
26d3ee3
+		 * max, not what it tells us to use.
26d3ee3
+		 *
26d3ee3
+		 * Note: This will still be broken if the eDP panel is not lit
26d3ee3
+		 * up by the BIOS, and thus we can't get the mode at module
26d3ee3
+		 * load.
26d3ee3
+		 */
26d3ee3
+		DRM_DEBUG_KMS("pipe has %d bpp for eDP panel, overriding BIOS-provided max %d bpp\n",
26d3ee3
+			      pipe_config->pipe_bpp, dev_priv->vbt.edp_bpp);
26d3ee3
+		dev_priv->vbt.edp_bpp = pipe_config->pipe_bpp;
26d3ee3
+	}
26d3ee3
 }
26d3ee3
 
26d3ee3
 static void intel_disable_dp(struct intel_encoder *encoder)
26d3ee3
-- 
26d3ee3
1.8.3.1