panfrost: Add madvise support to BO cache
authorRob Herring <robh@kernel.org>
Wed, 31 Jul 2019 23:28:37 +0000 (23:28 +0000)
committerRob Herring <robh@kernel.org>
Tue, 20 Aug 2019 00:33:20 +0000 (19:33 -0500)
commitd0ec5d38f6cff2e61d9e526423c0a016cc830d14
treed51ab040b6dfcf6e4c793a56e83bf61582a12224
parentc45c2d79605b27022975ff1635f9df8f5d01806a
panfrost: Add madvise support to BO cache

The kernel now supports madvise ioctl to indicate which BOs can be freed
when there is memory pressure. Mark BOs purgeable when they are in the
BO cache. The BOs must also be munmapped when they are in the cache or
they cannot be purged.

We could optimize avoiding the madvise ioctl on older kernels once the
driver version bump lands, but probably not worth it given the other
driver features also being added.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Signed-off-by: Rob Herring <robh@kernel.org>
src/gallium/drivers/panfrost/pan_bo_cache.c
src/gallium/drivers/panfrost/pan_drm.c