summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/panfrost/pan_drm.c
diff options
context:
space:
mode:
authorRob Herring <[email protected]>2019-07-31 23:28:37 +0000
committerRob Herring <[email protected]>2019-08-19 19:33:20 -0500
commitd0ec5d38f6cff2e61d9e526423c0a016cc830d14 (patch)
treed51ab040b6dfcf6e4c793a56e83bf61582a12224 /src/gallium/drivers/panfrost/pan_drm.c
parentc45c2d79605b27022975ff1635f9df8f5d01806a (diff)
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 <[email protected]> Reviewed-by: Tomeu Vizoso <[email protected]> Signed-off-by: Rob Herring <[email protected]>
Diffstat (limited to 'src/gallium/drivers/panfrost/pan_drm.c')
-rw-r--r--src/gallium/drivers/panfrost/pan_drm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gallium/drivers/panfrost/pan_drm.c b/src/gallium/drivers/panfrost/pan_drm.c
index 36a6b975680..28a4287202b 100644
--- a/src/gallium/drivers/panfrost/pan_drm.c
+++ b/src/gallium/drivers/panfrost/pan_drm.c
@@ -163,6 +163,8 @@ panfrost_drm_release_bo(struct panfrost_screen *screen, struct panfrost_bo *bo,
/* Rather than freeing the BO now, we'll cache the BO for later
* allocations if we're allowed to */
+ panfrost_drm_munmap_bo(screen, bo);
+
if (cacheable) {
bool cached = panfrost_bo_cache_put(screen, bo);
@@ -172,8 +174,6 @@ panfrost_drm_release_bo(struct panfrost_screen *screen, struct panfrost_bo *bo,
/* Otherwise, if the BO wasn't cached, we'll legitimately free the BO */
- panfrost_drm_munmap_bo(screen, bo);
-
ret = drmIoctl(screen->fd, DRM_IOCTL_GEM_CLOSE, &gem_close);
if (ret) {
fprintf(stderr, "DRM_IOCTL_GEM_CLOSE failed: %m\n");