Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2990262imu; Sun, 9 Dec 2018 14:27:36 -0800 (PST) X-Google-Smtp-Source: AFSGD/XYCg6JhGfi25n1k3/rVNmZvMlHnQ94b0BiyLwr4mLslJPthWph7BYRxEWsqF+flE44D/Fu X-Received: by 2002:a63:eb52:: with SMTP id b18mr8612490pgk.213.1544394456678; Sun, 09 Dec 2018 14:27:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544394456; cv=none; d=google.com; s=arc-20160816; b=MdAXlNHS2hNvTrj86R7h+qxmXOFm52Z18aO0XE5a7myi1wKsnUQirOzL3ktUtZj0L1 At5KCtjydWU+q7WGomAXIYH360QZl7+g5fk0V6ZONxM/+gG1FHQazwrC73m+VXEEUllx m2X6OLCtMIklIcZaCn60LGDhvFerl37PeXpCs4nw+ZKFg3IRl7qYOWOb6TaxT8irrEXD jXvzEgApuRleW3C+/2tcvJwE4cqCmhVyS3RoSej2vaM/02VIc+tx5M/Hsy7+RAcRT58U sHzaAOo3sGwuvsJYN4KsN/lYL1sjG1vt8LsUSunZe9L6tPnjqoYLbv0Bo6B1wynWz/F7 4o2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=JHq2jiK/xnTUt464DYNcoaK9uM5sVd1wqjkaizvr+HQ=; b=vIIppz0WFLRIWqR2MOz+DCAHMaWbULca67Dk9BHvOsgs0GGMn4uFSrV0ppKmWSffWH UAmTxUopVrM+bXumfMK9OFyQw3w4VCH2peCVxat7MZp6x88EvwXLfUB5q7j3P9417mPw uVSBj/mUwV5QmqrI3TWKO6kcLQ3RZrWevfa3IJ7qNLrQbOpUrc6V2tcGeguYmwE/5gDp MOTueBcyAzZHFXhWBQB4DfKzFLVR2vHQAA7qoYWUqCUlu2BkOPx7KuHhZ4mKk/Eoa1o0 xLNsLU/ho14MSK1uLL14MEPK860cD0bhU4EoXcN+ZIr80VEwfbcH5XlQViG+8zIQER8v 5arg== 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 z143si9470306pfc.97.2018.12.09.14.27.21; Sun, 09 Dec 2018 14:27:36 -0800 (PST) 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 S1728665AbeLIW0A (ORCPT + 99 others); Sun, 9 Dec 2018 17:26:00 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:34854 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726435AbeLIVzP (ORCPT ); Sun, 9 Dec 2018 16:55:15 -0500 Received: from pub.yeoldevic.com ([81.174.156.145] helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gW72e-0002pp-1W; Sun, 09 Dec 2018 21:55:12 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gW72d-0003Oc-LK; Sun, 09 Dec 2018 21:55:11 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "N. W." , "Tom Yan" , "Rodrigo Vivi" , "Paulo Zanoni" , "Ville =?UTF-8?Q?Syrj=C3=A4l=C3=A4?=" , "=?UTF-8?Q?Micha=C5=82=20?= =?UTF-8?Q?Kope=C4=87?=" , "Nicholas Stommel" , "Jani Nikula" Date: Sun, 09 Dec 2018 21:50:33 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) X-Patchwork-Hint: ignore Subject: [PATCH 3.16 141/328] drm/i915: set DP Main Stream Attribute for color range on DDI platforms In-Reply-To: X-SA-Exim-Connect-IP: 81.174.156.145 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.62-rc1 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ä 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 [bwh: Backported to 3.16: - s/crtc_state->/intel_crtc->config./ - Adjust context, indentation] Signed-off-by: Ben Hutchings --- 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 @@ -5918,6 +5918,7 @@ enum punit_power_well { #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 0x130040 --- a/drivers/gpu/drm/i915/intel_ddi.c +++ b/drivers/gpu/drm/i915/intel_ddi.c @@ -929,6 +929,10 @@ void intel_ddi_set_pipe_settings(struct if (type == INTEL_OUTPUT_DISPLAYPORT || type == INTEL_OUTPUT_EDP) { temp = TRANS_MSA_SYNC_CLK; + + if (intel_crtc->config.limited_color_range) + temp |= TRANS_MSA_CEA_RANGE; + switch (intel_crtc->config.pipe_bpp) { case 18: temp |= TRANS_MSA_6_BPC;