dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Hans de Goede <j.w.r.degoede@gmail.com>
To: "Jani Nikula" <jani.nikula@linux.intel.com>,
	"Joonas Lahtinen" <joonas.lahtinen@linux.intel.com>,
	"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
	"Daniel Vetter" <daniel@ffwll.ch>
Cc: Hans de Goede <hdegoede@redhat.com>,
	intel-gfx <intel-gfx@lists.freedesktop.org>,
	dri-devel@lists.freedesktop.org
Subject: [PATCH 4/4] drm/i915/intel_dsi: Read back pclk set by GOP and use that as pclk
Date: Tue, 19 Jun 2018 22:18:27 +0200	[thread overview]
Message-ID: <20180619201827.4257-5-hdegoede@redhat.com> (raw)
In-Reply-To: <20180619201827.4257-1-hdegoede@redhat.com>

On BYT and CHT the GOP sometimes initializes the pclk at a (slightly)
different frequency then the pclk which we've calculated.

This commit makes the DSI code read-back the pclk set by the GOP and
if that is within a reasonable margin of the calculated pclk, uses
that instead.

This fixes the first modeset being a full modeset instead of a
fast modeset on systems where the GOP pclk is different.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/gpu/drm/i915/intel_dsi_vbt.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_dsi_vbt.c b/drivers/gpu/drm/i915/intel_dsi_vbt.c
index 4d6ffa7b3e7b..d4cc6099012c 100644
--- a/drivers/gpu/drm/i915/intel_dsi_vbt.c
+++ b/drivers/gpu/drm/i915/intel_dsi_vbt.c
@@ -517,6 +517,7 @@ bool intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id)
 	u32 mul;
 	u16 burst_mode_ratio;
 	enum port port;
+	enum pipe pipe;
 
 	DRM_DEBUG_KMS("\n");
 
@@ -583,6 +584,19 @@ bool intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id)
 	} else
 		burst_mode_ratio = 100;
 
+	/*
+	 * On BYT / CRC the GOP sometimes picks a slightly different pclk,
+	 * read back the GOP configured pclk and prefer it over ours.
+	 */
+	if ((IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) &&
+	    intel_dsi_get_hw_state(&intel_dsi->base, &pipe)) {
+		u32 gop = intel_dsi_get_pclk(&intel_dsi->base, bpp, NULL);
+
+		DRM_DEBUG_KMS("Calculated pclk %d GOP %d\n", pclk, gop);
+		if (gop >= (pclk * 9 / 10) && gop <= (pclk * 11 / 10))
+			pclk = gop;
+	}
+
 	intel_dsi->burst_mode_ratio = burst_mode_ratio;
 	intel_dsi->pclk = pclk;
 
-- 
2.17.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2018-06-19 20:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-19 20:18 [PATCH 0/4] drm/i915/intel_dsi: Read back and use pclk set by the GOP Hans de Goede
2018-06-19 20:18 ` [PATCH 1/4] drm/i915/intel_dsi: Allow calling intel_dsi_get_pclk with a NULL config Hans de Goede
2018-06-19 20:18 ` [PATCH 2/4] drm/i915/intel_dsi: Move initialization of encoder variables up a bit Hans de Goede
2018-06-19 20:18 ` [PATCH 3/4] drm/i915/intel_dsi: Make intel_connector_get_hw_state() non static Hans de Goede
2018-06-19 20:18 ` Hans de Goede [this message]
2018-07-06 14:16   ` [PATCH 4/4] drm/i915/intel_dsi: Read back pclk set by GOP and use that as pclk Ville Syrjälä
2018-07-07  6:32     ` Hans de Goede
2018-07-09 17:37       ` Rodrigo Vivi
2018-07-09 17:43         ` Hans de Goede
2018-07-09 18:14       ` Ville Syrjälä
2018-07-10  7:03         ` Hans de Goede
2018-06-29 11:35 ` [PATCH 0/4] drm/i915/intel_dsi: Read back and use pclk set by the GOP Hans de Goede
2018-07-06 13:14   ` Jani Nikula
2018-07-07  6:10     ` Hans de Goede

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=20180619201827.4257-5-hdegoede@redhat.com \
    --to=j.w.r.degoede@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hdegoede@redhat.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=ville.syrjala@linux.intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).