intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: intel-gfx@lists.freedesktop.org, akash.goel@intel.com,
	shashidhar.hiremath@intel.com
Subject: Re: [PATCH 4/4] drm/i915: Support for pread/pwrite from/to non shmem backed objects
Date: Tue, 15 Sep 2015 16:05:05 +0530	[thread overview]
Message-ID: <1442313305.26385.41.camel@ankitprasad-desktop> (raw)
In-Reply-To: <20150915095452.GC6442@nuc-i3427.alporthouse.com>

On Tue, 2015-09-15 at 10:54 +0100, Chris Wilson wrote:
> On Tue, Sep 15, 2015 at 02:03:27PM +0530, ankitprasad.r.sharma@intel.com wrote:
> > @@ -1090,17 +1184,17 @@ 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) {
> > +		ret = i915_gem_gtt_pread_pwrite(dev, obj, args->size,
> > +						args->offset, args->data_ptr,
> > +						true);
> > +		goto out;
> > +	}
> 
> There already exists a GTT write path, along with a more correct
> description of its limitations.

Then it would look something like this, making i915_gem_gtt_pwrite_fast
to handle pagefaults for non-shmem backed objects

@@ -831,10 +925,16 @@ i915_gem_gtt_pwrite_fast(struct drm_device *dev,
                 * retry in the slow path.
                 */
-         if (fast_user_write(dev_priv->gtt.mappable, page_base,
+            if (obj->base.filp &&
+                 fast_user_write(dev_priv->gtt.mappable, page_base,
                                 page_offset, user_data, page_length)) {
                        ret = -EFAULT;
                        goto out_flush;
+            } else if (slow_user_access(dev_priv->gtt.mappable,
+                                        page_base, page_offset,
+                                       user_data, page_length, true)) {
+                       ret = -EFAULT;
+                       goto out_flush;
             }
 
Thanks
-Ankit


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

  reply	other threads:[~2015-09-15 10:52 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-15  8:33 [PATCH v6 0/4] Support for creating/using Stolen memory backed objects ankitprasad.r.sharma
2015-09-15  8:33 ` [PATCH 1/4] drm/i915: Clearing buffer objects via CPU/GTT ankitprasad.r.sharma
2015-09-15 14:00   ` Tvrtko Ursulin
2015-09-15  8:33 ` [PATCH 2/4] drm/i915: Support for creating Stolen memory backed objects ankitprasad.r.sharma
2015-09-15  9:49   ` Chris Wilson
2015-09-20 14:07     ` Ankitprasad Sharma
2015-09-23  9:26       ` Daniel Vetter
2015-09-15 14:11   ` Tvrtko Ursulin
2015-09-15  8:33 ` [PATCH 3/4] drm/i915: Add support for stealing purgable stolen pages ankitprasad.r.sharma
2015-09-15  9:37   ` Chris Wilson
2015-09-15 15:14   ` Tvrtko Ursulin
2015-09-16  9:01     ` Ankitprasad Sharma
2015-09-23  9:28       ` Daniel Vetter
2015-09-23  9:30         ` Tvrtko Ursulin
2015-09-23 12:12           ` Daniel Vetter
2015-09-15  8:33 ` [PATCH 4/4] drm/i915: Support for pread/pwrite from/to non shmem backed objects ankitprasad.r.sharma
2015-09-15  9:54   ` Chris Wilson
2015-09-15 10:35     ` Ankitprasad Sharma [this message]
2015-09-23 14:35 ` [PATCH v6 0/4] Support for creating/using Stolen memory " Chris Wilson
2015-09-30 10:35   ` Ankitprasad Sharma
  -- strict thread matches above, loose matches on Subject: below --
2015-07-22 13:51 [PATCH v5 " ankitprasad.r.sharma
2015-07-22 13:51 ` [PATCH 4/4] drm/i915: Support for pread/pwrite from/to non shmem " ankitprasad.r.sharma
2015-07-22 14:39   ` Chris Wilson
2015-07-31 13:16     ` Goel, Akash
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
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=1442313305.26385.41.camel@ankitprasad-desktop \
    --to=ankitprasad.r.sharma@intel.com \
    --cc=akash.goel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).