Greg Kroah-Hartman | e2be04c | 2017-11-01 15:09:13 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ |
Rob Clark | cd5351f | 2011-11-12 12:09:40 -0600 | [diff] [blame] | 2 | /* |
Rob Clark | 8bb0daf | 2013-02-11 12:43:09 -0500 | [diff] [blame] | 3 | * include/uapi/drm/omap_drm.h |
Rob Clark | cd5351f | 2011-11-12 12:09:40 -0600 | [diff] [blame] | 4 | * |
| 5 | * Copyright (C) 2011 Texas Instruments |
| 6 | * Author: Rob Clark <rob@ti.com> |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify it |
| 9 | * under the terms of the GNU General Public License version 2 as published by |
| 10 | * the Free Software Foundation. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 15 | * more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License along with |
| 18 | * this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | |
| 21 | #ifndef __OMAP_DRM_H__ |
| 22 | #define __OMAP_DRM_H__ |
| 23 | |
Gabriel Laskar | 7ef500e | 2015-11-30 15:10:50 +0100 | [diff] [blame] | 24 | #include "drm.h" |
Rob Clark | cd5351f | 2011-11-12 12:09:40 -0600 | [diff] [blame] | 25 | |
Emil Velikov | c92378a | 2016-04-07 19:06:40 +0100 | [diff] [blame] | 26 | #if defined(__cplusplus) |
| 27 | extern "C" { |
| 28 | #endif |
| 29 | |
Rob Clark | cd5351f | 2011-11-12 12:09:40 -0600 | [diff] [blame] | 30 | /* Please note that modifications to all structs defined here are |
| 31 | * subject to backwards-compatibility constraints. |
| 32 | */ |
| 33 | |
| 34 | #define OMAP_PARAM_CHIPSET_ID 1 /* ie. 0x3430, 0x4430, etc */ |
| 35 | |
| 36 | struct drm_omap_param { |
Dmitry V. Levin | 337ba7f | 2017-02-25 16:29:50 +0300 | [diff] [blame] | 37 | __u64 param; /* in */ |
| 38 | __u64 value; /* in (set_param), out (get_param) */ |
Rob Clark | cd5351f | 2011-11-12 12:09:40 -0600 | [diff] [blame] | 39 | }; |
| 40 | |
Tomi Valkeinen | 9b7117e | 2019-10-10 13:59:56 +0200 | [diff] [blame] | 41 | /* Scanout buffer, consumable by DSS */ |
| 42 | #define OMAP_BO_SCANOUT 0x00000001 |
Rob Clark | cd5351f | 2011-11-12 12:09:40 -0600 | [diff] [blame] | 43 | |
Tomi Valkeinen | 9b7117e | 2019-10-10 13:59:56 +0200 | [diff] [blame] | 44 | /* Buffer CPU caching mode: cached, write-combining or uncached. */ |
| 45 | #define OMAP_BO_CACHED 0x00000000 |
| 46 | #define OMAP_BO_WC 0x00000002 |
| 47 | #define OMAP_BO_UNCACHED 0x00000004 |
| 48 | #define OMAP_BO_CACHE_MASK 0x00000006 |
Rob Clark | cd5351f | 2011-11-12 12:09:40 -0600 | [diff] [blame] | 49 | |
Tomi Valkeinen | 9b7117e | 2019-10-10 13:59:56 +0200 | [diff] [blame] | 50 | /* Use TILER for the buffer. The TILER container unit can be 8, 16 or 32 bits. */ |
Rob Clark | cd5351f | 2011-11-12 12:09:40 -0600 | [diff] [blame] | 51 | #define OMAP_BO_TILED_8 0x00000100 |
| 52 | #define OMAP_BO_TILED_16 0x00000200 |
| 53 | #define OMAP_BO_TILED_32 0x00000300 |
Tomi Valkeinen | 9b7117e | 2019-10-10 13:59:56 +0200 | [diff] [blame] | 54 | #define OMAP_BO_TILED_MASK 0x00000f00 |
Rob Clark | cd5351f | 2011-11-12 12:09:40 -0600 | [diff] [blame] | 55 | |
| 56 | union omap_gem_size { |
Dmitry V. Levin | 337ba7f | 2017-02-25 16:29:50 +0300 | [diff] [blame] | 57 | __u32 bytes; /* (for non-tiled formats) */ |
Rob Clark | cd5351f | 2011-11-12 12:09:40 -0600 | [diff] [blame] | 58 | struct { |
Dmitry V. Levin | 337ba7f | 2017-02-25 16:29:50 +0300 | [diff] [blame] | 59 | __u16 width; |
| 60 | __u16 height; |
Rob Clark | cd5351f | 2011-11-12 12:09:40 -0600 | [diff] [blame] | 61 | } tiled; /* (for tiled formats) */ |
| 62 | }; |
| 63 | |
| 64 | struct drm_omap_gem_new { |
| 65 | union omap_gem_size size; /* in */ |
Dmitry V. Levin | 337ba7f | 2017-02-25 16:29:50 +0300 | [diff] [blame] | 66 | __u32 flags; /* in */ |
| 67 | __u32 handle; /* out */ |
| 68 | __u32 __pad; |
Rob Clark | cd5351f | 2011-11-12 12:09:40 -0600 | [diff] [blame] | 69 | }; |
| 70 | |
| 71 | /* mask of operations: */ |
| 72 | enum omap_gem_op { |
| 73 | OMAP_GEM_READ = 0x01, |
| 74 | OMAP_GEM_WRITE = 0x02, |
| 75 | }; |
| 76 | |
| 77 | struct drm_omap_gem_cpu_prep { |
Dmitry V. Levin | 337ba7f | 2017-02-25 16:29:50 +0300 | [diff] [blame] | 78 | __u32 handle; /* buffer handle (in) */ |
| 79 | __u32 op; /* mask of omap_gem_op (in) */ |
Rob Clark | cd5351f | 2011-11-12 12:09:40 -0600 | [diff] [blame] | 80 | }; |
| 81 | |
| 82 | struct drm_omap_gem_cpu_fini { |
Dmitry V. Levin | 337ba7f | 2017-02-25 16:29:50 +0300 | [diff] [blame] | 83 | __u32 handle; /* buffer handle (in) */ |
| 84 | __u32 op; /* mask of omap_gem_op (in) */ |
Rob Clark | cd5351f | 2011-11-12 12:09:40 -0600 | [diff] [blame] | 85 | /* TODO maybe here we pass down info about what regions are touched |
| 86 | * by sw so we can be clever about cache ops? For now a placeholder, |
| 87 | * set to zero and we just do full buffer flush.. |
| 88 | */ |
Dmitry V. Levin | 337ba7f | 2017-02-25 16:29:50 +0300 | [diff] [blame] | 89 | __u32 nregions; |
| 90 | __u32 __pad; |
Rob Clark | cd5351f | 2011-11-12 12:09:40 -0600 | [diff] [blame] | 91 | }; |
| 92 | |
| 93 | struct drm_omap_gem_info { |
Dmitry V. Levin | 337ba7f | 2017-02-25 16:29:50 +0300 | [diff] [blame] | 94 | __u32 handle; /* buffer handle (in) */ |
| 95 | __u32 pad; |
| 96 | __u64 offset; /* mmap offset (out) */ |
Rob Clark | cd5351f | 2011-11-12 12:09:40 -0600 | [diff] [blame] | 97 | /* note: in case of tiled buffers, the user virtual size can be |
| 98 | * different from the physical size (ie. how many pages are needed |
| 99 | * to back the object) which is returned in DRM_IOCTL_GEM_OPEN.. |
| 100 | * This size here is the one that should be used if you want to |
| 101 | * mmap() the buffer: |
| 102 | */ |
Dmitry V. Levin | 337ba7f | 2017-02-25 16:29:50 +0300 | [diff] [blame] | 103 | __u32 size; /* virtual size for mmap'ing (out) */ |
| 104 | __u32 __pad; |
Rob Clark | cd5351f | 2011-11-12 12:09:40 -0600 | [diff] [blame] | 105 | }; |
| 106 | |
| 107 | #define DRM_OMAP_GET_PARAM 0x00 |
| 108 | #define DRM_OMAP_SET_PARAM 0x01 |
Rob Clark | cd5351f | 2011-11-12 12:09:40 -0600 | [diff] [blame] | 109 | #define DRM_OMAP_GEM_NEW 0x03 |
Laurent Pinchart | d6f544f | 2017-05-09 01:27:11 +0300 | [diff] [blame] | 110 | #define DRM_OMAP_GEM_CPU_PREP 0x04 /* Deprecated, to be removed */ |
| 111 | #define DRM_OMAP_GEM_CPU_FINI 0x05 /* Deprecated, to be removed */ |
Rob Clark | cd5351f | 2011-11-12 12:09:40 -0600 | [diff] [blame] | 112 | #define DRM_OMAP_GEM_INFO 0x06 |
| 113 | #define DRM_OMAP_NUM_IOCTLS 0x07 |
| 114 | |
| 115 | #define DRM_IOCTL_OMAP_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GET_PARAM, struct drm_omap_param) |
| 116 | #define DRM_IOCTL_OMAP_SET_PARAM DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_SET_PARAM, struct drm_omap_param) |
Rob Clark | cd5351f | 2011-11-12 12:09:40 -0600 | [diff] [blame] | 117 | #define DRM_IOCTL_OMAP_GEM_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GEM_NEW, struct drm_omap_gem_new) |
| 118 | #define DRM_IOCTL_OMAP_GEM_CPU_PREP DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_GEM_CPU_PREP, struct drm_omap_gem_cpu_prep) |
| 119 | #define DRM_IOCTL_OMAP_GEM_CPU_FINI DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_GEM_CPU_FINI, struct drm_omap_gem_cpu_fini) |
| 120 | #define DRM_IOCTL_OMAP_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GEM_INFO, struct drm_omap_gem_info) |
| 121 | |
Emil Velikov | c92378a | 2016-04-07 19:06:40 +0100 | [diff] [blame] | 122 | #if defined(__cplusplus) |
| 123 | } |
| 124 | #endif |
| 125 | |
Rob Clark | cd5351f | 2011-11-12 12:09:40 -0600 | [diff] [blame] | 126 | #endif /* __OMAP_DRM_H__ */ |