diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2016-03-21 03:24:22 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2016-03-21 04:26:45 -0400 |
commit | 87e332d56b2c7dc6733f690c9069f4fe75f21c9d (patch) | |
tree | fc83506527f804eb1522e850b121598cefc5e0a1 | |
parent | 3c66f4aa7f3cb6579dfe977c05fcb5db25b41cd7 (diff) |
dma-buf: Update docs for SYNC ioctl
Just a bit of wording polish plus mentioning that it can fail and must
be restarted.
Requested by Sumit.
v2: Fix them typos (Hans).
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tiago Vignatti <tiago.vignatti@intel.com>
Cc: Stéphane Marchesin <marcheu@chromium.org>
Cc: David Herrmann <dh.herrmann@gmail.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Daniel Vetter <daniel.vetter@intel.com>
CC: linux-media@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: linaro-mm-sig@lists.linaro.org
Cc: intel-gfx@lists.freedesktop.org
Cc: devel@driverdev.osuosl.org
Cc: Hans Verkuil <hverkuil@xs4all.nl>
Acked-by: Sumit Semwal <sumit.semwal@linaro.org>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
-rw-r--r-- | Documentation/dma-buf-sharing.txt | 11 | ||||
-rw-r--r-- | drivers/dma-buf/dma-buf.c | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/Documentation/dma-buf-sharing.txt b/Documentation/dma-buf-sharing.txt index 32ac32e773e1..ca44c5820585 100644 --- a/Documentation/dma-buf-sharing.txt +++ b/Documentation/dma-buf-sharing.txt | |||
@@ -352,7 +352,8 @@ Being able to mmap an export dma-buf buffer object has 2 main use-cases: | |||
352 | 352 | ||
353 | No special interfaces, userspace simply calls mmap on the dma-buf fd, making | 353 | No special interfaces, userspace simply calls mmap on the dma-buf fd, making |
354 | sure that the cache synchronization ioctl (DMA_BUF_IOCTL_SYNC) is *always* | 354 | sure that the cache synchronization ioctl (DMA_BUF_IOCTL_SYNC) is *always* |
355 | used when the access happens. This is discussed next paragraphs. | 355 | used when the access happens. Note that DMA_BUF_IOCTL_SYNC can fail with |
356 | -EAGAIN or -EINTR, in which case it must be restarted. | ||
356 | 357 | ||
357 | Some systems might need some sort of cache coherency management e.g. when | 358 | Some systems might need some sort of cache coherency management e.g. when |
358 | CPU and GPU domains are being accessed through dma-buf at the same time. To | 359 | CPU and GPU domains are being accessed through dma-buf at the same time. To |
@@ -366,10 +367,10 @@ Being able to mmap an export dma-buf buffer object has 2 main use-cases: | |||
366 | want (with the new data being consumed by the GPU or say scanout device) | 367 | want (with the new data being consumed by the GPU or say scanout device) |
367 | - munmap once you don't need the buffer any more | 368 | - munmap once you don't need the buffer any more |
368 | 369 | ||
369 | Therefore, for correctness and optimal performance, systems with the memory | 370 | For correctness and optimal performance, it is always required to use |
370 | cache shared by the GPU and CPU i.e. the "coherent" and also the | 371 | SYNC_START and SYNC_END before and after, respectively, when accessing the |
371 | "incoherent" are always required to use SYNC_START and SYNC_END before and | 372 | mapped address. Userspace cannot rely on coherent access, even when there |
372 | after, respectively, when accessing the mapped address. | 373 | are systems where it just works without calling these ioctls. |
373 | 374 | ||
374 | 2. Supporting existing mmap interfaces in importers | 375 | 2. Supporting existing mmap interfaces in importers |
375 | 376 | ||
diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index 774a60f4309a..4a2c07ee6677 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c | |||
@@ -612,7 +612,7 @@ EXPORT_SYMBOL_GPL(dma_buf_begin_cpu_access); | |||
612 | * @dmabuf: [in] buffer to complete cpu access for. | 612 | * @dmabuf: [in] buffer to complete cpu access for. |
613 | * @direction: [in] length of range for cpu access. | 613 | * @direction: [in] length of range for cpu access. |
614 | * | 614 | * |
615 | * This call must always succeed. | 615 | * Can return negative error values, returns 0 on success. |
616 | */ | 616 | */ |
617 | int dma_buf_end_cpu_access(struct dma_buf *dmabuf, | 617 | int dma_buf_end_cpu_access(struct dma_buf *dmabuf, |
618 | enum dma_data_direction direction) | 618 | enum dma_data_direction direction) |