Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp6479014iob; Tue, 10 May 2022 20:57:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdWy7LOoO0ycHooEePzRCUsA/wUHY6ooDpvuiLEr4KszFWdoLm1PsZkqpZ2Tb30NzVeq3m X-Received: by 2002:aa7:d916:0:b0:425:d75f:ae68 with SMTP id a22-20020aa7d916000000b00425d75fae68mr26346057edr.270.1652241437486; Tue, 10 May 2022 20:57:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652241437; cv=none; d=google.com; s=arc-20160816; b=pVtB3IESHQJlCFEgMbbAXQTdZE2/Ztf2bdtYXNhoy7Z7LdnqU2amYaYNgqGLbeFXDU Z3dxer57gkIhQYrwS0+Ih8XjxoLSsJ5+qwsxvEAwyBLQvRoFRX9anZh+lp7KDqZvaITL Q41H8CzTGVuibvXZ91i7N7s54s/UeCC55YGNtNgNgel3c/RptrsngdjS5iL0iv1AXgPf 0ky9TnOFXN0aLC+IFeny093tDikeoM2qatzVL+jZQ1v1bt3kAC99sb8jSkDg8+Jh7yO4 G3lHd15nyT+6/o8cBwisk1nBqMXJocrFyxMuU1+hqJcv7kKG4Giu8dIY5RDcYiDZDPRR Kxag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=+HZZAVCUgB4PR5HOSv738zuWZd6viwdct4jZ4FZSIU0=; b=HNiOej7/8qbZlDEzIUaZCa3OGPZRKDCDcGukmZxdT/iHnMDGdB4MXadx7G9GseEQ/f XDoPgEnr9NiatLiqk0q8eARK/KC61nSQ9WsqkbjN2VtWslOySuE/YsGa5QmG7AvPVuqQ n/6WO8YQ1vJOIWAx31f6Mr+7f4ulZsDQYNZBdmVvO9xsxmm+C4gmxq36gG5jRZ5KRSEL gnaPrKsfL+DL8GfJ6JLyZ6qqgJxkxeI+Otc0vvGe8gVkLVdyC00fAiH0Mv2zObqMMBFE v+LF3L3LOMULtU2FfwbPL13HQsvRcMJ+51LBiOFI/EfTJ/ux/tNtZXK6LviP7fHht++N kIiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=oWmYD10T; 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 cw4-20020a170906478400b006e7f21f913dsi1736476ejc.233.2022.05.10.20.56.44; Tue, 10 May 2022 20:57:17 -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=oWmYD10T; 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 S232085AbiEJUxK (ORCPT + 99 others); Tue, 10 May 2022 16:53:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229728AbiEJUxH (ORCPT ); Tue, 10 May 2022 16:53:07 -0400 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38FC551E56 for ; Tue, 10 May 2022 13:53:06 -0700 (PDT) Received: by mail-pg1-x52d.google.com with SMTP id x12so15592479pgj.7 for ; Tue, 10 May 2022 13:53:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+HZZAVCUgB4PR5HOSv738zuWZd6viwdct4jZ4FZSIU0=; b=oWmYD10TXbpQiIJ/xzCl7IxKeJeRGHnNIYoe2NzGF8Z40b9A089yZu2d/GnlCuSqdo q6ZIKf55c1K3Q602V8ZhCPmbryBHAVSR29GFjetx8dPxfxwpeelua5Oe9dNh49PzFRnz msgXH2br9qxGT5GVAPoL2u6hWcb2Le2llWrms= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+HZZAVCUgB4PR5HOSv738zuWZd6viwdct4jZ4FZSIU0=; b=zaHvWK9yqUyWMXK1OBqIuhPixkx/xCluM31oICWK00bF4ovvW1jpfrU+kYNj4xLKbW //jz4x12vE6LGAfubYxw1J+o+RzNRqFIPgFPHWphrjiMvk+IeUbmHDD/Zt3KLdvZdAjf 5TkDPVhRx3pMFEIY0ooQ5ZmoVvxzqusyCM9AuGsq0uujXu9GqiZFuQd8HpCvfhBKSmIO PXvMZiCesG4G3jZX/vSGvatWciJ/6es8LrBeNP7wC8Hefatw/5Zzh+gW07z7hNmi/dHF hEmY37nv+Xakzoo9doT758POJ1RRpjx4I7S6uaDd/g3sUEC9ZFBCT/vneXsn42AfuVs4 AcBQ== X-Gm-Message-State: AOAM533AjBZnHA0WafTJ3LYr6iPen+ktLC3Rah7GGF3GoxppP3Mgo+Q/ oe9bgr68XhOyuAjuXinYDsJ9bQ== X-Received: by 2002:a62:d0c5:0:b0:50d:a467:3cc8 with SMTP id p188-20020a62d0c5000000b0050da4673cc8mr22146677pfg.81.1652215985737; Tue, 10 May 2022 13:53:05 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:6f08:624c:c762:d238]) by smtp.gmail.com with ESMTPSA id lr10-20020a17090b4b8a00b001d2edf4b513sm92975pjb.56.2022.05.10.13.53.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 May 2022 13:53:05 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org Cc: quic_abhinavk@quicinc.com, robdclark@gmail.com, swboyd@chromium.org, quic_aravindh@quicinc.com, ville.syrjala@linux.intel.com, tzimmermann@suse.de, linux-arm-msm@vger.kernel.org, jani.nikula@linux.intel.com, quic_sbillaka@quicinc.com, dmitry.baryshkov@linaro.org, freedreno@lists.freedesktop.org, quic_khsieh@quicinc.com, Douglas Anderson , Daniel Vetter , David Airlie , Maarten Lankhorst , Maxime Ripard , linux-kernel@vger.kernel.org Subject: [PATCH v2] drm/probe-helper: Default to 640x480 if no EDID Date: Tue, 10 May 2022 13:51:11 -0700 Message-Id: <20220510135101.v2.1.I31ec454f8d4ffce51a7708a8092f8a6f9c929092@changeid> X-Mailer: git-send-email 2.36.0.550.gb090851708-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.7 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,URIBL_BLOCKED autolearn=ham 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 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 --- Note that this is the second of two related and similar-sounding but different patches. See also ("drm/probe-helper: For DP, add 640x480 if all other modes are bad") [1]. I'm hoping to land _both_ of the patches since they address different issues. This patch addresses the case of a corrupt EDID and having 640x480 be the default in the "guessed" modes. The other patch handles the case where the EDID _isn't_ corrupt but all the modes listed can't be made with the existing situations. The two patches can land in either order. Also note that I didn't carry any Tested-by / Reviewed-by tags since the patch is now quite different. [1] https://lore.kernel.org/r/20220510131309.v2.2.I4ac7f55aa446699f8c200a23c10463256f6f439f@changeid Changes in v2: - Don't modify drm_add_modes_noedid() 'cause that'll break others - Set 640x480 as preferred in drm_helper_probe_single_connector_modes() drivers/gpu/drm/drm_probe_helper.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c index 682359512996..1fbb9a8c315c 100644 --- a/drivers/gpu/drm/drm_probe_helper.c +++ b/drivers/gpu/drm/drm_probe_helper.c @@ -516,8 +516,17 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector, count = drm_add_override_edid_modes(connector); if (count == 0 && (connector->status == connector_status_connected || - connector->status == connector_status_unknown)) + connector->status == connector_status_unknown)) { count = drm_add_modes_noedid(connector, 1024, 768); + + /* + * Give userspace a hint that we don't have a lot of confidence + * in these modes (we totally guessed) by marking 640x480 as + * preferred. This is low clock rate and incredibly common as + * a failsafe mode. + */ + drm_set_preferred_mode(connector, 640, 480); + } count += drm_helper_probe_add_cmdline_mode(connector); if (count == 0) goto prune; -- 2.36.0.550.gb090851708-goog