drm/panfrost: Add madvise and shrinker support
authorRob Herring <robh@kernel.org>
Mon, 5 Aug 2019 14:33:58 +0000 (08:33 -0600)
committerRob Herring <robh@kernel.org>
Thu, 8 Aug 2019 21:57:36 +0000 (15:57 -0600)
commit013b6510131568ce4e01856d5360bfdfe9c3632f
tree7c6b481c2a64a7dc2178c82622b0736bf0325084
parent17acb9f35ed736c177f85b8ee711f278e7aff421
drm/panfrost: Add madvise and shrinker support

Add support for madvise and a shrinker similar to other drivers. This
allows userspace to mark BOs which can be freed when there is memory
pressure.

Unlike other implementations, we don't depend on struct_mutex. The
driver maintains a list of BOs which can be freed when the shrinker
is called. Access to the list is serialized with the shrinker_lock.

Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20190805143358.21245-2-robh@kernel.org
drivers/gpu/drm/panfrost/Makefile
drivers/gpu/drm/panfrost/TODO
drivers/gpu/drm/panfrost/panfrost_device.h
drivers/gpu/drm/panfrost/panfrost_drv.c
drivers/gpu/drm/panfrost/panfrost_gem.c
drivers/gpu/drm/panfrost/panfrost_gem.h
drivers/gpu/drm/panfrost/panfrost_gem_shrinker.c [new file with mode: 0644]
include/uapi/drm/panfrost_drm.h