[Intel-gfx] [RFC 2/2] intel: Added a new flag 'BO_ALLOC_CPU_MAP_NOT_NEEDED' flag in bo_alloc
sourab.gupta at intel.com
sourab.gupta at intel.com
Wed Mar 5 12:33:19 CET 2014
From: Sourab Gupta <sourab.gupta at intel.com>
Added a new flag 'BO_ALLOC_CPU_MAP_NOT_NEEDED' flag which can be passed
to bo_alloc_tiled function. This is used to indicate that cpu mapping is
not required for the buffer object. This info will be passed to driver
in the gem_create ioctl.
Signed-off-by: Sourab Gupta <sourab.gupta at intel.com>
---
intel/intel_bufmgr.h | 1 +
intel/intel_bufmgr_gem.c | 15 ++++++++++++++-
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/intel/intel_bufmgr.h b/intel/intel_bufmgr.h
index 9383c72..3856a94 100644
--- a/intel/intel_bufmgr.h
+++ b/intel/intel_bufmgr.h
@@ -106,6 +106,7 @@ typedef struct _drm_intel_aub_annotation {
} drm_intel_aub_annotation;
#define BO_ALLOC_FOR_RENDER (1<<0)
+#define BO_ALLOC_CPU_MAP_NOT_NEEDED (1<<1)
drm_intel_bo *drm_intel_bo_alloc(drm_intel_bufmgr *bufmgr, const char *name,
unsigned long size, unsigned int alignment);
diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index 007a6d8..176047a 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -658,6 +658,10 @@ drm_intel_gem_bo_alloc_internal(drm_intel_bufmgr *bufmgr,
/* Round the allocated size up to a power of two number of pages. */
bucket = drm_intel_gem_bo_bucket_for_size(bufmgr_gem, size);
+ /* Avoid this object's allocation from regular B0 cache */
+ if(flags & BO_ALLOC_CPU_MAP_NOT_NEEDED)
+ bucket = NULL;
+
/* If we don't have caching at this size, don't actually round the
* allocation up.
*/
@@ -730,6 +734,11 @@ retry:
VG_CLEAR(create);
create.size = bo_size;
+ if(flags & BO_ALLOC_CPU_MAP_NOT_NEEDED)
+ create.flags = I915_CPU_MAP_NOT_NEEDED;
+ else
+ create.flags =0;
+
ret = drmIoctl(bufmgr_gem->fd,
DRM_IOCTL_I915_GEM_CREATE,
&create);
@@ -762,10 +771,14 @@ retry:
bo_gem->reloc_tree_fences = 0;
bo_gem->used_as_reloc_target = false;
bo_gem->has_error = false;
- bo_gem->reusable = true;
bo_gem->aub_annotations = NULL;
bo_gem->aub_annotation_count = 0;
+ if(flags & BO_ALLOC_CPU_MAP_NOT_NEEDED)
+ bo_gem->reusable = false;
+ else
+ bo_gem->reusable = true;
+
drm_intel_bo_gem_set_in_aperture_size(bufmgr_gem, bo_gem);
DBG("bo_create: buf %d (%s) %ldb\n",
--
1.7.9.5
More information about the Intel-gfx
mailing list