dma-buf: document how to find size, mention kernel versions
PATCH 1/1 dma-buf: document how to find size, mention kernel versions
Document how to obtain the size of a DMA-BUF. This is what Wayland compositors are doing.
Mention the kernel version numbers from which DMA-BUF features are available.
--- include/uapi/linux/dma-buf.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
include/uapi/linux/dma-buf.h +7 -3
@@ -47,9 +47,13 @@* * If the driver or API with which the client is interacting uses implicit * synchronization, waiting for prior work to complete can be done via -* poll() on the DMA buffer file descriptor. If the driver or API requires -* explicit synchronization, the client may have to wait on a sync_file or -* other synchronization primitive outside the scope of the DMA buffer API. +* poll() on the DMA buffer file descriptor from kernel version 3.17. If the +* driver or API requires explicit synchronization, the client may have to wait +* on a sync_file or other synchronization primitive outside the scope of the +* DMA buffer API. +* +* From kernel version 3.12, user-space can use llseek(2) with the ``SEEK_END`` +* whence to obtain the size of a DMA-BUF. */ struct dma_buf_sync {/**
Signature · 1 line
2.36.1
Quoted 19 lines · Simon Ser
Document how to obtain the size of a DMA-BUF. This is what Wayland compositors are doing.
Mention the kernel version numbers from which DMA-BUF features are available.
Signed-off-by Simon Ser <[email protected]>Cc Daniel Vetter <[email protected]>Cc Jason Ekstrand <[email protected]>--- include/uapi/linux/dma-buf.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)include/uapi/linux/dma-buf.h +0
-0
include/uapi/linux/dma-buf.h line 53
Quoted 10 lines
include/uapi/linux/dma-buf.h +4
-3@@ -47,9 +47,13 @@* * If the driver or API with which the client is interacting uses implicit * synchronization, waiting for prior work to complete can be done via -* poll() on the DMA buffer file descriptor. If the driver or API requires -* explicit synchronization, the client may have to wait on a sync_file or -* other synchronization primitive outside the scope of the DMA buffer API. +* poll() on the DMA buffer file descriptor from kernel version 3.17. If the +* driver or API requires explicit synchronization, the client may have to wait +* on a sync_file or other synchronization primitive outside the scope of the +* DMA buffer API.
This looks good, but you missed the DOC: implicit fence polling in dma-buf.c. Probably good to update that too.
include/uapi/linux/dma-buf.h line 56
Quoted 3 lines
include/uapi/linux/dma-buf.h +3
-0+* +* From kernel version 3.12, user-space can use llseek(2) with the ``SEEK_END`` +* whence to obtain the size of a DMA-BUF.
This feels misplaced, especially since this ends up under the "DMA Buffer ioctls" heading.
Maybe simplest to just put a "DMA Buffer misc uAPI" section directly into dma-buf.rst and put that section there? Also probably good to add that the size is invariant.
Or if you don't want a new heading, put it somewhere sensible in the mmap section? Also just noticed that the DOC: cpu access section could perhaps link to the relevant ioctl docs here to connect things better. -Daniel
Quoted 7 lines
include/uapi/linux/dma-buf.h +0
-1*/ struct dma_buf_sync {/** -- 2.36.1
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch