Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp150522pxb; Tue, 15 Feb 2022 10:12:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJxvEIXSOOs9LSCz9rJxUrgE5h+uApyUvBa5XUp8uuEnVi5dPN0Jp/WK8zoU1ghzqk9OqR6k X-Received: by 2002:a63:5a01:: with SMTP id o1mr114212pgb.306.1644948723896; Tue, 15 Feb 2022 10:12:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644948723; cv=none; d=google.com; s=arc-20160816; b=Ub3o4ixOKsZzFSqt1V/RU9Bl48gCD9c0frUDLpRexR6YCeFPujKmkv5azLHin+Nq77 TzvWH5Un01tU1MAWKcRZGkpeGyY4ksuwm3QpPAAJb61NFRqszfSBzsoyj/AM4dY8NBMh QqX6mhNhFVhAbTC83WuKsA+aDRX6csXlQh+orX/DyuD5kVtq9bM0T1m0HdZ/5fcOKk3S 0UwdjWjMzrfWrD23b3VUqQNTBrc1y9W0R0jAUboDQcRr/BdTr02sF7laxKEIb9bvR/u7 ESKUyvOxJ3g50U1Ek2R647Jenm6U9pNLj+E6+q/tK2sgdPpOgPlHO7hdYwH4RQIFlaDV nkKw== 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 :references:in-reply-to:message-id:subject:reply-to:cc:from:to :dkim-signature:date; bh=f1kG4y1Pad9UaeKLlKedqj/sm+OCsoIlrgJXYL6aSeI=; b=PtSsXJ4z+i85Or8Fer1HZo7MayBukR/Np7sK/McotIBZiTdunB+kCM07sWLViYeLmM +5BDxh+50nRP5xEg+J7yjVlCgjd9Kwg9MpFLt0jyuD93Ls7pW9m+jZg2hDrMG+bZXQF+ HAsniL5P4sLLmDMbQU9XTViAXe/TJeh5aiAaDg8Az6v1ib6xNI9Lejnci85c7VRVw29T TsY6sEHPLT9g/FrsCaFIOjpIQnrQeqqoqVvngMVApZ92X3rCCjhGw3KAtp5iesWpCgZO 5nWmZXwjjnfMvveVCLZAbIoipWwIHCX21OuuTvrHSQmWw+eQbhJ1XRLAC8b9MI90IyZc lEzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@emersion.fr header.s=protonmail2 header.b=E9V91jN8; 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=emersion.fr Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 70si3240943pgb.532.2022.02.15.10.11.46; Tue, 15 Feb 2022 10:12:03 -0800 (PST) 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=@emersion.fr header.s=protonmail2 header.b=E9V91jN8; 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=emersion.fr Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239981AbiBOQhe (ORCPT + 99 others); Tue, 15 Feb 2022 11:37:34 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:40154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233621AbiBOQhe (ORCPT ); Tue, 15 Feb 2022 11:37:34 -0500 X-Greylist: delayed 9703 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 15 Feb 2022 08:37:23 PST Received: from mail-4018.proton.ch (mail-4018.proton.ch [185.70.40.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 137D2A4184; Tue, 15 Feb 2022 08:37:23 -0800 (PST) Date: Tue, 15 Feb 2022 16:37:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emersion.fr; s=protonmail2; t=1644943039; bh=f1kG4y1Pad9UaeKLlKedqj/sm+OCsoIlrgJXYL6aSeI=; h=Date:To:From:Cc:Reply-To:Subject:Message-ID:In-Reply-To: References:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID; b=E9V91jN86xK6pzcMltPM69/bOQFFQNJV14lQwmcL2FYT3foga5gLBN44BK4oxAPri Vd8zuw1PuCIPGRg2//vtiVX9F2F6j/JTJL3odWwNmjV4QndYJ/cNzlL994kRk5oss4 t+oB5svlaOh0xBX9GF7yyVj1AjeFwDYEvnfX4LlK0wXUUANzluIiX7MMssmf+EtKXg j3TEQWNZHHEFFnC96soVMV8mnPbtAkLt2VhY0qKE/ctXlMHsckdPLAA5vi0D16WsVW ELSgf6c8NzeavnNPc22BI1Gvf+qHdGR5FmKWYe1aX8Wak2lhTUG3wpbv4id1Yx/OtQ 5XOlTjjx0fyLA== To: Emil Velikov From: Simon Ser Cc: Hsin-Yi Wang , ML dri-devel , David Airlie , Daniel Vetter , amd-gfx mailing list , Intel Graphics Development , Chun-Kuang Hu , devicetree , "Linux-Kernel@Vger. Kernel. Org" , Maxime Ripard , Alex Deucher , Rob Herring , linux-mediatek@lists.infradead.org, Thomas Zimmermann , Harry Wentland , Matthias Brugger , LAKML Reply-To: Simon Ser Subject: Re: [Intel-gfx] [PATCH v8 1/3] gpu: drm: separate panel orientation property creating and value setting Message-ID: In-Reply-To: References: <20220208084234.1684930-1-hsinyi@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 Tuesday, February 15th, 2022 at 15:38, Emil Velikov wrote: > On Tue, 15 Feb 2022 at 13:55, Simon Ser wrote: > > > > On Tuesday, February 15th, 2022 at 13:04, Emil Velikov wrote: > > > > > Greetings everyone, > > > > > > Padron for joining in so late o/ > > > > > > On Tue, 8 Feb 2022 at 08:42, Hsin-Yi Wang wrote= : > > > > > > > > drm_dev_register() sets connector->registration_state to > > > > DRM_CONNECTOR_REGISTERED and dev->registered to true. If > > > > drm_connector_set_panel_orientation() is first called after > > > > drm_dev_register(), it will fail several checks and results in foll= owing > > > > warning. > > > > > > > > Add a function to create panel orientation property and set default= value > > > > to UNKNOWN, so drivers can call this function to init the property = earlier > > > > , and let the panel set the real value later. > > > > > > > > > > The warning illustrates a genuine race condition, where userspace wil= l > > > read the old/invalid property value/state. So this patch masks away > > > the WARNING without addressing the actual issue. > > > Instead can we fix the respective drivers, so that no properties are > > > created after drm_dev_register()? > > > > > > Longer version: > > > As we look into drm_dev_register() it's in charge of creating the > > > dev/sysfs nodes (et al). Note that connectors cannot disappear at > > > runtime. > > > For panel orientation, we are creating an immutable connector > > > properly, meaning that as soon as drm_dev_register() is called we mus= t > > > ensure that the property is available (if applicable) and set to the > > > correct value. > > > > Unfortunately we can't quite do this. To apply the panel orientation qu= irks we > > need to grab the EDID of the eDP connector, and this happened too late = in my > > testing. > > > > What we can do is create the prop early during module load, and update = it when > > we read the EDID (at the place where we create it right now). User-spac= e will > > receive a hotplug event after the EDID is read, so will be able to pick= up the > > new value if any. > > Didn't quite get that, are you saying that a GETPROPERTY for the EDID, > the ioctl blocks or that we get an empty EDID? I'm not referring to GETPROPERTY, I'm referring to the driver getting the E= DID from the sink (here, the eDP panel). In my experimentations with amdgpu I noticed that the driver module load finished before the EDID was available = to the driver. Maybe other drivers behave differently and probe connectors whe= n loaded, not sure. > The EDID hotplug even thing is neat - sounds like it also signals on > panel orientation, correct? > On such an event, which properties userspace should be re-fetching - > everything or guess randomly? > > Looking through the documentation, I cannot see a clear answer :-\ User-space should re-fetch *all* properties. In practice some user-space ma= y only be fetching some properties, but that should get fixed in user-space. Also the kernel can indicate that only a single connector changed via the "CONNECTOR" uevent prop, or even a single connector property via "PROPERTY"= . See [1] for a user-space implementation. But all of this is purely an optio= nal optimization. Re-fetching all properties is a bit slower (especially if som= e drmModeGetConnector calls force-probe connectors) but works perfectly fine. It would be nice to document, if you have the time feel free to send a patc= h and CC danvet, pq and me. [1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/blob/252b2348bd62170d= 97c4e81fb2050f757b56d67e/backend/session/session.c#L144