From patchwork Mon Dec 30 18:37:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Louis Chauvet X-Patchwork-Id: 13923421 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 46742E77188 for ; Mon, 30 Dec 2024 18:38:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BC5DB10E568; Mon, 30 Dec 2024 18:38:06 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.b="PSITxTjr"; dkim-atps=neutral Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by gabe.freedesktop.org (Postfix) with ESMTPS id DF49E10E568 for ; Mon, 30 Dec 2024 18:38:05 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id 499DBE0004; Mon, 30 Dec 2024 18:37:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1735583864; 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=uXVFlt/M2yXMzY5/qRvMCWmbv0QIUsPFjlivd4tltRM=; b=PSITxTjrK2kyLXd+ZVlKQjt5t3mxDVO3qEfjjS1nPK3RX+62fX/d52udYgCsSnxR1EnYGl A6kIOwc4QCQJNJLflJrefQXxTsz/zYSU1jpdaU9nfjmYFTsRR17BCD/9LaFVKQFtOQt3Z5 TVvHtQPSfrX1MDPgzTSzGHvg5ypZSd3iwkltvKKugLSvpl087Rx2fp1k+R9ZcoYXKXO/G2 P1JMlKnxk76pYUe3ftXQ6/HsyqshkzgdGRyDf5ejEOUpkVTiAUmsSeOKgjx1RCioR2j/Ti D5iveXN9BuZ0RumbfEaljL7GM3rdmMaeB/5G0YC9Ov/1+Ocw+2fQbnPTC/5FTA== From: Louis Chauvet Date: Mon, 30 Dec 2024 19:37:31 +0100 Subject: [PATCH v6 1/8] drm/vkms: Switch to managed for connector MIME-Version: 1.0 Message-Id: <20241230-google-vkms-managed-v6-1-15c7d65cd63b@bootlin.com> References: <20241230-google-vkms-managed-v6-0-15c7d65cd63b@bootlin.com> In-Reply-To: <20241230-google-vkms-managed-v6-0-15c7d65cd63b@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 , =?utf-8?q?Ma=C3=ADra_Canal?= X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=2123; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=18DPeCWxOUuQwaVIAdaCjW1Z0dvcR+suDpSINITGFoE=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBncuhwGyYTz4EEkDbvg6PkxCR5wN4KsBpqVNyh7 kL/FYqwBguJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZ3LocAAKCRAgrS7GWxAs 4kS3EAC3yNnNrz1V4b+hLSZf3RceBUd32p2uRq6vF2R0eL9y3cICYNJS8IDHlrDU4asmSO+JWxH rgbzvrSRDaZNBdgzJfMUlXeqbwl+pR6lWi5lVLsHfq46E56MOa/VvLy3/va5zLDtRxJjc3ziN4d A9xIcfZTV6x/LZ6PInamv/ZwYx8lJ3ngKZvhINe8m3NI1Gd7B6oydhJk2ePb7HayVbE3FwpDVfh zn6M3JoeI/B5S61pm/I+DVkyksCvgUmOvhF7k3x2xj+yVEVlEblNS/pIctap4RRwV/bN+0ySFyh 6xf5BzwlW/Ve34UfhI+f311n6hrDu2BPz0lMHPj2PUMDuiqeZRdtEgmgVYqPag70Guxmg74F4wH k6Oqz/w82ZZh83QA4HqSlVn3kQIE3c+LcB25dv97ggFA3CR+wacgISPMu23iGjnA0VuWWYJ2d0T 6TgaJviejBwogAgzoV5rdKif1dG/wCglNQ06kILtHk+L11uFyKtvOBLjyg6wYQUJbTBpbvfpfiB HUSViZioDWINPZ05yxfwraf4kWihO254RrCraR4q2HoeG3yaaV/OQe1/QXXvFfyyzr+FhoUD5zr SMm7TWT1K5kBkHudn9Hz0DY7zZEMCRBYOKerX9En/fdMgIAhAPu85Hqn7PwJRJIVqxW5uqad2yE YhMXlwM+LqzxoiA== 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. Reviewed-by: Maxime Ripard Reviewed-by: Maíra Canal Signed-off-by: Louis Chauvet --- drivers/gpu/drm/vkms/vkms_output.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c index 8f4bd5aef087b459d37d0cbbf90fe0145090917a..570823ecb28f589e6323036590ec05a2f633bc9b 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, @@ -75,8 +75,8 @@ int vkms_output_init(struct vkms_device *vkmsdev) } } - 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"); return ret; @@ -88,7 +88,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); @@ -110,9 +110,5 @@ int vkms_output_init(struct vkms_device *vkmsdev) err_attach: drm_encoder_cleanup(encoder); - -err_encoder: - drm_connector_cleanup(connector); - return ret; } From patchwork Mon Dec 30 18:37:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Louis Chauvet X-Patchwork-Id: 13923422 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 B1266E77188 for ; Mon, 30 Dec 2024 18:38:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4209F10E56B; Mon, 30 Dec 2024 18:38:11 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.b="oO+b8RN1"; dkim-atps=neutral Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1410310E56B for ; Mon, 30 Dec 2024 18:38:06 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id 66CCCE0005; Mon, 30 Dec 2024 18:37:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1735583865; 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=ORNcbjUscQPawEReOo+mB/rT9VuEfLQrTBsR3RDKoMc=; b=oO+b8RN1/jmSTs3gSYctllDj+GE6sb2P45xOMYD55WeSmC+N6Oyy5y6oWsEgtsgx45DFGY 6XjWwWVQHVbgvUDgdsajGZU+jIeS3ib/PSyjiK+WjD1VfuJZ3D+wmmC02KK3EZayNOy0fM n+slbFAhS59xWFxFeGFoOTK2HCpoVbGvDPCLnI+W/gtZi0EGGdWHlCkzhTjnVaaN+ArspG 7RRlmSkri7dotRc7AoLGmFQk9BLntyxcK9TnYUgxTie42oF7dSsfypd3iy+rfYaEd3EB6C yXElUi84DAbfg1jY66PM6vcRY262z06v1ybg3vZ1Sn7A8UUXssokV6QhXSDWtQ== From: Louis Chauvet Date: Mon, 30 Dec 2024 19:37:32 +0100 Subject: [PATCH v6 2/8] drm/vkms: Switch to managed for encoder MIME-Version: 1.0 Message-Id: <20241230-google-vkms-managed-v6-2-15c7d65cd63b@bootlin.com> References: <20241230-google-vkms-managed-v6-0-15c7d65cd63b@bootlin.com> In-Reply-To: <20241230-google-vkms-managed-v6-0-15c7d65cd63b@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 , =?utf-8?q?Ma=C3=ADra_Canal?= X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=1949; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=6Q2vv/0lK0qmkxSO71I39a4RcXfCaF3f2eU4aUcvUP4=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBncuhwiaifnM4iL5bqHUyzJfo8vsij6lcri0Leh GFKcy43gm+JAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZ3LocAAKCRAgrS7GWxAs 4qwtEACpB7/iroulh+D5FoPeo7OsVPErTDpykJXypL95jvbv/sZJ69c6LEVIhiBJSAhbOJ8VJT0 vQtlERWeXvIpNSAo3oPKsuf6yddzjfqaeVI+7raF3E+pElf5j4RSLTXpSjrb1PopUtvu91JfQ+K iuTcgrr7uNeZO7GBG/utildhj2jm4OZ0CyKSsttXw5fKQKUzHNXzhhbWa6jUGhseTc9VWQNiYhe EZGDjIMqZ4ZKFNYYlobbwRDqMmu2BLBkHMa0112yebKQv59bEhqMTjnW41EXfGFkiM97SxA8I6O Ca/YxDl45yoPKC3rKHxYhJjdniXEemeUzQXPZKEu3Xp58AwRQW/7J+MNB8l/60hTKm5lCgDEmRX VH9DXV6b8IYtqpEqNiWpoPfyLntbNoqCUVmTflAHnBikRbzvJZOCtvbf1hWZQ4OGghMhMQmcQiO VKbZHIAoL4ThdrwTQQ0S7FFYG8p7mGnCZVTaNqUEG1vRkwQmnLHi5rGUSdH0j7p4Er6yeH3H4La jFpRLtcnmZROGpPB07r57v85P5QqBQD4CRZgrh9hWWak7j1s68H1JC/ZZk1yQy56R4+h8w4VlLX jFny1kiHYoJZTvjD0vVhHy0/9JS2hwE7UPyo5tYRGGQaoTdgrEhN9fp8clNTriGit74WywPEaEW Vv3V70ERHM/ubUA== 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. Reviewed-by: Maxime Ripard Reviewed-by: Maíra Canal Signed-off-by: Louis Chauvet --- drivers/gpu/drm/vkms/vkms_output.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c index 570823ecb28f589e6323036590ec05a2f633bc9b..ab9affa75b66ce9f00fe025052439405206144ec 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; @@ -84,8 +80,8 @@ 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; @@ -95,7 +91,7 @@ int vkms_output_init(struct vkms_device *vkmsdev) 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) { @@ -108,7 +104,5 @@ int vkms_output_init(struct vkms_device *vkmsdev) return 0; -err_attach: - drm_encoder_cleanup(encoder); return ret; } From patchwork Mon Dec 30 18:37:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Louis Chauvet X-Patchwork-Id: 13923416 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 0A413E7718F for ; Mon, 30 Dec 2024 18:37:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 30DB610E28F; Mon, 30 Dec 2024 18:37:50 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.b="KGNYrizO"; dkim-atps=neutral Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by gabe.freedesktop.org (Postfix) with ESMTPS id 64DE510E28F for ; Mon, 30 Dec 2024 18:37:48 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id 9E449E0006; Mon, 30 Dec 2024 18:37:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1735583866; 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=LY2O50zsA6s/xcwj2ByPp9+wVZ9Z+1qLAMiiqprNuz8=; b=KGNYrizOI//T5/J+B4YLELR2271hw8WzvA7IKTjNGTeFQVk01YKYfa4aPZmMY2PflHEr+W wJJjEHc1f15RwJFl7FOPcrxNcefo5LJeV/RVIJ2TE2Y2OKRIsxmFmfnqk+mJF61Z652n0t 8bnRhvJRMrk6aBK3yy+UuDTk5NhuHaXUOCWD3Fqb9LjFBBmxGtQQTwVOqv02DXUHU7Yhbj nBNpNZi+NAvlzat3N1HXJ8m8S4oHCalA91+uZ9dZ9FA7uQ38o5RoyNvdznW7gl405xk9+d nuqjJHDoHqD61SWTMIdGkHWJMJzVfTDCpzG4jxWIK985DyQUbTLaDw6SaM6ZKw== From: Louis Chauvet Date: Mon, 30 Dec 2024 19:37:33 +0100 Subject: [PATCH v6 3/8] drm/vkms: Switch to managed for crtc MIME-Version: 1.0 Message-Id: <20241230-google-vkms-managed-v6-3-15c7d65cd63b@bootlin.com> References: <20241230-google-vkms-managed-v6-0-15c7d65cd63b@bootlin.com> In-Reply-To: <20241230-google-vkms-managed-v6-0-15c7d65cd63b@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 , =?utf-8?q?Ma=C3=ADra_Canal?= X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=2850; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=n0VghhJrbrmKmRsfwMlZZWoRm6homaUFqv46ilHrHUU=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBncuhx/06LEii3IaTWmbE7XY7WLevxr6qDbJGoS rc/82iK0iOJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZ3LocQAKCRAgrS7GWxAs 4l8FD/9Ubicq7DGnYlHJPhdSu3S5imYv7nQCP/GSy9hsvS941RR6iks/bmaIA/IUPh/6kAglFO8 JUWzIQZ/m/qJiJtbNnZuV+0xb1EzW65LqAANaHTJmCg+M+zUWszLsGWwG2HshO/go13rCiR++j2 fXWrZ/RWrjW1CwPCoZOoUd5Gn0p4ODBTmkgx5gPhlL/vWDwXH5y6nq9qdBShP9ggDgeUSfdDCbc UaTDxOe2Rk99o0ayJ28r1K79BjbVF8qewXHWksXIVDcJDXwlg21gfdKZJuPzNljY/G8RC2YIbVR p1ZgEZMZtWR++buFeF8NGEKW3kvo3lFtuVEB6SYz0VGnK6/zcENIwhy52Jw8RuJvfy/zO10YQGK E0o6zEuGFk8GE233jRty2HizHI+kOUkLi697P845UOgq77J1bp7ldpauZUxiWBHnrWqYC2Xl1Ra YxVt1bR9a+GzbZFGcjiOKuKNjL4n2SPJTRkfAsAuUUQLOMPfQKCfV3+xNv9W/nUHpFYu7ttH0k9 vYB71pJQ7Dm/Kt9ttA0YGMpkyO/kfX/r9JcvS0Ek4GVxa1p6daW1KX18ATsU/PPcquIMCd/8rV9 /zSJ6/JrpKpihNhNWpxYiwu3OiJjQkNJP4lQGbsb3Haea4fQLEM1gikUejCXP6vKsryHk5ZDSio Xl0SxqkqLwzl5Bg== 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. Reviewed-by: Maxime Ripard Reviewed-by: Maíra Canal 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 28a57ae109fcc05af3fe74f94518c462c09119e3..ace8d293f7da611110c1e117b6cf2f3c9e9b4381 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" @@ -270,6 +271,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) { @@ -300,5 +309,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 e0409aba93496932b32a130ebb608ee53b1a9c59..7c142bfc3bd9de9556621db3e7f570dc0a4fab3a 100644 --- a/drivers/gpu/drm/vkms/vkms_drv.c +++ b/drivers/gpu/drm/vkms/vkms_drv.c @@ -53,14 +53,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; @@ -108,7 +100,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 Mon Dec 30 18:37:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Louis Chauvet X-Patchwork-Id: 13923417 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 5E5DAE77188 for ; Mon, 30 Dec 2024 18:37:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3A65D10E563; Mon, 30 Dec 2024 18:37:50 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.b="BzBe8Ooy"; dkim-atps=neutral Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7084E10E28F for ; Mon, 30 Dec 2024 18:37:49 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id EB3EEE0007; Mon, 30 Dec 2024 18:37:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1735583867; 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=YvSPUlvikRNTMxKUe5s2PjUplzN1tUly2y/DXFFhOEE=; b=BzBe8Ooy/r9oBPAMuVxXhGIGeOlnCDY+66Oca1Sw1ADR1Re8HIGz+qe3JOVY/QSvkiEI7Z LpMWRbmsSZPfvcgFapVnHKv5zUKh9uDVDc+69iORNYAf3ek5RoiXWVZtc6UOc/G06fcLc1 slNV+Ay65tRybTbrPXLsE23Hf6koaG6MMrIYcgaZfEJifgVdsXLgOgMzpp7SVmxXArwLrO nFcvnSD0QaeXqCBHBUcJydEIsf+mV9u72nZGhgkY5lbdYc5H4pJ8EQhyD4kx+pbugaMJ8i G+RMAMppbCYppQjnksN/f88DI2swXWL3RkBobPMomuKBUkvM1I8Tta6864trBg== From: Louis Chauvet Date: Mon, 30 Dec 2024 19:37:34 +0100 Subject: [PATCH v6 4/8] drm: writeback: Introduce cleanup function MIME-Version: 1.0 Message-Id: <20241230-google-vkms-managed-v6-4-15c7d65cd63b@bootlin.com> References: <20241230-google-vkms-managed-v6-0-15c7d65cd63b@bootlin.com> In-Reply-To: <20241230-google-vkms-managed-v6-0-15c7d65cd63b@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 X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=3266; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=RYpxra6SBSlWD2amtxMywRC1WPZn+3zaKBkO/JPwnmc=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBncuhxC6MMgqSFomI+ZO8jGiPRc19QWWvowbite s9+bmuuDzeJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZ3LocQAKCRAgrS7GWxAs 4tiFEACtNu9Nr3ublR++CZfncAAg++Li29yoy7rYJJGBn05nTtFxeYdsjlr3oN0j23hr06d3CXm jyS+LZk0hUn+eWYAhBQZLJQxUAbDQn8jKHDw6m/qjT5FdHtznnArYABGculxpkyV7pw47k0Zd9h 2+FXQNXUZS9SstsJAUSvmkemT7Wy7/lD8obaGveEWYIBGsP36+hdWZyj1xh6/xyOKbQUvWOOpO8 y8+D7vA4L2WiplJOkbHIseTmbQX65Gqku3lsleSm4a9PmLAjf76Gbz0vUQ6xv8t6X5MoaQFKaV1 ouMxRX51CJ29YQ0uulExi90iPvVbdSq02AUWsKB5bW6sRkRtLqBwfztyAn0lAPrDDE6zZakhHyJ SnkmDCsdCC5pwVcwBuDIFjO+QRthlhhSm3i60MMMGECD834BAy8QSz2o8PjzaWJms9DjJEWSQza n0e78VSlvUgHJqfFsUWWFwaXi+7FaIJr8hGFXdVhtHsd1KNjNsgGfM+L3owM/rXLb/XJpNVJ5IA qiCn1dRAOA4Ox7WP0yjjR23Br6ITtiEtpDMsQVaLEm5XEZGktQVSDj8WTleuTuwaNhx2HqgwpHC xw5T9bNZhJB9ZvXhKgLORtV8wtaVNE5ApmcrCJL7tZAzpgr2UWZQpc06iejrYA0mz83dDxGDBJL mF29MWh2gSLTQRw== 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 there is no cleanup function for writeback connectors. To allows implementation of drmm variant of writeback connector, create a cleanup function that can be used to properly remove all the writeback-specific properties and allocations. This also introduce an helper to cleanup only the drm_writeback_connector properties, so it can be used during initialization to cleanup in case of failure. Signed-off-by: Louis Chauvet --- drivers/gpu/drm/drm_writeback.c | 43 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/drivers/gpu/drm/drm_writeback.c b/drivers/gpu/drm/drm_writeback.c index 33a3c98a962d1ec49ac4b353902036cf74290ae6..c274cba257cde5f4b446df3854974e690c60bf7b 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 @@ -140,6 +141,22 @@ static int create_writeback_properties(struct drm_device *dev) return 0; } +static void delete_writeback_properties(struct drm_device *dev) +{ + if (dev->mode_config.writeback_pixel_formats_property) { + drm_property_destroy(dev, dev->mode_config.writeback_pixel_formats_property); + dev->mode_config.writeback_pixel_formats_property = NULL; + } + if (dev->mode_config.writeback_out_fence_ptr_property) { + drm_property_destroy(dev, dev->mode_config.writeback_out_fence_ptr_property); + dev->mode_config.writeback_out_fence_ptr_property = NULL; + } + if (dev->mode_config.writeback_fb_id_property) { + drm_property_destroy(dev, dev->mode_config.writeback_fb_id_property); + dev->mode_config.writeback_fb_id_property = NULL; + } +} + static const struct drm_encoder_funcs drm_writeback_encoder_funcs = { .destroy = drm_encoder_cleanup, }; @@ -284,6 +301,32 @@ int drm_writeback_connector_init_with_encoder(struct drm_device *dev, } EXPORT_SYMBOL(drm_writeback_connector_init_with_encoder); +/** + * drm_writeback_connector_cleanup - Cleanup the writeback connector + * @dev: DRM device + * @wb_connector: Pointer to the writeback connector to clean up + * + * This will decrement the reference counter of blobs and destroy properties. It + * will also clean the remaining jobs in this writeback connector. Caution: This helper will not + * clean up the attached encoder and the drm_connector. + */ +static void drm_writeback_connector_cleanup(struct drm_device *dev, + struct drm_writeback_connector *wb_connector) +{ + unsigned long flags; + struct drm_writeback_job *pos, *n; + + delete_writeback_properties(dev); + 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); +} + int drm_writeback_set_fb(struct drm_connector_state *conn_state, struct drm_framebuffer *fb) { From patchwork Mon Dec 30 18:37:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Louis Chauvet X-Patchwork-Id: 13923418 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 AEA3CE77188 for ; Mon, 30 Dec 2024 18:37:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2D6E110E569; Mon, 30 Dec 2024 18:37:56 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.b="QbPcv9/u"; dkim-atps=neutral Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by gabe.freedesktop.org (Postfix) with ESMTPS id 86E5410E564 for ; Mon, 30 Dec 2024 18:37:50 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id 12275E0008; Mon, 30 Dec 2024 18:37:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1735583869; 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=ayysUxCI3QxbG2xXJ6NotNlHl+ICIEwWLbwBEq1VG2g=; b=QbPcv9/urZ5ScriFM8C3EEzexT9xBzjCdh3V0QD8hkLeL3uEeCioOvsb9f1J8ADfMG6Rfy peWg5XNH0RWyrXQWGJPqfeJ94bFilAWnbGBqQFTaTjaVogBtdd6nPpdaeTxNFwh21b7goN RPT0GuOXvF+0mhLPFPHlT2Ed7P+hI/bKuhLP36+kNiklOPM25aSs2oXRBRjpXKgxeW6Idx WudoE3M1wy7qXjNSiWgaSfJYzbIghokilJgIDvUgqyW4I8143A06K9xySNzjwPgh7ZFkt3 +8yx2Sa/DtB+wjCeJG939Qh5D7+3K+AT5dq+yslktDwEHmjQo1jFqj2seZ2wHA== From: Louis Chauvet Date: Mon, 30 Dec 2024 19:37:35 +0100 Subject: [PATCH v6 5/8] drm: writeback: Create an helper for drm_writeback_connector initialization MIME-Version: 1.0 Message-Id: <20241230-google-vkms-managed-v6-5-15c7d65cd63b@bootlin.com> References: <20241230-google-vkms-managed-v6-0-15c7d65cd63b@bootlin.com> In-Reply-To: <20241230-google-vkms-managed-v6-0-15c7d65cd63b@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 X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=5066; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=igHBM8Lvu1AEho0hmFwk0UIKjXQ0jlSxXQhJo6f5/KU=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBncuhxszGYl3ngwNKeXJMyxp76jc+JNh/zMwU10 uYNho+viYCJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZ3LocQAKCRAgrS7GWxAs 4t45D/9Pfs6KVaM0DbfIAXWzHU/o5I1LRODc7jct/izUCVLIc+l5J7+zO2mgW5+3/L2huZn515i zhiNeXTtPN+0IySicHArC8aLSyYFOYyt5GM6evs1d04nXPr8F8fSFkb3viWG9g0ajbzJZKHg0rL o3jdot1GMqA7murh4JwvBkyYPX77pn9di0X2Q3Kd9RiMqY9BZWTCIa30bMWCFhRKTou9MdWyX7R 4fzF/gwJuNUw9B7R3Pjc7LuvSXy1wa2292lCikD+LsObdbyp2I6yngUgyNVIQN/CkAlaadzC3D1 RfJRJTgX79YaWuah3FnGIC6l/QEdmiGYFBjVDWDYnO2NwlfWg8X4Rnme1oUOwwyR4NQd2yGcMAu uJaiXp7ivXtlqti318jV9rW++9XBSucvMq1gpsa3iH9XQJNaKlLrZ41NuBXtTmaU6rVKzAXZ/3v my/Ih2Mj3DbTvOfLUBuGSowSuedj5kGJGv7/OPTXaYzEr+ICUfPDJylMJWJNA+r3FNbiUumH16X Jz3DwfDyywUlb1waqJr5Cj6qp7mvT+4V3UUng0rFL0zl8B72qwt+ZMn98R937aQOR+2fkZr3Tv2 62xwjKdnGxiglBSzrwLgA50Xq1XZFop4tFFr26qbz+YwMEt0IV3IoPA6dQnOSG/8gQNAm3sFLVn MfCpCdlbvBj30ZQ== 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" As the old drm and the new drmm variants of drm_writeback_connector requires almost the same initialization, create an internal helper to do most of the initialization work. Signed-off-by: Louis Chauvet Reviewed-by: Maxime Ripard --- drivers/gpu/drm/drm_writeback.c | 87 +++++++++++++++++++++++++++++------------ 1 file changed, 61 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/drm_writeback.c b/drivers/gpu/drm/drm_writeback.c index c274cba257cde5f4b446df3854974e690c60bf7b..494400b09796d37ed89145da45d5f1e029632de5 100644 --- a/drivers/gpu/drm/drm_writeback.c +++ b/drivers/gpu/drm/drm_writeback.c @@ -219,7 +219,6 @@ EXPORT_SYMBOL(drm_writeback_connector_init); * @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 * @@ -235,41 +234,31 @@ 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; + struct drm_property_blob *blob; 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); - - connector->interlace_allowed = 0; - ret = drm_connector_init(dev, connector, con_funcs, - DRM_MODE_CONNECTOR_WRITEBACK); - if (ret) - goto connector_fail; - 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); @@ -292,11 +281,57 @@ 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_property_blob *blob; + 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); From patchwork Mon Dec 30 18:37:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Louis Chauvet X-Patchwork-Id: 13923419 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 D0A27E7718F for ; Mon, 30 Dec 2024 18:37:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2563010E564; Mon, 30 Dec 2024 18:37:57 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.b="BbqcSCRz"; dkim-atps=neutral Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by gabe.freedesktop.org (Postfix) with ESMTPS id 93C0E10E564 for ; Mon, 30 Dec 2024 18:37:51 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id 2A986E0003; Mon, 30 Dec 2024 18:37:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1735583870; 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=2kdMq3NtV1Q5rfs52CZ3pak+GVWVcqrSS19cQV3F3L4=; b=BbqcSCRzUIGlYxbaLmwXSPAAwCsQM4Yh2k+UBY7DVF7K9eTO9f4B4Qff7hs2ALiZs/5qYg RM1IlEADzgT0mxjTUgBY4oLsZqppFpxMAmcqHWPmMvQ1iJL05AkHvMM5qW7YmiIDw9hu7R Jo4tGiepbAJOSd8rHF07NI46rqZEy1uwvQC5l65Oq2YZtQmfkPm7doNtavu4i5gmvKtGze XRlZQgx/kNouzy7QW0gJfq9EZNmYAjv5DcZ90KjWoKfIAkI5//Rsx4n3PvZRMWBaPfMX4R eGsQ4CiJv9lfEYafW5D9aaocSsn5ioCAnTOaji2p0jnVPafzs4uCxY5GU1o6hg== From: Louis Chauvet Date: Mon, 30 Dec 2024 19:37:36 +0100 Subject: [PATCH v6 6/8] drm: writeback: Add missing cleanup in case of initialization failure MIME-Version: 1.0 Message-Id: <20241230-google-vkms-managed-v6-6-15c7d65cd63b@bootlin.com> References: <20241230-google-vkms-managed-v6-0-15c7d65cd63b@bootlin.com> In-Reply-To: <20241230-google-vkms-managed-v6-0-15c7d65cd63b@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 X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=1629; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=lDpIpMGmW4xSLFBh/IPDhkS6hO2kKkwvWKfd99XUa90=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBncuhygB+fcbeHP/IV7O9W1NgMz50gh9k6nBZEI wtKuf6Kaa+JAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZ3LocgAKCRAgrS7GWxAs 4mBrD/4oUWX/P3pWLjtGvXPojjCwdX/LNNYOG/Dk7gGeBG0mqN/6ktVZjKapfgGSks7PROWDAnV GqFM/MErjka6PwAdz/JYPwmqxl1zKtZobOKPQjxMS0NYiYLaz81zjQxGzZWcVXiHROKQodPIBF8 PNLP8b6tGeiU7JiJukmgxlI9GragQ3vKpOiglhtWn15P+pEFaHjuoS5lUeGS1HaJyeHTEKciOtP o7pedgR1bN0zIrqEPb7G8DRyRUd+bwa3lhfpzQOt6RXi+Bel6U7g8tG55qVyHiv+9wgMhE19uwV BouoNl9g5BWsXXUCQyilB4gkRn3BoC6ahYR14Ttqg3BnGg0bCHL5qECowmW+lgMO1+7PwJrpkbK uDzjs3kegez9/tEJ2AGnNndMZGcPtfAL8htmIo9GZX3GVEGHfaqX1Cej3OA/1LBEHSFPgw27oDf 7ZSe+p+jBbt1uIUOdyyed5GCvAexC8OYG3wu5bczVCfMhd2BdKK+CLpOaD//C9c7XFQ+bz6QGV2 czHyba0WyR1SOXSSXWzhBlU6HhveqlKneLMZRMbNmKiSPBSvwOvJXoDTgw+mJmA6KaHrV2LJX4Q 54tM1hbmRrqNzXDTNrMOj1izMfqVAAAwPvEeQIz17N3AtuXP9IN0OudeoLQL7PuLFvd4duVb+y3 SWnkt0AHhJmMoLg== 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 implementation of drm_writeback_connector initialization does not properly clean up all resources in case of failure (allocated properties and possible_encoders). Add this cleaning in case of failure. Signed-off-by: Louis Chauvet --- drivers/gpu/drm/drm_writeback.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_writeback.c b/drivers/gpu/drm/drm_writeback.c index 494400b09796d37ed89145da45d5f1e029632de5..9c69f7181e02c23dabce488405608c40d4184af5 100644 --- a/drivers/gpu/drm/drm_writeback.c +++ b/drivers/gpu/drm/drm_writeback.c @@ -247,18 +247,20 @@ static int __drm_writeback_connector_init(struct drm_device *dev, int ret = create_writeback_properties(dev); if (ret != 0) - return ret; + goto failed_properties; connector->interlace_allowed = 0; ret = drm_connector_attach_encoder(connector, enc); if (ret) - return ret; + goto failed_properties; blob = drm_property_create_blob(dev, n_formats * sizeof(*formats), formats); - if (IS_ERR(blob)) - return PTR_ERR(blob); + if (IS_ERR(blob)) { + ret = PTR_ERR(blob); + goto failed_blob; + } INIT_LIST_HEAD(&wb_connector->job_queue); spin_lock_init(&wb_connector->job_lock); @@ -281,6 +283,11 @@ static int __drm_writeback_connector_init(struct drm_device *dev, wb_connector->pixel_formats_blob_ptr = blob; return 0; +failed_blob: + connector->possible_encoders &= ~drm_encoder_mask(enc); +failed_properties: + delete_writeback_properties(dev); + return ret; } /** From patchwork Mon Dec 30 18:37:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Louis Chauvet X-Patchwork-Id: 13923423 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 E7173E7718F for ; Mon, 30 Dec 2024 18:38:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6806310E56C; Mon, 30 Dec 2024 18:38:14 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.b="lqMJ4mst"; dkim-atps=neutral Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by gabe.freedesktop.org (Postfix) with ESMTPS id BA63410E56D for ; Mon, 30 Dec 2024 18:38:12 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id 36B85E0002; Mon, 30 Dec 2024 18:37:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1735583871; 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=esRRjJHDEk8HQ8R6rqbLTaRvPZxdOMS/qwKf6ebtbdo=; b=lqMJ4mstZN9HdJRSIxNnGzaomk6pe36aXJydJA4Qi3qKcsJqyLkCHHGdF9RJGe3Hf1witC G0IbikHT/61YAJtIlLBpwshWEUybGxpt2lSipwEZGZbiWYE5+ATJ3z2Hw1K1RF6yZjPaxb aEeVG94hgRcj82TMfSn6UFtoSh8SZDcO0ledWsCZGyyZtI3pPJ+mPgm114nHC0xjWlurpD 2Y1R43ZN5Gey8UoR9JhziorD17tnnTEPMICNz0j4+m8KnCWnYOcyO3mN4zXY7hGb7wfoT8 O7ApwtfVmoR1ZG83MRujOL3NGpzOL2qHYTxCD4rrC8n0/7HO169G90GwXL+yWQ== From: Louis Chauvet Date: Mon, 30 Dec 2024 19:37:37 +0100 Subject: [PATCH v6 7/8] drm: writeback: Create drmm variants for drm_writeback_connector initialization MIME-Version: 1.0 Message-Id: <20241230-google-vkms-managed-v6-7-15c7d65cd63b@bootlin.com> References: <20241230-google-vkms-managed-v6-0-15c7d65cd63b@bootlin.com> In-Reply-To: <20241230-google-vkms-managed-v6-0-15c7d65cd63b@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 X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=4084; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=EhkSYEZ68pDeZzMyUb+Yt9Bo/Mxf6ioebvaRQ1NiqGU=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBncuhy/jRThFwlfdT2r8urnrM3pQvWHPHV6xUcn zkJmKXimWOJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZ3LocgAKCRAgrS7GWxAs 4jOpD/4w6gts7wLnCWexMUFv1C0pJsE7Cox0atBmhJ53WZPIoB10lKqibFCvjAmNAzGcV9Aj4vk QbzDyGapklLPMPbLpL22HEFgfFOtZK7WTDtRwJwTzfMYLUHlzRne69T0aNJNliJsdYRWK+Ornsx p4e2P2yMAtD5vTaaBuLsEIemIpT9NO+XRM7XA2rI8Hoi1WLbsxutqhKwlJdeM4MeejcsdyyKDPs 402P6/pai28BM6tcLiTIQIEj4QkvGDigFkzg8s5yJ/5Pa+uoqoSJFY1H7u1ainkU5P4AYpQkeA4 1qdbIpJHX762yyWjTcOKfvj0kOgJtYJDHQroHAsUV8zpOcfx7ht4sRXSJcn0jcWMqR8PNLTAwGY Xi57EWrifuuZMfbrvi4m8yJBlzTbir+RGcPID72z6z45vwVnysvfsgaLfXJ56rrAzqWkmKhnkQR 4qq1qIO+b3lobxj0nz6VGLwDFRy5JdHq4dLqEsCVB2GfbUZgU4INuZ+brImiZF1xG8/9jM8sIgT WeUsY6zlTKAlu9tTv6EfoMrYvabhZiPMz1GOeIDqg8AZe3w3022139NTTVO69aLjWhbSCeOJk6W 0tOCyXhz+HNr7hUVmVVXofZsPmbM9UkkyemloNmxKCy+Ce52kALgSmQsX+DIX9f21PTcV1/MI6p 9qFMmq/GADFcQIQ== 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" To allows driver to only use drmm objects, add helper to create drm_writeback_connectors with automated lifetime management. Signed-off-by: Louis Chauvet --- drivers/gpu/drm/drm_writeback.c | 69 +++++++++++++++++++++++++++++++++++++++++ include/drm/drm_writeback.h | 8 +++++ 2 files changed, 77 insertions(+) diff --git a/drivers/gpu/drm/drm_writeback.c b/drivers/gpu/drm/drm_writeback.c index 9c69f7181e02c23dabce488405608c40d4184af5..1251f65aae9e3b6fb5c5de9ab9280e5430342208 100644 --- a/drivers/gpu/drm/drm_writeback.c +++ b/drivers/gpu/drm/drm_writeback.c @@ -369,6 +369,75 @@ static void drm_writeback_connector_cleanup(struct drm_device *dev, 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, 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) +{ + struct drm_connector *connector = &wb_connector->base; + 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); + } + + 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; + + ret = drmm_add_action_or_reset(dev, (void *)drm_writeback_connector_cleanup, + wb_connector); + if (ret) + return ret; + + return 0; +} +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 17e576c80169a820e8d5587b229b2cc2ee369a18..885373a34c000ae9a4ecff8d76125290bffca3f0 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); From patchwork Mon Dec 30 18:37:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Louis Chauvet X-Patchwork-Id: 13923420 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 C3D53E77194 for ; Mon, 30 Dec 2024 18:37:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 28B8510E56A; Mon, 30 Dec 2024 18:37:57 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.b="Bcomze7t"; dkim-atps=neutral Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by gabe.freedesktop.org (Postfix) with ESMTPS id DEE3E10E568 for ; Mon, 30 Dec 2024 18:37:53 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id 594E4E0009; Mon, 30 Dec 2024 18:37:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1735583872; 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=lRkeRn6r6X3xh8jLYGJ4zo8IwwZgvPnTh4x0qrq6oH8=; b=Bcomze7tL5oNotzwBmMPOZCtqawdOOfiJ+oJEBrfsronhpg4WfjLXnyeUpwNEJ7x77blBR E9MpVuwM7d6SLQB1xzgDZ2I04p7FQ1u4Qa37jClHzLC2khDGWSL0Zg62OetulqAVLTWW9f asaXge0WI6DElUV3Oqwqg+dC1vkoBB9zIRZrrScx582QvBbEVrd+fAzH4VYc+wVORJDIaj ME6cckn+UXSGz/RD2xxQVLEPhNa7lDKokkQTPxitMqMBHciGtxG/9AZcVWLiNqfU+ZyTZM abIGkX89Hc4sPTRYAOoFwmCtoR5IAe7c2Yn9A9b0g6NQYLy0+hUBfTdJDkIPNw== From: Louis Chauvet Date: Mon, 30 Dec 2024 19:37:38 +0100 Subject: [PATCH v6 8/8] drm/vkms: Switch to managed for writeback connector MIME-Version: 1.0 Message-Id: <20241230-google-vkms-managed-v6-8-15c7d65cd63b@bootlin.com> References: <20241230-google-vkms-managed-v6-0-15c7d65cd63b@bootlin.com> In-Reply-To: <20241230-google-vkms-managed-v6-0-15c7d65cd63b@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 , =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=1729; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=fH9+AvVDweyUZN0EnLMOj9Ap1SMeKhBjWS+wS7MANfo=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBncuhyBIBUSDlz44FD50cpIKLtdaHSEkAZ7nFbw J3SBHVjO6CJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZ3LocgAKCRAgrS7GWxAs 4kEOD/9dx3DoP89o/TmI2BDs1h/X3kYhnliFbaDOiSxjbrGGWBtMbRWAjmd4yO7wRpmrmPWBe/X obmsMR2QIHr5mWJhBtOOT2s51LbLPzopmHA/5wP89Oy5sowz4tPnS/SAi4cP6C/9rd1tU8aHIMM hlFMzq2cEnP0ijyRYmBE9y4egk4akzvokUisPkJ2X+Vb39I2gaur8BoHvbpaRB+/aed7GZX1hL5 SSbK8/KxMj+at0hk7gZ9J9WexYcGyzdY0pfdpSESrVdOVGDPwPJPSFaATjL1iFevMDmcgCRY9Aa 8c40bYr2qAlwwP/xkKKjigv6tSEQ/NDRRB7RAJbzBuI/uBDpfbHjcZ7NZWEmSDkYuJvlFsxmbqm IEfjQNWfMJi1jkIUnJQHg67ZcWInfDGiy0y1nWaYlj44ydJKqNrfW3j6Dm5YDnY4f4nXfSomwuj SXT3a01DJlNrRvWthlVfzeZA0nyndYQf5cDcp+gjI0qTzme6IX8tkgaqp92nKBgmUS1eePzNIPN nIfMBosGarv3gSyDuWZMOE/JHOwWUwpY1/zKhI40AeDyGHcveZ7vWiW8zkHwRJobWTaOsTrlvMI kG6K1wxiRlvOU1CseUlUmD02Hm79r07D2Q3zTXqtjXlXUpjt9q8ps4FSHopX1a65iDSr13UhW8M Yi004PkNKqyE0FQ== 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. Reviewed-by: José Expósito 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 79918b44fedd7ae2451d1d530fc6d5aabf2d99a3..f12417b2d24803a33e4ff56108cc89704a500faf 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, @@ -169,10 +168,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); }