Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp237259ioo; Thu, 26 May 2022 02:29:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgOykSv+FpWLkKJISNtEAaMUhBQeseq5dmFNzu6y7IWbqDwPwtdNh84oFRv2AvyGzrWN0+ X-Received: by 2002:aa7:cd4b:0:b0:42b:cd71:5e85 with SMTP id v11-20020aa7cd4b000000b0042bcd715e85mr6440179edw.207.1653557369663; Thu, 26 May 2022 02:29:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653557369; cv=none; d=google.com; s=arc-20160816; b=S8LKo1+U0TZfZRuyjn5/5eMp7wLVH16kFuQk0CSpFl8hWPflhOgv0f561BLaK/LU9p hD3JKO6uDZbmwiBJhGvgx+0cN4p5tMGWgTV8Nsv2LhNMAoF2qKTwz25IQlxGhKDN/43p rR4Le4GEv7oJYmSpj5uzSxujPEnYew0BAwsqFXup6HljGXL9pHR/lhATPHgb2wY3w/Zu H5DL/eQgwNqqSWJrjA9F+USNQfZ2Bsfit4WHvgMVS8yMpO31yHc21C8P8sgq3qhQQsY5 0/cO6acyyRxXB5yAxwKCl1xff4oI6sIraiZdBlyoeuv71lW7jOpWQXb1390B1SyaMZEj AE/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=oiTRf6EF/H3TBNBVZIGNJm3A9cOgQLVm1U6yDTQ2d5I=; b=r6uPM89Hs2xvKuLrmbcHeGv1fVpJleJAfX+GQcI8CWSFt586PnYOs6jfmu/YSSiaOq KyF5Ekj5vTW7ArJU+bd5x+Yyx31ZnZKC0zKHsl5t+K+/m4A1MLTQBrGdZZpteBpEzCYa uetgCcKJ80n7d2FMepiuFY011wgYnH8nXgqWyeEpwknv4PdY0u7e8D2VmDXXzoqLuAHM ZIPFSXOPigCFEy38zThlx2gNORpKuQmwzPw0LD93ZCa9fIVoYKkJG6oJuZhllLlny9hn HimuxvZ1Aq+k6YRGErJ6WQId49PC95RyPCPiHiRu74kOVUszCZt3sN0cwHfMTpZ909Ww cDsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="fs1lwK6/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lh3-20020a170906f8c300b006fec3821fcdsi986786ejb.364.2022.05.26.02.29.00; Thu, 26 May 2022 02:29:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="fs1lwK6/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345018AbiEZB2r (ORCPT + 99 others); Wed, 25 May 2022 21:28:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243733AbiEZB2q (ORCPT ); Wed, 25 May 2022 21:28:46 -0400 Received: from mail-vk1-xa32.google.com (mail-vk1-xa32.google.com [IPv6:2607:f8b0:4864:20::a32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 351849D070 for ; Wed, 25 May 2022 18:28:45 -0700 (PDT) Received: by mail-vk1-xa32.google.com with SMTP id b81so142078vkf.1 for ; Wed, 25 May 2022 18:28:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=oiTRf6EF/H3TBNBVZIGNJm3A9cOgQLVm1U6yDTQ2d5I=; b=fs1lwK6/6kqEgmHrQX6rxnyuN1F3qSBt6oZlGY/IgJSpxNNazl86s15U+QVeAweXiR e6K+dANWBE/D616R5uaxSIyjtWKMeZSMe8xcAZDhDA5mUPTWA/yrOPlxhZN2BW62jzVY lNQQhdz4wtvTJNq/yaBpzqsMj5a9tBTTmHJsY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=oiTRf6EF/H3TBNBVZIGNJm3A9cOgQLVm1U6yDTQ2d5I=; b=ehFWHocDjc+wxpvUB7aUtWvqmVawQVQkGqSMMVkIaLMbVyD8tUamoXwvuq6q+4kS3O 4QVSSvg6UhrS/EPWfASs7qkuH5FR3ycZTElhLfQIhHyPBD+C5sIuSO0oEgPKxVnouPCS PtYtzeNDLfJJ3LiiiCtJZZkNzjtzlOpYZtwc+SB9FZsyZORWHZ8zVidcbL/6MjcYSotL 9RWKvOg0B9n6J5/Kw4MN3+G82bS4piRB34wDw6+OiniP5O0J73LpabXxDFbbk1YCDlDU BEZslDrBUBwwOm6FJjSxPZa22y3A9oE69F0ZoTkmmLuEG219JrkbdRm+tI0LOuavzUzQ NHCg== X-Gm-Message-State: AOAM531QSRXQUZqBJgUxat3JHB9O8zPswp/tpAxE0c/FhBe4Sr1SPGW0 YUOJd8gCxAPejML2XMYfhVLp/qPkLqUaZb4+ X-Received: by 2002:a05:6122:d98:b0:331:47bf:b437 with SMTP id bc24-20020a0561220d9800b0033147bfb437mr13345642vkb.29.1653528524007; Wed, 25 May 2022 18:28:44 -0700 (PDT) Received: from mail-vk1-f178.google.com (mail-vk1-f178.google.com. [209.85.221.178]) by smtp.gmail.com with ESMTPSA id k23-20020a67e3d7000000b0032d275e6917sm12026vsm.23.2022.05.25.18.28.41 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 25 May 2022 18:28:41 -0700 (PDT) Received: by mail-vk1-f178.google.com with SMTP id ay20so132734vkb.5 for ; Wed, 25 May 2022 18:28:41 -0700 (PDT) X-Received: by 2002:a05:6122:221f:b0:343:f3d4:87cb with SMTP id bb31-20020a056122221f00b00343f3d487cbmr12802200vkb.13.1653528520525; Wed, 25 May 2022 18:28:40 -0700 (PDT) MIME-Version: 1.0 References: <20220513130533.v3.1.I31ec454f8d4ffce51a7708a8092f8a6f9c929092@changeid> <5857c510-9783-a483-8414-65d7350618d6@suse.de> In-Reply-To: From: Sean Paul Date: Wed, 25 May 2022 21:28:04 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3] drm/probe-helper: Make 640x480 first if no EDID To: Doug Anderson , Thomas Zimmermann , =?UTF-8?Q?St=C3=A9phane_Marchesin?= , dri-devel , "Aravind Venkateswaran (QUIC)" , "Kuogee Hsieh (QUIC)" , Jani Nikula , Rob Clark , Sankeerth Billakanti , =?UTF-8?B?VmlsbGUgU3lyasOkbMOk?= , "Abhinav Kumar (QUIC)" , Dmitry Baryshkov , Stephen Boyd , freedreno , linux-arm-msm , David Airlie , Maarten Lankhorst , Maxime Ripard , LKML , Sean Paul , Sean Paul Cc: Daniel Vetter Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,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 On Wed, May 25, 2022 at 9:26 AM Daniel Vetter wrote: > > On Mon, May 23, 2022 at 05:59:02PM -0700, Doug Anderson wrote: > > Hi, > > > > On Fri, May 20, 2022 at 5:01 PM Doug Anderson w= rote: > > > > > > Hi, > > > > > > On Mon, May 16, 2022 at 3:28 AM Thomas Zimmermann wrote: > > > > > > > > Hi Douglas, > > > > > > > > I understand that you're trying to tell userspace that the modelist= has > > > > been made up, but it's not something that should be done via fragil= e > > > > heuristics IMHO. > > > > > > > > I looked at the Chromium source code that you linked, but I cannot = say > > > > whether it's doing the correct thing. It all depends on what your > > > > program needs. > > > > > > > > In that function, you could also search for 'DRM_MODE_TYPE_USERDEF'= . > > > > It's the mode that the user specified on the kernel command line. I= f > > > > Chromium's automatic mode selection fails, you'd give your users di= rect > > > > control over it. > > > > > > That doesn't really work for Chrome OS. Certainly a kernel hacker > > > could do this, but it's not something I could imagine us exposing to > > > an average user of a Chromebook. > > > > > > > > > > When there's no flagged mode or if > > > > /sys/class/drm/card<...>/status contains "unconnected", you can ass= ume > > > > that the modelist is artificial and try the modes in an appropriate= order. > > > > > > So "no flagged" means that nothing is marked as preferred, correct? > > > > > > ...so I guess what you're suggesting is that the order that the kerne= l > > > is presenting the modes to userspace is not ABI. If there are no > > > preferred modes then userspace shouldn't necessarily assume that the > > > first mode returned is the best mode. Instead it should assume that i= f > > > there is no preferred mode then the mode list is made up and it shoul= d > > > make its own decisions about the best mode to start with. If this is > > > the ABI from the kernel then plausibly I could convince people to > > > change userspace to pick 640x480 first in this case. > > > > > > > If we really want the kernel to give additional guarantees, we shou= ld > > > > have a broader discussion about this topic IMHO. > > > > > > Sure. I've added St=C3=A9phane Marchesin to this thread in case he wa= nts to > > > chime in about anything. > > > > > > Overall, my take on the matter: > > > > > > * Mostly I got involved because, apparently, a DP compliance test was > > > failing. The compliance test was upset that when it presented us with > > > no EDID that we didn't default to 640x480. There was a push to make a > > > fix for this in the Qualcomm specific driver but that didn't sit righ= t > > > with me. > > > > > > * On all devices I'm currently working with (laptops), the DP is a > > > secondary display. If a user was trying to plug in a display with a > > > bad EDID and the max mode (1024x768) didn't work, they could just use > > > the primary display to choose a different resolution. It seems > > > unlikely a user would truly be upset and would probably be happy they > > > could get their broken display to work at all. Even if this is a > > > primary display, I believe there are documented key combos to change > > > the resolution of the primary display even if you can't see anything. > > > > > > * That all being said, defaulting to 640x480 when there's no EDID mad= e > > > sense to me, especially since it's actually defined in the DP spec. S= o > > > I'm trying to do the right thing and solve this corner case. That > > > being said, if it's truly controversial I can just drop it. > > > > > > > > > So I guess my plan will be to give St=C3=A9phane a little while in ca= se he > > > wants to chime in. If not then I guess I'll try a Chrome patch... > > > ...and if that doesn't work, I'll just drop it. > > > > OK, this userspace code seems to work: > > > > https://crrev.com/c/3662501 - ozone/drm: Try 640x480 before picking > > the first mode if no EDID > > > > ...so we'll see how review of that goes. :-) Mirroring some of my comments on that review here :-) IMO, this should be addressed in the kernel, or not at all. The kernel ensures other aspects of DisplayPort implementation are compliant, so I don't think this would be any exception. Further, the kernel is the one creating the "safe" mode list, so it seems odd that userspace would override that. Finally, relying on every userspace to do the right thing is asking for trouble (we have 3 places which would need this logic in CrOS). > > Yeah it sucks a bit but I'm mildly afraid that if we muck around with the > absolute fallback mode list in upstream we get whacked by a regression > report :-/ Yeah, this seems likely (unfortunately). > > There's the additional fun that on modern displays probably 720p (or mayb= e > 720i) is a lot more likely to work than anything else really, so best we > can do here maybe is to make it an uapi guarantee that if there's no > preferred mode, then most likely the kernel invent random noise out of > thin air, and userspace has to be careful and do its own magic heuristics= . > Or maybe we should add a flag for "this stuff is invented, buyer beware". > This seems like a reasonable compromise. Perhaps marking 640x480 as preferred would be a middle road? > I think clarifying that would be good. Changing defaults feels a bit too > risky, we had some really hilarious regression reports in the past along > the lines of the infamous xkcd. FWIW, I don't really have a strong opinion as to whether this should be fixed or not. I have a hard time believing that either 1024x768 or 640x480 would result in a happy result for the user, so we're really just choosing a mode which is bad enough for the user to unplug/replug. If 640x480 makes the compliance machine happy, I suppose that's a compelling reason, but I don't really feel like this is worth special casing each userspace. Sean > -Daniel > -- > Daniel Vetter > Software Engineer, Intel Corporation > http://blog.ffwll.ch