enum dma_buf_data_direction { DMA_BUF_BIDIRECTIONAL, DMA_BUF_TO_DEVICE, DMA_BUF_FROM_DEVICE }; /** * struct dma_buf_sync_arg - Argument to * * @start_x: Upper left X coordinate of area to be synced. * Unit is format-dependent * @start_y: Upper left Y coordinate of area to be synced. * Unit is format-dependent. * @width: Width of area to be synced. Grows to the right. * Unit is format-dependent. * @height: Height of area to be synced. Grows downwards. * Unit is format-dependent. * @direction: Intended transfer direction of data. * @flags: Flags to tune the synchronizing behaviour. */ struct dma_buf_sync_region_arg { __u32 buf_identifier; __u32 start_x; __u32 start_y; __u32 width; __u32 height; enum dma_buf_data_direction direction; __u32 flags; __u32 pad; }; /** * Force sync any outstanding rendering of the exporter before returning. * This is strictly a performance hint. The user may omit this flag to * speed up execution of the call, if it is known that previous rendering * affecting (by read or write) the synchronized area has already finished. */ #define DMA_BUF_SYNC_FLAG_SYNC (1 << 0); /** * Treat @start_x as byte offset into buffer and @width as byte * synchronization length. The values of @start_y and @height are ignored. * (Separate ioctl?) */ #define DMA_BUF_SYNC_FLAG_LINEAR (1 << 1); /** * Allow the implementation to coalesce sync_for_device calls, until either * a) An explicit flush * b) A sync for cpu call with DMA_BUF_BIDIRECTIONAL or DMA_BUF_TO_DEVICE * * Note: An implementation may choose to ignore this flag. */ #define DMA_BUF_SYNC_FLAG_COALESCE (1 << 2); /** * IOCTLS- * * Kernel waits should, if possible, be performed interruptible, and the * ioctl may sett errno to EINTR if the ioctl needs to be restarted. * To be discussed: Any sync operation may not affect areas outside the * region indicated. (Good for vmwgfx, but plays ill with cache line alignment) */ /** * Sync for CPU. */ #define DMA_BUF_SYNC_REGION_FOR_CPU \ _IOW(DMA_BUF_BASE, 0, struct dma_buf_sync_region_arg) /** * Sync for device. This is the default state of a dma-buf. */ #define DMA_BUF_SYNC_REGION_FOR_DEVICE \ _IOW(DMA_BUF_BASE, 1, struct dma_buf_sync_region_arg) /** * Flush any coalesced SYNC_REGION_FOR_DEVICE */ #define DMA_BUF_SYNC_REGION_FLUSH \ _IOW(DMA_BUF_BASE, 2, __u32)