From: sourab.gupta@intel.com Subject: [RFC 2/2] intel: Added a new flag 'BO_ALLOC_CPU_MAP_NOT_NEEDED' flag in bo_alloc Date: Wed, 5 Mar 2014 17:03:19 +0530 Message-ID: <1394019199-8723-3-git-send-email-sourab.gupta@intel.com> References: <1394019199-8723-1-git-send-email-sourab.gupta@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id 0B91FFA549 for ; Wed, 5 Mar 2014 03:32:54 -0800 (PST) In-Reply-To: <1394019199-8723-1-git-send-email-sourab.gupta@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org To: intel-gfx@lists.freedesktop.org Cc: "Cc: Daniel Vetter" , Sourab Gupta , "Cc: Jesse Barnes" , "Cc: Chris Wilson" List-Id: intel-gfx@lists.freedesktop.org From: Sourab Gupta 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 --- 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