[Mesa-dev] [PATCH 15/70] i965: Wrap drm_intel_bo_madvise() for brw_bo

Chris Wilson chris at chris-wilson.co.uk
Fri Aug 7 13:13:19 PDT 2015


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 31f39b4..1d0f0dd 100644
--- a/src/mesa/drivers/dri/i965/brw_batch.h
+++ b/src/mesa/drivers/dri/i965/brw_batch.h
@@ -78,6 +78,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 8d7ebdb..bb588cd 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_buffer_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 ? GL_RETAINED_APPLE : GL_UNDEFINED_APPLE;
 }
-- 
2.5.0



More information about the mesa-dev mailing list