Re: [PATCH 1/5] igt/gem_mmap_wc: Exercise mmap(wc) interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 17, 2014 at 11:37:19AM +0000, Chris Wilson wrote:
> Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> ---
>  lib/ioctl_wrappers.c   |  81 +++++++++++
>  lib/ioctl_wrappers.h   |   5 +
>  tests/.gitignore       |   1 +
>  tests/Makefile.am      |   2 +
>  tests/Makefile.sources |   1 +
>  tests/gem_mmap_wc.c    | 370 +++++++++++++++++++++++++++++++++++++++++++++++++
>  6 files changed, 460 insertions(+)
>  create mode 100644 tests/gem_mmap_wc.c
> 
> diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
> index f423237..8316f0d 100644
> --- a/lib/ioctl_wrappers.c
> +++ b/lib/ioctl_wrappers.c
> @@ -463,10 +463,91 @@ void *gem_mmap__gtt(int fd, uint32_t handle, int size, int prot)
>  	ptr = mmap64(0, size, prot, MAP_SHARED, fd, mmap_arg.offset);
>  	if (ptr == MAP_FAILED)
>  		ptr = NULL;
> +	else
> +		errno = 0;
>  
>  	return ptr;
>  }
>  
> +struct local_i915_gem_mmap_v2 {
> +	uint32_t handle;
> +	uint32_t pad;
> +	uint64_t offset;
> +	uint64_t size;
> +	uint64_t addr_ptr;
> +	uint64_t flags;
> +#define I915_MMAP_WC 0x1
> +};
> +#define LOCAL_IOCTL_I915_GEM_MMAP_v2 DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP, struct local_i915_gem_mmap_v2)
> +
> +bool gem_mmap__has_wc(int fd)
> +{
> +	static int has_wc = -1;
> +
> +	if (has_wc == -1) {
> +		struct drm_i915_getparam gp;
> +		int val = -1;
> +
> +		has_wc = 0;
> +
> +		memset(&gp, 0, sizeof(gp));
> +		gp.param = 29; /* MMAP_VERSION */
Now 30.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx





[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux