From: "Goel, Akash" <akash.goel@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, ankitprasad.r.sharma@intel.com
Cc: "intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>,
shashidhar.hiremath@intel.com
Subject: Re: [PATCH 4/4] drm/i915: Support for pread/pwrite from/to non shmem backed objects
Date: Fri, 31 Jul 2015 18:46:20 +0530 [thread overview]
Message-ID: <55BB7524.4000906@intel.com> (raw)
In-Reply-To: <20150722143915.GO6166@nuc-i3427.alporthouse.com>
On 7/22/2015 8:09 PM, Chris Wilson wrote:
> On Wed, Jul 22, 2015 at 07:21:49PM +0530, ankitprasad.r.sharma@intel.com wrote:
>> static int
>> i915_gem_shmem_pread(struct drm_device *dev,
>> struct drm_i915_gem_object *obj,
>> @@ -754,17 +850,20 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data,
>> goto out;
>> }
>>
>> - /* prime objects have no backing filp to GEM pread/pwrite
>> - * pages from.
>> - */
>> - if (!obj->base.filp) {
>> - ret = -EINVAL;
>> - goto out;
>> - }
>> -
>> trace_i915_gem_object_pread(obj, args->offset, args->size);
>>
>> - ret = i915_gem_shmem_pread(dev, obj, args, file);
>> + /* pread for non shmem backed objects */
>> + if (!obj->base.filp) {
>> + if (obj->tiling_mode == I915_TILING_NONE)
>
> pread/pwrite is defined as a cpu linear, the restriction upon tiling is
> a simplification of handling swizzling.
>
>> + ret = i915_gem_gtt_pread_pwrite(dev, obj, args->size,
>> + args->offset,
>> + args->data_ptr,
>> + false);
>> + else
>> + ret = -EINVAL;
>> + } else {
>> + ret = i915_gem_shmem_pread(dev, obj, args, file);
>> + }
>>
>> out:
>> drm_gem_object_unreference(&obj->base);
>> @@ -1105,17 +1204,22 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
>> goto out;
>> }
>>
>> - /* prime objects have no backing filp to GEM pread/pwrite
>> - * pages from.
>> - */
>> - if (!obj->base.filp) {
>> - ret = -EINVAL;
>> - goto out;
>> - }
>> -
>> trace_i915_gem_object_pwrite(obj, args->offset, args->size);
>>
>> ret = -EFAULT;
>> +
>> + /* pwrite for non shmem backed objects */
>> + if (!obj->base.filp) {
>> + if (obj->tiling_mode == I915_TILING_NONE)
>> + ret = i915_gem_gtt_pread_pwrite(dev, obj, args->size,
>> + args->offset,
>> + args->data_ptr,
>> + true);
>> + else
>> + ret = -EINVAL;
>> +
>> + goto out;
>
> The fast pwrite code always works for obj->base.filp == NULL. To easily
> make it generic and handle the cases where we cannot fallback to shem,
> undo the PIN_NONBLOCK.
>
> Then you just want something like
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index d3016f37cd4d..f2284a27dd6d 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -1114,8 +1114,9 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
> * perspective, requiring manual detiling by the client.
> */
> if (obj->tiling_mode == I915_TILING_NONE &&
Since the suggestion is to reuse the gtt_pwrite_fast function only for
non-shmem backed objects, can we also relax the Tiling constraint here,
apart from removing the PIN_NONBLOCK flag. As anyways there is a
put_fence already being done in gtt_pwrite_fast function.
Also currently the gtt_pwrite_fast function is non-tolerant to faults,
incurred while accessing the User space buffer, so can that also be
relaxed (at least for the non-shmem backed objects) ??
Best regards
Akash
> - obj->base.write_domain != I915_GEM_DOMAIN_CPU &&
> - cpu_write_needs_clflush(obj)) {
> + (obj->base.filp == NULL ||
> + (obj->base.write_domain != I915_GEM_DOMAIN_CPU &&
> + cpu_write_needs_clflush(obj)))) {
> ret = i915_gem_gtt_pwrite_fast(dev_priv, obj, args, file);
> /* Note that the gtt paths might fail with non-page-backed user
> * pointers (e.g. gtt mappings when moving data between
> @@ -1125,7 +1126,7 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
> if (ret == -EFAULT || ret == -ENOSPC) {
> if (obj->phys_handle)
> ret = i915_gem_phys_pwrite(obj, args, file);
> - else
> + else if (obj->filp)
> ret = i915_gem_shmem_pwrite(dev, obj, args, file);
> }
>
>
> to enable pwrite access to stolen.
> -Chris
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-07-31 13:16 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-22 13:51 [PATCH v5 0/4] Support for creating/using Stolen memory backed objects ankitprasad.r.sharma
2015-07-22 13:51 ` [PATCH 1/4] drm/i915: Clearing buffer objects via CPU/GTT ankitprasad.r.sharma
2015-07-22 15:01 ` Tvrtko Ursulin
2015-07-22 15:05 ` Chris Wilson
2015-07-22 15:06 ` Chris Wilson
2015-07-22 15:16 ` Tvrtko Ursulin
2015-07-22 15:23 ` Chris Wilson
2015-07-22 13:51 ` [PATCH 2/4] drm/i915: Support for creating Stolen memory backed objects ankitprasad.r.sharma
2015-07-22 15:14 ` Tvrtko Ursulin
2015-07-22 15:27 ` Chris Wilson
2015-07-22 13:51 ` [PATCH 3/4] drm/i915: Add support for stealing purgable stolen pages ankitprasad.r.sharma
2015-07-22 15:10 ` Chris Wilson
2015-07-27 9:38 ` Daniel Vetter
2015-07-29 12:04 ` Chris Wilson
2015-07-31 14:42 ` Goel, Akash
2015-07-31 15:06 ` Chris Wilson
2015-07-31 16:34 ` Goel, Akash
2015-07-31 14:24 ` Goel, Akash
2015-07-22 13:51 ` [PATCH 4/4] drm/i915: Support for pread/pwrite from/to non shmem backed objects ankitprasad.r.sharma
2015-07-22 14:39 ` Chris Wilson
2015-07-31 13:16 ` Goel, Akash [this message]
2015-09-10 17:50 ` Ankitprasad Sharma
2015-09-15 9:58 ` Chris Wilson
2015-07-22 15:46 ` Tvrtko Ursulin
2015-07-22 16:05 ` Daniel Vetter
2015-07-22 16:17 ` Tvrtko Ursulin
-- strict thread matches above, loose matches on Subject: below --
2015-09-15 8:33 [PATCH v6 0/4] Support for creating/using Stolen memory " ankitprasad.r.sharma
2015-09-15 8:33 ` [PATCH 4/4] drm/i915: Support for pread/pwrite from/to non shmem " ankitprasad.r.sharma
2015-09-15 9:54 ` Chris Wilson
2015-09-15 10:35 ` Ankitprasad Sharma
2015-07-01 9:25 [PATCH v4 0/4] Support for creating/using Stolen memory " ankitprasad.r.sharma
2015-07-01 9:25 ` [PATCH 4/4] drm/i915: Support for pread/pwrite from/to non shmem " ankitprasad.r.sharma
2015-07-01 9:54 ` Chris Wilson
2015-07-02 10:42 ` Tvrtko Ursulin
2015-07-02 11:00 ` Chris Wilson
2015-07-02 11:27 ` Tvrtko Ursulin
2015-07-02 11:58 ` Chris Wilson
2015-07-03 5:07 ` shuang.he
2015-05-06 10:15 [PATCH v3 0/4] Support for creating/using Stolen memory " ankitprasad.r.sharma
2015-05-06 10:16 ` [PATCH 4/4] drm/i915: Support for pread/pwrite from/to non shmem " ankitprasad.r.sharma
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55BB7524.4000906@intel.com \
--to=akash.goel@intel.com \
--cc=ankitprasad.r.sharma@intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
--cc=shashidhar.hiremath@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.