From patchwork Wed Jan 11 17:37:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ma=C3=ADra_Canal?= X-Patchwork-Id: 13097054 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id E01B1C5479D for ; Wed, 11 Jan 2023 17:38:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8E70310E0B4; Wed, 11 Jan 2023 17:38:44 +0000 (UTC) Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6D96A10E7B5 for ; Wed, 11 Jan 2023 17:38:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=BAuTiLzPk50vqXqF9ZBIcFufRjndH82IbE0TexouuM4=; b=jGomHbW22nFenQE008vYlc2zvW MWDGcOckLpyf3hjphmWYkcXVkn0wGo73W16grq50KHOuft6w+Flr3bDYCRDoaFO14pHhtRD63Ey57 DGQevTNviUUNAOnAYBI1aIUT0IHWcFaLoIk7bZkPm9Qu7NNJpzJ4sphGwMc7HzZg/Z7kxJERCMNlG ofZxUxep08AczvKBXZrTF2xr6X+TqVK+aVhQ8NKwp84q0Z9IyQucvfsOiOfibQMKpg7pECCgoRKJY bi/AJ42gbaUS1ohckqqiTgbh5DihYjXUBNN5n2p6n/Yce8AMmdl3od8JqpJj61yM6dJgzhM9bWt5c EIkorQVg==; Received: from [187.36.234.139] (helo=bowie..) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1pFf3T-005Sku-Vw; Wed, 11 Jan 2023 18:38:28 +0100 From: =?utf-8?q?Ma=C3=ADra_Canal?= To: Maxime Ripard , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Jani Nikula , Alain Volmat Subject: [PATCH 01/13] drm/debugfs: Create helper to add debugfs files to device's list Date: Wed, 11 Jan 2023 14:37:36 -0300 Message-Id: <20230111173748.752659-2-mcanal@igalia.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230111173748.752659-1-mcanal@igalia.com> References: <20230111173748.752659-1-mcanal@igalia.com> 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: , Cc: Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , =?utf-8?q?Andr=C3=A9_Alme?= =?utf-8?q?ida?= , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Create a helper to encapsulate the code that adds a new debugfs file to a linked list related to a object. Moreover, the helper also provides more flexibily on the type of the object, allowing to use the helper for other types of drm_debugfs_entry. Signed-off-by: Maíra Canal --- drivers/gpu/drm/drm_debugfs.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c index 4f643a490dc3..255d2068ac16 100644 --- a/drivers/gpu/drm/drm_debugfs.c +++ b/drivers/gpu/drm/drm_debugfs.c @@ -316,6 +316,17 @@ void drm_debugfs_cleanup(struct drm_minor *minor) minor->debugfs_root = NULL; } +#define drm_debugfs_add_file_to_list(component) do { \ + entry->file.name = name; \ + entry->file.show = show; \ + entry->file.data = data; \ + entry->component = (component); \ + \ + mutex_lock(&(component)->debugfs_mutex); \ + list_add(&entry->list, &(component)->debugfs_list); \ + mutex_unlock(&(component)->debugfs_mutex); \ + } while (0) + /** * drm_debugfs_add_file - Add a given file to the DRM device debugfs file list * @dev: drm device for the ioctl @@ -334,14 +345,7 @@ void drm_debugfs_add_file(struct drm_device *dev, const char *name, if (!entry) return; - entry->file.name = name; - entry->file.show = show; - entry->file.data = data; - entry->dev = dev; - - mutex_lock(&dev->debugfs_mutex); - list_add(&entry->list, &dev->debugfs_list); - mutex_unlock(&dev->debugfs_mutex); + drm_debugfs_add_file_to_list(dev); } EXPORT_SYMBOL(drm_debugfs_add_file); From patchwork Wed Jan 11 17:37:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ma=C3=ADra_Canal?= X-Patchwork-Id: 13097055 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id A4C6BC5479D for ; Wed, 11 Jan 2023 17:38:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1392410E7B1; Wed, 11 Jan 2023 17:38:45 +0000 (UTC) Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5769D10E7B6 for ; Wed, 11 Jan 2023 17:38:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=7hnudy0wkmxNkLHz09244h2KlIQRVcthBCtrNfe+Z4A=; b=ak8NxholPfQZ4uU023dvYBId8q RymRv0yrwlnwj3emHZ7CQUnTNaHZrJEBhjSsHdrpCMRGrQWEsQo0+rwbbfEzy+5gHUCSfT5HZFJan 9z8e8+/e+oKbcPmkgNZOIW8RkwDoYVZr1ie+XAf5F/r003xqYqu6QH0KjVXIqKzda7qaqgkBCCO5R yfsExaLwgrtuEzj1X8EJs1sigsFA1YVROMDDzZ7hVrscO4ffM6t0S9oLN3SYVI+nFy1OGbCpDhVM+ hSzNDw+60epO0iSqHmWtr/OKeTcuC4dcVRgWXPB6aLkKGQ9Bx9u8e7ytZ0FBLLSw87lCDSWSMETsl 11PMNVBg==; Received: from [187.36.234.139] (helo=bowie..) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1pFf3Y-005Sku-Hh; Wed, 11 Jan 2023 18:38:33 +0100 From: =?utf-8?q?Ma=C3=ADra_Canal?= To: Maxime Ripard , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Jani Nikula , Alain Volmat Subject: [PATCH 02/13] drm/debugfs: Create helper to create debugfs files from list Date: Wed, 11 Jan 2023 14:37:37 -0300 Message-Id: <20230111173748.752659-3-mcanal@igalia.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230111173748.752659-1-mcanal@igalia.com> References: <20230111173748.752659-1-mcanal@igalia.com> 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: , Cc: Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , =?utf-8?q?Andr=C3=A9_Alme?= =?utf-8?q?ida?= , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Create a helper to encapsulate the code that creates a new debugfs file from a linked list related to an object. Moreover, the helper also provides more flexibily on the type of the object. Signed-off-by: Maíra Canal --- drivers/gpu/drm/drm_debugfs.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c index 255d2068ac16..23f6ed7b5d68 100644 --- a/drivers/gpu/drm/drm_debugfs.c +++ b/drivers/gpu/drm/drm_debugfs.c @@ -218,6 +218,16 @@ void drm_debugfs_create_files(const struct drm_info_list *files, int count, } EXPORT_SYMBOL(drm_debugfs_create_files); +#define drm_create_file_from_list(component) do { \ + list_for_each_entry_safe(entry, tmp, &(component)->debugfs_list, \ + list) { \ + debugfs_create_file(entry->file.name, 0444, \ + minor->debugfs_root, entry, \ + &drm_debugfs_entry_fops); \ + list_del(&entry->list); \ + } \ + } while (0) + int drm_debugfs_init(struct drm_minor *minor, int minor_id, struct dentry *root) { @@ -245,11 +255,7 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id, if (dev->driver->debugfs_init) dev->driver->debugfs_init(minor); - list_for_each_entry_safe(entry, tmp, &dev->debugfs_list, list) { - debugfs_create_file(entry->file.name, 0444, - minor->debugfs_root, entry, &drm_debugfs_entry_fops); - list_del(&entry->list); - } + drm_create_file_from_list(dev); return 0; } @@ -262,11 +268,7 @@ void drm_debugfs_late_register(struct drm_device *dev) if (!minor) return; - list_for_each_entry_safe(entry, tmp, &dev->debugfs_list, list) { - debugfs_create_file(entry->file.name, 0444, - minor->debugfs_root, entry, &drm_debugfs_entry_fops); - list_del(&entry->list); - } + drm_create_file_from_list(dev); } int drm_debugfs_remove_files(const struct drm_info_list *files, int count, From patchwork Wed Jan 11 17:37:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ma=C3=ADra_Canal?= X-Patchwork-Id: 13097058 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 5A6EAC5479D for ; Wed, 11 Jan 2023 17:39:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C839010E7B6; Wed, 11 Jan 2023 17:38:58 +0000 (UTC) Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id C351D10E7AF for ; Wed, 11 Jan 2023 17:38:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=4tYyIZNSlv7m//YlLx72QWeadgOG/5RxFbxtTBQS9Ik=; b=mWvmi4aKdxjdQ5oYrsK1PUku7v li1Cb9pxfvAJJXN+rRGw/JpRgqIVRYuIzP/gL/RylSJUKEz9D23IUzcpC8c8gb4jiVZ46Dg2eVGp0 GtrMjej33cHC+eh1X84VpArH5ww0wLVAZIFyYNbO4ZBxXPCUUb/Q72bgTDV6IstxXzt+aj2J7gTZj +4fcNgxZfBG0sl5tL2utRYIsBFdq0QOFF2VJe2ZfTLtKR9PtbYLu1N/Ir8f9mrYN91Rw/cHPuYM+u O6JL1aenIDGbYDPYTnqrumxAH97TN0Y2DR5OIsgFK3j4A/AJXdjiS1Z0qp1/Ku4hLcPqEdkxw1HYJ yHHy/zZg==; Received: from [187.36.234.139] (helo=bowie..) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1pFf3c-005Sku-Ui; Wed, 11 Jan 2023 18:38:37 +0100 From: =?utf-8?q?Ma=C3=ADra_Canal?= To: Maxime Ripard , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Jani Nikula , Alain Volmat Subject: [PATCH 03/13] drm/debugfs: Create a debugfs infrastructure for connectors Date: Wed, 11 Jan 2023 14:37:38 -0300 Message-Id: <20230111173748.752659-4-mcanal@igalia.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230111173748.752659-1-mcanal@igalia.com> References: <20230111173748.752659-1-mcanal@igalia.com> 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: , Cc: Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , =?utf-8?q?Andr=C3=A9_Alme?= =?utf-8?q?ida?= , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Introduce the ability to add DRM debugfs files to a list managed by the connector and, during drm_connector_register(), all added files will be created at once. Moreover, introduce some typesafety as struct drm_debugfs_connector_entry holds a drm_connector instead of a drm_device. So, the drivers can get a connector object directly from the struct drm_debugfs_connector_entry in the show() callback. Signed-off-by: Maíra Canal --- drivers/gpu/drm/drm_connector.c | 5 +++++ drivers/gpu/drm/drm_debugfs.c | 35 +++++++++++++++++++++++++++++++++ drivers/gpu/drm/drm_internal.h | 5 +++++ include/drm/drm_connector.h | 15 ++++++++++++++ include/drm/drm_debugfs.h | 26 ++++++++++++++++++++++++ 5 files changed, 86 insertions(+) diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index 8d92777e57dd..c93655bb0edf 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -273,8 +273,10 @@ static int __drm_connector_init(struct drm_device *dev, INIT_LIST_HEAD(&connector->global_connector_list_entry); INIT_LIST_HEAD(&connector->probed_modes); INIT_LIST_HEAD(&connector->modes); + INIT_LIST_HEAD(&connector->debugfs_list); mutex_init(&connector->mutex); mutex_init(&connector->edid_override_mutex); + mutex_init(&connector->debugfs_mutex); connector->edid_blob_ptr = NULL; connector->epoch_counter = 0; connector->tile_blob_ptr = NULL; @@ -581,6 +583,7 @@ void drm_connector_cleanup(struct drm_connector *connector) connector->state); mutex_destroy(&connector->mutex); + mutex_destroy(&connector->debugfs_mutex); memset(connector, 0, sizeof(*connector)); @@ -627,6 +630,8 @@ int drm_connector_register(struct drm_connector *connector) goto err_debugfs; } + drm_debugfs_connector_init(connector); + drm_mode_object_register(connector->dev, &connector->base); connector->registration_state = DRM_CONNECTOR_REGISTERED; diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c index 23f6ed7b5d68..d9ec1ed5a7ec 100644 --- a/drivers/gpu/drm/drm_debugfs.c +++ b/drivers/gpu/drm/drm_debugfs.c @@ -260,6 +260,17 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id, return 0; } +void drm_debugfs_connector_init(struct drm_connector *connector) +{ + struct drm_minor *minor = connector->dev->primary; + struct drm_debugfs_connector_entry *entry, *tmp; + + if (!minor) + return; + + drm_create_file_from_list(connector); +} + void drm_debugfs_late_register(struct drm_device *dev) { struct drm_minor *minor = dev->primary; @@ -369,6 +380,30 @@ void drm_debugfs_add_files(struct drm_device *dev, const struct drm_debugfs_info } EXPORT_SYMBOL(drm_debugfs_add_files); +/** + * drm_debugfs_connector_add_file - Add a given file to the DRM connector debugfs file list + * @connector: DRM connector object + * @name: debugfs file name + * @show: show callback + * @data: driver-private data, should not be device-specific + * + * Add a given file entry to the DRM connector debugfs file list to be created on + * drm_debugfs_connector_init(). + */ +void drm_debugfs_connector_add_file(struct drm_connector *connector, const char *name, + int (*show)(struct seq_file*, void*), void *data) +{ + struct drm_debugfs_connector_entry *entry = drmm_kzalloc(connector->dev, + sizeof(*entry), + GFP_KERNEL); + + if (!entry) + return; + + drm_debugfs_add_file_to_list(connector); +} +EXPORT_SYMBOL(drm_debugfs_connector_add_file); + static int connector_show(struct seq_file *m, void *data) { struct drm_connector *connector = m->private; diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h index ed2103ee272c..dd9d7b8b45bd 100644 --- a/drivers/gpu/drm/drm_internal.h +++ b/drivers/gpu/drm/drm_internal.h @@ -185,6 +185,7 @@ int drm_gem_dumb_destroy(struct drm_file *file, struct drm_device *dev, #if defined(CONFIG_DEBUG_FS) int drm_debugfs_init(struct drm_minor *minor, int minor_id, struct dentry *root); +void drm_debugfs_connector_init(struct drm_connector *connector); void drm_debugfs_cleanup(struct drm_minor *minor); void drm_debugfs_late_register(struct drm_device *dev); void drm_debugfs_connector_add(struct drm_connector *connector); @@ -199,6 +200,10 @@ static inline int drm_debugfs_init(struct drm_minor *minor, int minor_id, return 0; } +static inline void drm_debugfs_connector_init(struct drm_connector *connector) +{ +} + static inline void drm_debugfs_cleanup(struct drm_minor *minor) { } diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 9037f1317aee..51340f3162ed 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -1720,6 +1720,21 @@ struct drm_connector { /** @debugfs_entry: debugfs directory for this connector */ struct dentry *debugfs_entry; + /** + * @debugfs_mutex: + * + * Protects &debugfs_list access. + */ + struct mutex debugfs_mutex; + + /** + * @debugfs_list: + * + * List of debugfs files to be created by the DRM connector. The files + * must be added during drm_connector_register(). + */ + struct list_head debugfs_list; + /** * @state: * diff --git a/include/drm/drm_debugfs.h b/include/drm/drm_debugfs.h index 7616f457ce70..c09c82274622 100644 --- a/include/drm/drm_debugfs.h +++ b/include/drm/drm_debugfs.h @@ -122,6 +122,23 @@ struct drm_debugfs_entry { struct list_head list; }; +/** + * struct drm_debugfs_connector_entry - Per-connector debugfs node structure + * + * This structure represents a debugfs file, as an instantiation of a &struct + * drm_debugfs_info on a &struct drm_connector. + */ +struct drm_debugfs_connector_entry { + /** @connector: &struct drm_connector for this node. */ + struct drm_connector *connector; + + /** @file: Template for this node. */ + struct drm_debugfs_info file; + + /** @list: Linked list of all connector nodes. */ + struct list_head list; +}; + #if defined(CONFIG_DEBUG_FS) void drm_debugfs_create_files(const struct drm_info_list *files, int count, struct dentry *root, @@ -134,6 +151,9 @@ void drm_debugfs_add_file(struct drm_device *dev, const char *name, void drm_debugfs_add_files(struct drm_device *dev, const struct drm_debugfs_info *files, int count); + +void drm_debugfs_connector_add_file(struct drm_connector *connector, const char *name, + int (*show)(struct seq_file*, void*), void *data); #else static inline void drm_debugfs_create_files(const struct drm_info_list *files, int count, struct dentry *root, @@ -155,6 +175,12 @@ static inline void drm_debugfs_add_files(struct drm_device *dev, const struct drm_debugfs_info *files, int count) {} + +static inline void drm_debugfs_connector_add_file(struct drm_connector *connector, + const char *name, + int (*show)(struct seq_file*, void*), + void *data) +{} #endif #endif /* _DRM_DEBUGFS_H_ */ From patchwork Wed Jan 11 17:37:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ma=C3=ADra_Canal?= X-Patchwork-Id: 13097056 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 327FAC5479D for ; Wed, 11 Jan 2023 17:39:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B8D7810E7B3; Wed, 11 Jan 2023 17:38:54 +0000 (UTC) Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3057D10E7B2 for ; Wed, 11 Jan 2023 17:38:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=6VNc8UTTTDXWWB2J8ixgEiVj8sADziKCjNdhy0RtikY=; b=Yj/lS27fXLS3yLaZj4mefM/z2v uIAkzseozek5eMdW4ZNWIQC5X+84lgVXfZUiqqJ2/Dka/obRTFtee87Slq15eq8WLOFtNKU3Xb7r6 APnH8g6PtI0amUi45qOhdDZoPgCUR9WA6xtAesm51bVIaHaPkuSMefxosDVbP8eJNSXB1wjpnfOfA dtnZ3Ka8kpzTNfEWm4vZRTIyZL/0HDp5K+oq/nX3Jq+DFrTO3ipm+YOYA/+IxNDfWhpPzorEthrIY s0ZqGUg3/eqKlOOQJejbO9AxO0soIdisJLg+W8w4nXk6XxmiDsyxyhtE1hAB1t/OTSbRxVXylJseU OGXc0QEQ==; Received: from [187.36.234.139] (helo=bowie..) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1pFf3h-005Sku-BQ; Wed, 11 Jan 2023 18:38:41 +0100 From: =?utf-8?q?Ma=C3=ADra_Canal?= To: Maxime Ripard , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Jani Nikula , Alain Volmat Subject: [PATCH 04/13] drm/debugfs: Create a debugfs infrastructure for encoders Date: Wed, 11 Jan 2023 14:37:39 -0300 Message-Id: <20230111173748.752659-5-mcanal@igalia.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230111173748.752659-1-mcanal@igalia.com> References: <20230111173748.752659-1-mcanal@igalia.com> 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: , Cc: Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , =?utf-8?q?Andr=C3=A9_Alme?= =?utf-8?q?ida?= , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Introduce the ability to add DRM debugfs files to a list managed by the encoder and, during drm_encoder_register_all(), all added files will be created at once. Moreover, introduce some typesafety as struct drm_debugfs_encoder_entry holds a drm_encoder instead of a drm_device. So, the drivers can get a encoder object directly from the struct drm_debugfs_encoder_entry in the show() callback. Signed-off-by: Maíra Canal --- drivers/gpu/drm/drm_debugfs.c | 36 ++++++++++++++++++++++++++++++++++ drivers/gpu/drm/drm_encoder.c | 6 ++++++ drivers/gpu/drm/drm_internal.h | 5 +++++ include/drm/drm_debugfs.h | 26 ++++++++++++++++++++++++ include/drm/drm_encoder.h | 15 ++++++++++++++ 5 files changed, 88 insertions(+) diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c index d9ec1ed5a7ec..6a763fe1b031 100644 --- a/drivers/gpu/drm/drm_debugfs.c +++ b/drivers/gpu/drm/drm_debugfs.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -271,6 +272,17 @@ void drm_debugfs_connector_init(struct drm_connector *connector) drm_create_file_from_list(connector); } +void drm_debugfs_encoder_init(struct drm_encoder *encoder) +{ + struct drm_minor *minor = encoder->dev->primary; + struct drm_debugfs_encoder_entry *entry, *tmp; + + if (!minor) + return; + + drm_create_file_from_list(encoder); +} + void drm_debugfs_late_register(struct drm_device *dev) { struct drm_minor *minor = dev->primary; @@ -404,6 +416,30 @@ void drm_debugfs_connector_add_file(struct drm_connector *connector, const char } EXPORT_SYMBOL(drm_debugfs_connector_add_file); +/** + * drm_debugfs_encoder_add_file - Add a given file to the DRM encoder debugfs file list + * @encoder: DRM encoder object + * @name: debugfs file name + * @show: show callback + * @data: driver-private data, should not be device-specific + * + * Add a given file entry to the DRM encoder debugfs file list to be created on + * drm_encoder_register_all(). + */ +void drm_debugfs_encoder_add_file(struct drm_encoder *encoder, const char *name, + int (*show)(struct seq_file*, void*), void *data) +{ + struct drm_debugfs_encoder_entry *entry = drmm_kzalloc(encoder->dev, + sizeof(*entry), + GFP_KERNEL); + + if (!entry) + return; + + drm_debugfs_add_file_to_list(encoder); +} +EXPORT_SYMBOL(drm_debugfs_encoder_add_file); + static int connector_show(struct seq_file *m, void *data) { struct drm_connector *connector = m->private; diff --git a/drivers/gpu/drm/drm_encoder.c b/drivers/gpu/drm/drm_encoder.c index 1143bc7f3252..d6de6237cb4f 100644 --- a/drivers/gpu/drm/drm_encoder.c +++ b/drivers/gpu/drm/drm_encoder.c @@ -30,6 +30,7 @@ #include #include "drm_crtc_internal.h" +#include "drm_internal.h" /** * DOC: overview @@ -78,6 +79,7 @@ int drm_encoder_register_all(struct drm_device *dev) ret = encoder->funcs->late_register(encoder); if (ret) return ret; + drm_debugfs_encoder_init(encoder); } return 0; @@ -125,9 +127,12 @@ static int __drm_encoder_init(struct drm_device *dev, } INIT_LIST_HEAD(&encoder->bridge_chain); + INIT_LIST_HEAD(&encoder->debugfs_list); list_add_tail(&encoder->head, &dev->mode_config.encoder_list); encoder->index = dev->mode_config.num_encoder++; + mutex_init(&encoder->debugfs_mutex); + out_put: if (ret) drm_mode_object_unregister(dev, &encoder->base); @@ -197,6 +202,7 @@ void drm_encoder_cleanup(struct drm_encoder *encoder) drm_mode_object_unregister(dev, &encoder->base); kfree(encoder->name); list_del(&encoder->head); + mutex_destroy(&encoder->debugfs_mutex); dev->mode_config.num_encoder--; memset(encoder, 0, sizeof(*encoder)); diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h index dd9d7b8b45bd..363936ee8628 100644 --- a/drivers/gpu/drm/drm_internal.h +++ b/drivers/gpu/drm/drm_internal.h @@ -186,6 +186,7 @@ int drm_gem_dumb_destroy(struct drm_file *file, struct drm_device *dev, int drm_debugfs_init(struct drm_minor *minor, int minor_id, struct dentry *root); void drm_debugfs_connector_init(struct drm_connector *connector); +void drm_debugfs_encoder_init(struct drm_encoder *encoder); void drm_debugfs_cleanup(struct drm_minor *minor); void drm_debugfs_late_register(struct drm_device *dev); void drm_debugfs_connector_add(struct drm_connector *connector); @@ -204,6 +205,10 @@ static inline void drm_debugfs_connector_init(struct drm_connector *connector) { } +static inline void drm_debugfs_encoder_init(struct drm_encoder *encoder) +{ +} + static inline void drm_debugfs_cleanup(struct drm_minor *minor) { } diff --git a/include/drm/drm_debugfs.h b/include/drm/drm_debugfs.h index c09c82274622..677ed3fee5e1 100644 --- a/include/drm/drm_debugfs.h +++ b/include/drm/drm_debugfs.h @@ -139,6 +139,23 @@ struct drm_debugfs_connector_entry { struct list_head list; }; +/** + * struct drm_debugfs_encoder_entry - Per-encoder debugfs node structure + * + * This structure represents a debugfs file, as an instantiation of a &struct + * drm_debugfs_info on a &struct drm_encoder. + */ +struct drm_debugfs_encoder_entry { + /** @encoder: &struct drm_encoder for this node. */ + struct drm_encoder *encoder; + + /** @file: Template for this node. */ + struct drm_debugfs_info file; + + /** @list: Linked list of all encoder nodes. */ + struct list_head list; +}; + #if defined(CONFIG_DEBUG_FS) void drm_debugfs_create_files(const struct drm_info_list *files, int count, struct dentry *root, @@ -154,6 +171,9 @@ void drm_debugfs_add_files(struct drm_device *dev, void drm_debugfs_connector_add_file(struct drm_connector *connector, const char *name, int (*show)(struct seq_file*, void*), void *data); + +void drm_debugfs_encoder_add_file(struct drm_encoder *encoder, const char *name, + int (*show)(struct seq_file*, void*), void *data); #else static inline void drm_debugfs_create_files(const struct drm_info_list *files, int count, struct dentry *root, @@ -181,6 +201,12 @@ static inline void drm_debugfs_connector_add_file(struct drm_connector *connecto int (*show)(struct seq_file*, void*), void *data) {} + +static inline void drm_debugfs_encoder_add_file(struct drm_encoder *encoder, + const char *name, + int (*show)(struct seq_file*, void*), + void *data) +{} #endif #endif /* _DRM_DEBUGFS_H_ */ diff --git a/include/drm/drm_encoder.h b/include/drm/drm_encoder.h index 3a09682af685..38b73f2a4e38 100644 --- a/include/drm/drm_encoder.h +++ b/include/drm/drm_encoder.h @@ -182,6 +182,21 @@ struct drm_encoder { */ struct list_head bridge_chain; + /** + * @debugfs_mutex: + * + * Protects &debugfs_list access. + */ + struct mutex debugfs_mutex; + + /** + * @debugfs_list: + * + * List of debugfs files to be created by the DRM encoder. The files + * must be added during drm_encoder_register_all(). + */ + struct list_head debugfs_list; + const struct drm_encoder_funcs *funcs; const struct drm_encoder_helper_funcs *helper_private; }; From patchwork Wed Jan 11 17:37:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ma=C3=ADra_Canal?= X-Patchwork-Id: 13097059 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id EDE3FC5479D for ; Wed, 11 Jan 2023 17:39:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A197910E7B0; Wed, 11 Jan 2023 17:39:07 +0000 (UTC) Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9990C10E7B4 for ; Wed, 11 Jan 2023 17:38:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=CZyeTL029zzJuVyDEXThSkwV4MZhrZheSD+yYbbMM5I=; b=cBNe5bj0Y7YpCtqw9Gn8VPmNSh ZmJcx3eCslVX35mw8g8l/PrfRzgsd8cy3IgT1nXrAZAVNxHZCiHvTYBFnQhmn5IEWd1NUK/UphuYS pcO0BAaYm/9d4p500o/9IMhvkdOxM5Oli8spFHsrVl2I8WSUaDLY4dgoHEDrMxv/ObfE5dsg5fB4l cJmUcU3cXwRYyIM75QqrNt88GWmTxjRg9V/C2LQqwhjkrBjdA9rZ7QNKXZ5cQcSasfk3VpgKI8V65 HCRAOHwNMaS4SZbR4mwVQ0EbuE71EicXbS1T6GMlyvhZMFryOLoU8KiJNiq17fi1QdVGVWi7zu+/D xcSozKkQ==; Received: from [187.36.234.139] (helo=bowie..) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1pFf3l-005Sku-Rk; Wed, 11 Jan 2023 18:38:46 +0100 From: =?utf-8?q?Ma=C3=ADra_Canal?= To: Maxime Ripard , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Jani Nikula , Alain Volmat Subject: [PATCH 05/13] drm/debugfs: Create a debugfs infrastructure for CRTC Date: Wed, 11 Jan 2023 14:37:40 -0300 Message-Id: <20230111173748.752659-6-mcanal@igalia.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230111173748.752659-1-mcanal@igalia.com> References: <20230111173748.752659-1-mcanal@igalia.com> 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: , Cc: Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , =?utf-8?q?Andr=C3=A9_Alme?= =?utf-8?q?ida?= , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Introduce the ability to add DRM debugfs files to a list managed by the crtc and, during drm_crtc_register_all(), all added files will be created at once. Moreover, introduce some typesafety as struct drm_debugfs_crtc_entry holds a drm_crtc instead of a drm_device. So, the drivers can get a crtc object directly from the struct drm_debugfs_crtc_entry in the show() callback. Signed-off-by: Maíra Canal --- drivers/gpu/drm/drm_crtc.c | 5 +++++ drivers/gpu/drm/drm_debugfs.c | 33 +++++++++++++++++++++++++++++++++ drivers/gpu/drm/drm_internal.h | 5 +++++ include/drm/drm_crtc.h | 15 +++++++++++++++ include/drm/drm_debugfs.h | 25 +++++++++++++++++++++++++ 5 files changed, 83 insertions(+) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index df9bf3c9206e..2953eef3e88e 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -131,6 +131,8 @@ int drm_crtc_register_all(struct drm_device *dev) ret = crtc->funcs->late_register(crtc); if (ret) return ret; + + drm_debugfs_crtc_init(crtc); } return 0; @@ -268,7 +270,9 @@ static int __drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc * crtc->funcs = funcs; INIT_LIST_HEAD(&crtc->commit_list); + INIT_LIST_HEAD(&crtc->debugfs_list); spin_lock_init(&crtc->commit_lock); + mutex_init(&crtc->debugfs_mutex); drm_modeset_lock_init(&crtc->mutex); ret = drm_mode_object_add(dev, &crtc->base, DRM_MODE_OBJECT_CRTC); @@ -508,6 +512,7 @@ void drm_crtc_cleanup(struct drm_crtc *crtc) crtc->gamma_store = NULL; drm_modeset_lock_fini(&crtc->mutex); + mutex_destroy(&crtc->debugfs_mutex); drm_mode_object_unregister(dev, &crtc->base); list_del(&crtc->head); diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c index 6a763fe1b031..e1f71a03a581 100644 --- a/drivers/gpu/drm/drm_debugfs.c +++ b/drivers/gpu/drm/drm_debugfs.c @@ -261,6 +261,17 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id, return 0; } +void drm_debugfs_crtc_init(struct drm_crtc *crtc) +{ + struct drm_minor *minor = crtc->dev->primary; + struct drm_debugfs_crtc_entry *entry, *tmp; + + if (!minor) + return; + + drm_create_file_from_list(crtc); +} + void drm_debugfs_connector_init(struct drm_connector *connector) { struct drm_minor *minor = connector->dev->primary; @@ -392,6 +403,28 @@ void drm_debugfs_add_files(struct drm_device *dev, const struct drm_debugfs_info } EXPORT_SYMBOL(drm_debugfs_add_files); +/** + * drm_debugfs_crtc_add_file - Add a given file to the DRM crtc debugfs file list + * @crtc: DRM crtc object + * @name: debugfs file name + * @show: show callback + * @data: driver-private data, should not be device-specific + * Add a given file entry to the DRM crtc debugfs file list to be created on + * drm_debugfs_crtc_init(). + */ +void drm_debugfs_crtc_add_file(struct drm_crtc *crtc, const char *name, + int (*show)(struct seq_file*, void*), void *data) +{ + struct drm_debugfs_crtc_entry *entry = drmm_kzalloc(crtc->dev, sizeof(*entry), + GFP_KERNEL); + + if (!entry) + return; + + drm_debugfs_add_file_to_list(crtc); +} +EXPORT_SYMBOL(drm_debugfs_crtc_add_file); + /** * drm_debugfs_connector_add_file - Add a given file to the DRM connector debugfs file list * @connector: DRM connector object diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h index 363936ee8628..9be697f7f8f9 100644 --- a/drivers/gpu/drm/drm_internal.h +++ b/drivers/gpu/drm/drm_internal.h @@ -185,6 +185,7 @@ int drm_gem_dumb_destroy(struct drm_file *file, struct drm_device *dev, #if defined(CONFIG_DEBUG_FS) int drm_debugfs_init(struct drm_minor *minor, int minor_id, struct dentry *root); +void drm_debugfs_crtc_init(struct drm_crtc *crtc); void drm_debugfs_connector_init(struct drm_connector *connector); void drm_debugfs_encoder_init(struct drm_encoder *encoder); void drm_debugfs_cleanup(struct drm_minor *minor); @@ -201,6 +202,10 @@ static inline int drm_debugfs_init(struct drm_minor *minor, int minor_id, return 0; } +static inline void drm_debugfs_crtc_init(struct drm_crtc *crtc) +{ +} + static inline void drm_debugfs_connector_init(struct drm_connector *connector) { } diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 8e1cbc75143e..612928929646 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -1139,6 +1139,21 @@ struct drm_crtc { */ struct dentry *debugfs_entry; + /** + * @debugfs_mutex: + * + * Protects &debugfs_list access. + */ + struct mutex debugfs_mutex; + + /** + * @debugfs_list: + * + * List of debugfs files to be created by the DRM crtc. The files + * must be added during drm_crtc_register_all(). + */ + struct list_head debugfs_list; + /** * @crc: * diff --git a/include/drm/drm_debugfs.h b/include/drm/drm_debugfs.h index 677ed3fee5e1..47f23615139f 100644 --- a/include/drm/drm_debugfs.h +++ b/include/drm/drm_debugfs.h @@ -122,6 +122,23 @@ struct drm_debugfs_entry { struct list_head list; }; +/** + * struct drm_debugfs_crtc_entry - Per-crtc debugfs node structure + * + * This structure represents a debugfs file, as an instantiation of a &struct + * drm_debugfs_info on a &struct drm_crtc. + */ +struct drm_debugfs_crtc_entry { + /** @crtc: &struct drm_crtc for this node. */ + struct drm_crtc *crtc; + + /** @file: Template for this node. */ + struct drm_debugfs_info file; + + /** @list: Linked list of all crtc nodes. */ + struct list_head list; +}; + /** * struct drm_debugfs_connector_entry - Per-connector debugfs node structure * @@ -169,6 +186,9 @@ void drm_debugfs_add_file(struct drm_device *dev, const char *name, void drm_debugfs_add_files(struct drm_device *dev, const struct drm_debugfs_info *files, int count); +void drm_debugfs_crtc_add_file(struct drm_crtc *crtc, const char *name, + int (*show)(struct seq_file*, void*), void *data); + void drm_debugfs_connector_add_file(struct drm_connector *connector, const char *name, int (*show)(struct seq_file*, void*), void *data); @@ -196,6 +216,11 @@ static inline void drm_debugfs_add_files(struct drm_device *dev, int count) {} +static inline void drm_debugfs_crtc_add_file(struct drm_crtc *crtc, const char *name, + int (*show)(struct seq_file*, void*), + void *data) +{} + static inline void drm_debugfs_connector_add_file(struct drm_connector *connector, const char *name, int (*show)(struct seq_file*, void*), From patchwork Wed Jan 11 17:37:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ma=C3=ADra_Canal?= X-Patchwork-Id: 13097060 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 0F5FFC54EBC for ; Wed, 11 Jan 2023 17:39:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0338010E7B4; Wed, 11 Jan 2023 17:39:08 +0000 (UTC) Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 215DF10E7B7 for ; Wed, 11 Jan 2023 17:38:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=bVN4C+QvCyfJZLYLAtmaPjkYIhxXDdYFgXmF4PxfhFs=; b=NV7nkTrbvBrJbp5vxtNs3PBH09 R1baDQQB15+P1syZUQPJGUXBLeeIzieHFmBf7WmGeoN2jl+DWEPqWrEDeOwkaIcuzqSKnULnOm/XV IDagx1Ipz2SxJ+3aIh/Ms6fqsQ5/wNRGUvq/aDbBNoRdxQ9DP1YjCPxEc746Ce8ca9O3QZx06cKVO 1Y4UKvor6rgeU4KxPfPSu/penDnnTC0KRud8J9KnwQ7OErs16WPy5zFDlkicKXm6An6wWevlwEVw7 aGT98wGohRSZNcxnbdZ4bUaH36sEKjxEUBE/J5LUnbOSxBA1QieNHjxJ6ewAzhZjlHSKjjt1TX17e DqExdL5A==; Received: from [187.36.234.139] (helo=bowie..) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1pFf3q-005Sku-Bk; Wed, 11 Jan 2023 18:38:50 +0100 From: =?utf-8?q?Ma=C3=ADra_Canal?= To: Maxime Ripard , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Jani Nikula , Alain Volmat Subject: [PATCH 06/13] drm/vc4: Split variable instantiation of vc4_debugfs_regset32() Date: Wed, 11 Jan 2023 14:37:41 -0300 Message-Id: <20230111173748.752659-7-mcanal@igalia.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230111173748.752659-1-mcanal@igalia.com> References: <20230111173748.752659-1-mcanal@igalia.com> 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: , Cc: Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , =?utf-8?q?Andr=C3=A9_Alme?= =?utf-8?q?ida?= , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Considering that there are multiple ways to instantiate a drm_debugfs_entry, as kms object's debugfs entries were introduced, split vc4_debugfs_regset32() into two functions: one to deal with the drm_printer and the other to instantiate the proper variables. Signed-off-by: Maíra Canal --- drivers/gpu/drm/vc4/vc4_debugfs.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_debugfs.c b/drivers/gpu/drm/vc4/vc4_debugfs.c index fac624a663ea..80afc69200f0 100644 --- a/drivers/gpu/drm/vc4/vc4_debugfs.c +++ b/drivers/gpu/drm/vc4/vc4_debugfs.c @@ -32,27 +32,34 @@ vc4_debugfs_init(struct drm_minor *minor) } } -static int vc4_debugfs_regset32(struct seq_file *m, void *unused) +static int vc4_debugfs_regset32(struct drm_device *drm, struct debugfs_regset32 *regset, + struct drm_printer *p) { - struct drm_debugfs_entry *entry = m->private; - struct drm_device *drm = entry->dev; - struct debugfs_regset32 *regset = entry->file.data; - struct drm_printer p = drm_seq_file_printer(m); int idx; if (!drm_dev_enter(drm, &idx)) return -ENODEV; - drm_print_regset32(&p, regset); + drm_print_regset32(p, regset); drm_dev_exit(idx); return 0; } +static int vc4_debugfs_dev_regset32(struct seq_file *m, void *unused) +{ + struct drm_debugfs_entry *entry = m->private; + struct drm_device *drm = entry->dev; + struct debugfs_regset32 *regset = entry->file.data; + struct drm_printer p = drm_seq_file_printer(m); + + return vc4_debugfs_regset32(drm, regset, &p); +} + void vc4_debugfs_add_regset32(struct drm_device *drm, const char *name, struct debugfs_regset32 *regset) { - drm_debugfs_add_file(drm, name, vc4_debugfs_regset32, regset); + drm_debugfs_add_file(drm, name, vc4_debugfs_dev_regset32, regset); } From patchwork Wed Jan 11 17:37:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ma=C3=ADra_Canal?= X-Patchwork-Id: 13097066 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 82E8DC5479D for ; Wed, 11 Jan 2023 17:39:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5F76D10E7BB; Wed, 11 Jan 2023 17:39:30 +0000 (UTC) Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0C4CC10E7AF for ; Wed, 11 Jan 2023 17:39:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Mmq7zwhPobz29pXWwkxNg2hoJg/zKhte437K+vYc8rI=; b=YoAdj28KT847bQXmS2y2cwSoM5 VbW5KOHCqeR2MtrtqNQTvg6/NVye/pNE07iOejwtQKNCN61GUBk1FEA1CtvH7RyafNJRcZnws42Cb b9y86UHUjUX8blYImxRO8kenSZaHhnoQGnCIPDIau6KKiszFKUiDlJBBuMqWIyoYVOZn+s9EiMzQi bPWRIAyMuCtPMMWsiM1EHwWNqFd8+A5VMjvT5whTQmQcH5UqDSlC3H9xPhZHJZelFjT9jHW3KJDs5 YRXBVImSGnx8RfBQWPueZmeZZdpIGj7oScyerzDobp6WMgh4WRTZgn3Cw5oESS+g/3pLsozEylvmv +O3jgO1A==; Received: from [187.36.234.139] (helo=bowie..) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1pFf3u-005Sku-S4; Wed, 11 Jan 2023 18:38:55 +0100 From: =?utf-8?q?Ma=C3=ADra_Canal?= To: Maxime Ripard , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Jani Nikula , Alain Volmat Subject: [PATCH 07/13] drm/vc4: Use the encoders' debugfs infrastructure Date: Wed, 11 Jan 2023 14:37:42 -0300 Message-Id: <20230111173748.752659-8-mcanal@igalia.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230111173748.752659-1-mcanal@igalia.com> References: <20230111173748.752659-1-mcanal@igalia.com> 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: , Cc: Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , =?utf-8?q?Andr=C3=A9_Alme?= =?utf-8?q?ida?= , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Replace the use of drm_debugfs_add_files() with the new drm_debugfs_encoder_add_files() function, which centers the debugfs files management on the drm_encoder instead of drm_device. Using this function on late register callbacks is more adequate as the callback passes a drm_encoder as parameter. Signed-off-by: Maíra Canal --- drivers/gpu/drm/vc4/vc4_debugfs.c | 17 +++++++++++++++++ drivers/gpu/drm/vc4/vc4_dpi.c | 3 +-- drivers/gpu/drm/vc4/vc4_drv.h | 8 ++++++++ drivers/gpu/drm/vc4/vc4_dsi.c | 3 +-- drivers/gpu/drm/vc4/vc4_hdmi.c | 5 ++--- drivers/gpu/drm/vc4/vc4_vec.c | 3 +-- 6 files changed, 30 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_debugfs.c b/drivers/gpu/drm/vc4/vc4_debugfs.c index 80afc69200f0..c71e4d6ec4c4 100644 --- a/drivers/gpu/drm/vc4/vc4_debugfs.c +++ b/drivers/gpu/drm/vc4/vc4_debugfs.c @@ -57,9 +57,26 @@ static int vc4_debugfs_dev_regset32(struct seq_file *m, void *unused) return vc4_debugfs_regset32(drm, regset, &p); } +static int vc4_debugfs_encoder_regset32(struct seq_file *m, void *unused) +{ + struct drm_debugfs_encoder_entry *entry = m->private; + struct drm_device *drm = entry->encoder->dev; + struct debugfs_regset32 *regset = entry->file.data; + struct drm_printer p = drm_seq_file_printer(m); + + return vc4_debugfs_regset32(drm, regset, &p); +} + void vc4_debugfs_add_regset32(struct drm_device *drm, const char *name, struct debugfs_regset32 *regset) { drm_debugfs_add_file(drm, name, vc4_debugfs_dev_regset32, regset); } + +void vc4_debugfs_encoder_add_regset32(struct drm_encoder *encoder, + const char *name, + struct debugfs_regset32 *regset) +{ + drm_debugfs_encoder_add_file(encoder, name, vc4_debugfs_encoder_regset32, regset); +} diff --git a/drivers/gpu/drm/vc4/vc4_dpi.c b/drivers/gpu/drm/vc4/vc4_dpi.c index f518d6e59ed6..084f7825dfa4 100644 --- a/drivers/gpu/drm/vc4/vc4_dpi.c +++ b/drivers/gpu/drm/vc4/vc4_dpi.c @@ -265,10 +265,9 @@ static const struct drm_encoder_helper_funcs vc4_dpi_encoder_helper_funcs = { static int vc4_dpi_late_register(struct drm_encoder *encoder) { - struct drm_device *drm = encoder->dev; struct vc4_dpi *dpi = to_vc4_dpi(encoder); - vc4_debugfs_add_regset32(drm, "dpi_regs", &dpi->regset); + vc4_debugfs_encoder_add_regset32(encoder, "dpi_regs", &dpi->regset); return 0; } diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h index 95069bb16821..8aaa8d00bc45 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h @@ -969,12 +969,20 @@ void vc4_debugfs_init(struct drm_minor *minor); void vc4_debugfs_add_regset32(struct drm_device *drm, const char *filename, struct debugfs_regset32 *regset); +void vc4_debugfs_encoder_add_regset32(struct drm_encoder *encoder, + const char *name, + struct debugfs_regset32 *regset); #else static inline void vc4_debugfs_add_regset32(struct drm_device *drm, const char *filename, struct debugfs_regset32 *regset) {} + +static inline void vc4_debugfs_encoder_add_regset32(struct drm_encoder *encoder, + const char *name, + struct debugfs_regset32 *regset) +{} #endif /* vc4_drv.c */ diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c index 2a71321b9222..00751b76bfe0 100644 --- a/drivers/gpu/drm/vc4/vc4_dsi.c +++ b/drivers/gpu/drm/vc4/vc4_dsi.c @@ -1424,10 +1424,9 @@ static const struct drm_bridge_funcs vc4_dsi_bridge_funcs = { static int vc4_dsi_late_register(struct drm_encoder *encoder) { - struct drm_device *drm = encoder->dev; struct vc4_dsi *dsi = to_vc4_dsi(encoder); - vc4_debugfs_add_regset32(drm, dsi->variant->debugfs_name, &dsi->regset); + vc4_debugfs_encoder_add_regset32(encoder, dsi->variant->debugfs_name, &dsi->regset); return 0; } diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 14628864487a..221cef11d4dd 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -2002,12 +2002,11 @@ static const struct drm_encoder_helper_funcs vc4_hdmi_encoder_helper_funcs = { static int vc4_hdmi_late_register(struct drm_encoder *encoder) { - struct drm_device *drm = encoder->dev; struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); const struct vc4_hdmi_variant *variant = vc4_hdmi->variant; - drm_debugfs_add_file(drm, variant->debugfs_name, - vc4_hdmi_debugfs_regs, vc4_hdmi); + drm_debugfs_encoder_add_file(encoder, variant->debugfs_name, + vc4_hdmi_debugfs_regs, vc4_hdmi); return 0; } diff --git a/drivers/gpu/drm/vc4/vc4_vec.c b/drivers/gpu/drm/vc4/vc4_vec.c index a3782d05cd66..4c5bd733d524 100644 --- a/drivers/gpu/drm/vc4/vc4_vec.c +++ b/drivers/gpu/drm/vc4/vc4_vec.c @@ -716,10 +716,9 @@ static const struct drm_encoder_helper_funcs vc4_vec_encoder_helper_funcs = { static int vc4_vec_late_register(struct drm_encoder *encoder) { - struct drm_device *drm = encoder->dev; struct vc4_vec *vec = encoder_to_vc4_vec(encoder); - vc4_debugfs_add_regset32(drm, "vec_regs", &vec->regset); + vc4_debugfs_encoder_add_regset32(encoder, "vec_regs", &vec->regset); return 0; } From patchwork Wed Jan 11 17:37:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ma=C3=ADra_Canal?= X-Patchwork-Id: 13097061 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id E9950C5479D for ; Wed, 11 Jan 2023 17:39:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BEA4210E7B7; Wed, 11 Jan 2023 17:39:18 +0000 (UTC) Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id B582E10E7B8 for ; Wed, 11 Jan 2023 17:39:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=4gl2pFWgYrzPZmPcG8qvunz/5tzwPpFB+A9QyO3wfi0=; b=a14S5VeRJoqGQJ4KqX5PyWddv4 EQftU2k8hrhNQHBDAY9YI8/N9T1YIHr0tfDZARFmYKnTsQmGA4Jc1BxfcZDZf3Vn9gjsVRdlGqryf tZs1JSSSdaG2Lc/ofYWBuIgO+MfnPRdU76WslmjP3nlL8gJLk9p77cVtvJH1gM0e484Rq808PBWbJ CJP/T5Ah31yEOuUN+x16MYzkPc3jK1UCERyd/+5bOH/DzWWgXrkgmYN8pddZ6aCGpiF/3zLUK9COD oaSlqO6FX+uhZ6H6LGV6HJP5nMW8K/bcGHZZL6Knwr8Se3a4f4024i5xtk1o8hnzz1JvTP7y9Is1e WMQ5za/g==; Received: from [187.36.234.139] (helo=bowie..) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1pFf3z-005Sku-FU; Wed, 11 Jan 2023 18:39:00 +0100 From: =?utf-8?q?Ma=C3=ADra_Canal?= To: Maxime Ripard , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Jani Nikula , Alain Volmat Subject: [PATCH 08/13] drm/vc4: Use the crtc's debugfs infrastructure Date: Wed, 11 Jan 2023 14:37:43 -0300 Message-Id: <20230111173748.752659-9-mcanal@igalia.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230111173748.752659-1-mcanal@igalia.com> References: <20230111173748.752659-1-mcanal@igalia.com> 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: , Cc: Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , =?utf-8?q?Andr=C3=A9_Alme?= =?utf-8?q?ida?= , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Replace the use of drm_debugfs_add_files() with the new drm_debugfs_crtc_add_files() function, which centers the debugfs files management on the drm_crtc instead of drm_device. Using this function on late register callbacks is more adequate as the callback passes a drm_crtc as parameter. Signed-off-by: Maíra Canal --- drivers/gpu/drm/vc4/vc4_crtc.c | 5 ++--- drivers/gpu/drm/vc4/vc4_debugfs.c | 17 +++++++++++++++++ drivers/gpu/drm/vc4/vc4_drv.h | 8 ++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c index cdc0559221f0..3e5c71c0bed3 100644 --- a/drivers/gpu/drm/vc4/vc4_crtc.c +++ b/drivers/gpu/drm/vc4/vc4_crtc.c @@ -1104,12 +1104,11 @@ void vc4_crtc_reset(struct drm_crtc *crtc) int vc4_crtc_late_register(struct drm_crtc *crtc) { - struct drm_device *drm = crtc->dev; struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc); const struct vc4_crtc_data *crtc_data = vc4_crtc_to_vc4_crtc_data(vc4_crtc); - vc4_debugfs_add_regset32(drm, crtc_data->debugfs_name, - &vc4_crtc->regset); + vc4_debugfs_crtc_add_regset32(crtc, crtc_data->debugfs_name, + &vc4_crtc->regset); return 0; } diff --git a/drivers/gpu/drm/vc4/vc4_debugfs.c b/drivers/gpu/drm/vc4/vc4_debugfs.c index c71e4d6ec4c4..33023ae32ddf 100644 --- a/drivers/gpu/drm/vc4/vc4_debugfs.c +++ b/drivers/gpu/drm/vc4/vc4_debugfs.c @@ -57,6 +57,16 @@ static int vc4_debugfs_dev_regset32(struct seq_file *m, void *unused) return vc4_debugfs_regset32(drm, regset, &p); } +static int vc4_debugfs_crtc_regset32(struct seq_file *m, void *unused) +{ + struct drm_debugfs_crtc_entry *entry = m->private; + struct drm_device *drm = entry->crtc->dev; + struct debugfs_regset32 *regset = entry->file.data; + struct drm_printer p = drm_seq_file_printer(m); + + return vc4_debugfs_regset32(drm, regset, &p); +} + static int vc4_debugfs_encoder_regset32(struct seq_file *m, void *unused) { struct drm_debugfs_encoder_entry *entry = m->private; @@ -74,6 +84,13 @@ void vc4_debugfs_add_regset32(struct drm_device *drm, drm_debugfs_add_file(drm, name, vc4_debugfs_dev_regset32, regset); } +void vc4_debugfs_crtc_add_regset32(struct drm_crtc *crtc, + const char *name, + struct debugfs_regset32 *regset) +{ + drm_debugfs_crtc_add_file(crtc, name, vc4_debugfs_crtc_regset32, regset); +} + void vc4_debugfs_encoder_add_regset32(struct drm_encoder *encoder, const char *name, struct debugfs_regset32 *regset) diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h index 8aaa8d00bc45..9a1b777afee2 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h @@ -969,6 +969,9 @@ void vc4_debugfs_init(struct drm_minor *minor); void vc4_debugfs_add_regset32(struct drm_device *drm, const char *filename, struct debugfs_regset32 *regset); +void vc4_debugfs_crtc_add_regset32(struct drm_crtc *crtc, + const char *name, + struct debugfs_regset32 *regset); void vc4_debugfs_encoder_add_regset32(struct drm_encoder *encoder, const char *name, struct debugfs_regset32 *regset); @@ -979,6 +982,11 @@ static inline void vc4_debugfs_add_regset32(struct drm_device *drm, struct debugfs_regset32 *regset) {} +static inline void vc4_debugfs_crtc_add_regset32(struct drm_crtc *crtc, + const char *name, + struct debugfs_regset32 *regset) +{} + static inline void vc4_debugfs_encoder_add_regset32(struct drm_encoder *encoder, const char *name, struct debugfs_regset32 *regset) From patchwork Wed Jan 11 17:37:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ma=C3=ADra_Canal?= X-Patchwork-Id: 13097062 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id D14B3C46467 for ; Wed, 11 Jan 2023 17:39:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9CB1B10E7B8; Wed, 11 Jan 2023 17:39:19 +0000 (UTC) Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id C8D6810E7B7 for ; Wed, 11 Jan 2023 17:39:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=saDsxy6VkRFo0MSUyGyDe1iXynIh/Kf/w3cWZNTzadk=; b=f4UXaNDAkwRuyIzLtvHmtrGK1r cZLu3Rq31rIAg+UxmhSJc7h8xZPw01RTKtd+DCte51cmRwUXwkWRFUuIzdOc1vXkIGM18NVqXBqUq LPe4/38PrTNwgJUAYt2n/N+e/cvCi3te4yENTa/wwoBAzFXkMYpoAPooKPhAPtUx573A4OiKVvZD5 I+amIV4TNtoVbMwWwxa1k8CuCGc2fjxVWMIy0L8GYdPrtmlyzBwpPG539MfV3d6A9P5Nm9OsHzZLl srPFLJPSOktk53+fR9AEyc628zB+Ty8sQzsyLpmNoce8pnjZ0pXzrs3r7/rq2tAIMKn+QrhM+A96M XQPgF5RQ==; Received: from [187.36.234.139] (helo=bowie..) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1pFf43-005Sku-NY; Wed, 11 Jan 2023 18:39:04 +0100 From: =?utf-8?q?Ma=C3=ADra_Canal?= To: Maxime Ripard , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Jani Nikula , Alain Volmat Subject: [PATCH 09/13] drm/sti: Use the crtc's debugfs infrastructure Date: Wed, 11 Jan 2023 14:37:44 -0300 Message-Id: <20230111173748.752659-10-mcanal@igalia.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230111173748.752659-1-mcanal@igalia.com> References: <20230111173748.752659-1-mcanal@igalia.com> 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: , Cc: Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , =?utf-8?q?Andr=C3=A9_Alme?= =?utf-8?q?ida?= , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Replace the use of drm_debugfs_add_files() with the new drm_debugfs_crtc_add_files() function, which centers the debugfs files management on the drm_crtc instead of drm_device. Using this function on late register callbacks is more adequate as the callback passes a drm_crtc as parameter. Signed-off-by: Maíra Canal --- drivers/gpu/drm/sti/sti_compositor.c | 6 +++--- drivers/gpu/drm/sti/sti_compositor.h | 2 +- drivers/gpu/drm/sti/sti_crtc.c | 2 +- drivers/gpu/drm/sti/sti_mixer.c | 31 +++++----------------------- drivers/gpu/drm/sti/sti_mixer.h | 2 +- drivers/gpu/drm/sti/sti_vid.c | 19 ++++------------- drivers/gpu/drm/sti/sti_vid.h | 2 +- 7 files changed, 16 insertions(+), 48 deletions(-) diff --git a/drivers/gpu/drm/sti/sti_compositor.c b/drivers/gpu/drm/sti/sti_compositor.c index 142a8e1b4436..822da9d2879c 100644 --- a/drivers/gpu/drm/sti/sti_compositor.c +++ b/drivers/gpu/drm/sti/sti_compositor.c @@ -44,17 +44,17 @@ static const struct sti_compositor_data stih407_compositor_data = { }; void sti_compositor_debugfs_init(struct sti_compositor *compo, - struct drm_minor *minor) + struct drm_crtc *crtc) { unsigned int i; for (i = 0; i < STI_MAX_VID; i++) if (compo->vid[i]) - vid_debugfs_init(compo->vid[i], minor); + vid_debugfs_init(compo->vid[i], crtc); for (i = 0; i < STI_MAX_MIXER; i++) if (compo->mixer[i]) - sti_mixer_debugfs_init(compo->mixer[i], minor); + sti_mixer_debugfs_init(compo->mixer[i], crtc); } static int sti_compositor_bind(struct device *dev, diff --git a/drivers/gpu/drm/sti/sti_compositor.h b/drivers/gpu/drm/sti/sti_compositor.h index 25bb01bdd013..f5e9a2e4b6b5 100644 --- a/drivers/gpu/drm/sti/sti_compositor.h +++ b/drivers/gpu/drm/sti/sti_compositor.h @@ -80,6 +80,6 @@ struct sti_compositor { }; void sti_compositor_debugfs_init(struct sti_compositor *compo, - struct drm_minor *minor); + struct drm_crtc *crtc); #endif diff --git a/drivers/gpu/drm/sti/sti_crtc.c b/drivers/gpu/drm/sti/sti_crtc.c index 3c7154f2d5f3..176c74db8bb7 100644 --- a/drivers/gpu/drm/sti/sti_crtc.c +++ b/drivers/gpu/drm/sti/sti_crtc.c @@ -318,7 +318,7 @@ static int sti_crtc_late_register(struct drm_crtc *crtc) struct sti_compositor *compo = dev_get_drvdata(mixer->dev); if (drm_crtc_index(crtc) == 0) - sti_compositor_debugfs_init(compo, crtc->dev->primary); + sti_compositor_debugfs_init(compo, crtc); return 0; } diff --git a/drivers/gpu/drm/sti/sti_mixer.c b/drivers/gpu/drm/sti/sti_mixer.c index 7e5f14646625..ce775c64db2e 100644 --- a/drivers/gpu/drm/sti/sti_mixer.c +++ b/drivers/gpu/drm/sti/sti_mixer.c @@ -147,8 +147,8 @@ static void mixer_dbg_mxn(struct seq_file *s, void *addr) static int mixer_dbg_show(struct seq_file *s, void *arg) { - struct drm_info_node *node = s->private; - struct sti_mixer *mixer = (struct sti_mixer *)node->info_ent->data; + struct drm_debugfs_crtc_entry *entry = s->private; + struct sti_mixer *mixer = (struct sti_mixer *)entry->file.data; seq_printf(s, "%s: (vaddr = 0x%p)", sti_mixer_to_str(mixer), mixer->regs); @@ -170,39 +170,18 @@ static int mixer_dbg_show(struct seq_file *s, void *arg) return 0; } -static struct drm_info_list mixer0_debugfs_files[] = { - { "mixer_main", mixer_dbg_show, 0, NULL }, -}; - -static struct drm_info_list mixer1_debugfs_files[] = { - { "mixer_aux", mixer_dbg_show, 0, NULL }, -}; - -void sti_mixer_debugfs_init(struct sti_mixer *mixer, struct drm_minor *minor) +void sti_mixer_debugfs_init(struct sti_mixer *mixer, struct drm_crtc *crtc) { - unsigned int i; - struct drm_info_list *mixer_debugfs_files; - int nb_files; - switch (mixer->id) { case STI_MIXER_MAIN: - mixer_debugfs_files = mixer0_debugfs_files; - nb_files = ARRAY_SIZE(mixer0_debugfs_files); + drm_debugfs_crtc_add_file(crtc, "mixer_main", mixer_dbg_show, mixer); break; case STI_MIXER_AUX: - mixer_debugfs_files = mixer1_debugfs_files; - nb_files = ARRAY_SIZE(mixer1_debugfs_files); + drm_debugfs_crtc_add_file(crtc, "mixer_aux", mixer_dbg_show, mixer); break; default: return; } - - for (i = 0; i < nb_files; i++) - mixer_debugfs_files[i].data = mixer; - - drm_debugfs_create_files(mixer_debugfs_files, - nb_files, - minor->debugfs_root, minor); } void sti_mixer_set_background_status(struct sti_mixer *mixer, bool enable) diff --git a/drivers/gpu/drm/sti/sti_mixer.h b/drivers/gpu/drm/sti/sti_mixer.h index ab06beb7b258..973f7058092b 100644 --- a/drivers/gpu/drm/sti/sti_mixer.h +++ b/drivers/gpu/drm/sti/sti_mixer.h @@ -58,7 +58,7 @@ int sti_mixer_active_video_area(struct sti_mixer *mixer, void sti_mixer_set_background_status(struct sti_mixer *mixer, bool enable); -void sti_mixer_debugfs_init(struct sti_mixer *mixer, struct drm_minor *minor); +void sti_mixer_debugfs_init(struct sti_mixer *mixer, struct drm_crtc *crtc); /* depth in Cross-bar control = z order */ #define GAM_MIXER_NB_DEPTH_LEVEL 6 diff --git a/drivers/gpu/drm/sti/sti_vid.c b/drivers/gpu/drm/sti/sti_vid.c index 2d818397918d..98f2f4c8c2db 100644 --- a/drivers/gpu/drm/sti/sti_vid.c +++ b/drivers/gpu/drm/sti/sti_vid.c @@ -92,8 +92,8 @@ static void vid_dbg_mst(struct seq_file *s, int val) static int vid_dbg_show(struct seq_file *s, void *arg) { - struct drm_info_node *node = s->private; - struct sti_vid *vid = (struct sti_vid *)node->info_ent->data; + struct drm_debugfs_crtc_entry *entry = s->private; + struct sti_vid *vid = (struct sti_vid *)entry->file.data; seq_printf(s, "VID: (vaddr= 0x%p)", vid->regs); @@ -120,20 +120,9 @@ static int vid_dbg_show(struct seq_file *s, void *arg) return 0; } -static struct drm_info_list vid_debugfs_files[] = { - { "vid", vid_dbg_show, 0, NULL }, -}; - -void vid_debugfs_init(struct sti_vid *vid, struct drm_minor *minor) +void vid_debugfs_init(struct sti_vid *vid, struct drm_crtc *crtc) { - unsigned int i; - - for (i = 0; i < ARRAY_SIZE(vid_debugfs_files); i++) - vid_debugfs_files[i].data = vid; - - drm_debugfs_create_files(vid_debugfs_files, - ARRAY_SIZE(vid_debugfs_files), - minor->debugfs_root, minor); + drm_debugfs_crtc_add_file(crtc, "vid", vid_dbg_show, vid); } void sti_vid_commit(struct sti_vid *vid, diff --git a/drivers/gpu/drm/sti/sti_vid.h b/drivers/gpu/drm/sti/sti_vid.h index 991849ba50b5..a14577a8df48 100644 --- a/drivers/gpu/drm/sti/sti_vid.h +++ b/drivers/gpu/drm/sti/sti_vid.h @@ -26,6 +26,6 @@ void sti_vid_disable(struct sti_vid *vid); struct sti_vid *sti_vid_create(struct device *dev, struct drm_device *drm_dev, int id, void __iomem *baseaddr); -void vid_debugfs_init(struct sti_vid *vid, struct drm_minor *minor); +void vid_debugfs_init(struct sti_vid *vid, struct drm_crtc *crtc); #endif From patchwork Wed Jan 11 17:37:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ma=C3=ADra_Canal?= X-Patchwork-Id: 13097065 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 655B5C46467 for ; Wed, 11 Jan 2023 17:39:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E321D10E7B9; Wed, 11 Jan 2023 17:39:29 +0000 (UTC) Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id EFC8B10E7B7 for ; Wed, 11 Jan 2023 17:39:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=M6dLSSXWPTXHD495TvvFtj63ymqVq8XZJDcxHou6zuo=; b=TXxZsiFuTBymS1xiETYH9dTM3+ Yn29+8W/b2LZxab5ier8Jlx+O3iXHaqnZfB0pETWxXHpOskhgEIw0TSdXX8OzJywrWg0Z9zaqGaO3 VeW1noDkoD4dxYTwmHjRvgZixdpr9v7Jd6h/Dh+gpYu0Q6PYepaAhmPxiLvjmssoRzVn2Emhi91wh +AXpjR7gd4f4ZcPpHBESANB+irTy44PxReUNNlA0bklOpKGTDjJhMtOeGfz52j+7BtdsMY2l7PDVj eO2hfe5j2XmwUanC3MpTroAzCx6rh2Z5U1w39I6fQrZ5HznK4YZSZLPgKNzW3AdIJt3wis3JkFjNr GCJxe5Gw==; Received: from [187.36.234.139] (helo=bowie..) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1pFf48-005Sku-9I; Wed, 11 Jan 2023 18:39:08 +0100 From: =?utf-8?q?Ma=C3=ADra_Canal?= To: Maxime Ripard , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Jani Nikula , Alain Volmat Subject: [PATCH 10/13] drm/sti: Use the connectors' debugfs infrastructure Date: Wed, 11 Jan 2023 14:37:45 -0300 Message-Id: <20230111173748.752659-11-mcanal@igalia.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230111173748.752659-1-mcanal@igalia.com> References: <20230111173748.752659-1-mcanal@igalia.com> 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: , Cc: Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , =?utf-8?q?Andr=C3=A9_Alme?= =?utf-8?q?ida?= , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Replace the use of drm_debugfs_add_files() with the new drm_debugfs_connector_add_files() function, which centers the debugfs files management on the drm_connector instead of drm_device. Using this function on late register callbacks is more adequate as the callback passes a drm_connector as parameter. Signed-off-by: Maíra Canal --- drivers/gpu/drm/sti/sti_dvo.c | 21 +++++---------------- drivers/gpu/drm/sti/sti_hda.c | 21 +++++---------------- drivers/gpu/drm/sti/sti_hdmi.c | 21 +++++---------------- 3 files changed, 15 insertions(+), 48 deletions(-) diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c index f3a5616b7daf..b617c288b893 100644 --- a/drivers/gpu/drm/sti/sti_dvo.c +++ b/drivers/gpu/drm/sti/sti_dvo.c @@ -178,8 +178,8 @@ static void dvo_dbg_awg_microcode(struct seq_file *s, void __iomem *reg) static int dvo_dbg_show(struct seq_file *s, void *data) { - struct drm_info_node *node = s->private; - struct sti_dvo *dvo = (struct sti_dvo *)node->info_ent->data; + struct drm_debugfs_connector_entry *entry = s->private; + struct sti_dvo *dvo = (struct sti_dvo *)entry->file.data; seq_printf(s, "DVO: (vaddr = 0x%p)", dvo->regs); DBGFS_DUMP(DVO_AWG_DIGSYNC_CTRL); @@ -192,20 +192,9 @@ static int dvo_dbg_show(struct seq_file *s, void *data) return 0; } -static struct drm_info_list dvo_debugfs_files[] = { - { "dvo", dvo_dbg_show, 0, NULL }, -}; - -static void dvo_debugfs_init(struct sti_dvo *dvo, struct drm_minor *minor) +static void dvo_debugfs_init(struct sti_dvo *dvo, struct drm_connector *connector) { - unsigned int i; - - for (i = 0; i < ARRAY_SIZE(dvo_debugfs_files); i++) - dvo_debugfs_files[i].data = dvo; - - drm_debugfs_create_files(dvo_debugfs_files, - ARRAY_SIZE(dvo_debugfs_files), - minor->debugfs_root, minor); + drm_debugfs_connector_add_file(connector, "dvo", dvo_dbg_show, dvo); } static void sti_dvo_disable(struct drm_bridge *bridge) @@ -403,7 +392,7 @@ static int sti_dvo_late_register(struct drm_connector *connector) = to_sti_dvo_connector(connector); struct sti_dvo *dvo = dvo_connector->dvo; - dvo_debugfs_init(dvo, dvo->drm_dev->primary); + dvo_debugfs_init(dvo, connector); return 0; } diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c index ec6656b9ee7c..9560f29db6e1 100644 --- a/drivers/gpu/drm/sti/sti_hda.c +++ b/drivers/gpu/drm/sti/sti_hda.c @@ -345,8 +345,8 @@ static void hda_dbg_video_dacs_ctrl(struct seq_file *s, void __iomem *reg) static int hda_dbg_show(struct seq_file *s, void *data) { - struct drm_info_node *node = s->private; - struct sti_hda *hda = (struct sti_hda *)node->info_ent->data; + struct drm_debugfs_connector_entry *entry = s->private; + struct sti_hda *hda = (struct sti_hda *)entry->file.data; seq_printf(s, "HD Analog: (vaddr = 0x%p)", hda->regs); DBGFS_DUMP(HDA_ANA_CFG); @@ -364,20 +364,9 @@ static int hda_dbg_show(struct seq_file *s, void *data) return 0; } -static struct drm_info_list hda_debugfs_files[] = { - { "hda", hda_dbg_show, 0, NULL }, -}; - -static void hda_debugfs_init(struct sti_hda *hda, struct drm_minor *minor) +static void hda_debugfs_init(struct sti_hda *hda, struct drm_connector *connector) { - unsigned int i; - - for (i = 0; i < ARRAY_SIZE(hda_debugfs_files); i++) - hda_debugfs_files[i].data = hda; - - drm_debugfs_create_files(hda_debugfs_files, - ARRAY_SIZE(hda_debugfs_files), - minor->debugfs_root, minor); + drm_debugfs_connector_add_file(connector, "hda", hda_dbg_show, hda); } /** @@ -643,7 +632,7 @@ static int sti_hda_late_register(struct drm_connector *connector) = to_sti_hda_connector(connector); struct sti_hda *hda = hda_connector->hda; - hda_debugfs_init(hda, hda->drm_dev->primary); + hda_debugfs_init(hda, connector); return 0; } diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c index fcc2194869d6..9b82d9b7db6a 100644 --- a/drivers/gpu/drm/sti/sti_hdmi.c +++ b/drivers/gpu/drm/sti/sti_hdmi.c @@ -668,8 +668,8 @@ static void hdmi_dbg_sw_di_cfg(struct seq_file *s, int val) static int hdmi_dbg_show(struct seq_file *s, void *data) { - struct drm_info_node *node = s->private; - struct sti_hdmi *hdmi = (struct sti_hdmi *)node->info_ent->data; + struct drm_debugfs_connector_entry *entry = s->private; + struct sti_hdmi *hdmi = (struct sti_hdmi *)entry->file.data; seq_printf(s, "HDMI: (vaddr = 0x%p)", hdmi->regs); DBGFS_DUMP("\n", HDMI_CFG); @@ -730,20 +730,9 @@ static int hdmi_dbg_show(struct seq_file *s, void *data) return 0; } -static struct drm_info_list hdmi_debugfs_files[] = { - { "hdmi", hdmi_dbg_show, 0, NULL }, -}; - -static void hdmi_debugfs_init(struct sti_hdmi *hdmi, struct drm_minor *minor) +static void hdmi_debugfs_init(struct sti_hdmi *hdmi, struct drm_connector *connector) { - unsigned int i; - - for (i = 0; i < ARRAY_SIZE(hdmi_debugfs_files); i++) - hdmi_debugfs_files[i].data = hdmi; - - drm_debugfs_create_files(hdmi_debugfs_files, - ARRAY_SIZE(hdmi_debugfs_files), - minor->debugfs_root, minor); + drm_debugfs_connector_add_file(connector, "hdmi", hdmi_dbg_show, hdmi); } static void sti_hdmi_disable(struct drm_bridge *bridge) @@ -1120,7 +1109,7 @@ static int sti_hdmi_late_register(struct drm_connector *connector) = to_sti_hdmi_connector(connector); struct sti_hdmi *hdmi = hdmi_connector->hdmi; - hdmi_debugfs_init(hdmi, hdmi->drm_dev->primary); + hdmi_debugfs_init(hdmi, connector); return 0; } From patchwork Wed Jan 11 17:37:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ma=C3=ADra_Canal?= X-Patchwork-Id: 13097063 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id CD871C5479D for ; Wed, 11 Jan 2023 17:39:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F229910E7BD; Wed, 11 Jan 2023 17:39:26 +0000 (UTC) Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 545D710E7B9 for ; Wed, 11 Jan 2023 17:39:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=oi+V6e0DSIlcwpc457pwLqM6HXb1h4o60/pcYsijnfI=; b=U7TgwudrGtcub6TPmNlgXFDFzf PHQy1W/FLEXJOZF6hCsHCeNJzd5gLsK0uNrjkMN0GA50NX4t6doLxiJqSB9Om1DJkPg/aHL/2wZii RhlzifQRVCUM5VkhzPDPzZbBLzT7ShVkT3kJFUqcozb9NeHW0c9FWHHegKdiW0bJD3Ynm9YPvbRPa JY7DUwDKcK0pfJixZPGaCwXNUWeJxJgz1x+4MIQb2RJD6BTuSbesurMbM1IIOFlGa9LgFSmL0xRJ4 tuQvAA4sNs8ngEmvofI94ZQS9rOrOTGif/4eq4zNMo9+uUtI7ECQIR3URh028QyXshZUuLeW2hlAS 0bUOs8TQ==; Received: from [187.36.234.139] (helo=bowie..) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1pFf4C-005Sku-MS; Wed, 11 Jan 2023 18:39:13 +0100 From: =?utf-8?q?Ma=C3=ADra_Canal?= To: Maxime Ripard , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Jani Nikula , Alain Volmat Subject: [PATCH 11/13] drm/sti: Use the encoders' debugfs infrastructure Date: Wed, 11 Jan 2023 14:37:46 -0300 Message-Id: <20230111173748.752659-12-mcanal@igalia.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230111173748.752659-1-mcanal@igalia.com> References: <20230111173748.752659-1-mcanal@igalia.com> 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: , Cc: Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , =?utf-8?q?Andr=C3=A9_Alme?= =?utf-8?q?ida?= , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Replace the use of drm_debugfs_add_files() with the new drm_debugfs_encoder_add_files() function, which centers the debugfs files management on the drm_encoder instead of drm_device. Using this function on late register callbacks is more adequate as the callback passes a drm_encoder as parameter. Signed-off-by: Maíra Canal --- drivers/gpu/drm/sti/sti_tvout.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/sti/sti_tvout.c b/drivers/gpu/drm/sti/sti_tvout.c index 2499715a69b7..5601888caec4 100644 --- a/drivers/gpu/drm/sti/sti_tvout.c +++ b/drivers/gpu/drm/sti/sti_tvout.c @@ -496,8 +496,8 @@ static void tvout_dbg_hd_dac_cfg(struct seq_file *s, int val) static int tvout_dbg_show(struct seq_file *s, void *data) { - struct drm_info_node *node = s->private; - struct sti_tvout *tvout = (struct sti_tvout *)node->info_ent->data; + struct drm_debugfs_encoder_entry *entry = s->private; + struct sti_tvout *tvout = (struct sti_tvout *)entry->file.data; struct drm_crtc *crtc; seq_printf(s, "TVOUT: (vaddr = 0x%p)", tvout->regs); @@ -566,20 +566,9 @@ static int tvout_dbg_show(struct seq_file *s, void *data) return 0; } -static struct drm_info_list tvout_debugfs_files[] = { - { "tvout", tvout_dbg_show, 0, NULL }, -}; - -static void tvout_debugfs_init(struct sti_tvout *tvout, struct drm_minor *minor) +static void tvout_debugfs_init(struct sti_tvout *tvout, struct drm_encoder *encoder) { - unsigned int i; - - for (i = 0; i < ARRAY_SIZE(tvout_debugfs_files); i++) - tvout_debugfs_files[i].data = tvout; - - drm_debugfs_create_files(tvout_debugfs_files, - ARRAY_SIZE(tvout_debugfs_files), - minor->debugfs_root, minor); + drm_debugfs_encoder_add_file(encoder, "tvout", tvout_dbg_show, tvout); } static void sti_tvout_encoder_dpms(struct drm_encoder *encoder, int mode) @@ -607,7 +596,7 @@ static int sti_tvout_late_register(struct drm_encoder *encoder) if (tvout->debugfs_registered) return 0; - tvout_debugfs_init(tvout, encoder->dev->primary); + tvout_debugfs_init(tvout, encoder); tvout->debugfs_registered = true; return 0; From patchwork Wed Jan 11 17:37:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ma=C3=ADra_Canal?= X-Patchwork-Id: 13097064 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id CD132C5479D for ; Wed, 11 Jan 2023 17:39:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8253110E7BA; Wed, 11 Jan 2023 17:39:29 +0000 (UTC) Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id AD08210E7B9 for ; Wed, 11 Jan 2023 17:39:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=VuknvR/eX5vfDCyU1tH62dyNfEz79ebOqLZs6uv4njU=; b=UPKIDJCPRDYWzvh/KFT+vgSWbl 58mW1sa55xEAXl0pjEWQOY7oaVne7nFfw2cV5Agj4JnRNgsHYXC0PNWAOU+WiHUYWyuBa+fmMfwD6 yOdByqpYo5QfcJVlsruZxWXnt4szMZjDtvSiwAK22e7HxdUaU2bZVkFvgocLNJAQ9nJlIrIOHCJOC iv3dwlxazRZ2sBKSxoU/4pbr0LfHgT45TzA7L1UQK88V+zVmgtZK3ZfCgDdBxx3md7nrjNZ+tgeWU e8oWLQQSx//Dl4tIbAwRFXBvwFGA56d6gd9QD+vGM/q+jChk2WsOxsgY4ycnhRrh7bWaWpM4X2JgF t9jE6F9w==; Received: from [187.36.234.139] (helo=bowie..) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1pFf4G-005Sku-OC; Wed, 11 Jan 2023 18:39:17 +0100 From: =?utf-8?q?Ma=C3=ADra_Canal?= To: Maxime Ripard , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Jani Nikula , Alain Volmat Subject: [PATCH 12/13] drm/debugfs: Remove the debugfs late register function Date: Wed, 11 Jan 2023 14:37:47 -0300 Message-Id: <20230111173748.752659-13-mcanal@igalia.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230111173748.752659-1-mcanal@igalia.com> References: <20230111173748.752659-1-mcanal@igalia.com> 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: , Cc: Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , =?utf-8?q?Andr=C3=A9_Alme?= =?utf-8?q?ida?= , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" With the new debugfs infrastructure for kms objects, there is no need to have a late register helper for debugfs, as the late register debugfs function was only created because drm_debugfs_init() is not able to create debugfs files for modeset components, as they are registered after the primary and the render drm_minor are registered. Now that each kms object has its own debugfs init function, remove the debugfs late register function. Signed-off-by: Maíra Canal --- drivers/gpu/drm/drm_debugfs.c | 11 ----------- drivers/gpu/drm/drm_internal.h | 5 ----- drivers/gpu/drm/drm_mode_config.c | 2 -- 3 files changed, 18 deletions(-) diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c index e1f71a03a581..fe470a896527 100644 --- a/drivers/gpu/drm/drm_debugfs.c +++ b/drivers/gpu/drm/drm_debugfs.c @@ -294,17 +294,6 @@ void drm_debugfs_encoder_init(struct drm_encoder *encoder) drm_create_file_from_list(encoder); } -void drm_debugfs_late_register(struct drm_device *dev) -{ - struct drm_minor *minor = dev->primary; - struct drm_debugfs_entry *entry, *tmp; - - if (!minor) - return; - - drm_create_file_from_list(dev); -} - int drm_debugfs_remove_files(const struct drm_info_list *files, int count, struct drm_minor *minor) { diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h index 9be697f7f8f9..eb6a0545249a 100644 --- a/drivers/gpu/drm/drm_internal.h +++ b/drivers/gpu/drm/drm_internal.h @@ -189,7 +189,6 @@ void drm_debugfs_crtc_init(struct drm_crtc *crtc); void drm_debugfs_connector_init(struct drm_connector *connector); void drm_debugfs_encoder_init(struct drm_encoder *encoder); void drm_debugfs_cleanup(struct drm_minor *minor); -void drm_debugfs_late_register(struct drm_device *dev); void drm_debugfs_connector_add(struct drm_connector *connector); void drm_debugfs_connector_remove(struct drm_connector *connector); void drm_debugfs_crtc_add(struct drm_crtc *crtc); @@ -218,10 +217,6 @@ static inline void drm_debugfs_cleanup(struct drm_minor *minor) { } -static inline void drm_debugfs_late_register(struct drm_device *dev) -{ -} - static inline void drm_debugfs_connector_add(struct drm_connector *connector) { } diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c index 87eb591fe9b5..8525ef851540 100644 --- a/drivers/gpu/drm/drm_mode_config.c +++ b/drivers/gpu/drm/drm_mode_config.c @@ -54,8 +54,6 @@ int drm_modeset_register_all(struct drm_device *dev) if (ret) goto err_connector; - drm_debugfs_late_register(dev); - return 0; err_connector: From patchwork Wed Jan 11 17:37:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ma=C3=ADra_Canal?= X-Patchwork-Id: 13097067 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 28252C46467 for ; Wed, 11 Jan 2023 17:39:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2B76410E7BE; Wed, 11 Jan 2023 17:39:40 +0000 (UTC) Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6D53010E7BE for ; Wed, 11 Jan 2023 17:39:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=+MeraZdARiGlH97qbC++ixvY3ydhDMG3H5stHgiEsfc=; b=DIzmdy90oU+wlzd53r1I83G1CM 2TYsAoW5ih1jfFEHNDQRZ3JI/BllXt8C2bDu9LT1rsgPX7D1odhMQT9av6kD7R+Rp1jj8kTGkXHX9 LuL82fGWKnx2hpeBB8hscJuZE2WpXlOc5DCxq7WAIiCxmtgQ5r989SnAduNM1cb6y2HtySdgMz0Bh P5SAV8Li/hl4vXc99a8n+dfHJI0oKCEfQTRmkSX9RY881N2Vq5UFCPReOY2Yd3agwsF6cHH4/U7Z7 vnJcymNNUtHpz9xL+5H3pUGH/tWRBG3ip1xl66UC6aaR+F8g46Jl2kQLTRsP5H6rnOR+QU0QrZjoh UovLHYtw==; Received: from [187.36.234.139] (helo=bowie..) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1pFf4L-005Sku-6G; Wed, 11 Jan 2023 18:39:21 +0100 From: =?utf-8?q?Ma=C3=ADra_Canal?= To: Maxime Ripard , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Jani Nikula , Alain Volmat Subject: [PATCH 13/13] drm/todo: Update the debugfs clean up task Date: Wed, 11 Jan 2023 14:37:48 -0300 Message-Id: <20230111173748.752659-14-mcanal@igalia.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230111173748.752659-1-mcanal@igalia.com> References: <20230111173748.752659-1-mcanal@igalia.com> 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: , Cc: Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , =?utf-8?q?Andr=C3=A9_Alme?= =?utf-8?q?ida?= , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The structs drm_debugfs_connector_entry, drm_debugfs_encoder_entry, and drm_debugfs_crtc_entry introduced a debugfs infrastruture that made it possible to remove late-register debugfs. So, update the debugfs clean up task to include the advances for the kms objects and point out possible improvements to be done. Signed-off-by: Maíra Canal --- Documentation/gpu/todo.rst | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst index 1f8a5ebe188e..3c4d4b8541e8 100644 --- a/Documentation/gpu/todo.rst +++ b/Documentation/gpu/todo.rst @@ -511,14 +511,12 @@ There's a bunch of issues with it: - Convert drivers to support the drm_debugfs_add_files() function instead of the drm_debugfs_create_files() function. -- Improve late-register debugfs by rolling out the same debugfs pre-register - infrastructure for connector and crtc too. That way, the drivers won't need to - split their setup code into init and register anymore. - -- We probably want to have some support for debugfs files on crtc/connectors and - maybe other kms objects directly in core. There's even drm_print support in - the funcs for these objects to dump kms state, so it's all there. And then the - ->show() functions should obviously give you a pointer to the right object. +- Convert drivers to use the kms object debugfs helpers, such as + drm_debugfs_connector_add_files(), instead of the drm_debugfs_create_files() + function on late register hooks. + +- We probably want to have some support for debugfs files on planes, like we + have for crtc, connectors, and encoders. - The drm_driver->debugfs_init hooks we have is just an artifact of the old midlayered load sequence. DRM debugfs should work more like sysfs, where you