linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maarten Lankhorst <maarten.lankhorst@canonical.com>
To: jakob@vmware.com, thellstrom@vmware.com,
	dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org,
	sumit.semwal@linaro.org, linux-media@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/5] fence: dma-buf cross-device synchronization (v9)
Date: Sun, 07 Oct 2012 18:31:22 +0200	[thread overview]
Message-ID: <5071AE5A.7050204@canonical.com> (raw)
In-Reply-To: <20120928124224.14366.27842.stgit@patser.local>

Op 28-09-12 14:42, Maarten Lankhorst schreef:
> A fence can be attached to a buffer which is being filled or consumed
> by hw, to allow userspace to pass the buffer without waiting to another
> device.  For example, userspace can call page_flip ioctl to display the
> next frame of graphics after kicking the GPU but while the GPU is still
> rendering.  The display device sharing the buffer with the GPU would
> attach a callback to get notified when the GPU's rendering-complete IRQ
> fires, to update the scan-out address of the display, without having to
> wake up userspace.
>
> A fence is transient, one-shot deal.  It is allocated and attached
> to one or more dma-buf's.  When the one that attached it is done, with
> the pending operation, it can signal the fence:
>   + fence_signal()
>
> To have a rough approximation whether a fence is fired, call:
>   + fence_is_signaled()
>
> The dma-buf-mgr handles tracking, and waiting on, the fences associated
> with a dma-buf.
>
> The one pending on the fence can add an async callback:
>   + fence_add_callback()
>
> The callback can optionally be cancelled with:
>   + fence_remove_callback()
>
> To wait synchronously, optionally with a timeout:
>   + fence_wait()
>   + fence_wait_timeout()
>
...

Implementing this makes the locking feel weird, instead of abusing
fence->event_queue.lock I think it would make sense to remove this part entirely,
and have a simply linked list plus a pointer to a spinlock.

enable_signaling should be called with this spinlock held. This way,
the enable_signaling callback would be easier to implement
and doesn't have to double check for races as much in there.

Also __fence_signal should be exported which would be the
same as fence_signal, but without taking the spinlock as separate
step, so it can be called with the spinlock held.

How do you feel about these proposed changes?

~Maarten


      parent reply	other threads:[~2012-10-07 16:31 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20120928124148.14366.21063.stgit@patser.local>
2012-09-28 13:20 ` [PATCH 1/5] dma-buf: remove fallback for !CONFIG_DMA_SHARED_BUFFER Daniel Vetter
2012-09-28 14:14 ` Maarten Lankhorst
2012-09-28 19:42   ` Thomas Hellstrom
2012-09-28 20:10     ` Thomas Hellstrom
2012-09-29 15:16       ` Maarten Lankhorst
2012-10-01  8:49         ` Thomas Hellstrom
2012-10-01  9:47     ` Maarten Lankhorst
2012-10-02  6:46       ` Thomas Hellstrom
2012-10-02  8:03         ` Daniel Vetter
2012-10-03  7:45           ` Thomas Hellstrom
2012-10-03  7:54             ` Daniel Vetter
2012-10-03  8:37               ` Thomas Hellstrom
2012-10-03  8:53                 ` Daniel Vetter
2012-10-03 10:53                   ` Thomas Hellstrom
2012-10-03 12:46                     ` Maarten Lankhorst
2012-10-03 12:56                       ` Thomas Hellstrom
2012-10-03  7:57             ` Maarten Lankhorst
2012-10-03  8:35               ` Thomas Hellstrom
     [not found] ` <20120928124313.14366.44686.stgit@patser.local>
2012-09-28 15:29   ` [PATCH 4/5] reservation: cross-device reservation support Thomas Hellström
2012-09-28 16:01     ` Maarten Lankhorst
2012-10-03 12:33   ` Thomas Hellstrom
     [not found] ` <20120928124224.14366.27842.stgit@patser.local>
2012-10-07 16:31   ` Maarten Lankhorst [this message]

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=5071AE5A.7050204@canonical.com \
    --to=maarten.lankhorst@canonical.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jakob@vmware.com \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=sumit.semwal@linaro.org \
    --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;
as well as URLs for NNTP newsgroup(s).