Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
To: "Goel, Akash" <akash.goel@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: Thu, 10 Sep 2015 23:20:51 +0530	[thread overview]
Message-ID: <1441907451.26385.34.camel@ankitprasad-desktop> (raw)
In-Reply-To: <55BB7524.4000906@intel.com>

On Fri, 2015-07-31 at 18:46 +0530, Goel, Akash wrote:
> 
> 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) ??

Even if we reuse the gtt_pwrite_fast we will have to handle page-faults
for non-shmem backed objects, that will contradict the purpose of
gtt_pwrite_fast. The gtt_pread_pwrite will still be around for pread
purpose.

Also, I think it should be ok to relax the tiling constraint as well, as
we put_fence everytime we try to pread/pwrite from/to a non-shmem-backed
object here.

Thanks,
Ankit

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-09-10 18:08 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
2015-09-10 17:50       ` Ankitprasad Sharma [this message]
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=1441907451.26385.34.camel@ankitprasad-desktop \
    --to=ankitprasad.r.sharma@intel.com \
    --cc=akash.goel@intel.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox