[Mesa-dev] [PATCH 11/51] i965: Wrap drm_intel_bo_madvise() for brw_bo

Chris Wilson chris at chris-wilson.co.uk
Tue Jan 10 21:23:34 UTC 2017


To reduce later churn, extract drm_intel_bo_madvise() with a smaller
wrapper.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 src/mesa/drivers/dri/i965/brw_batch.h            | 5 +++++
 src/mesa/drivers/dri/i965/brw_object_purgeable.c | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_batch.h b/src/mesa/drivers/dri/i965/brw_batch.h
index d4898a592c..043a87cf15 100644
--- a/src/mesa/drivers/dri/i965/brw_batch.h
+++ b/src/mesa/drivers/dri/i965/brw_batch.h
@@ -79,6 +79,11 @@ inline static void brw_bo_put(brw_bo *bo)
       drm_intel_bo_unreference(bo);
 }
 
+inline static int brw_bo_madvise(brw_bo *bo, int state)
+{
+   return drm_intel_bo_madvise(bo, state);
+}
+
 inline static uint32_t brw_bo_flink(brw_bo *bo)
 {
    uint32_t name = 0;
diff --git a/src/mesa/drivers/dri/i965/brw_object_purgeable.c b/src/mesa/drivers/dri/i965/brw_object_purgeable.c
index 08d4cfccaa..e59e63ec82 100644
--- a/src/mesa/drivers/dri/i965/brw_object_purgeable.c
+++ b/src/mesa/drivers/dri/i965/brw_object_purgeable.c
@@ -43,7 +43,7 @@ intel_buffer_purgeable(brw_bo *buffer)
    int retained = 0;
 
    if (buffer != NULL)
-      retained = drm_intel_bo_madvise(buffer, I915_MADV_DONTNEED);
+      retained = brw_bo_madvise(buffer, I915_MADV_DONTNEED);
 
    return retained ? GL_VOLATILE_APPLE : GL_RELEASED_APPLE;
 }
@@ -107,7 +107,7 @@ intel_bo_unpurgeable(brw_bo *buffer)
 
    retained = 0;
    if (buffer != NULL)
-      retained = drm_intel_bo_madvise(buffer, I915_MADV_WILLNEED);
+      retained = brw_bo_madvise(buffer, I915_MADV_WILLNEED);
 
    return retained;
 }
-- 
2.11.0



More information about the mesa-dev mailing list