Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp168591ybx; Fri, 1 Nov 2019 01:18:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqybGlZWspDbqMrSr2/iOqUR3++AnMKuB7nIEslC+rZ6KI8PTgXVrK5N+tEQnlMREfZnlm6F X-Received: by 2002:a50:9353:: with SMTP id n19mr11211702eda.258.1572596319117; Fri, 01 Nov 2019 01:18:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572596319; cv=none; d=google.com; s=arc-20160816; b=pn3islfNCdstP5klW1dlBuwTDBGHYHMFwfeYNKpTpdDJcqeFp0kHKTuXpihEdSD4iD +goxKaMnAABbMOb3y8UDRtCVqfjnXTX9McvlhgMw0QWaN4hG3qfXJyjHqcEVMhHHa/di EhfbTmEGZqZFwcZgR2wpCuS0fciKzRf5hDqQIXD9TDDKl42duCRHjh/Tg/ZmW6Kc9rj8 YXlE4GD1MBieaGFriKtCUvlfuaQWlB8YCV5yeH/ke6xVBOW8KjKe50rSqxcyFQJb2Vup UbuRdcJemZ0ksvrZcECyckEbxpwNEe+zOJENndE2JVGGgzS12Mf7iLLRnb+wZ8/vzw9T KrGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from; bh=SJsTZwJmKkZK8T6JE9Kq8xZXsXw4F+fUQX2slUwv62Y=; b=RycWiOJ9MaFC95G2GwJ2FRhcjKw4OJvyz6ZhRhjJL7uAGj20AzX1qYQc8X5sTvahoy mARK72SMEL1guHOt7V3u/WImyQ7zwcgJGSSfSjIhFEaiEHpLLTewb0tKjGlly05Z5t1m GfMlWEGMsLy4r1itSrrEr+KJu8ojr2YByRmrtFf8A0aLxpihhvni8/4yPUmWDoqAVp9A KXfHQHezyLR83sGHVPmTVwgdA5fukkgRnWimrG6wa9znpd5SxfaR0/TqWKhcEMr7dO7X IGVCc5/hF9LSlThi8kR8CYuOAxlb9Fr1ECLJbgo9ZdjYMQwaXxr1VqNeG64C/w+xq5Tk aKRA== 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 o2si6979425edj.290.2019.11.01.01.18.15; Fri, 01 Nov 2019 01:18:39 -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 S1730319AbfKAIPX (ORCPT + 99 others); Fri, 1 Nov 2019 04:15:23 -0400 Received: from 60-251-196-230.HINET-IP.hinet.net ([60.251.196.230]:39755 "EHLO ironport.ite.com.tw" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729942AbfKAIPW (ORCPT ); Fri, 1 Nov 2019 04:15:22 -0400 X-Greylist: delayed 529 seconds by postgrey-1.27 at vger.kernel.org; Fri, 01 Nov 2019 04:15:22 EDT Received: from unknown (HELO mse.ite.com.tw) ([192.168.35.30]) by ironport.ite.com.tw with ESMTP; 01 Nov 2019 16:05:28 +0800 Received: from csbcas.internal.ite.com.tw (csbcas1.internal.ite.com.tw [192.168.65.46]) by mse.ite.com.tw with ESMTP id xA185M3K074232; Fri, 1 Nov 2019 16:05:22 +0800 (GMT-8) (envelope-from allen.chen@ite.com.tw) Received: from allen-VirtualBox.internal.ite.com.tw (192.168.70.14) by csbcas1.internal.ite.com.tw (192.168.65.45) with Microsoft SMTP Server (TLS) id 14.3.352.0; Fri, 1 Nov 2019 16:05:22 +0800 From: allen CC: Allen Chen , Pi-Hsun Shih , Jau-Chih Tseng , Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , "open list:DRM DRIVERS" , open list Subject: [PATCH] drm/edid: fixup EDID 1.3 and 1.4 judge reduced-blanking timings logic Date: Fri, 1 Nov 2019 16:04:22 +0800 Message-ID: <1572595463-30970-1-git-send-email-allen.chen@ite.com.tw> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [192.168.70.14] X-MAIL: mse.ite.com.tw xA185M3K074232 To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org According to VESA ENHANCED EXTENDED DISPLAY IDENTIFICATION DATA STANDARD (Defines EDID Structure Version 1, Revision 4) page: 39 How to determine whether the monitor support RB timing or not? EDID 1.4 First: read detailed timing descriptor and make sure byte0 = 0, byte1 = 0, byte2 = 0 and byte3 = 0xFD Second: read detailed timing descriptor byte10 = 0x04 and EDID byte18h bit0 = 1 Third: if EDID byte18h bit0 == 1 && byte10 == 0x04, then we can check byte15, if byte15 bit4 =1 is support RB if EDID byte18h bit0 != 1 || byte10 != 0x04, then byte15 can not be used The linux code is_rb function not follow the VESA's rule EDID 1.3 LCD flat panels do not require long blanking intervals as a retrace period so default support reduced-blanking timings. Signed-off-by: Allen Chen --- drivers/gpu/drm/drm_edid.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index e5e7e65..08e914d 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -93,6 +93,11 @@ struct detailed_mode_closure { int modes; }; +struct edid_support_rb_closure { + struct edid *edid; + u8 support_rb; +}; + #define LEVEL_DMT 0 #define LEVEL_GTF 1 #define LEVEL_GTF2 2 @@ -2018,22 +2023,31 @@ struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev, is_rb(struct detailed_timing *t, void *data) { u8 *r = (u8 *)t; - if (r[3] == EDID_DETAIL_MONITOR_RANGE) - if (r[15] & 0x10) - *(bool *)data = true; + struct edid_support_rb_closure *closure = data; + struct edid *edid = closure->edid; + + if (!r[0] && !r[1] && !r[2] && r[3] == EDID_DETAIL_MONITOR_RANGE) { + if (edid->features & BIT(0) && r[10] == BIT(2)) + closure->support_rb = (r[15] & 0x10) ? 1 : 0; + } } /* EDID 1.4 defines this explicitly. For EDID 1.3, we guess, badly. */ static bool drm_monitor_supports_rb(struct edid *edid) { + struct edid_support_rb_closure closure = { + .edid = edid, + .support_rb = -1, + }; + if (edid->revision >= 4) { - bool ret = false; - drm_for_each_detailed_block((u8 *)edid, is_rb, &ret); - return ret; + drm_for_each_detailed_block((u8 *)edid, is_rb, &closure); + if (closure.support_rb >= 0) + return closure.support_rb; } - return ((edid->input & DRM_EDID_INPUT_DIGITAL) != 0); + return true; } static void -- 1.9.1