From patchwork Mon Oct 18 08:47:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Ser X-Patchwork-Id: 12565365 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C105C433EF for ; Mon, 18 Oct 2021 08:47:45 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4B6046126A for ; Mon, 18 Oct 2021 08:47:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4B6046126A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=emersion.fr Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E2A846E863; Mon, 18 Oct 2021 08:47:40 +0000 (UTC) Received: from mail-4317.proton.ch (mail-4317.proton.ch [185.70.43.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9CB1289DA6 for ; Mon, 18 Oct 2021 08:47:35 +0000 (UTC) Date: Mon, 18 Oct 2021 08:47:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emersion.fr; s=protonmail; t=1634546853; bh=FLiBIxB5ERncQvVQfq90RgTp8lZtwv3T5LHXkh2ltJg=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=fkGe2v2k7gozYgHUHMtARzIepdGyWYjM/KBeVC/V+qM3o0SNNS+ZH8lT/LwUYkX9Y XuJAth+5YhnhUqz34My+exhb5zCpz74wPJJFtboilYuPV/TCW37/5Pl6zUPjeVpbxR 4Va/Q+Z0lo7Fdyg3EFrRE4UMIXUwxz0D4JArW8Wpo4kH5hZ45nfrtq+ZLFIqsnZXuq 3w/YRl0vzs8/asuRwOrSozI319+RfaOnhtVlVAvM6BiJ2Crdo+Q+B9RZaB4nzlhUqg erWuulFE9nWw28Xreecq/jBehCAhotamDSviyeyEXMEQJczqOS4fsYjLePv0adqPOU H///KoV05TEvw== To: dri-devel@lists.freedesktop.org From: Simon Ser Cc: Sam Ravnborg , Harry Wentland Subject: [PATCH v4 1/6] drm/sysfs: introduce drm_sysfs_connector_hotplug_event Message-ID: <20211018084707.32253-2-contact@emersion.fr> In-Reply-To: <20211018084707.32253-1-contact@emersion.fr> References: <20211018084707.32253-1-contact@emersion.fr> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Simon Ser Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This function sends a hotplug uevent with a CONNECTOR property. Signed-off-by: Simon Ser Reviewed-by: Sam Ravnborg Acked-by: Harry Wentland --- drivers/gpu/drm/drm_sysfs.c | 25 +++++++++++++++++++++++++ include/drm/drm_sysfs.h | 1 + 2 files changed, 26 insertions(+) diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c index 76ff6ec3421b..430e00b16eec 100644 --- a/drivers/gpu/drm/drm_sysfs.c +++ b/drivers/gpu/drm/drm_sysfs.c @@ -409,6 +409,31 @@ void drm_sysfs_hotplug_event(struct drm_device *dev) } EXPORT_SYMBOL(drm_sysfs_hotplug_event); +/** + * drm_sysfs_connector_hotplug_event - generate a DRM uevent for any connector + * change + * @connector: connector which has changed + * + * Send a uevent for the DRM connector specified by @connector. This will send + * a uevent with the properties HOTPLUG=1 and CONNECTOR. + */ +void drm_sysfs_connector_hotplug_event(struct drm_connector *connector) +{ + struct drm_device *dev = connector->dev; + char hotplug_str[] = "HOTPLUG=1", conn_id[21]; + char *envp[] = { hotplug_str, conn_id, NULL }; + + snprintf(conn_id, sizeof(conn_id), + "CONNECTOR=%u", connector->base.id); + + drm_dbg_kms(connector->dev, + "[CONNECTOR:%d:%s] generating connector hotplug event\n", + connector->base.id, connector->name); + + kobject_uevent_env(&dev->primary->kdev->kobj, KOBJ_CHANGE, envp); +} +EXPORT_SYMBOL(drm_sysfs_connector_hotplug_event); + /** * drm_sysfs_connector_status_event - generate a DRM uevent for connector * property status change diff --git a/include/drm/drm_sysfs.h b/include/drm/drm_sysfs.h index d454ef617b2c..6273cac44e47 100644 --- a/include/drm/drm_sysfs.h +++ b/include/drm/drm_sysfs.h @@ -11,6 +11,7 @@ int drm_class_device_register(struct device *dev); void drm_class_device_unregister(struct device *dev); void drm_sysfs_hotplug_event(struct drm_device *dev); +void drm_sysfs_connector_hotplug_event(struct drm_connector *connector); void drm_sysfs_connector_status_event(struct drm_connector *connector, struct drm_property *property); #endif From patchwork Mon Oct 18 08:47:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Ser X-Patchwork-Id: 12565359 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED8EFC433FE for ; Mon, 18 Oct 2021 08:47:36 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B952E60F02 for ; Mon, 18 Oct 2021 08:47:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B952E60F02 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=emersion.fr Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4E12388E41; Mon, 18 Oct 2021 08:47:35 +0000 (UTC) Received: from mail-4323.proton.ch (mail-4323.proton.ch [185.70.43.23]) by gabe.freedesktop.org (Postfix) with ESMTPS id A924F88EF2 for ; Mon, 18 Oct 2021 08:47:33 +0000 (UTC) Date: Mon, 18 Oct 2021 08:47:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emersion.fr; s=protonmail; t=1634546851; bh=+y0rRtkssxzbjvE8UQNuS0lAQ3Z8DvWBR4Uu8yw+/UQ=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=ofvSsBMv5bTcGKh5yB1e+vktQxS+GHSgRbQXKIpP0m6Yl5mNRNh234VwoFlfs9lNj yt5oVQEraNRHXpOl/mrkvH7Acb5K9znCaEkVRiupvHviy5jwsQ03OhBE7r9PEL1dlR 6GrycMfqI7mD690CECJeN6nFYkiEXKP+KTRvMrhtBxmOLFZ3hBkQfWGWuubWAkFkAj zkty9XvvdUfINc5iFT9Do5dcBASLTqsOWp+WTkXln/DpRlT639BjEJdEQjKcqawqio MuqEXIFwXeHSR9h54IOhW7+nnn84kU7MvfkMMkYTSOkg5i+6CJmWN0VViC/3aRLKHZ FSah0XGnYPAMw== To: dri-devel@lists.freedesktop.org From: Simon Ser Cc: Sam Ravnborg , Harry Wentland Subject: [PATCH v4 2/6] drm/probe-helper: add drm_kms_helper_connector_hotplug_event Message-ID: <20211018084707.32253-3-contact@emersion.fr> In-Reply-To: <20211018084707.32253-1-contact@emersion.fr> References: <20211018084707.32253-1-contact@emersion.fr> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Simon Ser Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This function is the same as drm_kms_helper_hotplug_event, but takes a connector instead of a device. Signed-off-by: Simon Ser Reviewed-by: Sam Ravnborg Acked-by: Harry Wentland --- drivers/gpu/drm/drm_probe_helper.c | 23 +++++++++++++++++++++++ include/drm/drm_probe_helper.h | 1 + 2 files changed, 24 insertions(+) diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c index 61d5c57f23e1..3aef3b188c99 100644 --- a/drivers/gpu/drm/drm_probe_helper.c +++ b/drivers/gpu/drm/drm_probe_helper.c @@ -604,6 +604,9 @@ EXPORT_SYMBOL(drm_helper_probe_single_connector_modes); * * This function must be called from process context with no mode * setting locks held. + * + * If only a single connector has changed, consider calling + * drm_kms_helper_connector_hotplug_event() instead. */ void drm_kms_helper_hotplug_event(struct drm_device *dev) { @@ -616,6 +619,26 @@ void drm_kms_helper_hotplug_event(struct drm_device *dev) } EXPORT_SYMBOL(drm_kms_helper_hotplug_event); +/** + * drm_kms_helper_connector_hotplug_event - fire off a KMS connector hotplug event + * @connector: drm_connector which has changed + * + * This is the same as drm_kms_helper_hotplug_event(), except it fires a more + * fine-grained uevent for a single connector. + */ +void drm_kms_helper_connector_hotplug_event(struct drm_connector *connector) +{ + struct drm_device *dev = connector->dev; + + /* send a uevent + call fbdev */ + drm_sysfs_connector_hotplug_event(connector); + if (dev->mode_config.funcs->output_poll_changed) + dev->mode_config.funcs->output_poll_changed(dev); + + drm_client_dev_hotplug(dev); +} +EXPORT_SYMBOL(drm_kms_helper_connector_hotplug_event); + static void output_poll_execute(struct work_struct *work) { struct delayed_work *delayed_work = to_delayed_work(work); diff --git a/include/drm/drm_probe_helper.h b/include/drm/drm_probe_helper.h index 04c57564c397..48300aa6ca71 100644 --- a/include/drm/drm_probe_helper.h +++ b/include/drm/drm_probe_helper.h @@ -20,6 +20,7 @@ void drm_kms_helper_poll_fini(struct drm_device *dev); bool drm_helper_hpd_irq_event(struct drm_device *dev); bool drm_connector_helper_hpd_irq_event(struct drm_connector *connector); void drm_kms_helper_hotplug_event(struct drm_device *dev); +void drm_kms_helper_connector_hotplug_event(struct drm_connector *connector); void drm_kms_helper_poll_disable(struct drm_device *dev); void drm_kms_helper_poll_enable(struct drm_device *dev); From patchwork Mon Oct 18 08:47:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Ser X-Patchwork-Id: 12565363 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91CC2C433F5 for ; Mon, 18 Oct 2021 08:47:43 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6141860F02 for ; Mon, 18 Oct 2021 08:47:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6141860F02 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=emersion.fr Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3C57F6E99C; Mon, 18 Oct 2021 08:47:41 +0000 (UTC) Received: from mail-4317.proton.ch (mail-4317.proton.ch [185.70.43.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 04E976E863 for ; Mon, 18 Oct 2021 08:47:38 +0000 (UTC) Date: Mon, 18 Oct 2021 08:47:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emersion.fr; s=protonmail; t=1634546857; bh=Jx0zqIs5J+6c24AqW5pjPuGzBZVQzXp/EKgdk/kIofA=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=ULbcMOroDHSJJ+13v4bZUf+sAUWy7AAzcI5wtlYtrZrH6c42tuzV2I+BR5wwLlrW2 CGJvPX9Z79dtIIJW4dic1UQn0EnGZoI6D0TUtpT5lOVAGOaScll455qKSBBj5HXfyG 9IBZtrmwv4vdMn63UcZ/ado9GMXazK+GefD5sTeeFWuq8pwIc8/ERrymKCf5F0oq08 BIhELUWtwgWW51xbidMyNPePX3VyU2Hb7jLYzDhM5/ewwZIITVpTbC3v96ceeaGpjy 9X5JGnMthtbS5SUCIE4zrZzj8QMNsOLloaseHeyxu23h0i/kmnOs7MnvdwaDdxzXH5 7TtmD0WlPiSfQ== To: dri-devel@lists.freedesktop.org From: Simon Ser Cc: Sam Ravnborg , Harry Wentland Subject: [PATCH v4 3/6] drm/connector: use drm_sysfs_connector_hotplug_event Message-ID: <20211018084707.32253-4-contact@emersion.fr> In-Reply-To: <20211018084707.32253-1-contact@emersion.fr> References: <20211018084707.32253-1-contact@emersion.fr> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Simon Ser Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" In drm_connector_register, use drm_sysfs_connector_hotplug_event instead of drm_sysfs_hotplug_event, because the hotplug event only updates a single connector. Signed-off-by: Simon Ser Reviewed-by: Sam Ravnborg Acked-by: Harry Wentland --- drivers/gpu/drm/drm_connector.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index ec3973e8963c..a50c82bc2b2f 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -547,7 +547,7 @@ int drm_connector_register(struct drm_connector *connector) connector->registration_state = DRM_CONNECTOR_REGISTERED; /* Let userspace know we have a new connector */ - drm_sysfs_hotplug_event(connector->dev); + drm_sysfs_connector_hotplug_event(connector); if (connector->privacy_screen) drm_privacy_screen_register_notifier(connector->privacy_screen, From patchwork Mon Oct 18 08:47:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Ser X-Patchwork-Id: 12565357 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6787AC433F5 for ; Mon, 18 Oct 2021 08:47:35 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 35F7160F8F for ; Mon, 18 Oct 2021 08:47:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 35F7160F8F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=emersion.fr Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8840F88EF2; Mon, 18 Oct 2021 08:47:34 +0000 (UTC) Received: from mail-40136.proton.ch (mail-40136.proton.ch [185.70.40.136]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3223488EF2 for ; Mon, 18 Oct 2021 08:47:33 +0000 (UTC) Date: Mon, 18 Oct 2021 08:47:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emersion.fr; s=protonmail; t=1634546851; bh=/dqjXplC+oBAE/kPn3VVB9eqTT/0NviN+bQY0r1Si6o=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=uIhwPSTwONNnqRz2Ugxk+3+Lg9pWw1iUXZ9nqGBI00rNNKa3u2B8AWsYLvFVBeW5M QfHYN5URtMo00T2PvMrtweKpAd09Ehfoj6YTpJrRIQHXY3jadtSuf0ES86ECkrBqtQ jOc1KuVnbbNqbnc5pOj7GZb0x4pdueNb1j20Vzi5hs4eQybHjebJgCNT8w2ed1ogGC 3B9m7f2WB7BHQ2trYhWTcOW9QP0GSne6pFszavqN+6ti245izIKo1ePdxGxyRziJ06 TfjzAnhpbj/VPH4BEGgeyArxs+vyF2iOO6NC+fQT1ra35f2M+AZ5yEPdQ8gkHQibee kjksZsdKdaerQ== To: dri-devel@lists.freedesktop.org From: Simon Ser Cc: Harry Wentland Subject: [PATCH v4 4/6] amdgpu: use drm_kms_helper_connector_hotplug_event Message-ID: <20211018084707.32253-5-contact@emersion.fr> In-Reply-To: <20211018084707.32253-1-contact@emersion.fr> References: <20211018084707.32253-1-contact@emersion.fr> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Simon Ser Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" When updating a single connector, use drm_kms_helper_connector_hotplug_event instead of drm_kms_helper_hotplug_event. Signed-off-by: Simon Ser Reviewed-by: Harry Wentland --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 8 ++++---- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 9b1fc54555ee..c261e57d9a22 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -2652,7 +2652,7 @@ static void handle_hpd_irq(void *param) drm_modeset_unlock_all(dev); if (aconnector->base.force == DRM_FORCE_UNSPECIFIED) - drm_kms_helper_hotplug_event(dev); + drm_kms_helper_connector_hotplug_event(connector); } else if (dc_link_detect(aconnector->dc_link, DETECT_REASON_HPD)) { if (new_connection_type == dc_connection_none && @@ -2666,7 +2666,7 @@ static void handle_hpd_irq(void *param) drm_modeset_unlock_all(dev); if (aconnector->base.force == DRM_FORCE_UNSPECIFIED) - drm_kms_helper_hotplug_event(dev); + drm_kms_helper_connector_hotplug_event(connector); } mutex_unlock(&aconnector->hpd_lock); @@ -2833,7 +2833,7 @@ static void handle_hpd_rx_irq(void *param) dm_restore_drm_connector_state(dev, connector); drm_modeset_unlock_all(dev); - drm_kms_helper_hotplug_event(dev); + drm_kms_helper_connector_hotplug_event(connector); } else if (dc_link_detect(dc_link, DETECT_REASON_HPDRX)) { if (aconnector->fake_enable) @@ -2846,7 +2846,7 @@ static void handle_hpd_rx_irq(void *param) dm_restore_drm_connector_state(dev, connector); drm_modeset_unlock_all(dev); - drm_kms_helper_hotplug_event(dev); + drm_kms_helper_connector_hotplug_event(connector); } } #ifdef CONFIG_DRM_AMD_DC_HDCP diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c index 87daa78a32b8..23e789855d17 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c @@ -1241,7 +1241,7 @@ static ssize_t trigger_hotplug(struct file *f, const char __user *buf, dm_restore_drm_connector_state(dev, connector); drm_modeset_unlock_all(dev); - drm_kms_helper_hotplug_event(dev); + drm_kms_helper_connector_hotplug_event(connector); } else if (param[0] == 0) { if (!aconnector->dc_link) goto unlock; @@ -1263,7 +1263,7 @@ static ssize_t trigger_hotplug(struct file *f, const char __user *buf, dm_restore_drm_connector_state(dev, connector); drm_modeset_unlock_all(dev); - drm_kms_helper_hotplug_event(dev); + drm_kms_helper_connector_hotplug_event(connector); } unlock: From patchwork Mon Oct 18 08:47:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Ser X-Patchwork-Id: 12565361 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7242CC433EF for ; Mon, 18 Oct 2021 08:47:41 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3408160F02 for ; Mon, 18 Oct 2021 08:47:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3408160F02 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=emersion.fr Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 84F0A6E867; Mon, 18 Oct 2021 08:47:40 +0000 (UTC) Received: from mail-40136.proton.ch (mail-40136.proton.ch [185.70.40.136]) by gabe.freedesktop.org (Postfix) with ESMTPS id CE2CD6E863 for ; Mon, 18 Oct 2021 08:47:39 +0000 (UTC) Date: Mon, 18 Oct 2021 08:47:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emersion.fr; s=protonmail; t=1634546858; bh=YQTkOvdAiABoAgJvHgRsVUQ62iLcGNwcFxXJ3n6mzBQ=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=uEia5BfW4xPgQ8xRemkEYMlbEuzx1D5OjtjbXqQqz6q4hZnr5jNf5X+xLYXRW65R2 Nk5HiQ/XYnJYFyNVbfF6A0CiMJ1oIURm8Ml+fzG74cnpXxXSuKHyA7LTz6YColbA6x 5Nv2R20aiIuJTAx5R0cUuRlmXiQFt5Grcx/XaDaqvvAuyQiquzX/FdoYOExJsM+A1y JtIQbrWrVcRephz8DMlyo+SFq53cRJwhkN2D0Eo0n2Bbpgwg+B/p48HpnlH0S54Vbv dIfisrWE5xnPhGzNyy4NOXztbQM2pHXaWpzTOq1H2tvfidcmtqG6v8XrHNGVRiKQt6 IBEN9ZuGhnwbA== To: dri-devel@lists.freedesktop.org From: Simon Ser Cc: Ville Syrjala , Sam Ravnborg , Maxime Ripard Subject: [PATCH v4 5/6] drm/probe-helper: use drm_kms_helper_connector_hotplug_event Message-ID: <20211018084707.32253-6-contact@emersion.fr> In-Reply-To: <20211018084707.32253-1-contact@emersion.fr> References: <20211018084707.32253-1-contact@emersion.fr> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Simon Ser Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" If an hotplug event only updates a single connector, use drm_kms_helper_connector_hotplug_event instead of drm_kms_helper_hotplug_event. Changes in v4: - Simplify loop logic (Ville, Sam) - Update drm_connector_helper_hpd_irq_event (Maxime) Signed-off-by: Simon Ser Cc: Ville Syrjala Cc: Sam Ravnborg Cc: Maxime Ripard Reviewed-by: Maxime Ripard Reviewed-by: Sam Ravnborg --- drivers/gpu/drm/drm_probe_helper.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c index 3aef3b188c99..682359512996 100644 --- a/drivers/gpu/drm/drm_probe_helper.c +++ b/drivers/gpu/drm/drm_probe_helper.c @@ -888,7 +888,7 @@ bool drm_connector_helper_hpd_irq_event(struct drm_connector *connector) mutex_unlock(&dev->mode_config.mutex); if (changed) { - drm_kms_helper_hotplug_event(dev); + drm_kms_helper_connector_hotplug_event(connector); drm_dbg_kms(dev, "[CONNECTOR:%d:%s] Sent hotplug event\n", connector->base.id, connector->name); @@ -927,9 +927,9 @@ EXPORT_SYMBOL(drm_connector_helper_hpd_irq_event); */ bool drm_helper_hpd_irq_event(struct drm_device *dev) { - struct drm_connector *connector; + struct drm_connector *connector, *first_changed_connector = NULL; struct drm_connector_list_iter conn_iter; - bool changed = false; + int changed = 0; if (!dev->mode_config.poll_enabled) return false; @@ -941,16 +941,25 @@ bool drm_helper_hpd_irq_event(struct drm_device *dev) if (!(connector->polled & DRM_CONNECTOR_POLL_HPD)) continue; - if (check_connector_changed(connector)) - changed = true; + if (check_connector_changed(connector)) { + if (!first_changed_connector) { + drm_connector_get(connector); + first_changed_connector = connector; + } + + changed++; + } } drm_connector_list_iter_end(&conn_iter); mutex_unlock(&dev->mode_config.mutex); - if (changed) { + if (changed == 1) + drm_kms_helper_connector_hotplug_event(first_changed_connector); + else if (changed > 0) drm_kms_helper_hotplug_event(dev); - DRM_DEBUG_KMS("Sent hotplug event\n"); - } + + if (first_changed_connector) + drm_connector_put(first_changed_connector); return changed; } From patchwork Mon Oct 18 08:47:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Simon Ser X-Patchwork-Id: 12565367 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CBC5C433EF for ; Mon, 18 Oct 2021 08:47:47 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4CA9960F02 for ; Mon, 18 Oct 2021 08:47:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4CA9960F02 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=emersion.fr Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8113A6E99E; Mon, 18 Oct 2021 08:47:42 +0000 (UTC) Received: from mail-40136.proton.ch (mail-40136.proton.ch [185.70.40.136]) by gabe.freedesktop.org (Postfix) with ESMTPS id 805BC6E863 for ; Mon, 18 Oct 2021 08:47:40 +0000 (UTC) Date: Mon, 18 Oct 2021 08:47:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emersion.fr; s=protonmail; t=1634546858; bh=AqZrLz2VN/83fP01hhtFuIxcRXjNQUIEhxswPOHOGis=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=d71doQL5A42fl/CdgmBYCVjleamLp5nXyrGaQjXzAAAogJvKpBMzAXfW5lFreU/VN fIBa8vBXX0eQRWaWpjx3dUofA+IzGDMq3sp85iL91r0DGVI6vTscDbmzJyMOUH+jRj 3NHMTjRE0MHcpr9zOlugkweQmu8snTUX6pJDfuX4hoOj9TNQZbzf1RBU3AhIGFU3Yr SOvCf51RCLAkQQo8yMcbxkn3wPjLYn3skLBqSIf6qnip0eYJYUVMxDGH17+RPsGQVM WMF0CnvsQvN5lrfGDcGJz9bKVT9rpsAz6eWPFR/Z6N1m3qmfR4hYkrytXM9sBRNl5W Hh8ioN5D7fNHQ== To: dri-devel@lists.freedesktop.org From: Simon Ser Cc: Ville Syrjala Subject: [PATCH v4 6/6] i915/display/dp: send a more fine-grained link-status uevent Message-ID: <20211018084707.32253-7-contact@emersion.fr> In-Reply-To: <20211018084707.32253-1-contact@emersion.fr> References: <20211018084707.32253-1-contact@emersion.fr> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Simon Ser Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" When link-status changes, send a hotplug uevent which contains the connector ID. That way, user-space can more easily figure out that only this connector has been updated. Changes in v4: avoid sending two uevents (Ville) Signed-off-by: Simon Ser Cc: Ville Syrjala Reviewed-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_dp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index 04175f359fd6..8b81a709d33b 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -5263,7 +5263,7 @@ static void intel_dp_modeset_retry_work_fn(struct work_struct *work) DRM_MODE_LINK_STATUS_BAD); mutex_unlock(&connector->dev->mode_config.mutex); /* Send Hotplug uevent so userspace can reprobe */ - drm_kms_helper_hotplug_event(connector->dev); + drm_kms_helper_connector_hotplug_event(connector); } bool