1 /* 2 * Copyright (c) 2009-2017, Intel Corporation 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice shall be included 12 * in all copies or substantial portions of the Software. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 * OTHER DEALINGS IN THE SOFTWARE. 21 */ 22 //! 23 //! \file media_libva_putsurface_linux.h 24 //! \brief libva(and its extension) putsurface linux implementaion head file 25 //! 26 #ifndef __MEDIA_LIBVA_PUTSURFACE_LINUX_H__ 27 #define __MEDIA_LIBVA_PUTSURFACE_LINUX_H__ 28 29 #include <va/va.h> 30 #include <va/va_backend.h> 31 #include <va/va_dricommon.h> 32 #include "mos_defs.h" 33 34 #define LIBVA_X11_NAME "libva-x11.so.2" 35 typedef struct dri_drawable *(*dri_get_drawable_func)( 36 VADriverContextP ctx, XID drawable); 37 typedef union dri_buffer *(*dri_get_rendering_buffer_func)( 38 VADriverContextP ctx, struct dri_drawable *d); 39 typedef void (*dri_swap_buffer_func)( 40 VADriverContextP ctx, struct dri_drawable *d); 41 42 //! 43 //! \struct dri_vtable 44 //! \brief VA api driver table 45 //! 46 struct dri_vtable { 47 dri_get_drawable_func get_drawable; 48 dri_get_rendering_buffer_func get_rendering_buffer; 49 dri_swap_buffer_func swap_buffer; 50 }; 51 52 //! 53 //! \struct va_dri_output 54 //! \brief VA driver output 55 //! 56 struct va_dri_output { 57 struct dso_handle *handle; 58 struct dri_vtable vtable; 59 }; 60 61 //! 62 //! \struct dso_symbol 63 //! \brief Symbol lookup table 64 //! 65 struct dso_symbol { 66 /** Symbol name */ 67 const char *name; 68 /** Offset into the supplied vtable where symbol is to be loaded. */ 69 uint32_t offset; 70 }; 71 72 #include <dlfcn.h> 73 //#include "dso_utils.h" 74 /** Generic pointer to function. */ 75 typedef void (*dso_generic_func)(void); 76 77 //! 78 //! \struct dso_handle 79 //! \brief Dso handle 80 //! 81 struct dso_handle { 82 void *handle; 83 }; 84 85 //! 86 //! \brief Output driver initialization 87 //! 88 //! \param [in] ctx 89 //! Pointer to VA driver context 90 //! 91 //! \return bool 92 //! true if call success, else false 93 //! 94 bool output_dri_init(VADriverContextP ctx); 95 //! 96 //! \brief Closes and disposed any allocated data 97 //! 98 //! \param [in] h 99 //! Dso handle 100 //! 101 void dso_close(struct dso_handle *h); 102 103 //! 104 //! \brief Rectangle initialization 105 //! 106 //! \param [in] Rect 107 //! Rectangle 108 //! \param [in] destx 109 //! Destination X 110 //! \param [in] desty 111 //! Destination Y 112 //! \param [in] destw 113 //! Destination W 114 //! \param [in] desth 115 //! Destination H 116 //! 117 void Rect_init( 118 RECT *Rect, 119 int16_t destx, 120 int16_t desty, 121 uint16_t destw, 122 uint16_t desth 123 ); 124 125 typedef GC (*TypeXCreateGC)(Display*, Drawable, unsigned long, XGCValues*); 126 typedef int32_t (*TypeXFreeGC)(Display*, GC); 127 typedef XImage* (*TypeXCreateImage)(Display*, Visual*, uint32_t, int32_t, int32_t, 128 char*, uint32_t, uint32_t, int32_t, int32_t); 129 typedef int32_t (*TypeXDestroyImage)(XImage*); 130 typedef int32_t (*TypeXPutImage)(Display*, Drawable, GC, XImage*, int32_t, int32_t, int32_t, int32_t, 131 uint32_t, uint32_t); 132 133 //! \brief Ddi codec put surface linux vphal ext 134 //! 135 //! \param ctx 136 //! Pointer to VA driver context 137 //! \param surface 138 //! VA surface ID 139 //! \param draw 140 //! Drawable of window system 141 //! \param srcx 142 //! Source X of the region 143 //! \param srcy 144 //! Source Y of the region 145 //! \param srcw 146 //! Source W of the region 147 //! \param srch 148 //! Source H of the region 149 //! \param destx 150 //! Destination X 151 //! \param desty 152 //! Destination Y 153 //! \param destw 154 //! Destination W 155 //! \param desth 156 //! Destination H 157 //! \param cliprects 158 //! Client-supplied clip list 159 //! \param number_cliprects 160 //! Number of clip rects in the clip list 161 //! \param flags 162 //! De-interlacing flags 163 //! 164 //! \return VAStatus 165 //! VA_STATUS_SUCCESS if success, else fail reason 166 //! 167 VAStatus DdiCodec_PutSurfaceLinuxVphalExt( 168 VADriverContextP ctx, 169 VASurfaceID surface, 170 void *draw, /* Drawable of window system */ 171 int16_t srcx, 172 int16_t srcy, 173 uint16_t srcw, 174 uint16_t srch, 175 int16_t destx, 176 int16_t desty, 177 uint16_t destw, 178 uint16_t desth, 179 VARectangle *cliprects, /* client supplied clip list */ 180 uint32_t number_cliprects, /* number of clip rects in the clip list */ 181 uint32_t flags /* de-interlacing flags */ 182 ); 183 184 //! \brief Ddi codec put surface linux hardware 185 //! 186 //! \param ctx 187 //! Pointer to VA driver context 188 //! \param surface 189 //! VA surface ID 190 //! \param draw 191 //! Drawable of window system 192 //! \param srcx 193 //! Source X of the region 194 //! \param srcy 195 //! Source Y of the region 196 //! \param srcw 197 //! Source W of the region 198 //! \param srch 199 //! Source H of the region 200 //! \param destx 201 //! Destination X 202 //! \param desty 203 //! Destination Y 204 //! \param destw 205 //! Destination W 206 //! \param desth 207 //! Destination H 208 //! \param cliprects 209 //! Client-supplied clip list 210 //! \param number_cliprects 211 //! Number of clip rects in the clip list 212 //! \param flags 213 //! De-interlacing flags 214 //! 215 //! \return VAStatus 216 //! VA_STATUS_SUCCESS if success, else fail reason 217 //! 218 VAStatus DdiCodec_PutSurfaceLinuxHW( 219 VADriverContextP ctx, 220 VASurfaceID surface, 221 void* draw, /* Drawable of window system */ 222 int16_t srcx, 223 int16_t srcy, 224 uint16_t srcw, 225 uint16_t srch, 226 int16_t destx, 227 int16_t desty, 228 uint16_t destw, 229 uint16_t desth, 230 VARectangle *cliprects, /* client supplied clip list */ 231 uint32_t number_cliprects, /* number of clip rects in the clip list */ 232 uint32_t flags /* de-interlacing flags */ 233 ); 234 235 #ifndef ANDROID 236 //! \brief Ddi codec put surface linux software 237 //! 238 //! \param ctx 239 //! Pointer to VA driver context 240 //! \param surface 241 //! VA surface ID 242 //! \param draw 243 //! Drawable of window system 244 //! \param srcx 245 //! Source X of the region 246 //! \param srcy 247 //! Source Y of the region 248 //! \param srcw 249 //! Source W of the region 250 //! \param srch 251 //! Source H of the region 252 //! \param destx 253 //! Destination X 254 //! \param desty 255 //! Destination Y 256 //! \param destw 257 //! Destination W 258 //! \param desth 259 //! Destination H 260 //! \param cliprects 261 //! Client-supplied clip list 262 //! \param number_cliprects 263 //! Number of clip rects in the clip list 264 //! \param flags 265 //! De-interlacing flags 266 //! 267 //! \return VAStatus 268 //! VA_STATUS_SUCCESS if success, else fail reason 269 //! 270 VAStatus DdiMedia_PutSurfaceLinuxSW( 271 VADriverContextP ctx, 272 VASurfaceID surface, 273 void* draw, /* Drawable of window system */ 274 int16_t srcx, 275 int16_t srcy, 276 uint16_t srcw, 277 uint16_t srch, 278 int16_t destx, 279 int16_t desty, 280 uint16_t destw, 281 uint16_t desth, 282 VARectangle *cliprects, /* client supplied clip list */ 283 uint32_t number_cliprects, /* number of clip rects in the clip list */ 284 uint32_t flags /* de-interlacing flags */ 285 ); 286 287 //! \brief Ddi codec put surface dummy 288 //! 289 //! \param ctx 290 //! Pointer to VA driver context 291 //! \param surface 292 //! VA surface ID 293 //! \param draw 294 //! Drawable of window system 295 //! \param srcx 296 //! Source X of the region 297 //! \param srcy 298 //! Source Y of the region 299 //! \param srcw 300 //! Source W of the region 301 //! \param srch 302 //! Source H of the region 303 //! \param destx 304 //! Destination X 305 //! \param desty 306 //! Destination Y 307 //! \param destw 308 //! Destination W 309 //! \param desth 310 //! Destination H 311 //! \param cliprects 312 //! Client-supplied clip list 313 //! \param number_cliprects 314 //! Number of clip rects in the clip list 315 //! \param flags 316 //! De-interlacing flags 317 //! 318 //! \return VAStatus 319 //! VA_STATUS_SUCCESS if success, else fail reason 320 //! 321 VAStatus DdiMedia_PutSurfaceDummy( 322 VADriverContextP ctx, 323 VASurfaceID surface, 324 void *draw, /* Drawable of window system */ 325 int16_t srcx, 326 int16_t srcy, 327 uint16_t srcw, 328 uint16_t srch, 329 int16_t destx, 330 int16_t desty, 331 uint16_t destw, 332 uint16_t desth, 333 VARectangle *cliprects, /* client supplied clip list */ 334 uint32_t number_cliprects, /* number of clip rects in the clip list */ 335 uint32_t flags /* de-interlacing flags */ 336 ); 337 #endif 338 339 #endif 340 341