From nobody Sat Nov 30 01:44:27 2024 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B20421A76A4 for ; Thu, 12 Sep 2024 13:25:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726147529; cv=none; b=Znwj0d36p3pCBAjohq0oGaBa3M+/tS7LgwAdVVxA+1KD6iFVvw+9+IUFPyeedvzBE0f3NNCJuqAZ8hlbDpwmiv268airCVqG5rtnPI/U/aYk776JZMyDu7d1tng5P/MZb8QOA8TaWEVcrd5FTWpkCloOnk51/nRGkF2jW9eMbOY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726147529; c=relaxed/simple; bh=tR2Pek6p+Z1Y/CCm8gFsRbPMfMtJuv7bIWglOMvOdFY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ANFhyeW1HSqOzAlGsgWQFevg4yohByRkq8mXebojq6jwRmc/VxuOCiOZBeBDbfeeZrVgR/Nc0lzc7WSk8Xkmx8UWE3c5iQCISMWvhqxbtWgGNyfmIUhi64p5bUwTTea18FgN82uspPlOxJS/btnt3EadswNA9eGrxy7ohgRoPrM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=CDPxMND5; arc=none smtp.client-ip=217.70.183.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="CDPxMND5" Received: by mail.gandi.net (Postfix) with ESMTPSA id 3C4DB4000E; Thu, 12 Sep 2024 13:25:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1726147519; 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=g34sFbJmZ8FTG/UCaYFEJPYIDmiuCfsWD/gVjbMaAdU=; b=CDPxMND5j0TvekZ7GfQb6Q4eErc9oQOrKXBMi5VzM/nUFPkNvszOHgroEjeaeXKnRljvum gliUHLfJFJv25uBKyXu3VhLovVOVFU1mqU8C+SjABaZdH+P2KyC75JnUSMup8WjAsTtl5g Fi06l5V5mc2s+xB+SplE1VbCblfkbMgwgbMKNYsh2eR2Su430qE9prZeb+hAcUTBpIwDJ9 u/Cz1ArUw255ldp+H7NZUFCQpYYjPsBksNdvn/ubwhBpLLfj5GGzIVlY82bkeIxVd7Jnhp wRtfSVGaZvvVigDQ47YuqnDmfC4N2Ho7wladFa+rJuMBvDAXCYAimCqVyf6mSw== From: Louis Chauvet Date: Thu, 12 Sep 2024 15:25:14 +0200 Subject: [PATCH v3 1/4] drm/vkms: Switch to managed for connector Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240912-google-vkms-managed-v3-1-7708d6ad262d@bootlin.com> References: <20240912-google-vkms-managed-v3-0-7708d6ad262d@bootlin.com> In-Reply-To: <20240912-google-vkms-managed-v3-0-7708d6ad262d@bootlin.com> To: Rodrigo Siqueira , Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie 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=2084; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=tR2Pek6p+Z1Y/CCm8gFsRbPMfMtJuv7bIWglOMvOdFY=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBm4uu8q0Cm3Vmu3KFO5KNH6YiN/uDaU+NLuFMQc NUoLZjbQTCJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZuLrvAAKCRAgrS7GWxAs 4j3RD/wML80ppF2mUtV6BVZUfH2mypdVpWRaTp5b/JqWTEolEgkZV0LbwOwtv/PWEK3UU32fF5J 5rrUB+YTUUBS5fopmSyuAn7opZJd/2fJB3hdjbQkT6953w33W/1eXloXVPj/Xn7tKQUzWW562EK ggYuwvQyd0H6VbxNC9aiHI4/OEopWmu8KgiL9lM5Pk/S5v57jNo+E7TQN5zGkWL5rLZKWTZMHzs oFlkY1zTrjJRtJxI2pEeLfmPkQvCFm7hEX3wKaXF7CZpbSS0MiosC1AUcRp8sw80zmZFBmxIhXc jqS8zzEuxuxTykQ0QG2hjtGTPKkadLM+VatZokFrx3yJNg79+vIFdFIA75Auw0rZNU8t0s97MYT OF9uecZRmTYKyMcr4Wzothk5HeCjozFLELP+SWyme+KbQZWtDwb5ZqM/HGtWrM8MBmvn7D2t5RD SK9Q0fFnWFmvULwqM7fxVPYk/nn9TjXOXS6VdaXs1IX0y4lYow38mxRR8tGJXhIwmDqXcLKTEg4 gZqC+dha2m52bX7qSWpbaesXnIFm4wN/HtFxP+Pm9Ty/oiQUfDA45pgxb2ueC9Jfi8dk2bDLL61 8EWQZ6ymBwHKfCvYnJ+kl5TAb4hUI7BcV9ueSYNtlBnhA4Uz1m53se+5N4KzZ07taUfltpm+g0V 3yRS5euMZ/qeARA== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-Sasl: louis.chauvet@bootlin.com 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 | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms= _output.c index a6a942b4f84f0caffe1e9e1523edb262e1b7bcfb..1a445a4ff6ffb023a1c1ef7e141= c771277146251 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 =20 static const struct drm_connector_funcs vkms_connector_funcs =3D { .fill_modes =3D drm_helper_probe_single_connector_modes, - .destroy =3D drm_connector_cleanup, .reset =3D drm_atomic_helper_connector_reset, .atomic_duplicate_state =3D drm_atomic_helper_connector_duplicate_state, .atomic_destroy_state =3D drm_atomic_helper_connector_destroy_state, @@ -66,8 +66,8 @@ int vkms_output_init(struct vkms_device *vkmsdev) } } =20 - ret =3D drm_connector_init(dev, connector, &vkms_connector_funcs, - DRM_MODE_CONNECTOR_VIRTUAL); + ret =3D drmm_connector_init(dev, connector, &vkms_connector_funcs, + DRM_MODE_CONNECTOR_VIRTUAL, NULL); if (ret) { DRM_ERROR("Failed to init connector\n"); goto err_connector; @@ -79,7 +79,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 =3D drm_crtc_mask(crtc); =20 @@ -101,12 +101,7 @@ int vkms_output_init(struct vkms_device *vkmsdev) =20 err_attach: drm_encoder_cleanup(encoder); - -err_encoder: - drm_connector_cleanup(connector); - err_connector: drm_crtc_cleanup(crtc); - return ret; } --=20 2.44.2 From nobody Sat Nov 30 01:44:27 2024 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F39DB1A76BC for ; Thu, 12 Sep 2024 13:25:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726147529; cv=none; b=eH2mP0HZyjJeJE6yHoi8mYykAMSFUOCs6EGMTkt3Kw39d5gRi6dCQMJL21KxBxm36f3ZEVnQN7iBeZVQRIo8tX9ro8EKT9yxZdpFa6Ia0L06/p2RpriyGiZoSUjQkGKCCqxNJiyk6iuqG5KpRh4TU3TXcN7Y/CmwPinXNIC6fF0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726147529; c=relaxed/simple; bh=bM44tHCPJrHTE+kJWXIrV417+Q33Eyk1EOPqV9M8sYw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Kz+7hIKDZM/I+qqhVvhaWOSBt7MmDRjyaPQX84coBhJYBLzXFFJmTX3gQN9F9UVtJo/wzsNwdRKpxf/euKPl3dXE5GPF9HJ0HAsXlNfssHQDS22zRroqrA6LKjNG3Vl8HbhF6s0gvnyiCgO5TBm/xMzlrSB60R/zR4qnLEvy558= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=pE4xfwPS; arc=none smtp.client-ip=217.70.183.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="pE4xfwPS" Received: by mail.gandi.net (Postfix) with ESMTPSA id 1EBA04000D; Thu, 12 Sep 2024 13:25:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1726147519; 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=ZU22e0/TQ7MJ3yFJWCIrZsJEcPRhtvo7WlcHoOwghGA=; b=pE4xfwPSWQF8+5sKIWJgXqjsCbLhf6rHdkZk8qWEKLU7WXh3tYVHhUDuWjYnXTUrCeQyQK FKgaEja6Wd0heGeHtCapItx6LQMiuYmIm1rRlN2wkf4FGjIDXiNhwDsa/ZvkPkXeI4N7PJ a+idTvgnN/mgOfy/qIRi0uAz+n9eQxMFUK492Toz8dNM18WvZkT0m41ID9Xnqx9zSs15x5 MkLzRp0qfWXFE2RbrzCwwAhx0/O+AJtzvdN8E3sM3uc43El7WYv4LNO8eT1Tv3zfNEf/Aw jPiWMSLj2efTiz9N9BZvEKyb8V7RLJdkrQKcksIcRs6SjETvqCs1gZ+Sp2B7Zg== From: Louis Chauvet Date: Thu, 12 Sep 2024 15:25:15 +0200 Subject: [PATCH v3 2/4] drm/vkms: Switch to managed for encoder Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240912-google-vkms-managed-v3-2-7708d6ad262d@bootlin.com> References: <20240912-google-vkms-managed-v3-0-7708d6ad262d@bootlin.com> In-Reply-To: <20240912-google-vkms-managed-v3-0-7708d6ad262d@bootlin.com> To: Rodrigo Siqueira , Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie 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=1909; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=bM44tHCPJrHTE+kJWXIrV417+Q33Eyk1EOPqV9M8sYw=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBm4uu8MZi6SumIboPrHUhfYXcn7YAGOwxchgcz7 j88asy8FWeJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZuLrvAAKCRAgrS7GWxAs 4lfoD/4vF8usdGpAQ8dBZlkeDh22CqCZHZWgese9ruXdDPEPx66ojjzG6ml0/JqSRQbUYhfMGmp 1fqEUKWnzzM1+HluGxIJMX7HWwpKxtQwAeHNJ8taFYHf4FnVrUum6btIGh7JCVGWOfLk+wSPBrU 8c9u6kwVq0A1IftCfxjCFr2Jq5bNBH/cRcRKxyxnZRpzdEs9hjaz9kpggK6/z054hV9LwhJP6ww 8vVojV95V2qfTMyEqQ6raC4phBi0tNJGBywS1IYLxL93KsW+67L3HZzvkeMNP38NpnvnhWoH5PY BevSUh+/P1I/YXUAjOGND19Ng1eCy00x4xlUs/qmEogjCI8vgiYyNLVjkyzz23IVXikh31aYIeP aHxtkn7i/HydMXgF5ld/vl+VxunsDAdm+VK9HNVFA1qNkdHt7Fm+muYYF2hQmwwrxjXerbTx7IP 5ojlHZ3lnZiMTV2A+MAiefLR63MkotXw2xp2+EIbSuBIaJHStZKtEjdRijADs6hLkD6P6kX1KXp KZBfgkto5YvnL/CkNtC2m5/kcy9nOPwzm6py6mrfq4gdf3DZjNPw+9p1zSXsewmE8qQ5pGBPtkE zsHFzqORqw9alw3MDqPiem5nvw+9PwjIpQ7Aj5PYlSakJVXkTSrrRsCD7G9goHgjs0H+gvO8v4j LmqG50vr6K4MpMw== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-Sasl: louis.chauvet@bootlin.com 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 1a445a4ff6ffb023a1c1ef7e141c771277146251..2226ba1972f3ff51483abacac45= ee8914be0c94a 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_f= uncs =3D { .atomic_destroy_state =3D drm_atomic_helper_connector_destroy_state, }; =20 -static const struct drm_encoder_funcs vkms_encoder_funcs =3D { - .destroy =3D drm_encoder_cleanup, -}; - static int vkms_conn_get_modes(struct drm_connector *connector) { int count; @@ -75,18 +71,18 @@ int vkms_output_init(struct vkms_device *vkmsdev) =20 drm_connector_helper_add(connector, &vkms_conn_helper_funcs); =20 - ret =3D drm_encoder_init(dev, encoder, &vkms_encoder_funcs, - DRM_MODE_ENCODER_VIRTUAL, NULL); + ret =3D 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 =3D drm_crtc_mask(crtc); =20 ret =3D drm_connector_attach_encoder(connector, encoder); if (ret) { DRM_ERROR("Failed to attach connector to encoder\n"); - goto err_attach; + return ret; } =20 if (vkmsdev->config->writeback) { @@ -99,8 +95,6 @@ int vkms_output_init(struct vkms_device *vkmsdev) =20 return 0; =20 -err_attach: - drm_encoder_cleanup(encoder); err_connector: drm_crtc_cleanup(crtc); return ret; --=20 2.44.2 From nobody Sat Nov 30 01:44:27 2024 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7DB8E1AB6C3 for ; Thu, 12 Sep 2024 13:25:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726147531; cv=none; b=ehkYngbESowZwy2uHBwkDt4/KhVkQ39r1oVj+TzZbWqfBWruh/vF+DW0M0w3OBfJ9evegRykOv7dSceDrjH+jVKxhCOvdja9NXOwCLCv6Duq1tXl/Te+3GCs00cw3sa0uKq8HuhGU93BruOlcFjwOpPx6B/rBN1y0nPq+oeedpI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726147531; c=relaxed/simple; bh=Wz5xV9ppwUXESjrOq0r7h7WjvQ6z2QMJPsfZHBp14W4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=eKUu2b5HFLxerR0w/iXL61uj+VIfrN6FVYe3WWDdCzYRt7HyZVkHlZ4zPEFZyCAt6W/9xRaBnwW3sG5C3s7AA54G/KNBvCh/x1lyhnRj+ElrfwbkynQZ4wx04lI452hb4Zqc7SBiGsNzXDR0KVrkJLOCzqtkYMcOh+89dUHvwco= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=kly6+zF9; arc=none smtp.client-ip=217.70.183.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="kly6+zF9" Received: by mail.gandi.net (Postfix) with ESMTPSA id F193540008; Thu, 12 Sep 2024 13:25:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1726147520; 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=jHUlHTbWDx2+CDiUKbnK1f55570D9EJQ2eAZEAhIJoU=; b=kly6+zF90KYgRQbIoWRDniYYV0LzGH//6fKiJHjcRIMxE3IzzwyNOnLgSt/XQT8Kr7EU2u 5jMhDAbEuFhhhB2Hqte6R2DV29k0phpNHguw5i63wogXZUbDNiteU8yVKtaDrCX/M8q2Vv racceRBwAr1v/gKI64Eh9k5g9/Ou0a0hM6UaY9E+MB72VXhYQ0eFooVVVNePavjxQa3rye VQT/fy0/qbYdSXs40OA99BmamP52vLVXA6rMan0CXoB76Wbl+3uoH7ud+41iqsAvkCnzrZ H1NdmIKvrSI4hYujOi2Z8a9ft6oTYPdw3nxiSxFDOzxwH9J132snYkuKPiJWxw== From: Louis Chauvet Date: Thu, 12 Sep 2024 15:25:16 +0200 Subject: [PATCH v3 3/4] drm/vkms: Switch to managed for crtc Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240912-google-vkms-managed-v3-3-7708d6ad262d@bootlin.com> References: <20240912-google-vkms-managed-v3-0-7708d6ad262d@bootlin.com> In-Reply-To: <20240912-google-vkms-managed-v3-0-7708d6ad262d@bootlin.com> To: Rodrigo Siqueira , Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie 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=2726; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=Wz5xV9ppwUXESjrOq0r7h7WjvQ6z2QMJPsfZHBp14W4=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBm4uu8NHGz3GXdoQCk4tGqrkN/oVHXvfrtKeBjQ BdHnATj/eWJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZuLrvAAKCRAgrS7GWxAs 4rLsEACIA5/nrrQ5DoWXFEv0ncatq0EzNyKKtePfTgVlVYclD45bH04vUoxNNbUuaER2qpUQC0X 712GDZqUIWDdM58eIjm7bixZgPuwetmR+Hnv2IDolO3WxatPFDUDMoadymiLB34SOfLdigIFsIX bYH5pWrJYuEjTtBd1WMT/nTMWmhrBY3bD8Yfp9KmqidC/u4SpvyemqXVNAtyLeeud3j91LR5qcD Oou30zr9m97UJIQvsTAWiQMqt5BWI1r5/+eSsuPEXps8hAMS8FicILgxxwP/N4shpO+uR7ZZ0Vr CCfGdVL1TB+lWdewYVsvf/zmtgN1P3VGOidQj5UeIaHzUghVOmaUAKBOgo7h/fONR67jGjZPHt5 7f5/ERYXEqa+VHWUbS8da6kGG+nUAnPboCEh3yL59A79B0peBngX7/fi+RrwGdHZ2Ht1MlhgE3G 5BzyZ1K7CiFNmLc8wofo6DT+NNIBcX/xdlyKRTmlnlrmhcUFvoU1MPavsiCVMwfTX98tNSLzUWX gvj175t0y2FK2WDuN2Z/hbJ9nK94q1PhhTtFJhXpbOFnSieecfMnjH6zr88ky2yqiUnrtRUBXAz yLaUE4H2D/Ss4EwLXS7p/Lk9hnZJiNcDDwXihuH/T973dSqpEycRD/1O3p8aF5deYyzmhhvHn5+ scn+k8qS+O9NeHA== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-Sasl: louis.chauvet@bootlin.com 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_c= rtc.c index 40b4d084e3ceef9e1e24b7338efdd9253afee8d6..821b9ac746083630116e05c1cf8= e3dc2424ac66a 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 =20 #include "vkms_drv.h" =20 @@ -272,6 +273,14 @@ static const struct drm_crtc_helper_funcs vkms_crtc_he= lper_funcs =3D { .atomic_disable =3D vkms_crtc_atomic_disable, }; =20 +static void vkms_crtc_destroy_workqueue(struct drm_device *dev, + void *raw_vkms_out) +{ + struct vkms_output *vkms_out =3D 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) { @@ -297,5 +306,10 @@ int vkms_crtc_init(struct drm_device *dev, struct drm_= crtc *crtc, if (!vkms_out->composer_workq) return -ENOMEM; =20 + ret =3D 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_dr= v.c index 1226a790bece7e197ab200f9fab68ee3dbaf340f..f6c2acb57f21bde5282682f090f= 48867ba3615c5 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"); =20 DEFINE_DRM_GEM_FOPS(vkms_driver_fops); =20 -static void vkms_release(struct drm_device *dev) -{ - struct vkms_device *vkms =3D 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 =3D old_state->dev; @@ -109,7 +101,6 @@ static const struct drm_debugfs_info vkms_config_debugf= s_list[] =3D { =20 static const struct drm_driver vkms_driver =3D { .driver_features =3D DRIVER_MODESET | DRIVER_ATOMIC | DRIVER_GEM, - .release =3D vkms_release, .fops =3D &vkms_driver_fops, DRM_GEM_SHMEM_DRIVER_OPS, =20 --=20 2.44.2 From nobody Sat Nov 30 01:44:27 2024 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7DBF61AB6DC for ; Thu, 12 Sep 2024 13:25:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726147530; cv=none; b=NhoE7drftglbZN2sqht1v+stujWToAmKeDkVhnZnlD1YkPgyV0ZNfGOxHt+EbrXUFOWysO/EBJj/kugKjNYzkhpzc6m8CkHz/AKyoH0UBHFK84evO37Fm/y9h+5u+AQJVyXAHnZtXWG62YjeX2NinAFpPoEFSwwz2Zg4pzkIZR0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726147530; c=relaxed/simple; bh=HqLDT2kDdULA6wIcAVsiwZrhSN52t305f8ag1ydTtms=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=D4JhzAkcLtOaHqgkCC35vbT+21gp4AJ1wiY04kbV97ZR8bgrTJ54SYPhHcdP08AtpcNfop7w80wmg96o5N37+0AP6QBU2587ft/WzOgTpregqBohUjr9gkC2g3CJiHN6/UV+6Eo+l9/PJ2yBZ60zWMSbQuQRP09anBzNu8KDjlY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=XOL+xtlq; arc=none smtp.client-ip=217.70.183.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="XOL+xtlq" Received: by mail.gandi.net (Postfix) with ESMTPSA id D5DC640004; Thu, 12 Sep 2024 13:25:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1726147521; 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=GpsUVuEinW8EH03g2sq6CYyNt8DLqEZWlJ6lw4FIIPs=; b=XOL+xtlq+3fW3c90nkqTHAkDg05uAloEPpZwAvKKEXlPviuxzF74NJUPA7KqceRTJ8orz5 eu6zmn/EPORKMPNt8N0VDKfeVMntOnw/1Qi+vzzlRN2lQ2FL7HUtLrEW0ienFElTH9VXxy +7yAhf+rdVSvRMYaDVf0MxC7N4b4DpH3HxZkIs7H0/0tkK2yX2P/bzMEoiO45u1j/qC4+q UyDkiDDOymUszEzzVjwWf5EF5IHXvBEnpAJTbLAe71pt1wtnS15yJx6jRIgNLae0Bup705 Lsb1nDZevhVTacGn3xoL9tAtAP6092NZXGkJWuM0H0DVrPMyjT61RslXtGZxFQ== From: Louis Chauvet Date: Thu, 12 Sep 2024 15:25:17 +0200 Subject: [PATCH v3 4/4] drm/vkms: Switch to managed for writeback connector Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240912-google-vkms-managed-v3-4-7708d6ad262d@bootlin.com> References: <20240912-google-vkms-managed-v3-0-7708d6ad262d@bootlin.com> In-Reply-To: <20240912-google-vkms-managed-v3-0-7708d6ad262d@bootlin.com> To: Rodrigo Siqueira , Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie 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=1671; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=HqLDT2kDdULA6wIcAVsiwZrhSN52t305f8ag1ydTtms=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBm4uu8HmEzwmBUqDedxhCpcmLkeGIsQmnbc78CJ gD1o3ASgxGJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZuLrvAAKCRAgrS7GWxAs 4hOUEADPaf75OVqrMBKKKcdS+p3NTt7BeEqESVcTeUu2oeqy6UA04saIrLTEYeepHPof/5s/OEt 8km3IzxHuXgab7DlPzD+2etQSepvFoYz6KQ6evbM3QsGP5QBeGctSDqH//MwFxJvLQ5NUDT9glT HVKes/lvoTu3U+HPEsAi0WfYmG+5jA2AoRFeDiXdpwPsD5t/Ed9ei18q2Rj3Xyt44CqUFxqgbVo 8kUNfAvX5u/Xp8I8fT7PfUJrT2lOb8IoPAkmo2meR2jzk+9doaFsRAW6nCmxSzNx5gqzaHbHwKk RaIFbmnhH7O38wksRjHod0Lti35fVeQkMYXyUq/AG/prQe4sgwijieXBU0szRcKIr6VJy7gXzxv 29k9em18r3gEjMMTlBXIA4bSBuXHTwjVwBPy74DjPIWbcFFdUoPWeGSYPbVQ4p6oLtOFpH9Oh0a TZUhTNLEgzLt1jphWgglWgA3VGY87jkSwWqSA7kSb2OfLFvur7cdyC4tXQ8An20QEUXwuasaUMw 8OCShttF8LHm+7YmvVXZdPDgKxquDxKWI3QyQb/FQes22v6wtf9Ay6GG+xC9o1k26CLIPZ2k8A2 Cbtl6CX4Qly7E5wzw1dwuWkff2ttkYPhEMl90KD5L8F1kDFeoT1tcqiK2FnSCTfNVdE9rnNtmia hVQAp2sKRM1K5Iw== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-Sasl: louis.chauvet@bootlin.com 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/v= kms_writeback.c index bc724cbd5e3a79705bdc091a7a13430f67ecf65f..a948f4598764efef971f76e1016= fc1a963fbbba7 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[] =3D { =20 static const struct drm_connector_funcs vkms_wb_connector_funcs =3D { .fill_modes =3D drm_helper_probe_single_connector_modes, - .destroy =3D drm_connector_cleanup, .reset =3D drm_atomic_helper_connector_reset, .atomic_duplicate_state =3D drm_atomic_helper_connector_duplicate_state, .atomic_destroy_state =3D drm_atomic_helper_connector_destroy_state, @@ -174,10 +173,10 @@ int vkms_enable_writeback_connector(struct vkms_devic= e *vkmsdev) =20 drm_connector_helper_add(&wb->base, &vkms_wb_conn_helper_funcs); =20 - 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); } --=20 2.44.2