All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Hellstrom <thellstrom@vmware.com>
To: Rob Clark <robdclark@gmail.com>
Cc: "linaro-mm-sig@lists.linaro.org" <linaro-mm-sig@lists.linaro.org>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	Thomas Hellstrom <thellstrom@vmware.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>
Subject: Re: dma-buf non-coherent mmap
Date: Thu, 31 Oct 2013 22:38:30 +0100	[thread overview]
Message-ID: <5272CDD6.3060809@vmware.com> (raw)
In-Reply-To: <CAF6AEGuLggBayKZ53rFPjyq=w72R6-XoYdVQ03sP02vBq=_KXQ@mail.gmail.com>

On 10/31/2013 10:10 PM, Rob Clark wrote:
> On Thu, Oct 31, 2013 at 4:40 PM, Thomas Hellstrom <thellstrom@vmware.com> wrote:
>> On 10/31/2013 06:52 PM, Rob Clark wrote:
>>> On Thu, Oct 31, 2013 at 1:00 PM, Thomas Hellstrom <thellstrom@vmware.com>
>>> wrote:
>>>> Hi!
>>>>
>>>> I'm just looking over what's needed to implement drm Prime / dma-buf
>>>> exports
>>>> + imports in the vmwgfx driver. It seems like most dma-bufs ops are quite
>>>> straightforward to implement except user-space mmap().
>>>>
>>>> The reason being that vmwgfx dma-bufs will be using completely
>>>> non-coherent
>>>> memory, whenever there needs to be CPU accesses.
>>>>
>>>> The accelerated contents resides in an opaque structure on the device
>>>> into
>>>> which we can DMA to and from, so for mmap to work we need to zap ptes and
>>>> DMA to the device when doing something accelerated, and on the first
>>>> page-fault DMA data back and wait for idle if the device did a write to
>>>> the
>>>> dma-buf.
>>>>
>>>> Now this shouldn't really be a problem if dma-bufs were only used for
>>>> cross-device sharing, but since people apparently want to use dma-buf
>>>> file
>>>> handles to share CPU data between processes it really becomes a serious
>>>> problem.
>>>>
>>>> Needless to say we'd want to limit the size of the DMAs, and have mmap
>>>> users
>>>> request regions for read, and mark regions dirty for write, something
>>>> similar to gallium's texture transfer objects.
>>>>
>>>> Any ideas?
>>> well, I think vmwgfx is part of the reason we decided mmap would be
>>> optional for dmabuf.  So perhaps it is an option to simply ignore
>>> mmap?
>>>
>>> BR,
>>> -R
>>
>> Well, I'd be happy to avoid mmap, but then what does optional mean in this
>> context?
>> That all generic user-space apps *must* implement a workaround if mmap isn't
>> implemented?
> well, mmap was mostly just added because it was needed by android for
> ION on dmabuf.
>
> I think it is an option to just not use dmabuf mmap in a linux
> userspace.  I mean, we could also define some ioctls to give us pwrite
> and other similar sort of functionality if it is needed.

I think that if direct user-space cpu-access to dma-buf is ever needed 
by linux,
something like that is a better option. Best IMHO would be to avoid 
user-space
cpu-access completely.

Regards,
/Thomas


>
> BR,
> -R
>

  reply	other threads:[~2013-10-31 21:38 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-31 17:00 dma-buf non-coherent mmap Thomas Hellstrom
2013-10-31 17:52 ` Rob Clark
2013-10-31 20:40   ` Thomas Hellstrom
2013-10-31 20:48     ` Dave Airlie
2013-10-31 21:07       ` Thomas Hellstrom
2013-10-31 23:00         ` Daniel Vetter
2013-11-01  0:17           ` Jakob Bornecrantz
2013-11-01  0:25             ` Rob Clark
2013-11-01  0:37               ` Jakob Bornecrantz
2013-11-01  0:57                 ` Rob Clark
2013-11-01 10:03                   ` Lucas Stach
2013-11-01 10:17                     ` Daniel Vetter
2013-11-01 13:22                       ` Rob Clark
2013-11-01 13:32                         ` Lucas Stach
2013-11-04  7:53                           ` Thomas Hellstrom
2013-11-04 10:22                             ` Lucas Stach
2013-11-04 10:48                               ` Thomas Hellstrom
2013-11-01 13:54                       ` Thomas Hellstrom
2013-10-31 21:10     ` Rob Clark
2013-10-31 21:38       ` Thomas Hellstrom [this message]
2013-10-31 22:43         ` [Linaro-mm-sig] " Benjamin Gaignard

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=5272CDD6.3060809@vmware.com \
    --to=thellstrom@vmware.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=robdclark@gmail.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.