Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp298691ybl; Wed, 11 Dec 2019 18:40:53 -0800 (PST) X-Google-Smtp-Source: APXvYqwszvynTGzkf5FUlS3qbcnhR+BWZoII10Df9Djt+OwItAC8kn45IOkb/RsHMG8xW8nXM8Hp X-Received: by 2002:a05:6830:11d3:: with SMTP id v19mr5597699otq.322.1576118453816; Wed, 11 Dec 2019 18:40:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576118453; cv=none; d=google.com; s=arc-20160816; b=f4XcH1tGhKo6oX8atWOgAB7lRpM82xFFapM83gIOuzMe1Hq/Rr8vSc3MaYvxLVHPXd S4wzV8FBPbugP+qO3jbkHBKbHf07bQjgF9T0UXfsae8R+pxLSLpvOdSJE7e57R3wKWJZ OOC3Uf1KNt7lbJ+70Mr41g5ojaA6Irwzqc8UmkIdRrHZpfzBOkiXiGi8CpwXcDKS3uj+ iqOOUgHJOe8n0mePpB1WkarQ1hwgcvjjk9D5ZcZMeS2AL3PfnRXSOnRyiS+oVfbYvEP9 QnviwUGb7PGYbzSEWLS7IlwtfbR3sq8yJ8pVFKqHiHOCjUFqDO/qIhf8xGkekH8hM1tj NONg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:mime-version:message-id:date:subject :cc:from; bh=kpeHh8dc/aU4U+cT+Q3yNtWNKq0FWNq5HDSI7VPGUpc=; b=ld5Fv4zLsGnpbOQl931c+wlAZZeiMi1eJBFStyMXmSEuh/OPcobpKnIIGkgRNkOjEB PyUxnzAqb7pGDoY8/t1OkNqX3QWxg7gazQdJDNF6cZ/S7ATnpNrNTK4EVFFb9n0n3S42 SpRjoRaFdGIled1+HGRnoOU+Cj3ozssqivpmBbU7ZRLzZln0O9jKckl6ePTebI/tHbt3 Yz6H27alY0Iref4WSKbd6uYr+TVPq2zKD6M1zQlQ0lrzvXP2hmV5MLoYN746DgsEFzfz 3s8Zxon4uj/A6ZMUrVAo2nGYe4JzTDTFs/XHUCOO0W8yzFIGSiadminiA+9XIslY+Cc6 a4Eg== 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 a17si2216378otr.178.2019.12.11.18.40.41; Wed, 11 Dec 2019 18:40:53 -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 S1727835AbfLLCjf (ORCPT + 99 others); Wed, 11 Dec 2019 21:39:35 -0500 Received: from 60-251-196-230.HINET-IP.hinet.net ([60.251.196.230]:47361 "EHLO ironport.ite.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727652AbfLLCjf (ORCPT ); Wed, 11 Dec 2019 21:39:35 -0500 Received: from unknown (HELO mse.ite.com.tw) ([192.168.35.30]) by ironport.ite.com.tw with ESMTP; 12 Dec 2019 10:39:33 +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 xBC2dSJ3065779; Thu, 12 Dec 2019 10:39:28 +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; Thu, 12 Dec 2019 10:39:28 +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 v2] drm/edid: fixup EDID 1.4 judge reduced-blanking timings logic Date: Thu, 12 Dec 2019 10:33:42 +0800 Message-ID: <1576118022-4347-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 X-Originating-IP: [192.168.70.14] X-MAIL: mse.ite.com.tw xBC2dSJ3065779 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 byte 0 = 0x00, byte 1 = 0x00, byte 2 = 0x00 and byte 3 = 0xFD Second: read EDID bit 0 in feature support byte at address 18h = 1 and detailed timing descriptor byte 10 = 0x04 Third: if EDID bit 0 in feature support byte = 1 && detailed timing descriptor byte 10 = 0x04 then we can check byte 15, if bit 4 in byte 15 = 1 is support RB if EDID bit 0 in feature support byte != 1 || detailed timing descriptor byte 10 != 0x04, then byte 15 can not be used The linux code is_rb function not follow the VESA's rule Signed-off-by: Allen Chen Reported-by: kbuild test robot --- drivers/gpu/drm/drm_edid.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index f5926bf..826ed78 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -2017,13 +2017,21 @@ struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev, } } +static bool +is_display_descriptor(const u8 *r, u8 tag) +{ + return (!r[0] && !r[1] && !r[2] && r[3] == tag) ? true : false; +} + static void 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; + + if (is_display_descriptor(r, EDID_DETAIL_MONITOR_RANGE)) { + if (r[10] == BIT(2)) + *(int *)data = !!(r[15] & 0x10); + } } /* EDID 1.4 defines this explicitly. For EDID 1.3, we guess, badly. */ @@ -2031,9 +2039,13 @@ struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev, drm_monitor_supports_rb(struct edid *edid) { if (edid->revision >= 4) { - bool ret = false; - drm_for_each_detailed_block((u8 *)edid, is_rb, &ret); - return ret; + if (edid->features & BIT(0)) { + int ret = -1; + + drm_for_each_detailed_block((u8 *)edid, is_rb, &ret); + if (ret != -1) + return ret; + } } return ((edid->input & DRM_EDID_INPUT_DIGITAL) != 0); -- 1.9.1