Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2254191pxp; Fri, 18 Mar 2022 06:48:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJytoS9J5cGaDUnjQA60U7Fa9g9uZoJ8p1OcUAEOg2UFHbErygVV79lKZA+g2nIJmCgJ/UV2 X-Received: by 2002:a05:6a00:158b:b0:4f8:e4a9:973f with SMTP id u11-20020a056a00158b00b004f8e4a9973fmr10177204pfk.2.1647611291981; Fri, 18 Mar 2022 06:48:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647611291; cv=none; d=google.com; s=arc-20160816; b=hFYsGOAZrdGJFGfBAMChP6zYkDrNfdi6bRSC19VAwmB3Oeq9r+cIyDtDyhC8llMYGW 4QDrabBvB+mb6++3mqoqsRVway+8u0I1xXF6NRS/h2dOwyUoOOJOfV/wdLhb6k5mx1zR rDHueU/oWu3sAqj5w1TTc4EWRC6+TlrZQ3/Tc8lPYB9FdtbSZIK0L+3J1ZY2uK4BU2Nj oBg1QD4JYyzjmpG5jN7+92aukCqAn73eQDCUT23khd1dSElaJdQhwpish9clavRe0MYx ZacDvzQEj8+I3mIm54HcASS5XEW+irIK1NeGgfE+Ib1in0Sx3kppkdvwT2JI+IhMSHqD 8cEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=0ogp3OEFkwZj8QEMXIkrMCD+Y2owy7GvkEn/U8LOX0o=; b=Fy/iIKkHRlkqzdo4HY0kkKdfUE3LMzyesLCXXtNJThb9XoWiwMskG4vHyM2c/Lbm6u pJPYdXhLFrSF1uzj26AUKHJmNvxaqHRtN6zwNxBCdYplrt3WZtjusdVsRpNQQzy2/wEp oRBP6zLNkt65iSHOCBwxB0ohMe3d30Shaws5fcSfjC3gOaeiOqfiZF5cvOEF8Kn/h7UU +a8aOZP36QHyJ+IADu307txv5VFdBzJFWrrcst/b6rB2is6X4ChCM7gBwqjKmpYqEaVK rgmznFwaJXK31MYJQH/UHnC/efZz24LNx0RdI+0/FdjQDavHcyglBhvvmpuyc+qnkGp6 7kZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Pf+BOEhy; 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 z3-20020a170902ee0300b00153ee8f2c7fsi1894580plb.7.2022.03.18.06.47.57; Fri, 18 Mar 2022 06:48:11 -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=Pf+BOEhy; 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 S231135AbiCRIbr (ORCPT + 99 others); Fri, 18 Mar 2022 04:31:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231201AbiCRIbo (ORCPT ); Fri, 18 Mar 2022 04:31:44 -0400 Received: from mail-ua1-x929.google.com (mail-ua1-x929.google.com [IPv6:2607:f8b0:4864:20::929]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E058727CE0E for ; Fri, 18 Mar 2022 01:30:24 -0700 (PDT) Received: by mail-ua1-x929.google.com with SMTP id v20so2686887uat.9 for ; Fri, 18 Mar 2022 01:30:24 -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; bh=0ogp3OEFkwZj8QEMXIkrMCD+Y2owy7GvkEn/U8LOX0o=; b=Pf+BOEhya9aXXbYBUeUOBRRU7JhM5PstNvwRvh4CwFFLDHwwrqRxswcdt7fceLlQ9h SbVt99hG/N/i2Yg1eI/N/pWGYA9GiLlX6qOIAZDvSYRQRWu4G4Uag0C3btZqkT4cjcZV PKWRNnFOICcYpYs0aSRQn9QSo4YoxNA0h7fi8= 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; bh=0ogp3OEFkwZj8QEMXIkrMCD+Y2owy7GvkEn/U8LOX0o=; b=4huRNitQCN/Dbp/pte0biPIZXUR1l5oyJwyOQcxTRwgv+1JPA3z5JxWBr6fKD89Dk3 qWrQt4QwrYEtxa+tC9kDqWV45ywNb0gFcnNb4nHQJMne7ZkXvsa7Uu98+S4Zy82wceui TjuO1DRCnroM/nVpkLVXOPawx6fUGIglgIkYMpZHyVL1+ZM+idTjkglHSF2oKeVHYni/ O1r1xnuRvhPVGZaNW6ftORIqf5FEQ5nQGY2/jmM8gyJMDX+ObzpdXzJWbcxrhKBVWYnQ DCUFwc2tUpzIRZLAW/Q4E5t00NR1WNvEuTRTCpTwxAHmelkz6E+exTF94VOUwAlQ/KsQ udyA== X-Gm-Message-State: AOAM5327zNjr44N7DQuuKx9ZWhLpcIUzpszfzRhq04aNV9lmvrTv3a0Y 7sziTYfh7aqPvj1ggEho6f5pzLg/jDygOftKUTp7zz7oWomYmA== X-Received: by 2002:ab0:2619:0:b0:354:ccac:32f with SMTP id c25-20020ab02619000000b00354ccac032fmr578951uao.46.1647592223830; Fri, 18 Mar 2022 01:30:23 -0700 (PDT) MIME-Version: 1.0 References: <20220208084234.1684930-1-hsinyi@chromium.org> <16c1886f-d130-b299-9d09-ad11556f3bfd@amd.com> In-Reply-To: <16c1886f-d130-b299-9d09-ad11556f3bfd@amd.com> From: Hsin-Yi Wang Date: Fri, 18 Mar 2022 16:29:57 +0800 Message-ID: Subject: Re: [Intel-gfx] [PATCH v8 1/3] gpu: drm: separate panel orientation property creating and value setting To: Harry Wentland Cc: Simon Ser , Hans de Goede , Emil Velikov , Maxime Ripard , Chun-Kuang Hu , Thomas Zimmermann , devicetree , David Airlie , Intel Graphics Development , "Linux-Kernel@Vger. Kernel. Org" , amd-gfx mailing list , Matthias Brugger , Rob Herring , linux-mediatek@lists.infradead.org, ML dri-devel , Alex Deucher , LAKML , Daniel Vetter Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3.6 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=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 On Fri, Feb 18, 2022 at 11:57 PM Harry Wentland wrote: > > On 2022-02-18 07:12, Simon Ser wrote: > > On Friday, February 18th, 2022 at 12:54, Hans de Goede wrote: > > > >> On 2/18/22 12:39, Simon Ser wrote: > >>> On Friday, February 18th, 2022 at 11:38, Hans de Goede wrote: > >>> > >>>> What I'm reading in the above is that it is being considered to allow > >>>> changing the panel-orientation value after the connector has been made > >>>> available to userspace; and let userspace know about this through a uevent. > >>>> > >>>> I believe that this is a bad idea, it is important to keep in mind here > >>>> what userspace (e.g. plymouth) uses this prorty for. This property is > >>>> used to rotate the image being rendered / shown on the framebuffer to > >>>> adjust for the panel orientation. > >>>> > >>>> So now lets assume we apply the correct upside-down orientation later > >>>> on a device with an upside-down mounted LCD panel. Then on boot the > >>>> following could happen: > >>>> > >>>> 1. amdgpu exports a connector for the LCD panel to userspace without > >>>> setting panel-orient=upside-down > >>>> 2. plymouth sees this and renders its splash normally, but since the > >>>> panel is upside-down it will now actually show upside-down > >>> > >>> At this point amdgpu hasn't probed the connector yet. So the connector > >>> will be marked as disconnected, and plymouth shouldn't render anything. > >> > >> If before the initial probe of the connector there is a /dev/dri/card0 > >> which plymouth can access, then plymouth may at this point decide > >> to disable any seemingly unused crtcs, which will make the screen go black... > >> > >> I'm not sure if plymouth will actually do this, but AFAICT this would > >> not be invalid behavior for a userspace kms consumer to do and I > >> believe it is likely that mutter will disable unused crtcs. > >> > >> IMHO it is just a bad idea to register /dev/dri/card0 with userspace > >> before the initial connector probe is done. Nothing good can come > >> of that. > >> > >> If all the exposed connectors initially are going to show up as > >> disconnected anyways what is the value in registering /dev/dri/card0 > >> with userspace early ? > > > > OK. I'm still unsure how I feel about this, but I think I agree with > > you. That said, the amdgpu architecture is quite involved with multiple > > abstraction levels, so I don't think I'm equipped to write a patch to > > fix this... > > > > amdgpu_dm's connector registration already triggers a detection. See the > calls to dc_link_detect and amdgpu_dm_update_connector_after_detect in > amdgpu_dm_initialize_drm_device. > > dc_link_detect is supposed to read the edid via > dm_helpers_read_local_edid and amdgpu_dm_update_connector_after_detect > will update the EDID on the connector via a > drm_connector_update_edid_property call. > > This all happens at driver load. > > I don't know why you're seeing the embedded connector as disconnected > unless the DP-MIPI bridge for some reason doesn't indicate that the panel > is connected at driver load. > > Harry > > > cc Daniel Vetter: can you confirm probing all connectors is a good thing > > to do on driver module load? > > > >>>> I guess the initial modeline is inherited from the video-bios, but > >>>> what about the physical size? Note that you cannot just change the > >>>> physical size later either, that gets used to determine the hidpi > >>>> scaling factor in the bootsplash, and changing that after the initial > >>>> bootsplash dislay will also look ugly > >>>> > >>>> b) Why you need the edid for the panel-orientation property at all, > >>>> typically the edid prom is part of the panel and the panel does not > >>>> know that it is mounted e.g. upside down at all, that is a property > >>>> of the system as a whole not of the panel as a standalone unit so > >>>> in my experience getting panel-orient info is something which comes > >>>> from the firmware /video-bios not from edid ? > >>> > >>> This is an internal DRM thing. The orientation quirks logic uses the > >>> mode size advertised by the EDID. > >> > >> The DMI based quirking does, yes. But e.g. the quirk code directly > >> reading this from the Intel VBT does not rely on the mode. > >> > >> But if you are planning on using a DMI based quirk for the steamdeck > >> then yes that needs the mode. > >> > >> Thee mode check is there for 2 reasons: > >> > >> 1. To avoid also applying the quirk to external displays, but > >> I think that that is also solved in most drivers by only checking for > >> a quirk at all on the eDP connector > >> > >> 2. Some laptop models ship with different panels in different badges > >> some of these are portrait (so need a panel-orient) setting and others > >> are landscape. > > > > That makes sense. So yeah the EDID mode based matching logic needs to > > stay to accomodate for these cases. > > > >>> I agree that at least in the Steam > >>> Deck case it may not make a lot of sense to use any info from the > >>> EDID, but that's needed for the current status quo. > >> > >> We could extend the DMI quirk mechanism to allow quirks which don't > >> do the mode check, for use on devices where we can guarantee neither > >> 1 nor 2 happens, then amdgpu could call the quirk code early simply > >> passing 0x0 as resolution. > > > > Yeah. But per the above amdgpu should maybe probe connectors on module > > load. If/when amdgpu is fixed to do this, then we don't need to disable > > the mode matching logic in panel-orientation quirks anymore. > Hi all, Thanks for all of the discussion. I'm not sure about how amd drm works, but for some SoC, the panel orientation is set in panel[1]. The goal of this patch is to separate the property creation, so some drm can optionally create it earlier before drm_dev_register(). I've sent the v9 to address some issues in v8, but the basic idea is still the same. It has no effect to drm_connector_set_panel_orientation_with_quirk() used in amdgpu and i915, they work the same as before. Do you think this is reasonable? [1] https://elixir.bootlin.com/linux/v5.17-rc7/source/drivers/gpu/drm/panel/panel-edp.c#L556