i965/drm: Drop drm_bacon_gem_bo_madvise_internal().
authorKenneth Graunke <kenneth@whitecape.org>
Mon, 3 Apr 2017 23:55:06 +0000 (16:55 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 10 Apr 2017 21:32:15 +0000 (14:32 -0700)
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.

Chris says this was added primarly to avoid bo/bo_gem casting,
which was inconvenient.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
src/mesa/drivers/dri/i965/intel_bufmgr_gem.c

index cf84e6269685471a52997183ad86d6077498653c..69eee3d9f5a48098d381a2dab45907d577bda57e 100644 (file)
@@ -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;