| 1 | /* |
| 2 | Copyright (c) 2012, Broadcom Europe Ltd |
| 3 | All rights reserved. |
| 4 | |
| 5 | Redistribution and use in source and binary forms, with or without |
| 6 | modification, are permitted provided that the following conditions are met: |
| 7 | * Redistributions of source code must retain the above copyright |
| 8 | notice, this list of conditions and the following disclaimer. |
| 9 | * Redistributions in binary form must reproduce the above copyright |
| 10 | notice, this list of conditions and the following disclaimer in the |
| 11 | documentation and/or other materials provided with the distribution. |
| 12 | * Neither the name of the copyright holder nor the |
| 13 | names of its contributors may be used to endorse or promote products |
| 14 | derived from this software without specific prior written permission. |
| 15 | |
| 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY |
| 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 | */ |
| 27 | |
| 28 | // Display service command enumeration. |
| 29 | |
| 30 | #ifndef VC_DISPSERVICEX_DEFS_H |
| 31 | #define VC_DISPSERVICEX_DEFS_H |
| 32 | |
| 33 | #include "interface/vctypes/vc_image_types.h" |
| 34 | |
| 35 | #define HOST_PITCH_ALIGNMENT 4 |
| 36 | |
| 37 | //Round up to the nearest multiple of 16 |
| 38 | #define PAD16(x) (((x) + (VC_INTERFACE_BLOCK_SIZE-1)) & ~(VC_INTERFACE_BLOCK_SIZE-1)) |
| 39 | |
| 40 | //The max length for an effect name |
| 41 | #define DISPMANX_MAX_EFFECT_NAME (28) |
| 42 | |
| 43 | // Should really use the VC_IMAGE_TYPE_T, but this one has been extended |
| 44 | // to force it up to 32-bits... |
| 45 | typedef enum { |
| 46 | // Values initially chosen to match VC_IMAGE_TYPE_T to aid debugging |
| 47 | // This is now a mandatory constraint |
| 48 | VC_FORMAT_RGB565 = VC_IMAGE_RGB565, |
| 49 | VC_FORMAT_YUV420 = VC_IMAGE_YUV420, |
| 50 | VC_FORMAT_RGB888 = VC_IMAGE_RGB888, |
| 51 | VC_FORMAT_RGBA32 = VC_IMAGE_RGBA32, |
| 52 | VC_FORMAT_RGBA565 = VC_IMAGE_RGBA565, |
| 53 | VC_FORMAT_RGBA16 = VC_IMAGE_RGBA16, |
| 54 | VC_FORMAT_TF_RGBA32 = VC_IMAGE_TF_RGBA32, |
| 55 | VC_FORMAT_TF_RGBA16 = VC_IMAGE_TF_RGBA16, |
| 56 | VC_FORMAT_TF_RGB565 = VC_IMAGE_TF_RGB565, |
| 57 | VC_FORMAT_BGR888 = VC_IMAGE_BGR888, |
| 58 | VC_FORMAT_BGR888_NP = VC_IMAGE_BGR888_NP, |
| 59 | |
| 60 | VC_FORMAT_ARGB8888 = VC_IMAGE_ARGB8888, |
| 61 | VC_FORMAT_XRGB8888 = VC_IMAGE_XRGB8888, |
| 62 | |
| 63 | /* To force 32-bit storage, enabling use in structures over-the-wire */ |
| 64 | VC_FORMAT_RANGE_MAX = 0x7FFFFFFF |
| 65 | } VC_IMAGE_FORMAT_T; |
| 66 | |
| 67 | // Transforms. |
| 68 | /* Image transformations. These must match the DISPMAN and Media Player versions */ |
| 69 | #define TRANSFORM_HFLIP (1<<0) |
| 70 | #define TRANSFORM_VFLIP (1<<1) |
| 71 | #define TRANSFORM_TRANSPOSE (1<<2) |
| 72 | |
| 73 | #define VC_DISPMAN_ROT0 VC_IMAGE_ROT0 |
| 74 | #define VC_DISPMAN_ROT90 VC_IMAGE_ROT90 |
| 75 | #define VC_DISPMAN_ROT180 VC_IMAGE_ROT180 |
| 76 | #define VC_DISPMAN_ROT270 VC_IMAGE_ROT270 |
| 77 | #define VC_DISPMAN_MIRROR_ROT0 VC_IMAGE_MIRROR_ROT0 |
| 78 | #define VC_DISPMAN_MIRROR_ROT90 VC_IMAGE_MIRROR_ROT90 |
| 79 | #define VC_DISPMAN_MIRROR_ROT180 VC_IMAGE_MIRROR_ROT180 |
| 80 | #define VC_DISPMAN_MIRROR_ROT270 VC_IMAGE_MIRROR_ROT270 |
| 81 | #define VC_DISPMAN_TRANSFORM_T VC_IMAGE_TRANSFORM_T |
| 82 | |
| 83 | typedef enum { |
| 84 | VC_RESOURCE_TYPE_HOST, |
| 85 | VC_RESOURCE_TYPE_VIDEOCORE, |
| 86 | VC_RESOURCE_TYPE_VIDEOCORE_UNCACHED, |
| 87 | } VC_RESOURCE_TYPE_T; |
| 88 | |
| 89 | typedef struct { |
| 90 | uint8_t type; // VC_IMAGE_FORMAT_T |
| 91 | uint32_t width; // width in pixels |
| 92 | uint32_t height; // height in pixels |
| 93 | uint32_t pitch; // pitch of image_data array in *bytes* |
| 94 | uint32_t size; // number of *bytes* available in the image_data arry |
| 95 | uint32_t pointer; // pointer for image_data - this allows the object to be cast to a VC_IMAGE_T on the VIDEOCORE side |
| 96 | } VC_IMAGE_PARAM_T; |
| 97 | |
| 98 | typedef enum { |
| 99 | VC_DISPMANX_GET_DEVICES = 0, |
| 100 | VC_DISPMANX_GET_DEVICE_NAME, |
| 101 | VC_DISPMANX_GET_MODES, |
| 102 | VC_DISPMANX_GET_MODE_INFO, |
| 103 | VC_DISPMANX_DISPLAY_QUERY_IMAGE_FORMATS, |
| 104 | // Resources |
| 105 | VC_DISPMANX_RESOURCE_CREATE, |
| 106 | VC_DISPMANX_RESOURCE_WRITE_DATA, |
| 107 | VC_DISPMANX_RESOURCE_DELETE, |
| 108 | // Displays |
| 109 | VC_DISPMANX_DISPLAY_OPEN, |
| 110 | VC_DISPMANX_DISPLAY_OPEN_MODE, |
| 111 | VC_DISPMANX_DISPLAY_OPEN_OFFSCREEN, |
| 112 | VC_DISPMANX_DISPLAY_RECONFIGURE, |
| 113 | VC_DISPMANX_DISPLAY_SET_DESTINATION, |
| 114 | VC_DISPMANX_DISPLAY_SET_BACKGROUND, |
| 115 | VC_DISPMANX_DISPLAY_GET_INFO, |
| 116 | VC_DISPMANX_DISPLAY_CLOSE, |
| 117 | // Updates |
| 118 | VC_DISPMANX_UPDATE_START, |
| 119 | VC_DISPMANX_ELEMENT_ADD, |
| 120 | VC_DISPMANX_ELEMENT_CHANGE_SOURCE, |
| 121 | VC_DISPMANX_ELEMENT_MODIFIED, |
| 122 | VC_DISPMANX_ELEMENT_REMOVE, |
| 123 | VC_DISPMANX_UPDATE_SUBMIT, |
| 124 | VC_DISPMANX_UPDATE_SUBMIT_SYNC, |
| 125 | // Miscellaneous |
| 126 | VC_DISPMANX_SNAPSHOT, |
| 127 | // new features - add to end of list |
| 128 | VC_CMD_END_OF_LIST |
| 129 | } VC_CMD_CODE_T; |
| 130 | |
| 131 | /* The table of functions executed for each command. */ |
| 132 | |
| 133 | typedef void (*INTERFACE_EXECUTE_FN_T)(int, int); |
| 134 | |
| 135 | extern INTERFACE_EXECUTE_FN_T interface_execute_fn[]; |
| 136 | |
| 137 | #define DISPMANX_MAX_HOST_DEVICES 8 |
| 138 | #define DISPMANX_MAX_DEVICE_NAME_LEN 16 |
| 139 | |
| 140 | //Parameter sets for dispservice commands |
| 141 | |
| 142 | typedef struct { |
| 143 | int32_t response; |
| 144 | uint32_t ndevices; |
| 145 | uint32_t dummy[2]; |
| 146 | uint8_t names[DISPMANX_MAX_HOST_DEVICES][DISPMANX_MAX_DEVICE_NAME_LEN]; |
| 147 | } DISPMANX_GET_DEVICES_RESP_T; |
| 148 | typedef struct { |
| 149 | uint32_t device; |
| 150 | uint32_t dummy[3]; //Pad to multiple of 16 bytes |
| 151 | } DISPMANX_GET_MODES_PARAM_T; |
| 152 | typedef struct { |
| 153 | uint32_t display; |
| 154 | uint32_t mode; |
| 155 | uint32_t dummy[2]; //Pad to multiple of 16 bytes |
| 156 | } DISPMANX_GET_MODE_INFO_PARAM_T; |
| 157 | typedef struct { |
| 158 | uint32_t type; |
| 159 | uint32_t width; |
| 160 | uint32_t height; |
| 161 | uint32_t dummy[1]; // Pad to multiple of 16 bytes |
| 162 | } DISPMANX_RESOURCE_CREATE_PARAM_T; |
| 163 | typedef struct { |
| 164 | // This will be needed when we change to vchi. |
| 165 | int junk; // empty structure not allowed |
| 166 | } DISPMANX_RESOURCE_WRITE_DATA_PARAM_T; |
| 167 | typedef struct { |
| 168 | uint32_t handle; |
| 169 | uint32_t dummy[3]; //Pad to multiple of 16 bytes |
| 170 | } DISPMANX_RESOURCE_DELETE_PARAM_T; |
| 171 | typedef struct { |
| 172 | uint32_t device; |
| 173 | uint32_t dummy[3]; |
| 174 | } DISPMANX_DISPLAY_OPEN_PARAM_T; |
| 175 | typedef struct { |
| 176 | uint32_t device; |
| 177 | uint32_t mode; |
| 178 | uint32_t dummy[2]; |
| 179 | } DISPMANX_DISPLAY_OPEN_MODE_PARAM_T; |
| 180 | typedef struct { |
| 181 | uint32_t dest; |
| 182 | uint32_t orientation; |
| 183 | uint32_t dummy[2]; |
| 184 | } DISPMANX_DISPLAY_OPEN_OFFSCREEN_PARAM_T; |
| 185 | typedef struct { |
| 186 | uint32_t display; |
| 187 | uint32_t dest; |
| 188 | uint32_t dummy[2]; |
| 189 | } DISPMANX_DISPLAY_SET_DESTINATION_PARAM_T; |
| 190 | typedef struct { |
| 191 | uint32_t display; |
| 192 | uint32_t update; |
| 193 | uint32_t colour; |
| 194 | uint32_t dummy; |
| 195 | } DISPMANX_DISPLAY_SET_BACKGROUND_PARAM_T; |
| 196 | typedef struct { |
| 197 | uint32_t display; |
| 198 | uint32_t dummy[3]; |
| 199 | } DISPMANX_DISPLAY_GET_INFO_PARAM_T; |
| 200 | typedef struct { |
| 201 | uint32_t read_response; |
| 202 | int32_t width; |
| 203 | int32_t height; |
| 204 | int32_t aspect_pixwidth; |
| 205 | int32_t aspect_pixheight; |
| 206 | int32_t fieldrate_num; |
| 207 | int32_t fieldrate_denom; |
| 208 | int32_t fields_per_frame; |
| 209 | uint32_t transform; |
| 210 | uint32_t dummy[3]; |
| 211 | } DISPMANX_DISPLAY_GET_INFO_RESP_T; |
| 212 | typedef struct { |
| 213 | int32_t priority; |
| 214 | uint32_t dummy[3]; |
| 215 | } DISPMANX_UPDATE_START_PARAM_T; |
| 216 | typedef struct { |
| 217 | uint32_t update; |
| 218 | uint32_t display; |
| 219 | int32_t layer; |
| 220 | uint32_t transform; |
| 221 | uint32_t src_resource; |
| 222 | uint16_t dest_x; |
| 223 | uint16_t dest_y; |
| 224 | uint16_t dest_width; |
| 225 | uint16_t dest_height; |
| 226 | uint16_t src_x; |
| 227 | uint16_t src_y; |
| 228 | uint16_t src_width; |
| 229 | uint16_t src_height; |
| 230 | uint32_t flags; |
| 231 | uint32_t opacity; |
| 232 | uint32_t mask_resource; |
| 233 | // already 16 byte aligned |
| 234 | } DISPMANX_ELEMENT_ADD_PARAM_T; |
| 235 | typedef struct { |
| 236 | uint32_t update; |
| 237 | uint32_t element; |
| 238 | uint32_t src_resource; |
| 239 | uint32_t dummy; // pad to 16 bytes |
| 240 | } DISPMANX_ELEMENT_CHANGE_SOURCE_PARAM_T; |
| 241 | typedef struct { |
| 242 | uint32_t update; |
| 243 | uint32_t element; |
| 244 | uint16_t x; |
| 245 | uint16_t y; |
| 246 | uint16_t width; |
| 247 | uint16_t height; |
| 248 | } DISPMANX_ELEMENT_MODIFIED_PARAM_T; |
| 249 | typedef struct { |
| 250 | uint32_t update; |
| 251 | uint32_t element; |
| 252 | uint32_t dummy[2]; |
| 253 | } DISPMANX_ELEMENT_REMOVE_PARAM_T; |
| 254 | typedef struct { |
| 255 | uint32_t update; |
| 256 | uint32_t dummy[3]; |
| 257 | } DISPMANX_UPDATE_SUBMIT_PARAM_T; |
| 258 | typedef struct { |
| 259 | uint32_t update; |
| 260 | uint32_t dummy[3]; |
| 261 | } DISPMANX_UPDATE_SUBMIT_SYNC_PARAM_T; |
| 262 | typedef struct { |
| 263 | uint32_t display; |
| 264 | uint32_t snapshot_resource; |
| 265 | uint32_t transform; |
| 266 | uint32_t dummy[1]; |
| 267 | } DISPMANX_DISPLAY_SNAPSHOT_PARAM_T; |
| 268 | |
| 269 | // for dispmanx |
| 270 | |
| 271 | #define TRANSFORM_HFLIP (1<<0) |
| 272 | #define TRANSFORM_VFLIP (1<<1) |
| 273 | #define TRANSFORM_TRANSPOSE (1<<2) |
| 274 | |
| 275 | |
| 276 | #endif //VC_DISPSERVICEX_DEFS_H |
| 277 | |