[Libva] [PATCH 3/3] extbuf: add support for userptr imports.
Chris Wilson
chris at chris-wilson.co.uk
Thu Apr 2 06:45:37 PDT 2015
On Thu, Apr 02, 2015 at 03:28:20PM +0200, Gwenole Beauchesne wrote:
> +drm_intel_bo *
> +do_import_userptr(struct intel_driver_data *intel, const char *name,
> + void *data, size_t data_size, uint32_t va_flags)
> +{
> +#ifdef HAVE_DRM_INTEL_USERPTR
> + uint32_t page_size, tiling_mode, flags = 0;
> + drm_intel_bo *bo;
> +
> + /* XXX: userptr is only supported for page-aligned allocations */
> + page_size = getpagesize();
> + if ((uintptr_t)data & (page_size - 1))
> + return NULL;
> +
> + tiling_mode = (va_flags & VA_SURFACE_EXTBUF_DESC_ENABLE_TILING) ?
> + I915_TILING_Y : I915_TILING_NONE;
> +
> + flags |= I915_USERPTR_UNSYNCHRONIZED;
Do not ask for unsynchronized userptr on foriegn memory. Consider it a
shotgun you handed to the client whilst wearing a gigantic bullseye, and
in the process of painting that bullseye on everything you can see.
Fortunately it's only available to root.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Libva
mailing list