From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Anholt Subject: Re: [PATCH] drm/vc4: Make sure vc4_bo_{inc,dec}_usecnt() calls are balanced Date: Mon, 30 Apr 2018 13:54:54 -0700 Message-ID: <87y3h4jty9.fsf@anholt.net> References: <20180430133232.32457-1-boris.brezillon@bootlin.com> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Return-path: In-Reply-To: <20180430133232.32457-1-boris.brezillon@bootlin.com> Sender: stable-owner@vger.kernel.org Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, Peter Robinson , Boris Brezillon , stable@vger.kernel.org List-Id: dri-devel@lists.freedesktop.org --=-=-= Content-Type: text/plain Boris Brezillon writes: > Commit b9f19259b84d ("drm/vc4: Add the DRM_IOCTL_VC4_GEM_MADVISE ioctl") > introduced a mechanism to mark some BOs as purgeable to allow the driver > to drop them under memory pressure. In order to implement this feature > we had to add a mechanism to mark BOs as currently used by a piece of > hardware which materialized through the ->usecnt counter. > > Plane code is supposed to increment usecnt when it attaches a BO to a > plane and decrement it when it's done with this BO, which was done in > the ->prepare_fb() and ->cleanup_fb() hooks. The problem is, async page > flip logic does not go through the regular atomic update path, and > ->prepare_fb() and ->cleanup_fb() are not called in this case. > > Fix that by manually calling vc4_bo_{inc,dec}_usecnt() in the > async-page-flip path. > > Note that all this should go away as soon as we get generic async page > flip support in the core, in the meantime, this fix should do the > trick. Pushed to drm-misc-fixes. Thanks! --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE/JuuFDWp9/ZkuCBXtdYpNtH8nugFAlrngp4ACgkQtdYpNtH8 nuivzQ/7BuDSSpelXtM08N4P//b0l3OPFKlJUWlkvQgQ991o9RuduDzy2lVMCvZ5 Tm/jO09t7s9/I4Rc0j/kbLin3A6ZoYGMyQPK4WyMY1N4j6gyWRxWyAO7Jqi06G8g 777poo9/dex4oTT7DmsB0qDaZpGYW2AD3VnLM+N1X+l2tOOqQi7i9h9ZHZ6tXG8T WYDz7Ssj6MltMsaqjysJmHLE3rZ9It51LOrxCN4MqMp29kM4ZD0VVjIqvKSvBkch 9V19/ANukf1eYoLMpiHgEeGLpqjpBxWbrJK9ll/ouwN04cWdXRq033PE2ohC4TCV vlE1z5oD9m3NKwY3HKt4CTpSo9k/fplX0LC2uKAQvjoUcP0r/Q/VE19nNLxkePLw zDcdthrrschauXIQK/JZoiI4zUlnu2YGz/BnWmFQZOS1axjqwU4J2J266WGS0Ev/ UZZkAf9ITRyAk3xrr6QOBubA92YwRmukfEH/869HR5I/rBKArfJKKQ6mysNHXQnL afYp81q1/brXrbS1yH/xHxAhLfVwe0iXJG8kxW5YUgQUFUI1rWm0bYCVVBTi2JTI fjfh/V0f0jxXAqGxfB9UWbGHyQ92bznMicrBK7bQLNEmZvv0ScXpceC8Pd0vD+YC qFO2zOi6CyU/jiLXYkW7iTyCZ0M3+/+XQGkvd/DsGXTqv7IjMqs= =C5X0 -----END PGP SIGNATURE----- --=-=-=--