12 Feb, 2016

1 commit

  • The userspace might need some sort of cache coherency management e.g. when CPU
    and GPU domains are being accessed through dma-buf at the same time. To
    circumvent this problem there are begin/end coherency markers, that forward
    directly to existing dma-buf device drivers vfunc hooks. Userspace can make use
    of those markers through the DMA_BUF_IOCTL_SYNC ioctl. The sequence would be
    used like following:
    - mmap dma-buf fd
    - for each drawing/upload cycle in CPU 1. SYNC_START ioctl, 2. read/write
    to mmap area 3. SYNC_END ioctl. This can be repeated as often as you
    want (with the new data being consumed by the GPU or say scanout device)
    - munmap once you don't need the buffer any more

    v2 (Tiago): Fix header file type names (u64 -> __u64)
    v3 (Tiago): Add documentation. Use enum dma_buf_sync_flags to the begin/end
    dma-buf functions. Check for overflows in start/length.
    v4 (Tiago): use 2d regions for sync.
    v5 (Tiago): forget about 2d regions (v4); use _IOW in DMA_BUF_IOCTL_SYNC and
    remove range information from struct dma_buf_sync.
    v6 (Tiago): use __u64 structured padded flags instead enum. Adjust
    documentation about the recommendation on using sync ioctls.
    v7 (Tiago): Alex' nit on flags definition and being even more wording in the
    doc about sync usage.
    v9 (Tiago): remove useless is_dma_buf_file check. Fix sync.flags conditionals
    and its mask order check. Add include in dma-buf.h.

    Cc: Ville Syrjälä
    Cc: David Herrmann
    Cc: Sumit Semwal
    Reviewed-by: Stéphane Marchesin
    Signed-off-by: Daniel Vetter
    Signed-off-by: Tiago Vignatti
    Reviewed-by: David Herrmann
    Signed-off-by: Daniel Vetter
    Link: http://patchwork.freedesktop.org/patch/msgid/1455228291-29640-1-git-send-email-tiago.vignatti@intel.com

    Daniel Vetter