From patchwork Fri Sep 6 13:24:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 2854537 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4FAA39F3DC for ; Fri, 6 Sep 2013 13:25:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 30656201EF for ; Fri, 6 Sep 2013 13:25:26 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id E96D7201BC for ; Fri, 6 Sep 2013 13:25:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DAFA5E62EA for ; Fri, 6 Sep 2013 06:25:24 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id AD609E5D34 for ; Fri, 6 Sep 2013 06:24:20 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 06 Sep 2013 06:21:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.90,854,1371106800"; d="scan'208";a="399368365" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.167]) by orsmga002.jf.intel.com with SMTP; 06 Sep 2013 06:24:18 -0700 Received: by stinkbox (sSMTP sendmail emulation); Fri, 06 Sep 2013 16:24:17 +0300 From: ville.syrjala@linux.intel.com To: intel-gfx@lists.freedesktop.org Date: Fri, 6 Sep 2013 16:24:17 +0300 Message-Id: <1378473857-11890-1-git-send-email-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 1.8.1.5 In-Reply-To: <1378293292-30682-6-git-send-email-ville.syrjala@linux.intel.com> References: <1378293292-30682-6-git-send-email-ville.syrjala@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH] drm/i915: Fix issues caused from get_clock elimination X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ville Syrjälä For non-PCH encoders ironlake_crtc_clock_get() attempts to extract adjusted_mode.clock from port_clock. But now that we call ironlake_crtc_clock_get() before the encoders' get_config() that no longer works. To fix the problem also call ironlake_crtc_clock_get() before get_config() for PCH encoders, and afterwards for non-PCH encoders. Also be careful not to clobber port_clock when calling it afterwards. The problem was introduced by: "drm/i915: Fix port_clock readout for SDVO and HDMI 12bpc cases" Signed-off-by: Ville Syrjälä --- This could be squashed with the patch that caused the problem in the first place, but I left it separate for now to solicit feedback on how ugly do people think this is. I could of course leave the get_clock callback in place, but only fill it in for ILK+ and add a has_pch_encoder check there, otherwise we could keep the direct func call in get_pipe_config. drivers/gpu/drm/i915/intel_display.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 5b8a437..3cfd99b 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -6040,7 +6040,14 @@ static void ironlake_crtc_clock_get(struct intel_crtc *crtc, * This value does not include pixel_multiplier. We will fix * port_clock in the encoder's get_config() function if necessary. */ - pipe_config->port_clock = pipe_config->adjusted_mode.clock = clock; + pipe_config->adjusted_mode.clock = clock; + + /* + * We get called before encoder get_config() for pch encoders, + * after for non-pch. Don't clobber port_clock in the latter case. + */ + if (!pipe_config->port_clock) + pipe_config->port_clock = clock; } static bool ironlake_get_pipe_config(struct intel_crtc *crtc, @@ -6105,6 +6112,8 @@ static bool ironlake_get_pipe_config(struct intel_crtc *crtc, pipe_config->pixel_multiplier = ((tmp & PLL_REF_SDVO_HDMI_MULTIPLIER_MASK) >> PLL_REF_SDVO_HDMI_MULTIPLIER_SHIFT) + 1; + + ironlake_crtc_clock_get(crtc, pipe_config); } else { pipe_config->pixel_multiplier = 1; } @@ -6113,8 +6122,6 @@ static bool ironlake_get_pipe_config(struct intel_crtc *crtc, ironlake_get_pfit_config(crtc, pipe_config); - ironlake_crtc_clock_get(crtc, pipe_config); - return true; } @@ -8827,6 +8834,9 @@ check_crtc_state(struct drm_device *dev) encoder->get_config(encoder, &pipe_config); } + if (HAS_PCH_SPLIT(dev) && !pipe_config.has_pch_encoder) + ironlake_crtc_clock_get(crtc, &pipe_config); + WARN(crtc->active != active, "crtc active state doesn't match with hw state " "(expected %i, found %i)\n", crtc->active, active); @@ -10479,6 +10489,13 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) pipe); } + if (HAS_PCH_SPLIT(dev)) { + list_for_each_entry(crtc, &dev->mode_config.crtc_list, base.head) { + if (!crtc->config.has_pch_encoder) + ironlake_crtc_clock_get(crtc, &crtc->config); + } + } + list_for_each_entry(connector, &dev->mode_config.connector_list, base.head) { if (connector->get_hw_state(connector)) {