On ma, 2017-03-06 at 09:29 +0000, Chris Wilson wrote:
> Before we instantiate/pin the backing store for our use, we
> can prepopulate the shmemfs filp efficiently using the a
> write into the pagecache. We avoid the penalty of instantiating
> all the pages, important if the user is just writing to a few
> and never uses the object on the GPU, and using a direct write
> into shmemfs allows it to avoid the cost of retrieving a page
> (either swapin or clearing-before-use) before it is overwritten.
> 
> This can be extended later to provide additional specialisation for
> other backends (other than shmemfs).
> 
> References: https://bugs.freedesktop.org/show_bug.cgi?id=99107
> Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>
> Cc: Matthew Auld <matthew.william.a...@gmail.com>
> Cc: Joonas Lahtinen <joonas.lahti...@linux.intel.com>
> Cc: Mika Kuoppala <mika.kuopp...@linux.intel.com>

<SNIP>

> +static int
> +i915_gem_object_pwrite_gtt(struct drm_i915_gem_object *obj,
> +                        const struct drm_i915_gem_pwrite *arg)
> +{
> +     struct address_space *mapping = obj->base.filp->f_mapping;
> +     char __user *user_data = u64_to_user_ptr(arg->data_ptr);
> +     u64 remain, offset;
> +     unsigned int pg;
> +
> +     /* Before we instantiate/pin the backing store for our use, we
> +      * can prepopulate the shmemfs filp efficiently using the a
> +      * write into the pagecache. We avoid the penalty of instantiating
> +      * all the pages, important if the user is just writing to a few
> +      * and never uses the object on the GPU, and using a direct write
> +      * into shmemfs allows it to avoid the cost of retrieving a page
> +      * (either swapin or clearing-before-use) before it is overwritten.
> +      */
> +     if (READ_ONCE(obj->mm.pages))
> +             return -ENODEV;
> +
> +     /* Before the pages are instantioted the object is treated as being

*instantiated

<SNIP>

> +             err = pagecache_write_end(obj->base.filp, mapping, offset,
> +                                       len, len - unwritten,
> +                                       page, data);

Did you deliberately make the arguments different from write_begin? :)

If this solves a problem;

Reviewed-by: Joonas Lahtinen <joonas.lahti...@linux.intel.com>

But should we instead fix libva?

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to