Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp743276imm; Thu, 13 Sep 2018 07:07:41 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdbeo8AI5Nzvk6m+238nwb0t7JmhIr71ewLnaVPo6ZzmgC8Fp176NNhGrJRJ5e5EguUGYQD2 X-Received: by 2002:a17:902:b28:: with SMTP id 37-v6mr7549589plq.337.1536847661778; Thu, 13 Sep 2018 07:07:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536847661; cv=none; d=google.com; s=arc-20160816; b=fDO/rs/Hk49qeD4UO2WhjZpNnaJ44XGln56oUD+OoDrtSzCjplpVS/TN3oNhUQt9Rm K1d06bo6/uCsy8SKD4nuDtlsWta3hG/nt9wiOsuOBjueG5GBG5xJSriPDk9kYkpKKhF6 QMnCjRjr3EZefe8TM2sGkuTxxwng8pyhhvG41jd+8lHdI8lTV020D4aowCA7MuJpWXGB m4AWGa8GLpomfjrgoj/dJUcFD5UlPEy8vciGni4OTck5L44v7JCZ7zQklxJODcF2BhvV +pu/v1a4yvZ1mODdNnZCuF7OzkSCMbEItL2gNQGaeyK5sBbuILETWAbjb5ZUz6bu5Mbm gNwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=Zh9TVVAnQXRdV2UEySElJR37T7tokTPo2nkJyO/iwEM=; b=0P2dNJjMDBxkwxdKyFVygf4OB2aWiQPaNvXZEgTRfU83RELOtFw94D9l2T9eEVX5lK 7pzuogMMg5XsNoMfjW7zKsPBEUORdLd+B4yTXddUV3f9Vyng+hpI3q+bz3lDh/SCbpO+ iMCPWQc8Jgq0bYy3iwMKjydbOxxY9B76DJ8FkOz9/mhqoe5lLNCQ1BJnip/O8z8fg63l ROdN1g/00vJk2hWXQBMqTZvzQBU6BnzHOuxbdsfaQEH2hEhjhYmyLCKDu/ycU4kr5ppV NXXfJ43xLeslzIJ86CJHy7NM2+R41c1ysC4HS3LTAWqbK3mDHHPs0u/mwtsoLZWmfhqT Tfcw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u22-v6si4497939plk.443.2018.09.13.07.07.26; Thu, 13 Sep 2018 07:07:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732304AbeIMTRA (ORCPT + 99 others); Thu, 13 Sep 2018 15:17:00 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:35780 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729144AbeIMTQ7 (ORCPT ); Thu, 13 Sep 2018 15:16:59 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id A836BD06; Thu, 13 Sep 2018 14:07:18 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Micha=C5=82=20Kope=C4=87?= , "N. W." , Nicholas Stommel , Tom Yan , Paulo Zanoni , Rodrigo Vivi , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Jani Nikula Subject: [PATCH 4.18 184/197] drm/i915: set DP Main Stream Attribute for color range on DDI platforms Date: Thu, 13 Sep 2018 15:32:13 +0200 Message-Id: <20180913131848.922339925@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180913131841.568116777@linuxfoundation.org> References: <20180913131841.568116777@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jani Nikula commit 6209c285e7a5e68dbcdf8fd2456c6dd68433806b upstream. Since Haswell we have no color range indication either in the pipe or port registers for DP. Instead, there's a separate register for setting the DP Main Stream Attributes (MSA) directly. The MSA register definition makes no references to colorimetry, just a vague reference to the DP spec. The connection to the color range was lost. Apparently we've failed to set the proper MSA bit for limited, or CEA, range ever since the first DDI platforms. We've started setting other MSA parameters since commit dae847991a43 ("drm/i915: add intel_ddi_set_pipe_settings"). Without the crucial bit of information, the DP sink has no way of knowing the source is actually transmitting limited range RGB, leading to "washed out" colors. With the colorimetry information, compliant sinks should be able to handle the limited range properly. Native (i.e. non-LSPCON) HDMI was not affected because we do pass the color range via AVI infoframes. Though not the root cause, the problem was made worse for DDI platforms with commit 55bc60db5988 ("drm/i915: Add "Automatic" mode for the "Broadcast RGB" property"), which selects limited range RGB automatically based on the mode, as per the DP, HDMI and CEA specs. After all these years, the fix boils down to flipping one bit. [Per testing reports, this fixes DP sinks, but not the LSPCON. My educated guess is that the LSPCON fails to turn the CEA range MSA into AVI infoframes for HDMI.] Reported-by: Michał Kopeć Reported-by: N. W. Reported-by: Nicholas Stommel Reported-by: Tom Yan Tested-by: Nicholas Stommel References: https://bugs.freedesktop.org/show_bug.cgi?id=100023 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107476 Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=94921 Cc: Paulo Zanoni Cc: Rodrigo Vivi Cc: Ville Syrjälä Cc: # v3.9+ Reviewed-by: Rodrigo Vivi Signed-off-by: Jani Nikula Link: https://patchwork.freedesktop.org/patch/msgid/20180814060001.18224-1-jani.nikula@intel.com (cherry picked from commit dc5977da99ea28094b8fa4e9bacbd29bedc41de5) Signed-off-by: Rodrigo Vivi Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_ddi.c | 4 ++++ 2 files changed, 5 insertions(+) --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -8825,6 +8825,7 @@ enum skl_power_gate { #define TRANS_MSA_10_BPC (2<<5) #define TRANS_MSA_12_BPC (3<<5) #define TRANS_MSA_16_BPC (4<<5) +#define TRANS_MSA_CEA_RANGE (1<<3) /* LCPLL Control */ #define LCPLL_CTL _MMIO(0x130040) --- a/drivers/gpu/drm/i915/intel_ddi.c +++ b/drivers/gpu/drm/i915/intel_ddi.c @@ -1659,6 +1659,10 @@ void intel_ddi_set_pipe_settings(const s WARN_ON(transcoder_is_dsi(cpu_transcoder)); temp = TRANS_MSA_SYNC_CLK; + + if (crtc_state->limited_color_range) + temp |= TRANS_MSA_CEA_RANGE; + switch (crtc_state->pipe_bpp) { case 18: temp |= TRANS_MSA_6_BPC;