Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 1 | /**************************************************************************** |
| 2 | **************************************************************************** |
| 3 | *** |
| 4 | *** This header was automatically generated from a Linux kernel header |
| 5 | *** of the same name, to make information necessary for userspace to |
| 6 | *** call into the kernel available to libc. It contains only constants, |
| 7 | *** structures, and macros generated from the original header, and thus, |
| 8 | *** contains no copyrightable information. |
| 9 | *** |
| 10 | *** To edit the content of this header, modify the corresponding |
| 11 | *** source file (e.g. under external/kernel-headers/original/) then |
| 12 | *** run bionic/libc/kernel/tools/update_all.py |
| 13 | *** |
| 14 | *** Any manual change here will be lost the next time this script will |
| 15 | *** be run. You've been warned! |
| 16 | *** |
| 17 | **************************************************************************** |
| 18 | ****************************************************************************/ |
| 19 | #ifndef VIRTIO_GPU_HW_H |
| 20 | #define VIRTIO_GPU_HW_H |
| 21 | #include <linux/types.h> |
| 22 | #define VIRTIO_GPU_F_VIRGL 0 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 23 | enum virtio_gpu_ctrl_type { |
| 24 | VIRTIO_GPU_UNDEFINED = 0, |
| 25 | VIRTIO_GPU_CMD_GET_DISPLAY_INFO = 0x0100, |
| 26 | VIRTIO_GPU_CMD_RESOURCE_CREATE_2D, |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 27 | VIRTIO_GPU_CMD_RESOURCE_UNREF, |
| 28 | VIRTIO_GPU_CMD_SET_SCANOUT, |
| 29 | VIRTIO_GPU_CMD_RESOURCE_FLUSH, |
| 30 | VIRTIO_GPU_CMD_TRANSFER_TO_HOST_2D, |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 31 | VIRTIO_GPU_CMD_RESOURCE_ATTACH_BACKING, |
| 32 | VIRTIO_GPU_CMD_RESOURCE_DETACH_BACKING, |
| 33 | VIRTIO_GPU_CMD_GET_CAPSET_INFO, |
| 34 | VIRTIO_GPU_CMD_GET_CAPSET, |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 35 | VIRTIO_GPU_CMD_CTX_CREATE = 0x0200, |
| 36 | VIRTIO_GPU_CMD_CTX_DESTROY, |
| 37 | VIRTIO_GPU_CMD_CTX_ATTACH_RESOURCE, |
| 38 | VIRTIO_GPU_CMD_CTX_DETACH_RESOURCE, |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 39 | VIRTIO_GPU_CMD_RESOURCE_CREATE_3D, |
| 40 | VIRTIO_GPU_CMD_TRANSFER_TO_HOST_3D, |
| 41 | VIRTIO_GPU_CMD_TRANSFER_FROM_HOST_3D, |
| 42 | VIRTIO_GPU_CMD_SUBMIT_3D, |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 43 | VIRTIO_GPU_CMD_UPDATE_CURSOR = 0x0300, |
| 44 | VIRTIO_GPU_CMD_MOVE_CURSOR, |
| 45 | VIRTIO_GPU_RESP_OK_NODATA = 0x1100, |
| 46 | VIRTIO_GPU_RESP_OK_DISPLAY_INFO, |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 47 | VIRTIO_GPU_RESP_OK_CAPSET_INFO, |
| 48 | VIRTIO_GPU_RESP_OK_CAPSET, |
| 49 | VIRTIO_GPU_RESP_ERR_UNSPEC = 0x1200, |
| 50 | VIRTIO_GPU_RESP_ERR_OUT_OF_MEMORY, |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 51 | VIRTIO_GPU_RESP_ERR_INVALID_SCANOUT_ID, |
| 52 | VIRTIO_GPU_RESP_ERR_INVALID_RESOURCE_ID, |
| 53 | VIRTIO_GPU_RESP_ERR_INVALID_CONTEXT_ID, |
| 54 | VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER, |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 55 | }; |
| 56 | #define VIRTIO_GPU_FLAG_FENCE (1 << 0) |
| 57 | struct virtio_gpu_ctrl_hdr { |
| 58 | __le32 type; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 59 | __le32 flags; |
| 60 | __le64 fence_id; |
| 61 | __le32 ctx_id; |
| 62 | __le32 padding; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 63 | }; |
| 64 | struct virtio_gpu_cursor_pos { |
| 65 | __le32 scanout_id; |
| 66 | __le32 x; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 67 | __le32 y; |
| 68 | __le32 padding; |
| 69 | }; |
| 70 | struct virtio_gpu_update_cursor { |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 71 | struct virtio_gpu_ctrl_hdr hdr; |
| 72 | struct virtio_gpu_cursor_pos pos; |
| 73 | __le32 resource_id; |
| 74 | __le32 hot_x; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 75 | __le32 hot_y; |
| 76 | __le32 padding; |
| 77 | }; |
| 78 | struct virtio_gpu_rect { |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 79 | __le32 x; |
| 80 | __le32 y; |
| 81 | __le32 width; |
| 82 | __le32 height; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 83 | }; |
| 84 | struct virtio_gpu_resource_unref { |
| 85 | struct virtio_gpu_ctrl_hdr hdr; |
| 86 | __le32 resource_id; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 87 | __le32 padding; |
| 88 | }; |
| 89 | struct virtio_gpu_resource_create_2d { |
| 90 | struct virtio_gpu_ctrl_hdr hdr; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 91 | __le32 resource_id; |
| 92 | __le32 format; |
| 93 | __le32 width; |
| 94 | __le32 height; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 95 | }; |
| 96 | struct virtio_gpu_set_scanout { |
| 97 | struct virtio_gpu_ctrl_hdr hdr; |
| 98 | struct virtio_gpu_rect r; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 99 | __le32 scanout_id; |
| 100 | __le32 resource_id; |
| 101 | }; |
| 102 | struct virtio_gpu_resource_flush { |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 103 | struct virtio_gpu_ctrl_hdr hdr; |
| 104 | struct virtio_gpu_rect r; |
| 105 | __le32 resource_id; |
| 106 | __le32 padding; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 107 | }; |
| 108 | struct virtio_gpu_transfer_to_host_2d { |
| 109 | struct virtio_gpu_ctrl_hdr hdr; |
| 110 | struct virtio_gpu_rect r; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 111 | __le64 offset; |
| 112 | __le32 resource_id; |
| 113 | __le32 padding; |
| 114 | }; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 115 | struct virtio_gpu_mem_entry { |
| 116 | __le64 addr; |
| 117 | __le32 length; |
| 118 | __le32 padding; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 119 | }; |
| 120 | struct virtio_gpu_resource_attach_backing { |
| 121 | struct virtio_gpu_ctrl_hdr hdr; |
| 122 | __le32 resource_id; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 123 | __le32 nr_entries; |
| 124 | }; |
| 125 | struct virtio_gpu_resource_detach_backing { |
| 126 | struct virtio_gpu_ctrl_hdr hdr; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 127 | __le32 resource_id; |
| 128 | __le32 padding; |
| 129 | }; |
| 130 | #define VIRTIO_GPU_MAX_SCANOUTS 16 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 131 | struct virtio_gpu_resp_display_info { |
| 132 | struct virtio_gpu_ctrl_hdr hdr; |
| 133 | struct virtio_gpu_display_one { |
| 134 | struct virtio_gpu_rect r; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 135 | __le32 enabled; |
| 136 | __le32 flags; |
| 137 | } pmodes[VIRTIO_GPU_MAX_SCANOUTS]; |
| 138 | }; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 139 | struct virtio_gpu_box { |
| 140 | __le32 x, y, z; |
| 141 | __le32 w, h, d; |
| 142 | }; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 143 | struct virtio_gpu_transfer_host_3d { |
| 144 | struct virtio_gpu_ctrl_hdr hdr; |
| 145 | struct virtio_gpu_box box; |
| 146 | __le64 offset; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 147 | __le32 resource_id; |
| 148 | __le32 level; |
| 149 | __le32 stride; |
| 150 | __le32 layer_stride; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 151 | }; |
| 152 | #define VIRTIO_GPU_RESOURCE_FLAG_Y_0_TOP (1 << 0) |
| 153 | struct virtio_gpu_resource_create_3d { |
| 154 | struct virtio_gpu_ctrl_hdr hdr; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 155 | __le32 resource_id; |
| 156 | __le32 target; |
| 157 | __le32 format; |
| 158 | __le32 bind; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 159 | __le32 width; |
| 160 | __le32 height; |
| 161 | __le32 depth; |
| 162 | __le32 array_size; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 163 | __le32 last_level; |
| 164 | __le32 nr_samples; |
| 165 | __le32 flags; |
| 166 | __le32 padding; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 167 | }; |
| 168 | struct virtio_gpu_ctx_create { |
| 169 | struct virtio_gpu_ctrl_hdr hdr; |
| 170 | __le32 nlen; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 171 | __le32 padding; |
| 172 | char debug_name[64]; |
| 173 | }; |
| 174 | struct virtio_gpu_ctx_destroy { |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 175 | struct virtio_gpu_ctrl_hdr hdr; |
| 176 | }; |
| 177 | struct virtio_gpu_ctx_resource { |
| 178 | struct virtio_gpu_ctrl_hdr hdr; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 179 | __le32 resource_id; |
| 180 | __le32 padding; |
| 181 | }; |
| 182 | struct virtio_gpu_cmd_submit { |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 183 | struct virtio_gpu_ctrl_hdr hdr; |
| 184 | __le32 size; |
| 185 | __le32 padding; |
| 186 | }; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 187 | #define VIRTIO_GPU_CAPSET_VIRGL 1 |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 188 | #define VIRTIO_GPU_CAPSET_VIRGL2 2 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 189 | struct virtio_gpu_get_capset_info { |
| 190 | struct virtio_gpu_ctrl_hdr hdr; |
| 191 | __le32 capset_index; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 192 | __le32 padding; |
| 193 | }; |
| 194 | struct virtio_gpu_resp_capset_info { |
| 195 | struct virtio_gpu_ctrl_hdr hdr; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 196 | __le32 capset_id; |
| 197 | __le32 capset_max_version; |
| 198 | __le32 capset_max_size; |
| 199 | __le32 padding; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 200 | }; |
| 201 | struct virtio_gpu_get_capset { |
| 202 | struct virtio_gpu_ctrl_hdr hdr; |
| 203 | __le32 capset_id; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 204 | __le32 capset_version; |
| 205 | }; |
| 206 | struct virtio_gpu_resp_capset { |
| 207 | struct virtio_gpu_ctrl_hdr hdr; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 208 | __u8 capset_data[]; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 209 | }; |
| 210 | #define VIRTIO_GPU_EVENT_DISPLAY (1 << 0) |
| 211 | struct virtio_gpu_config { |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 212 | __u32 events_read; |
| 213 | __u32 events_clear; |
| 214 | __u32 num_scanouts; |
| 215 | __u32 num_capsets; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 216 | }; |
| 217 | enum virtio_gpu_formats { |
| 218 | VIRTIO_GPU_FORMAT_B8G8R8A8_UNORM = 1, |
| 219 | VIRTIO_GPU_FORMAT_B8G8R8X8_UNORM = 2, |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 220 | VIRTIO_GPU_FORMAT_A8R8G8B8_UNORM = 3, |
| 221 | VIRTIO_GPU_FORMAT_X8R8G8B8_UNORM = 4, |
| 222 | VIRTIO_GPU_FORMAT_R8G8B8A8_UNORM = 67, |
| 223 | VIRTIO_GPU_FORMAT_X8B8G8R8_UNORM = 68, |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 224 | VIRTIO_GPU_FORMAT_A8B8G8R8_UNORM = 121, |
| 225 | VIRTIO_GPU_FORMAT_R8G8B8X8_UNORM = 134, |
| 226 | }; |
| 227 | #endif |