Dave Airlie | f64122c | 2013-02-25 14:47:55 +1000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2013 Red Hat |
| 3 | * All Rights Reserved. |
| 4 | * |
| 5 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 6 | * copy of this software and associated documentation files (the "Software"), |
| 7 | * to deal in the Software without restriction, including without limitation |
| 8 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 9 | * and/or sell copies of the Software, and to permit persons to whom the |
| 10 | * Software is furnished to do so, subject to the following conditions: |
| 11 | * |
| 12 | * The above copyright notice and this permission notice (including the next |
| 13 | * paragraph) shall be included in all copies or substantial portions of the |
| 14 | * Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 19 | * THE AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR |
| 20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 22 | * OTHER DEALINGS IN THE SOFTWARE. |
| 23 | */ |
| 24 | #ifndef QXL_DRM_H |
| 25 | #define QXL_DRM_H |
| 26 | |
Gabriel Laskar | 8ca3284 | 2015-11-30 15:10:51 +0100 | [diff] [blame] | 27 | #include "drm.h" |
Dave Airlie | f64122c | 2013-02-25 14:47:55 +1000 | [diff] [blame] | 28 | |
| 29 | /* Please note that modifications to all structs defined here are |
| 30 | * subject to backwards-compatibility constraints. |
| 31 | * |
Mikko Rapeli | 8e51012 | 2015-03-11 03:12:23 +0100 | [diff] [blame] | 32 | * Do not use pointers, use __u64 instead for 32 bit / 64 bit user/kernel |
Dave Airlie | f64122c | 2013-02-25 14:47:55 +1000 | [diff] [blame] | 33 | * compatibility Keep fields aligned to their size |
| 34 | */ |
| 35 | |
| 36 | #define QXL_GEM_DOMAIN_CPU 0 |
| 37 | #define QXL_GEM_DOMAIN_VRAM 1 |
| 38 | #define QXL_GEM_DOMAIN_SURFACE 2 |
| 39 | |
| 40 | #define DRM_QXL_ALLOC 0x00 |
| 41 | #define DRM_QXL_MAP 0x01 |
| 42 | #define DRM_QXL_EXECBUFFER 0x02 |
| 43 | #define DRM_QXL_UPDATE_AREA 0x03 |
| 44 | #define DRM_QXL_GETPARAM 0x04 |
| 45 | #define DRM_QXL_CLIENTCAP 0x05 |
| 46 | |
| 47 | #define DRM_QXL_ALLOC_SURF 0x06 |
| 48 | |
| 49 | struct drm_qxl_alloc { |
Mikko Rapeli | 8e51012 | 2015-03-11 03:12:23 +0100 | [diff] [blame] | 50 | __u32 size; |
| 51 | __u32 handle; /* 0 is an invalid handle */ |
Dave Airlie | f64122c | 2013-02-25 14:47:55 +1000 | [diff] [blame] | 52 | }; |
| 53 | |
| 54 | struct drm_qxl_map { |
Mikko Rapeli | 8e51012 | 2015-03-11 03:12:23 +0100 | [diff] [blame] | 55 | __u64 offset; /* use for mmap system call */ |
| 56 | __u32 handle; |
| 57 | __u32 pad; |
Dave Airlie | f64122c | 2013-02-25 14:47:55 +1000 | [diff] [blame] | 58 | }; |
| 59 | |
| 60 | /* |
| 61 | * dest is the bo we are writing the relocation into |
| 62 | * src is bo we are relocating. |
| 63 | * *(dest_handle.base_addr + dest_offset) = physical_address(src_handle.addr + |
| 64 | * src_offset) |
| 65 | */ |
| 66 | #define QXL_RELOC_TYPE_BO 1 |
| 67 | #define QXL_RELOC_TYPE_SURF 2 |
| 68 | |
| 69 | struct drm_qxl_reloc { |
Mikko Rapeli | 8e51012 | 2015-03-11 03:12:23 +0100 | [diff] [blame] | 70 | __u64 src_offset; /* offset into src_handle or src buffer */ |
| 71 | __u64 dst_offset; /* offset in dest handle */ |
| 72 | __u32 src_handle; /* dest handle to compute address from */ |
| 73 | __u32 dst_handle; /* 0 if to command buffer */ |
| 74 | __u32 reloc_type; |
| 75 | __u32 pad; |
Dave Airlie | f64122c | 2013-02-25 14:47:55 +1000 | [diff] [blame] | 76 | }; |
| 77 | |
| 78 | struct drm_qxl_command { |
Mikko Rapeli | 8e51012 | 2015-03-11 03:12:23 +0100 | [diff] [blame] | 79 | __u64 __user command; /* void* */ |
| 80 | __u64 __user relocs; /* struct drm_qxl_reloc* */ |
| 81 | __u32 type; |
| 82 | __u32 command_size; |
| 83 | __u32 relocs_num; |
| 84 | __u32 pad; |
Dave Airlie | f64122c | 2013-02-25 14:47:55 +1000 | [diff] [blame] | 85 | }; |
| 86 | |
| 87 | /* XXX: call it drm_qxl_commands? */ |
| 88 | struct drm_qxl_execbuffer { |
Mikko Rapeli | 8e51012 | 2015-03-11 03:12:23 +0100 | [diff] [blame] | 89 | __u32 flags; /* for future use */ |
| 90 | __u32 commands_num; |
| 91 | __u64 __user commands; /* struct drm_qxl_command* */ |
Dave Airlie | f64122c | 2013-02-25 14:47:55 +1000 | [diff] [blame] | 92 | }; |
| 93 | |
| 94 | struct drm_qxl_update_area { |
Mikko Rapeli | 8e51012 | 2015-03-11 03:12:23 +0100 | [diff] [blame] | 95 | __u32 handle; |
| 96 | __u32 top; |
| 97 | __u32 left; |
| 98 | __u32 bottom; |
| 99 | __u32 right; |
| 100 | __u32 pad; |
Dave Airlie | f64122c | 2013-02-25 14:47:55 +1000 | [diff] [blame] | 101 | }; |
| 102 | |
| 103 | #define QXL_PARAM_NUM_SURFACES 1 /* rom->n_surfaces */ |
| 104 | #define QXL_PARAM_MAX_RELOCS 2 |
| 105 | struct drm_qxl_getparam { |
Mikko Rapeli | 8e51012 | 2015-03-11 03:12:23 +0100 | [diff] [blame] | 106 | __u64 param; |
| 107 | __u64 value; |
Dave Airlie | f64122c | 2013-02-25 14:47:55 +1000 | [diff] [blame] | 108 | }; |
| 109 | |
| 110 | /* these are one bit values */ |
| 111 | struct drm_qxl_clientcap { |
Mikko Rapeli | 8e51012 | 2015-03-11 03:12:23 +0100 | [diff] [blame] | 112 | __u32 index; |
| 113 | __u32 pad; |
Dave Airlie | f64122c | 2013-02-25 14:47:55 +1000 | [diff] [blame] | 114 | }; |
| 115 | |
| 116 | struct drm_qxl_alloc_surf { |
Mikko Rapeli | 8e51012 | 2015-03-11 03:12:23 +0100 | [diff] [blame] | 117 | __u32 format; |
| 118 | __u32 width; |
| 119 | __u32 height; |
| 120 | __s32 stride; |
| 121 | __u32 handle; |
| 122 | __u32 pad; |
Dave Airlie | f64122c | 2013-02-25 14:47:55 +1000 | [diff] [blame] | 123 | }; |
| 124 | |
| 125 | #define DRM_IOCTL_QXL_ALLOC \ |
| 126 | DRM_IOWR(DRM_COMMAND_BASE + DRM_QXL_ALLOC, struct drm_qxl_alloc) |
| 127 | |
| 128 | #define DRM_IOCTL_QXL_MAP \ |
| 129 | DRM_IOWR(DRM_COMMAND_BASE + DRM_QXL_MAP, struct drm_qxl_map) |
| 130 | |
| 131 | #define DRM_IOCTL_QXL_EXECBUFFER \ |
| 132 | DRM_IOW(DRM_COMMAND_BASE + DRM_QXL_EXECBUFFER,\ |
| 133 | struct drm_qxl_execbuffer) |
| 134 | |
| 135 | #define DRM_IOCTL_QXL_UPDATE_AREA \ |
| 136 | DRM_IOW(DRM_COMMAND_BASE + DRM_QXL_UPDATE_AREA,\ |
| 137 | struct drm_qxl_update_area) |
| 138 | |
| 139 | #define DRM_IOCTL_QXL_GETPARAM \ |
| 140 | DRM_IOWR(DRM_COMMAND_BASE + DRM_QXL_GETPARAM,\ |
| 141 | struct drm_qxl_getparam) |
| 142 | |
| 143 | #define DRM_IOCTL_QXL_CLIENTCAP \ |
| 144 | DRM_IOW(DRM_COMMAND_BASE + DRM_QXL_CLIENTCAP,\ |
| 145 | struct drm_qxl_clientcap) |
| 146 | |
| 147 | #define DRM_IOCTL_QXL_ALLOC_SURF \ |
| 148 | DRM_IOWR(DRM_COMMAND_BASE + DRM_QXL_ALLOC_SURF,\ |
| 149 | struct drm_qxl_alloc_surf) |
| 150 | |
| 151 | #endif |