Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4666965iob; Sun, 8 May 2022 21:14:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwB0eJqw6WIpEYi1KpMxSa3Z51cWtuKviKPafchVCTHI6WkgpFtdL5FivLdf8/LZ0kpQEIk X-Received: by 2002:a65:55c8:0:b0:3c6:6833:5730 with SMTP id k8-20020a6555c8000000b003c668335730mr8793000pgs.325.1652069648369; Sun, 08 May 2022 21:14:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652069648; cv=none; d=google.com; s=arc-20160816; b=IGQaUensk3i+oQa3oI0wTN1G8uE4SOorm3YDItHI0PjEYRftVzkKE7FDiNXjcbWEcL si6F3kqmbKwdFKEaZ1bxjNvJcc2t295qqOFRJhn36awF1KgRYazIN4Rn8U0HzZRm93EC kq0i9JuSsO63+es9AHzgejtycfXFNuDJa3mw5FyE7X/m4+gRcwbQYgGuMSiEFg8F3b0b E77ngVTUepHFTWeU4rQ+JxasWvgO83U8XI7wXZ+/gwMehQ9TFLXru0iN1BByxAItAw5B ouzOh+nKYGhxFsKfJtRsJ7PmKKPQyNRLJUwTQ4guH6zOCAycCgCT/sDZqVPQT7dZ/Yh4 //Qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=NUSDpDYK9LHoRDYP/GAG5zI9+n9lXCiukOajpSWRp7U=; b=Yh5IQoCd2kmy6upZql/+GTEdFiO24Ra4F5VnY0xW45DBRfM0qvNwLeccq7SltSFsam bHSOITkYHVAXuknj3ANleF5e54+JwSDkW5oLZMf2P4gNy5M+Fq2L8OvvUmZjIDp3cyqm 4kLD+ovuqfEx5yOZ5VATf25fFUHAxkNmajja4bqgeyBRZirodkpchkgOLHqnY1zQzn/v mtdRp5J3s2lL8Aw/PyjJeUwzfFaHNALwn8BHNwlvX2ycJTw/3n0iOsWB1XwGPjg05Lvz j4kvp7U59rk+IMcBo9g/Z44Xc6SCDc6JOtl4EmWv1k91SdPv50miaEdw74WKu8HHHZaT fPeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=SCMfjvm7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id mu6-20020a17090b388600b001dc61ae509dsi20434481pjb.103.2022.05.08.21.14.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 21:14:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=SCMfjvm7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DC631110C04; Sun, 8 May 2022 21:12:16 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443823AbiEFQgz (ORCPT + 99 others); Fri, 6 May 2022 12:36:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443819AbiEFQgx (ORCPT ); Fri, 6 May 2022 12:36:53 -0400 Received: from alexa-out-sd-02.qualcomm.com (alexa-out-sd-02.qualcomm.com [199.106.114.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 796014EF6B; Fri, 6 May 2022 09:33:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1651854790; x=1683390790; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=NUSDpDYK9LHoRDYP/GAG5zI9+n9lXCiukOajpSWRp7U=; b=SCMfjvm7IPTy3aeW2103g5sLBIX2xC9SxjzYQQkcDoKpJnNW/H59zZd+ ZbdPuR+s3/HfqWCQEF2R8mG22kOyX7zbvK/mReS4+9lnhlImX8L27Wb8L mKb/f3AR6w9wcDDXgKNE/opK3ZRvUzQWE4DK1jcRPxqW84WM/j8btgpAZ Y=; Received: from unknown (HELO ironmsg-SD-alpha.qualcomm.com) ([10.53.140.30]) by alexa-out-sd-02.qualcomm.com with ESMTP; 06 May 2022 09:33:10 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg-SD-alpha.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2022 09:33:09 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Fri, 6 May 2022 09:33:09 -0700 Received: from [10.111.168.240] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Fri, 6 May 2022 09:33:04 -0700 Message-ID: <8ea03441-b835-f5db-5cc3-85e5330dfe3f@quicinc.com> Date: Fri, 6 May 2022 09:33:02 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.2 Subject: Re: [RFC PATCH] drm/edid: drm_add_modes_noedid() should set lowest resolution as preferred Content-Language: en-US To: Jani Nikula , Doug Anderson , dri-devel , =?UTF-8?B?VmlsbGUgU3lyasOkbMOk?= CC: Sankeerth Billakanti , Thomas Zimmermann , David Airlie , linux-arm-msm , Stephen Boyd , "Dmitry Baryshkov" , "Aravind Venkateswaran (QUIC)" , "Kuogee Hsieh (QUIC)" , LKML References: <20220426132121.RFC.1.I31ec454f8d4ffce51a7708a8092f8a6f9c929092@changeid> <874k22lxmh.fsf@intel.com> From: Abhinav Kumar In-Reply-To: <874k22lxmh.fsf@intel.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jani On 5/6/2022 4:16 AM, Jani Nikula wrote: > On Thu, 05 May 2022, Doug Anderson wrote: >> Ville, >> >> On Tue, Apr 26, 2022 at 1:21 PM Douglas Anderson wrote: >>> >>> If we're unable to read the EDID for a display because it's corrupt / >>> bogus / invalid then we'll add a set of standard modes for the >>> display. When userspace looks at these modes it doesn't really have a >>> good concept for which mode to pick and it'll likely pick the highest >>> resolution one by default. That's probably not ideal because the modes >>> were purely guesses on the part of the Linux kernel. >>> >>> Let's instead set 640x480 as the "preferred" mode when we have no EDID. >>> >>> Signed-off-by: Douglas Anderson >>> --- >>> >>> drivers/gpu/drm/drm_edid.c | 9 +++++++++ >>> 1 file changed, 9 insertions(+) >> >> Someone suggested that you might have an opinion on this patch and >> another one I posted recently [1]. Do you have any thoughts on it? >> Just to be clear: I'm hoping to land _both_ this patch and [1]. If you >> don't have an opinion, that's OK too. >> >> [1] https://lore.kernel.org/r/20220426114627.2.I4ac7f55aa446699f8c200a23c10463256f6f439f@changeid > > There are a number of drivers with combos: > > drm_add_modes_noedid() > drm_set_preferred_mode() > > which I think would be affected by the change. Perhaps you should just > call drm_set_preferred_mode() in your referenced patch? > So it seems like many drivers handle the !edid case within their respective get_modes() call which probably is because they know the max capability of their connector and because they know which mode should be set as preferred. But at the same time, perhaps the code below which handles the count == 0 case should be changed like below to make sure we are within the max_width/height of the connector (to handle the first condition)? diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c index 682359512996..6eb89d90777b 100644 --- a/drivers/gpu/drm/drm_probe_helper.c +++ b/drivers/gpu/drm/drm_probe_helper.c @@ -517,7 +517,8 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector, if (count == 0 && (connector->status == connector_status_connected || connector->status == connector_status_unknown)) - count = drm_add_modes_noedid(connector, 1024, 768); + count = drm_add_modes_noedid(connector, connector->dev->mode_config.max_width, + connector->dev->mode_config.max_height); count += drm_helper_probe_add_cmdline_mode(connector); if (count == 0) goto prune; > Alternatively, perhaps drm_set_preferred_mode() should erase the > previous preferred mode(s) if it finds a matching new preferred mode. > But still yes, even if we change it like above perhaps for other non-DP cases its still better to allow individual drivers to pick their preferred modes. If we call drm_set_preferred_mode() in the referenced patch, it will not address the no EDID cases because the patch comes into picture when there was a EDID with some modes but not with 640x480. So i think the second proposal is a good one. It will cover existing users of drm_set_preferred_mode() as typically its called after drm_add_modes_noedid() which means the existing users want to "override" their preferred mode. > > BR, > Jani. >