blob: 7f30393b92c3b4f26486964997f91ac8bca5ec4e [file] [log] [blame]
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00001/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * Framework for buffer objects that can be shared across devices/subsystems.
4 *
5 * Copyright(C) 2015 Intel Ltd
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef _DMA_BUF_UAPI_H_
21#define _DMA_BUF_UAPI_H_
22
23#include <linux/types.h>
24
25/* begin/end dma-buf functions used for userspace mmap. */
26struct dma_buf_sync {
27 __u64 flags;
28};
29
30#define DMA_BUF_SYNC_READ (1 << 0)
31#define DMA_BUF_SYNC_WRITE (2 << 0)
32#define DMA_BUF_SYNC_RW (DMA_BUF_SYNC_READ | DMA_BUF_SYNC_WRITE)
33#define DMA_BUF_SYNC_START (0 << 2)
34#define DMA_BUF_SYNC_END (1 << 2)
35#define DMA_BUF_SYNC_VALID_FLAGS_MASK \
36 (DMA_BUF_SYNC_RW | DMA_BUF_SYNC_END)
37
David Brazdil0f672f62019-12-10 10:32:29 +000038#define DMA_BUF_NAME_LEN 32
39
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000040#define DMA_BUF_BASE 'b'
41#define DMA_BUF_IOCTL_SYNC _IOW(DMA_BUF_BASE, 0, struct dma_buf_sync)
Olivier Deprez0e641232021-09-23 10:07:05 +020042
43/* 32/64bitness of this uapi was botched in android, there's no difference
44 * between them in actual uapi, they're just different numbers.
45 */
David Brazdil0f672f62019-12-10 10:32:29 +000046#define DMA_BUF_SET_NAME _IOW(DMA_BUF_BASE, 1, const char *)
Olivier Deprez0e641232021-09-23 10:07:05 +020047#define DMA_BUF_SET_NAME_A _IOW(DMA_BUF_BASE, 1, u32)
48#define DMA_BUF_SET_NAME_B _IOW(DMA_BUF_BASE, 1, u64)
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000049
50#endif