From patchwork Sun Mar 27 23:52:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mario Kleiner X-Patchwork-Id: 8677541 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 80EAF9F36E for ; Sun, 27 Mar 2016 23:54:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7F2532021F for ; Sun, 27 Mar 2016 23:54:07 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 8D6ED20218 for ; Sun, 27 Mar 2016 23:54:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 994146E2EA; Sun, 27 Mar 2016 23:54:03 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x230.google.com (mail-wm0-x230.google.com [IPv6:2a00:1450:400c:c09::230]) by gabe.freedesktop.org (Postfix) with ESMTPS id 554286E2E7 for ; Sun, 27 Mar 2016 23:53:10 +0000 (UTC) Received: by mail-wm0-x230.google.com with SMTP id p65so82256745wmp.1 for ; Sun, 27 Mar 2016 16:53:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TxPswUAnRoMm+uXCXwSSUfQCK+0hARgM/p4BvaB8EPM=; b=PCTqQZhnbrDqrWdazvo+4FuA57+4W2MaY54mkU6+juBnjMn3irH+UMBKGfxPk8Ur3C CKE0BBjJEVMmde9Tt/clnZUtxsawG3WVSQ3SOdjGTAjKWZuawwY/L2hkKVAL0XLI38Y4 yOQmYZZmfifVEyDorho6/dZq8phXXis1Fdc3r10Ub7I4WnbkrqSpdSsIZxLkBvj7EEnT ueVVEpiu60jlkpTnRPlRHdbms9DHlIeClaUjPT9mhpiOmCYnC99e3Os1/WZdOC25e1+z cgyQtOshOF2ebagmV+t5Dh75vBB/khDpTrQeyfI+mE6yvHyFbRyDdSP8dl6FNHWICfj1 yeFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TxPswUAnRoMm+uXCXwSSUfQCK+0hARgM/p4BvaB8EPM=; b=Gw1fOT3qDZx8FdXZWGmVZn2r5JN8j1jBJ6P4Np5CxXjg+xySKVZ50pAgxmDJfXV0MD y0TABpegXi6xaWMO21G8eHt/wxp7ufH3UPE7a8V+7L5sycKg1NlT/weP9GnzSXZ/UzjO 8VrZvC6Q5dloajYwIM9X7qwCu5UhhkpoH2PDJ8CpTXx94hZbtRFbR/SZ227fex26t87R zwh8FL66STO6Ee9mmYBgPfYClIExQUAXJwhky32fm9KcPVMKOtL3sX5NKtI6Jd1we5qc VBYM4U/7ZBinYqBH+pdKblOBHdBF0bzl5uCt16VQXs6BVO1SwpQ+5fOH/HtCI0JDiqh3 p+6Q== X-Gm-Message-State: AD7BkJJKYnwDsVUdfHBw03akiIYGC2P1yrzjlzYEDJso/l3clETm4C6zEsFy7uRadD8glg== X-Received: by 10.194.134.134 with SMTP id pk6mr25814117wjb.176.1459122788329; Sun, 27 Mar 2016 16:53:08 -0700 (PDT) Received: from twisty.cin.medizin.uni-tuebingen.de (cin-11.medizin.uni-tuebingen.de. [134.2.118.242]) by smtp.gmail.com with ESMTPSA id o16sm22327412wjr.9.2016.03.27.16.53.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 27 Mar 2016 16:53:07 -0700 (PDT) From: Mario Kleiner To: dri-devel@lists.freedesktop.org Subject: [PATCH 1/3] drm/edid: Set 8 bpc color depth for displays with "DFP 1.x compliant TMDS". Date: Mon, 28 Mar 2016 01:52:45 +0200 Message-Id: <1459122767-13314-2-git-send-email-mario.kleiner.de@gmail.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1459122767-13314-1-git-send-email-mario.kleiner.de@gmail.com> References: <1459122767-13314-1-git-send-email-mario.kleiner.de@gmail.com> MIME-Version: 1.0 Cc: Jani Nikula , stable@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 According to E-EDID spec 1.3, table 3.9, a digital video sink with the "DFP 1.x compliant TMDS" bit set is "signal compatible with VESA DFP 1.x TMDS CRGB, 1 pixel / clock, up to 8 bits / color MSB aligned". For such displays, the DFP spec 1.0, section 3.10 "EDID support" says: "If the DFP monitor only supports EDID 1.X (1.1, 1.2, etc.) without extensions, the host will make the following assumptions: 1. 24-bit MSB-aligned RGB TFT 2. DE polarity is active high 3. H and V syncs are active high 4. Established CRT timings will be used 5. Dithering will not be enabled on the host" So if we don't know the bit depth of the display from additional colorimetry info we should assume 8 bpc / 24 bpp with no dithering by default. This patch adds info->bpc = 8 assignement for that case. Now the DVI 1.0 spec (section 2.2.11.2 "Monitor data format support") mandates that "...If the monitor implements the EDID 2.0, 1.3 or newer data structure the monitor may specify any data format that is definable within the EDID data structure used. In all cases the monitor must support the 24-bit MSB aligned RGB TFT data format as a minimum." So any DVI display with EDID 1.3 should also have at least info->bpc = 8, even if the "DFP 1.x compliant" bit isn't set, but in our EDID handling we don't know if the EDID comes from a DVI display or something else. I therefore don't know if it is safe to always assume 8 bpc for digital inputs? Most of my tested DVI sinks set the DFP bit, but one tested Dell panel doesn't. Lack of handling this correctly was exposed by commit 013dd9e03872 ("drm/i915/dp: fall back to 18 bpp when sink capability is unknown") which assumes that the sink capability is unknown if our edid handling reports 0 bpc. As we return bpc = 0 for such displays, that patch will cause a degradation of output precison to 6 bpc for such displays on Intel hw if they are connected via an active DP->dual-link DVI converter and thereby treated as Displayport. As that patch was backported to stable we should include this one also in stable to fix the regression in color depth for such panels. Signed-off-by: Mario Kleiner Cc: Jani Nikula Cc: Ville Syrjälä Cc: stable@vger.kernel.org --- drivers/gpu/drm/drm_edid.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 414d7f6..ff28815 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -3810,8 +3810,12 @@ static void drm_add_display_info(struct edid *edid, if (edid->revision < 3) return; - if (!(edid->input & DRM_EDID_INPUT_DIGITAL)) + if (!(edid->input & DRM_EDID_INPUT_DIGITAL)) { + /* Analog sinks = infinite bpc, but driver decides */ + DRM_DEBUG("%s: Assigning analog sink color depth as %d bpc.\n", + connector->name, info->bpc); return; + } /* Get data from CEA blocks if present */ edid_ext = drm_find_cea_extension(edid); @@ -3829,6 +3833,31 @@ static void drm_add_display_info(struct edid *edid, /* HDMI deep color modes supported? Assign to info, if so */ drm_assign_hdmi_deep_color_info(edid, info, connector); + /* + * Digital sink with "DFP 1.x compliant TMDS" according to EDID 1.3? + * + * For such displays, the DFP spec 1.0, section 3.10 "EDID support" + * says: + * + * "If the DFP monitor only supports EDID 1.X (1.1, 1.2, etc.) + * without extensions, the host will make the following assumptions: + * + * 1. 24-bit MSB-aligned RGB TFT + * 2. DE polarity is active high + * 3. H and V syncs are active high + * 4. Established CRT timings will be used + * 5. Dithering will not be enabled on the host" + * + * So we use 8 bpc in this case and "no dithering" will hopefully + * follow. + */ + if ((info->bpc == 0) && (edid->revision < 4) && + (edid->input & DRM_EDID_DIGITAL_TYPE_DVI)) { + info->bpc = 8; + DRM_DEBUG("%s: Assigning DFP/DVI sink color depth as %d bpc.\n", + connector->name, info->bpc); + } + /* Only defined for 1.4 with digital displays */ if (edid->revision < 4) return;