broadcom/vc4: Mark BOs as purgeable when they enter the BO cache
authorBoris Brezillon <boris.brezillon@free-electrons.com>
Tue, 26 Sep 2017 11:37:40 +0000 (13:37 +0200)
committerEric Anholt <eric@anholt.net>
Thu, 9 Nov 2017 18:57:17 +0000 (10:57 -0800)
commit359a8f6ae5a2e33ffd8dd2a06883fad83e7e09c9
treefd3ec9fcbf75c81dcd381306c4d682819c57bee2
parent7d72af4f09c0482661096797594287e6d7d5c1b2
broadcom/vc4: Mark BOs as purgeable when they enter the BO cache

This patch makes use of the DRM_IOCTL_VC4_GEM_MADVISE ioctl to mark all
BOs placed in the mesa BO cache as purgeable so that the system can
reclaim this memory under memory pressure.

v2:
- Removed BOs from the cache when they've been purged by the kernel
- Check whether the madvise ioctl is supported or not before using it

v3: Don't walk the whole list when we find a busy BO (by anholt, acked by
    Boris)

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/gallium/drivers/vc4/vc4_bufmgr.c
src/gallium/drivers/vc4/vc4_screen.c
src/gallium/drivers/vc4/vc4_screen.h