From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A6B392AE94 for ; Mon, 6 Jan 2025 09:43:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736156595; cv=none; b=HCgDvzaSrv3Tm0zOSyB8LMSzZU6iKlGFqtyKEQIF4hpedW3DUaEsO9UV8K/DLd+OXnJYS+4NXotzESIZaIZXFKEbzCt3FzU6k04HeAe9mo7BAkrvgK6Q4/IvldZ5Rqmpmfdu3ZyPgqAg3y/PkN+I37w4ZbcdnZASTtB5OPRcHLU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736156595; c=relaxed/simple; bh=Am1upAm9duRmcKQiHZvn5Fk4ib0c9TJ6pXdDabnpuCQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NPjSV+WlR9yNl1glMSs4d8Ex9ExfJEZ4TKJSimvDJNsdt2Nr30LKuiCGjea+u5XFb5MtV/o9+TtdMyq2FTAgTymqDmd9Qm5i/rTfDdDHVJYKPdBMhjgZj4AECWIvmd+tDp/DsWW6FhhKi2C2EN616ZP2obRQy4sbrp9a5rUm6zQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=D30hOUp2; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="D30hOUp2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE30EC4CED2; Mon, 6 Jan 2025 09:43:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736156595; bh=Am1upAm9duRmcKQiHZvn5Fk4ib0c9TJ6pXdDabnpuCQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=D30hOUp2WPGyAxoilb3pUH9u6mLN0sRfGw/RALHLBnzomAhB9AHrYmisOjaMgO8YQ Gk4z/fHfhQBxR/YWdQ3g4XcQoqEfHitCc54C0AP57Y0GlsHUeq8uEK/lmsmJjiFlNT LXu64zKwwqCykpnEGv9QQcEmbg8K2RaFyKvD6bbry+QEigwmKEHDBGxXIWJ+QChrBF RwdJ0bdGfhpkHlmDGQUNpwlLL+7THCGgqVFoRIYp4Xn5SnKyc1kxeoeamC4hJoPu6P iVV/MLzAtLqkx5CnDB7hiMpEdfg75mWPoMCPBPptPg5Q/R+t0zOUz/Rfb8Sd6417eM rXlb5CYYQRUVA== Date: Mon, 6 Jan 2025 10:43:12 +0100 From: Maxime Ripard To: Louis Chauvet Cc: Rodrigo Siqueira , Melissa Wen , =?utf-8?B?TWHDrXJh?= Canal , Haneen Mohammed , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Simona Vetter , 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 Subject: Re: [PATCH v6 4/8] drm: writeback: Introduce cleanup function Message-ID: <20250106-straight-cyan-hare-50d8e0@houat> References: <20241230-google-vkms-managed-v6-0-15c7d65cd63b@bootlin.com> <20241230-google-vkms-managed-v6-4-15c7d65cd63b@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha384; protocol="application/pgp-signature"; boundary="ms2zusdi6h6qpedv" Content-Disposition: inline In-Reply-To: <20241230-google-vkms-managed-v6-4-15c7d65cd63b@bootlin.com> --ms2zusdi6h6qpedv Content-Type: text/plain; protected-headers=v1; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Subject: Re: [PATCH v6 4/8] drm: writeback: Introduce cleanup function MIME-Version: 1.0 On Mon, Dec 30, 2024 at 07:37:34PM +0100, Louis Chauvet wrote: > 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. >=20 > 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. >=20 > Signed-off-by: Louis Chauvet > --- > drivers/gpu/drm/drm_writeback.c | 43 +++++++++++++++++++++++++++++++++++= ++++++ > 1 file changed, 43 insertions(+) >=20 > diff --git a/drivers/gpu/drm/drm_writeback.c b/drivers/gpu/drm/drm_writeb= ack.c > index 33a3c98a962d1ec49ac4b353902036cf74290ae6..c274cba257cde5f4b446df385= 4974e690c60bf7b 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_de= vice *dev) > return 0; > } > =20 > +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_pro= perty); > + dev->mode_config.writeback_pixel_formats_property =3D NULL; > + } > + if (dev->mode_config.writeback_out_fence_ptr_property) { > + drm_property_destroy(dev, dev->mode_config.writeback_out_fence_ptr_pro= perty); > + dev->mode_config.writeback_out_fence_ptr_property =3D 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 =3D NULL; > + } > +} > + > static const struct drm_encoder_funcs drm_writeback_encoder_funcs =3D { > .destroy =3D 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); > =20 > +/** > + * 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 proper= ties. It > + * will also clean the remaining jobs in this writeback connector. Cauti= on: 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); > +} > + Given that this function is static now, it should be merged with the patch using it. Maxime --ms2zusdi6h6qpedv Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iJUEABMJAB0WIQTkHFbLp4ejekA/qfgnX84Zoj2+dgUCZ3ulqwAKCRAnX84Zoj2+ dnbuAX44qK1eRM529azS8s7oe9uBDW/qiucXZvTDGw+Pc8EqHQSHgD6mPe8m6k7X iGKFQ2EBgJGKFRP+mmqXmCymlMMy35FTR0D82Oh2JGFJ9GbQPwVC/hswWc0zK7Pd 3j2nv0zlxg== =NLCS -----END PGP SIGNATURE----- --ms2zusdi6h6qpedv--