New flag to indicate no cpu mapping requirement for buffer object.
cover New flag to indicate no cpu mapping requirement for buffer object.
From: Sourab Gupta <[email protected]>
Added a new libdrm flag and a flag in the gem_create ioctl. This is used to indicate that cpu mapping is not required for the buffer object.
Sourab Gupta (2):
include/drm: Rename the 'pad' field to 'flags' of gem_create ioctl
intel: Added a new flag 'BO_ALLOC_CPU_MAP_NOT_NEEDED' flag in
bo_alloc
include/drm/i915_drm.h | 3 ++- intel/intel_bufmgr.h | 1 + intel/intel_bufmgr_gem.c | 15 ++++++++++++++- 3 files changed, 17 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.9.5
RFC 1/2 include/drm: Rename the 'pad' field to 'flags' of gem_create ioctl
From: Sourab Gupta <[email protected]>
Renamed the 'pad' field to 'flags' of gem_create ioctl. Also, added a new flag I915_CPU_MAP_NOT_NEEDED which can be passed with gem_create ioctl.
--- include/drm/i915_drm.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/drm/i915_drm.h +2 -1
@@ -431,7 +431,8 @@ struct drm_i915_gem_create {* Object handles are nonzero. */ __u32 handle; -__u32 pad; +__u32 flags; +#define I915_CPU_MAP_NOT_NEEDED 0x1 };struct drm_i915_gem_pread {
Signature · 1 line
1.7.9.5
RFC 2/2 intel: Added a new flag 'BO_ALLOC_CPU_MAP_NOT_NEEDED' flag in bo_alloc
In reply to [email protected]From: Sourab Gupta <[email protected]>
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.
--- intel/intel_bufmgr.h | 1 + intel/intel_bufmgr_gem.c | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-)
intel/intel_bufmgr.h +1 -0
@@ -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);
intel/intel_bufmgr_gem.c +14 -1
@@ -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",
Signature · 1 line
1.7.9.5