On Thu, Oct 23, 2014 at 04:03:56PM +0530, akash.goel@xxxxxxxxx wrote: > drivers/gpu/drm/i915/i915_dma.c | 3 +++ > drivers/gpu/drm/i915/i915_gem.c | 17 +++++++++++++++++ > include/uapi/drm/i915_drm.h | 4 ++++ > 3 files changed, 24 insertions(+) > > diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c > index 1b39807..2d8191a 100644 > --- a/drivers/gpu/drm/i915/i915_dma.c > +++ b/drivers/gpu/drm/i915/i915_dma.c > @@ -1027,6 +1027,9 @@ static int i915_getparam(struct drm_device *dev, void *data, > case I915_PARAM_CMD_PARSER_VERSION: > value = i915_cmd_parser_get_version(); > break; > + case I915_PARAM_HAS_UC_MMAP: > + value = 1; > + break; > default: > DRM_DEBUG("Unknown parameter %d\n", param->param); > return -EINVAL; > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c > index 1b192d4..16b267b 100644 > --- a/drivers/gpu/drm/i915/i915_gem.c > +++ b/drivers/gpu/drm/i915/i915_gem.c > @@ -1492,6 +1492,23 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data, > addr = vm_mmap(obj->filp, 0, args->size, > PROT_READ | PROT_WRITE, MAP_SHARED, > args->offset); Forgot to mutter about: if (args->flags & INVALID_FLAGS) return -EINVAL; and the param then makes better sense as I915_PARAM_HAS_EXT_MMAP (extended mmap interface, which we can then version) In future we can test for EXT_MMAP support and mmap(RANDOM_FLAG) returning EINVAL for any new extension flags. > + > + if (args->flags & I915_GEM_USE_UNCACHED_MMAP) { > + struct mm_struct *mm = current->mm; > + struct vm_area_struct *vma; > + down_write(&mm->mmap_sem); > + vma = find_vma(mm, addr); > + if (!vma) { > + drm_gem_object_unreference_unlocked(obj); > + return -EINVAL; > + } > + /* Change the page attribute to uncached (along with > + * write-combinning to get better performance) */ > + vma->vm_page_prot = > + pgprot_writecombine(vm_get_page_prot(vma->vm_flags)); > + up_write(&mm->mmap_sem); > + } > + > drm_gem_object_unreference_unlocked(obj); > if (IS_ERR((void *)addr)) > return addr; > diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h > index ff57f07..3d0b1c0 100644 > --- a/include/uapi/drm/i915_drm.h > +++ b/include/uapi/drm/i915_drm.h > @@ -340,6 +340,7 @@ typedef struct drm_i915_irq_wait { > #define I915_PARAM_HAS_EXEC_HANDLE_LUT 26 > #define I915_PARAM_HAS_WT 27 > #define I915_PARAM_CMD_PARSER_VERSION 28 > +#define I915_PARAM_HAS_UC_MMAP 29 > > typedef struct drm_i915_getparam { > int param; > @@ -487,6 +488,9 @@ struct drm_i915_gem_mmap { > * This is a fixed-size type for 32/64 compatibility. > */ > __u64 addr_ptr; > + > +#define I915_GEM_USE_UNCACHED_MMAP (1<<0) #define I915_MMAP_WC is shorter -Chris -- Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx