From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thierry Reding Subject: Re: [PATCH 17/17] drm/tegra: fb: Do not destroy framebuffer Date: Tue, 4 Nov 2014 17:08:07 +0100 Message-ID: <20141104160805.GC1840@ulmo.nvidia.com> References: <1415006868-318-1-git-send-email-thierry.reding@gmail.com> <1415006868-318-17-git-send-email-thierry.reding@gmail.com> <20141103095342.GD26941@phenom.ffwll.local> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1188119681==" Return-path: Received: from mail-pa0-f48.google.com (mail-pa0-f48.google.com [209.85.220.48]) by gabe.freedesktop.org (Postfix) with ESMTP id 1DD316E095 for ; Tue, 4 Nov 2014 08:08:14 -0800 (PST) Received: by mail-pa0-f48.google.com with SMTP id ey11so14622085pad.7 for ; Tue, 04 Nov 2014 08:08:13 -0800 (PST) In-Reply-To: <20141103095342.GD26941@phenom.ffwll.local> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Daniel Vetter Cc: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org --===============1188119681== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="raC6veAxrt5nqIoY" Content-Disposition: inline --raC6veAxrt5nqIoY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Nov 03, 2014 at 10:53:42AM +0100, Daniel Vetter wrote: > On Mon, Nov 03, 2014 at 10:27:48AM +0100, Thierry Reding wrote: > > From: Thierry Reding > >=20 > > Drop a reference instead of directly calling the framebuffer .destroy() > > callback at fbdev free time. This is necessary to make sure the object > > isn't destroyed if anyone else still has a reference. > >=20 > > Signed-off-by: Thierry Reding > > --- > > drivers/gpu/drm/tegra/fb.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > >=20 > > diff --git a/drivers/gpu/drm/tegra/fb.c b/drivers/gpu/drm/tegra/fb.c > > index c5fa3c4b2ed5..17a29971a7ee 100644 > > --- a/drivers/gpu/drm/tegra/fb.c > > +++ b/drivers/gpu/drm/tegra/fb.c > > @@ -355,7 +355,7 @@ static void tegra_fbdev_free(struct tegra_fbdev *fb= dev) > > =20 > > if (fbdev->fb) { > > drm_framebuffer_unregister_private(&fbdev->fb->base); > > - tegra_fb_destroy(&fbdev->fb->base); > > + drm_framebuffer_unreference(&fbdev->fb->base); >=20 > Yeah this is better since you have a free-standing fb pointer. I think > most kms drivers copied this stuff from i915, which just embedded the > framebuffer. And then calling unref obviously is a bad idea since the > kfree will blow up. >=20 > Reviewed-by: Daniel Vetter I just noticed that drm_framebuffer_remove() is actually more appropriate here. Just unreferencing will trigger the WARN_ON in drm_mode_config_cleanup(). Removing the framebuffer also has the advantage that any users are forcibly disabled, which gets rid of some annoying IOMMU faults. Does the Reviewed-by still apply if I do this on top: - drm_framebuffer_unreference(&fbdev->fb->base); + drm_framebuffer_remove(&fbdev->fb->base); ? Thierry --raC6veAxrt5nqIoY Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJUWPnlAAoJEN0jrNd/PrOhn1cQALkEG/pam+IcYcWb0iNs4rqp Sor9D2/29UIw14R4PnAPoe1iQFquVepvQ7Srscctvwx/PRdP3780YiThFnrZJlM+ onYCKoH5Louli1XoVr7q3QorbyTdkD1AAynCl7S1CPVsmwrYHR3hlKfxzrxNGEL1 wqcEJqSxUj60OIr5j7Jm3pVxLcaJ+SkZDGbzhkU3/U5JF4ur/UvrpJmL8UJcbNeE 1om9VkhmrvagQYVPKu0PDiR8d6R/9SD/jr5mejLwLdVtem0Qv7Xq9MP2rSNccDSc T5rBHy+vM7bEf1GlWQjF4GMzL5ZM6r4dnwrCYS4w7f54yaiv4ckG1XKgf3m/75ou 4MZQ0syESlti03ACvJg6GXGEbKld1XYQdVPQjOfeKo/RPK07hUZYpwpGuABIHPfG ANm6MeLm6CCOPaWtbdUjG17pnjqW0WCFndVSmDEwkFrFqOf3P59fMW1lQNHsaWeS 5xX97YkbVy1QsLAtOJM10hq+i+ih28KrPjGYSM4WBe9rc5nIiOAedG1m6COUjzDH G/mhQxtYRK18vfeiHPmvwUkIvzO0kkNnJKk1/klaeXLCkkq/5YKWJmCb06XJtjgA bseq8mtnpD9A8uz9RC6kQFG4te7MSHi3aQPHSg+JPWXKArNXELbUSJpTf2Os9r4f YQ+JMScrFr81cMdJXOxH =Dm9i -----END PGP SIGNATURE----- --raC6veAxrt5nqIoY-- --===============1188119681== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHA6Ly9saXN0 cy5mcmVlZGVza3RvcC5vcmcvbWFpbG1hbi9saXN0aW5mby9kcmktZGV2ZWwK --===============1188119681==--