dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tiago Vignatti <tiago.vignatti@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>,
	dri-devel@lists.freedesktop.org, daniel.thompson@linaro.org,
	daniel.vetter@ffwll.ch, thellstrom@vmware.com,
	jglisse@redhat.com
Subject: Re: [PATCH v6 4/5] drm/i915: Implement end_cpu_access
Date: Fri, 18 Dec 2015 17:02:34 -0200	[thread overview]
Message-ID: <5674584A.6060308@intel.com> (raw)
In-Reply-To: <20151217080142.GE14895@nuc-i3427.alporthouse.com>

On 12/17/2015 06:01 AM, Chris Wilson wrote:
> On Wed, Dec 16, 2015 at 08:25:36PM -0200, Tiago Vignatti wrote:
>> This function is meant to be used with dma-buf mmap, when finishing the CPU
>> access of the mapped pointer.
>>
>> +static void i915_gem_end_cpu_access(struct dma_buf *dma_buf, enum dma_data_direction direction)
>> +{
>> +	struct drm_i915_gem_object *obj = dma_buf_to_obj(dma_buf);
>> +	struct drm_device *dev = obj->base.dev;
>> +	struct drm_i915_private *dev_priv = to_i915(dev);
>> +	bool was_interruptible, write = (direction == DMA_BIDIRECTIONAL || direction == DMA_TO_DEVICE);
>> +	int ret;
>> +
>> +	mutex_lock(&dev->struct_mutex);
>> +	was_interruptible = dev_priv->mm.interruptible;
>> +	dev_priv->mm.interruptible = false;
>> +
>> +	ret = i915_gem_object_set_to_gtt_domain(obj, write);
>
> This only needs to pass .write=false. The dma-buf direction is
> only for the period of the user access, and we are now flushing the
> caches. This is equivalent to the sw-finish ioctl and ideally we just
> want the i915_gem_object_flush_cpu_write_domain().

in fact the only usage so far I found for end_cpu_access is when the 
pinned buffer is scanout out. Should I pretty much copy sw-finish in 
end_cpu_access then?

Thanks,

Tiago

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2015-12-18 19:02 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-16 22:25 Direct userspace dma-buf mmap (v6) Tiago Vignatti
2015-12-16 22:25 ` [PATCH v6 1/5] drm: prime: Honour O_RDWR during prime-handle-to-fd Tiago Vignatti
2015-12-16 22:25 ` [PATCH v6 2/5] dma-buf: Remove range-based flush Tiago Vignatti
2015-12-16 22:25 ` [PATCH v6 3/5] dma-buf: Add ioctls to allow userspace to flush Tiago Vignatti
2015-12-17 18:19   ` Alex Deucher
2015-12-18 18:46     ` Tiago Vignatti
2015-12-17 21:58   ` Thomas Hellstrom
2015-12-18 15:29     ` Daniel Vetter
2015-12-18 19:50     ` Tiago Vignatti
2015-12-21  9:38       ` Thomas Hellstrom
2015-12-16 22:25 ` [PATCH v6 4/5] drm/i915: Implement end_cpu_access Tiago Vignatti
2015-12-17  8:01   ` Chris Wilson
2015-12-18 19:02     ` Tiago Vignatti [this message]
2015-12-18 19:19       ` Tiago Vignatti
2015-12-22 20:51         ` Chris Wilson
2015-12-16 22:25 ` [PATCH v6 5/5] drm/i915: Use CPU mapping for userspace dma-buf mmap() Tiago Vignatti
2015-12-16 22:25 ` [PATCH igt v6 1/6] lib: Add gem_userptr and __gem_userptr helpers Tiago Vignatti
2015-12-16 22:25 ` [PATCH igt v6 2/6] prime_mmap: Add new test for calling mmap() on dma-buf fds Tiago Vignatti
2015-12-16 22:25 ` [PATCH igt v6 3/6] prime_mmap: Add basic tests to write in a bo using CPU Tiago Vignatti
2015-12-16 22:25 ` [PATCH igt v6 4/6] lib: Add prime_sync_start and prime_sync_end helpers Tiago Vignatti
2015-12-17 10:18   ` Daniel Vetter
2015-12-16 22:25 ` [PATCH igt v6 5/6] tests: Add kms_mmap_write_crc for cache coherency tests Tiago Vignatti
2015-12-17  7:53   ` Chris Wilson
2015-12-16 22:25 ` [PATCH igt v6 6/6] tests: Add prime_mmap_coherency " Tiago Vignatti
2015-12-17 10:15 ` Direct userspace dma-buf mmap (v6) Daniel Vetter

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=5674584A.6060308@intel.com \
    --to=tiago.vignatti@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=daniel.thompson@linaro.org \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jglisse@redhat.com \
    --cc=thellstrom@vmware.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