public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: pwrite/pread do not require obj->base.filp, just pages
Date: Mon, 13 Jun 2016 14:12:46 +0100	[thread overview]
Message-ID: <575EB14E.2030002@linux.intel.com> (raw)
In-Reply-To: <20160613125243.GE8446@nuc-i3427.alporthouse.com>


On 13/06/16 13:52, Chris Wilson wrote:
> On Mon, Jun 13, 2016 at 01:45:56PM +0100, Tvrtko Ursulin wrote:
>>
>> On 13/06/16 13:40, Chris Wilson wrote:
>>> The idea behind relaxing the restriction for pread/pwrite was to handle
>>> !obj->base.flip, i.e. non-shmemfs backed objects, which only requires
>>> that the object provide struct pages.
>>>
>>> v2: Remove excess (). Note enough editing after copy'n'paste.
>>>
>>> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
>>> Cc: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
>>> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>> ---
>>>   drivers/gpu/drm/i915/i915_gem.c | 7 ++++---
>>>   1 file changed, 4 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
>>> index 21d0dea57312..6f950c37efab 100644
>>> --- a/drivers/gpu/drm/i915/i915_gem.c
>>> +++ b/drivers/gpu/drm/i915/i915_gem.c
>>> @@ -760,7 +760,7 @@ i915_gem_shmem_pread(struct drm_device *dev,
>>>   	int needs_clflush = 0;
>>>   	struct sg_page_iter sg_iter;
>>>
>>> -	if (!obj->base.filp)
>>> +	if ((obj->ops->flags & I915_GEM_OBJECT_HAS_STRUCT_PAGE) == 0)
>>>   		return -ENODEV;
>>>
>>>   	user_data = u64_to_user_ptr(args->data_ptr);
>>> @@ -1298,7 +1298,8 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
>>>   	 * pread/pwrite currently are reading and writing from the CPU
>>>   	 * perspective, requiring manual detiling by the client.
>>>   	 */
>>> -	if (!obj->base.filp || cpu_write_needs_clflush(obj)) {
>>> +	if ((obj->ops->flags & I915_GEM_OBJECT_HAS_STRUCT_PAGE) == 0 ||
>>> +	    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
>>> @@ -1308,7 +1309,7 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
>>>   	if (ret == -EFAULT) {
>>>   		if (obj->phys_handle)
>>>   			ret = i915_gem_phys_pwrite(obj, args, file);
>>> -		else if (obj->base.filp)
>>> +		else if (obj->ops->flags & I915_GEM_OBJECT_HAS_STRUCT_PAGE)
>>>   			ret = i915_gem_shmem_pwrite(dev, obj, args, file);
>>>   		else
>>>   			ret = -ENODEV;
>>>
>>
>> To enable on userptr or there is more to it? Would it even make more
>> sense to keep rejecting it on userptr to discourage suboptimal
>> userspace?
>
> And prime objects, and everything in future not backed by a filp.

Hmm.. I sense a hole in the IGT coverage. :)

You definitely do not mind allowing it with userptr?

Actually, we don't need to go through the aperture for anything but 
stolen, right? A third, more optimal path could be added for page backed 
objects which are not shmem, not userptr and not stolen.

Regards,

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

  reply	other threads:[~2016-06-13 13:12 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-10  8:52 [PATCH 1/5] drm/i915: Add support for mapping an object page by page ankitprasad.r.sharma
2016-06-10  8:53 ` [PATCH 2/5] drm/i915: Introduce i915_gem_object_get_dma_address() ankitprasad.r.sharma
2016-06-10  8:53 ` [PATCH 3/5] drm/i915: Use insert_page for pwrite_fast ankitprasad.r.sharma
2016-06-10  8:53 ` [PATCH 4/5] drm/i915: Clearing buffer objects via CPU/GTT ankitprasad.r.sharma
2016-06-10  8:53 ` [PATCH 5/5] drm/i915: Support for pread/pwrite from/to non shmem backed objects ankitprasad.r.sharma
2016-06-10  9:40 ` ✗ Ro.CI.BAT: failure for series starting with [1/5] drm/i915: Add support for mapping an object page by page Patchwork
2016-06-10 12:49   ` Tvrtko Ursulin
2016-06-10 12:56     ` Chris Wilson
2016-06-13  9:05       ` Tvrtko Ursulin
2016-06-13 12:36         ` [PATCH] drm/i915: pwrite/pread do not require obj->base.filp, just pages Chris Wilson
2016-06-13 12:40         ` Chris Wilson
2016-06-13 12:45           ` Tvrtko Ursulin
2016-06-13 12:52             ` Chris Wilson
2016-06-13 13:12               ` Tvrtko Ursulin [this message]
2016-06-13 13:30                 ` Chris Wilson
2016-06-13 12:38 ` ✗ Ro.CI.BAT: failure for series starting with drm/i915: pwrite/pread do not require obj->base.filp, just pages (rev2) Patchwork
2016-06-13 13:05 ` ✗ Ro.CI.BAT: failure for series starting with drm/i915: pwrite/pread do not require obj->base.filp, just pages (rev3) Patchwork

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=575EB14E.2030002@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /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