From: Sourab Gupta <sourab.gupta@xxxxxxxxx> Adding the flag 'I915_CPU_MAP_NOT_NEEDED' to gem_create ioctl. This is to indicate the driver that direct cpu access to this buffer object is not needed and hence Driver can opt to use Stolen area as a backing store for it. When this flag is set, try to allocate the objects from Stolen area. Fallback to shmem in case of allocation failure. Signed-off-by: Sourab Gupta <sourab.gupta@xxxxxxxxx> Signed-off-by: Akash Goel <akash.goel@xxxxxxxxx> --- drivers/gpu/drm/i915/i915_gem.c | 17 ++++++++++++----- include/uapi/drm/i915_drm.h | 3 ++- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 177c207..22b531a 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -225,9 +225,11 @@ static int i915_gem_create(struct drm_file *file, struct drm_device *dev, uint64_t size, - uint32_t *handle_p) + uint32_t *handle_p, + uint32_t flags) + { - struct drm_i915_gem_object *obj; + struct drm_i915_gem_object *obj=NULL; int ret; u32 handle; @@ -236,7 +238,12 @@ i915_gem_create(struct drm_file *file, return -EINVAL; /* Allocate the new object */ - obj = i915_gem_alloc_object(dev, size); + if (flags & I915_CPU_MAP_NOT_NEEDED) + obj = i915_gem_object_create_stolen(dev, size); + + if (obj == NULL) + obj = i915_gem_alloc_object(dev, size); + if (obj == NULL) return -ENOMEM; @@ -259,7 +266,7 @@ i915_gem_dumb_create(struct drm_file *file, args->pitch = ALIGN(args->width * DIV_ROUND_UP(args->bpp, 8), 64); args->size = args->pitch * args->height; return i915_gem_create(file, dev, - args->size, &args->handle); + args->size, &args->handle, args->flags); } /** @@ -272,7 +279,7 @@ i915_gem_create_ioctl(struct drm_device *dev, void *data, struct drm_i915_gem_create *args = data; return i915_gem_create(file, dev, - args->size, &args->handle); + args->size, &args->handle, args->flags); } static inline int diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h index 126bfaa..8625f54 100644 --- a/include/uapi/drm/i915_drm.h +++ b/include/uapi/drm/i915_drm.h @@ -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 { -- 1.7.9.5 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx