[Intel-gfx] [PATCH] intel: allow fence register tracking to be disable
Daniel Vetter
daniel.vetter at ffwll.ch
Thu Apr 22 22:48:46 CEST 2010
libdrm just doesn't know enough to do this precisely. Therefore allow
this to be disabled and put the burden on the client where enough
information is available.
Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
intel/intel_bufmgr.h | 1 +
intel/intel_bufmgr_gem.c | 25 ++++++++++++++++++++++++-
2 files changed, 25 insertions(+), 1 deletions(-)
diff --git a/intel/intel_bufmgr.h b/intel/intel_bufmgr.h
index 0984ab0..4e3dd20 100644
--- a/intel/intel_bufmgr.h
+++ b/intel/intel_bufmgr.h
@@ -135,6 +135,7 @@ drm_intel_bo *drm_intel_bo_gem_create_from_name(drm_intel_bufmgr *bufmgr,
unsigned int handle);
void drm_intel_bufmgr_gem_enable_reuse(drm_intel_bufmgr *bufmgr);
void drm_intel_bufmgr_gem_enable_fenced_relocs(drm_intel_bufmgr *bufmgr);
+int drm_intel_bufmgr_gem_disable_fence_accounting(drm_intel_bufmgr *bufmgr);
int drm_intel_gem_bo_map_gtt(drm_intel_bo *bo);
int drm_intel_gem_bo_unmap_gtt(drm_intel_bo *bo);
void drm_intel_gem_bo_start_gtt_access(drm_intel_bo *bo, int write_enable);
diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index a2cf6e6..b7aa2bd 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -101,6 +101,7 @@ typedef struct _drm_intel_bufmgr_gem {
int gen;
char bo_reuse;
char fenced_relocs;
+ char no_fence_accounting;
} drm_intel_bufmgr_gem;
#define DRM_INTEL_RELOC_FENCE (1<<0)
@@ -1737,6 +1738,28 @@ drm_intel_bufmgr_gem_enable_fenced_relocs(drm_intel_bufmgr *bufmgr)
}
/**
+ * Disable the fence checking in drm_intel_gem_bo_get_aperture_space
+ *
+ * The gem buffer manager doesn't know which tiled buffers need fence registers
+ * and which do not. The checking done in get_aperture_space is therefore
+ * necessarily much too pessimistic. Enabling this option allows the client to
+ * check fence register usage on its own.
+ *
+ * Returns 0 if unfenced relocations are not available, i.e. the user has to
+ * reserve a fence for every relocation of a tiled buffer. Returns 1 if unfenced
+ * relocations are available.
+ */
+int drm_intel_bufmgr_gem_disable_fence_accounting(drm_intel_bufmgr *bufmgr)
+{
+ drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *)bufmgr;
+
+ if (bufmgr_gem->fenced_relocs)
+ bufmgr_gem->no_fence_accounting = 1;
+
+ return bufmgr_gem->fenced_relocs;
+}
+
+/**
* Return the additional aperture space required by the tree of buffer objects
* rooted at bo.
*/
@@ -1884,7 +1907,7 @@ drm_intel_gem_check_aperture_space(drm_intel_bo **bo_array, int count)
int total_fences;
/* Check for fence reg constraints if necessary */
- if (bufmgr_gem->available_fences) {
+ if (bufmgr_gem->available_fences && !bufmgr_gem->no_fence_accounting) {
total_fences = drm_intel_gem_total_fences(bo_array, count);
if (total_fences > bufmgr_gem->available_fences)
return -ENOSPC;
--
1.7.0.4
More information about the Intel-gfx
mailing list