From patchwork Wed Oct 17 11:09:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 10645341 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 28AB117D4 for ; Wed, 17 Oct 2018 11:37:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 094DF22A6F for ; Wed, 17 Oct 2018 11:37:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F1AC02AE6F; Wed, 17 Oct 2018 11:37:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C27E822A6F for ; Wed, 17 Oct 2018 11:37:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 80CDD6E362; Wed, 17 Oct 2018 11:37:11 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by gabe.freedesktop.org (Postfix) with ESMTPS id D2DB289FF9; Wed, 17 Oct 2018 11:09:50 +0000 (UTC) Received: by mail-wm1-x342.google.com with SMTP id z204-v6so1717031wmc.5; Wed, 17 Oct 2018 04:09:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dOBsTOEgjLnAQSA95z4rt7Mqn7LuzSE4Si3B076DY48=; b=j43bnWGcPGckkfgzHZL8hCCA+V+GOe+zUVsHPhsNd2M0SWdIQpueooJn4RacKUngZw iGpLzlXMHcFu7eOZYc6Q8PFzLzj98bp2CS6La0+tVVlt96vAVNyZRyiMG8mCdSFocFde OVeYjbONVfofCxE/JJJE8e0rjQrCM68qAZ0loj4qm4DWuhgRjwE47RdQ2M6BXyhQF8vp rrTBFNTyb0dXqLCVQMmt1ZduZzHFCBkvLXk6WGjG7IYAxi0fdVVzT0d+1dD9xd+eCv0r BwZoG2Q8vPZZQusVufBNAL90xShkx6OONbj7av6toFcmQ6Es+3IVBUkhdxtPPk2z0KpW HDQw== X-Gm-Message-State: ABuFfogyXr4Q/hCQtkxKlD9JpXxpX+K/guskue6lXjFAA17eLbZevny0 IwR65X/D6AxzL3n8UdL1C8SB4MqRM8o= X-Google-Smtp-Source: ACcGV61AANcuRa/yf9oVpROUOrN0zT0s5A/DoRj26ylIh+fE/DwOBsm6YXXFbyRi4QXIYidOXNCVnw== X-Received: by 2002:a1c:ee0c:: with SMTP id m12-v6mr2485309wmh.112.1539774589439; Wed, 17 Oct 2018 04:09:49 -0700 (PDT) Received: from shalem.localdomain.com (546A5441.cm-12-3b.dynamic.ziggo.nl. [84.106.84.65]) by smtp.gmail.com with ESMTPSA id b71-v6sm1727008wma.13.2018.10.17.04.09.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Oct 2018 04:09:48 -0700 (PDT) From: Hans de Goede X-Google-Original-From: Hans de Goede To: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= , Daniel Vetter Subject: [PATCH v2 1/2] drm/i915/intel_dsi: Move initialization of encoder variables up a bit Date: Wed, 17 Oct 2018 13:09:42 +0200 Message-Id: <20181017110943.30770-2-hdegoede@redhat.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181017110943.30770-1-hdegoede@redhat.com> References: <20181017110943.30770-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 17 Oct 2018 11:37:00 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hans de Goede , intel-gfx , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Move the initialization of encoder variables a bit higher inside the intel_dsi_init() function. So that can call intel_encoder_current_mode() from intel_dsi_vbt_init(). This is a preparation patch for reading back the GOP configured pclk from intel_dsi_vbt_init(). Signed-off-by: Hans de Goede --- drivers/gpu/drm/i915/vlv_dsi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/vlv_dsi.c b/drivers/gpu/drm/i915/vlv_dsi.c index bafeb2a19b90..55951b4a036c 100644 --- a/drivers/gpu/drm/i915/vlv_dsi.c +++ b/drivers/gpu/drm/i915/vlv_dsi.c @@ -1773,6 +1773,9 @@ void vlv_dsi_init(struct drm_i915_private *dev_priv) intel_connector->get_hw_state = intel_connector_get_hw_state; intel_encoder->port = port; + intel_encoder->type = INTEL_OUTPUT_DSI; + intel_encoder->power_domain = POWER_DOMAIN_PORT_DSI; + intel_encoder->cloneable = 0; /* * On BYT/CHV, pipe A maps to MIPI DSI port A, pipe B maps to MIPI DSI @@ -1824,9 +1827,6 @@ void vlv_dsi_init(struct drm_i915_private *dev_priv) } } - intel_encoder->type = INTEL_OUTPUT_DSI; - intel_encoder->power_domain = POWER_DOMAIN_PORT_DSI; - intel_encoder->cloneable = 0; drm_connector_init(dev, connector, &intel_dsi_connector_funcs, DRM_MODE_CONNECTOR_DSI); From patchwork Wed Oct 17 11:09:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 10645339 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8A01917D4 for ; Wed, 17 Oct 2018 11:37:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C79E22A6F for ; Wed, 17 Oct 2018 11:37:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 601432AE6F; Wed, 17 Oct 2018 11:37:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2915322A6F for ; Wed, 17 Oct 2018 11:37:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F13DE6E35B; Wed, 17 Oct 2018 11:37:01 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by gabe.freedesktop.org (Postfix) with ESMTPS id B6BF86E355; Wed, 17 Oct 2018 11:09:51 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id l6-v6so28775511wrt.1; Wed, 17 Oct 2018 04:09:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9Rm1+ndrweDNc5dZfyn4tzl23B7UAvb/LSW7AJbdUoM=; b=leFn77ZFlY2CqSeIas8ZV8QVIAun17f8OkNARN9hQ2Q85PypiYec+5NHNcBvdi2Mfa dMsv9/TjLpl6Bb8NmHWOqiDPSUUTtayrORRLrm9bPP+xpLyfWT1MRuXFc3GovCBB2G4M OpmrLK06hS2lUM9NRw5nWSnGOkmtQEFmOgQkbW6IVVag2f/NxsiQ90XDogKGErWH9unz Y9+uaUbrHhyE2Z9fsyt4mVAFWg5y4dI98mRaI0o0VkcIHM2sNB5GPrx0QyVrXEYbFkBK ef89PiORDD+IXGNyIzYc6srOqAy/bJciAoQXL5gJPhNXWTG4kT8Sa27w9MoHKsXKBvxg IhAA== X-Gm-Message-State: ABuFfoj+Zq8Go0MdH4pwrUbJFSYxhI4wzMCt+wG6WLoQmYQZMdxszfCk Sv9vMN4Z7pBZw9ZeKBrsclg= X-Google-Smtp-Source: ACcGV6026sAjykDd6OTvmzvMsRdwzu99Qr7/HKlQv2rfZqs8UxTEMfDxqC4S/rDt4sVH+aC/zz7M9Q== X-Received: by 2002:a5d:6551:: with SMTP id z17-v6mr22200149wrv.194.1539774590383; Wed, 17 Oct 2018 04:09:50 -0700 (PDT) Received: from shalem.localdomain.com (546A5441.cm-12-3b.dynamic.ziggo.nl. [84.106.84.65]) by smtp.gmail.com with ESMTPSA id b71-v6sm1727008wma.13.2018.10.17.04.09.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Oct 2018 04:09:49 -0700 (PDT) From: Hans de Goede X-Google-Original-From: Hans de Goede To: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= , Daniel Vetter Subject: [PATCH v2 2/2] drm/i915/intel_dsi: Read back pclk set by GOP and use that as pclk v2 Date: Wed, 17 Oct 2018 13:09:43 +0200 Message-Id: <20181017110943.30770-3-hdegoede@redhat.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181017110943.30770-1-hdegoede@redhat.com> References: <20181017110943.30770-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 17 Oct 2018 11:37:00 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hans de Goede , intel-gfx , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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. Changes in v2: -Use intel_encoder_current_mode() to get the pclk setup by the GOP Signed-off-by: Hans de Goede --- drivers/gpu/drm/i915/intel_dsi_vbt.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_dsi_vbt.c b/drivers/gpu/drm/i915/intel_dsi_vbt.c index ac83d6b89ae0..3387b187105c 100644 --- a/drivers/gpu/drm/i915/intel_dsi_vbt.c +++ b/drivers/gpu/drm/i915/intel_dsi_vbt.c @@ -506,6 +506,7 @@ bool intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id) struct mipi_config *mipi_config = dev_priv->vbt.dsi.config; struct mipi_pps_data *pps = dev_priv->vbt.dsi.pps; struct drm_display_mode *mode = dev_priv->vbt.lfp_lvds_vbt_mode; + struct drm_display_mode *curr; u32 bpp; u32 tlpx_ns, extra_byte_count, bitrate, tlpx_ui; u32 ui_num, ui_den; @@ -583,6 +584,23 @@ 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)) { + curr = intel_encoder_current_mode(&intel_dsi->base); + if (curr) { + DRM_DEBUG_KMS("Calculated pclk %d GOP %d\n", + pclk, curr->clock); + if (curr->clock >= (pclk * 9 / 10) && + curr->clock <= (pclk * 11 / 10)) + pclk = curr->clock; + + kfree(curr); + } + } + intel_dsi->burst_mode_ratio = burst_mode_ratio; intel_dsi->pclk = pclk;