2 * Copyright (c) 2007 Intel Corporation. All Rights Reserved.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sub license, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
12 * The above copyright notice and this permission notice (including the
13 * next paragraph) shall be included in all copies or substantial portions
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
19 * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
20 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 #include "va_backend.h"
37 #define DEFAULT_DRIVER_DIR "/usr/X11R6/lib/modules/dri"
38 #define DRIVER_EXTENSION "_drv_video.so"
39 #define DRIVER_INIT_FUNC "__vaDriverInit_0_24"
41 #define CTX(dpy) ((VADriverContextP) dpy );
42 #define ASSERT_CONTEXT(dpy) assert( vaDbgContextIsValid(dpy) )
44 #define CHECK_VTABLE(s, ctx, func) if (!va_checkVtable(ctx->vtable.va##func, #func)) s = VA_STATUS_ERROR_UNKNOWN;
45 #define CHECK_MAXIMUM(s, ctx, var) if (!va_checkMaximum(ctx->max_##var, #var)) s = VA_STATUS_ERROR_UNKNOWN;
47 #define TRACE(func) if (va_debug_trace) va_infoMessage("[TR] %s\n", #func);
49 static VADriverContextP pDriverContexts = NULL;
50 static int va_debug_trace = 0;
52 static Bool vaDbgContextIsValid(VADriverContextP arg_ctx)
54 VADriverContextP ctx = pDriverContexts;
67 VADisplay vaGetDisplay (
68 NativeDisplay native_dpy /* implementation specific */
72 VADriverContextP ctx = pDriverContexts;
76 if (ctx->x11_dpy == (Display *)native_dpy)
78 dpy = (VADisplay) ctx;
86 /* create new entry */
87 ctx = (VADriverContextP) calloc(1, sizeof(struct VADriverContext));
88 ctx->pNext = pDriverContexts;
89 ctx->x11_dpy = (Display *) native_dpy;
90 pDriverContexts = ctx;
91 dpy = (VADisplay) ctx;
97 static void va_errorMessage(const char *msg, ...)
101 fprintf(stderr, "libva error: ");
103 vfprintf(stderr, msg, args);
107 static void va_infoMessage(const char *msg, ...)
111 fprintf(stderr, "libva: ");
113 vfprintf(stderr, msg, args);
117 static Bool va_checkVtable(void *ptr, char *function)
121 va_errorMessage("No valid vtable entry for va%s\n", function);
127 static Bool va_checkMaximum(int value, char *variable)
131 va_errorMessage("Failed to define max_%s in init\n", variable);
137 static VAStatus va_getDriverName(VADriverContextP ctx, char **driver_name)
139 VAStatus vaStatus = VA_STATUS_ERROR_UNKNOWN;
147 if (geteuid() == getuid())
149 /* don't allow setuid apps to use LIBVA_DRIVER_NAME */
150 if (getenv("LIBVA_DRIVER_NAME"))
152 /* For easier debugging */
153 *driver_name = strdup(getenv("LIBVA_DRIVER_NAME"));
154 return VA_STATUS_SUCCESS;
159 result = VA_DRIQueryDirectRenderingCapable(ctx->x11_dpy, ctx->x11_screen, &direct_capable);
162 va_errorMessage("VA_DRIQueryDirectRenderingCapable failed\n");
167 result = direct_capable;
170 va_errorMessage("VA_DRIQueryDirectRenderingCapable returned false\n");
175 result = VA_DRIGetClientDriverName(ctx->x11_dpy, ctx->x11_screen, &driver_major, &driver_minor,
176 &driver_patch, driver_name);
179 va_errorMessage("VA_DRIGetClientDriverName returned false\n");
184 vaStatus = VA_STATUS_SUCCESS;
185 va_infoMessage("VA_DRIGetClientDriverName: %d.%d.%d %s (screen %d)\n",
186 driver_major, driver_minor, driver_patch, *driver_name, ctx->x11_screen);
192 static VAStatus va_openDriver(VADriverContextP ctx, char *driver_name)
194 VAStatus vaStatus = VA_STATUS_ERROR_UNKNOWN;
199 if (geteuid() == getuid())
201 /* don't allow setuid apps to use LIBVA_DRIVERS_PATH */
202 search_path = getenv("LIBVA_DRIVERS_PATH");
205 search_path = getenv("LIBGL_DRIVERS_PATH");
210 search_path = DEFAULT_DRIVER_DIR;
213 search_path = strdup(search_path);
214 driver_dir = strtok_r(search_path, ":", &saveptr);
218 char *driver_path = (char *) malloc( strlen(driver_dir) +
219 strlen(driver_name) +
220 strlen(DRIVER_EXTENSION) + 2 );
221 strcpy( driver_path, driver_dir );
222 strcat( driver_path, "/" );
223 strcat( driver_path, driver_name );
224 strcat( driver_path, DRIVER_EXTENSION );
226 va_infoMessage("Trying to open %s\n", driver_path);
228 handle = dlopen( driver_path, RTLD_NOW | RTLD_GLOBAL );
231 /* Don't give errors for non-existing files */
232 if (0 == access( driver_path, F_OK))
234 va_errorMessage("dlopen of %s failed: %s\n", driver_path, dlerror());
239 VADriverInit init_func;
240 init_func = (VADriverInit) dlsym(handle, DRIVER_INIT_FUNC);
243 va_errorMessage("%s has no function %s\n", driver_path, DRIVER_INIT_FUNC);
248 vaStatus = (*init_func)(ctx);
250 if (VA_STATUS_SUCCESS == vaStatus)
252 CHECK_MAXIMUM(vaStatus, ctx, profiles);
253 CHECK_MAXIMUM(vaStatus, ctx, entrypoints);
254 CHECK_MAXIMUM(vaStatus, ctx, attributes);
255 CHECK_MAXIMUM(vaStatus, ctx, image_formats);
256 CHECK_MAXIMUM(vaStatus, ctx, subpic_formats);
257 CHECK_MAXIMUM(vaStatus, ctx, display_attributes);
258 CHECK_VTABLE(vaStatus, ctx, Terminate);
259 CHECK_VTABLE(vaStatus, ctx, QueryConfigProfiles);
260 CHECK_VTABLE(vaStatus, ctx, QueryConfigEntrypoints);
261 CHECK_VTABLE(vaStatus, ctx, QueryConfigAttributes);
262 CHECK_VTABLE(vaStatus, ctx, CreateConfig);
263 CHECK_VTABLE(vaStatus, ctx, DestroyConfig);
264 CHECK_VTABLE(vaStatus, ctx, GetConfigAttributes);
265 CHECK_VTABLE(vaStatus, ctx, CreateSurfaces);
266 CHECK_VTABLE(vaStatus, ctx, DestroySurface);
267 CHECK_VTABLE(vaStatus, ctx, CreateContext);
268 CHECK_VTABLE(vaStatus, ctx, DestroyContext);
269 CHECK_VTABLE(vaStatus, ctx, CreateBuffer);
270 CHECK_VTABLE(vaStatus, ctx, BufferData);
271 CHECK_VTABLE(vaStatus, ctx, BufferSetNumElements);
272 CHECK_VTABLE(vaStatus, ctx, MapBuffer);
273 CHECK_VTABLE(vaStatus, ctx, UnmapBuffer);
274 CHECK_VTABLE(vaStatus, ctx, DestroyBuffer);
275 CHECK_VTABLE(vaStatus, ctx, BeginPicture);
276 CHECK_VTABLE(vaStatus, ctx, RenderPicture);
277 CHECK_VTABLE(vaStatus, ctx, EndPicture);
278 CHECK_VTABLE(vaStatus, ctx, SyncSurface);
279 CHECK_VTABLE(vaStatus, ctx, QuerySurfaceStatus);
280 CHECK_VTABLE(vaStatus, ctx, PutSurface);
281 CHECK_VTABLE(vaStatus, ctx, QueryImageFormats);
282 CHECK_VTABLE(vaStatus, ctx, CreateImage);
283 CHECK_VTABLE(vaStatus, ctx, DestroyImage);
284 CHECK_VTABLE(vaStatus, ctx, GetImage);
285 CHECK_VTABLE(vaStatus, ctx, PutImage);
286 CHECK_VTABLE(vaStatus, ctx, QuerySubpictureFormats);
287 CHECK_VTABLE(vaStatus, ctx, CreateSubpicture);
288 CHECK_VTABLE(vaStatus, ctx, DestroySubpicture);
289 CHECK_VTABLE(vaStatus, ctx, SetSubpictureImage);
290 CHECK_VTABLE(vaStatus, ctx, SetSubpicturePalette);
291 CHECK_VTABLE(vaStatus, ctx, SetSubpictureChromakey);
292 CHECK_VTABLE(vaStatus, ctx, SetSubpictureGlobalAlpha);
293 CHECK_VTABLE(vaStatus, ctx, AssociateSubpicture);
294 CHECK_VTABLE(vaStatus, ctx, QueryDisplayAttributes);
295 CHECK_VTABLE(vaStatus, ctx, GetDisplayAttributes);
296 CHECK_VTABLE(vaStatus, ctx, SetDisplayAttributes);
297 CHECK_VTABLE(vaStatus, ctx, DbgCopySurfaceToBuffer);
299 if (VA_STATUS_SUCCESS != vaStatus)
301 va_errorMessage("%s init failed\n", driver_path);
304 if (VA_STATUS_SUCCESS == vaStatus)
306 ctx->handle = handle;
314 driver_dir = strtok_r(NULL, ":", &saveptr);
324 * Returns a short english description of error_status
326 const char *vaErrorStr(VAStatus error_status)
330 case VA_STATUS_SUCCESS:
331 return "success (no error)";
332 case VA_STATUS_ERROR_ALLOCATION_FAILED:
333 return "resource allocation failed";
334 case VA_STATUS_ERROR_INVALID_CONFIG:
335 return "invalid VAConfigID";
336 case VA_STATUS_ERROR_INVALID_CONTEXT:
337 return "invalid VAContextID";
338 case VA_STATUS_ERROR_INVALID_SURFACE:
339 return "invalid VASurfaceID";
340 case VA_STATUS_ERROR_INVALID_BUFFER:
341 return "invalid VABufferID";
342 case VA_STATUS_ERROR_ATTR_NOT_SUPPORTED:
343 return "attribute not supported";
344 case VA_STATUS_ERROR_MAX_NUM_EXCEEDED:
345 return "list argument exceeds maximum number";
346 case VA_STATUS_ERROR_UNSUPPORTED_PROFILE:
347 return "the requested VAProfile is not supported";
348 case VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT:
349 return "the requested VAEntryPoint is not supported";
350 case VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT:
351 return "the requested RT Format is not supported";
352 case VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE:
353 return "the requested VABufferType is not supported";
354 case VA_STATUS_ERROR_UNKNOWN:
355 return "unknown libva error";
357 return "unknown libva error / description missing";
360 VAStatus vaInitialize (
362 int *major_version, /* out */
363 int *minor_version /* out */
366 VADriverContextP ctx = CTX(dpy);
367 char *driver_name = NULL;
372 va_debug_trace = (getenv("LIBVA_DEBUG_TRACE") != NULL);
374 vaStatus = va_getDriverName(ctx, &driver_name);
375 va_infoMessage("va_getDriverName() returns %d\n", vaStatus);
377 if (VA_STATUS_SUCCESS == vaStatus)
379 vaStatus = va_openDriver(ctx, driver_name);
380 va_infoMessage("va_openDriver() returns %d\n", vaStatus);
382 *major_version = ctx->version_major;
383 *minor_version = ctx->version_minor;
395 * After this call, all library internal resources will be cleaned up
397 VAStatus vaTerminate (
401 VAStatus vaStatus = VA_STATUS_SUCCESS;
402 VADriverContextP old_ctx = CTX(dpy);
403 ASSERT_CONTEXT(old_ctx);
407 vaStatus = old_ctx->vtable.vaTerminate(old_ctx);
408 dlclose(old_ctx->handle);
409 old_ctx->handle = NULL;
412 if (VA_STATUS_SUCCESS == vaStatus)
414 VADriverContextP *ctx = &pDriverContexts;
416 /* Throw away old_ctx */
421 *ctx = old_ctx->pNext;
422 old_ctx->pNext = NULL;
425 ctx = &((*ctx)->pNext);
432 /* Get maximum number of profiles supported by the implementation */
433 int vaMaxNumProfiles (
437 VADriverContextP ctx = CTX(dpy);
440 return ctx->max_profiles;
443 /* Get maximum number of entrypoints supported by the implementation */
444 int vaMaxNumEntrypoints (
448 VADriverContextP ctx = CTX(dpy);
451 return ctx->max_entrypoints;
455 /* Get maximum number of attributs supported by the implementation */
456 int vaMaxNumConfigAttributes (
460 VADriverContextP ctx = CTX(dpy);
463 return ctx->max_attributes;
466 VAStatus vaQueryConfigEntrypoints (
469 VAEntrypoint *entrypoints, /* out */
470 int *num_entrypoints /* out */
473 VADriverContextP ctx = CTX(dpy);
476 TRACE(vaQueryConfigEntrypoints);
477 return ctx->vtable.vaQueryConfigEntrypoints ( ctx, profile, entrypoints, num_entrypoints);
480 VAStatus vaGetConfigAttributes (
483 VAEntrypoint entrypoint,
484 VAConfigAttrib *attrib_list, /* in/out */
488 VADriverContextP ctx = CTX(dpy);
491 TRACE(vaGetConfigAttributes);
492 return ctx->vtable.vaGetConfigAttributes ( ctx, profile, entrypoint, attrib_list, num_attribs );
495 VAStatus vaQueryConfigProfiles (
497 VAProfile *profile_list, /* out */
498 int *num_profiles /* out */
501 VADriverContextP ctx = CTX(dpy);
504 TRACE(vaQueryConfigProfiles);
505 return ctx->vtable.vaQueryConfigProfiles ( ctx, profile_list, num_profiles );
508 VAStatus vaCreateConfig (
511 VAEntrypoint entrypoint,
512 VAConfigAttrib *attrib_list,
514 VAConfigID *config_id /* out */
517 VADriverContextP ctx = CTX(dpy);
520 TRACE(vaCreateConfig);
521 return ctx->vtable.vaCreateConfig ( ctx, profile, entrypoint, attrib_list, num_attribs, config_id );
524 VAStatus vaDestroyConfig (
529 VADriverContextP ctx = CTX(dpy);
532 TRACE(vaDestroyConfig);
533 return ctx->vtable.vaDestroyConfig ( ctx, config_id );
536 VAStatus vaQueryConfigAttributes (
538 VAConfigID config_id,
539 VAProfile *profile, /* out */
540 VAEntrypoint *entrypoint, /* out */
541 VAConfigAttrib *attrib_list,/* out */
542 int *num_attribs /* out */
545 VADriverContextP ctx = CTX(dpy);
548 TRACE(vaQueryConfigAttributes);
549 return ctx->vtable.vaQueryConfigAttributes( ctx, config_id, profile, entrypoint, attrib_list, num_attribs);
552 VAStatus vaCreateSurfaces (
558 VASurface *surfaces /* out */
561 VADriverContextP ctx = CTX(dpy);
564 TRACE(vaCreateSurfaces);
565 return ctx->vtable.vaCreateSurfaces( ctx, width, height, format, num_surfaces, surfaces );
568 VAStatus vaDestroySurface (
570 VASurface *surface_list,
574 VADriverContextP ctx = CTX(dpy);
577 TRACE(vaDestroySurface);
578 return ctx->vtable.vaDestroySurface( ctx, surface_list, num_surfaces );
581 VAStatus vaCreateContext (
583 VAConfigID config_id,
587 VASurface *render_targets,
588 int num_render_targets,
589 VAContext *context /* out */
592 VADriverContextP ctx = CTX(dpy);
595 TRACE(vaCreateContext);
596 return ctx->vtable.vaCreateContext( ctx, config_id, picture_width, picture_height,
597 flag, render_targets, num_render_targets, context );
600 VAStatus vaDestroyContext (
605 VADriverContextP ctx = CTX(dpy);
608 TRACE(vaDestroyContext);
609 return ctx->vtable.vaDestroyContext( ctx, context );
612 VAStatus vaCreateBuffer (
614 VABufferType type, /* in */
615 VABufferID *buf_id /* out */
618 VADriverContextP ctx = CTX(dpy);
621 TRACE(vaCreateBuffer);
622 return ctx->vtable.vaCreateBuffer( ctx, type, buf_id);
625 VAStatus vaBufferData (
627 VABufferID buf_id, /* in */
628 unsigned int size, /* in */
629 unsigned int num_elements, /* in */
633 VADriverContextP ctx = CTX(dpy);
637 return ctx->vtable.vaBufferData( ctx, buf_id, size, num_elements, data);
640 VAStatus vaBufferSetNumElements (
642 VABufferID buf_id, /* in */
643 unsigned int num_elements /* in */
646 VADriverContextP ctx = CTX(dpy);
649 TRACE(vaBufferSetNumElements);
650 return ctx->vtable.vaBufferSetNumElements( ctx, buf_id, num_elements );
654 VAStatus vaMapBuffer (
656 VABufferID buf_id, /* in */
657 void **pbuf /* out */
660 VADriverContextP ctx = CTX(dpy);
664 return ctx->vtable.vaMapBuffer( ctx, buf_id, pbuf );
667 VAStatus vaUnmapBuffer (
669 VABufferID buf_id /* in */
672 VADriverContextP ctx = CTX(dpy);
675 TRACE(vaUnmapBuffer);
676 return ctx->vtable.vaUnmapBuffer( ctx, buf_id );
679 VAStatus vaDestroyBuffer (
684 VADriverContextP ctx = CTX(dpy);
687 TRACE(vaDestroyBuffer);
688 return ctx->vtable.vaDestroyBuffer( ctx, buffer_id );
691 VAStatus vaBeginPicture (
694 VASurface *render_target
697 VADriverContextP ctx = CTX(dpy);
700 TRACE(vaBeginPicture);
701 return ctx->vtable.vaBeginPicture( ctx, context, render_target );
704 VAStatus vaRenderPicture (
711 VADriverContextP ctx = CTX(dpy);
714 TRACE(vaRenderPicture);
715 return ctx->vtable.vaRenderPicture( ctx, context, buffers, num_buffers );
718 VAStatus vaEndPicture (
723 VADriverContextP ctx = CTX(dpy);
727 return ctx->vtable.vaEndPicture( ctx, context );
730 VAStatus vaSyncSurface (
733 VASurface *render_target
736 VADriverContextP ctx = CTX(dpy);
739 TRACE(vaSyncSurface);
740 return ctx->vtable.vaSyncSurface( ctx, context, render_target );
743 VAStatus vaQuerySurfaceStatus (
746 VASurface *render_target,
747 VASurfaceStatus *status /* out */
750 VADriverContextP ctx = CTX(dpy);
753 TRACE(vaQuerySurfaceStatus);
754 return ctx->vtable.vaQuerySurfaceStatus( ctx, context, render_target, status );
757 VAStatus vaPutSurface (
760 Drawable draw, /* X Drawable */
767 unsigned short destw,
768 unsigned short desth,
769 VARectangle *cliprects, /* client supplied clip list */
770 unsigned int number_cliprects, /* number of clip rects in the clip list */
771 unsigned int flags /* de-interlacing flags */
774 VADriverContextP ctx = CTX(dpy);
778 return ctx->vtable.vaPutSurface( ctx, surface, draw, srcx, srcy, srcw, srch,
779 destx, desty, destw, desth,
780 cliprects, number_cliprects, flags );
783 /* Get maximum number of image formats supported by the implementation */
784 int vaMaxNumImageFormats (
788 VADriverContextP ctx = CTX(dpy);
791 return ctx->max_image_formats;
794 VAStatus vaQueryImageFormats (
796 VAImageFormat *format_list, /* out */
797 int *num_formats /* out */
800 VADriverContextP ctx = CTX(dpy);
803 TRACE(vaQueryImageFormats);
804 return ctx->vtable.vaQueryImageFormats ( ctx, format_list, num_formats);
808 * The width and height fields returned in the VAImage structure may get
809 * enlarged for some YUV formats. The size of the data buffer that needs
810 * to be allocated will be given in the "data_size" field in VAImage.
811 * Image data is not allocated by this function. The client should
812 * allocate the memory and fill in the VAImage structure's data field
813 * after looking at "data_size" returned from the library.
815 VAStatus vaCreateImage (
817 VAImageFormat *format,
820 VAImage *image /* out */
823 VADriverContextP ctx = CTX(dpy);
826 TRACE(vaCreateImage);
827 return ctx->vtable.vaCreateImage ( ctx, format, width, height, image);
831 * Should call DestroyImage before destroying the surface it is bound to
833 VAStatus vaDestroyImage (
838 VADriverContextP ctx = CTX(dpy);
841 TRACE(vaDestroyImage);
842 return ctx->vtable.vaDestroyImage ( ctx, image);
846 * Retrieve surface data into a VAImage
847 * Image must be in a format supported by the implementation
849 VAStatus vaGetImage (
852 int x, /* coordinates of the upper left source pixel */
854 unsigned int width, /* width and height of the region */
859 VADriverContextP ctx = CTX(dpy);
863 return ctx->vtable.vaGetImage ( ctx, surface, x, y, width, height, image);
867 * Copy data from a VAImage to a surface
868 * Image must be in a format supported by the implementation
870 VAStatus vaPutImage (
882 VADriverContextP ctx = CTX(dpy);
886 return ctx->vtable.vaPutImage ( ctx, surface, image, src_x, src_y, width, height, dest_x, dest_y );
889 /* Get maximum number of subpicture formats supported by the implementation */
890 int vaMaxNumSubpictureFormats (
894 VADriverContextP ctx = CTX(dpy);
897 return ctx->max_subpic_formats;
901 * Query supported subpicture formats
902 * The caller must provide a "format_list" array that can hold at
903 * least vaMaxNumSubpictureFormats() entries. The flags arrary holds the flag
904 * for each format to indicate additional capabilities for that format. The actual
905 * number of formats returned in "format_list" is returned in "num_formats".
907 VAStatus vaQuerySubpictureFormats (
909 VAImageFormat *format_list, /* out */
910 unsigned int *flags, /* out */
911 unsigned int *num_formats /* out */
914 VADriverContextP ctx = CTX(dpy);
917 TRACE(vaQuerySubpictureFormats);
918 return ctx->vtable.vaQuerySubpictureFormats ( ctx, format_list, flags, num_formats);
922 * Subpictures are created with an image associated.
924 VAStatus vaCreateSubpicture (
927 VASubpicture *subpicture /* out */
930 VADriverContextP ctx = CTX(dpy);
933 TRACE(vaCreateSubpicture);
934 return ctx->vtable.vaCreateSubpicture ( ctx, image, subpicture );
938 * Destroy the subpicture before destroying the image it is assocated to
940 VAStatus vaDestroySubpicture (
942 VASubpicture *subpicture
945 VADriverContextP ctx = CTX(dpy);
948 TRACE(vaDestroySubpicture);
949 return ctx->vtable.vaDestroySubpicture ( ctx, subpicture);
952 VAStatus vaSetSubpictureImage (
954 VASubpicture *subpicture,
958 VADriverContextP ctx = CTX(dpy);
961 TRACE(vaSetSubpictureImage);
962 return ctx->vtable.vaSetSubpictureImage ( ctx, subpicture, image);
966 VAStatus vaSetSubpicturePalette (
968 VASubpicture *subpicture,
970 * pointer to an array holding the palette data. The size of the array is
971 * num_palette_entries * entry_bytes in size. The order of the components
972 * in the palette is described by the component_order in VASubpicture struct
974 unsigned char *palette
977 VADriverContextP ctx = CTX(dpy);
980 TRACE(vaSetSubpicturePalette);
981 return ctx->vtable.vaSetSubpicturePalette ( ctx, subpicture, palette);
985 * If chromakey is enabled, then the area where the source value falls within
986 * the chromakey [min, max] range is transparent
988 VAStatus vaSetSubpictureChromakey (
990 VASubpicture *subpicture,
991 unsigned int chromakey_min,
992 unsigned int chromakey_max
995 VADriverContextP ctx = CTX(dpy);
998 TRACE(vaSetSubpictureChromakey);
999 return ctx->vtable.vaSetSubpictureChromakey ( ctx, subpicture, chromakey_min, chromakey_max );
1004 * Global alpha value is between 0 and 1. A value of 1 means fully opaque and
1005 * a value of 0 means fully transparent. If per-pixel alpha is also specified then
1006 * the overall alpha is per-pixel alpha multiplied by the global alpha
1008 VAStatus vaSetSubpictureGlobalAlpha (
1010 VASubpicture *subpicture,
1014 VADriverContextP ctx = CTX(dpy);
1015 ASSERT_CONTEXT(ctx);
1017 TRACE(vaSetSubpictureGlobalAlpha);
1018 return ctx->vtable.vaSetSubpictureGlobalAlpha ( ctx, subpicture, global_alpha );
1022 vaAssociateSubpicture associates the subpicture with the target_surface.
1023 It defines the region mapping between the subpicture and the target
1024 surface through source and destination rectangles (with the same width and height).
1025 Both will be displayed at the next call to vaPutSurface. Additional
1026 associations before the call to vaPutSurface simply overrides the association.
1028 VAStatus vaAssociateSubpicture (
1030 VASurface *target_surface,
1031 VASubpicture *subpicture,
1032 short src_x, /* upper left offset in subpicture */
1034 short dest_x, /* upper left offset in surface */
1036 unsigned short width,
1037 unsigned short height,
1039 * whether to enable chroma-keying or global-alpha
1040 * see VA_SUBPICTURE_XXX values
1045 VADriverContextP ctx = CTX(dpy);
1046 ASSERT_CONTEXT(ctx);
1048 TRACE(vaAssociateSubpicture);
1049 return ctx->vtable.vaAssociateSubpicture ( ctx, target_surface, subpicture, src_x, src_y, dest_x, dest_y, width, height, flags );
1052 /* Get maximum number of display attributes supported by the implementation */
1053 int vaMaxNumDisplayAttributes (
1057 VADriverContextP ctx = CTX(dpy);
1058 ASSERT_CONTEXT(ctx);
1060 return ctx->max_display_attributes;
1064 * Query display attributes
1065 * The caller must provide a "attr_list" array that can hold at
1066 * least vaMaxNumDisplayAttributes() entries. The actual number of attributes
1067 * returned in "attr_list" is returned in "num_attributes".
1069 VAStatus vaQueryDisplayAttributes (
1071 VADisplayAttribute *attr_list, /* out */
1072 int *num_attributes /* out */
1075 VADriverContextP ctx = CTX(dpy);
1076 ASSERT_CONTEXT(ctx);
1078 TRACE(vaQueryDisplayAttributes);
1079 return ctx->vtable.vaQueryDisplayAttributes ( ctx, attr_list, num_attributes );
1083 * Get display attributes
1084 * This function returns the current attribute values in "attr_list".
1085 * Only attributes returned with VA_DISPLAY_ATTRIB_GETTABLE set in the "flags" field
1086 * from vaQueryDisplayAttributes() can have their values retrieved.
1088 VAStatus vaGetDisplayAttributes (
1090 VADisplayAttribute *attr_list, /* in/out */
1094 VADriverContextP ctx = CTX(dpy);
1095 ASSERT_CONTEXT(ctx);
1097 TRACE(vaGetDisplayAttributes);
1098 return ctx->vtable.vaGetDisplayAttributes ( ctx, attr_list, num_attributes );
1102 * Set display attributes
1103 * Only attributes returned with VA_DISPLAY_ATTRIB_SETTABLE set in the "flags" field
1104 * from vaQueryDisplayAttributes() can be set. If the attribute is not settable or
1105 * the value is out of range, the function returns VA_STATUS_ERROR_ATTR_NOT_SUPPORTED
1107 VAStatus vaSetDisplayAttributes (
1109 VADisplayAttribute *attr_list,
1113 VADriverContextP ctx = CTX(dpy);
1114 ASSERT_CONTEXT(ctx);
1116 TRACE(vaSetDisplayAttributes);
1117 return ctx->vtable.vaSetDisplayAttributes ( ctx, attr_list, num_attributes );
1122 VAStatus vaDbgCopySurfaceToBuffer(VADisplay dpy,
1124 void **buffer, /* out */
1125 unsigned int *stride /* out */
1128 VADriverContextP ctx = CTX(dpy);
1129 ASSERT_CONTEXT(ctx);
1131 TRACE(vaDbgCopySurfaceToBuffer);
1132 return ctx->vtable.vaDbgCopySurfaceToBuffer( ctx, surface, buffer, stride );