[PATCH] drm/vc4: Make sure vc4_bo_{inc, dec}_usecnt() calls are balanced

Eric Anholt eric at anholt.net
Mon Apr 30 20:54:54 UTC 2018


Boris Brezillon <boris.brezillon at bootlin.com> 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!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20180430/18fdb97f/attachment-0001.sig>


More information about the dri-devel mailing list