From patchwork Fri May 6 17:41:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mario Kleiner X-Patchwork-Id: 9034971 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 4E1DA9F30C for ; Fri, 6 May 2016 17:41:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 53A822039D for ; Fri, 6 May 2016 17:41:35 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 57ECE20392 for ; Fri, 6 May 2016 17:41:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7C7036EB1D; Fri, 6 May 2016 17:41:33 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x22f.google.com (mail-wm0-x22f.google.com [IPv6:2a00:1450:400c:c09::22f]) by gabe.freedesktop.org (Postfix) with ESMTPS id B144A6EB1D for ; Fri, 6 May 2016 17:41:31 +0000 (UTC) Received: by mail-wm0-x22f.google.com with SMTP id a17so89168062wme.0 for ; Fri, 06 May 2016 10:41:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:references:to:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=kAT/qVCQy313OhFFeaeZVS3Oj/qZODVPepZt+R2jkv4=; b=doz1Mqsh+cn7tJF1U4y1IQ8Y8Y/9FTpnAxXUuxmD4UdkXPc7SvsGm4daY6Rj4Ci5Rf 0a3ExMRiB7ad/K6TOXAnI89oUl2sdc0UqhIw8PvDt25bJZBxHd/rRmspaRwEr6H1NmNb Kpo6lXdNjnPeRfNwSpXLUKGBhurCDA5bscTIiB1CBjet5HeQayPit2Z1TyF35yRCdW0t vStXHJEYQE6G4Gtqa/diTnRD3fir7i5kjRxjpmJlNSsqX/shHfG4jHNGkI9bs8lArs43 KjuAVfd/FjEXgNZlZQBY99M9/on76YfkZXcJwZ+CU/nmVdfZDbcyAll98+b4C7vEooxY vuYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:references:to:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=kAT/qVCQy313OhFFeaeZVS3Oj/qZODVPepZt+R2jkv4=; b=TTNFIaOEZtiL5dD3kSUJcZC7RznXTGCIUYSUie5TQk8AqgqiPgwm5fPgnl2WltwcpC yqQhArJF7qBXNx2NRFN4oAVmBYBpSTV63j6sq0RS1+zzi8/Z0f3p1qvoKMUikaP8K3dj j4TtOCC9srESwBaxxMdhkze5qWQXa0nlD4CSwoRJZtG79lhKMYhNY0iI3gumIGaiNtYW w/y/ZJ7RrxGLoxdRSHDcOV7geE/UMrLi/ODzbOTnKudgTx7Bq6dpQfHKVY6H8ZdRHhFP vvpPpEn69IIhRq5LbIxJSm22Ivtm4vFTCuStP9NRoTQ0UWlkymqnD+cwp0AWEn7y+O8q sxUw== X-Gm-Message-State: AOPr4FVdsDSaaE5XC3dTGRk+tMFaekbbL0CP27/sP6/fjzbwog2iMltBR33pc7WgPAU/Vg== X-Received: by 10.194.2.130 with SMTP id 2mr20981325wju.77.1462556490313; Fri, 06 May 2016 10:41:30 -0700 (PDT) Received: from [172.25.199.14] (cin-11.medizin.uni-tuebingen.de. [134.2.118.242]) by smtp.gmail.com with ESMTPSA id k139sm9493831wmg.24.2016.05.06.10.41.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 May 2016 10:41:29 -0700 (PDT) Subject: Fwd: [PATCH 1/3] drm/edid: Set 8 bpc color depth for displays with "DFP 1.x compliant TMDS". References: <1459122767-13314-2-git-send-email-mario.kleiner.de@gmail.com> To: Jani Nikula , =?UTF-8?B?VmlsbGUgU3lyasOkbMOk?= , Daniel Vetter , "dri-devel@lists.freedesktop.org" From: Mario Kleiner X-Forwarded-Message-Id: <1459122767-13314-2-git-send-email-mario.kleiner.de@gmail.com> Message-ID: <572CD748.2030103@gmail.com> Date: Fri, 6 May 2016 19:41:28 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <1459122767-13314-2-git-send-email-mario.kleiner.de@gmail.com> 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=-6.2 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 -------- Forwarded Message -------- 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 From: Mario Kleiner To: dri-devel@lists.freedesktop.org CC: mario.kleiner.de@gmail.com, Jani Nikula , Ville Syrjälä , stable@vger.kernel.org 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;