[Mesa-dev] [PATCH 43/53] i965/drm: Drop drm_bacon_gem_bo_madvise_internal().

Kenneth Graunke kenneth at whitecape.org
Wed Apr 5 00:10:33 UTC 2017


The only difference is that it takes an explicit bufmgr rather than
using bo->bufmgr, but there is only one bufmgr per screen so they
should be identical anyway.
---
 src/mesa/drivers/dri/i965/intel_bufmgr_gem.c | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_bufmgr_gem.c b/src/mesa/drivers/dri/i965/intel_bufmgr_gem.c
index a1cb8079822..0adddd6d08b 100644
--- a/src/mesa/drivers/dri/i965/intel_bufmgr_gem.c
+++ b/src/mesa/drivers/dri/i965/intel_bufmgr_gem.c
@@ -226,9 +226,8 @@ drm_bacon_bo_busy(drm_bacon_bo *bo)
 	return (ret == 0 && busy.busy);
 }
 
-static int
-drm_bacon_gem_bo_madvise_internal(drm_bacon_bufmgr *bufmgr,
-				  drm_bacon_bo *bo, int state)
+int
+drm_bacon_bo_madvise(drm_bacon_bo *bo, int state)
 {
 	struct drm_i915_gem_madvise madv;
 
@@ -236,17 +235,11 @@ drm_bacon_gem_bo_madvise_internal(drm_bacon_bufmgr *bufmgr,
 	madv.handle = bo->gem_handle;
 	madv.madv = state;
 	madv.retained = 1;
-	drmIoctl(bufmgr->fd, DRM_IOCTL_I915_GEM_MADVISE, &madv);
+	drmIoctl(bo->bufmgr->fd, DRM_IOCTL_I915_GEM_MADVISE, &madv);
 
 	return madv.retained;
 }
 
-int
-drm_bacon_bo_madvise(drm_bacon_bo *bo, int madv)
-{
-	return drm_bacon_gem_bo_madvise_internal(bo->bufmgr, bo, madv);
-}
-
 /* drop the oldest entries that have been purged by the kernel */
 static void
 drm_bacon_gem_bo_cache_purge_bucket(drm_bacon_bufmgr *bufmgr,
@@ -256,8 +249,7 @@ drm_bacon_gem_bo_cache_purge_bucket(drm_bacon_bufmgr *bufmgr,
 		drm_bacon_bo *bo;
 
 		bo = LIST_ENTRY(drm_bacon_bo, bucket->head.next, head);
-		if (drm_bacon_gem_bo_madvise_internal
-		    (bufmgr, bo, I915_MADV_DONTNEED))
+		if (drm_bacon_bo_madvise(bo, I915_MADV_DONTNEED))
 			break;
 
 		list_del(&bo->head);
@@ -330,8 +322,7 @@ retry:
 		}
 
 		if (alloc_from_cache) {
-			if (!drm_bacon_gem_bo_madvise_internal
-			    (bufmgr, bo, I915_MADV_WILLNEED)) {
+			if (!drm_bacon_bo_madvise(bo, I915_MADV_WILLNEED)) {
 				drm_bacon_gem_bo_free(bo);
 				drm_bacon_gem_bo_cache_purge_bucket(bufmgr,
 								    bucket);
@@ -743,8 +734,7 @@ drm_bacon_gem_bo_unreference_final(drm_bacon_bo *bo, time_t time)
 	bucket = drm_bacon_gem_bo_bucket_for_size(bufmgr, bo->size);
 	/* Put the buffer into our internal cache for reuse if we can. */
 	if (bufmgr->bo_reuse && bo->reusable && bucket != NULL &&
-	    drm_bacon_gem_bo_madvise_internal(bufmgr, bo,
-					      I915_MADV_DONTNEED)) {
+	    drm_bacon_bo_madvise(bo, I915_MADV_DONTNEED)) {
 		bo->free_time = time;
 
 		bo->name = NULL;
-- 
2.12.1



More information about the mesa-dev mailing list