[Intel-gfx] [PATCH] drm/i915: Implement dma_buf_ops->kmap

Joonas Lahtinen joonas.lahtinen at linux.intel.com
Wed Apr 12 11:39:30 UTC 2017


On pe, 2017-04-07 at 22:36 +0100, Chris Wilson wrote:
> Since kmap allows us to block we can pin the pages and use our normal
> page lookup routine making the implementation simple.
> 
> Testcase: igt/drv_selftest/dmabuf
> Testcase: igt/prime_rw
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

<SNIP>

> +static int igt_dmabuf_export_kmap(void *arg)
> +{
> +	struct drm_i915_private *i915 = arg;
> +	struct drm_i915_gem_object *obj;
> +	struct dma_buf *dmabuf;
> +	void *ptr;
> +	int err;
> +
> +	obj = i915_gem_object_create(i915, 2*PAGE_SIZE);
> +	if (IS_ERR(obj))
> +		return PTR_ERR(obj);
> +
> +	dmabuf = i915_gem_prime_export(&i915->drm, &obj->base, 0);
> +	if (IS_ERR(dmabuf)) {
> +		pr_err("i915_gem_prime_export failed with err=%d\n",
> +		       (int)PTR_ERR(dmabuf));
> +		err = PTR_ERR(dmabuf);

You could hoist this assignment on line up. and just make the pr_err
use err, just saying.

Maybe you could use phases array in this function too.

Reviewed-by: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation


More information about the Intel-gfx mailing list