From patchwork Thu Oct 10 17:39:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Louis Chauvet X-Patchwork-Id: 13830576 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 5F949CFC5E9 for ; Thu, 10 Oct 2024 17:39:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B87D710E99E; Thu, 10 Oct 2024 17:39:13 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.b="O0c+ilKA"; dkim-atps=neutral Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9F12110E983 for ; Thu, 10 Oct 2024 17:39:11 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id 64E3F60008; Thu, 10 Oct 2024 17:39:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1728581950; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PipLqVj5xkPyoetI+WW+1rh6cTZU8H1AKdi1jQjRa5M=; b=O0c+ilKAYO2EoXB1uSLrU/N3TfLGIVCeIHqsiZOFnhpSvzvj1GTfBE4DuBG0Q1SX1vXuEb EhZPtRKn9a1bgw2WQ8CFtFfp2nUK7GaomWUKHX5c1da7Y8mAxJhRCHzy/cc8HD4SYV00Uq umZqCmM/DeMTQTlCZjyc2cbvAXQlVapFH22yOiIDpgjuRZVLBBkcT4wLIc8f5LImFTjzem iYOqbR+DxmP2zx00M9V44Bg1OikZlU6iu/Cx71d+WREgJmHEFPG6H010mgSR6h5Iggw4jb cGP1z3rXvAjUtPtisuPgnUDdiIhJOxmKvdxdvJRSARs2ZcbPfOqLDt6DBJ0GZQ== From: Louis Chauvet Date: Thu, 10 Oct 2024 19:39:03 +0200 Subject: [PATCH v4 1/5] drm/vkms: Switch to managed for connector MIME-Version: 1.0 Message-Id: <20241010-google-vkms-managed-v4-1-ed04a62ad2e3@bootlin.com> References: <20241010-google-vkms-managed-v4-0-ed04a62ad2e3@bootlin.com> In-Reply-To: <20241010-google-vkms-managed-v4-0-ed04a62ad2e3@bootlin.com> To: Rodrigo Siqueira , Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Simona Vetter Cc: dri-devel@lists.freedesktop.org, arthurgrillo@riseup.net, linux-kernel@vger.kernel.org, jeremie.dautheribes@bootlin.com, miquel.raynal@bootlin.com, thomas.petazzoni@bootlin.com, seanpaul@google.com, nicolejadeyee@google.com, Louis Chauvet , 20241010-vkms-remove-index-v2-1-6b8d6cfd5a15@bootlin.com X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2372; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=yGT7SN06dK+D20p7SLaCpw1NfHZP91hoKUuigEH3q/E=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBnCBE6tqLjj+hV77ppmvzkLCGJ9MGEV00I36IHd JTVOpsiIKWJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZwgROgAKCRAgrS7GWxAs 4mhYEAC4BNUA2uE9CRw4E6NhdyIzgoE8pbSNx0a2/8CWVs+PwFq7xFfhLiYbie5lzQoqCG7MZhd qyuCzlu3nI1S8UvqCna17vnWI4Mb8NApJC5HF6/7QUb1M/apzMaez/BxAocBB5e6F/PS6XsXkvs VJWE9wkdznY3YazzQrQzKQariO7TFZhqmvHSQlaelNz9M/PFXj2UfUJd9W7BinUbvxhnZkyOeQl gVRPTctHYbKecPBBCgab4tNHUcYBW/LP914KhetGUJcXkO/7dRel4VFOUfJQVEaKBxeFtWjFu9R bhONIHzuheAHcxv4GEFUjiqdnAm5xIA0u5nl9w378zOxM/fNBkyr++cf58yrluqevg0AB1ugNIr 8USzW+/n30jU8wpaaTGs2nNH/McCerTB/EX2rNffIhKUDY8phMgH51elPD5rXgX00lQVdDVM8i4 2ykZQlK6SD6VbC8DmXgPmyIYuf8uFQzp+EEzmo2Uv3LwBcSty5M56e+RVS0OJH0QN2LPMfutnq5 LzX+IZKrPakAYMv9SPf+i5NDS0HeLS+TNyTRAbeR//OfL3vNah/Oaig2/8ZXW5AgDSuqu+hjBqr 5LjnyACYMjsbA4srYBevPj7YTQWNVRnsv4HWIqTE6D1IsNZqMWmtGr7YaA0kyEegXjwF5/gj+3b tWcYzLwrh/wDrvA== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-Sasl: louis.chauvet@bootlin.com 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The current VKMS driver uses non-managed function to create connectors. It is not an issue yet, but in order to support multiple devices easily, convert this code to use drm and device managed helpers. Signed-off-by: Louis Chauvet --- drivers/gpu/drm/vkms/vkms_output.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c index 5128aa3b2eb6..8f7a05b73e1d 100644 --- a/drivers/gpu/drm/vkms/vkms_output.c +++ b/drivers/gpu/drm/vkms/vkms_output.c @@ -3,11 +3,11 @@ #include "vkms_drv.h" #include #include +#include #include static const struct drm_connector_funcs vkms_connector_funcs = { .fill_modes = drm_helper_probe_single_connector_modes, - .destroy = drm_connector_cleanup, .reset = drm_atomic_helper_connector_reset, .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, @@ -70,17 +70,17 @@ int vkms_output_init(struct vkms_device *vkmsdev) if (IS_ERR(overlay)) { DRM_DEV_ERROR(dev->dev, "Failed to init vkms plane\n"); ret = PTR_ERR(overlay); - goto err_crtc; + goto err_connector; } overlay->base.possible_crtcs = drm_crtc_mask(crtc); } } - ret = drm_connector_init(dev, connector, &vkms_connector_funcs, - DRM_MODE_CONNECTOR_VIRTUAL); + ret = drmm_connector_init(dev, connector, &vkms_connector_funcs, + DRM_MODE_CONNECTOR_VIRTUAL, NULL); if (ret) { DRM_ERROR("Failed to init connector\n"); - goto err_crtc; + goto err_connector; } drm_connector_helper_add(connector, &vkms_conn_helper_funcs); @@ -89,7 +89,7 @@ int vkms_output_init(struct vkms_device *vkmsdev) DRM_MODE_ENCODER_VIRTUAL, NULL); if (ret) { DRM_ERROR("Failed to init encoder\n"); - goto err_encoder; + return ret; } encoder->possible_crtcs = drm_crtc_mask(crtc); @@ -111,12 +111,7 @@ int vkms_output_init(struct vkms_device *vkmsdev) err_attach: drm_encoder_cleanup(encoder); - -err_encoder: - drm_connector_cleanup(connector); - -err_crtc: +err_connector: drm_crtc_cleanup(crtc); - return ret; } From patchwork Thu Oct 10 17:39:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Louis Chauvet X-Patchwork-Id: 13830577 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 EA1F0CFC5EB for ; Thu, 10 Oct 2024 17:39:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B1DD910E987; Thu, 10 Oct 2024 17:39:13 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.b="oMI/eq4k"; dkim-atps=neutral Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by gabe.freedesktop.org (Postfix) with ESMTPS id CF16510E987 for ; Thu, 10 Oct 2024 17:39:12 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id 7E44060007; Thu, 10 Oct 2024 17:39:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1728581951; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mjqHkT9IVEOJZ1uSyhzJbsiqfoK7bqwM7inCqaTi0g8=; b=oMI/eq4kRM/Y305f54zMQsV9xROVNOm/5HHKXYp/Bn4sqqe2aorG5GKR3GaXUYOncCU3am WFOyCrZM5hY5dj8BCuvrEH1a2xmg0cE0X/Xe5pailD5W7e/E5DyTJYDhtCIKs1CDSDYUPy A91uiYaPq1AVwtcSVERfv0NpkYStYE2GPv96YTCv5s40R9NlTzhE20Ay0xcevPGnrfWBhP YOkb5xTc5a3h0KrEZVp2YMr/U+J6mnYFQAw2iX8UM+y8uunCXI/v+qr7Jvom8w9Sj8zJfK YW3gC+rBoIn4R8s9nnusVoHUv63OfoYWg6GNy9luxdzd9dudQ/s7+sXw/GleGA== From: Louis Chauvet Date: Thu, 10 Oct 2024 19:39:04 +0200 Subject: [PATCH v4 2/5] drm/vkms: Switch to managed for encoder MIME-Version: 1.0 Message-Id: <20241010-google-vkms-managed-v4-2-ed04a62ad2e3@bootlin.com> References: <20241010-google-vkms-managed-v4-0-ed04a62ad2e3@bootlin.com> In-Reply-To: <20241010-google-vkms-managed-v4-0-ed04a62ad2e3@bootlin.com> To: Rodrigo Siqueira , Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Simona Vetter Cc: dri-devel@lists.freedesktop.org, arthurgrillo@riseup.net, linux-kernel@vger.kernel.org, jeremie.dautheribes@bootlin.com, miquel.raynal@bootlin.com, thomas.petazzoni@bootlin.com, seanpaul@google.com, nicolejadeyee@google.com, Louis Chauvet , 20241010-vkms-remove-index-v2-1-6b8d6cfd5a15@bootlin.com X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1855; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=mhiDPGhfqrZUTw+u0l+InZGIFZ2Tudq0ZIqg2HTKL88=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBnCBE6rhwAbsn3Aq7NZbw28q7NmcApSw0KPn5q1 eg8qhN/jpGJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZwgROgAKCRAgrS7GWxAs 4rn/EADAX0SkwsxcvfzMRLwSP3AtuRTvVUt5ftggSW6KZVW1vyDUPDZo1126msRZ7UTpOpwSf6L Ym03n+ycyoXdQ5vepCE/63VJ2T+hIHgxqJhGSb3TZNfD0v90uMT4FRNJP3/ul9m1bzP0gQx+IyS T1niFn4YNjAcn1tDVTMRCFGcvV3e3ZVwumaGwa2Jx1OhT8kxXs7wu7ApSNlPzL4qE8VQxq1ub+C L2Bewv97AWz+j78HRFdVJaNprGoLCAsC7h9WUzht4o2dJEFI5SnE/pkRoGX9mj488fi4Xibx6sx OkaNwcOQX/mIFiUPcLc7lBxbUcq9yPLZdSsSmJA2e08NSKrnksRVNdDHXzyO7bN1J/BfkkYO4Sp ZeY/BkkIfqKkvpvtasuDeh49Iqbf0R39Y2LZ5kvAipz7BRcOfY9L4aLn/Ip0z3v8IY6B/T824z4 qzXJYYL1WUb12J58+ZsKzQTL25fHsDRhvx2oashFwo2k31a6pJRAQ6pHypfjK7yOQR33yHEjgEA 15VLYYTdj3M943EukYRlRcBXhnYuG3tJwzEB7RH7eQggHGqsDKO5gWqdReImnOpzmgo29D+uqXc u4WRv6CwogR9Hcjj9fRl8tT0pULMjT/pQRhGbhMfmk3pFrqsZBq1q2nUvPJThQAz2GUcv6Hayg8 o8sFcLWvkCa4LaA== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-Sasl: louis.chauvet@bootlin.com 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The current VKMS driver uses non-managed function to create encoders. It is not an issue yet, but in order to support multiple devices easily, convert this code to use drm and device managed helpers. Signed-off-by: Louis Chauvet --- drivers/gpu/drm/vkms/vkms_output.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c index 8f7a05b73e1d..c878b2843d05 100644 --- a/drivers/gpu/drm/vkms/vkms_output.c +++ b/drivers/gpu/drm/vkms/vkms_output.c @@ -13,10 +13,6 @@ static const struct drm_connector_funcs vkms_connector_funcs = { .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, }; -static const struct drm_encoder_funcs vkms_encoder_funcs = { - .destroy = drm_encoder_cleanup, -}; - static int vkms_conn_get_modes(struct drm_connector *connector) { int count; @@ -85,18 +81,18 @@ int vkms_output_init(struct vkms_device *vkmsdev) drm_connector_helper_add(connector, &vkms_conn_helper_funcs); - ret = drm_encoder_init(dev, encoder, &vkms_encoder_funcs, - DRM_MODE_ENCODER_VIRTUAL, NULL); + ret = drmm_encoder_init(dev, encoder, NULL, + DRM_MODE_ENCODER_VIRTUAL, NULL); if (ret) { DRM_ERROR("Failed to init encoder\n"); - return ret; + goto err_connector; } encoder->possible_crtcs = drm_crtc_mask(crtc); ret = drm_connector_attach_encoder(connector, encoder); if (ret) { DRM_ERROR("Failed to attach connector to encoder\n"); - goto err_attach; + return ret; } if (vkmsdev->config->writeback) { @@ -109,8 +105,6 @@ int vkms_output_init(struct vkms_device *vkmsdev) return 0; -err_attach: - drm_encoder_cleanup(encoder); err_connector: drm_crtc_cleanup(crtc); return ret; From patchwork Thu Oct 10 17:39:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Louis Chauvet X-Patchwork-Id: 13830579 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 545EDCFC5E9 for ; Thu, 10 Oct 2024 17:39:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4035710E984; Thu, 10 Oct 2024 17:39:17 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.b="ZrAk3ji+"; dkim-atps=neutral Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by gabe.freedesktop.org (Postfix) with ESMTPS id DF31D10E9A0 for ; Thu, 10 Oct 2024 17:39:13 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id 9B57F6000A; Thu, 10 Oct 2024 17:39:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1728581952; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PdDg8pgo6hxWE8qqCsve/ZQum9OXZmVcmDbzpy+h8Pg=; b=ZrAk3ji+jOXeFc3tXSg3rJJgXDgGWzmbaB4fvjO8VMgTE2NSoU0bM5v0YZ8Kesc2gHZF6n GK1ZzLpGurlcEpMFEOVH7gSikB7cilX9IPWlPa3gpxXpWvcLUyrF1JMH0+AoRCHOdD36En HTe8Yd1ugM58/Qhj2X3W4umfUbUX2cN229B7QNSbm+gBkPeU9DbV5WI2U3hWB0tfxNG9Ix z8j6KhdZ1ESHA8wrENDP0Tu7LYpuVjytSMnKUxbsnQFoflOCItvLVMKLpblc5l82E5lKS8 oSVlUOOp/DxcyCclJtbodCwitwUDq+jb0TZAi6rHDq2gU0gAPGZsyTlgamAsGQ== From: Louis Chauvet Date: Thu, 10 Oct 2024 19:39:05 +0200 Subject: [PATCH v4 3/5] drm/vkms: Switch to managed for crtc MIME-Version: 1.0 Message-Id: <20241010-google-vkms-managed-v4-3-ed04a62ad2e3@bootlin.com> References: <20241010-google-vkms-managed-v4-0-ed04a62ad2e3@bootlin.com> In-Reply-To: <20241010-google-vkms-managed-v4-0-ed04a62ad2e3@bootlin.com> To: Rodrigo Siqueira , Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Simona Vetter Cc: dri-devel@lists.freedesktop.org, arthurgrillo@riseup.net, linux-kernel@vger.kernel.org, jeremie.dautheribes@bootlin.com, miquel.raynal@bootlin.com, thomas.petazzoni@bootlin.com, seanpaul@google.com, nicolejadeyee@google.com, Louis Chauvet , 20241010-vkms-remove-index-v2-1-6b8d6cfd5a15@bootlin.com X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2642; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=PQ87QRrHXXBxQiWqyj4h93dY9Re2kRrb505r5//jqMg=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBnCBE6rkwcXhC0wI4yvPydsQ7G04/qbmhQNnmDa aJkIqgfSSyJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZwgROgAKCRAgrS7GWxAs 4k2FEADVySM/u59SKXvJ/mNkpg1otkqm1srqB1zrYRlxmAZwe2SoemXQMC7apI55CTX01W7aUvt nY/ZqXCjvEI/+1Ayk9Q00OsCGDY+GhpPl18TmFWwYg7iCEbZuWmnuekIuE50mb8EN4zITuJHqss HqNXfPJcDVd5B66pvsKkywy1MQdnHi8UvBrU609jpWBKcQlW7DSicIxBiwybhe/oSFQkANYMBlR 6X31IBsqbaUlCbvOBfNFeNK4OnH57lJWSLZnyR1FqrUJhj/WyKtxSQhl0XbjP3xxeG4NaPUUk2G jiUg9YNe9qoXsCBGo773zNpqvhlRzIQcZUz92TMmst3Uw75NUdr8OXMI3VetIYXe8F2mR42C+FH Kqqk0/t6mutFcN70uxxDncWu3xUFC5+ycHhSkjVoEzyej8IJ445+IDFUeQJCIeO0lG4Q9xWPwb2 d0b4tCF0Goo8NORQCx2SQb0o5Rv5sb4cTX6gv7eR9fK6PmQPBujQLFSZ/fCylKiOr8hkbczmG8V vWHgita0ApMpzxuQP8ce2kktAYRaNVMw/+m9w0N1jPYV+fkvG3Fjr9AXgptfBqLcn31Ru8llwT2 tHrP0f0kDtiOghx6UzKit6DNDg4tbqwmW/b8/EV3h4NOekjwjWWvSsJxF9dOiRmPBHpqctLg7R4 svcQao/vqc0GgEQ== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-Sasl: louis.chauvet@bootlin.com 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The current VKMS driver uses managed function to create crtc, but don't use it to properly clean the crtc workqueue. It is not an issue yet, but in order to support multiple devices easily, convert this code to use drm and device managed helpers. Signed-off-by: Louis Chauvet --- drivers/gpu/drm/vkms/vkms_crtc.c | 14 ++++++++++++++ drivers/gpu/drm/vkms/vkms_drv.c | 9 --------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c index a40295c18b48..877877dc0af1 100644 --- a/drivers/gpu/drm/vkms/vkms_crtc.c +++ b/drivers/gpu/drm/vkms/vkms_crtc.c @@ -6,6 +6,7 @@ #include #include #include +#include #include "vkms_drv.h" @@ -274,6 +275,14 @@ static const struct drm_crtc_helper_funcs vkms_crtc_helper_funcs = { .atomic_disable = vkms_crtc_atomic_disable, }; +static void vkms_crtc_destroy_workqueue(struct drm_device *dev, + void *raw_vkms_out) +{ + struct vkms_output *vkms_out = raw_vkms_out; + + destroy_workqueue(vkms_out->composer_workq); +} + int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, struct drm_plane *primary, struct drm_plane *cursor) { @@ -304,5 +313,10 @@ int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, if (!vkms_out->composer_workq) return -ENOMEM; + ret = drmm_add_action_or_reset(dev, vkms_crtc_destroy_workqueue, + vkms_out); + if (ret) + return ret; + return ret; } diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c index 0f6805b9fe7b..eede3b8c70ef 100644 --- a/drivers/gpu/drm/vkms/vkms_drv.c +++ b/drivers/gpu/drm/vkms/vkms_drv.c @@ -54,14 +54,6 @@ MODULE_PARM_DESC(enable_overlay, "Enable/Disable overlay support"); DEFINE_DRM_GEM_FOPS(vkms_driver_fops); -static void vkms_release(struct drm_device *dev) -{ - struct vkms_device *vkms = drm_device_to_vkms_device(dev); - - if (vkms->output.composer_workq) - destroy_workqueue(vkms->output.composer_workq); -} - static void vkms_atomic_commit_tail(struct drm_atomic_state *old_state) { struct drm_device *dev = old_state->dev; @@ -110,7 +102,6 @@ static const struct drm_debugfs_info vkms_config_debugfs_list[] = { static const struct drm_driver vkms_driver = { .driver_features = DRIVER_MODESET | DRIVER_ATOMIC | DRIVER_GEM, - .release = vkms_release, .fops = &vkms_driver_fops, DRM_GEM_SHMEM_DRIVER_OPS, DRM_FBDEV_SHMEM_DRIVER_OPS, From patchwork Thu Oct 10 17:39:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Louis Chauvet X-Patchwork-Id: 13830578 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 3B4CFCFC5E7 for ; Thu, 10 Oct 2024 17:39:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3314810E982; Thu, 10 Oct 2024 17:39:17 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.b="opO4nTxc"; dkim-atps=neutral Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by gabe.freedesktop.org (Postfix) with ESMTPS id EC72610E9A1 for ; Thu, 10 Oct 2024 17:39:14 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id B57866000B; Thu, 10 Oct 2024 17:39:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1728581953; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uulKexxJGHrNqQbD6J55BuE9kpqXCUt7e8QIhWgR1zw=; b=opO4nTxcrFg6mFxsEL+h0RjBS2YP0+BUeY9lIBOTJX/MbJQ3SM0MwfPLmM8EXXCZvPKjka aijsYFB5Yj1KyMNz8w6WOMVlLntlrjuqazOfrnmMV5IM+ijMmGqbfnNB7qRd9905w3BwWN ontzzDnLfeEIYYg8gm4dOXNVYkiTcco+qmyd75qghSRDj0tMMnVc6w+Zlcz2ZEefuc3VkU J0b/EVjaylwgARmMoUxZUw1EaLf57paYUZCuCmrSpoun+ioh4AVHKUgfX7si2qy3SeFGGS 6vTx8tCYqQfyvskSTZXkMnZpjCbtxLYYayAUig3gsMl44J+yRMb+BawdOBr51Q== From: Louis Chauvet Date: Thu, 10 Oct 2024 19:39:06 +0200 Subject: [PATCH v4 4/5] drm: writeback: Introduce drm managed helpers MIME-Version: 1.0 Message-Id: <20241010-google-vkms-managed-v4-4-ed04a62ad2e3@bootlin.com> References: <20241010-google-vkms-managed-v4-0-ed04a62ad2e3@bootlin.com> In-Reply-To: <20241010-google-vkms-managed-v4-0-ed04a62ad2e3@bootlin.com> To: Rodrigo Siqueira , Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Simona Vetter Cc: dri-devel@lists.freedesktop.org, arthurgrillo@riseup.net, linux-kernel@vger.kernel.org, jeremie.dautheribes@bootlin.com, miquel.raynal@bootlin.com, thomas.petazzoni@bootlin.com, seanpaul@google.com, nicolejadeyee@google.com, Louis Chauvet , 20241010-vkms-remove-index-v2-1-6b8d6cfd5a15@bootlin.com X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=12723; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=DW23xxSf+0mXMZrgd4Jt7AGKmvSdNKpue3JAG78VBvo=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBnCBE7evbkwvBhEnasoy+yA2lOc5xQieTCNML9q gfpPmYGO1yJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZwgROwAKCRAgrS7GWxAs 4lOREADWVcgpm5NvhVkLT8m3vKeOmHLKLZ92AWk7g2qPlnbP98F8D9f1zkouYaAPRRwS1Wmlpi/ 5svdprR7Ydia/wK/PjxN5YNl31i9V2ibwHyLs7GAfKDVFFhydPQw7Coa+kycCxZkdiHrfQ5h6JX 4VwgnOKg3gQ9hu6qpxQSu2CSGXUyfsLaeRjOPCHsLI++bKnOQFW52oNcNuiktPkITBDSniGikoH K2gBQND2HeIpZsjmBVrYOrKimuKHWIHumxvev5m3qMaxfeogE+xJVxN8GCTwwV5hKROIE3yv6KG 5dXGYjq3Sfm4TgWl7n/HSSVYTwduWwdshJLI5qDN+FlaUlwYXwVR5L4SQgxnDJd6cnsLk5/MxcZ LLfpvJe11v0fI3Uf/tTxK2DGR66xRq95yK4FKLHcY22TQG3luqW+w2trew2xKIpo2EhZrjrajOe eoA7SC5EDnr4Km9TsycHdvEt9etz/qDtCtvl42tgxKMcaa/DuyIAdJLsIjid45PXpCDfP11W92R m9mfx6308m5NKNXTS2+jHTBbyUKTuzZZyiX9Y4FKt4+Ru4cspO08siEj3//82Qb9omwl5kb9sj8 8s4n8AZC/nigI4Ca8uKHqy+GKei/CtWZd/Jf72chntTpOEN6jT6KqOXCKQA0h27m6kBAVODrZy9 f3Lc61VLC9uAgQw== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-Sasl: louis.chauvet@bootlin.com 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Currently drm_writeback_connector are created by drm_writeback_connector_init or drm_writeback_connector_init_with_encoder. Both of the function uses drm_connector_init and drm_encoder_init, but there is no way to properly clean those structure from outside. By using drm managed variants, we can ensure that the writeback connector is properly cleaned. This patch introduce drmm_writeback_connector_init, an helper to initialize a writeback connector using drm managed helpers. This function allows the caller to use its own encoder. Signed-off-by: Louis Chauvet --- drivers/gpu/drm/drm_connector.c | 4 + drivers/gpu/drm/drm_writeback.c | 224 ++++++++++++++++++++++++++++++++++------ include/drm/drm_writeback.h | 10 ++ 3 files changed, 208 insertions(+), 30 deletions(-) diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index fc35f47e2849..fe4c1967860a 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -613,6 +613,7 @@ static void drm_mode_remove(struct drm_connector *connector, drm_mode_destroy(connector->dev, mode); } +void drm_writeback_connector_cleanup(struct drm_device *dev, void *data); /** * drm_connector_cleanup - cleans up an initialised connector * @connector: connector to cleanup @@ -631,6 +632,9 @@ void drm_connector_cleanup(struct drm_connector *connector) DRM_CONNECTOR_REGISTERED)) drm_connector_unregister(connector); + if (connector->connector_type == DRM_MODE_CONNECTOR_WRITEBACK) + drm_writeback_connector_cleanup(dev, connector); + if (connector->privacy_screen) { drm_privacy_screen_put(connector->privacy_screen); connector->privacy_screen = NULL; diff --git a/drivers/gpu/drm/drm_writeback.c b/drivers/gpu/drm/drm_writeback.c index 33a3c98a962d..28f299ce8e10 100644 --- a/drivers/gpu/drm/drm_writeback.c +++ b/drivers/gpu/drm/drm_writeback.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -196,13 +197,12 @@ int drm_writeback_connector_init(struct drm_device *dev, EXPORT_SYMBOL(drm_writeback_connector_init); /** - * drm_writeback_connector_init_with_encoder - Initialize a writeback connector with - * a custom encoder + * __drm_writeback_connector_init - Common initialization code for writeback + * connector * * @dev: DRM device * @wb_connector: Writeback connector to initialize * @enc: handle to the already initialized drm encoder - * @con_funcs: Connector funcs vtable * @formats: Array of supported pixel formats for the writeback engine * @n_formats: Length of the formats array * @@ -218,41 +218,32 @@ EXPORT_SYMBOL(drm_writeback_connector_init); * assigning the encoder helper functions, possible_crtcs and any other encoder * specific operation. * - * Drivers should always use this function instead of drm_connector_init() to - * set up writeback connectors if they want to manage themselves the lifetime of the - * associated encoder. - * * Returns: 0 on success, or a negative error code */ -int drm_writeback_connector_init_with_encoder(struct drm_device *dev, - struct drm_writeback_connector *wb_connector, struct drm_encoder *enc, - const struct drm_connector_funcs *con_funcs, const u32 *formats, - int n_formats) +static int __drm_writeback_connector_init(struct drm_device *dev, + struct drm_writeback_connector *wb_connector, + struct drm_encoder *enc, + const u32 *formats, int n_formats) { - struct drm_property_blob *blob; struct drm_connector *connector = &wb_connector->base; struct drm_mode_config *config = &dev->mode_config; - int ret = create_writeback_properties(dev); - - if (ret != 0) - return ret; - - blob = drm_property_create_blob(dev, n_formats * sizeof(*formats), - formats); - if (IS_ERR(blob)) - return PTR_ERR(blob); - + struct drm_property_blob *blob; + int ret; connector->interlace_allowed = 0; - ret = drm_connector_init(dev, connector, con_funcs, - DRM_MODE_CONNECTOR_WRITEBACK); + ret = create_writeback_properties(dev); if (ret) - goto connector_fail; + return ret; ret = drm_connector_attach_encoder(connector, enc); if (ret) - goto attach_fail; + return ret; + + blob = drm_property_create_blob(dev, n_formats * sizeof(*formats), + formats); + if (IS_ERR(blob)) + return PTR_ERR(blob); INIT_LIST_HEAD(&wb_connector->job_queue); spin_lock_init(&wb_connector->job_lock); @@ -275,15 +266,188 @@ int drm_writeback_connector_init_with_encoder(struct drm_device *dev, wb_connector->pixel_formats_blob_ptr = blob; return 0; +} + +/** + * drm_writeback_connector_init_with_encoder - Initialize a writeback connector with + * a custom encoder + * + * @dev: DRM device + * @wb_connector: Writeback connector to initialize + * @enc: handle to the already initialized drm encoder + * @con_funcs: Connector funcs vtable + * @formats: Array of supported pixel formats for the writeback engine + * @n_formats: Length of the formats array + * + * This function creates the writeback-connector-specific properties if they + * have not been already created, initializes the connector as + * type DRM_MODE_CONNECTOR_WRITEBACK, and correctly initializes the property + * values. + * + * This function assumes that the drm_writeback_connector's encoder has already been + * created and initialized before invoking this function. + * + * In addition, this function also assumes that callers of this API will manage + * assigning the encoder helper functions, possible_crtcs and any other encoder + * specific operation. + * + * Drivers should always use this function instead of drm_connector_init() to + * set up writeback connectors if they want to manage themselves the lifetime of the + * associated encoder. + * + * Returns: 0 on success, or a negative error code + */ +int drm_writeback_connector_init_with_encoder(struct drm_device *dev, + struct drm_writeback_connector *wb_connector, + struct drm_encoder *enc, + const struct drm_connector_funcs *con_funcs, + const u32 *formats, int n_formats) +{ + struct drm_connector *connector = &wb_connector->base; + int ret; + + ret = drm_connector_init(dev, connector, con_funcs, + DRM_MODE_CONNECTOR_WRITEBACK); + if (ret) + return ret; + + ret = __drm_writeback_connector_init(dev, wb_connector, enc, formats, + n_formats); + if (ret) + drm_connector_cleanup(connector); -attach_fail: - drm_connector_cleanup(connector); -connector_fail: - drm_property_blob_put(blob); return ret; } EXPORT_SYMBOL(drm_writeback_connector_init_with_encoder); +/** + * drm_writeback_connector_cleanup - Cleanup the writeback connector + * @dev: DRM device + * @data: Opaque pointer to the connector + * + * This will decrement the reference counter of blobs and it will clean the + * remaining jobs in this writeback connector. + */ +void drm_writeback_connector_cleanup(struct drm_device *dev, void *data) +{ + struct drm_connector *connector = data; + struct drm_writeback_connector *wb_connector = container_of(connector, + struct drm_writeback_connector, + base); + unsigned long flags; + struct drm_writeback_job *pos, *n; + + drm_property_blob_put(wb_connector->pixel_formats_blob_ptr); + + spin_lock_irqsave(&wb_connector->job_lock, flags); + list_for_each_entry_safe(pos, n, &wb_connector->job_queue, list_entry) { + drm_writeback_cleanup_job(pos); + list_del(&pos->list_entry); + } + spin_unlock_irqrestore(&wb_connector->job_lock, flags); +} + +/** + * __drmm_writeback_connector_init - Initialize a writeback connector with + * a custom encoder + * + * @dev: DRM device + * @wb_connector: Writeback connector to initialize + * @con_funcs: Connector funcs vtable + * @enc: handle to the already initialized drm encoder + * @formats: Array of supported pixel formats for the writeback engine + * @n_formats: Length of the formats array + * + * This function initialize a writeback connector and register its cleanup. + * It uses the common helper @__drm_writeback_connector_init to do the + * general initialization. + * + * This function assumes that @enc has already been created and initialized + * before invoking this function. + * + * In addition, this function also assumes that callers of this API will manage + * assigning the encoder helper functions, possible_crtcs and any other encoder + * specific operation. + * + * Returns: 0 on success, or a negative error code + */ +static int __drmm_writeback_connector_init(struct drm_device *dev, + struct drm_writeback_connector *wb_connector, + const struct drm_connector_funcs *con_funcs, + struct drm_encoder *enc, + const u32 *formats, int n_formats) +{ + struct drm_connector *connector = &wb_connector->base; + int ret; + + ret = drmm_connector_init(dev, connector, con_funcs, + DRM_MODE_CONNECTOR_WRITEBACK, NULL); + if (ret) + return ret; + + ret = __drm_writeback_connector_init(dev, wb_connector, enc, formats, + n_formats); + if (ret) + return ret; + + return 0; +} + +/** + * drmm_writeback_connector_init - Initialize a writeback connector with + * a custom encoder + * + * @dev: DRM device + * @wb_connector: Writeback connector to initialize + * @con_funcs: Connector funcs vtable + * @enc: handle to the already initialized drm encoder, optional + * @enc_funcs: Encoder funcs vtable, optional, only used when @enc is NULL + * @formats: Array of supported pixel formats for the writeback engine + * @n_formats: Length of the formats array + * @possible_crtcs: if @enc is NULL, this will set the possible_crtc for the + * newly created encoder + * + * This function initialize a writeback connector and register its cleanup. + * + * This function creates the writeback-connector-specific properties if they + * have not been already created, initializes the connector as + * type DRM_MODE_CONNECTOR_WRITEBACK, and correctly initializes the property + * values. + * + * If @enc is NULL, this function will create a drm-managed encoder and will + * attach @enc_funcs on it. It will also attach the CRTC passed in + * @possible_crtcs + * + * Returns: 0 on success, or a negative error code + */ +int drmm_writeback_connector_init(struct drm_device *dev, + struct drm_writeback_connector *wb_connector, + const struct drm_connector_funcs *con_funcs, + struct drm_encoder *enc, + const struct drm_encoder_helper_funcs *enc_funcs, + const u32 *formats, int n_formats, + u32 possible_crtcs) +{ + int ret; + + if (!enc) { + ret = drmm_encoder_init(dev, &wb_connector->encoder, + NULL, DRM_MODE_ENCODER_VIRTUAL, NULL); + if (ret) + return ret; + + enc = &wb_connector->encoder; + enc->possible_crtcs |= possible_crtcs; + if (enc_funcs) + drm_encoder_helper_add(enc, enc_funcs); + } + + return __drmm_writeback_connector_init(dev, wb_connector, con_funcs, + &wb_connector->encoder, formats, + n_formats); +} +EXPORT_SYMBOL(drmm_writeback_connector_init); + int drm_writeback_set_fb(struct drm_connector_state *conn_state, struct drm_framebuffer *fb) { diff --git a/include/drm/drm_writeback.h b/include/drm/drm_writeback.h index 17e576c80169..5e5ff8dd9d9d 100644 --- a/include/drm/drm_writeback.h +++ b/include/drm/drm_writeback.h @@ -161,6 +161,14 @@ int drm_writeback_connector_init_with_encoder(struct drm_device *dev, const struct drm_connector_funcs *con_funcs, const u32 *formats, int n_formats); +int drmm_writeback_connector_init(struct drm_device *dev, + struct drm_writeback_connector *wb_connector, + const struct drm_connector_funcs *con_funcs, + struct drm_encoder *enc, + const struct drm_encoder_helper_funcs *enc_funcs, + const u32 *formats, int n_formats, + u32 possible_crtcs); + int drm_writeback_set_fb(struct drm_connector_state *conn_state, struct drm_framebuffer *fb); @@ -175,6 +183,8 @@ void drm_writeback_signal_completion(struct drm_writeback_connector *wb_connector, int status); +void drm_writeback_connector_cleanup(struct drm_device *dev, void *data); + struct dma_fence * drm_writeback_get_out_fence(struct drm_writeback_connector *wb_connector); #endif From patchwork Thu Oct 10 17:39:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Louis Chauvet X-Patchwork-Id: 13830580 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 2C5DCCFC5EB for ; Thu, 10 Oct 2024 17:39:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8C2E010E9A1; Thu, 10 Oct 2024 17:39:20 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.b="jd3jsYTG"; dkim-atps=neutral Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1E40510E982 for ; Thu, 10 Oct 2024 17:39:15 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id C63F06000C; Thu, 10 Oct 2024 17:39:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1728581954; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Rkf9ZB1RI/rNCaGK7I5+lWCo2AWKpanKigvlMgvMjRM=; b=jd3jsYTGnV4aC195SBKC7P2bszl6mmEW3hsOyW0utC1awdr1sJN0KPDMukDZS8PblI74g+ v/Ou0QFlo+maIaFvuSwq2i8eqsJgq6cg7WNNsv2XAduYWkEqw58zHa2EekqaE6O7VPctR9 WEFgIWkXtCg++ogSi5H7V2kBdUSVGfzsg4r6/cPpdUAQx5O7J76f+8t9i33bgbwBk/9Rfq vFMXNmqPFt1azUoNQN0nP/hpXq2oT6TnFjEVUnCoE9Aj5dwFEZRsMOtB6hOXbY4YtEZlw4 j7tEDvYabZ6ys8Tp8fcOfGxnE8gKKCh7cHIy0ebMt4uAXAI9HGPA7jLSCqS7+Q== From: Louis Chauvet Date: Thu, 10 Oct 2024 19:39:07 +0200 Subject: [PATCH v4 5/5] drm/vkms: Switch to managed for writeback connector MIME-Version: 1.0 Message-Id: <20241010-google-vkms-managed-v4-5-ed04a62ad2e3@bootlin.com> References: <20241010-google-vkms-managed-v4-0-ed04a62ad2e3@bootlin.com> In-Reply-To: <20241010-google-vkms-managed-v4-0-ed04a62ad2e3@bootlin.com> To: Rodrigo Siqueira , Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Simona Vetter Cc: dri-devel@lists.freedesktop.org, arthurgrillo@riseup.net, linux-kernel@vger.kernel.org, jeremie.dautheribes@bootlin.com, miquel.raynal@bootlin.com, thomas.petazzoni@bootlin.com, seanpaul@google.com, nicolejadeyee@google.com, Louis Chauvet , 20241010-vkms-remove-index-v2-1-6b8d6cfd5a15@bootlin.com X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1615; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=8l77jL6QEAistTQ7vNwYyQyAA5lIi9scXT9/twYXbAM=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBnCBE7NMO1dp5i+Q/LysJmR6xywG87t8hEhM9fr IaTJ+AmyPWJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZwgROwAKCRAgrS7GWxAs 4q0cD/9y2FmV7crb8LSRzxX3vslwV2c0WJ2Z83sCtWbNYhfCWx9VLSQjlfW73ToISTCqS8PUXZT nNyQqHNlCPIvI+ktCS/vnrp7rbrJCfqZRcUdc5objMlmFV8OvLnKi3/aZTh7LmqhHOiiLq54xfd S2BZIJrSsCDd0uNlBn3EhGkAfKOcPmcF5hdnhoPibf5EciGBhVDYgBrTLpdbTH8AvHyuO0WKO5y mOIV6OexhxgJTroHBn6NatGFOtQkgHjkNJIpib07+YMhQpSCgGpG8qFUExQBQGB12VFryyYCIaT Vt+PPU8nmI7QfhMoUfA+QuPT4wlJXVUr+kBfvMl9Z5X1TYqH+YuU0wLBFCwyxtV3HBtVjye8qEu 1Hr79nE5REqzJ5dSkOs1qTLupHNJoa+VHUncRkjxpuIQDzTv2NSeIoiUb5B3iO9j4ADsniJh48R uXtx1D7Rzw6PdN6sNpL6SbfY3/ycGsC8XA6rRxa4mKS0AiyGj0fzuTJO3CcJYjb3fonBKQtYlmF LtwdwgjQKARXs28tWIuylvn+qVkom3Rc2XWuvo425nTF5cF0NuSh04vEebgiinsxrf1OLjnIHHW WFLkAnoG+pTrqtS3rYnapMwRnBu/yRSaXVFlQbJCzwBi+XTyRitYjsngZ7fIAAAUt4D0DSh/i77 D63+ljQmuADkEbg== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-Sasl: louis.chauvet@bootlin.com 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The current VKMS driver uses non-managed function to create writeback connectors. It is not an issue yet, but in order to support multiple devices easily, convert this code to use drm and device managed helpers. Signed-off-by: Louis Chauvet --- drivers/gpu/drm/vkms/vkms_writeback.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/vkms/vkms_writeback.c b/drivers/gpu/drm/vkms/vkms_writeback.c index bc724cbd5e3a..a948f4598764 100644 --- a/drivers/gpu/drm/vkms/vkms_writeback.c +++ b/drivers/gpu/drm/vkms/vkms_writeback.c @@ -24,7 +24,6 @@ static const u32 vkms_wb_formats[] = { static const struct drm_connector_funcs vkms_wb_connector_funcs = { .fill_modes = drm_helper_probe_single_connector_modes, - .destroy = drm_connector_cleanup, .reset = drm_atomic_helper_connector_reset, .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, @@ -174,10 +173,10 @@ int vkms_enable_writeback_connector(struct vkms_device *vkmsdev) drm_connector_helper_add(&wb->base, &vkms_wb_conn_helper_funcs); - return drm_writeback_connector_init(&vkmsdev->drm, wb, - &vkms_wb_connector_funcs, - NULL, - vkms_wb_formats, - ARRAY_SIZE(vkms_wb_formats), - 1); + return drmm_writeback_connector_init(&vkmsdev->drm, wb, + &vkms_wb_connector_funcs, + NULL, NULL, + vkms_wb_formats, + ARRAY_SIZE(vkms_wb_formats), + 1); }