From 07e7589d86624e9c1ca4c38d00cf6886e1445ae2 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 11 May 2010 08:54:06 +0100 Subject: intel: query whether a buffer is reusable. Signed-off-by: Chris Wilson --- intel/intel_bufmgr.c | 7 +++++++ intel/intel_bufmgr.h | 1 + intel/intel_bufmgr_gem.c | 9 +++++++++ intel/intel_bufmgr_priv.h | 7 +++++++ 4 files changed, 24 insertions(+) diff --git a/intel/intel_bufmgr.c b/intel/intel_bufmgr.c index ce21a332..9144fdd4 100644 --- a/intel/intel_bufmgr.c +++ b/intel/intel_bufmgr.c @@ -229,6 +229,13 @@ int drm_intel_bo_disable_reuse(drm_intel_bo *bo) return 0; } +int drm_intel_bo_is_reusable(drm_intel_bo *bo) +{ + if (bo->bufmgr->bo_is_reusable) + return bo->bufmgr->bo_is_reusable(bo); + return 0; +} + int drm_intel_bo_busy(drm_intel_bo *bo) { if (bo->bufmgr->bo_busy) diff --git a/intel/intel_bufmgr.h b/intel/intel_bufmgr.h index 0984ab08..cbcddb65 100644 --- a/intel/intel_bufmgr.h +++ b/intel/intel_bufmgr.h @@ -126,6 +126,7 @@ int drm_intel_bo_busy(drm_intel_bo *bo); int drm_intel_bo_madvise(drm_intel_bo *bo, int madv); int drm_intel_bo_disable_reuse(drm_intel_bo *bo); +int drm_intel_bo_is_reusable(drm_intel_bo *bo); int drm_intel_bo_references(drm_intel_bo *bo, drm_intel_bo *target_bo); /* drm_intel_bufmgr_gem.c */ diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c index 8fa5631d..9daa89ad 100644 --- a/intel/intel_bufmgr_gem.c +++ b/intel/intel_bufmgr_gem.c @@ -1903,6 +1903,14 @@ drm_intel_gem_bo_disable_reuse(drm_intel_bo *bo) return 0; } +static int +drm_intel_gem_bo_is_reusable(drm_intel_bo *bo) +{ + drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo; + + return bo_gem->reusable; +} + static int _drm_intel_gem_bo_references(drm_intel_bo *bo, drm_intel_bo *target_bo) { @@ -2060,6 +2068,7 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size) bufmgr_gem->bufmgr.check_aperture_space = drm_intel_gem_check_aperture_space; bufmgr_gem->bufmgr.bo_disable_reuse = drm_intel_gem_bo_disable_reuse; + bufmgr_gem->bufmgr.bo_is_reusable = drm_intel_gem_bo_is_reusable; bufmgr_gem->bufmgr.get_pipe_from_crtc_id = drm_intel_gem_get_pipe_from_crtc_id; bufmgr_gem->bufmgr.bo_references = drm_intel_gem_bo_references; diff --git a/intel/intel_bufmgr_priv.h b/intel/intel_bufmgr_priv.h index fb84e70f..f987d97a 100644 --- a/intel/intel_bufmgr_priv.h +++ b/intel/intel_bufmgr_priv.h @@ -246,6 +246,13 @@ struct _drm_intel_bufmgr { */ int (*bo_disable_reuse) (drm_intel_bo *bo); + /** + * Query whether a buffer is reusable. + * + * \param bo Buffer to query + */ + int (*bo_is_reusable) (drm_intel_bo *bo); + /** * * Return the pipe associated with a crtc_id so that vblank -- cgit v1.2.3