diff options
Diffstat (limited to 'meta-emenlow/packages/libva/libva-0.31.0/391_compat.patch')
| -rw-r--r-- | meta-emenlow/packages/libva/libva-0.31.0/391_compat.patch | 3273 |
1 files changed, 3273 insertions, 0 deletions
diff --git a/meta-emenlow/packages/libva/libva-0.31.0/391_compat.patch b/meta-emenlow/packages/libva/libva-0.31.0/391_compat.patch new file mode 100644 index 0000000000..5e09d22b82 --- /dev/null +++ b/meta-emenlow/packages/libva/libva-0.31.0/391_compat.patch | |||
| @@ -0,0 +1,3273 @@ | |||
| 1 | commit 2e7aa803a8547dfcde6e97ae2bb4a8bbdbb2634e | ||
| 2 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
| 3 | Date: Mon Nov 23 12:22:09 2009 +0000 | ||
| 4 | |||
| 5 | Update compat code for VDPAU/MPEG-4 additions. | ||
| 6 | |||
| 7 | commit 30808b39d82cbf0c185052a2d2d5ed8a5fc065d1 | ||
| 8 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
| 9 | Date: Thu Sep 10 14:01:57 2009 +0000 | ||
| 10 | |||
| 11 | Update compatibility glue for VASliceParameterBufferMPEG2.slice_horizontal_position addition. | ||
| 12 | |||
| 13 | commit 27faf49366602637da223f3dc5f30ce4d6d72070 | ||
| 14 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
| 15 | Date: Wed Sep 2 15:06:20 2009 +0000 | ||
| 16 | |||
| 17 | Fix vaSyncSurface() compat code for VA API < 0.31 drivers. | ||
| 18 | |||
| 19 | commit dc33a3e28b38b7d579ab768899963cf9b0d38677 | ||
| 20 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
| 21 | Date: Wed Sep 2 12:28:43 2009 +0000 | ||
| 22 | |||
| 23 | Fix check for 0.30 modules. | ||
| 24 | |||
| 25 | commit bd913971bd9e7460b454513b006e16c18136625e | ||
| 26 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
| 27 | Date: Wed Sep 2 11:58:08 2009 +0000 | ||
| 28 | |||
| 29 | Update for VA API 0.31. | ||
| 30 | |||
| 31 | commit 9cc7f89d3cc0238ab5b3a47c316e261e06a16634 | ||
| 32 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
| 33 | Date: Thu Jul 2 15:55:48 2009 +0000 | ||
| 34 | |||
| 35 | Fix VAEncSliceParameterBuffer thunk. | ||
| 36 | |||
| 37 | commit 483bc9e67afa9bcd8f99f08a74a78e7dfad4651f | ||
| 38 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
| 39 | Date: Thu Jul 2 09:24:04 2009 +0000 | ||
| 40 | |||
| 41 | Fix make dist (va_compat_template.h). | ||
| 42 | |||
| 43 | commit 7f41b22366142c4e476fbae929ad343dc33af3a4 | ||
| 44 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
| 45 | Date: Thu Jun 25 14:05:57 2009 +0000 | ||
| 46 | |||
| 47 | Drop superfluous semi-colon. | ||
| 48 | |||
| 49 | commit dcc75aae23fc8f653179b6a331f4021acd6775fd | ||
| 50 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
| 51 | Date: Thu Jun 25 13:53:26 2009 +0000 | ||
| 52 | |||
| 53 | Fix check for 0.30 modules. | ||
| 54 | |||
| 55 | commit b34512e74ac4150a3f8ee4abe4fa5b17907f8869 | ||
| 56 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
| 57 | Date: Thu Jun 25 13:17:48 2009 +0000 | ||
| 58 | |||
| 59 | Fix vaTerminate() thunk. | ||
| 60 | |||
| 61 | commit 3b006d1ac66429f6b8ffff00ce60e1e47a32c02c | ||
| 62 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
| 63 | Date: Thu Jun 25 12:48:22 2009 +0000 | ||
| 64 | |||
| 65 | Cosmetics. | ||
| 66 | |||
| 67 | commit 452295d5ac34643f8a316491888c3900f12c5bff | ||
| 68 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
| 69 | Date: Thu Jun 25 12:18:48 2009 +0000 | ||
| 70 | |||
| 71 | Fix compatibility with 0.29 modules. | ||
| 72 | |||
| 73 | commit 0e0da9ea861f14e8129767dbf6f11be5c051d85f | ||
| 74 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
| 75 | Date: Wed Jun 24 11:40:56 2009 +0000 | ||
| 76 | |||
| 77 | Add compatibility layer with original libva 0.29. | ||
| 78 | |||
| 79 | diff --git a/src/va_compat.c b/src/va_compat.c | ||
| 80 | new file mode 100644 | ||
| 81 | index 0000000..0bd7385 | ||
| 82 | --- /dev/null | ||
| 83 | +++ b/src/va_compat.c | ||
| 84 | @@ -0,0 +1,1171 @@ | ||
| 85 | +/* | ||
| 86 | + * Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved. | ||
| 87 | + * | ||
| 88 | + * Permission is hereby granted, free of charge, to any person obtaining a | ||
| 89 | + * copy of this software and associated documentation files (the | ||
| 90 | + * "Software"), to deal in the Software without restriction, including | ||
| 91 | + * without limitation the rights to use, copy, modify, merge, publish, | ||
| 92 | + * distribute, sub license, and/or sell copies of the Software, and to | ||
| 93 | + * permit persons to whom the Software is furnished to do so, subject to | ||
| 94 | + * the following conditions: | ||
| 95 | + * | ||
| 96 | + * The above copyright notice and this permission notice (including the | ||
| 97 | + * next paragraph) shall be included in all copies or substantial portions | ||
| 98 | + * of the Software. | ||
| 99 | + * | ||
| 100 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
| 101 | + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
| 102 | + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. | ||
| 103 | + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR | ||
| 104 | + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
| 105 | + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
| 106 | + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 107 | + */ | ||
| 108 | + | ||
| 109 | +#include "config.h" | ||
| 110 | +#include "va.h" | ||
| 111 | +#include "va_compat.h" | ||
| 112 | +#include "va_backend.h" | ||
| 113 | +#include <string.h> | ||
| 114 | +#include <alloca.h> | ||
| 115 | +#include <assert.h> | ||
| 116 | + | ||
| 117 | +#define CTX(dpy) (((VADisplayContextP)dpy)->pDriverContext) | ||
| 118 | +#define COMPAT_CTX(ctx) ((VACompatContextP)(ctx)->compat) | ||
| 119 | +#define ASSERT assert | ||
| 120 | + | ||
| 121 | +/* Invoke the normal VA API entry-point. This one can be replaced with | ||
| 122 | + one of the va_compat_*() functions */ | ||
| 123 | +#define VA_INVOKE(FUNC, CTX, ...) \ | ||
| 124 | + (CTX)->vtable.FUNC(CTX, __VA_ARGS__) | ||
| 125 | + | ||
| 126 | +/* Invoke the real VA API entry-point. That is, the driver's function */ | ||
| 127 | +#define VA_INVOKE_COMPAT_ARGS(CTX, ...) \ | ||
| 128 | + (COMPAT_CTX(CTX)->compat_ctx, __VA_ARGS__) | ||
| 129 | +#define VA_INVOKE_COMPAT(FUNC, CTX, ...) \ | ||
| 130 | + COMPAT_CTX(CTX)->vtable.FUNC VA_INVOKE_COMPAT_ARGS(CTX, __VA_ARGS__) | ||
| 131 | + | ||
| 132 | +typedef struct VACompatContext *VACompatContextP; | ||
| 133 | + | ||
| 134 | +typedef VAStatus (*VABufferTranslateFunc)(VACompatContextP ctx, void *dest, const void *src); | ||
| 135 | + | ||
| 136 | +typedef enum { | ||
| 137 | + VA_DRIVER_ID_UNKNOWN, | ||
| 138 | + VA_DRIVER_ID_POULSBO, | ||
| 139 | + VA_DRIVER_ID_IEGD | ||
| 140 | +} VADriverID; | ||
| 141 | + | ||
| 142 | +typedef struct { | ||
| 143 | + VABufferID id; | ||
| 144 | + VABufferType type; | ||
| 145 | + unsigned int size; | ||
| 146 | + unsigned int num_elements; | ||
| 147 | + unsigned char *data; | ||
| 148 | + VABufferTranslateFunc translate; | ||
| 149 | + VABufferID compat_id; | ||
| 150 | + unsigned int compat_size; | ||
| 151 | + unsigned char *compat_data; | ||
| 152 | + unsigned int map_count; | ||
| 153 | +} VABufferCompat; | ||
| 154 | + | ||
| 155 | +typedef struct VAContextMap *VAContextMapP; | ||
| 156 | +typedef struct VAContextMap { | ||
| 157 | + VASurfaceID surface; | ||
| 158 | + VAContextID context; | ||
| 159 | + VAContextMapP next; | ||
| 160 | +} VAContextMap; | ||
| 161 | + | ||
| 162 | +typedef struct { | ||
| 163 | + VAStatus (*vaTerminate)(void *); | ||
| 164 | + VAStatus (*vaQueryConfigProfiles)(void *, VAProfile *, int *); | ||
| 165 | + VAStatus (*vaQueryConfigEntrypoints)(void *, VAProfile, VAEntrypoint *, int *); | ||
| 166 | + VAStatus (*vaGetConfigAttributes)(void *, VAProfile, VAEntrypoint, VAConfigAttrib *, int); | ||
| 167 | + VAStatus (*vaCreateConfig)(void *, VAProfile, VAEntrypoint, VAConfigAttrib *, int, VAConfigID *); | ||
| 168 | + VAStatus (*vaDestroyConfig)(void *, VAConfigID); | ||
| 169 | + VAStatus (*vaQueryConfigAttributes)(void *, VAConfigID, VAProfile *, VAEntrypoint *, VAConfigAttrib *, int *); | ||
| 170 | + VAStatus (*vaCreateSurfaces)(void *, int, int, int, int, VASurfaceID *); | ||
| 171 | + VAStatus (*vaDestroySurfaces)(void *, VASurfaceID *, int); | ||
| 172 | + VAStatus (*vaCreateContext)(void *, VAConfigID, int, int, int, VASurfaceID *, int, VAContextID *); | ||
| 173 | + VAStatus (*vaDestroyContext)(void *, VAContextID); | ||
| 174 | + VAStatus (*vaCreateBuffer)(void *, VAContextID, VABufferType, unsigned int, unsigned int, void *, VABufferID *); | ||
| 175 | + VAStatus (*vaBufferSetNumElements)(void *, VABufferID, unsigned int); | ||
| 176 | + VAStatus (*vaMapBuffer)(void *, VABufferID, void **); | ||
| 177 | + VAStatus (*vaUnmapBuffer)(void *, VABufferID); | ||
| 178 | + VAStatus (*vaDestroyBuffer)(void *, VABufferID); | ||
| 179 | + VAStatus (*vaBeginPicture)(void *, VAContextID, VASurfaceID); | ||
| 180 | + VAStatus (*vaRenderPicture)(void *, VAContextID, VABufferID *, int); | ||
| 181 | + VAStatus (*vaEndPicture)(void *, VAContextID); | ||
| 182 | + VAStatus (*vaSyncSurface_pre31)(void *, VAContextID, VASurfaceID); | ||
| 183 | + VAStatus (*vaQuerySurfaceStatus)(void *, VASurfaceID, VASurfaceStatus *); | ||
| 184 | + VAStatus (*vaPutSurface)(void *, VASurfaceID, unsigned long, short, short, unsigned short, unsigned short, short, short, unsigned short, unsigned short, VARectangle *, unsigned int, unsigned int); | ||
| 185 | + VAStatus (*vaQueryImageFormats)(void *, VAImageFormat *, int *); | ||
| 186 | + VAStatus (*vaCreateImage)(void *, VAImageFormat *, int, int, VAImage *); | ||
| 187 | + VAStatus (*vaDeriveImage)(void *, VASurfaceID, VAImage *); | ||
| 188 | + VAStatus (*vaDestroyImage)(void *, VAImageID); | ||
| 189 | + VAStatus (*vaSetImagePalette)(void *, VAImageID, unsigned char *); | ||
| 190 | + VAStatus (*vaGetImage)(void *, VASurfaceID, int, int, unsigned int, unsigned int, VAImageID); | ||
| 191 | + VAStatus (*vaPutImage_pre31)(void *, VASurfaceID, VAImageID, int, int, unsigned int, unsigned int, int, int); | ||
| 192 | + VAStatus (*vaPutImage2_pre31)(void *, VASurfaceID, VAImageID, int, int, unsigned int, unsigned int, int, int, unsigned int, unsigned int); | ||
| 193 | + VAStatus (*vaQuerySubpictureFormats)(void *, VAImageFormat *, unsigned int *, unsigned int *); | ||
| 194 | + VAStatus (*vaCreateSubpicture)(void *, VAImageID, VASubpictureID *); | ||
| 195 | + VAStatus (*vaDestroySubpicture)(void *, VASubpictureID); | ||
| 196 | + VAStatus (*vaSetSubpictureImage)(void *, VASubpictureID, VAImageID); | ||
| 197 | + VAStatus (*vaSetSubpictureChromakey)(void *, VASubpictureID, unsigned int, unsigned int, unsigned int); | ||
| 198 | + VAStatus (*vaSetSubpictureGlobalAlpha)(void *, VASubpictureID, float); | ||
| 199 | + VAStatus (*vaAssociateSubpicture_pre31)(void *, VASubpictureID, VASurfaceID *, int, short, short, short, short, unsigned short, unsigned short, unsigned int); | ||
| 200 | + VAStatus (*vaAssociateSubpicture2_pre31)(void *, VASubpictureID, VASurfaceID *, int, short, short, unsigned short, unsigned short, short, short, unsigned short, unsigned short, unsigned int); | ||
| 201 | + VAStatus (*vaDeassociateSubpicture)(void *, VASubpictureID, VASurfaceID *, int); | ||
| 202 | + VAStatus (*vaQueryDisplayAttributes)(void *, VADisplayAttribute *, int *); | ||
| 203 | + VAStatus (*vaGetDisplayAttributes)(void *, VADisplayAttribute *, int); | ||
| 204 | + VAStatus (*vaSetDisplayAttributes)(void *, VADisplayAttribute *, int); | ||
| 205 | + | ||
| 206 | + /* 0.29 hooks */ | ||
| 207 | + VAStatus (*vaSetSubpicturePalette)(void *, VASubpictureID, unsigned char *); | ||
| 208 | + VAStatus (*vaDbgCopySurfaceToBuffer)(void *, VASurfaceID, void **, unsigned int *); | ||
| 209 | + | ||
| 210 | + /* 0.30 hooks */ | ||
| 211 | + VAStatus (*vaCreateSurfaceFromCIFrame)(void *, unsigned long, VASurfaceID *); | ||
| 212 | + VAStatus (*vaCreateSurfaceFromV4L2Buf)(void *, int, struct v4l2_format *, struct v4l2_buffer *, VASurfaceID *); | ||
| 213 | + VAStatus (*vaCopySurfaceToBuffer)(void *, VASurfaceID, unsigned int *, unsigned int *, unsigned int *, unsigned int *, unsigned int *, unsigned int *, unsigned int *, void **); | ||
| 214 | + | ||
| 215 | + /* 0.31 hooks */ | ||
| 216 | + VAStatus (*vaPutImage)(void *, VASurfaceID, VAImageID, int, int, unsigned int, unsigned int, int, int, unsigned int, unsigned int); | ||
| 217 | + VAStatus (*vaAssociateSubpicture)(void *, VASubpictureID, VASurfaceID *, int, short, short, unsigned short, unsigned short, short, short, unsigned short, unsigned short, unsigned int); | ||
| 218 | + VAStatus (*vaSyncSurface)(void *, VASurfaceID); | ||
| 219 | +} VACompatDriverVTable; | ||
| 220 | + | ||
| 221 | +typedef struct VACompatContext { | ||
| 222 | + VABufferCompat *buffers; | ||
| 223 | + unsigned int buffers_count_max; | ||
| 224 | + unsigned int compat_version; | ||
| 225 | + void *compat_ctx; | ||
| 226 | + VACompatDriverVTable vtable; /* original vtable */ | ||
| 227 | + VADriverID driver_id; | ||
| 228 | + char *driver_name; | ||
| 229 | + VAContextMapP context_map; | ||
| 230 | + VAContextMapP last_context_map_match; | ||
| 231 | + unsigned int skip_frame : 1; | ||
| 232 | +} VACompatContext; | ||
| 233 | + | ||
| 234 | +#define COMPAT_MAJOR 0 | ||
| 235 | +#define COMPAT_MINOR 29 | ||
| 236 | +#include "va_compat_template.h" | ||
| 237 | + | ||
| 238 | +#define COMPAT_MAJOR 0 | ||
| 239 | +#define COMPAT_MINOR 30 | ||
| 240 | +#include "va_compat_template.h" | ||
| 241 | + | ||
| 242 | +#define COMPAT_MAJOR 0 | ||
| 243 | +#define COMPAT_MINOR 31 | ||
| 244 | +#include "va_compat_template.h" | ||
| 245 | + | ||
| 246 | +static inline int va_IsIntelBuffer(VADriverContextP ctx, VABufferID id) | ||
| 247 | +{ | ||
| 248 | + VACompatContextP compat = ctx->compat; | ||
| 249 | + | ||
| 250 | + if (compat->driver_id == VA_DRIVER_ID_POULSBO) { | ||
| 251 | + /* There were only Intel implementations for VA API. Besides, the | ||
| 252 | + returned buffer IDs had the following format [ 0 BASE ID ] where | ||
| 253 | + BASE is the 7-bit value 0x04 and ID an index into the heap of | ||
| 254 | + objects */ | ||
| 255 | + return (id & 0x7f000000) == 0x04000000; | ||
| 256 | + } | ||
| 257 | + | ||
| 258 | + if (compat->driver_id == VA_DRIVER_ID_IEGD) { | ||
| 259 | + /* XXX: there is no means to differentiate the buffers, they | ||
| 260 | + are linearly generated (IEGD 10.0 build 1335) */ | ||
| 261 | + return 1; | ||
| 262 | + } | ||
| 263 | + | ||
| 264 | + return 0; | ||
| 265 | +} | ||
| 266 | + | ||
| 267 | +static VAContextMapP va_context_map_lookup_p( | ||
| 268 | + VACompatContextP ctx, | ||
| 269 | + VASurfaceID surface | ||
| 270 | +) | ||
| 271 | +{ | ||
| 272 | + VAContextMapP m = ctx->context_map; | ||
| 273 | + | ||
| 274 | + while (m) { | ||
| 275 | + if (m->surface == surface) | ||
| 276 | + return m; | ||
| 277 | + m = m->next; | ||
| 278 | + } | ||
| 279 | + return NULL; | ||
| 280 | +} | ||
| 281 | + | ||
| 282 | +static VAContextID va_context_map_lookup( | ||
| 283 | + VACompatContextP ctx, | ||
| 284 | + VASurfaceID surface | ||
| 285 | +) | ||
| 286 | +{ | ||
| 287 | + VAContextMapP m; | ||
| 288 | + | ||
| 289 | + /* Lookup in cached */ | ||
| 290 | + m = ctx->last_context_map_match; | ||
| 291 | + if (m && m->surface == surface) | ||
| 292 | + return m->context; | ||
| 293 | + | ||
| 294 | + /* Full (slow) lookup */ | ||
| 295 | + m = va_context_map_lookup_p(ctx, surface); | ||
| 296 | + if (m) { | ||
| 297 | + ctx->last_context_map_match = m; | ||
| 298 | + return m->context; | ||
| 299 | + } | ||
| 300 | + return VA_INVALID_ID; | ||
| 301 | +} | ||
| 302 | + | ||
| 303 | +static void va_context_map_add( | ||
| 304 | + VACompatContextP ctx, | ||
| 305 | + VAContextID context, | ||
| 306 | + VASurfaceID surface | ||
| 307 | +) | ||
| 308 | +{ | ||
| 309 | + VAContextMapP m; | ||
| 310 | + | ||
| 311 | + /* Update existing entry */ | ||
| 312 | + m = va_context_map_lookup_p(ctx, surface); | ||
| 313 | + if (m) { | ||
| 314 | + m->context = context; | ||
| 315 | + return; | ||
| 316 | + } | ||
| 317 | + | ||
| 318 | + /* Create new mapping */ | ||
| 319 | + m = malloc(sizeof(*m)); | ||
| 320 | + ASSERT(m); | ||
| 321 | + if (m) { | ||
| 322 | + m->surface = surface; | ||
| 323 | + m->context = context; | ||
| 324 | + m->next = ctx->context_map; | ||
| 325 | + ctx->context_map = m; | ||
| 326 | + } | ||
| 327 | +} | ||
| 328 | + | ||
| 329 | +static void va_context_map_remove( | ||
| 330 | + VACompatContextP ctx, | ||
| 331 | + VAContextID context | ||
| 332 | +) | ||
| 333 | +{ | ||
| 334 | + VAContextMapP p = NULL; | ||
| 335 | + VAContextMapP m = ctx->context_map; | ||
| 336 | + VAContextMapP d; | ||
| 337 | + | ||
| 338 | + while (m) { | ||
| 339 | + if (m->context == context) { | ||
| 340 | + d = m; | ||
| 341 | + | ||
| 342 | + /* Unlink current node */ | ||
| 343 | + if (p) | ||
| 344 | + p->next = m->next; | ||
| 345 | + else | ||
| 346 | + ctx->context_map = m->next; | ||
| 347 | + m = m->next; | ||
| 348 | + | ||
| 349 | + /* Reset cache */ | ||
| 350 | + if (ctx->last_context_map_match == d) | ||
| 351 | + ctx->last_context_map_match = NULL; | ||
| 352 | + | ||
| 353 | + free(d); | ||
| 354 | + } | ||
| 355 | + else { | ||
| 356 | + p = m; | ||
| 357 | + m = m->next; | ||
| 358 | + } | ||
| 359 | + } | ||
| 360 | +} | ||
| 361 | + | ||
| 362 | +static VABufferCompat *va_GetBufferCompat ( | ||
| 363 | + VADriverContextP ctx, | ||
| 364 | + VABufferID id | ||
| 365 | +) | ||
| 366 | +{ | ||
| 367 | + VACompatContextP compat = ctx->compat; | ||
| 368 | + int index; | ||
| 369 | + | ||
| 370 | + if (!va_IsIntelBuffer(ctx, id)) | ||
| 371 | + return NULL; | ||
| 372 | + | ||
| 373 | + index = id & 0x00ffffff; | ||
| 374 | + if (index >= compat->buffers_count_max) | ||
| 375 | + return NULL; | ||
| 376 | + | ||
| 377 | + if (compat->buffers[index].id != id) | ||
| 378 | + return NULL; | ||
| 379 | + | ||
| 380 | + return &compat->buffers[index]; | ||
| 381 | +} | ||
| 382 | + | ||
| 383 | +static VAStatus va_TranslateBufferCompat ( | ||
| 384 | + VADriverContextP ctx, | ||
| 385 | + VABufferCompat *compat_buffer | ||
| 386 | +) | ||
| 387 | +{ | ||
| 388 | + VAStatus status; | ||
| 389 | + unsigned char *src, *dest; | ||
| 390 | + int i; | ||
| 391 | + | ||
| 392 | + status = VA_INVOKE(vaMapBuffer, ctx, compat_buffer->id, (void **)&src); | ||
| 393 | + if (status != VA_STATUS_SUCCESS) | ||
| 394 | + return status; | ||
| 395 | + | ||
| 396 | + ASSERT(compat_buffer->data); | ||
| 397 | + ASSERT(src == compat_buffer->data); | ||
| 398 | + ASSERT(compat_buffer->compat_data); | ||
| 399 | + dest = compat_buffer->compat_data; | ||
| 400 | + for (i = 0; i < compat_buffer->num_elements; i++) | ||
| 401 | + { | ||
| 402 | + /* XXX: check errors */ | ||
| 403 | + status = compat_buffer->translate(ctx->compat, dest, src); | ||
| 404 | + | ||
| 405 | + src += compat_buffer->size; | ||
| 406 | + dest += compat_buffer->compat_size; | ||
| 407 | + } | ||
| 408 | + | ||
| 409 | + return VA_INVOKE(vaUnmapBuffer, ctx, compat_buffer->id); | ||
| 410 | +} | ||
| 411 | + | ||
| 412 | +static VAStatus va_CreateBufferCompat ( | ||
| 413 | + VADriverContextP ctx, | ||
| 414 | + VAContextID context, | ||
| 415 | + VABufferID id, | ||
| 416 | + VABufferType type, | ||
| 417 | + unsigned int size, | ||
| 418 | + unsigned int num_elements, | ||
| 419 | + unsigned int compat_size, | ||
| 420 | + VABufferTranslateFunc translate_func | ||
| 421 | +) | ||
| 422 | +{ | ||
| 423 | + VACompatContextP compat = ctx->compat; | ||
| 424 | + VABufferCompat *compat_buffer; | ||
| 425 | + int index; | ||
| 426 | + | ||
| 427 | + if (!va_IsIntelBuffer(ctx, id)) | ||
| 428 | + return VA_STATUS_ERROR_INVALID_BUFFER; | ||
| 429 | + index = id & 0x00ffffff; | ||
| 430 | + | ||
| 431 | + /* XXX: this allocation strategy is not really space efficient... */ | ||
| 432 | + if (index >= compat->buffers_count_max) | ||
| 433 | + { | ||
| 434 | + compat->buffers_count_max = index + 1; | ||
| 435 | + compat->buffers = realloc(compat->buffers, | ||
| 436 | + (compat->buffers_count_max * | ||
| 437 | + sizeof(VABufferCompat))); | ||
| 438 | + if (compat->buffers == NULL) | ||
| 439 | + return VA_STATUS_ERROR_ALLOCATION_FAILED; | ||
| 440 | + } | ||
| 441 | + | ||
| 442 | + compat_buffer = &compat->buffers[index]; | ||
| 443 | + compat_buffer->id = id; | ||
| 444 | + compat_buffer->type = type; | ||
| 445 | + compat_buffer->size = size; | ||
| 446 | + compat_buffer->num_elements = num_elements; | ||
| 447 | + compat_buffer->data = NULL; | ||
| 448 | + compat_buffer->translate = translate_func; | ||
| 449 | + compat_buffer->compat_size = compat_size; | ||
| 450 | + compat_buffer->compat_data = NULL; | ||
| 451 | + compat_buffer->map_count = 0; | ||
| 452 | + | ||
| 453 | + return VA_INVOKE_COMPAT(vaCreateBuffer, | ||
| 454 | + ctx, | ||
| 455 | + context, | ||
| 456 | + type, | ||
| 457 | + compat_size, | ||
| 458 | + num_elements, | ||
| 459 | + NULL, | ||
| 460 | + &compat_buffer->compat_id); | ||
| 461 | +} | ||
| 462 | + | ||
| 463 | +static VAStatus va_DestroyBufferCompat ( | ||
| 464 | + VADriverContextP ctx, | ||
| 465 | + VABufferID id | ||
| 466 | +) | ||
| 467 | +{ | ||
| 468 | + VABufferCompat *compat_buffer; | ||
| 469 | + VAStatus status; | ||
| 470 | + | ||
| 471 | + if ((compat_buffer = va_GetBufferCompat(ctx, id)) == NULL) | ||
| 472 | + return VA_STATUS_SUCCESS; | ||
| 473 | + | ||
| 474 | + /* Force unmap if there were more maps than unmaps */ | ||
| 475 | + if (compat_buffer->map_count > 1) | ||
| 476 | + compat_buffer->map_count = 1; | ||
| 477 | + if (compat_buffer->map_count > 1) | ||
| 478 | + { | ||
| 479 | + if ((status = VA_INVOKE(vaUnmapBuffer, ctx, id)) != VA_STATUS_SUCCESS) | ||
| 480 | + return status; | ||
| 481 | + } | ||
| 482 | + | ||
| 483 | + compat_buffer->id = 0; | ||
| 484 | + return VA_INVOKE_COMPAT(vaDestroyBuffer, ctx, compat_buffer->compat_id); | ||
| 485 | +} | ||
| 486 | + | ||
| 487 | +static VAStatus va_compat_CreateBuffer ( | ||
| 488 | + VADriverContextP ctx, | ||
| 489 | + VAContextID context, /* in */ | ||
| 490 | + VABufferType type, /* in */ | ||
| 491 | + unsigned int size, /* in */ | ||
| 492 | + unsigned int num_elements, /* in */ | ||
| 493 | + void *data, /* in */ | ||
| 494 | + VABufferID *buf_id /* out */ | ||
| 495 | +) | ||
| 496 | +{ | ||
| 497 | + VABufferTranslateFunc translate_func = NULL; | ||
| 498 | + unsigned int compat_size = 0; | ||
| 499 | + VAStatus status; | ||
| 500 | + | ||
| 501 | + status = VA_INVOKE_COMPAT(vaCreateBuffer, | ||
| 502 | + ctx, | ||
| 503 | + context, | ||
| 504 | + type, | ||
| 505 | + size, | ||
| 506 | + num_elements, | ||
| 507 | + data, | ||
| 508 | + buf_id); | ||
| 509 | + | ||
| 510 | + if (status != VA_STATUS_SUCCESS) | ||
| 511 | + return status; | ||
| 512 | + | ||
| 513 | +#define INIT_TRANSLATE_FUNC_(STRUCT, MAJOR, MINOR) do { \ | ||
| 514 | + translate_func = va_compat_translate_VA##STRUCT##_##MAJOR##_##MINOR; \ | ||
| 515 | + compat_size = sizeof(VA##STRUCT##_##MAJOR##_##MINOR); \ | ||
| 516 | +} while (0) | ||
| 517 | +#define INIT_TRANSLATE_FUNC(BUFFER, CODEC, MAJOR, MINOR) \ | ||
| 518 | + INIT_TRANSLATE_FUNC_(BUFFER##Buffer##CODEC, MAJOR, MINOR) | ||
| 519 | + | ||
| 520 | + /* XXX: this assumes all structures have different sizes from each other */ | ||
| 521 | + switch (size) { | ||
| 522 | + case sizeof(VAPictureParameterBufferH264): | ||
| 523 | + if (type == VAPictureParameterBufferType && ctx->version_major == 0) | ||
| 524 | + { | ||
| 525 | + switch (ctx->version_minor) { | ||
| 526 | + case 29: INIT_TRANSLATE_FUNC(PictureParameter,H264, 0,29); break; | ||
| 527 | + case 30: INIT_TRANSLATE_FUNC(PictureParameter,H264, 0,30); break; | ||
| 528 | + } | ||
| 529 | + } | ||
| 530 | + break; | ||
| 531 | + case sizeof(VASliceParameterBufferH264): | ||
| 532 | + if (type == VASliceParameterBufferType && ctx->version_major == 0) | ||
| 533 | + { | ||
| 534 | + switch (ctx->version_minor) { | ||
| 535 | + case 29: INIT_TRANSLATE_FUNC(SliceParameter,H264, 0,29); break; | ||
| 536 | + case 30: INIT_TRANSLATE_FUNC(SliceParameter,H264, 0,30); break; | ||
| 537 | + } | ||
| 538 | + } | ||
| 539 | + break; | ||
| 540 | + case sizeof(VAPictureParameterBufferVC1): | ||
| 541 | + if (type == VAPictureParameterBufferType && ctx->version_major == 0) | ||
| 542 | + { | ||
| 543 | + switch (ctx->version_minor) { | ||
| 544 | + case 29: INIT_TRANSLATE_FUNC(PictureParameter,VC1, 0,29); break; | ||
| 545 | + case 30: INIT_TRANSLATE_FUNC(PictureParameter,VC1, 0,30); break; | ||
| 546 | + } | ||
| 547 | + } | ||
| 548 | + break; | ||
| 549 | + case sizeof(VAPictureParameterBufferMPEG2): | ||
| 550 | + if (type == VAPictureParameterBufferType && ctx->version_major == 0) | ||
| 551 | + { | ||
| 552 | + switch (ctx->version_minor) { | ||
| 553 | + case 29: INIT_TRANSLATE_FUNC(PictureParameter,MPEG2, 0,29); break; | ||
| 554 | + case 30: INIT_TRANSLATE_FUNC(PictureParameter,MPEG2, 0,30); break; | ||
| 555 | + } | ||
| 556 | + } | ||
| 557 | + break; | ||
| 558 | + case sizeof(VASliceParameterBufferMPEG2): | ||
| 559 | + if (type == VASliceParameterBufferType && ctx->version_major == 0) | ||
| 560 | + { | ||
| 561 | + switch (ctx->version_minor) { | ||
| 562 | + case 29: INIT_TRANSLATE_FUNC(SliceParameter,MPEG2, 0,29); break; | ||
| 563 | + case 30: INIT_TRANSLATE_FUNC(SliceParameter,MPEG2, 0,30); break; | ||
| 564 | + } | ||
| 565 | + } | ||
| 566 | + break; | ||
| 567 | + case sizeof(VAPictureParameterBufferMPEG4): | ||
| 568 | + if (type == VAPictureParameterBufferType && ctx->version_major == 0) | ||
| 569 | + { | ||
| 570 | + switch (ctx->version_minor) { | ||
| 571 | + case 29: INIT_TRANSLATE_FUNC(PictureParameter,MPEG4, 0,29); break; | ||
| 572 | + case 30: INIT_TRANSLATE_FUNC(PictureParameter,MPEG4, 0,30); break; | ||
| 573 | + case 31: INIT_TRANSLATE_FUNC(PictureParameter,MPEG4, 0,31); break; | ||
| 574 | + } | ||
| 575 | + } | ||
| 576 | + break; | ||
| 577 | + case sizeof(VAEncSliceParameterBuffer): | ||
| 578 | + if (type == VAEncSliceParameterBufferType && ctx->version_major == 0) | ||
| 579 | + { | ||
| 580 | + switch (ctx->version_minor) { | ||
| 581 | + case 30: INIT_TRANSLATE_FUNC_(EncSliceParameterBuffer, 0,30); break; | ||
| 582 | + } | ||
| 583 | + } | ||
| 584 | + break; | ||
| 585 | + } | ||
| 586 | + | ||
| 587 | +#undef INIT_TRANSLATE_FUNC | ||
| 588 | + | ||
| 589 | + /* Create thunk */ | ||
| 590 | + if (buf_id && translate_func) | ||
| 591 | + { | ||
| 592 | + ASSERT(compat_size > 0); | ||
| 593 | + | ||
| 594 | + status = va_CreateBufferCompat(ctx, | ||
| 595 | + context, | ||
| 596 | + *buf_id, | ||
| 597 | + type, | ||
| 598 | + size, | ||
| 599 | + num_elements, | ||
| 600 | + compat_size, | ||
| 601 | + translate_func); | ||
| 602 | + } | ||
| 603 | + | ||
| 604 | + return status; | ||
| 605 | +} | ||
| 606 | + | ||
| 607 | +static VAStatus va_compat_BufferSetNumElements ( | ||
| 608 | + VADriverContextP ctx, | ||
| 609 | + VABufferID buf_id, /* in */ | ||
| 610 | + unsigned int num_elements /* in */ | ||
| 611 | +) | ||
| 612 | +{ | ||
| 613 | + VABufferCompat *compat_buffer; | ||
| 614 | + VAStatus status; | ||
| 615 | + | ||
| 616 | + status = VA_INVOKE_COMPAT(vaBufferSetNumElements, ctx, buf_id, num_elements); | ||
| 617 | + if (status != VA_STATUS_SUCCESS) | ||
| 618 | + return status; | ||
| 619 | + | ||
| 620 | + if ((compat_buffer = va_GetBufferCompat(ctx, buf_id)) != NULL) | ||
| 621 | + { | ||
| 622 | + compat_buffer->num_elements = num_elements; | ||
| 623 | + status = VA_INVOKE_COMPAT(vaBufferSetNumElements, | ||
| 624 | + ctx, | ||
| 625 | + compat_buffer->compat_id, | ||
| 626 | + num_elements); | ||
| 627 | + } | ||
| 628 | + | ||
| 629 | + return status; | ||
| 630 | +} | ||
| 631 | + | ||
| 632 | +static VAStatus va_compat_DestroyBuffer ( | ||
| 633 | + VADriverContextP ctx, | ||
| 634 | + VABufferID buffer_id | ||
| 635 | +) | ||
| 636 | +{ | ||
| 637 | + VAStatus status; | ||
| 638 | + if ((status = va_DestroyBufferCompat(ctx, buffer_id)) != VA_STATUS_SUCCESS) | ||
| 639 | + return status; | ||
| 640 | + | ||
| 641 | + return VA_INVOKE_COMPAT(vaDestroyBuffer, ctx, buffer_id); | ||
| 642 | +} | ||
| 643 | + | ||
| 644 | +static VAStatus va_compat_MapBuffer ( | ||
| 645 | + VADriverContextP ctx, | ||
| 646 | + VABufferID buf_id, /* in */ | ||
| 647 | + void **pbuf /* out */ | ||
| 648 | +) | ||
| 649 | +{ | ||
| 650 | + VABufferCompat *compat_buffer; | ||
| 651 | + VAStatus status; | ||
| 652 | + | ||
| 653 | + if ((compat_buffer = va_GetBufferCompat(ctx, buf_id)) == NULL) | ||
| 654 | + return VA_INVOKE_COMPAT(vaMapBuffer, ctx, buf_id, pbuf); | ||
| 655 | + | ||
| 656 | + if (compat_buffer->map_count++ == 0) | ||
| 657 | + { | ||
| 658 | + status = VA_INVOKE_COMPAT(vaMapBuffer, ctx, buf_id, (void **)&compat_buffer->data); | ||
| 659 | + if (status != VA_STATUS_SUCCESS) | ||
| 660 | + return status; | ||
| 661 | + | ||
| 662 | + status = VA_INVOKE_COMPAT(vaMapBuffer, ctx, compat_buffer->compat_id, (void **)&compat_buffer->compat_data); | ||
| 663 | + if (status != VA_STATUS_SUCCESS) | ||
| 664 | + return status; | ||
| 665 | + } | ||
| 666 | + | ||
| 667 | + if (pbuf) | ||
| 668 | + *pbuf = compat_buffer->data; | ||
| 669 | + | ||
| 670 | + return VA_STATUS_SUCCESS; | ||
| 671 | +} | ||
| 672 | + | ||
| 673 | +static VAStatus va_compat_UnmapBuffer ( | ||
| 674 | + VADriverContextP ctx, | ||
| 675 | + VABufferID buf_id /* in */ | ||
| 676 | +) | ||
| 677 | +{ | ||
| 678 | + VABufferCompat *compat_buffer; | ||
| 679 | + VAStatus status; | ||
| 680 | + | ||
| 681 | + if ((compat_buffer = va_GetBufferCompat(ctx, buf_id)) == NULL) | ||
| 682 | + return VA_INVOKE_COMPAT(vaUnmapBuffer, ctx, buf_id); | ||
| 683 | + | ||
| 684 | + if (--compat_buffer->map_count == 0) | ||
| 685 | + { | ||
| 686 | + status = VA_INVOKE_COMPAT(vaUnmapBuffer, ctx, compat_buffer->compat_id); | ||
| 687 | + if (status != VA_STATUS_SUCCESS) | ||
| 688 | + return status; | ||
| 689 | + compat_buffer->compat_data = NULL; | ||
| 690 | + | ||
| 691 | + status = VA_INVOKE_COMPAT(vaUnmapBuffer, ctx, compat_buffer->id); | ||
| 692 | + if (status != VA_STATUS_SUCCESS) | ||
| 693 | + return status; | ||
| 694 | + compat_buffer->data = NULL; | ||
| 695 | + } | ||
| 696 | + | ||
| 697 | + return VA_STATUS_SUCCESS; | ||
| 698 | +} | ||
| 699 | + | ||
| 700 | +static VAStatus va_compat_BeginPicture ( | ||
| 701 | + VADriverContextP ctx, | ||
| 702 | + VAContextID context, | ||
| 703 | + VASurfaceID render_target | ||
| 704 | +) | ||
| 705 | +{ | ||
| 706 | + VACompatContextP compat = ctx->compat; | ||
| 707 | + compat->skip_frame = 0; | ||
| 708 | + return VA_INVOKE_COMPAT(vaBeginPicture, ctx, context, render_target); | ||
| 709 | +} | ||
| 710 | + | ||
| 711 | +static VAStatus va_compat_EndPicture ( | ||
| 712 | + VADriverContextP ctx, | ||
| 713 | + VAContextID context | ||
| 714 | +) | ||
| 715 | +{ | ||
| 716 | + VACompatContextP compat = ctx->compat; | ||
| 717 | + VAStatus status = VA_INVOKE_COMPAT(vaEndPicture, ctx, context); | ||
| 718 | + | ||
| 719 | + /* Ignore errors if the HW decoder did not handle VC-1 skipped P-frames */ | ||
| 720 | + if (compat->skip_frame && status == VA_STATUS_ERROR_UNKNOWN) | ||
| 721 | + status = VA_STATUS_SUCCESS; | ||
| 722 | + | ||
| 723 | + return status; | ||
| 724 | +} | ||
| 725 | + | ||
| 726 | +static VAStatus va_compat_RenderPicture ( | ||
| 727 | + VADriverContextP ctx, | ||
| 728 | + VAContextID context, | ||
| 729 | + VABufferID *buffers, | ||
| 730 | + int num_buffers | ||
| 731 | +) | ||
| 732 | +{ | ||
| 733 | + VACompatContextP compat = ctx->compat; | ||
| 734 | + VABufferCompat *compat_buffer; | ||
| 735 | + VABufferID *compat_buffer_ids; | ||
| 736 | + VAStatus status; | ||
| 737 | + int i, n; | ||
| 738 | + | ||
| 739 | + if ((n = num_buffers) < 1) | ||
| 740 | + n = 1; | ||
| 741 | + compat_buffer_ids = alloca(n * sizeof(compat_buffer_ids[0])); | ||
| 742 | + | ||
| 743 | + for (i = 0; i < num_buffers; i++) | ||
| 744 | + { | ||
| 745 | + if ((compat_buffer = va_GetBufferCompat(ctx, buffers[i])) == NULL) | ||
| 746 | + compat_buffer_ids[i] = buffers[i]; | ||
| 747 | + else | ||
| 748 | + { | ||
| 749 | + status = va_TranslateBufferCompat(ctx, compat_buffer); | ||
| 750 | + if (status != VA_STATUS_SUCCESS) | ||
| 751 | + return status; | ||
| 752 | + compat_buffer_ids[i] = compat_buffer->compat_id; | ||
| 753 | + } | ||
| 754 | + } | ||
| 755 | + | ||
| 756 | + if (!compat->skip_frame) | ||
| 757 | + { | ||
| 758 | + status = VA_INVOKE_COMPAT(vaRenderPicture, ctx, context, compat_buffer_ids, num_buffers); | ||
| 759 | + if (status != VA_STATUS_SUCCESS) | ||
| 760 | + return status; | ||
| 761 | + } | ||
| 762 | + | ||
| 763 | + /* Buffers are automatically destroyed afterwards */ | ||
| 764 | + for (i = 0; i < num_buffers; i++) | ||
| 765 | + { | ||
| 766 | + if ((compat_buffer = va_GetBufferCompat(ctx, buffers[i])) != NULL) | ||
| 767 | + { | ||
| 768 | + status = VA_INVOKE_COMPAT(vaDestroyBuffer, ctx, compat_buffer->id); | ||
| 769 | + if (status != VA_STATUS_SUCCESS) | ||
| 770 | + return status; | ||
| 771 | + } | ||
| 772 | + } | ||
| 773 | + | ||
| 774 | + return VA_STATUS_SUCCESS; | ||
| 775 | +} | ||
| 776 | + | ||
| 777 | +#define DEFINE_VTABLE_ENTRY_(RETVAL, PROC, ARGS, COMPAT_PROC, COMPAT_ARGS, COMPAT_PRE, COMPAT_POST) \ | ||
| 778 | +static RETVAL va_compat_##PROC ARGS \ | ||
| 779 | +{ \ | ||
| 780 | + if (COMPAT_CTX(ctx)->vtable.va##COMPAT_PROC == NULL) \ | ||
| 781 | + return VA_STATUS_ERROR_OPERATION_FAILED; \ | ||
| 782 | + COMPAT_PRE; \ | ||
| 783 | + RETVAL ret = COMPAT_CTX(ctx)->vtable.va##COMPAT_PROC VA_INVOKE_COMPAT_ARGS COMPAT_ARGS; \ | ||
| 784 | + COMPAT_POST; \ | ||
| 785 | + return ret; \ | ||
| 786 | +} | ||
| 787 | + | ||
| 788 | +#define DEFINE_VTABLE_ENTRY(RETVAL, PROC, DECL_ARGS, CALL_ARGS) \ | ||
| 789 | +DEFINE_VTABLE_ENTRY_(RETVAL, PROC, DECL_ARGS, PROC, CALL_ARGS, {}, {}) | ||
| 790 | + | ||
| 791 | +static VAStatus va_compat_Terminate(VADriverContextP ctx) | ||
| 792 | +{ | ||
| 793 | + if (COMPAT_CTX(ctx)->vtable.vaTerminate == NULL) | ||
| 794 | + return VA_STATUS_ERROR_OPERATION_FAILED; | ||
| 795 | + return COMPAT_CTX(ctx)->vtable.vaTerminate(COMPAT_CTX(ctx)->compat_ctx); | ||
| 796 | +} | ||
| 797 | + | ||
| 798 | +DEFINE_VTABLE_ENTRY( | ||
| 799 | + VAStatus, QueryConfigProfiles, | ||
| 800 | + (VADriverContextP ctx, VAProfile *profile_list, int *num_profiles), | ||
| 801 | + (ctx, profile_list, num_profiles)) | ||
| 802 | + | ||
| 803 | +DEFINE_VTABLE_ENTRY( | ||
| 804 | + VAStatus, QueryConfigEntrypoints, | ||
| 805 | + (VADriverContextP ctx, VAProfile profile, | ||
| 806 | + VAEntrypoint *entrypoint_list, int *num_entrypoints), | ||
| 807 | + (ctx, profile, entrypoint_list, num_entrypoints)) | ||
| 808 | + | ||
| 809 | +DEFINE_VTABLE_ENTRY( | ||
| 810 | + VAStatus, GetConfigAttributes, | ||
| 811 | + (VADriverContextP ctx, VAProfile profile, VAEntrypoint entrypoint, | ||
| 812 | + VAConfigAttrib *attrib_list, int num_attribs), | ||
| 813 | + (ctx, profile, entrypoint, attrib_list, num_attribs)) | ||
| 814 | + | ||
| 815 | +DEFINE_VTABLE_ENTRY( | ||
| 816 | + VAStatus, CreateConfig, | ||
| 817 | + (VADriverContextP ctx, VAProfile profile, VAEntrypoint entrypoint, | ||
| 818 | + VAConfigAttrib *attrib_list, int num_attribs, VAConfigID *config_id), | ||
| 819 | + (ctx, profile, entrypoint, attrib_list, num_attribs, config_id)) | ||
| 820 | + | ||
| 821 | +DEFINE_VTABLE_ENTRY( | ||
| 822 | + VAStatus, DestroyConfig, | ||
| 823 | + (VADriverContextP ctx, VAConfigID config_id), | ||
| 824 | + (ctx, config_id)) | ||
| 825 | + | ||
| 826 | +DEFINE_VTABLE_ENTRY( | ||
| 827 | + VAStatus, QueryConfigAttributes, | ||
| 828 | + (VADriverContextP ctx, VAConfigID config_id, VAProfile *profile, | ||
| 829 | + VAEntrypoint *entrypoint, VAConfigAttrib *attrib_list, int *num_attribs), | ||
| 830 | + (ctx, config_id, profile, entrypoint, attrib_list, num_attribs)) | ||
| 831 | + | ||
| 832 | +DEFINE_VTABLE_ENTRY( | ||
| 833 | + VAStatus, CreateSurfaces, | ||
| 834 | + (VADriverContextP ctx, int width, int height, int format, | ||
| 835 | + int num_surfaces, VASurfaceID *surfaces), | ||
| 836 | + (ctx, width, height, format, num_surfaces, surfaces)) | ||
| 837 | + | ||
| 838 | +DEFINE_VTABLE_ENTRY( | ||
| 839 | + VAStatus, DestroySurfaces, | ||
| 840 | + (VADriverContextP ctx, VASurfaceID *surface_list, int num_surfaces), | ||
| 841 | + (ctx, surface_list, num_surfaces)) | ||
| 842 | + | ||
| 843 | +DEFINE_VTABLE_ENTRY( | ||
| 844 | + VAStatus, CreateContext, | ||
| 845 | + (VADriverContextP ctx, VAConfigID config_id, | ||
| 846 | + int picture_width, int picture_height, int flag, | ||
| 847 | + VASurfaceID *render_targets, int num_render_targets, VAContextID *context), | ||
| 848 | + (ctx, config_id, picture_width, picture_height, flag, | ||
| 849 | + render_targets, num_render_targets, context)) | ||
| 850 | + | ||
| 851 | +DEFINE_VTABLE_ENTRY( | ||
| 852 | + VAStatus, DestroyContext, | ||
| 853 | + (VADriverContextP ctx, VAContextID context), | ||
| 854 | + (ctx, context)) | ||
| 855 | + | ||
| 856 | +DEFINE_VTABLE_ENTRY( | ||
| 857 | + VAStatus, SyncSurface, | ||
| 858 | + (VADriverContextP ctx, VASurfaceID render_target), | ||
| 859 | + (ctx, render_target)) | ||
| 860 | + | ||
| 861 | +DEFINE_VTABLE_ENTRY( | ||
| 862 | + VAStatus, QuerySurfaceStatus, | ||
| 863 | + (VADriverContextP ctx, VASurfaceID render_target, VASurfaceStatus *status), | ||
| 864 | + (ctx, render_target, status)) | ||
| 865 | + | ||
| 866 | +DEFINE_VTABLE_ENTRY( | ||
| 867 | + VAStatus, PutSurface, | ||
| 868 | + (VADriverContextP ctx, VASurfaceID surface, Drawable draw, | ||
| 869 | + short srcx, short srcy, unsigned short srcw, unsigned short srch, | ||
| 870 | + short destx, short desty, unsigned short destw, unsigned short desth, | ||
| 871 | + VARectangle *cliprects, unsigned int number_cliprects, unsigned int flags), | ||
| 872 | + (ctx, surface, draw, srcx, srcy, srcw, srch, destx, desty, destw, desth, | ||
| 873 | + cliprects, number_cliprects, flags)) | ||
| 874 | + | ||
| 875 | +DEFINE_VTABLE_ENTRY( | ||
| 876 | + VAStatus, QueryImageFormats, | ||
| 877 | + (VADriverContextP ctx, VAImageFormat *format_list, int *num_formats), | ||
| 878 | + (ctx, format_list, num_formats)) | ||
| 879 | + | ||
| 880 | +DEFINE_VTABLE_ENTRY( | ||
| 881 | + VAStatus, CreateImage, | ||
| 882 | + (VADriverContextP ctx, VAImageFormat *format, | ||
| 883 | + int width, int height, VAImage *image), | ||
| 884 | + (ctx, format, width, height, image)) | ||
| 885 | + | ||
| 886 | +DEFINE_VTABLE_ENTRY( | ||
| 887 | + VAStatus, DeriveImage, | ||
| 888 | + (VADriverContextP ctx, VASurfaceID surface, VAImage *image), | ||
| 889 | + (ctx, surface, image)) | ||
| 890 | + | ||
| 891 | +DEFINE_VTABLE_ENTRY( | ||
| 892 | + VAStatus, DestroyImage, | ||
| 893 | + (VADriverContextP ctx, VAImageID image), | ||
| 894 | + (ctx, image)) | ||
| 895 | + | ||
| 896 | +DEFINE_VTABLE_ENTRY( | ||
| 897 | + VAStatus, SetImagePalette, | ||
| 898 | + (VADriverContextP ctx, VAImageID image, unsigned char *palette), | ||
| 899 | + (ctx, image, palette)) | ||
| 900 | + | ||
| 901 | +DEFINE_VTABLE_ENTRY( | ||
| 902 | + VAStatus, GetImage, | ||
| 903 | + (VADriverContextP ctx, VASurfaceID surface, | ||
| 904 | + int x, int y, unsigned int width, unsigned int height, VAImageID image), | ||
| 905 | + (ctx, surface, x, y, width, height, image)) | ||
| 906 | + | ||
| 907 | +DEFINE_VTABLE_ENTRY( | ||
| 908 | + VAStatus, PutImage, | ||
| 909 | + (VADriverContextP ctx, VASurfaceID surface, VAImageID image, | ||
| 910 | + int srcx, int srcy, unsigned int srcw, unsigned int srch, | ||
| 911 | + int destx, int desty, unsigned int destw, unsigned int desth), | ||
| 912 | + (ctx, surface, image, srcx, srcy, srcw, srch, destx, desty, destw, desth)) | ||
| 913 | + | ||
| 914 | +DEFINE_VTABLE_ENTRY( | ||
| 915 | + VAStatus, QuerySubpictureFormats, | ||
| 916 | + (VADriverContextP ctx, VAImageFormat *format_list, | ||
| 917 | + unsigned int *flags, unsigned int *num_formats), | ||
| 918 | + (ctx, format_list, flags, num_formats)) | ||
| 919 | + | ||
| 920 | +DEFINE_VTABLE_ENTRY( | ||
| 921 | + VAStatus, CreateSubpicture, | ||
| 922 | + (VADriverContextP ctx, VAImageID image, VASubpictureID *subpicture), | ||
| 923 | + (ctx, image, subpicture)) | ||
| 924 | + | ||
| 925 | +DEFINE_VTABLE_ENTRY( | ||
| 926 | + VAStatus, DestroySubpicture, | ||
| 927 | + (VADriverContextP ctx, VASubpictureID subpicture), | ||
| 928 | + (ctx, subpicture)) | ||
| 929 | + | ||
| 930 | +DEFINE_VTABLE_ENTRY( | ||
| 931 | + VAStatus, SetSubpictureImage, | ||
| 932 | + (VADriverContextP ctx, VASubpictureID subpicture, VAImageID image), | ||
| 933 | + (ctx, subpicture, image)) | ||
| 934 | + | ||
| 935 | +DEFINE_VTABLE_ENTRY( | ||
| 936 | + VAStatus, SetSubpictureChromakey, | ||
| 937 | + (VADriverContextP ctx, VASubpictureID subpicture, | ||
| 938 | + unsigned int chromakey_min, | ||
| 939 | + unsigned int chromakey_max, | ||
| 940 | + unsigned int chromakey_mask), | ||
| 941 | + (ctx, subpicture, chromakey_min, chromakey_max, chromakey_mask)) | ||
| 942 | + | ||
| 943 | +DEFINE_VTABLE_ENTRY( | ||
| 944 | + VAStatus, SetSubpictureGlobalAlpha, | ||
| 945 | + (VADriverContextP ctx, VASubpictureID subpicture, float global_alpha), | ||
| 946 | + (ctx, subpicture, global_alpha)) | ||
| 947 | + | ||
| 948 | +DEFINE_VTABLE_ENTRY( | ||
| 949 | + VAStatus, AssociateSubpicture, | ||
| 950 | + (VADriverContextP ctx, VASubpictureID subpicture, | ||
| 951 | + VASurfaceID *target_surfaces, int num_surfaces, | ||
| 952 | + short srcx, short srcy, unsigned short srcw, unsigned short srch, | ||
| 953 | + short destx, short desty, unsigned short destw, unsigned short desth, | ||
| 954 | + unsigned int flags), | ||
| 955 | + (ctx, subpicture, target_surfaces, num_surfaces, | ||
| 956 | + srcx, srcy, srcw, srch, destx, desty, destw, desth, flags)) | ||
| 957 | + | ||
| 958 | +DEFINE_VTABLE_ENTRY( | ||
| 959 | + VAStatus, DeassociateSubpicture, | ||
| 960 | + (VADriverContextP ctx, VASubpictureID subpicture, | ||
| 961 | + VASurfaceID *target_surfaces, int num_surfaces), | ||
| 962 | + (ctx, subpicture, target_surfaces, num_surfaces)) | ||
| 963 | + | ||
| 964 | +DEFINE_VTABLE_ENTRY( | ||
| 965 | + VAStatus, QueryDisplayAttributes, | ||
| 966 | + (VADriverContextP ctx, VADisplayAttribute *attr_list, int *num_attributes), | ||
| 967 | + (ctx, attr_list, num_attributes)) | ||
| 968 | + | ||
| 969 | +DEFINE_VTABLE_ENTRY( | ||
| 970 | + VAStatus, GetDisplayAttributes, | ||
| 971 | + (VADriverContextP ctx, VADisplayAttribute *attr_list, int num_attributes), | ||
| 972 | + (ctx, attr_list, num_attributes)) | ||
| 973 | + | ||
| 974 | +DEFINE_VTABLE_ENTRY( | ||
| 975 | + VAStatus, SetDisplayAttributes, | ||
| 976 | + (VADriverContextP ctx, VADisplayAttribute *attr_list, int num_attributes), | ||
| 977 | + (ctx, attr_list, num_attributes)) | ||
| 978 | + | ||
| 979 | +DEFINE_VTABLE_ENTRY( | ||
| 980 | + VAStatus, CreateSurfaceFromCIFrame, | ||
| 981 | + (VADriverContextP ctx, unsigned long frame_id, VASurfaceID *surface), | ||
| 982 | + (ctx, frame_id, surface)) | ||
| 983 | + | ||
| 984 | +DEFINE_VTABLE_ENTRY( | ||
| 985 | + VAStatus, CreateSurfaceFromV4L2Buf, | ||
| 986 | + (VADriverContextP ctx, int v4l2_fd, | ||
| 987 | + struct v4l2_format *v4l2_fmt, struct v4l2_buffer *v4l2_buf, | ||
| 988 | + VASurfaceID *surface), | ||
| 989 | + (ctx, v4l2_fd, v4l2_fmt, v4l2_buf, surface)) | ||
| 990 | + | ||
| 991 | +DEFINE_VTABLE_ENTRY( | ||
| 992 | + VAStatus, CopySurfaceToBuffer, | ||
| 993 | + (VADriverContextP ctx, VASurfaceID surface, unsigned int *fourcc, | ||
| 994 | + unsigned int *luma_stride, | ||
| 995 | + unsigned int *chroma_u_stride, unsigned int *chroma_v_stride, | ||
| 996 | + unsigned int *luma_offset, | ||
| 997 | + unsigned int *chroma_u_offset, unsigned int *chroma_v_offset, | ||
| 998 | + void **buffer), | ||
| 999 | + (ctx, surface, fourcc, | ||
| 1000 | + luma_stride, chroma_u_stride, chroma_v_stride, | ||
| 1001 | + luma_offset, chroma_u_offset, chroma_v_offset, | ||
| 1002 | + buffer)) | ||
| 1003 | + | ||
| 1004 | +DEFINE_VTABLE_ENTRY_( | ||
| 1005 | + VAStatus, SyncSurface_pre31, | ||
| 1006 | + (VADriverContextP ctx, VASurfaceID render_target), | ||
| 1007 | + SyncSurface_pre31, | ||
| 1008 | + (ctx, va_context_map_lookup(COMPAT_CTX(ctx), render_target), render_target), | ||
| 1009 | + {}, {}) | ||
| 1010 | + | ||
| 1011 | +DEFINE_VTABLE_ENTRY_( | ||
| 1012 | + VAStatus, PutImage_pre31, | ||
| 1013 | + (VADriverContextP ctx, VASurfaceID surface, VAImageID image, | ||
| 1014 | + int srcx, int srcy, unsigned int srcw, unsigned int srch, | ||
| 1015 | + int destx, int desty, unsigned int destw, unsigned int desth), | ||
| 1016 | + PutImage2_pre31, | ||
| 1017 | + (ctx, surface, image, srcx, srcy, srcw, srch, destx, desty, destw, desth), | ||
| 1018 | + {}, {}) | ||
| 1019 | + | ||
| 1020 | +DEFINE_VTABLE_ENTRY_( | ||
| 1021 | + VAStatus, AssociateSubpicture_pre31, | ||
| 1022 | + (VADriverContextP ctx, VASubpictureID subpicture, | ||
| 1023 | + VASurfaceID *target_surfaces, int num_surfaces, | ||
| 1024 | + short srcx, short srcy, unsigned short srcw, unsigned short srch, | ||
| 1025 | + short destx, short desty, unsigned short destw, unsigned short desth, | ||
| 1026 | + unsigned int flags), | ||
| 1027 | + AssociateSubpicture2_pre31, | ||
| 1028 | + (ctx, subpicture, target_surfaces, num_surfaces, | ||
| 1029 | + srcx, srcy, srcw, srch, destx, desty, destw, desth, flags), | ||
| 1030 | + {}, {}) | ||
| 1031 | + | ||
| 1032 | +DEFINE_VTABLE_ENTRY_( | ||
| 1033 | + VAStatus, CreateContext_pre31, | ||
| 1034 | + (VADriverContextP ctx, VAConfigID config_id, | ||
| 1035 | + int picture_width, int picture_height, int flag, | ||
| 1036 | + VASurfaceID *render_targets, int num_render_targets, VAContextID *context), | ||
| 1037 | + CreateContext, | ||
| 1038 | + (ctx, config_id, picture_width, picture_height, flag, | ||
| 1039 | + render_targets, num_render_targets, context), | ||
| 1040 | + {}, { | ||
| 1041 | + VACompatContextP const compat_ctx = COMPAT_CTX(ctx); | ||
| 1042 | + int i; | ||
| 1043 | + for (i = 0; i < num_render_targets; i++) | ||
| 1044 | + va_context_map_add(compat_ctx, *context, render_targets[i]); | ||
| 1045 | + }) | ||
| 1046 | + | ||
| 1047 | +DEFINE_VTABLE_ENTRY_( | ||
| 1048 | + VAStatus, DestroyContext_pre31, | ||
| 1049 | + (VADriverContextP ctx, VAContextID context), | ||
| 1050 | + DestroyContext, | ||
| 1051 | + (ctx, context), | ||
| 1052 | + {}, { va_context_map_remove(COMPAT_CTX(ctx), context); }) | ||
| 1053 | + | ||
| 1054 | +#undef DEFINE_VTABLE_ENTRY | ||
| 1055 | +#undef DEFINE_VTABLE_ENTRY_ | ||
| 1056 | + | ||
| 1057 | +static void va_compat_init_VADriverVTable(VADriverContextP ctx, int compat_version) | ||
| 1058 | +{ | ||
| 1059 | +#define INIT_VTABLE_(CTX, DST_PROC, SRC_PROC) \ | ||
| 1060 | + (CTX)->vtable.va##DST_PROC = va_compat_##SRC_PROC | ||
| 1061 | +#define INIT_VTABLE(CTX, PROC) \ | ||
| 1062 | + INIT_VTABLE_(CTX, PROC, PROC) | ||
| 1063 | + | ||
| 1064 | + INIT_VTABLE(ctx, Terminate); | ||
| 1065 | + INIT_VTABLE(ctx, QueryConfigProfiles); | ||
| 1066 | + INIT_VTABLE(ctx, QueryConfigEntrypoints); | ||
| 1067 | + INIT_VTABLE(ctx, GetConfigAttributes); | ||
| 1068 | + INIT_VTABLE(ctx, CreateConfig); | ||
| 1069 | + INIT_VTABLE(ctx, DestroyConfig); | ||
| 1070 | + INIT_VTABLE(ctx, QueryConfigAttributes); | ||
| 1071 | + INIT_VTABLE(ctx, CreateSurfaces); | ||
| 1072 | + INIT_VTABLE(ctx, DestroySurfaces); | ||
| 1073 | + INIT_VTABLE(ctx, CreateContext); | ||
| 1074 | + INIT_VTABLE(ctx, DestroyContext); | ||
| 1075 | + INIT_VTABLE(ctx, CreateBuffer); | ||
| 1076 | + INIT_VTABLE(ctx, BufferSetNumElements); | ||
| 1077 | + INIT_VTABLE(ctx, MapBuffer); | ||
| 1078 | + INIT_VTABLE(ctx, UnmapBuffer); | ||
| 1079 | + INIT_VTABLE(ctx, DestroyBuffer); | ||
| 1080 | + INIT_VTABLE(ctx, BeginPicture); | ||
| 1081 | + INIT_VTABLE(ctx, RenderPicture); | ||
| 1082 | + INIT_VTABLE(ctx, EndPicture); | ||
| 1083 | + INIT_VTABLE(ctx, SyncSurface); | ||
| 1084 | + INIT_VTABLE(ctx, QuerySurfaceStatus); | ||
| 1085 | + INIT_VTABLE(ctx, PutSurface); | ||
| 1086 | + INIT_VTABLE(ctx, QueryImageFormats); | ||
| 1087 | + INIT_VTABLE(ctx, CreateImage); | ||
| 1088 | + INIT_VTABLE(ctx, DeriveImage); | ||
| 1089 | + INIT_VTABLE(ctx, DestroyImage); | ||
| 1090 | + INIT_VTABLE(ctx, SetImagePalette); | ||
| 1091 | + INIT_VTABLE(ctx, GetImage); | ||
| 1092 | + INIT_VTABLE(ctx, PutImage); | ||
| 1093 | + INIT_VTABLE(ctx, QuerySubpictureFormats); | ||
| 1094 | + INIT_VTABLE(ctx, CreateSubpicture); | ||
| 1095 | + INIT_VTABLE(ctx, DestroySubpicture); | ||
| 1096 | + INIT_VTABLE(ctx, SetSubpictureImage); | ||
| 1097 | + INIT_VTABLE(ctx, SetSubpictureChromakey); | ||
| 1098 | + INIT_VTABLE(ctx, SetSubpictureGlobalAlpha); | ||
| 1099 | + INIT_VTABLE(ctx, AssociateSubpicture); | ||
| 1100 | + INIT_VTABLE(ctx, DeassociateSubpicture); | ||
| 1101 | + INIT_VTABLE(ctx, QueryDisplayAttributes); | ||
| 1102 | + INIT_VTABLE(ctx, GetDisplayAttributes); | ||
| 1103 | + INIT_VTABLE(ctx, SetDisplayAttributes); | ||
| 1104 | + INIT_VTABLE(ctx, CreateSurfaceFromCIFrame); | ||
| 1105 | + INIT_VTABLE(ctx, CreateSurfaceFromV4L2Buf); | ||
| 1106 | + INIT_VTABLE(ctx, CopySurfaceToBuffer); | ||
| 1107 | + | ||
| 1108 | + if (compat_version && compat_version < 31) { | ||
| 1109 | + INIT_VTABLE_(ctx, CreateContext, CreateContext_pre31); | ||
| 1110 | + INIT_VTABLE_(ctx, DestroyContext, DestroyContext_pre31); | ||
| 1111 | + INIT_VTABLE_(ctx, SyncSurface, SyncSurface_pre31); | ||
| 1112 | + INIT_VTABLE_(ctx, PutImage, PutImage_pre31); | ||
| 1113 | + INIT_VTABLE_(ctx, AssociateSubpicture, AssociateSubpicture_pre31); | ||
| 1114 | + } | ||
| 1115 | + | ||
| 1116 | +#undef INIT_VTABLE | ||
| 1117 | +#undef INIT_VTABLE__ | ||
| 1118 | +} | ||
| 1119 | + | ||
| 1120 | +VAStatus va_compat_init(VADisplay dpy, int compat_version, void *compat_ctx) | ||
| 1121 | +{ | ||
| 1122 | + VADisplayContextP pDisplayContext = (VADisplayContextP)dpy; | ||
| 1123 | + VADriverContextP ctx = CTX(dpy); | ||
| 1124 | + VADriverContextP_0_29 ctx_0_29; | ||
| 1125 | + VADriverContextP_0_30 ctx_0_30; | ||
| 1126 | + VACompatContextP compat; | ||
| 1127 | + VAStatus status; | ||
| 1128 | + char *driver_name; | ||
| 1129 | + | ||
| 1130 | + ctx->compat = NULL; | ||
| 1131 | + | ||
| 1132 | + if (compat_version == 0) | ||
| 1133 | + return VA_STATUS_SUCCESS; | ||
| 1134 | + | ||
| 1135 | + ASSERT(compat_ctx); | ||
| 1136 | + if (compat_ctx == NULL) | ||
| 1137 | + return VA_STATUS_ERROR_UNKNOWN; | ||
| 1138 | + | ||
| 1139 | + driver_name = NULL; | ||
| 1140 | + status = pDisplayContext->vaGetDriverName(pDisplayContext, &driver_name); | ||
| 1141 | + ASSERT(status == VA_STATUS_SUCCESS); | ||
| 1142 | + if (status != VA_STATUS_SUCCESS) | ||
| 1143 | + return status; | ||
| 1144 | + | ||
| 1145 | + if ((compat = malloc(sizeof(*compat))) == NULL) | ||
| 1146 | + return VA_STATUS_ERROR_ALLOCATION_FAILED; | ||
| 1147 | + compat->buffers = NULL; | ||
| 1148 | + compat->buffers_count_max = 0; | ||
| 1149 | + compat->compat_version = compat_version; | ||
| 1150 | + compat->compat_ctx = NULL; | ||
| 1151 | + compat->driver_name = driver_name; | ||
| 1152 | + compat->context_map = NULL; | ||
| 1153 | + compat->last_context_map_match = NULL; | ||
| 1154 | + ctx->compat = compat; | ||
| 1155 | + | ||
| 1156 | + if (strcmp(driver_name, "psb") == 0) | ||
| 1157 | + compat->driver_id = VA_DRIVER_ID_POULSBO; | ||
| 1158 | + else if (strcmp(driver_name, "iegd") == 0) | ||
| 1159 | + compat->driver_id = VA_DRIVER_ID_IEGD; | ||
| 1160 | + else | ||
| 1161 | + compat->driver_id = VA_DRIVER_ID_UNKNOWN; | ||
| 1162 | + | ||
| 1163 | + switch (compat_version) { | ||
| 1164 | + case 29: | ||
| 1165 | + if ((ctx_0_29 = malloc(sizeof(*ctx_0_29))) == NULL) | ||
| 1166 | + return VA_STATUS_ERROR_ALLOCATION_FAILED; | ||
| 1167 | + memcpy(ctx_0_29, compat_ctx, sizeof(*ctx_0_29)); | ||
| 1168 | + va_compat_translate_VADriverContext_0_29(compat, ctx_0_29); | ||
| 1169 | + compat->compat_ctx = ctx_0_29; | ||
| 1170 | + COPY_FIELD(ctx, ctx_0_29, version_major); | ||
| 1171 | + COPY_FIELD(ctx, ctx_0_29, version_minor); | ||
| 1172 | + COPY_FIELD(ctx, ctx_0_29, max_profiles); | ||
| 1173 | + COPY_FIELD(ctx, ctx_0_29, max_entrypoints); | ||
| 1174 | + COPY_FIELD(ctx, ctx_0_29, max_attributes); | ||
| 1175 | + COPY_FIELD(ctx, ctx_0_29, max_image_formats); | ||
| 1176 | + COPY_FIELD(ctx, ctx_0_29, max_subpic_formats); | ||
| 1177 | + COPY_FIELD(ctx, ctx_0_29, max_display_attributes); | ||
| 1178 | + COPY_FIELD(ctx, ctx_0_29, str_vendor); | ||
| 1179 | + break; | ||
| 1180 | + case 30: | ||
| 1181 | + if ((ctx_0_30 = malloc(sizeof(*ctx_0_30))) == NULL) | ||
| 1182 | + return VA_STATUS_ERROR_ALLOCATION_FAILED; | ||
| 1183 | + memcpy(ctx_0_30, compat_ctx, sizeof(*ctx_0_30)); | ||
| 1184 | + va_compat_translate_VADriverContext_0_30(compat, ctx_0_30); | ||
| 1185 | + compat->compat_ctx = ctx_0_30; | ||
| 1186 | + COPY_FIELD(ctx, ctx_0_30, version_major); | ||
| 1187 | + COPY_FIELD(ctx, ctx_0_30, version_minor); | ||
| 1188 | + COPY_FIELD(ctx, ctx_0_30, max_profiles); | ||
| 1189 | + COPY_FIELD(ctx, ctx_0_30, max_entrypoints); | ||
| 1190 | + COPY_FIELD(ctx, ctx_0_30, max_attributes); | ||
| 1191 | + COPY_FIELD(ctx, ctx_0_30, max_image_formats); | ||
| 1192 | + COPY_FIELD(ctx, ctx_0_30, max_subpic_formats); | ||
| 1193 | + COPY_FIELD(ctx, ctx_0_30, max_display_attributes); | ||
| 1194 | + COPY_FIELD(ctx, ctx_0_30, str_vendor); | ||
| 1195 | + break; | ||
| 1196 | + case VA_MINOR_VERSION: | ||
| 1197 | + va_compat_translate_VADriverContext(compat, compat_ctx); | ||
| 1198 | + compat->compat_ctx = compat_ctx; | ||
| 1199 | + break; | ||
| 1200 | + default: | ||
| 1201 | + ASSERT(compat_version == 0); | ||
| 1202 | + return VA_STATUS_ERROR_UNKNOWN; | ||
| 1203 | + } | ||
| 1204 | + | ||
| 1205 | + va_compat_init_VADriverVTable(ctx, compat_version); | ||
| 1206 | + return VA_STATUS_SUCCESS; | ||
| 1207 | +} | ||
| 1208 | + | ||
| 1209 | +VAStatus va_compat_fini(VADisplay dpy) | ||
| 1210 | +{ | ||
| 1211 | + VADriverContextP ctx = CTX(dpy); | ||
| 1212 | + VACompatContextP compat = ctx->compat; | ||
| 1213 | + int i; | ||
| 1214 | + | ||
| 1215 | + if (compat == NULL) | ||
| 1216 | + return VA_STATUS_SUCCESS; | ||
| 1217 | + | ||
| 1218 | + if (compat->driver_name) | ||
| 1219 | + { | ||
| 1220 | + free(compat->driver_name); | ||
| 1221 | + compat->driver_name = NULL; | ||
| 1222 | + } | ||
| 1223 | + | ||
| 1224 | + if (compat->buffers) | ||
| 1225 | + { | ||
| 1226 | + for (i = 0; i < compat->buffers_count_max; i++) | ||
| 1227 | + { | ||
| 1228 | + if (compat->buffers[i].id) | ||
| 1229 | + va_DestroyBufferCompat(ctx, compat->buffers[i].id); | ||
| 1230 | + } | ||
| 1231 | + free(compat->buffers); | ||
| 1232 | + compat->buffers = NULL; | ||
| 1233 | + } | ||
| 1234 | + | ||
| 1235 | + if (compat->compat_ctx && compat->compat_version != VA_MINOR_VERSION) | ||
| 1236 | + { | ||
| 1237 | + free(compat->compat_ctx); | ||
| 1238 | + compat->compat_ctx = NULL; | ||
| 1239 | + } | ||
| 1240 | + | ||
| 1241 | + if (compat->context_map) | ||
| 1242 | + { | ||
| 1243 | + VAContextMapP d, m = compat->context_map; | ||
| 1244 | + while (m) { | ||
| 1245 | + d = m; | ||
| 1246 | + m = m->next; | ||
| 1247 | + free(d); | ||
| 1248 | + } | ||
| 1249 | + } | ||
| 1250 | + compat->last_context_map_match = NULL; | ||
| 1251 | + | ||
| 1252 | + free(compat); | ||
| 1253 | + ctx->compat = NULL; | ||
| 1254 | + return VA_STATUS_SUCCESS; | ||
| 1255 | +} | ||
| 1256 | diff --git a/src/va_compat.h b/src/va_compat.h | ||
| 1257 | new file mode 100644 | ||
| 1258 | index 0000000..2c9d801 | ||
| 1259 | --- /dev/null | ||
| 1260 | +++ b/src/va_compat.h | ||
| 1261 | @@ -0,0 +1,1467 @@ | ||
| 1262 | +/* | ||
| 1263 | + * Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved. | ||
| 1264 | + * | ||
| 1265 | + * Permission is hereby granted, free of charge, to any person obtaining a | ||
| 1266 | + * copy of this software and associated documentation files (the | ||
| 1267 | + * "Software"), to deal in the Software without restriction, including | ||
| 1268 | + * without limitation the rights to use, copy, modify, merge, publish, | ||
| 1269 | + * distribute, sub license, and/or sell copies of the Software, and to | ||
| 1270 | + * permit persons to whom the Software is furnished to do so, subject to | ||
| 1271 | + * the following conditions: | ||
| 1272 | + * | ||
| 1273 | + * The above copyright notice and this permission notice (including the | ||
| 1274 | + * next paragraph) shall be included in all copies or substantial portions | ||
| 1275 | + * of the Software. | ||
| 1276 | + * | ||
| 1277 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
| 1278 | + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
| 1279 | + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. | ||
| 1280 | + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR | ||
| 1281 | + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
| 1282 | + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
| 1283 | + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 1284 | + */ | ||
| 1285 | + | ||
| 1286 | +#ifndef VA_COMPAT_H | ||
| 1287 | +#define VA_COMPAT_H | ||
| 1288 | + | ||
| 1289 | +VAStatus va_compat_init(VADisplay dpy, int compat_version, void *compat_ctx); | ||
| 1290 | +VAStatus va_compat_fini(VADisplay dpy); | ||
| 1291 | + | ||
| 1292 | +/* H.264 Picture (0.29) */ | ||
| 1293 | +typedef struct _VAPictureH264_0_29 | ||
| 1294 | +{ | ||
| 1295 | + VASurfaceID picture_id; | ||
| 1296 | + unsigned int flags; | ||
| 1297 | + unsigned int TopFieldOrderCnt; | ||
| 1298 | + unsigned int BottomFieldOrderCnt; | ||
| 1299 | +} VAPictureH264_0_29; | ||
| 1300 | + | ||
| 1301 | +/* H.264 Picture Parameter Buffer (0.29) */ | ||
| 1302 | +typedef struct _VAPictureParameterBufferH264_0_29 | ||
| 1303 | +{ | ||
| 1304 | + VAPictureH264_0_29 CurrPic; | ||
| 1305 | + VAPictureH264_0_29 ReferenceFrames[16]; /* in DPB */ | ||
| 1306 | + unsigned short picture_width_in_mbs_minus1; | ||
| 1307 | + unsigned short picture_height_in_mbs_minus1; | ||
| 1308 | + unsigned char bit_depth_luma_minus8; | ||
| 1309 | + unsigned char bit_depth_chroma_minus8; | ||
| 1310 | + unsigned char num_ref_frames; | ||
| 1311 | + union { | ||
| 1312 | + struct { | ||
| 1313 | + unsigned char chroma_format_idc : 2; | ||
| 1314 | + unsigned char residual_colour_transform_flag : 1; | ||
| 1315 | + unsigned char frame_mbs_only_flag : 1; | ||
| 1316 | + unsigned char mb_adaptive_frame_field_flag : 1; | ||
| 1317 | + unsigned char direct_8x8_inference_flag : 1; | ||
| 1318 | + unsigned char MinLumaBiPredSize8x8 : 1; /* see A.3.3.2 */ | ||
| 1319 | + }; | ||
| 1320 | + unsigned char seq_fields; | ||
| 1321 | + }; | ||
| 1322 | + unsigned char num_slice_groups_minus1; | ||
| 1323 | + unsigned char slice_group_map_type; | ||
| 1324 | + signed char pic_init_qp_minus26; | ||
| 1325 | + signed char chroma_qp_index_offset; | ||
| 1326 | + signed char second_chroma_qp_index_offset; | ||
| 1327 | + union { | ||
| 1328 | + struct { | ||
| 1329 | + unsigned char entropy_coding_mode_flag : 1; | ||
| 1330 | + unsigned char weighted_pred_flag : 1; | ||
| 1331 | + unsigned char weighted_bipred_idc : 2; | ||
| 1332 | + unsigned char transform_8x8_mode_flag : 1; | ||
| 1333 | + unsigned char field_pic_flag : 1; | ||
| 1334 | + unsigned char constrained_intra_pred_flag : 1; | ||
| 1335 | + }; | ||
| 1336 | + unsigned char pic_fields; | ||
| 1337 | + }; | ||
| 1338 | + unsigned short frame_num; | ||
| 1339 | +} VAPictureParameterBufferH264_0_29; | ||
| 1340 | + | ||
| 1341 | +/* H.264 Slice Parameter Buffer (0.29) */ | ||
| 1342 | +typedef struct _VASliceParameterBufferH264_0_29 | ||
| 1343 | +{ | ||
| 1344 | + unsigned int slice_data_size;/* number of bytes in the slice data buffer for this slice */ | ||
| 1345 | + unsigned int slice_data_offset;/* the offset to the NAL start code for this slice */ | ||
| 1346 | + unsigned int slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */ | ||
| 1347 | + unsigned short slice_data_bit_offset; /* bit offset from NAL start code to the beginning of slice data */ | ||
| 1348 | + unsigned short first_mb_in_slice; | ||
| 1349 | + unsigned char slice_type; | ||
| 1350 | + unsigned char direct_spatial_mv_pred_flag; | ||
| 1351 | + unsigned char num_ref_idx_l0_active_minus1; | ||
| 1352 | + unsigned char num_ref_idx_l1_active_minus1; | ||
| 1353 | + unsigned char cabac_init_idc; | ||
| 1354 | + char slice_qp_delta; | ||
| 1355 | + unsigned char disable_deblocking_filter_idc; | ||
| 1356 | + char slice_alpha_c0_offset_div2; | ||
| 1357 | + char slice_beta_offset_div2; | ||
| 1358 | + VAPictureH264_0_29 RefPicList0[32]; /* See 8.2.4.2 */ | ||
| 1359 | + VAPictureH264_0_29 RefPicList1[32]; /* See 8.2.4.2 */ | ||
| 1360 | + unsigned char luma_log2_weight_denom; | ||
| 1361 | + unsigned char chroma_log2_weight_denom; | ||
| 1362 | + unsigned char luma_weight_l0_flag; | ||
| 1363 | + short luma_weight_l0[32]; | ||
| 1364 | + short luma_offset_l0[32]; | ||
| 1365 | + unsigned char chroma_weight_l0_flag; | ||
| 1366 | + short chroma_weight_l0[32][2]; | ||
| 1367 | + short chroma_offset_l0[32][2]; | ||
| 1368 | + unsigned char luma_weight_l1_flag; | ||
| 1369 | + short luma_weight_l1[32]; | ||
| 1370 | + short luma_offset_l1[32]; | ||
| 1371 | + unsigned char chroma_weight_l1_flag; | ||
| 1372 | + short chroma_weight_l1[32][2]; | ||
| 1373 | + short chroma_offset_l1[32][2]; | ||
| 1374 | +} VASliceParameterBufferH264_0_29; | ||
| 1375 | + | ||
| 1376 | +/* VC-1 Picture Parameter Buffer (0.29) */ | ||
| 1377 | +typedef struct _VAPictureParameterBufferVC1_0_29 | ||
| 1378 | +{ | ||
| 1379 | + VASurfaceID forward_reference_picture; | ||
| 1380 | + VASurfaceID backward_reference_picture; | ||
| 1381 | + /* if out-of-loop post-processing is done on the render | ||
| 1382 | + target, then we need to keep the in-loop decoded | ||
| 1383 | + picture as a reference picture */ | ||
| 1384 | + VASurfaceID inloop_decoded_picture; | ||
| 1385 | + | ||
| 1386 | + /* sequence layer for AP or meta data for SP and MP */ | ||
| 1387 | + union { | ||
| 1388 | + struct { | ||
| 1389 | + unsigned char interlace : 1; /* SEQUENCE_LAYER::INTERLACE */ | ||
| 1390 | + unsigned char syncmarker : 1;/* METADATA::SYNCMARKER */ | ||
| 1391 | + unsigned char overlap : 1;/* METADATA::OVERLAP */ | ||
| 1392 | + }; | ||
| 1393 | + unsigned char sequence_fields; | ||
| 1394 | + }; | ||
| 1395 | + | ||
| 1396 | + unsigned short coded_width; /* ENTRY_POINT_LAYER::CODED_WIDTH */ | ||
| 1397 | + unsigned short coded_height; /* ENTRY_POINT_LAYER::CODED_HEIGHT */ | ||
| 1398 | + unsigned char closed_entry; /* ENTRY_POINT_LAYER::CLOSED_ENTRY */ | ||
| 1399 | + unsigned char broken_link; /* ENTRY_POINT_LAYER::BROKEN_LINK */ | ||
| 1400 | + unsigned char loopfilter; /* ENTRY_POINT_LAYER::LOOPFILTER */ | ||
| 1401 | + unsigned char conditional_overlap_flag; /* ENTRY_POINT_LAYER::CONDOVER */ | ||
| 1402 | + unsigned char fast_uvmc_flag; /* ENTRY_POINT_LAYER::FASTUVMC */ | ||
| 1403 | + union { | ||
| 1404 | + struct { | ||
| 1405 | + unsigned char range_mapping_luma_flag: 1; /* ENTRY_POINT_LAYER::RANGE_MAPY_FLAG */ | ||
| 1406 | + unsigned char range_mapping_luma: 3; /* ENTRY_POINT_LAYER::RANGE_MAPY */ | ||
| 1407 | + unsigned char range_mapping_chroma_flag: 1; /* ENTRY_POINT_LAYER::RANGE_MAPUV_FLAG */ | ||
| 1408 | + unsigned char range_mapping_chroma: 3; /* ENTRY_POINT_LAYER::RANGE_MAPUV */ | ||
| 1409 | + }; | ||
| 1410 | + unsigned char range_mapping_fields; | ||
| 1411 | + }; | ||
| 1412 | + | ||
| 1413 | + unsigned char b_picture_fraction; /* PICTURE_LAYER::BFRACTION */ | ||
| 1414 | + unsigned char cbp_table; /* PICTURE_LAYER::CBPTAB/ICBPTAB */ | ||
| 1415 | + unsigned char mb_mode_table; /* PICTURE_LAYER::MBMODETAB */ | ||
| 1416 | + unsigned char range_reduction_frame;/* PICTURE_LAYER::RANGEREDFRM */ | ||
| 1417 | + unsigned char rounding_control; /* PICTURE_LAYER::RNDCTRL */ | ||
| 1418 | + unsigned char post_processing; /* PICTURE_LAYER::POSTPROC */ | ||
| 1419 | + unsigned char picture_resolution_index; /* PICTURE_LAYER::RESPIC */ | ||
| 1420 | + unsigned char luma_scale; /* PICTURE_LAYER::LUMSCALE */ | ||
| 1421 | + unsigned char luma_shift; /* PICTURE_LAYER::LUMSHIFT */ | ||
| 1422 | + union { | ||
| 1423 | + struct { | ||
| 1424 | + unsigned char picture_type : 2; /* PICTURE_LAYER::PTYPE */ | ||
| 1425 | + unsigned char frame_coding_mode : 3;/* PICTURE_LAYER::FCM */ | ||
| 1426 | + unsigned char top_field_first : 1;/* PICTURE_LAYER::TFF */ | ||
| 1427 | + unsigned char is_first_field : 1; /* set to 1 if it is the first field */ | ||
| 1428 | + unsigned char intensity_compensation: 1;/* PICTURE_LAYER::INTCOMP */ | ||
| 1429 | + }; | ||
| 1430 | + unsigned char picture_fields; | ||
| 1431 | + }; | ||
| 1432 | + union { | ||
| 1433 | + struct { | ||
| 1434 | + unsigned char mv_type_mb : 1; /* PICTURE::MVTYPEMB */ | ||
| 1435 | + unsigned char direct_mb : 1; /* PICTURE::DIRECTMB */ | ||
| 1436 | + unsigned char skip_mb : 1; /* PICTURE::SKIPMB */ | ||
| 1437 | + unsigned char field_tx : 1; /* PICTURE::FIELDTX */ | ||
| 1438 | + unsigned char forward_mb : 1; /* PICTURE::FORWARDMB */ | ||
| 1439 | + unsigned char ac_pred : 1; /* PICTURE::ACPRED */ | ||
| 1440 | + unsigned char overflags : 1; /* PICTURE::OVERFLAGS */ | ||
| 1441 | + }; | ||
| 1442 | + unsigned char raw_coding_flag; | ||
| 1443 | + }; | ||
| 1444 | + union { | ||
| 1445 | + struct { | ||
| 1446 | + unsigned char bp_mv_type_mb : 1; /* PICTURE::MVTYPEMB */ | ||
| 1447 | + unsigned char bp_direct_mb : 1; /* PICTURE::DIRECTMB */ | ||
| 1448 | + unsigned char bp_skip_mb : 1; /* PICTURE::SKIPMB */ | ||
| 1449 | + unsigned char bp_field_tx : 1; /* PICTURE::FIELDTX */ | ||
| 1450 | + unsigned char bp_forward_mb : 1; /* PICTURE::FORWARDMB */ | ||
| 1451 | + unsigned char bp_ac_pred : 1; /* PICTURE::ACPRED */ | ||
| 1452 | + unsigned char bp_overflags : 1; /* PICTURE::OVERFLAGS */ | ||
| 1453 | + }; | ||
| 1454 | + unsigned char bitplane_present_flag; /* signal what bitplane is being passed via the bitplane buffer */ | ||
| 1455 | + }; | ||
| 1456 | + union { | ||
| 1457 | + struct { | ||
| 1458 | + unsigned char reference_distance_flag : 1;/* PICTURE_LAYER::REFDIST_FLAG */ | ||
| 1459 | + unsigned char reference_distance : 5;/* PICTURE_LAYER::REFDIST */ | ||
| 1460 | + unsigned char num_reference_pictures: 1;/* PICTURE_LAYER::NUMREF */ | ||
| 1461 | + unsigned char reference_field_pic_indicator : 1;/* PICTURE_LAYER::REFFIELD */ | ||
| 1462 | + }; | ||
| 1463 | + unsigned short reference_fields; | ||
| 1464 | + }; | ||
| 1465 | + union { | ||
| 1466 | + struct { | ||
| 1467 | + VAMvModeVC1 mv_mode : 3; /* PICTURE_LAYER::MVMODE */ | ||
| 1468 | + VAMvModeVC1 mv_mode2 : 3; /* PICTURE_LAYER::MVMODE2 */ | ||
| 1469 | + unsigned char mv_table : 3; /* PICTURE_LAYER::MVTAB/IMVTAB */ | ||
| 1470 | + unsigned char two_mv_block_pattern_table: 2; /* PICTURE_LAYER::2MVBPTAB */ | ||
| 1471 | + unsigned char four_mv_switch : 1; /* PICTURE_LAYER::4MVSWITCH */ | ||
| 1472 | + unsigned char four_mv_block_pattern_table : 2; /* PICTURE_LAYER::4MVBPTAB */ | ||
| 1473 | + unsigned char extended_mv_flag : 1; /* ENTRY_POINT_LAYER::EXTENDED_MV */ | ||
| 1474 | + unsigned char extended_mv_range : 2; /* PICTURE_LAYER::MVRANGE */ | ||
| 1475 | + unsigned char extended_dmv_flag : 1; /* ENTRY_POINT_LAYER::EXTENDED_DMV */ | ||
| 1476 | + unsigned char extended_dmv_range : 2; /* PICTURE_LAYER::DMVRANGE */ | ||
| 1477 | + }; | ||
| 1478 | + unsigned int mv_fields; | ||
| 1479 | + }; | ||
| 1480 | + union { | ||
| 1481 | + struct { | ||
| 1482 | + unsigned char dquant : 2; /* ENTRY_POINT_LAYER::DQUANT */ | ||
| 1483 | + unsigned char quantizer : 2; /* ENTRY_POINT_LAYER::QUANTIZER */ | ||
| 1484 | + unsigned char half_qp : 1; /* PICTURE_LAYER::HALFQP */ | ||
| 1485 | + unsigned char pic_quantizer_scale : 5;/* PICTURE_LAYER::PQUANT */ | ||
| 1486 | + unsigned char pic_quantizer_type : 1;/* PICTURE_LAYER::PQUANTIZER */ | ||
| 1487 | + unsigned char dq_frame : 1; /* VOPDQUANT::DQUANTFRM */ | ||
| 1488 | + unsigned char dq_profile : 2; /* VOPDQUANT::DQPROFILE */ | ||
| 1489 | + unsigned char dq_sb_edge : 2; /* VOPDQUANT::DQSBEDGE */ | ||
| 1490 | + unsigned char dq_db_edge : 2; /* VOPDQUANT::DQDBEDGE */ | ||
| 1491 | + unsigned char dq_binary_level : 1; /* VOPDQUANT::DQBILEVEL */ | ||
| 1492 | + unsigned char alt_pic_quantizer : 5;/* VOPDQUANT::ALTPQUANT */ | ||
| 1493 | + }; | ||
| 1494 | + unsigned long pic_quantizer_fields; | ||
| 1495 | + }; | ||
| 1496 | + union { | ||
| 1497 | + struct { | ||
| 1498 | + unsigned char variable_sized_transform_flag : 1;/* ENTRY_POINT_LAYER::VSTRANSFORM */ | ||
| 1499 | + unsigned char mb_level_transform_type_flag : 1;/* PICTURE_LAYER::TTMBF */ | ||
| 1500 | + unsigned char frame_level_transform_type : 2;/* PICTURE_LAYER::TTFRM */ | ||
| 1501 | + unsigned char transform_ac_codingset_idx1 : 2;/* PICTURE_LAYER::TRANSACFRM */ | ||
| 1502 | + unsigned char transform_ac_codingset_idx2 : 2;/* PICTURE_LAYER::TRANSACFRM2 */ | ||
| 1503 | + unsigned char intra_transform_dc_table : 1;/* PICTURE_LAYER::TRANSDCTAB */ | ||
| 1504 | + }; | ||
| 1505 | + unsigned short transform_fields; | ||
| 1506 | + }; | ||
| 1507 | +} VAPictureParameterBufferVC1_0_29; | ||
| 1508 | + | ||
| 1509 | +/* MPEG-2 Picture Parameter Buffer (0.29) */ | ||
| 1510 | +typedef struct _VAPictureParameterBufferMPEG2_0_29 | ||
| 1511 | +{ | ||
| 1512 | + unsigned short horizontal_size; | ||
| 1513 | + unsigned short vertical_size; | ||
| 1514 | + VASurfaceID forward_reference_picture; | ||
| 1515 | + VASurfaceID backward_reference_picture; | ||
| 1516 | + /* meanings of the following fields are the same as in the standard */ | ||
| 1517 | + int picture_coding_type; | ||
| 1518 | + int f_code; /* pack all four fcode into this */ | ||
| 1519 | + union { | ||
| 1520 | + struct { | ||
| 1521 | + unsigned char intra_dc_precision : 2; | ||
| 1522 | + unsigned char picture_structure : 2; | ||
| 1523 | + unsigned char top_field_first : 1; | ||
| 1524 | + unsigned char frame_pred_frame_dct : 1; | ||
| 1525 | + unsigned char concealment_motion_vectors : 1; | ||
| 1526 | + unsigned char q_scale_type : 1; | ||
| 1527 | + unsigned char intra_vlc_format : 1; | ||
| 1528 | + unsigned char alternate_scan : 1; | ||
| 1529 | + unsigned char repeat_first_field : 1; | ||
| 1530 | + unsigned char progressive_frame : 1; | ||
| 1531 | + unsigned char is_first_field : 1; /* indicate whether the current field | ||
| 1532 | + * is the first field for field picture | ||
| 1533 | + */ | ||
| 1534 | + }; | ||
| 1535 | + unsigned int picture_coding_extension; | ||
| 1536 | + }; | ||
| 1537 | +} VAPictureParameterBufferMPEG2_0_29; | ||
| 1538 | + | ||
| 1539 | +/* MPEG-2 Slice Parameter Buffer (0.29) */ | ||
| 1540 | +typedef struct _VASliceParameterBufferMPEG2_0_29 | ||
| 1541 | +{ | ||
| 1542 | + unsigned int slice_data_size;/* number of bytes in the slice data buffer for this slice */ | ||
| 1543 | + unsigned int slice_data_offset;/* the offset to the first byte of slice data */ | ||
| 1544 | + unsigned int slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */ | ||
| 1545 | + unsigned int macroblock_offset;/* the offset to the first bit of MB from the first byte of slice data */ | ||
| 1546 | + unsigned int slice_vertical_position; | ||
| 1547 | + int quantiser_scale_code; | ||
| 1548 | + int intra_slice_flag; | ||
| 1549 | +} VASliceParameterBufferMPEG2_0_29; | ||
| 1550 | + | ||
| 1551 | +/* MPEG-4 Picture Parameter Buffer (0.29) */ | ||
| 1552 | +typedef struct _VAPictureParameterBufferMPEG4_0_29 | ||
| 1553 | +{ | ||
| 1554 | + unsigned short vop_width; | ||
| 1555 | + unsigned short vop_height; | ||
| 1556 | + VASurfaceID forward_reference_picture; | ||
| 1557 | + VASurfaceID backward_reference_picture; | ||
| 1558 | + union { | ||
| 1559 | + struct { | ||
| 1560 | + unsigned char short_video_header : 1; | ||
| 1561 | + unsigned char chroma_format : 2; | ||
| 1562 | + unsigned char interlaced : 1; | ||
| 1563 | + unsigned char obmc_disable : 1; | ||
| 1564 | + unsigned char sprite_enable : 2; | ||
| 1565 | + unsigned char sprite_warping_accuracy : 2; | ||
| 1566 | + unsigned char quant_type : 1; | ||
| 1567 | + unsigned char quarter_sample : 1; | ||
| 1568 | + unsigned char data_partitioned : 1; | ||
| 1569 | + unsigned char reversible_vlc : 1; | ||
| 1570 | + }; | ||
| 1571 | + unsigned short vol_fields; | ||
| 1572 | + }; | ||
| 1573 | + unsigned char no_of_sprite_warping_points; | ||
| 1574 | + short sprite_trajectory_du[3]; | ||
| 1575 | + short sprite_trajectory_dv[3]; | ||
| 1576 | + unsigned char quant_precision; | ||
| 1577 | + union { | ||
| 1578 | + struct { | ||
| 1579 | + unsigned char vop_coding_type : 2; | ||
| 1580 | + unsigned char backward_reference_vop_coding_type : 2; | ||
| 1581 | + unsigned char vop_rounding_type : 1; | ||
| 1582 | + unsigned char intra_dc_vlc_thr : 3; | ||
| 1583 | + unsigned char top_field_first : 1; | ||
| 1584 | + unsigned char alternate_vertical_scan_flag : 1; | ||
| 1585 | + }; | ||
| 1586 | + unsigned short vop_fields; | ||
| 1587 | + }; | ||
| 1588 | + unsigned char vop_fcode_forward; | ||
| 1589 | + unsigned char vop_fcode_backward; | ||
| 1590 | + /* short header related */ | ||
| 1591 | + unsigned char num_gobs_in_vop; | ||
| 1592 | + unsigned char num_macroblocks_in_gob; | ||
| 1593 | + /* for direct mode prediction */ | ||
| 1594 | + short TRB; | ||
| 1595 | + short TRD; | ||
| 1596 | +} VAPictureParameterBufferMPEG4_0_29; | ||
| 1597 | + | ||
| 1598 | +/* H.264 Picture (0.30) */ | ||
| 1599 | +typedef struct _VAPictureH264_0_30 | ||
| 1600 | +{ | ||
| 1601 | + VASurfaceID picture_id; | ||
| 1602 | + unsigned int flags; | ||
| 1603 | + unsigned int TopFieldOrderCnt; | ||
| 1604 | + unsigned int BottomFieldOrderCnt; | ||
| 1605 | +} VAPictureH264_0_30; | ||
| 1606 | + | ||
| 1607 | +/* H.264 Picture Parameter Buffer (0.30) */ | ||
| 1608 | +typedef struct _VAPictureParameterBufferH264_0_30 | ||
| 1609 | +{ | ||
| 1610 | + VAPictureH264 CurrPic; | ||
| 1611 | + VAPictureH264 ReferenceFrames[16]; /* in DPB */ | ||
| 1612 | + unsigned short picture_width_in_mbs_minus1; | ||
| 1613 | + unsigned short picture_height_in_mbs_minus1; | ||
| 1614 | + unsigned char bit_depth_luma_minus8; | ||
| 1615 | + unsigned char bit_depth_chroma_minus8; | ||
| 1616 | + unsigned char num_ref_frames; | ||
| 1617 | + union { | ||
| 1618 | + struct { | ||
| 1619 | + unsigned char chroma_format_idc : 2; | ||
| 1620 | + unsigned char residual_colour_transform_flag : 1; | ||
| 1621 | + unsigned char frame_mbs_only_flag : 1; | ||
| 1622 | + unsigned char mb_adaptive_frame_field_flag : 1; | ||
| 1623 | + unsigned char direct_8x8_inference_flag : 1; | ||
| 1624 | + unsigned char MinLumaBiPredSize8x8 : 1; /* see A.3.3.2 */ | ||
| 1625 | + } bits; | ||
| 1626 | + unsigned char value; | ||
| 1627 | + } seq_fields; | ||
| 1628 | + unsigned char num_slice_groups_minus1; | ||
| 1629 | + unsigned char slice_group_map_type; | ||
| 1630 | + signed char pic_init_qp_minus26; | ||
| 1631 | + signed char chroma_qp_index_offset; | ||
| 1632 | + signed char second_chroma_qp_index_offset; | ||
| 1633 | + union { | ||
| 1634 | + struct { | ||
| 1635 | + unsigned char entropy_coding_mode_flag : 1; | ||
| 1636 | + unsigned char weighted_pred_flag : 1; | ||
| 1637 | + unsigned char weighted_bipred_idc : 2; | ||
| 1638 | + unsigned char transform_8x8_mode_flag : 1; | ||
| 1639 | + unsigned char field_pic_flag : 1; | ||
| 1640 | + unsigned char constrained_intra_pred_flag : 1; | ||
| 1641 | + } bits; | ||
| 1642 | + unsigned char value; | ||
| 1643 | + } pic_fields; | ||
| 1644 | + unsigned short frame_num; | ||
| 1645 | +} VAPictureParameterBufferH264_0_30; | ||
| 1646 | + | ||
| 1647 | +/* H.264 Slice Parameter Buffer (0.30) */ | ||
| 1648 | +typedef struct _VASliceParameterBufferH264_0_30 | ||
| 1649 | +{ | ||
| 1650 | + unsigned int slice_data_size;/* number of bytes in the slice data buffer for this slice */ | ||
| 1651 | + unsigned int slice_data_offset;/* the offset to the NAL start code for this slice */ | ||
| 1652 | + unsigned int slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */ | ||
| 1653 | + unsigned short slice_data_bit_offset; /* bit offset from NAL start code to the beginning of slice data */ | ||
| 1654 | + unsigned short first_mb_in_slice; | ||
| 1655 | + unsigned char slice_type; | ||
| 1656 | + unsigned char direct_spatial_mv_pred_flag; | ||
| 1657 | + unsigned char num_ref_idx_l0_active_minus1; | ||
| 1658 | + unsigned char num_ref_idx_l1_active_minus1; | ||
| 1659 | + unsigned char cabac_init_idc; | ||
| 1660 | + char slice_qp_delta; | ||
| 1661 | + unsigned char disable_deblocking_filter_idc; | ||
| 1662 | + char slice_alpha_c0_offset_div2; | ||
| 1663 | + char slice_beta_offset_div2; | ||
| 1664 | + VAPictureH264 RefPicList0[32]; /* See 8.2.4.2 */ | ||
| 1665 | + VAPictureH264 RefPicList1[32]; /* See 8.2.4.2 */ | ||
| 1666 | + unsigned char luma_log2_weight_denom; | ||
| 1667 | + unsigned char chroma_log2_weight_denom; | ||
| 1668 | + unsigned char luma_weight_l0_flag; | ||
| 1669 | + short luma_weight_l0[32]; | ||
| 1670 | + short luma_offset_l0[32]; | ||
| 1671 | + unsigned char chroma_weight_l0_flag; | ||
| 1672 | + short chroma_weight_l0[32][2]; | ||
| 1673 | + short chroma_offset_l0[32][2]; | ||
| 1674 | + unsigned char luma_weight_l1_flag; | ||
| 1675 | + short luma_weight_l1[32]; | ||
| 1676 | + short luma_offset_l1[32]; | ||
| 1677 | + unsigned char chroma_weight_l1_flag; | ||
| 1678 | + short chroma_weight_l1[32][2]; | ||
| 1679 | + short chroma_offset_l1[32][2]; | ||
| 1680 | +} VASliceParameterBufferH264_0_30; | ||
| 1681 | + | ||
| 1682 | +/* VC-1 Picture Parameter Buffer (0.30) */ | ||
| 1683 | +typedef struct _VAPictureParameterBufferVC1_0_30 | ||
| 1684 | +{ | ||
| 1685 | + VASurfaceID forward_reference_picture; | ||
| 1686 | + VASurfaceID backward_reference_picture; | ||
| 1687 | + /* if out-of-loop post-processing is done on the render | ||
| 1688 | + target, then we need to keep the in-loop decoded | ||
| 1689 | + picture as a reference picture */ | ||
| 1690 | + VASurfaceID inloop_decoded_picture; | ||
| 1691 | + | ||
| 1692 | + /* sequence layer for AP or meta data for SP and MP */ | ||
| 1693 | + union { | ||
| 1694 | + struct { | ||
| 1695 | + unsigned char interlace : 1; /* SEQUENCE_LAYER::INTERLACE */ | ||
| 1696 | + unsigned char syncmarker : 1;/* METADATA::SYNCMARKER */ | ||
| 1697 | + unsigned char overlap : 1;/* METADATA::OVERLAP */ | ||
| 1698 | + } bits; | ||
| 1699 | + unsigned char value; | ||
| 1700 | + } sequence_fields; | ||
| 1701 | + | ||
| 1702 | + unsigned short coded_width; /* ENTRY_POINT_LAYER::CODED_WIDTH */ | ||
| 1703 | + unsigned short coded_height; /* ENTRY_POINT_LAYER::CODED_HEIGHT */ | ||
| 1704 | + unsigned char closed_entry; /* ENTRY_POINT_LAYER::CLOSED_ENTRY */ | ||
| 1705 | + unsigned char broken_link; /* ENTRY_POINT_LAYER::BROKEN_LINK */ | ||
| 1706 | + unsigned char loopfilter; /* ENTRY_POINT_LAYER::LOOPFILTER */ | ||
| 1707 | + unsigned char conditional_overlap_flag; /* ENTRY_POINT_LAYER::CONDOVER */ | ||
| 1708 | + unsigned char fast_uvmc_flag; /* ENTRY_POINT_LAYER::FASTUVMC */ | ||
| 1709 | + union { | ||
| 1710 | + struct { | ||
| 1711 | + unsigned char luma_flag : 1; /* ENTRY_POINT_LAYER::RANGE_MAPY_FLAG */ | ||
| 1712 | + unsigned char luma : 3; /* ENTRY_POINT_LAYER::RANGE_MAPY */ | ||
| 1713 | + unsigned char chroma_flag : 1; /* ENTRY_POINT_LAYER::RANGE_MAPUV_FLAG */ | ||
| 1714 | + unsigned char chroma : 3; /* ENTRY_POINT_LAYER::RANGE_MAPUV */ | ||
| 1715 | + } bits; | ||
| 1716 | + unsigned char value; | ||
| 1717 | + } range_mapping_fields; | ||
| 1718 | + | ||
| 1719 | + unsigned char b_picture_fraction; /* PICTURE_LAYER::BFRACTION */ | ||
| 1720 | + unsigned char cbp_table; /* PICTURE_LAYER::CBPTAB/ICBPTAB */ | ||
| 1721 | + unsigned char mb_mode_table; /* PICTURE_LAYER::MBMODETAB */ | ||
| 1722 | + unsigned char range_reduction_frame;/* PICTURE_LAYER::RANGEREDFRM */ | ||
| 1723 | + unsigned char rounding_control; /* PICTURE_LAYER::RNDCTRL */ | ||
| 1724 | + unsigned char post_processing; /* PICTURE_LAYER::POSTPROC */ | ||
| 1725 | + unsigned char picture_resolution_index; /* PICTURE_LAYER::RESPIC */ | ||
| 1726 | + unsigned char luma_scale; /* PICTURE_LAYER::LUMSCALE */ | ||
| 1727 | + unsigned char luma_shift; /* PICTURE_LAYER::LUMSHIFT */ | ||
| 1728 | + union { | ||
| 1729 | + struct { | ||
| 1730 | + unsigned char picture_type : 2; /* PICTURE_LAYER::PTYPE */ | ||
| 1731 | + unsigned char frame_coding_mode : 3; /* PICTURE_LAYER::FCM */ | ||
| 1732 | + unsigned char top_field_first : 1; /* PICTURE_LAYER::TFF */ | ||
| 1733 | + unsigned char is_first_field : 1; /* set to 1 if it is the first field */ | ||
| 1734 | + unsigned char intensity_compensation : 1; /* PICTURE_LAYER::INTCOMP */ | ||
| 1735 | + } bits; | ||
| 1736 | + unsigned char value; | ||
| 1737 | + } picture_fields; | ||
| 1738 | + union { | ||
| 1739 | + struct { | ||
| 1740 | + unsigned char mv_type_mb : 1; /* PICTURE::MVTYPEMB */ | ||
| 1741 | + unsigned char direct_mb : 1; /* PICTURE::DIRECTMB */ | ||
| 1742 | + unsigned char skip_mb : 1; /* PICTURE::SKIPMB */ | ||
| 1743 | + unsigned char field_tx : 1; /* PICTURE::FIELDTX */ | ||
| 1744 | + unsigned char forward_mb : 1; /* PICTURE::FORWARDMB */ | ||
| 1745 | + unsigned char ac_pred : 1; /* PICTURE::ACPRED */ | ||
| 1746 | + unsigned char overflags : 1; /* PICTURE::OVERFLAGS */ | ||
| 1747 | + } flags; | ||
| 1748 | + unsigned char value; | ||
| 1749 | + } raw_coding; | ||
| 1750 | + union { | ||
| 1751 | + struct { | ||
| 1752 | + unsigned char bp_mv_type_mb : 1; /* PICTURE::MVTYPEMB */ | ||
| 1753 | + unsigned char bp_direct_mb : 1; /* PICTURE::DIRECTMB */ | ||
| 1754 | + unsigned char bp_skip_mb : 1; /* PICTURE::SKIPMB */ | ||
| 1755 | + unsigned char bp_field_tx : 1; /* PICTURE::FIELDTX */ | ||
| 1756 | + unsigned char bp_forward_mb : 1; /* PICTURE::FORWARDMB */ | ||
| 1757 | + unsigned char bp_ac_pred : 1; /* PICTURE::ACPRED */ | ||
| 1758 | + unsigned char bp_overflags : 1; /* PICTURE::OVERFLAGS */ | ||
| 1759 | + } flags; | ||
| 1760 | + unsigned char value; | ||
| 1761 | + } bitplane_present; /* signal what bitplane is being passed via the bitplane buffer */ | ||
| 1762 | + union { | ||
| 1763 | + struct { | ||
| 1764 | + unsigned char reference_distance_flag : 1;/* PICTURE_LAYER::REFDIST_FLAG */ | ||
| 1765 | + unsigned char reference_distance : 5;/* PICTURE_LAYER::REFDIST */ | ||
| 1766 | + unsigned char num_reference_pictures: 1;/* PICTURE_LAYER::NUMREF */ | ||
| 1767 | + unsigned char reference_field_pic_indicator : 1;/* PICTURE_LAYER::REFFIELD */ | ||
| 1768 | + } bits; | ||
| 1769 | + unsigned short value; | ||
| 1770 | + } reference_fields; | ||
| 1771 | + union { | ||
| 1772 | + struct { | ||
| 1773 | + unsigned char mv_mode : 3; /* PICTURE_LAYER::MVMODE */ | ||
| 1774 | + unsigned char mv_mode2 : 3; /* PICTURE_LAYER::MVMODE2 */ | ||
| 1775 | + unsigned char mv_table : 3; /* PICTURE_LAYER::MVTAB/IMVTAB */ | ||
| 1776 | + unsigned char two_mv_block_pattern_table: 2; /* PICTURE_LAYER::2MVBPTAB */ | ||
| 1777 | + unsigned char four_mv_switch : 1; /* PICTURE_LAYER::4MVSWITCH */ | ||
| 1778 | + unsigned char four_mv_block_pattern_table : 2; /* PICTURE_LAYER::4MVBPTAB */ | ||
| 1779 | + unsigned char extended_mv_flag : 1; /* ENTRY_POINT_LAYER::EXTENDED_MV */ | ||
| 1780 | + unsigned char extended_mv_range : 2; /* PICTURE_LAYER::MVRANGE */ | ||
| 1781 | + unsigned char extended_dmv_flag : 1; /* ENTRY_POCHAR_LAYER::EXTENDED_DMV */ | ||
| 1782 | + unsigned char extended_dmv_range : 2; /* PICTURE_LAYER::DMVRANGE */ | ||
| 1783 | + } bits; | ||
| 1784 | + unsigned int value; | ||
| 1785 | + } mv_fields; | ||
| 1786 | + union { | ||
| 1787 | + struct { | ||
| 1788 | + unsigned char dquant : 2; /* ENTRY_POINT_LAYER::DQUANT */ | ||
| 1789 | + unsigned char quantizer : 2; /* ENTRY_POINT_LAYER::QUANTIZER */ | ||
| 1790 | + unsigned char half_qp : 1; /* PICTURE_LAYER::HALFQP */ | ||
| 1791 | + unsigned char pic_quantizer_scale : 5;/* PICTURE_LAYER::PQUANT */ | ||
| 1792 | + unsigned char pic_quantizer_type : 1;/* PICTURE_LAYER::PQUANTIZER */ | ||
| 1793 | + unsigned char dq_frame : 1; /* VOPDQUANT::DQUANTFRM */ | ||
| 1794 | + unsigned char dq_profile : 2; /* VOPDQUANT::DQPROFILE */ | ||
| 1795 | + unsigned char dq_sb_edge : 2; /* VOPDQUANT::DQSBEDGE */ | ||
| 1796 | + unsigned char dq_db_edge : 2; /* VOPDQUANT::DQDBEDGE */ | ||
| 1797 | + unsigned char dq_binary_level : 1; /* VOPDQUANT::DQBILEVEL */ | ||
| 1798 | + unsigned char alt_pic_quantizer : 5;/* VOPDQUANT::ALTPQUANT */ | ||
| 1799 | + } bits; | ||
| 1800 | + unsigned long value; | ||
| 1801 | + } pic_quantizer_fields; | ||
| 1802 | + union { | ||
| 1803 | + struct { | ||
| 1804 | + unsigned char variable_sized_transform_flag : 1;/* ENTRY_POINT_LAYER::VSTRANSFORM */ | ||
| 1805 | + unsigned char mb_level_transform_type_flag : 1;/* PICTURE_LAYER::TTMBF */ | ||
| 1806 | + unsigned char frame_level_transform_type : 2;/* PICTURE_LAYER::TTFRM */ | ||
| 1807 | + unsigned char transform_ac_codingset_idx1 : 2;/* PICTURE_LAYER::TRANSACFRM */ | ||
| 1808 | + unsigned char transform_ac_codingset_idx2 : 2;/* PICTURE_LAYER::TRANSACFRM2 */ | ||
| 1809 | + unsigned char intra_transform_dc_table : 1;/* PICTURE_LAYER::TRANSDCTAB */ | ||
| 1810 | + } bits; | ||
| 1811 | + unsigned short value; | ||
| 1812 | + } transform_fields; | ||
| 1813 | +} VAPictureParameterBufferVC1_0_30; | ||
| 1814 | + | ||
| 1815 | +/* MPEG-2 Picture Parameter Buffer (0.30) */ | ||
| 1816 | +typedef struct _VAPictureParameterBufferMPEG2_0_30 | ||
| 1817 | +{ | ||
| 1818 | + unsigned short horizontal_size; | ||
| 1819 | + unsigned short vertical_size; | ||
| 1820 | + VASurfaceID forward_reference_picture; | ||
| 1821 | + VASurfaceID backward_reference_picture; | ||
| 1822 | + /* meanings of the following fields are the same as in the standard */ | ||
| 1823 | + int picture_coding_type; | ||
| 1824 | + int f_code; /* pack all four fcode into this */ | ||
| 1825 | + union { | ||
| 1826 | + struct { | ||
| 1827 | + unsigned int intra_dc_precision : 2; | ||
| 1828 | + unsigned int picture_structure : 2; | ||
| 1829 | + unsigned int top_field_first : 1; | ||
| 1830 | + unsigned int frame_pred_frame_dct : 1; | ||
| 1831 | + unsigned int concealment_motion_vectors : 1; | ||
| 1832 | + unsigned int q_scale_type : 1; | ||
| 1833 | + unsigned int intra_vlc_format : 1; | ||
| 1834 | + unsigned int alternate_scan : 1; | ||
| 1835 | + unsigned int repeat_first_field : 1; | ||
| 1836 | + unsigned int progressive_frame : 1; | ||
| 1837 | + unsigned int is_first_field : 1; /* indicate whether the current field | ||
| 1838 | + * is the first field for field picture | ||
| 1839 | + */ | ||
| 1840 | + } bits; | ||
| 1841 | + unsigned int value; | ||
| 1842 | + } picture_coding_extension; | ||
| 1843 | +} VAPictureParameterBufferMPEG2_0_30; | ||
| 1844 | + | ||
| 1845 | +/* MPEG-2 Slice Parameter Buffer (0.29) */ | ||
| 1846 | +typedef VASliceParameterBufferMPEG2_0_29 VASliceParameterBufferMPEG2_0_30; | ||
| 1847 | + | ||
| 1848 | +/* MPEG-4 Picture Parameter Buffer (0.30) */ | ||
| 1849 | +typedef struct _VAPictureParameterBufferMPEG4_0_30 | ||
| 1850 | +{ | ||
| 1851 | + unsigned short vop_width; | ||
| 1852 | + unsigned short vop_height; | ||
| 1853 | + VASurfaceID forward_reference_picture; | ||
| 1854 | + VASurfaceID backward_reference_picture; | ||
| 1855 | + union { | ||
| 1856 | + struct { | ||
| 1857 | + unsigned char short_video_header : 1; | ||
| 1858 | + unsigned char chroma_format : 2; | ||
| 1859 | + unsigned char interlaced : 1; | ||
| 1860 | + unsigned char obmc_disable : 1; | ||
| 1861 | + unsigned char sprite_enable : 2; | ||
| 1862 | + unsigned char sprite_warping_accuracy : 2; | ||
| 1863 | + unsigned char quant_type : 1; | ||
| 1864 | + unsigned char quarter_sample : 1; | ||
| 1865 | + unsigned char data_partitioned : 1; | ||
| 1866 | + unsigned char reversible_vlc : 1; | ||
| 1867 | + } bits; | ||
| 1868 | + unsigned short value; | ||
| 1869 | + } vol_fields; | ||
| 1870 | + unsigned char no_of_sprite_warping_points; | ||
| 1871 | + short sprite_trajectory_du[3]; | ||
| 1872 | + short sprite_trajectory_dv[3]; | ||
| 1873 | + unsigned char quant_precision; | ||
| 1874 | + union { | ||
| 1875 | + struct { | ||
| 1876 | + unsigned char vop_coding_type : 2; | ||
| 1877 | + unsigned char backward_reference_vop_coding_type : 2; | ||
| 1878 | + unsigned char vop_rounding_type : 1; | ||
| 1879 | + unsigned char intra_dc_vlc_thr : 3; | ||
| 1880 | + unsigned char top_field_first : 1; | ||
| 1881 | + unsigned char alternate_vertical_scan_flag : 1; | ||
| 1882 | + } bits; | ||
| 1883 | + unsigned short value; | ||
| 1884 | + } vop_fields; | ||
| 1885 | + unsigned char vop_fcode_forward; | ||
| 1886 | + unsigned char vop_fcode_backward; | ||
| 1887 | + /* short header related */ | ||
| 1888 | + unsigned char num_gobs_in_vop; | ||
| 1889 | + unsigned char num_macroblocks_in_gob; | ||
| 1890 | + /* for direct mode prediction */ | ||
| 1891 | + short TRB; | ||
| 1892 | + short TRD; | ||
| 1893 | +} VAPictureParameterBufferMPEG4_0_30; | ||
| 1894 | + | ||
| 1895 | +/* Encode Slice Parameter Buffer (0.30) */ | ||
| 1896 | +typedef struct _VAEncSliceParameterBuffer_0_30 | ||
| 1897 | +{ | ||
| 1898 | + unsigned int start_row_number; /* starting MB row number for this slice */ | ||
| 1899 | + unsigned int slice_height; /* slice height measured in MB */ | ||
| 1900 | + union { | ||
| 1901 | + struct { | ||
| 1902 | + unsigned char is_intra : 1; | ||
| 1903 | + unsigned char disable_deblocking_filter_idc : 2; | ||
| 1904 | + } bits; | ||
| 1905 | + unsigned char value; | ||
| 1906 | + } slice_flags; | ||
| 1907 | +} VAEncSliceParameterBuffer_0_30; | ||
| 1908 | + | ||
| 1909 | +/* MPEG-4 Picture Parameter Buffer (0.31) */ | ||
| 1910 | +typedef struct _VAPictureParameterBufferMPEG4_0_31 | ||
| 1911 | +{ | ||
| 1912 | + unsigned short vop_width; | ||
| 1913 | + unsigned short vop_height; | ||
| 1914 | + VASurfaceID forward_reference_picture; | ||
| 1915 | + VASurfaceID backward_reference_picture; | ||
| 1916 | + union { | ||
| 1917 | + struct { | ||
| 1918 | + unsigned int short_video_header : 1; | ||
| 1919 | + unsigned int chroma_format : 2; | ||
| 1920 | + unsigned int interlaced : 1; | ||
| 1921 | + unsigned int obmc_disable : 1; | ||
| 1922 | + unsigned int sprite_enable : 2; | ||
| 1923 | + unsigned int sprite_warping_accuracy : 2; | ||
| 1924 | + unsigned int quant_type : 1; | ||
| 1925 | + unsigned int quarter_sample : 1; | ||
| 1926 | + unsigned int data_partitioned : 1; | ||
| 1927 | + unsigned int reversible_vlc : 1; | ||
| 1928 | + } bits; | ||
| 1929 | + unsigned int value; | ||
| 1930 | + } vol_fields; | ||
| 1931 | + unsigned char no_of_sprite_warping_points; | ||
| 1932 | + short sprite_trajectory_du[3]; | ||
| 1933 | + short sprite_trajectory_dv[3]; | ||
| 1934 | + unsigned char quant_precision; | ||
| 1935 | + union { | ||
| 1936 | + struct { | ||
| 1937 | + unsigned int vop_coding_type : 2; | ||
| 1938 | + unsigned int backward_reference_vop_coding_type : 2; | ||
| 1939 | + unsigned int vop_rounding_type : 1; | ||
| 1940 | + unsigned int intra_dc_vlc_thr : 3; | ||
| 1941 | + unsigned int top_field_first : 1; | ||
| 1942 | + unsigned int alternate_vertical_scan_flag : 1; | ||
| 1943 | + } bits; | ||
| 1944 | + unsigned int value; | ||
| 1945 | + } vop_fields; | ||
| 1946 | + unsigned char vop_fcode_forward; | ||
| 1947 | + unsigned char vop_fcode_backward; | ||
| 1948 | + /* short header related */ | ||
| 1949 | + unsigned char num_gobs_in_vop; | ||
| 1950 | + unsigned char num_macroblocks_in_gob; | ||
| 1951 | + /* for direct mode prediction */ | ||
| 1952 | + short TRB; | ||
| 1953 | + short TRD; | ||
| 1954 | +} VAPictureParameterBufferMPEG4_0_31; | ||
| 1955 | + | ||
| 1956 | +typedef struct VADriverContext_0_29 *VADriverContextP_0_29; | ||
| 1957 | + | ||
| 1958 | +/* Driver VTable (0.29) */ | ||
| 1959 | +struct VADriverVTable_0_29 | ||
| 1960 | +{ | ||
| 1961 | + VAStatus (*vaTerminate) ( VADriverContextP_0_29 ctx ); | ||
| 1962 | + | ||
| 1963 | + VAStatus (*vaQueryConfigProfiles) ( | ||
| 1964 | + VADriverContextP_0_29 ctx, | ||
| 1965 | + VAProfile *profile_list, /* out */ | ||
| 1966 | + int *num_profiles /* out */ | ||
| 1967 | + ); | ||
| 1968 | + | ||
| 1969 | + VAStatus (*vaQueryConfigEntrypoints) ( | ||
| 1970 | + VADriverContextP_0_29 ctx, | ||
| 1971 | + VAProfile profile, | ||
| 1972 | + VAEntrypoint *entrypoint_list, /* out */ | ||
| 1973 | + int *num_entrypoints /* out */ | ||
| 1974 | + ); | ||
| 1975 | + | ||
| 1976 | + VAStatus (*vaGetConfigAttributes) ( | ||
| 1977 | + VADriverContextP_0_29 ctx, | ||
| 1978 | + VAProfile profile, | ||
| 1979 | + VAEntrypoint entrypoint, | ||
| 1980 | + VAConfigAttrib *attrib_list, /* in/out */ | ||
| 1981 | + int num_attribs | ||
| 1982 | + ); | ||
| 1983 | + | ||
| 1984 | + VAStatus (*vaCreateConfig) ( | ||
| 1985 | + VADriverContextP_0_29 ctx, | ||
| 1986 | + VAProfile profile, | ||
| 1987 | + VAEntrypoint entrypoint, | ||
| 1988 | + VAConfigAttrib *attrib_list, | ||
| 1989 | + int num_attribs, | ||
| 1990 | + VAConfigID *config_id /* out */ | ||
| 1991 | + ); | ||
| 1992 | + | ||
| 1993 | + VAStatus (*vaDestroyConfig) ( | ||
| 1994 | + VADriverContextP_0_29 ctx, | ||
| 1995 | + VAConfigID config_id | ||
| 1996 | + ); | ||
| 1997 | + | ||
| 1998 | + VAStatus (*vaQueryConfigAttributes) ( | ||
| 1999 | + VADriverContextP_0_29 ctx, | ||
| 2000 | + VAConfigID config_id, | ||
| 2001 | + VAProfile *profile, /* out */ | ||
| 2002 | + VAEntrypoint *entrypoint, /* out */ | ||
| 2003 | + VAConfigAttrib *attrib_list, /* out */ | ||
| 2004 | + int *num_attribs /* out */ | ||
| 2005 | + ); | ||
| 2006 | + | ||
| 2007 | + VAStatus (*vaCreateSurfaces) ( | ||
| 2008 | + VADriverContextP_0_29 ctx, | ||
| 2009 | + int width, | ||
| 2010 | + int height, | ||
| 2011 | + int format, | ||
| 2012 | + int num_surfaces, | ||
| 2013 | + VASurfaceID *surfaces /* out */ | ||
| 2014 | + ); | ||
| 2015 | + | ||
| 2016 | + VAStatus (*vaDestroySurfaces) ( | ||
| 2017 | + VADriverContextP_0_29 ctx, | ||
| 2018 | + VASurfaceID *surface_list, | ||
| 2019 | + int num_surfaces | ||
| 2020 | + ); | ||
| 2021 | + | ||
| 2022 | + VAStatus (*vaCreateContext) ( | ||
| 2023 | + VADriverContextP_0_29 ctx, | ||
| 2024 | + VAConfigID config_id, | ||
| 2025 | + int picture_width, | ||
| 2026 | + int picture_height, | ||
| 2027 | + int flag, | ||
| 2028 | + VASurfaceID *render_targets, | ||
| 2029 | + int num_render_targets, | ||
| 2030 | + VAContextID *context /* out */ | ||
| 2031 | + ); | ||
| 2032 | + | ||
| 2033 | + VAStatus (*vaDestroyContext) ( | ||
| 2034 | + VADriverContextP_0_29 ctx, | ||
| 2035 | + VAContextID context | ||
| 2036 | + ); | ||
| 2037 | + | ||
| 2038 | + VAStatus (*vaCreateBuffer) ( | ||
| 2039 | + VADriverContextP_0_29 ctx, | ||
| 2040 | + VAContextID context, /* in */ | ||
| 2041 | + VABufferType type, /* in */ | ||
| 2042 | + unsigned int size, /* in */ | ||
| 2043 | + unsigned int num_elements, /* in */ | ||
| 2044 | + void *data, /* in */ | ||
| 2045 | + VABufferID *buf_id /* out */ | ||
| 2046 | + ); | ||
| 2047 | + | ||
| 2048 | + VAStatus (*vaBufferSetNumElements) ( | ||
| 2049 | + VADriverContextP_0_29 ctx, | ||
| 2050 | + VABufferID buf_id, /* in */ | ||
| 2051 | + unsigned int num_elements /* in */ | ||
| 2052 | + ); | ||
| 2053 | + | ||
| 2054 | + VAStatus (*vaMapBuffer) ( | ||
| 2055 | + VADriverContextP_0_29 ctx, | ||
| 2056 | + VABufferID buf_id, /* in */ | ||
| 2057 | + void **pbuf /* out */ | ||
| 2058 | + ); | ||
| 2059 | + | ||
| 2060 | + VAStatus (*vaUnmapBuffer) ( | ||
| 2061 | + VADriverContextP_0_29 ctx, | ||
| 2062 | + VABufferID buf_id /* in */ | ||
| 2063 | + ); | ||
| 2064 | + | ||
| 2065 | + VAStatus (*vaDestroyBuffer) ( | ||
| 2066 | + VADriverContextP_0_29 ctx, | ||
| 2067 | + VABufferID buffer_id | ||
| 2068 | + ); | ||
| 2069 | + | ||
| 2070 | + VAStatus (*vaBeginPicture) ( | ||
| 2071 | + VADriverContextP_0_29 ctx, | ||
| 2072 | + VAContextID context, | ||
| 2073 | + VASurfaceID render_target | ||
| 2074 | + ); | ||
| 2075 | + | ||
| 2076 | + VAStatus (*vaRenderPicture) ( | ||
| 2077 | + VADriverContextP_0_29 ctx, | ||
| 2078 | + VAContextID context, | ||
| 2079 | + VABufferID *buffers, | ||
| 2080 | + int num_buffers | ||
| 2081 | + ); | ||
| 2082 | + | ||
| 2083 | + VAStatus (*vaEndPicture) ( | ||
| 2084 | + VADriverContextP_0_29 ctx, | ||
| 2085 | + VAContextID context | ||
| 2086 | + ); | ||
| 2087 | + | ||
| 2088 | + VAStatus (*vaSyncSurface) ( | ||
| 2089 | + VADriverContextP_0_29 ctx, | ||
| 2090 | + VAContextID context, | ||
| 2091 | + VASurfaceID render_target | ||
| 2092 | + ); | ||
| 2093 | + | ||
| 2094 | + VAStatus (*vaQuerySurfaceStatus) ( | ||
| 2095 | + VADriverContextP_0_29 ctx, | ||
| 2096 | + VASurfaceID render_target, | ||
| 2097 | + VASurfaceStatus *status /* out */ | ||
| 2098 | + ); | ||
| 2099 | + | ||
| 2100 | + VAStatus (*vaPutSurface) ( | ||
| 2101 | + VADriverContextP_0_29 ctx, | ||
| 2102 | + VASurfaceID surface, | ||
| 2103 | + unsigned long draw, /* X Drawable */ | ||
| 2104 | + short srcx, | ||
| 2105 | + short srcy, | ||
| 2106 | + unsigned short srcw, | ||
| 2107 | + unsigned short srch, | ||
| 2108 | + short destx, | ||
| 2109 | + short desty, | ||
| 2110 | + unsigned short destw, | ||
| 2111 | + unsigned short desth, | ||
| 2112 | + VARectangle *cliprects, /* client supplied clip list */ | ||
| 2113 | + unsigned int number_cliprects, /* number of clip rects in the clip list */ | ||
| 2114 | + unsigned int flags /* de-interlacing flags */ | ||
| 2115 | + ); | ||
| 2116 | + | ||
| 2117 | + VAStatus (*vaQueryImageFormats) ( | ||
| 2118 | + VADriverContextP_0_29 ctx, | ||
| 2119 | + VAImageFormat *format_list, /* out */ | ||
| 2120 | + int *num_formats /* out */ | ||
| 2121 | + ); | ||
| 2122 | + | ||
| 2123 | + VAStatus (*vaCreateImage) ( | ||
| 2124 | + VADriverContextP_0_29 ctx, | ||
| 2125 | + VAImageFormat *format, | ||
| 2126 | + int width, | ||
| 2127 | + int height, | ||
| 2128 | + VAImage *image /* out */ | ||
| 2129 | + ); | ||
| 2130 | + | ||
| 2131 | + VAStatus (*vaDeriveImage) ( | ||
| 2132 | + VADriverContextP_0_29 ctx, | ||
| 2133 | + VASurfaceID surface, | ||
| 2134 | + VAImage *image /* out */ | ||
| 2135 | + ); | ||
| 2136 | + | ||
| 2137 | + VAStatus (*vaDestroyImage) ( | ||
| 2138 | + VADriverContextP_0_29 ctx, | ||
| 2139 | + VAImageID image | ||
| 2140 | + ); | ||
| 2141 | + | ||
| 2142 | + VAStatus (*vaSetImagePalette) ( | ||
| 2143 | + VADriverContextP_0_29 ctx, | ||
| 2144 | + VAImageID image, | ||
| 2145 | + /* | ||
| 2146 | + * pointer to an array holding the palette data. The size of the array is | ||
| 2147 | + * num_palette_entries * entry_bytes in size. The order of the components | ||
| 2148 | + * in the palette is described by the component_order in VAImage struct | ||
| 2149 | + */ | ||
| 2150 | + unsigned char *palette | ||
| 2151 | + ); | ||
| 2152 | + | ||
| 2153 | + VAStatus (*vaGetImage) ( | ||
| 2154 | + VADriverContextP_0_29 ctx, | ||
| 2155 | + VASurfaceID surface, | ||
| 2156 | + int x, /* coordinates of the upper left source pixel */ | ||
| 2157 | + int y, | ||
| 2158 | + unsigned int width, /* width and height of the region */ | ||
| 2159 | + unsigned int height, | ||
| 2160 | + VAImageID image | ||
| 2161 | + ); | ||
| 2162 | + | ||
| 2163 | + VAStatus (*vaPutImage) ( | ||
| 2164 | + VADriverContextP_0_29 ctx, | ||
| 2165 | + VASurfaceID surface, | ||
| 2166 | + VAImageID image, | ||
| 2167 | + int src_x, | ||
| 2168 | + int src_y, | ||
| 2169 | + unsigned int width, | ||
| 2170 | + unsigned int height, | ||
| 2171 | + int dest_x, | ||
| 2172 | + int dest_y | ||
| 2173 | + ); | ||
| 2174 | + | ||
| 2175 | + VAStatus (*vaPutImage2) ( | ||
| 2176 | + VADriverContextP_0_29 ctx, | ||
| 2177 | + VASurfaceID surface, | ||
| 2178 | + VAImageID image, | ||
| 2179 | + int src_x, | ||
| 2180 | + int src_y, | ||
| 2181 | + unsigned int src_width, | ||
| 2182 | + unsigned int src_height, | ||
| 2183 | + int dest_x, | ||
| 2184 | + int dest_y, | ||
| 2185 | + unsigned int dest_width, | ||
| 2186 | + unsigned int dest_height | ||
| 2187 | + ); | ||
| 2188 | + | ||
| 2189 | + VAStatus (*vaQuerySubpictureFormats) ( | ||
| 2190 | + VADriverContextP_0_29 ctx, | ||
| 2191 | + VAImageFormat *format_list, /* out */ | ||
| 2192 | + unsigned int *flags, /* out */ | ||
| 2193 | + unsigned int *num_formats /* out */ | ||
| 2194 | + ); | ||
| 2195 | + | ||
| 2196 | + VAStatus (*vaCreateSubpicture) ( | ||
| 2197 | + VADriverContextP_0_29 ctx, | ||
| 2198 | + VAImageID image, | ||
| 2199 | + VASubpictureID *subpicture /* out */ | ||
| 2200 | + ); | ||
| 2201 | + | ||
| 2202 | + VAStatus (*vaDestroySubpicture) ( | ||
| 2203 | + VADriverContextP_0_29 ctx, | ||
| 2204 | + VASubpictureID subpicture | ||
| 2205 | + ); | ||
| 2206 | + | ||
| 2207 | + VAStatus (*vaSetSubpictureImage) ( | ||
| 2208 | + VADriverContextP_0_29 ctx, | ||
| 2209 | + VASubpictureID subpicture, | ||
| 2210 | + VAImageID image | ||
| 2211 | + ); | ||
| 2212 | + | ||
| 2213 | + VAStatus (*vaSetSubpicturePalette) ( | ||
| 2214 | + VADriverContextP_0_29 ctx, | ||
| 2215 | + VASubpictureID subpicture, | ||
| 2216 | + /* | ||
| 2217 | + * pointer to an array holding the palette data. The size of the array is | ||
| 2218 | + * num_palette_entries * entry_bytes in size. The order of the components | ||
| 2219 | + * in the palette is described by the component_order in VASubpicture struct | ||
| 2220 | + */ | ||
| 2221 | + unsigned char *palette | ||
| 2222 | + ); | ||
| 2223 | + | ||
| 2224 | + VAStatus (*vaSetSubpictureChromakey) ( | ||
| 2225 | + VADriverContextP_0_29 ctx, | ||
| 2226 | + VASubpictureID subpicture, | ||
| 2227 | + unsigned int chromakey_min, | ||
| 2228 | + unsigned int chromakey_max, | ||
| 2229 | + unsigned int chromakey_mask | ||
| 2230 | + ); | ||
| 2231 | + | ||
| 2232 | + VAStatus (*vaSetSubpictureGlobalAlpha) ( | ||
| 2233 | + VADriverContextP_0_29 ctx, | ||
| 2234 | + VASubpictureID subpicture, | ||
| 2235 | + float global_alpha | ||
| 2236 | + ); | ||
| 2237 | + | ||
| 2238 | + VAStatus (*vaAssociateSubpicture) ( | ||
| 2239 | + VADriverContextP_0_29 ctx, | ||
| 2240 | + VASubpictureID subpicture, | ||
| 2241 | + VASurfaceID *target_surfaces, | ||
| 2242 | + int num_surfaces, | ||
| 2243 | + short src_x, /* upper left offset in subpicture */ | ||
| 2244 | + short src_y, | ||
| 2245 | + short dest_x, /* upper left offset in surface */ | ||
| 2246 | + short dest_y, | ||
| 2247 | + unsigned short width, | ||
| 2248 | + unsigned short height, | ||
| 2249 | + /* | ||
| 2250 | + * whether to enable chroma-keying or global-alpha | ||
| 2251 | + * see VA_SUBPICTURE_XXX values | ||
| 2252 | + */ | ||
| 2253 | + unsigned int flags | ||
| 2254 | + ); | ||
| 2255 | + | ||
| 2256 | + VAStatus (*vaAssociateSubpicture2) ( | ||
| 2257 | + VADriverContextP_0_29 ctx, | ||
| 2258 | + VASubpictureID subpicture, | ||
| 2259 | + VASurfaceID *target_surfaces, | ||
| 2260 | + int num_surfaces, | ||
| 2261 | + short src_x, /* upper left offset in subpicture */ | ||
| 2262 | + short src_y, | ||
| 2263 | + unsigned short src_width, | ||
| 2264 | + unsigned short src_height, | ||
| 2265 | + short dest_x, /* upper left offset in surface */ | ||
| 2266 | + short dest_y, | ||
| 2267 | + unsigned short dest_width, | ||
| 2268 | + unsigned short dest_height, | ||
| 2269 | + /* | ||
| 2270 | + * whether to enable chroma-keying or global-alpha | ||
| 2271 | + * see VA_SUBPICTURE_XXX values | ||
| 2272 | + */ | ||
| 2273 | + unsigned int flags | ||
| 2274 | + ); | ||
| 2275 | + | ||
| 2276 | + VAStatus (*vaDeassociateSubpicture) ( | ||
| 2277 | + VADriverContextP_0_29 ctx, | ||
| 2278 | + VASubpictureID subpicture, | ||
| 2279 | + VASurfaceID *target_surfaces, | ||
| 2280 | + int num_surfaces | ||
| 2281 | + ); | ||
| 2282 | + | ||
| 2283 | + VAStatus (*vaQueryDisplayAttributes) ( | ||
| 2284 | + VADriverContextP_0_29 ctx, | ||
| 2285 | + VADisplayAttribute *attr_list, /* out */ | ||
| 2286 | + int *num_attributes /* out */ | ||
| 2287 | + ); | ||
| 2288 | + | ||
| 2289 | + VAStatus (*vaGetDisplayAttributes) ( | ||
| 2290 | + VADriverContextP_0_29 ctx, | ||
| 2291 | + VADisplayAttribute *attr_list, /* in/out */ | ||
| 2292 | + int num_attributes | ||
| 2293 | + ); | ||
| 2294 | + | ||
| 2295 | + VAStatus (*vaSetDisplayAttributes) ( | ||
| 2296 | + VADriverContextP_0_29 ctx, | ||
| 2297 | + VADisplayAttribute *attr_list, | ||
| 2298 | + int num_attributes | ||
| 2299 | + ); | ||
| 2300 | + | ||
| 2301 | + | ||
| 2302 | + VAStatus (*vaDbgCopySurfaceToBuffer) ( | ||
| 2303 | + VADriverContextP_0_29 ctx, | ||
| 2304 | + VASurfaceID surface, | ||
| 2305 | + void **buffer, /* out */ | ||
| 2306 | + unsigned int *stride /* out */ | ||
| 2307 | + ); | ||
| 2308 | +}; | ||
| 2309 | + | ||
| 2310 | +/* Driver context (0.29) */ | ||
| 2311 | +struct VADriverContext_0_29 | ||
| 2312 | +{ | ||
| 2313 | + void *old_pNext; /* preserved for binary compatibility */ | ||
| 2314 | + | ||
| 2315 | + void *pDriverData; | ||
| 2316 | + struct VADriverVTable_0_29 vtable; | ||
| 2317 | + | ||
| 2318 | + void *x11_dpy; | ||
| 2319 | + int x11_screen; | ||
| 2320 | + | ||
| 2321 | + int version_major; | ||
| 2322 | + int version_minor; | ||
| 2323 | + int max_profiles; | ||
| 2324 | + int max_entrypoints; | ||
| 2325 | + int max_attributes; | ||
| 2326 | + int max_image_formats; | ||
| 2327 | + int max_subpic_formats; | ||
| 2328 | + int max_display_attributes; | ||
| 2329 | + const char *str_vendor; | ||
| 2330 | + | ||
| 2331 | + void *handle; /* dlopen handle */ | ||
| 2332 | +}; | ||
| 2333 | + | ||
| 2334 | +/* Forward declarations for VA API 0.30 */ | ||
| 2335 | +struct v4l2_format; | ||
| 2336 | +struct v4l2_buffer; | ||
| 2337 | +typedef struct VADriverContext_0_30 *VADriverContextP_0_30; | ||
| 2338 | + | ||
| 2339 | +/* Driver VTable (0.30) */ | ||
| 2340 | +struct VADriverVTable_0_30 | ||
| 2341 | +{ | ||
| 2342 | + VAStatus (*vaTerminate) ( VADriverContextP_0_30 ctx ); | ||
| 2343 | + | ||
| 2344 | + VAStatus (*vaQueryConfigProfiles) ( | ||
| 2345 | + VADriverContextP_0_30 ctx, | ||
| 2346 | + VAProfile *profile_list, /* out */ | ||
| 2347 | + int *num_profiles /* out */ | ||
| 2348 | + ); | ||
| 2349 | + | ||
| 2350 | + VAStatus (*vaQueryConfigEntrypoints) ( | ||
| 2351 | + VADriverContextP_0_30 ctx, | ||
| 2352 | + VAProfile profile, | ||
| 2353 | + VAEntrypoint *entrypoint_list, /* out */ | ||
| 2354 | + int *num_entrypoints /* out */ | ||
| 2355 | + ); | ||
| 2356 | + | ||
| 2357 | + VAStatus (*vaGetConfigAttributes) ( | ||
| 2358 | + VADriverContextP_0_30 ctx, | ||
| 2359 | + VAProfile profile, | ||
| 2360 | + VAEntrypoint entrypoint, | ||
| 2361 | + VAConfigAttrib *attrib_list, /* in/out */ | ||
| 2362 | + int num_attribs | ||
| 2363 | + ); | ||
| 2364 | + | ||
| 2365 | + VAStatus (*vaCreateConfig) ( | ||
| 2366 | + VADriverContextP_0_30 ctx, | ||
| 2367 | + VAProfile profile, | ||
| 2368 | + VAEntrypoint entrypoint, | ||
| 2369 | + VAConfigAttrib *attrib_list, | ||
| 2370 | + int num_attribs, | ||
| 2371 | + VAConfigID *config_id /* out */ | ||
| 2372 | + ); | ||
| 2373 | + | ||
| 2374 | + VAStatus (*vaDestroyConfig) ( | ||
| 2375 | + VADriverContextP_0_30 ctx, | ||
| 2376 | + VAConfigID config_id | ||
| 2377 | + ); | ||
| 2378 | + | ||
| 2379 | + VAStatus (*vaQueryConfigAttributes) ( | ||
| 2380 | + VADriverContextP_0_30 ctx, | ||
| 2381 | + VAConfigID config_id, | ||
| 2382 | + VAProfile *profile, /* out */ | ||
| 2383 | + VAEntrypoint *entrypoint, /* out */ | ||
| 2384 | + VAConfigAttrib *attrib_list, /* out */ | ||
| 2385 | + int *num_attribs /* out */ | ||
| 2386 | + ); | ||
| 2387 | + | ||
| 2388 | + VAStatus (*vaCreateSurfaces) ( | ||
| 2389 | + VADriverContextP_0_30 ctx, | ||
| 2390 | + int width, | ||
| 2391 | + int height, | ||
| 2392 | + int format, | ||
| 2393 | + int num_surfaces, | ||
| 2394 | + VASurfaceID *surfaces /* out */ | ||
| 2395 | + ); | ||
| 2396 | + | ||
| 2397 | + VAStatus (*vaDestroySurfaces) ( | ||
| 2398 | + VADriverContextP_0_30 ctx, | ||
| 2399 | + VASurfaceID *surface_list, | ||
| 2400 | + int num_surfaces | ||
| 2401 | + ); | ||
| 2402 | + | ||
| 2403 | + VAStatus (*vaCreateContext) ( | ||
| 2404 | + VADriverContextP_0_30 ctx, | ||
| 2405 | + VAConfigID config_id, | ||
| 2406 | + int picture_width, | ||
| 2407 | + int picture_height, | ||
| 2408 | + int flag, | ||
| 2409 | + VASurfaceID *render_targets, | ||
| 2410 | + int num_render_targets, | ||
| 2411 | + VAContextID *context /* out */ | ||
| 2412 | + ); | ||
| 2413 | + | ||
| 2414 | + VAStatus (*vaDestroyContext) ( | ||
| 2415 | + VADriverContextP_0_30 ctx, | ||
| 2416 | + VAContextID context | ||
| 2417 | + ); | ||
| 2418 | + | ||
| 2419 | + VAStatus (*vaCreateBuffer) ( | ||
| 2420 | + VADriverContextP_0_30 ctx, | ||
| 2421 | + VAContextID context, /* in */ | ||
| 2422 | + VABufferType type, /* in */ | ||
| 2423 | + unsigned int size, /* in */ | ||
| 2424 | + unsigned int num_elements, /* in */ | ||
| 2425 | + void *data, /* in */ | ||
| 2426 | + VABufferID *buf_id /* out */ | ||
| 2427 | + ); | ||
| 2428 | + | ||
| 2429 | + VAStatus (*vaBufferSetNumElements) ( | ||
| 2430 | + VADriverContextP_0_30 ctx, | ||
| 2431 | + VABufferID buf_id, /* in */ | ||
| 2432 | + unsigned int num_elements /* in */ | ||
| 2433 | + ); | ||
| 2434 | + | ||
| 2435 | + VAStatus (*vaMapBuffer) ( | ||
| 2436 | + VADriverContextP_0_30 ctx, | ||
| 2437 | + VABufferID buf_id, /* in */ | ||
| 2438 | + void **pbuf /* out */ | ||
| 2439 | + ); | ||
| 2440 | + | ||
| 2441 | + VAStatus (*vaUnmapBuffer) ( | ||
| 2442 | + VADriverContextP_0_30 ctx, | ||
| 2443 | + VABufferID buf_id /* in */ | ||
| 2444 | + ); | ||
| 2445 | + | ||
| 2446 | + VAStatus (*vaDestroyBuffer) ( | ||
| 2447 | + VADriverContextP_0_30 ctx, | ||
| 2448 | + VABufferID buffer_id | ||
| 2449 | + ); | ||
| 2450 | + | ||
| 2451 | + VAStatus (*vaBeginPicture) ( | ||
| 2452 | + VADriverContextP_0_30 ctx, | ||
| 2453 | + VAContextID context, | ||
| 2454 | + VASurfaceID render_target | ||
| 2455 | + ); | ||
| 2456 | + | ||
| 2457 | + VAStatus (*vaRenderPicture) ( | ||
| 2458 | + VADriverContextP_0_30 ctx, | ||
| 2459 | + VAContextID context, | ||
| 2460 | + VABufferID *buffers, | ||
| 2461 | + int num_buffers | ||
| 2462 | + ); | ||
| 2463 | + | ||
| 2464 | + VAStatus (*vaEndPicture) ( | ||
| 2465 | + VADriverContextP_0_30 ctx, | ||
| 2466 | + VAContextID context | ||
| 2467 | + ); | ||
| 2468 | + | ||
| 2469 | + VAStatus (*vaSyncSurface) ( | ||
| 2470 | + VADriverContextP_0_30 ctx, | ||
| 2471 | + VAContextID context, | ||
| 2472 | + VASurfaceID render_target | ||
| 2473 | + ); | ||
| 2474 | + | ||
| 2475 | + VAStatus (*vaQuerySurfaceStatus) ( | ||
| 2476 | + VADriverContextP_0_30 ctx, | ||
| 2477 | + VASurfaceID render_target, | ||
| 2478 | + VASurfaceStatus *status /* out */ | ||
| 2479 | + ); | ||
| 2480 | + | ||
| 2481 | + VAStatus (*vaPutSurface) ( | ||
| 2482 | + VADriverContextP_0_30 ctx, | ||
| 2483 | + VASurfaceID surface, | ||
| 2484 | + unsigned long draw, /* X Drawable */ | ||
| 2485 | + short srcx, | ||
| 2486 | + short srcy, | ||
| 2487 | + unsigned short srcw, | ||
| 2488 | + unsigned short srch, | ||
| 2489 | + short destx, | ||
| 2490 | + short desty, | ||
| 2491 | + unsigned short destw, | ||
| 2492 | + unsigned short desth, | ||
| 2493 | + VARectangle *cliprects, /* client supplied clip list */ | ||
| 2494 | + unsigned int number_cliprects, /* number of clip rects in the clip list */ | ||
| 2495 | + unsigned int flags /* de-interlacing flags */ | ||
| 2496 | + ); | ||
| 2497 | + | ||
| 2498 | + VAStatus (*vaQueryImageFormats) ( | ||
| 2499 | + VADriverContextP_0_30 ctx, | ||
| 2500 | + VAImageFormat *format_list, /* out */ | ||
| 2501 | + int *num_formats /* out */ | ||
| 2502 | + ); | ||
| 2503 | + | ||
| 2504 | + VAStatus (*vaCreateImage) ( | ||
| 2505 | + VADriverContextP_0_30 ctx, | ||
| 2506 | + VAImageFormat *format, | ||
| 2507 | + int width, | ||
| 2508 | + int height, | ||
| 2509 | + VAImage *image /* out */ | ||
| 2510 | + ); | ||
| 2511 | + | ||
| 2512 | + VAStatus (*vaDeriveImage) ( | ||
| 2513 | + VADriverContextP_0_30 ctx, | ||
| 2514 | + VASurfaceID surface, | ||
| 2515 | + VAImage *image /* out */ | ||
| 2516 | + ); | ||
| 2517 | + | ||
| 2518 | + VAStatus (*vaDestroyImage) ( | ||
| 2519 | + VADriverContextP_0_30 ctx, | ||
| 2520 | + VAImageID image | ||
| 2521 | + ); | ||
| 2522 | + | ||
| 2523 | + VAStatus (*vaSetImagePalette) ( | ||
| 2524 | + VADriverContextP_0_30 ctx, | ||
| 2525 | + VAImageID image, | ||
| 2526 | + /* | ||
| 2527 | + * pointer to an array holding the palette data. The size of the array is | ||
| 2528 | + * num_palette_entries * entry_bytes in size. The order of the components | ||
| 2529 | + * in the palette is described by the component_order in VAImage struct | ||
| 2530 | + */ | ||
| 2531 | + unsigned char *palette | ||
| 2532 | + ); | ||
| 2533 | + | ||
| 2534 | + VAStatus (*vaGetImage) ( | ||
| 2535 | + VADriverContextP_0_30 ctx, | ||
| 2536 | + VASurfaceID surface, | ||
| 2537 | + int x, /* coordinates of the upper left source pixel */ | ||
| 2538 | + int y, | ||
| 2539 | + unsigned int width, /* width and height of the region */ | ||
| 2540 | + unsigned int height, | ||
| 2541 | + VAImageID image | ||
| 2542 | + ); | ||
| 2543 | + | ||
| 2544 | + VAStatus (*vaPutImage) ( | ||
| 2545 | + VADriverContextP_0_30 ctx, | ||
| 2546 | + VASurfaceID surface, | ||
| 2547 | + VAImageID image, | ||
| 2548 | + int src_x, | ||
| 2549 | + int src_y, | ||
| 2550 | + unsigned int width, | ||
| 2551 | + unsigned int height, | ||
| 2552 | + int dest_x, | ||
| 2553 | + int dest_y | ||
| 2554 | + ); | ||
| 2555 | + | ||
| 2556 | + VAStatus (*vaPutImage2) ( | ||
| 2557 | + VADriverContextP_0_30 ctx, | ||
| 2558 | + VASurfaceID surface, | ||
| 2559 | + VAImageID image, | ||
| 2560 | + int src_x, | ||
| 2561 | + int src_y, | ||
| 2562 | + unsigned int src_width, | ||
| 2563 | + unsigned int src_height, | ||
| 2564 | + int dest_x, | ||
| 2565 | + int dest_y, | ||
| 2566 | + unsigned int dest_width, | ||
| 2567 | + unsigned int dest_height | ||
| 2568 | + ); | ||
| 2569 | + | ||
| 2570 | + VAStatus (*vaQuerySubpictureFormats) ( | ||
| 2571 | + VADriverContextP_0_30 ctx, | ||
| 2572 | + VAImageFormat *format_list, /* out */ | ||
| 2573 | + unsigned int *flags, /* out */ | ||
| 2574 | + unsigned int *num_formats /* out */ | ||
| 2575 | + ); | ||
| 2576 | + | ||
| 2577 | + VAStatus (*vaCreateSubpicture) ( | ||
| 2578 | + VADriverContextP_0_30 ctx, | ||
| 2579 | + VAImageID image, | ||
| 2580 | + VASubpictureID *subpicture /* out */ | ||
| 2581 | + ); | ||
| 2582 | + | ||
| 2583 | + VAStatus (*vaDestroySubpicture) ( | ||
| 2584 | + VADriverContextP_0_30 ctx, | ||
| 2585 | + VASubpictureID subpicture | ||
| 2586 | + ); | ||
| 2587 | + | ||
| 2588 | + VAStatus (*vaSetSubpictureImage) ( | ||
| 2589 | + VADriverContextP_0_30 ctx, | ||
| 2590 | + VASubpictureID subpicture, | ||
| 2591 | + VAImageID image | ||
| 2592 | + ); | ||
| 2593 | + | ||
| 2594 | + VAStatus (*vaSetSubpictureChromakey) ( | ||
| 2595 | + VADriverContextP_0_30 ctx, | ||
| 2596 | + VASubpictureID subpicture, | ||
| 2597 | + unsigned int chromakey_min, | ||
| 2598 | + unsigned int chromakey_max, | ||
| 2599 | + unsigned int chromakey_mask | ||
| 2600 | + ); | ||
| 2601 | + | ||
| 2602 | + VAStatus (*vaSetSubpictureGlobalAlpha) ( | ||
| 2603 | + VADriverContextP_0_30 ctx, | ||
| 2604 | + VASubpictureID subpicture, | ||
| 2605 | + float global_alpha | ||
| 2606 | + ); | ||
| 2607 | + | ||
| 2608 | + VAStatus (*vaAssociateSubpicture) ( | ||
| 2609 | + VADriverContextP_0_30 ctx, | ||
| 2610 | + VASubpictureID subpicture, | ||
| 2611 | + VASurfaceID *target_surfaces, | ||
| 2612 | + int num_surfaces, | ||
| 2613 | + short src_x, /* upper left offset in subpicture */ | ||
| 2614 | + short src_y, | ||
| 2615 | + short dest_x, /* upper left offset in surface */ | ||
| 2616 | + short dest_y, | ||
| 2617 | + unsigned short width, | ||
| 2618 | + unsigned short height, | ||
| 2619 | + /* | ||
| 2620 | + * whether to enable chroma-keying or global-alpha | ||
| 2621 | + * see VA_SUBPICTURE_XXX values | ||
| 2622 | + */ | ||
| 2623 | + unsigned int flags | ||
| 2624 | + ); | ||
| 2625 | + | ||
| 2626 | + VAStatus (*vaAssociateSubpicture2) ( | ||
| 2627 | + VADriverContextP_0_30 ctx, | ||
| 2628 | + VASubpictureID subpicture, | ||
| 2629 | + VASurfaceID *target_surfaces, | ||
| 2630 | + int num_surfaces, | ||
| 2631 | + short src_x, /* upper left offset in subpicture */ | ||
| 2632 | + short src_y, | ||
| 2633 | + unsigned short src_width, | ||
| 2634 | + unsigned short src_height, | ||
| 2635 | + short dest_x, /* upper left offset in surface */ | ||
| 2636 | + short dest_y, | ||
| 2637 | + unsigned short dest_width, | ||
| 2638 | + unsigned short dest_height, | ||
| 2639 | + /* | ||
| 2640 | + * whether to enable chroma-keying or global-alpha | ||
| 2641 | + * see VA_SUBPICTURE_XXX values | ||
| 2642 | + */ | ||
| 2643 | + unsigned int flags | ||
| 2644 | + ); | ||
| 2645 | + | ||
| 2646 | + VAStatus (*vaDeassociateSubpicture) ( | ||
| 2647 | + VADriverContextP_0_30 ctx, | ||
| 2648 | + VASubpictureID subpicture, | ||
| 2649 | + VASurfaceID *target_surfaces, | ||
| 2650 | + int num_surfaces | ||
| 2651 | + ); | ||
| 2652 | + | ||
| 2653 | + VAStatus (*vaQueryDisplayAttributes) ( | ||
| 2654 | + VADriverContextP_0_30 ctx, | ||
| 2655 | + VADisplayAttribute *attr_list, /* out */ | ||
| 2656 | + int *num_attributes /* out */ | ||
| 2657 | + ); | ||
| 2658 | + | ||
| 2659 | + VAStatus (*vaGetDisplayAttributes) ( | ||
| 2660 | + VADriverContextP_0_30 ctx, | ||
| 2661 | + VADisplayAttribute *attr_list, /* in/out */ | ||
| 2662 | + int num_attributes | ||
| 2663 | + ); | ||
| 2664 | + | ||
| 2665 | + VAStatus (*vaSetDisplayAttributes) ( | ||
| 2666 | + VADriverContextP_0_30 ctx, | ||
| 2667 | + VADisplayAttribute *attr_list, | ||
| 2668 | + int num_attributes | ||
| 2669 | + ); | ||
| 2670 | + | ||
| 2671 | + /* device specific */ | ||
| 2672 | + VAStatus (*vaCreateSurfaceFromCIFrame) ( | ||
| 2673 | + VADriverContextP_0_30 ctx, | ||
| 2674 | + unsigned long frame_id, | ||
| 2675 | + VASurfaceID *surface /* out */ | ||
| 2676 | + ); | ||
| 2677 | + | ||
| 2678 | + | ||
| 2679 | + VAStatus (*vaCreateSurfaceFromV4L2Buf) ( | ||
| 2680 | + VADriverContextP_0_30 ctx, | ||
| 2681 | + int v4l2_fd, /* file descriptor of V4L2 device */ | ||
| 2682 | + struct v4l2_format *v4l2_fmt, /* format of V4L2 */ | ||
| 2683 | + struct v4l2_buffer *v4l2_buf, /* V4L2 buffer */ | ||
| 2684 | + VASurfaceID *surface /* out */ | ||
| 2685 | + ); | ||
| 2686 | + | ||
| 2687 | + VAStatus (*vaCopySurfaceToBuffer) ( | ||
| 2688 | + VADriverContextP_0_30 ctx, | ||
| 2689 | + VASurfaceID surface, | ||
| 2690 | + unsigned int *fourcc, /* out for follow argument */ | ||
| 2691 | + unsigned int *luma_stride, | ||
| 2692 | + unsigned int *chroma_u_stride, | ||
| 2693 | + unsigned int *chroma_v_stride, | ||
| 2694 | + unsigned int *luma_offset, | ||
| 2695 | + unsigned int *chroma_u_offset, | ||
| 2696 | + unsigned int *chroma_v_offset, | ||
| 2697 | + void **buffer | ||
| 2698 | + ); | ||
| 2699 | +}; | ||
| 2700 | + | ||
| 2701 | +/* Driver context (0.30) */ | ||
| 2702 | +struct VADriverContext_0_30 | ||
| 2703 | +{ | ||
| 2704 | + void *pDriverData; | ||
| 2705 | + struct VADriverVTable_0_30 vtable; | ||
| 2706 | + | ||
| 2707 | + void *x11_dpy; | ||
| 2708 | + int x11_screen; | ||
| 2709 | + int version_major; | ||
| 2710 | + int version_minor; | ||
| 2711 | + int max_profiles; | ||
| 2712 | + int max_entrypoints; | ||
| 2713 | + int max_attributes; | ||
| 2714 | + int max_image_formats; | ||
| 2715 | + int max_subpic_formats; | ||
| 2716 | + int max_display_attributes; | ||
| 2717 | + const char *str_vendor; | ||
| 2718 | + | ||
| 2719 | + void *handle; /* dlopen handle */ | ||
| 2720 | + | ||
| 2721 | + void *dri_state; | ||
| 2722 | +}; | ||
| 2723 | + | ||
| 2724 | +/* Driver VTable and context (0.31) */ | ||
| 2725 | +#define VADriverVTable_0_31 VADriverVTable | ||
| 2726 | +#define VADriverContext_0_31 VADriverContext | ||
| 2727 | + | ||
| 2728 | +#endif /* VA_COMPAT_H */ | ||
| 2729 | diff --git a/src/va_compat_template.h b/src/va_compat_template.h | ||
| 2730 | new file mode 100644 | ||
| 2731 | index 0000000..18349de | ||
| 2732 | --- /dev/null | ||
| 2733 | +++ b/src/va_compat_template.h | ||
| 2734 | @@ -0,0 +1,539 @@ | ||
| 2735 | +/* | ||
| 2736 | + * Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved. | ||
| 2737 | + * | ||
| 2738 | + * Permission is hereby granted, free of charge, to any person obtaining a | ||
| 2739 | + * copy of this software and associated documentation files (the | ||
| 2740 | + * "Software"), to deal in the Software without restriction, including | ||
| 2741 | + * without limitation the rights to use, copy, modify, merge, publish, | ||
| 2742 | + * distribute, sub license, and/or sell copies of the Software, and to | ||
| 2743 | + * permit persons to whom the Software is furnished to do so, subject to | ||
| 2744 | + * the following conditions: | ||
| 2745 | + * | ||
| 2746 | + * The above copyright notice and this permission notice (including the | ||
| 2747 | + * next paragraph) shall be included in all copies or substantial portions | ||
| 2748 | + * of the Software. | ||
| 2749 | + * | ||
| 2750 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
| 2751 | + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
| 2752 | + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. | ||
| 2753 | + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR | ||
| 2754 | + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
| 2755 | + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
| 2756 | + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 2757 | + */ | ||
| 2758 | + | ||
| 2759 | +#undef CONCAT_ | ||
| 2760 | +#define CONCAT_(x, y) x##y | ||
| 2761 | +#undef CONCAT | ||
| 2762 | +#define CONCAT(x, y) CONCAT_(x, y) | ||
| 2763 | +#undef MKCOMPAT_ | ||
| 2764 | +#define MKCOMPAT_(NAME,MINOR) CONCAT(CONCAT(NAME,_0_),MINOR) | ||
| 2765 | +#undef MKCOMPAT | ||
| 2766 | +#define MKCOMPAT(NAME) MKCOMPAT_(NAME,COMPAT_MINOR) | ||
| 2767 | +#undef STRUCT | ||
| 2768 | +#define STRUCT(BUFFER, CODEC) MKCOMPAT(VA##BUFFER##Buffer##CODEC) | ||
| 2769 | +#undef TRANSLATE_1 | ||
| 2770 | +#define TRANSLATE_1(NAME) CONCAT(va_compat_translate_,NAME) | ||
| 2771 | +#undef TRANSLATE_ | ||
| 2772 | +#define TRANSLATE_(NAME) TRANSLATE_1(MKCOMPAT(NAME)) | ||
| 2773 | +#undef TRANSLATE | ||
| 2774 | +#define TRANSLATE(BUFFER, CODEC) TRANSLATE_1(STRUCT(BUFFER,CODEC)) | ||
| 2775 | + | ||
| 2776 | +#undef COPY_ARRAY | ||
| 2777 | +#define COPY_ARRAY(DST, SRC, ARRAY) \ | ||
| 2778 | + memcpy((DST)->ARRAY, (SRC)->ARRAY, sizeof((DST)->ARRAY)) | ||
| 2779 | + | ||
| 2780 | +#undef COPY_FIELD | ||
| 2781 | +#define COPY_FIELD(DST, SRC, MEMBER) \ | ||
| 2782 | + (DST)->MEMBER = (SRC)->MEMBER | ||
| 2783 | + | ||
| 2784 | +#undef COPY_VTABLE__ | ||
| 2785 | +#define COPY_VTABLE__(DST, DST_MEMBER, SRC, SRC_MEMBER) \ | ||
| 2786 | + (DST##_vtable)->DST_MEMBER = (SRC##_vtable)->SRC_MEMBER | ||
| 2787 | + | ||
| 2788 | +#undef COPY_VTABLE_ | ||
| 2789 | +#define COPY_VTABLE_(DST, DST_SUFFIX, SRC, MEMBER) \ | ||
| 2790 | + COPY_VTABLE__(DST, MEMBER##_##DST_SUFFIX, SRC, MEMBER) | ||
| 2791 | + | ||
| 2792 | +#undef COPY_VTABLE | ||
| 2793 | +#define COPY_VTABLE(DST, SRC, MEMBER) \ | ||
| 2794 | + COPY_VTABLE__(DST, MEMBER, SRC, MEMBER) | ||
| 2795 | + | ||
| 2796 | +/* 0.29 */ | ||
| 2797 | +#if COMPAT_MAJOR == 0 && COMPAT_MINOR == 29 | ||
| 2798 | +#undef BFV | ||
| 2799 | +#define BFV(a, b) a | ||
| 2800 | +#undef BFM | ||
| 2801 | +#define BFM(a, b, c) c | ||
| 2802 | +#undef COPY_BIT_FIELD | ||
| 2803 | +#define COPY_BIT_FIELD(DST, SRC, FIELD, MEMBER) \ | ||
| 2804 | + (DST)->MEMBER = (SRC)->FIELD.bits.MEMBER | ||
| 2805 | +#undef COPY_BIT_FLAG | ||
| 2806 | +#define COPY_BIT_FLAG(DST, SRC, FIELD, MEMBER) \ | ||
| 2807 | + (DST)->MEMBER = (SRC)->FIELD.flags.MEMBER | ||
| 2808 | +#endif | ||
| 2809 | + | ||
| 2810 | +/* 0.29 glue to match 0.30 names */ | ||
| 2811 | +#undef M_raw_coding | ||
| 2812 | +#undef M_bitplane_present | ||
| 2813 | +#undef M_luma_flag | ||
| 2814 | +#undef M_luma | ||
| 2815 | +#undef M_chroma_flag | ||
| 2816 | +#undef M_chroma | ||
| 2817 | + | ||
| 2818 | +#if COMPAT_MAJOR == 0 && COMPAT_MINOR == 29 | ||
| 2819 | +#define M_raw_coding raw_coding_flag | ||
| 2820 | +#define M_bitplane_present bitplane_present_flag | ||
| 2821 | +#define M_luma_flag range_mapping_luma_flag | ||
| 2822 | +#define M_luma range_mapping_luma | ||
| 2823 | +#define M_chroma_flag range_mapping_chroma_flag | ||
| 2824 | +#define M_chroma range_mapping_chroma | ||
| 2825 | +#else | ||
| 2826 | +#define M_raw_coding raw_coding | ||
| 2827 | +#define M_bitplane_present bitplane_present | ||
| 2828 | +#define M_luma_flag luma_flag | ||
| 2829 | +#define M_luma luma | ||
| 2830 | +#define M_chroma_flag chroma_flag | ||
| 2831 | +#define M_chroma chroma | ||
| 2832 | +#endif | ||
| 2833 | + | ||
| 2834 | +/* 0.30 */ | ||
| 2835 | +#if COMPAT_MAJOR == 0 && COMPAT_MINOR == 30 | ||
| 2836 | +#undef BFV | ||
| 2837 | +#define BFV(a, b) a.b | ||
| 2838 | +#undef BFM | ||
| 2839 | +#define BFM(a, b, c) a.b.c | ||
| 2840 | +#undef COPY_BIT_FIELD | ||
| 2841 | +#define COPY_BIT_FIELD(DST, SRC, FIELD, MEMBER) \ | ||
| 2842 | + (DST)->FIELD.bits.MEMBER = (SRC)->FIELD.bits.MEMBER | ||
| 2843 | +#undef COPY_BIT_FLAG | ||
| 2844 | +#define COPY_BIT_FLAG(DST, SRC, FIELD, MEMBER) \ | ||
| 2845 | + (DST)->FIELD.flags.MEMBER = (SRC)->FIELD.flags.MEMBER | ||
| 2846 | +#endif | ||
| 2847 | + | ||
| 2848 | +#if COMPAT_MAJOR == 0 && COMPAT_MINOR < 31 | ||
| 2849 | +static VAStatus TRANSLATE_(VAPictureH264)( | ||
| 2850 | + VACompatContextP ctx, | ||
| 2851 | + void *dest_pic, | ||
| 2852 | + const void *src_pic | ||
| 2853 | +) | ||
| 2854 | +{ | ||
| 2855 | + MKCOMPAT(VAPictureH264) *dest = dest_pic; | ||
| 2856 | + const VAPictureH264 *src = src_pic; | ||
| 2857 | + | ||
| 2858 | + COPY_FIELD(dest, src, picture_id); | ||
| 2859 | + COPY_FIELD(dest, src, flags); | ||
| 2860 | + COPY_FIELD(dest, src, TopFieldOrderCnt); | ||
| 2861 | + COPY_FIELD(dest, src, BottomFieldOrderCnt); | ||
| 2862 | + | ||
| 2863 | + return VA_STATUS_SUCCESS; | ||
| 2864 | +} | ||
| 2865 | + | ||
| 2866 | +static VAStatus TRANSLATE(PictureParameter,H264)( | ||
| 2867 | + VACompatContextP ctx, | ||
| 2868 | + void *dest_buffer, | ||
| 2869 | + const void *src_buffer | ||
| 2870 | +) | ||
| 2871 | +{ | ||
| 2872 | + STRUCT(PictureParameter,H264) *dest = dest_buffer; | ||
| 2873 | + const VAPictureParameterBufferH264 *src = src_buffer; | ||
| 2874 | + VAStatus status; | ||
| 2875 | + int i; | ||
| 2876 | + | ||
| 2877 | + status = TRANSLATE_(VAPictureH264)(ctx, | ||
| 2878 | + &dest->CurrPic, &src->CurrPic); | ||
| 2879 | + if (status != VA_STATUS_SUCCESS) | ||
| 2880 | + return status; | ||
| 2881 | + | ||
| 2882 | + for (i = 0; i < 16; i++) { | ||
| 2883 | + status = TRANSLATE_(VAPictureH264)(ctx, | ||
| 2884 | + &dest->ReferenceFrames[i], | ||
| 2885 | + &src->ReferenceFrames[i]); | ||
| 2886 | + if (status != VA_STATUS_SUCCESS) | ||
| 2887 | + return status; | ||
| 2888 | + } | ||
| 2889 | + | ||
| 2890 | + COPY_FIELD(dest, src, picture_width_in_mbs_minus1); | ||
| 2891 | + COPY_FIELD(dest, src, picture_height_in_mbs_minus1); | ||
| 2892 | + COPY_FIELD(dest, src, bit_depth_luma_minus8); | ||
| 2893 | + COPY_FIELD(dest, src, bit_depth_chroma_minus8); | ||
| 2894 | + COPY_FIELD(dest, src, num_ref_frames); | ||
| 2895 | + dest->BFV(seq_fields, value) = 0; /* reset all bits */ | ||
| 2896 | + COPY_BIT_FIELD(dest, src, seq_fields, chroma_format_idc); | ||
| 2897 | + COPY_BIT_FIELD(dest, src, seq_fields, residual_colour_transform_flag); | ||
| 2898 | + COPY_BIT_FIELD(dest, src, seq_fields, frame_mbs_only_flag); | ||
| 2899 | + COPY_BIT_FIELD(dest, src, seq_fields, mb_adaptive_frame_field_flag); | ||
| 2900 | + COPY_BIT_FIELD(dest, src, seq_fields, direct_8x8_inference_flag); | ||
| 2901 | + COPY_BIT_FIELD(dest, src, seq_fields, MinLumaBiPredSize8x8); | ||
| 2902 | + COPY_FIELD(dest, src, num_slice_groups_minus1); | ||
| 2903 | + COPY_FIELD(dest, src, slice_group_map_type); | ||
| 2904 | + COPY_FIELD(dest, src, pic_init_qp_minus26); | ||
| 2905 | + COPY_FIELD(dest, src, chroma_qp_index_offset); | ||
| 2906 | + COPY_FIELD(dest, src, second_chroma_qp_index_offset); | ||
| 2907 | + dest->BFV(pic_fields, value) = 0; /* reset all bits */ | ||
| 2908 | + COPY_BIT_FIELD(dest, src, pic_fields, entropy_coding_mode_flag); | ||
| 2909 | + COPY_BIT_FIELD(dest, src, pic_fields, weighted_pred_flag); | ||
| 2910 | + COPY_BIT_FIELD(dest, src, pic_fields, weighted_bipred_idc); | ||
| 2911 | + COPY_BIT_FIELD(dest, src, pic_fields, transform_8x8_mode_flag); | ||
| 2912 | + COPY_BIT_FIELD(dest, src, pic_fields, field_pic_flag); | ||
| 2913 | + COPY_BIT_FIELD(dest, src, pic_fields, constrained_intra_pred_flag); | ||
| 2914 | + COPY_FIELD(dest, src, frame_num); | ||
| 2915 | + | ||
| 2916 | + return VA_STATUS_SUCCESS; | ||
| 2917 | +} | ||
| 2918 | + | ||
| 2919 | +static VAStatus TRANSLATE(SliceParameter,H264)( | ||
| 2920 | + VACompatContextP ctx, | ||
| 2921 | + void *dest_buffer, | ||
| 2922 | + const void *src_buffer | ||
| 2923 | +) | ||
| 2924 | +{ | ||
| 2925 | + STRUCT(SliceParameter,H264) *dest = dest_buffer; | ||
| 2926 | + const VASliceParameterBufferH264 *src = src_buffer; | ||
| 2927 | + VAStatus status; | ||
| 2928 | + int i; | ||
| 2929 | + | ||
| 2930 | + COPY_FIELD(dest, src, slice_data_size); | ||
| 2931 | + COPY_FIELD(dest, src, slice_data_offset); | ||
| 2932 | + COPY_FIELD(dest, src, slice_data_flag); | ||
| 2933 | + COPY_FIELD(dest, src, slice_data_bit_offset); | ||
| 2934 | + COPY_FIELD(dest, src, first_mb_in_slice); | ||
| 2935 | + COPY_FIELD(dest, src, slice_type); | ||
| 2936 | + COPY_FIELD(dest, src, direct_spatial_mv_pred_flag); | ||
| 2937 | + COPY_FIELD(dest, src, num_ref_idx_l0_active_minus1); | ||
| 2938 | + COPY_FIELD(dest, src, num_ref_idx_l1_active_minus1); | ||
| 2939 | + COPY_FIELD(dest, src, cabac_init_idc); | ||
| 2940 | + COPY_FIELD(dest, src, slice_qp_delta); | ||
| 2941 | + COPY_FIELD(dest, src, disable_deblocking_filter_idc); | ||
| 2942 | + COPY_FIELD(dest, src, slice_alpha_c0_offset_div2); | ||
| 2943 | + COPY_FIELD(dest, src, slice_beta_offset_div2); | ||
| 2944 | + for (i = 0; i < 32; i++) { | ||
| 2945 | + status = TRANSLATE_(VAPictureH264)(ctx, | ||
| 2946 | + &dest->RefPicList0[i], | ||
| 2947 | + &src->RefPicList0[i]); | ||
| 2948 | + if (status != VA_STATUS_SUCCESS) | ||
| 2949 | + return status; | ||
| 2950 | + status = TRANSLATE_(VAPictureH264)(ctx, | ||
| 2951 | + &dest->RefPicList1[i], | ||
| 2952 | + &src->RefPicList1[i]); | ||
| 2953 | + if (status != VA_STATUS_SUCCESS) | ||
| 2954 | + return status; | ||
| 2955 | + } | ||
| 2956 | + COPY_FIELD(dest, src, luma_log2_weight_denom); | ||
| 2957 | + COPY_FIELD(dest, src, chroma_log2_weight_denom); | ||
| 2958 | + COPY_FIELD(dest, src, luma_weight_l0_flag); | ||
| 2959 | + COPY_ARRAY(dest, src, luma_weight_l0); | ||
| 2960 | + COPY_ARRAY(dest, src, luma_offset_l0); | ||
| 2961 | + COPY_FIELD(dest, src, chroma_weight_l0_flag); | ||
| 2962 | + COPY_ARRAY(dest, src, chroma_weight_l0); | ||
| 2963 | + COPY_ARRAY(dest, src, chroma_offset_l0); | ||
| 2964 | + COPY_FIELD(dest, src, luma_weight_l1_flag); | ||
| 2965 | + COPY_ARRAY(dest, src, luma_weight_l1); | ||
| 2966 | + COPY_ARRAY(dest, src, luma_offset_l1); | ||
| 2967 | + COPY_FIELD(dest, src, chroma_weight_l1_flag); | ||
| 2968 | + COPY_ARRAY(dest, src, chroma_weight_l1); | ||
| 2969 | + COPY_ARRAY(dest, src, chroma_offset_l1); | ||
| 2970 | + | ||
| 2971 | + return VA_STATUS_SUCCESS; | ||
| 2972 | +} | ||
| 2973 | + | ||
| 2974 | +static VAStatus TRANSLATE(PictureParameter,VC1)( | ||
| 2975 | + VACompatContextP ctx, | ||
| 2976 | + void *dest_buffer, | ||
| 2977 | + const void *src_buffer | ||
| 2978 | +) | ||
| 2979 | +{ | ||
| 2980 | + STRUCT(PictureParameter,VC1) *dest = dest_buffer; | ||
| 2981 | + const VAPictureParameterBufferVC1 *src = src_buffer; | ||
| 2982 | + | ||
| 2983 | + COPY_FIELD(dest, src, forward_reference_picture); | ||
| 2984 | + COPY_FIELD(dest, src, backward_reference_picture); | ||
| 2985 | + COPY_FIELD(dest, src, inloop_decoded_picture); | ||
| 2986 | + dest->BFV(sequence_fields, value) = 0; /* reset all bits */ | ||
| 2987 | + COPY_BIT_FIELD(dest, src, sequence_fields, interlace); | ||
| 2988 | + COPY_BIT_FIELD(dest, src, sequence_fields, syncmarker); | ||
| 2989 | + COPY_BIT_FIELD(dest, src, sequence_fields, overlap); | ||
| 2990 | + COPY_FIELD(dest, src, coded_width); | ||
| 2991 | + COPY_FIELD(dest, src, coded_height); | ||
| 2992 | +#if COMPAT_MAJOR == 0 && COMPAT_MINOR == 30 | ||
| 2993 | + dest->closed_entry = src->entrypoint_fields.bits.closed_entry; | ||
| 2994 | + dest->broken_link = src->entrypoint_fields.bits.broken_link; | ||
| 2995 | + dest->loopfilter = src->entrypoint_fields.bits.loopfilter; | ||
| 2996 | +#else | ||
| 2997 | + COPY_BIT_FIELD(dest, src, entrypoint_fields, closed_entry); | ||
| 2998 | + COPY_BIT_FIELD(dest, src, entrypoint_fields, broken_link); | ||
| 2999 | + COPY_BIT_FIELD(dest, src, entrypoint_fields, loopfilter); | ||
| 3000 | +#endif | ||
| 3001 | + COPY_FIELD(dest, src, conditional_overlap_flag); | ||
| 3002 | + COPY_FIELD(dest, src, fast_uvmc_flag); | ||
| 3003 | + dest->BFV(range_mapping_fields, value) = 0; /* reset all bits */ | ||
| 3004 | + dest->BFM(range_mapping_fields, bits, M_luma_flag) = | ||
| 3005 | + src->range_mapping_fields.bits.luma_flag; | ||
| 3006 | + dest->BFM(range_mapping_fields, bits, M_luma) = | ||
| 3007 | + src->range_mapping_fields.bits.luma; | ||
| 3008 | + dest->BFM(range_mapping_fields, bits, M_chroma_flag) = | ||
| 3009 | + src->range_mapping_fields.bits.chroma_flag; | ||
| 3010 | + dest->BFM(range_mapping_fields, bits, M_chroma) = | ||
| 3011 | + src->range_mapping_fields.bits.chroma; | ||
| 3012 | + COPY_FIELD(dest, src, b_picture_fraction); | ||
| 3013 | + COPY_FIELD(dest, src, cbp_table); | ||
| 3014 | + COPY_FIELD(dest, src, mb_mode_table); | ||
| 3015 | + COPY_FIELD(dest, src, range_reduction_frame); | ||
| 3016 | + COPY_FIELD(dest, src, rounding_control); | ||
| 3017 | + COPY_FIELD(dest, src, post_processing); | ||
| 3018 | + COPY_FIELD(dest, src, picture_resolution_index); | ||
| 3019 | + COPY_FIELD(dest, src, luma_scale); | ||
| 3020 | + COPY_FIELD(dest, src, luma_shift); | ||
| 3021 | + dest->BFV(picture_fields, value) = 0; /* reset all bits */ | ||
| 3022 | + COPY_BIT_FIELD(dest, src, picture_fields, picture_type); | ||
| 3023 | + COPY_BIT_FIELD(dest, src, picture_fields, frame_coding_mode); | ||
| 3024 | + COPY_BIT_FIELD(dest, src, picture_fields, top_field_first); | ||
| 3025 | + COPY_BIT_FIELD(dest, src, picture_fields, is_first_field); | ||
| 3026 | + COPY_BIT_FIELD(dest, src, picture_fields, intensity_compensation); | ||
| 3027 | + dest->BFV(M_raw_coding, value) = 0; /* reset all bits */ | ||
| 3028 | + COPY_BIT_FLAG(dest, src, raw_coding, mv_type_mb); | ||
| 3029 | + COPY_BIT_FLAG(dest, src, raw_coding, direct_mb); | ||
| 3030 | + COPY_BIT_FLAG(dest, src, raw_coding, skip_mb); | ||
| 3031 | + COPY_BIT_FLAG(dest, src, raw_coding, field_tx); | ||
| 3032 | + COPY_BIT_FLAG(dest, src, raw_coding, forward_mb); | ||
| 3033 | + COPY_BIT_FLAG(dest, src, raw_coding, ac_pred); | ||
| 3034 | + COPY_BIT_FLAG(dest, src, raw_coding, overflags); | ||
| 3035 | + dest->BFV(M_bitplane_present, value) = 0; /* reset all bits */ | ||
| 3036 | + COPY_BIT_FLAG(dest, src, bitplane_present, bp_mv_type_mb); | ||
| 3037 | + COPY_BIT_FLAG(dest, src, bitplane_present, bp_direct_mb); | ||
| 3038 | + COPY_BIT_FLAG(dest, src, bitplane_present, bp_skip_mb); | ||
| 3039 | + COPY_BIT_FLAG(dest, src, bitplane_present, bp_field_tx); | ||
| 3040 | + COPY_BIT_FLAG(dest, src, bitplane_present, bp_forward_mb); | ||
| 3041 | + COPY_BIT_FLAG(dest, src, bitplane_present, bp_ac_pred); | ||
| 3042 | + COPY_BIT_FLAG(dest, src, bitplane_present, bp_overflags); | ||
| 3043 | + dest->BFV(reference_fields, value) = 0; /* reset all bits */ | ||
| 3044 | + COPY_BIT_FIELD(dest, src, reference_fields, reference_distance_flag); | ||
| 3045 | + COPY_BIT_FIELD(dest, src, reference_fields, reference_distance); | ||
| 3046 | + COPY_BIT_FIELD(dest, src, reference_fields, num_reference_pictures); | ||
| 3047 | + COPY_BIT_FIELD(dest, src, reference_fields, reference_field_pic_indicator); | ||
| 3048 | + dest->BFV(mv_fields, value) = 0; /* reset all bits */ | ||
| 3049 | + COPY_BIT_FIELD(dest, src, mv_fields, mv_mode); | ||
| 3050 | + COPY_BIT_FIELD(dest, src, mv_fields, mv_mode2); | ||
| 3051 | + COPY_BIT_FIELD(dest, src, mv_fields, mv_table); | ||
| 3052 | + COPY_BIT_FIELD(dest, src, mv_fields, two_mv_block_pattern_table); | ||
| 3053 | + COPY_BIT_FIELD(dest, src, mv_fields, four_mv_switch); | ||
| 3054 | + COPY_BIT_FIELD(dest, src, mv_fields, four_mv_block_pattern_table); | ||
| 3055 | + COPY_BIT_FIELD(dest, src, mv_fields, extended_mv_flag); | ||
| 3056 | + COPY_BIT_FIELD(dest, src, mv_fields, extended_mv_range); | ||
| 3057 | + COPY_BIT_FIELD(dest, src, mv_fields, extended_dmv_flag); | ||
| 3058 | + COPY_BIT_FIELD(dest, src, mv_fields, extended_dmv_range); | ||
| 3059 | + dest->BFV(pic_quantizer_fields, value) = 0; /* reset all bits */ | ||
| 3060 | + COPY_BIT_FIELD(dest, src, pic_quantizer_fields, dquant); | ||
| 3061 | + COPY_BIT_FIELD(dest, src, pic_quantizer_fields, quantizer); | ||
| 3062 | + COPY_BIT_FIELD(dest, src, pic_quantizer_fields, half_qp); | ||
| 3063 | + COPY_BIT_FIELD(dest, src, pic_quantizer_fields, pic_quantizer_scale); | ||
| 3064 | + COPY_BIT_FIELD(dest, src, pic_quantizer_fields, pic_quantizer_type); | ||
| 3065 | + COPY_BIT_FIELD(dest, src, pic_quantizer_fields, dq_frame); | ||
| 3066 | + COPY_BIT_FIELD(dest, src, pic_quantizer_fields, dq_profile); | ||
| 3067 | + COPY_BIT_FIELD(dest, src, pic_quantizer_fields, dq_sb_edge); | ||
| 3068 | + COPY_BIT_FIELD(dest, src, pic_quantizer_fields, dq_db_edge); | ||
| 3069 | + COPY_BIT_FIELD(dest, src, pic_quantizer_fields, dq_binary_level); | ||
| 3070 | + COPY_BIT_FIELD(dest, src, pic_quantizer_fields, alt_pic_quantizer); | ||
| 3071 | + dest->BFV(transform_fields, value) = 0; /* reset all bits */ | ||
| 3072 | + COPY_BIT_FIELD(dest, src, transform_fields, variable_sized_transform_flag); | ||
| 3073 | + COPY_BIT_FIELD(dest, src, transform_fields, mb_level_transform_type_flag); | ||
| 3074 | + COPY_BIT_FIELD(dest, src, transform_fields, frame_level_transform_type); | ||
| 3075 | + COPY_BIT_FIELD(dest, src, transform_fields, transform_ac_codingset_idx1); | ||
| 3076 | + COPY_BIT_FIELD(dest, src, transform_fields, transform_ac_codingset_idx2); | ||
| 3077 | + COPY_BIT_FIELD(dest, src, transform_fields, intra_transform_dc_table); | ||
| 3078 | + | ||
| 3079 | + if (src->picture_fields.bits.picture_type == 4) { | ||
| 3080 | + dest->BFM(picture_fields, bits, picture_type) = 1; /* P-frame */ | ||
| 3081 | + ctx->skip_frame = 1; | ||
| 3082 | + } | ||
| 3083 | + | ||
| 3084 | + return VA_STATUS_SUCCESS; | ||
| 3085 | +} | ||
| 3086 | + | ||
| 3087 | +static VAStatus TRANSLATE(PictureParameter,MPEG2)( | ||
| 3088 | + VACompatContextP ctx, | ||
| 3089 | + void *dest_buffer, | ||
| 3090 | + const void *src_buffer | ||
| 3091 | +) | ||
| 3092 | +{ | ||
| 3093 | + STRUCT(PictureParameter,MPEG2) *dest = dest_buffer; | ||
| 3094 | + const VAPictureParameterBufferMPEG2 *src = src_buffer; | ||
| 3095 | + | ||
| 3096 | + COPY_FIELD(dest, src, horizontal_size); | ||
| 3097 | + COPY_FIELD(dest, src, vertical_size); | ||
| 3098 | + COPY_FIELD(dest, src, forward_reference_picture); | ||
| 3099 | + COPY_FIELD(dest, src, backward_reference_picture); | ||
| 3100 | + COPY_FIELD(dest, src, picture_coding_type); | ||
| 3101 | + COPY_FIELD(dest, src, f_code); | ||
| 3102 | + dest->BFV(picture_coding_extension, value) = 0; /* reset all bits */ | ||
| 3103 | + COPY_BIT_FIELD(dest, src, picture_coding_extension, intra_dc_precision); | ||
| 3104 | + COPY_BIT_FIELD(dest, src, picture_coding_extension, picture_structure); | ||
| 3105 | + COPY_BIT_FIELD(dest, src, picture_coding_extension, top_field_first); | ||
| 3106 | + COPY_BIT_FIELD(dest, src, picture_coding_extension, frame_pred_frame_dct); | ||
| 3107 | + COPY_BIT_FIELD(dest, src, picture_coding_extension, concealment_motion_vectors); | ||
| 3108 | + COPY_BIT_FIELD(dest, src, picture_coding_extension, q_scale_type); | ||
| 3109 | + COPY_BIT_FIELD(dest, src, picture_coding_extension, intra_vlc_format); | ||
| 3110 | + COPY_BIT_FIELD(dest, src, picture_coding_extension, alternate_scan); | ||
| 3111 | + COPY_BIT_FIELD(dest, src, picture_coding_extension, repeat_first_field); | ||
| 3112 | + COPY_BIT_FIELD(dest, src, picture_coding_extension, progressive_frame); | ||
| 3113 | + COPY_BIT_FIELD(dest, src, picture_coding_extension, is_first_field); | ||
| 3114 | + | ||
| 3115 | + return VA_STATUS_SUCCESS; | ||
| 3116 | +} | ||
| 3117 | + | ||
| 3118 | +static VAStatus TRANSLATE(SliceParameter,MPEG2)( | ||
| 3119 | + VACompatContextP ctx, | ||
| 3120 | + void *dest_buffer, | ||
| 3121 | + const void *src_buffer | ||
| 3122 | +) | ||
| 3123 | +{ | ||
| 3124 | + STRUCT(SliceParameter,MPEG2) *dest = dest_buffer; | ||
| 3125 | + const VASliceParameterBufferMPEG2 *src = src_buffer; | ||
| 3126 | + | ||
| 3127 | + COPY_FIELD(dest, src, slice_data_size); | ||
| 3128 | + COPY_FIELD(dest, src, slice_data_offset); | ||
| 3129 | + COPY_FIELD(dest, src, slice_data_flag); | ||
| 3130 | + COPY_FIELD(dest, src, macroblock_offset); | ||
| 3131 | + COPY_FIELD(dest, src, slice_vertical_position); | ||
| 3132 | + COPY_FIELD(dest, src, quantiser_scale_code); | ||
| 3133 | + COPY_FIELD(dest, src, intra_slice_flag); | ||
| 3134 | + | ||
| 3135 | + return VA_STATUS_SUCCESS; | ||
| 3136 | +} | ||
| 3137 | +#endif | ||
| 3138 | + | ||
| 3139 | +static VAStatus TRANSLATE(PictureParameter,MPEG4)( | ||
| 3140 | + VACompatContextP ctx, | ||
| 3141 | + void *dest_buffer, | ||
| 3142 | + const void *src_buffer | ||
| 3143 | +) | ||
| 3144 | +{ | ||
| 3145 | + STRUCT(PictureParameter,MPEG4) *dest = dest_buffer; | ||
| 3146 | + const VAPictureParameterBufferMPEG4 *src = src_buffer; | ||
| 3147 | + | ||
| 3148 | + COPY_FIELD(dest, src, vop_width); | ||
| 3149 | + COPY_FIELD(dest, src, vop_height); | ||
| 3150 | + COPY_FIELD(dest, src, forward_reference_picture); | ||
| 3151 | + COPY_FIELD(dest, src, backward_reference_picture); | ||
| 3152 | + dest->BFV(vol_fields, value) = 0; /* reset all bits */ | ||
| 3153 | + COPY_BIT_FIELD(dest, src, vol_fields, short_video_header); | ||
| 3154 | + COPY_BIT_FIELD(dest, src, vol_fields, chroma_format); | ||
| 3155 | + COPY_BIT_FIELD(dest, src, vol_fields, interlaced); | ||
| 3156 | + COPY_BIT_FIELD(dest, src, vol_fields, obmc_disable); | ||
| 3157 | + COPY_BIT_FIELD(dest, src, vol_fields, sprite_enable); | ||
| 3158 | + COPY_BIT_FIELD(dest, src, vol_fields, sprite_warping_accuracy); | ||
| 3159 | + COPY_BIT_FIELD(dest, src, vol_fields, quant_type); | ||
| 3160 | + COPY_BIT_FIELD(dest, src, vol_fields, quarter_sample); | ||
| 3161 | + COPY_BIT_FIELD(dest, src, vol_fields, data_partitioned); | ||
| 3162 | + COPY_BIT_FIELD(dest, src, vol_fields, reversible_vlc); | ||
| 3163 | + COPY_FIELD(dest, src, no_of_sprite_warping_points); | ||
| 3164 | + COPY_ARRAY(dest, src, sprite_trajectory_du); | ||
| 3165 | + COPY_ARRAY(dest, src, sprite_trajectory_dv); | ||
| 3166 | + COPY_FIELD(dest, src, quant_precision); | ||
| 3167 | + dest->BFV(vop_fields, value) = 0; /* reset all bits */ | ||
| 3168 | + COPY_BIT_FIELD(dest, src, vop_fields, vop_coding_type); | ||
| 3169 | + COPY_BIT_FIELD(dest, src, vop_fields, backward_reference_vop_coding_type); | ||
| 3170 | + COPY_BIT_FIELD(dest, src, vop_fields, vop_rounding_type); | ||
| 3171 | + COPY_BIT_FIELD(dest, src, vop_fields, intra_dc_vlc_thr); | ||
| 3172 | + COPY_BIT_FIELD(dest, src, vop_fields, top_field_first); | ||
| 3173 | + COPY_BIT_FIELD(dest, src, vop_fields, alternate_vertical_scan_flag); | ||
| 3174 | + COPY_FIELD(dest, src, vop_fcode_forward); | ||
| 3175 | + COPY_FIELD(dest, src, vop_fcode_backward); | ||
| 3176 | + COPY_FIELD(dest, src, num_gobs_in_vop); | ||
| 3177 | + COPY_FIELD(dest, src, num_macroblocks_in_gob); | ||
| 3178 | + COPY_FIELD(dest, src, TRB); | ||
| 3179 | + COPY_FIELD(dest, src, TRD); | ||
| 3180 | + | ||
| 3181 | + return VA_STATUS_SUCCESS; | ||
| 3182 | +} | ||
| 3183 | + | ||
| 3184 | +#if COMPAT_MAJOR == 0 && COMPAT_MINOR == 30 | ||
| 3185 | +static VAStatus TRANSLATE_(VAEncSliceParameterBuffer)( | ||
| 3186 | + VACompatContextP ctx, | ||
| 3187 | + void *dest_buffer, | ||
| 3188 | + const void *src_buffer | ||
| 3189 | +) | ||
| 3190 | +{ | ||
| 3191 | + MKCOMPAT(VAEncSliceParameterBuffer) * const dest = dest_buffer; | ||
| 3192 | + const VAEncSliceParameterBuffer * const src = src_buffer; | ||
| 3193 | + | ||
| 3194 | + COPY_FIELD(dest, src, start_row_number); | ||
| 3195 | + COPY_FIELD(dest, src, slice_height); | ||
| 3196 | + dest->BFV(slice_flags, value) = 0; /* reset all bits */ | ||
| 3197 | + COPY_BIT_FIELD(dest, src, slice_flags, is_intra); | ||
| 3198 | + COPY_BIT_FIELD(dest, src, slice_flags, disable_deblocking_filter_idc); | ||
| 3199 | + | ||
| 3200 | + return VA_STATUS_SUCCESS; | ||
| 3201 | +} | ||
| 3202 | +#endif | ||
| 3203 | + | ||
| 3204 | +static void TRANSLATE_(VADriverContext)( | ||
| 3205 | + VACompatContext *dest, | ||
| 3206 | + const struct MKCOMPAT(VADriverContext) *src | ||
| 3207 | +) | ||
| 3208 | +{ | ||
| 3209 | + VACompatDriverVTable *dest_vtable = &dest->vtable; | ||
| 3210 | + const struct MKCOMPAT(VADriverVTable) *src_vtable = &src->vtable; | ||
| 3211 | + | ||
| 3212 | + memset(dest_vtable, 0, sizeof(*dest_vtable)); | ||
| 3213 | + COPY_VTABLE(dest, src, vaTerminate); | ||
| 3214 | + COPY_VTABLE(dest, src, vaQueryConfigProfiles); | ||
| 3215 | + COPY_VTABLE(dest, src, vaQueryConfigEntrypoints); | ||
| 3216 | + COPY_VTABLE(dest, src, vaGetConfigAttributes); | ||
| 3217 | + COPY_VTABLE(dest, src, vaCreateConfig); | ||
| 3218 | + COPY_VTABLE(dest, src, vaDestroyConfig); | ||
| 3219 | + COPY_VTABLE(dest, src, vaQueryConfigAttributes); | ||
| 3220 | + COPY_VTABLE(dest, src, vaCreateSurfaces); | ||
| 3221 | + COPY_VTABLE(dest, src, vaDestroySurfaces); | ||
| 3222 | + COPY_VTABLE(dest, src, vaCreateContext); | ||
| 3223 | + COPY_VTABLE(dest, src, vaDestroyContext); | ||
| 3224 | + COPY_VTABLE(dest, src, vaCreateBuffer); | ||
| 3225 | + COPY_VTABLE(dest, src, vaBufferSetNumElements); | ||
| 3226 | + COPY_VTABLE(dest, src, vaMapBuffer); | ||
| 3227 | + COPY_VTABLE(dest, src, vaUnmapBuffer); | ||
| 3228 | + COPY_VTABLE(dest, src, vaDestroyBuffer); | ||
| 3229 | + COPY_VTABLE(dest, src, vaBeginPicture); | ||
| 3230 | + COPY_VTABLE(dest, src, vaRenderPicture); | ||
| 3231 | + COPY_VTABLE(dest, src, vaEndPicture); | ||
| 3232 | + COPY_VTABLE(dest, src, vaQuerySurfaceStatus); | ||
| 3233 | + COPY_VTABLE(dest, src, vaPutSurface); | ||
| 3234 | + COPY_VTABLE(dest, src, vaQueryImageFormats); | ||
| 3235 | + COPY_VTABLE(dest, src, vaCreateImage); | ||
| 3236 | + COPY_VTABLE(dest, src, vaDeriveImage); | ||
| 3237 | + COPY_VTABLE(dest, src, vaDestroyImage); | ||
| 3238 | + COPY_VTABLE(dest, src, vaSetImagePalette); | ||
| 3239 | + COPY_VTABLE(dest, src, vaGetImage); | ||
| 3240 | + COPY_VTABLE(dest, src, vaQuerySubpictureFormats); | ||
| 3241 | + COPY_VTABLE(dest, src, vaCreateSubpicture); | ||
| 3242 | + COPY_VTABLE(dest, src, vaDestroySubpicture); | ||
| 3243 | + COPY_VTABLE(dest, src, vaSetSubpictureImage); | ||
| 3244 | + COPY_VTABLE(dest, src, vaSetSubpictureChromakey); | ||
| 3245 | + COPY_VTABLE(dest, src, vaSetSubpictureGlobalAlpha); | ||
| 3246 | + COPY_VTABLE(dest, src, vaDeassociateSubpicture); | ||
| 3247 | + COPY_VTABLE(dest, src, vaQueryDisplayAttributes); | ||
| 3248 | + COPY_VTABLE(dest, src, vaGetDisplayAttributes); | ||
| 3249 | + COPY_VTABLE(dest, src, vaSetDisplayAttributes); | ||
| 3250 | +#if COMPAT_MAJOR == 0 && COMPAT_MINOR <= 29 | ||
| 3251 | + COPY_VTABLE(dest, src, vaSetSubpicturePalette); | ||
| 3252 | + COPY_VTABLE(dest, src, vaDbgCopySurfaceToBuffer); | ||
| 3253 | +#endif | ||
| 3254 | +#if COMPAT_MAJOR == 0 && COMPAT_MINOR >= 30 | ||
| 3255 | + COPY_VTABLE(dest, src, vaCreateSurfaceFromCIFrame); | ||
| 3256 | + COPY_VTABLE(dest, src, vaCreateSurfaceFromV4L2Buf); | ||
| 3257 | + COPY_VTABLE(dest, src, vaCopySurfaceToBuffer); | ||
| 3258 | +#endif | ||
| 3259 | +#if COMPAT_MAJOR == 0 && COMPAT_MINOR >= 31 | ||
| 3260 | + COPY_VTABLE(dest, src, vaSyncSurface); | ||
| 3261 | + COPY_VTABLE(dest, src, vaPutImage); | ||
| 3262 | + COPY_VTABLE(dest, src, vaAssociateSubpicture); | ||
| 3263 | +#else | ||
| 3264 | + COPY_VTABLE_(dest, pre31, src, vaSyncSurface); | ||
| 3265 | + COPY_VTABLE_(dest, pre31, src, vaPutImage); | ||
| 3266 | + COPY_VTABLE_(dest, pre31, src, vaPutImage2); | ||
| 3267 | + COPY_VTABLE_(dest, pre31, src, vaAssociateSubpicture); | ||
| 3268 | + COPY_VTABLE_(dest, pre31, src, vaAssociateSubpicture2); | ||
| 3269 | +#endif | ||
| 3270 | +} | ||
| 3271 | + | ||
| 3272 | +#undef COMPAT_MAJOR | ||
| 3273 | +#undef COMPAT_MINOR | ||
