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_23"
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_VTABLE(vaStatus, ctx, Terminate);
258 CHECK_VTABLE(vaStatus, ctx, QueryConfigProfiles);
259 CHECK_VTABLE(vaStatus, ctx, QueryConfigEntrypoints);
260 CHECK_VTABLE(vaStatus, ctx, QueryConfigAttributes);
261 CHECK_VTABLE(vaStatus, ctx, CreateConfig);
262 CHECK_VTABLE(vaStatus, ctx, GetConfigAttributes);
263 CHECK_VTABLE(vaStatus, ctx, CreateSurfaces);
264 CHECK_VTABLE(vaStatus, ctx, DestroySurface);
265 CHECK_VTABLE(vaStatus, ctx, CreateContext);
266 CHECK_VTABLE(vaStatus, ctx, DestroyContext);
267 CHECK_VTABLE(vaStatus, ctx, CreateBuffer);
268 CHECK_VTABLE(vaStatus, ctx, BufferData);
269 CHECK_VTABLE(vaStatus, ctx, BufferSetNumElements);
270 CHECK_VTABLE(vaStatus, ctx, MapBuffer);
271 CHECK_VTABLE(vaStatus, ctx, UnmapBuffer);
272 CHECK_VTABLE(vaStatus, ctx, DestroyBuffer);
273 CHECK_VTABLE(vaStatus, ctx, BeginPicture);
274 CHECK_VTABLE(vaStatus, ctx, RenderPicture);
275 CHECK_VTABLE(vaStatus, ctx, EndPicture);
276 CHECK_VTABLE(vaStatus, ctx, SyncSurface);
277 CHECK_VTABLE(vaStatus, ctx, QuerySurfaceStatus);
278 CHECK_VTABLE(vaStatus, ctx, PutSurface);
279 CHECK_VTABLE(vaStatus, ctx, CopySurfaceToGLXPbuffer);
280 CHECK_VTABLE(vaStatus, ctx, QueryImageFormats);
281 CHECK_VTABLE(vaStatus, ctx, CreateImage);
282 CHECK_VTABLE(vaStatus, ctx, DestroyImage);
283 CHECK_VTABLE(vaStatus, ctx, GetImage);
284 CHECK_VTABLE(vaStatus, ctx, PutImage);
285 CHECK_VTABLE(vaStatus, ctx, QuerySubpictureFormats);
286 CHECK_VTABLE(vaStatus, ctx, CreateSubpicture);
287 CHECK_VTABLE(vaStatus, ctx, DestroySubpicture);
288 CHECK_VTABLE(vaStatus, ctx, SetSubpictureImage);
289 CHECK_VTABLE(vaStatus, ctx, SetSubpicturePalette);
290 CHECK_VTABLE(vaStatus, ctx, SetSubpictureChromakey);
291 CHECK_VTABLE(vaStatus, ctx, SetSubpictureGlobalAlpha);
292 CHECK_VTABLE(vaStatus, ctx, AssociateSubpicture);
293 CHECK_VTABLE(vaStatus, ctx, DbgCopySurfaceToBuffer);
295 if (VA_STATUS_SUCCESS != vaStatus)
297 va_errorMessage("%s init failed\n", driver_path);
300 if (VA_STATUS_SUCCESS == vaStatus)
302 ctx->handle = handle;
310 driver_dir = strtok_r(NULL, ":", &saveptr);
320 * Returns a short english description of error_status
322 const char *vaErrorStr(VAStatus error_status)
326 case VA_STATUS_SUCCESS:
327 return "success (no error)";
328 case VA_STATUS_ERROR_ALLOCATION_FAILED:
329 return "resource allocation failed";
330 case VA_STATUS_ERROR_INVALID_CONFIG:
331 return "invalid VAConfigID";
332 case VA_STATUS_ERROR_INVALID_CONTEXT:
333 return "invalid VAContextID";
334 case VA_STATUS_ERROR_INVALID_SURFACE:
335 return "invalid VASurfaceID";
336 case VA_STATUS_ERROR_INVALID_BUFFER:
337 return "invalid VABufferID";
338 case VA_STATUS_ERROR_ATTR_NOT_SUPPORTED:
339 return "attribute not supported";
340 case VA_STATUS_ERROR_MAX_NUM_EXCEEDED:
341 return "list argument exceeds maximum number";
342 case VA_STATUS_ERROR_UNSUPPORTED_PROFILE:
343 return "the requested VAProfile is not supported";
344 case VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT:
345 return "the requested VAEntryPoint is not supported";
346 case VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT:
347 return "the requested RT Format is not supported";
348 case VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE:
349 return "the requested VABufferType is not supported";
350 case VA_STATUS_ERROR_UNKNOWN:
351 return "unknown libva error";
353 return "unknown libva error / description missing";
356 VAStatus vaInitialize (
358 int *major_version, /* out */
359 int *minor_version /* out */
362 VADriverContextP ctx = CTX(dpy);
363 char *driver_name = NULL;
368 va_debug_trace = (getenv("LIBVA_DEBUG_TRACE") != NULL);
370 vaStatus = va_getDriverName(ctx, &driver_name);
371 va_infoMessage("va_getDriverName() returns %d\n", vaStatus);
373 if (VA_STATUS_SUCCESS == vaStatus)
375 vaStatus = va_openDriver(ctx, driver_name);
376 va_infoMessage("va_openDriver() returns %d\n", vaStatus);
378 *major_version = ctx->version_major;
379 *minor_version = ctx->version_minor;
391 * After this call, all library internal resources will be cleaned up
393 VAStatus vaTerminate (
397 VAStatus vaStatus = VA_STATUS_SUCCESS;
398 VADriverContextP old_ctx = CTX(dpy);
399 ASSERT_CONTEXT(old_ctx);
403 vaStatus = old_ctx->vtable.vaTerminate(old_ctx);
404 dlclose(old_ctx->handle);
405 old_ctx->handle = NULL;
408 if (VA_STATUS_SUCCESS == vaStatus)
410 VADriverContextP *ctx = &pDriverContexts;
412 /* Throw away old_ctx */
417 *ctx = old_ctx->pNext;
418 old_ctx->pNext = NULL;
421 ctx = &((*ctx)->pNext);
428 /* Get maximum number of profiles supported by the implementation */
429 int vaMaxNumProfiles (
433 VADriverContextP ctx = CTX(dpy);
436 return ctx->max_profiles;
439 /* Get maximum number of entrypoints supported by the implementation */
440 int vaMaxNumEntrypoints (
444 VADriverContextP ctx = CTX(dpy);
447 return ctx->max_entrypoints;
451 /* Get maximum number of attributs supported by the implementation */
452 int vaMaxNumConfigAttributes (
456 VADriverContextP ctx = CTX(dpy);
459 return ctx->max_attributes;
462 VAStatus vaQueryConfigEntrypoints (
465 VAEntrypoint *entrypoints, /* out */
466 int *num_entrypoints /* out */
469 VADriverContextP ctx = CTX(dpy);
472 TRACE(vaQueryConfigEntrypoints);
473 return ctx->vtable.vaQueryConfigEntrypoints ( ctx, profile, entrypoints, num_entrypoints);
476 VAStatus vaQueryConfigAttributes (
479 VAEntrypoint entrypoint,
480 VAConfigAttrib *attrib_list, /* in/out */
484 VADriverContextP ctx = CTX(dpy);
487 TRACE(vaQueryConfigAttributes);
488 return ctx->vtable.vaQueryConfigAttributes ( ctx, profile, entrypoint, attrib_list, num_attribs );
491 VAStatus vaQueryConfigProfiles (
493 VAProfile *profile_list, /* out */
494 int *num_profiles /* out */
497 VADriverContextP ctx = CTX(dpy);
500 TRACE(vaQueryConfigProfiles);
501 return ctx->vtable.vaQueryConfigProfiles ( ctx, profile_list, num_profiles );
504 VAStatus vaCreateConfig (
507 VAEntrypoint entrypoint,
508 VAConfigAttrib *attrib_list,
510 VAConfigID *config_id /* out */
513 VADriverContextP ctx = CTX(dpy);
516 TRACE(vaCreateConfig);
517 return ctx->vtable.vaCreateConfig ( ctx, profile, entrypoint, attrib_list, num_attribs, config_id );
520 VAStatus vaGetConfigAttributes (
522 VAConfigID config_id,
523 VAProfile *profile, /* out */
524 VAEntrypoint *entrypoint, /* out */
525 VAConfigAttrib *attrib_list,/* out */
526 int *num_attribs /* out */
529 VADriverContextP ctx = CTX(dpy);
532 TRACE(vaGetConfigAttributes);
533 return ctx->vtable.vaGetConfigAttributes( ctx, config_id, profile, entrypoint, attrib_list, num_attribs);
536 VAStatus vaCreateSurfaces (
542 VASurface *surfaces /* out */
545 VADriverContextP ctx = CTX(dpy);
548 TRACE(vaCreateSurfaces);
549 return ctx->vtable.vaCreateSurfaces( ctx, width, height, format, num_surfaces, surfaces );
552 VAStatus vaDestroySurface (
554 VASurface *surface_list,
558 VADriverContextP ctx = CTX(dpy);
561 TRACE(vaDestroySurface);
562 return ctx->vtable.vaDestroySurface( ctx, surface_list, num_surfaces );
565 VAStatus vaCreateContext (
567 VAConfigID config_id,
571 VASurface *render_targets,
572 int num_render_targets,
573 VAContext *context /* out */
576 VADriverContextP ctx = CTX(dpy);
579 TRACE(vaCreateContext);
580 return ctx->vtable.vaCreateContext( ctx, config_id, picture_width, picture_height,
581 flag, render_targets, num_render_targets, context );
584 VAStatus vaDestroyContext (
589 VADriverContextP ctx = CTX(dpy);
592 TRACE(vaDestroyContext);
593 return ctx->vtable.vaDestroyContext( ctx, context );
596 VAStatus vaCreateBuffer (
598 VABufferType type, /* in */
599 VABufferID *buf_id /* out */
602 VADriverContextP ctx = CTX(dpy);
605 TRACE(vaCreateBuffer);
606 return ctx->vtable.vaCreateBuffer( ctx, type, buf_id);
609 VAStatus vaBufferData (
611 VABufferID buf_id, /* in */
612 unsigned int size, /* in */
613 unsigned int num_elements, /* in */
617 VADriverContextP ctx = CTX(dpy);
621 return ctx->vtable.vaBufferData( ctx, buf_id, size, num_elements, data);
624 VAStatus vaBufferSetNumElements (
626 VABufferID buf_id, /* in */
627 unsigned int num_elements /* in */
630 VADriverContextP ctx = CTX(dpy);
633 TRACE(vaBufferSetNumElements);
634 return ctx->vtable.vaBufferSetNumElements( ctx, buf_id, num_elements );
638 VAStatus vaMapBuffer (
640 VABufferID buf_id, /* in */
641 void **pbuf /* out */
644 VADriverContextP ctx = CTX(dpy);
648 return ctx->vtable.vaMapBuffer( ctx, buf_id, pbuf );
651 VAStatus vaUnmapBuffer (
653 VABufferID buf_id /* in */
656 VADriverContextP ctx = CTX(dpy);
659 TRACE(vaUnmapBuffer);
660 return ctx->vtable.vaUnmapBuffer( ctx, buf_id );
663 VAStatus vaDestroyBuffer (
668 VADriverContextP ctx = CTX(dpy);
671 TRACE(vaDestroyBuffer);
672 return ctx->vtable.vaDestroyBuffer( ctx, buffer_id );
675 VAStatus vaBeginPicture (
678 VASurface *render_target
681 VADriverContextP ctx = CTX(dpy);
684 TRACE(vaBeginPicture);
685 return ctx->vtable.vaBeginPicture( ctx, context, render_target );
688 VAStatus vaRenderPicture (
695 VADriverContextP ctx = CTX(dpy);
698 TRACE(vaRenderPicture);
699 return ctx->vtable.vaRenderPicture( ctx, context, buffers, num_buffers );
702 VAStatus vaEndPicture (
707 VADriverContextP ctx = CTX(dpy);
711 return ctx->vtable.vaEndPicture( ctx, context );
714 VAStatus vaSyncSurface (
717 VASurface *render_target
720 VADriverContextP ctx = CTX(dpy);
723 TRACE(vaSyncSurface);
724 return ctx->vtable.vaSyncSurface( ctx, context, render_target );
727 VAStatus vaQuerySurfaceStatus (
730 VASurface *render_target,
731 VASurfaceStatus *status /* out */
734 VADriverContextP ctx = CTX(dpy);
737 TRACE(vaQuerySurfaceStatus);
738 return ctx->vtable.vaQuerySurfaceStatus( ctx, context, render_target, status );
741 VAStatus vaPutSurface (
744 Drawable draw, /* X Drawable */
751 unsigned short destw,
752 unsigned short desth,
753 VARectangle *cliprects, /* client supplied clip list */
754 unsigned int number_cliprects, /* number of clip rects in the clip list */
755 int flags /* de-interlacing flags */
758 VADriverContextP ctx = CTX(dpy);
762 return ctx->vtable.vaPutSurface( ctx, surface, draw, srcx, srcy, srcw, srch,
763 destx, desty, destw, desth,
764 cliprects, number_cliprects, flags );
767 VAStatus vaCopySurfaceToGLXPbuffer (
773 unsigned short width,
774 unsigned short height,
777 unsigned int draw_buffer,
778 unsigned int flags /* de-interlacing flags */
781 VADriverContextP ctx = CTX(dpy);
784 TRACE(vaCopySurfaceToGLXPbuffer);
785 return ctx->vtable.vaCopySurfaceToGLXPbuffer( ctx, surface, pbuffer_id,
786 srcx,srcy,width, height,destx,desty,
787 draw_buffer, flags );
790 /* Get maximum number of image formats supported by the implementation */
791 int vaMaxNumImageFormats (
795 VADriverContextP ctx = CTX(dpy);
798 return ctx->max_image_formats;
801 VAStatus vaQueryImageFormats (
803 VAImageFormat *format_list, /* out */
804 int *num_formats /* out */
807 VADriverContextP ctx = CTX(dpy);
810 TRACE(vaQueryImageFormats);
811 return ctx->vtable.vaQueryImageFormats ( ctx, format_list, num_formats);
815 * The width and height fields returned in the VAImage structure may get
816 * enlarged for some YUV formats. The size of the data buffer that needs
817 * to be allocated will be given in the "data_size" field in VAImage.
818 * Image data is not allocated by this function. The client should
819 * allocate the memory and fill in the VAImage structure's data field
820 * after looking at "data_size" returned from the library.
822 VAStatus vaCreateImage (
824 VAImageFormat *format,
827 VAImage *image /* out */
830 VADriverContextP ctx = CTX(dpy);
833 TRACE(vaCreateImage);
834 return ctx->vtable.vaCreateImage ( ctx, format, width, height, image);
838 * Should call DestroyImage before destroying the surface it is bound to
840 VAStatus vaDestroyImage (
845 VADriverContextP ctx = CTX(dpy);
848 TRACE(vaDestroyImage);
849 return ctx->vtable.vaDestroyImage ( ctx, image);
853 * Retrieve surface data into a VAImage
854 * Image must be in a format supported by the implementation
856 VAStatus vaGetImage (
859 int x, /* coordinates of the upper left source pixel */
861 unsigned int width, /* width and height of the region */
866 VADriverContextP ctx = CTX(dpy);
870 return ctx->vtable.vaGetImage ( ctx, surface, x, y, width, height, image);
874 * Copy data from a VAImage to a surface
875 * Image must be in a format supported by the implementation
877 VAStatus vaPutImage (
889 VADriverContextP ctx = CTX(dpy);
893 return ctx->vtable.vaPutImage ( ctx, surface, image, src_x, src_y, width, height, dest_x, dest_y );
896 /* Get maximum number of subpicture formats supported by the implementation */
897 int vaMaxNumSubpictureFormats (
901 VADriverContextP ctx = CTX(dpy);
904 return ctx->max_subpic_formats;
908 * Query supported subpicture formats
909 * The caller must provide a "format_list" array that can hold at
910 * least vaMaxNumSubpictureFormats() entries. The flags arrary holds the flag
911 * for each format to indicate additional capabilities for that format. The actual
912 * number of formats returned in "format_list" is returned in "num_formats".
914 VAStatus vaQuerySubpictureFormats (
916 VAImageFormat *format_list, /* out */
917 unsigned int *flags, /* out */
918 unsigned int *num_formats /* out */
921 VADriverContextP ctx = CTX(dpy);
924 TRACE(vaQuerySubpictureFormats);
925 return ctx->vtable.vaQuerySubpictureFormats ( ctx, format_list, flags, num_formats);
929 * Subpictures are created with an image associated.
931 VAStatus vaCreateSubpicture (
934 VASubpicture *subpicture /* out */
937 VADriverContextP ctx = CTX(dpy);
940 TRACE(vaCreateSubpicture);
941 return ctx->vtable.vaCreateSubpicture ( ctx, image, subpicture );
945 * Destroy the subpicture before destroying the image it is assocated to
947 VAStatus vaDestroySubpicture (
949 VASubpicture *subpicture
952 VADriverContextP ctx = CTX(dpy);
955 TRACE(vaDestroySubpicture);
956 return ctx->vtable.vaDestroySubpicture ( ctx, subpicture);
959 VAStatus vaSetSubpictureImage (
961 VASubpicture *subpicture,
965 VADriverContextP ctx = CTX(dpy);
968 TRACE(vaSetSubpictureImage);
969 return ctx->vtable.vaSetSubpictureImage ( ctx, subpicture, image);
973 VAStatus vaSetSubpicturePalette (
975 VASubpicture *subpicture,
977 * pointer to an array holding the palette data. The size of the array is
978 * num_palette_entries * entry_bytes in size. The order of the components
979 * in the palette is described by the component_order in VASubpicture struct
981 unsigned char *palette
984 VADriverContextP ctx = CTX(dpy);
987 TRACE(vaSetSubpicturePalette);
988 return ctx->vtable.vaSetSubpicturePalette ( ctx, subpicture, palette);
992 * If chromakey is enabled, then the area where the source value falls within
993 * the chromakey [min, max] range is transparent
995 VAStatus vaSetSubpictureChromakey (
997 VASubpicture *subpicture,
998 unsigned int chromakey_min,
999 unsigned int chromakey_max
1002 VADriverContextP ctx = CTX(dpy);
1003 ASSERT_CONTEXT(ctx);
1005 TRACE(vaSetSubpictureChromakey);
1006 return ctx->vtable.vaSetSubpictureChromakey ( ctx, subpicture, chromakey_min, chromakey_max );
1011 * Global alpha value is between 0 and 1. A value of 1 means fully opaque and
1012 * a value of 0 means fully transparent. If per-pixel alpha is also specified then
1013 * the overall alpha is per-pixel alpha multiplied by the global alpha
1015 VAStatus vaSetSubpictureGlobalAlpha (
1017 VASubpicture *subpicture,
1021 VADriverContextP ctx = CTX(dpy);
1022 ASSERT_CONTEXT(ctx);
1024 TRACE(vaSetSubpictureGlobalAlpha);
1025 return ctx->vtable.vaSetSubpictureGlobalAlpha ( ctx, subpicture, global_alpha );
1029 vaAssociateSubpicture associates the subpicture with the target_surface.
1030 It defines the region mapping between the subpicture and the target
1031 surface through source and destination rectangles (with the same width and height).
1032 Both will be displayed at the next call to vaPutSurface. Additional
1033 associations before the call to vaPutSurface simply overrides the association.
1035 VAStatus vaAssociateSubpicture (
1037 VASurface *target_surface,
1038 VASubpicture *subpicture,
1039 short src_x, /* upper left offset in subpicture */
1041 short dest_x, /* upper left offset in surface */
1043 unsigned short width,
1044 unsigned short height,
1046 * whether to enable chroma-keying or global-alpha
1047 * see VA_SUBPICTURE_XXX values
1052 VADriverContextP ctx = CTX(dpy);
1053 ASSERT_CONTEXT(ctx);
1055 TRACE(vaAssociateSubpicture);
1056 return ctx->vtable.vaAssociateSubpicture ( ctx, target_surface, subpicture, src_x, src_y, dest_x, dest_y, width, height, flags );
1060 VAStatus vaDbgCopySurfaceToBuffer(VADisplay dpy,
1062 void **buffer, /* out */
1063 unsigned int *stride /* out */
1066 VADriverContextP ctx = CTX(dpy);
1067 ASSERT_CONTEXT(ctx);
1069 TRACE(vaDbgCopySurfaceToBuffer);
1070 return ctx->vtable.vaDbgCopySurfaceToBuffer( ctx, surface, buffer, stride );