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.
28 #include "va_backend.h"
29 #include "va_backend_vpp.h"
41 #include <cutils/log.h>
42 /* support versions < JellyBean */
51 #define DRIVER_EXTENSION "_drv_video.so"
53 #define CTX(dpy) (((VADisplayContextP)dpy)->pDriverContext)
54 #define CHECK_DISPLAY(dpy) if( !vaDisplayIsValid(dpy) ) { return VA_STATUS_ERROR_INVALID_DISPLAY; }
57 #define CHECK_VTABLE(s, ctx, func) if (!va_checkVtable(ctx->vtable->va##func, #func)) s = VA_STATUS_ERROR_UNKNOWN;
58 #define CHECK_MAXIMUM(s, ctx, var) if (!va_checkMaximum(ctx->max_##var, #var)) s = VA_STATUS_ERROR_UNKNOWN;
59 #define CHECK_STRING(s, ctx, var) if (!va_checkString(ctx->str_##var, #var)) s = VA_STATUS_ERROR_UNKNOWN;
62 * read a config "env" for libva.conf or from environment setting
63 * libva.conf has higher priority
64 * return 0: the "env" is set, and the value is copied into env_value
65 * 1: the env is not set
67 int va_parseConfig(char *env, char *env_value)
69 char *token, *value, *saveptr;
76 fp = fopen("/etc/libva.conf", "r");
77 while (fp && (fgets(oneline, 1024, fp) != NULL)) {
78 if (strlen(oneline) == 1)
80 token = strtok_r(oneline, "=\n", &saveptr);
81 value = strtok_r(NULL, "=\n", &saveptr);
83 if (NULL == token || NULL == value)
86 if (strcmp(token, env) == 0) {
88 strncpy(env_value,value, 1024);
89 env_value[1023] = '\0';
100 /* no setting in config file, use env setting */
104 strncpy(env_value, value, 1024);
105 env_value[1023] = '\0';
113 int vaDisplayIsValid(VADisplay dpy)
115 VADisplayContextP pDisplayContext = (VADisplayContextP)dpy;
116 return pDisplayContext && (pDisplayContext->vadpy_magic == VA_DISPLAY_MAGIC) && pDisplayContext->vaIsValid(pDisplayContext);
119 static void default_log_error(const char *buffer)
124 fprintf(stderr, "libva error: %s", buffer);
128 static void default_log_info(const char *buffer)
133 fprintf(stderr, "libva info: %s", buffer);
137 static vaMessageCallback va_log_error = default_log_error;
138 static vaMessageCallback va_log_info = default_log_info;
141 * Set the callback for error messages, or NULL for no logging.
142 * Returns the previous one, or NULL if it was disabled.
144 vaMessageCallback vaSetErrorCallback(vaMessageCallback callback)
146 vaMessageCallback old_callback = va_log_error;
147 va_log_error = callback;
152 * Set the callback for info messages, or NULL for no logging.
153 * Returns the previous one, or NULL if it was disabled.
155 vaMessageCallback vaSetInfoCallback(vaMessageCallback callback)
157 vaMessageCallback old_callback = va_log_info;
158 va_log_info = callback;
162 void va_errorMessage(const char *msg, ...)
164 #if ENABLE_VA_MESSAGING
165 char buf[512], *dynbuf;
169 if (va_log_error == NULL)
173 len = vsnprintf(buf, sizeof(buf), msg, args);
176 if (len >= (int)sizeof(buf)) {
177 dynbuf = malloc(len + 1);
181 n = vsnprintf(dynbuf, len + 1, msg, args);
184 va_log_error(dynbuf);
192 void va_infoMessage(const char *msg, ...)
194 #if ENABLE_VA_MESSAGING
195 char buf[512], *dynbuf;
199 if (va_log_info == NULL)
203 len = vsnprintf(buf, sizeof(buf), msg, args);
206 if (len >= (int)sizeof(buf)) {
207 dynbuf = malloc(len + 1);
211 n = vsnprintf(dynbuf, len + 1, msg, args);
222 static bool va_checkVtable(void *ptr, char *function)
225 va_errorMessage("No valid vtable entry for va%s\n", function);
231 static bool va_checkMaximum(int value, char *variable)
234 va_errorMessage("Failed to define max_%s in init\n", variable);
240 static bool va_checkString(const char* value, char *variable)
243 va_errorMessage("Failed to define str_%s in init\n", variable);
250 va_getDriverInitName(char *name, int namelen, int major, int minor)
252 int ret = snprintf(name, namelen, "__vaDriverInit_%d_%d", major, minor);
253 return ret > 0 && ret < namelen;
256 static VAStatus va_getDriverName(VADisplay dpy, char **driver_name)
258 VADisplayContextP pDisplayContext = (VADisplayContextP)dpy;
260 return pDisplayContext->vaGetDriverName(pDisplayContext, driver_name);
263 static VAStatus va_openDriver(VADisplay dpy, char *driver_name)
265 VADriverContextP ctx = CTX(dpy);
266 VAStatus vaStatus = VA_STATUS_ERROR_UNKNOWN;
267 char *search_path = NULL;
271 if (geteuid() == getuid())
272 /* don't allow setuid apps to use LIBVA_DRIVERS_PATH */
273 search_path = getenv("LIBVA_DRIVERS_PATH");
275 search_path = VA_DRIVERS_PATH;
277 search_path = strdup((const char *)search_path);
278 driver_dir = strtok_r(search_path, ":", &saveptr);
281 char *driver_path = (char *) malloc( strlen(driver_dir) +
282 strlen(driver_name) +
283 strlen(DRIVER_EXTENSION) + 2 );
285 va_errorMessage("%s L%d Out of memory!n",
286 __FUNCTION__, __LINE__);
288 return VA_STATUS_ERROR_ALLOCATION_FAILED;
291 strncpy( driver_path, driver_dir, strlen(driver_dir) + 1);
292 strncat( driver_path, "/", strlen("/") );
293 strncat( driver_path, driver_name, strlen(driver_name) );
294 strncat( driver_path, DRIVER_EXTENSION, strlen(DRIVER_EXTENSION) );
296 va_infoMessage("Trying to open %s\n", driver_path);
298 handle = dlopen( driver_path, RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE );
300 handle = dlopen( driver_path, RTLD_NOW| RTLD_GLOBAL);
303 /* Don't give errors for non-existing files */
304 if (0 == access( driver_path, F_OK))
305 va_errorMessage("dlopen of %s failed: %s\n", driver_path, dlerror());
307 VADriverInit init_func = NULL;
308 char init_func_s[256];
311 static const struct {
314 } compatible_versions[] = {
315 { VA_MAJOR_VERSION, VA_MINOR_VERSION },
327 for (i = 0; compatible_versions[i].major >= 0; i++) {
328 if (va_getDriverInitName(init_func_s, sizeof(init_func_s),
329 compatible_versions[i].major,
330 compatible_versions[i].minor)) {
331 init_func = (VADriverInit)dlsym(handle, init_func_s);
333 va_infoMessage("Found init function %s\n", init_func_s);
339 if (compatible_versions[i].major < 0) {
340 va_errorMessage("%s has no function %s\n",
341 driver_path, init_func_s);
344 struct VADriverVTable *vtable = ctx->vtable;
345 struct VADriverVTableVPP *vtable_vpp = ctx->vtable_vpp;
347 vaStatus = VA_STATUS_SUCCESS;
349 vtable = calloc(1, sizeof(*vtable));
351 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
353 ctx->vtable = vtable;
356 vtable_vpp = calloc(1, sizeof(*vtable_vpp));
358 vtable_vpp->version = VA_DRIVER_VTABLE_VPP_VERSION;
360 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
362 ctx->vtable_vpp = vtable_vpp;
364 if (init_func && VA_STATUS_SUCCESS == vaStatus)
365 vaStatus = (*init_func)(ctx);
367 if (VA_STATUS_SUCCESS == vaStatus) {
368 CHECK_MAXIMUM(vaStatus, ctx, profiles);
369 CHECK_MAXIMUM(vaStatus, ctx, entrypoints);
370 CHECK_MAXIMUM(vaStatus, ctx, attributes);
371 CHECK_MAXIMUM(vaStatus, ctx, image_formats);
372 CHECK_MAXIMUM(vaStatus, ctx, subpic_formats);
373 CHECK_MAXIMUM(vaStatus, ctx, display_attributes);
374 CHECK_STRING(vaStatus, ctx, vendor);
375 CHECK_VTABLE(vaStatus, ctx, Terminate);
376 CHECK_VTABLE(vaStatus, ctx, QueryConfigProfiles);
377 CHECK_VTABLE(vaStatus, ctx, QueryConfigEntrypoints);
378 CHECK_VTABLE(vaStatus, ctx, QueryConfigAttributes);
379 CHECK_VTABLE(vaStatus, ctx, CreateConfig);
380 CHECK_VTABLE(vaStatus, ctx, DestroyConfig);
381 CHECK_VTABLE(vaStatus, ctx, GetConfigAttributes);
382 CHECK_VTABLE(vaStatus, ctx, CreateSurfaces);
383 CHECK_VTABLE(vaStatus, ctx, DestroySurfaces);
384 CHECK_VTABLE(vaStatus, ctx, CreateContext);
385 CHECK_VTABLE(vaStatus, ctx, DestroyContext);
386 CHECK_VTABLE(vaStatus, ctx, CreateBuffer);
387 CHECK_VTABLE(vaStatus, ctx, BufferSetNumElements);
388 CHECK_VTABLE(vaStatus, ctx, MapBuffer);
389 CHECK_VTABLE(vaStatus, ctx, UnmapBuffer);
390 CHECK_VTABLE(vaStatus, ctx, DestroyBuffer);
391 CHECK_VTABLE(vaStatus, ctx, BeginPicture);
392 CHECK_VTABLE(vaStatus, ctx, RenderPicture);
393 CHECK_VTABLE(vaStatus, ctx, EndPicture);
394 CHECK_VTABLE(vaStatus, ctx, SyncSurface);
395 CHECK_VTABLE(vaStatus, ctx, QuerySurfaceStatus);
396 CHECK_VTABLE(vaStatus, ctx, PutSurface);
397 CHECK_VTABLE(vaStatus, ctx, QueryImageFormats);
398 CHECK_VTABLE(vaStatus, ctx, CreateImage);
399 CHECK_VTABLE(vaStatus, ctx, DeriveImage);
400 CHECK_VTABLE(vaStatus, ctx, DestroyImage);
401 CHECK_VTABLE(vaStatus, ctx, SetImagePalette);
402 CHECK_VTABLE(vaStatus, ctx, GetImage);
403 CHECK_VTABLE(vaStatus, ctx, PutImage);
404 CHECK_VTABLE(vaStatus, ctx, QuerySubpictureFormats);
405 CHECK_VTABLE(vaStatus, ctx, CreateSubpicture);
406 CHECK_VTABLE(vaStatus, ctx, DestroySubpicture);
407 CHECK_VTABLE(vaStatus, ctx, SetSubpictureImage);
408 CHECK_VTABLE(vaStatus, ctx, SetSubpictureChromakey);
409 CHECK_VTABLE(vaStatus, ctx, SetSubpictureGlobalAlpha);
410 CHECK_VTABLE(vaStatus, ctx, AssociateSubpicture);
411 CHECK_VTABLE(vaStatus, ctx, DeassociateSubpicture);
412 CHECK_VTABLE(vaStatus, ctx, QueryDisplayAttributes);
413 CHECK_VTABLE(vaStatus, ctx, GetDisplayAttributes);
414 CHECK_VTABLE(vaStatus, ctx, SetDisplayAttributes);
416 if (VA_STATUS_SUCCESS != vaStatus) {
417 va_errorMessage("%s init failed\n", driver_path);
420 if (VA_STATUS_SUCCESS == vaStatus)
421 ctx->handle = handle;
428 driver_dir = strtok_r(NULL, ":", &saveptr);
436 VAPrivFunc vaGetLibFunc(VADisplay dpy, const char *func)
438 VADriverContextP ctx;
439 if (!vaDisplayIsValid(dpy))
443 if (NULL == ctx->handle)
446 return (VAPrivFunc) dlsym(ctx->handle, func);
451 * Returns a short english description of error_status
453 const char *vaErrorStr(VAStatus error_status)
455 switch(error_status) {
456 case VA_STATUS_SUCCESS:
457 return "success (no error)";
458 case VA_STATUS_ERROR_OPERATION_FAILED:
459 return "operation failed";
460 case VA_STATUS_ERROR_ALLOCATION_FAILED:
461 return "resource allocation failed";
462 case VA_STATUS_ERROR_INVALID_DISPLAY:
463 return "invalid VADisplay";
464 case VA_STATUS_ERROR_INVALID_CONFIG:
465 return "invalid VAConfigID";
466 case VA_STATUS_ERROR_INVALID_CONTEXT:
467 return "invalid VAContextID";
468 case VA_STATUS_ERROR_INVALID_SURFACE:
469 return "invalid VASurfaceID";
470 case VA_STATUS_ERROR_INVALID_BUFFER:
471 return "invalid VABufferID";
472 case VA_STATUS_ERROR_INVALID_IMAGE:
473 return "invalid VAImageID";
474 case VA_STATUS_ERROR_INVALID_SUBPICTURE:
475 return "invalid VASubpictureID";
476 case VA_STATUS_ERROR_ATTR_NOT_SUPPORTED:
477 return "attribute not supported";
478 case VA_STATUS_ERROR_MAX_NUM_EXCEEDED:
479 return "list argument exceeds maximum number";
480 case VA_STATUS_ERROR_UNSUPPORTED_PROFILE:
481 return "the requested VAProfile is not supported";
482 case VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT:
483 return "the requested VAEntryPoint is not supported";
484 case VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT:
485 return "the requested RT Format is not supported";
486 case VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE:
487 return "the requested VABufferType is not supported";
488 case VA_STATUS_ERROR_SURFACE_BUSY:
489 return "surface is in use";
490 case VA_STATUS_ERROR_FLAG_NOT_SUPPORTED:
491 return "flag not supported";
492 case VA_STATUS_ERROR_INVALID_PARAMETER:
493 return "invalid parameter";
494 case VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED:
495 return "resolution not supported";
496 case VA_STATUS_ERROR_UNIMPLEMENTED:
497 return "the requested function is not implemented";
498 case VA_STATUS_ERROR_SURFACE_IN_DISPLAYING:
499 return "surface is in displaying (may by overlay)" ;
500 case VA_STATUS_ERROR_INVALID_IMAGE_FORMAT:
501 return "invalid VAImageFormat";
502 case VA_STATUS_ERROR_INVALID_VALUE:
503 return "an invalid/unsupported value was supplied";
504 case VA_STATUS_ERROR_UNSUPPORTED_FILTER:
505 return "the requested filter is not supported";
506 case VA_STATUS_ERROR_INVALID_FILTER_CHAIN:
507 return "an invalid filter chain was supplied";
508 case VA_STATUS_ERROR_UNKNOWN:
509 return "unknown libva error";
511 return "unknown libva error / description missing";
514 const static char *prefer_driver_list[4] = {
521 VAStatus vaSetDriverName(
526 VADriverContextP ctx;
527 VAStatus vaStatus = VA_STATUS_SUCCESS;
528 char *override_driver_name = NULL;
532 if (geteuid() != getuid()) {
533 vaStatus = VA_STATUS_ERROR_OPERATION_FAILED;
534 va_errorMessage("no permission to vaSetDriverName\n");
538 if (strlen(driver_name) == 0 || strlen(driver_name) >=256) {
539 vaStatus = VA_STATUS_ERROR_INVALID_PARAMETER;
540 va_errorMessage("vaSetDriverName returns %s\n",
541 vaErrorStr(vaStatus));
546 for (i = 0; i < sizeof(prefer_driver_list) / sizeof(char *); i++) {
547 if (strlen(prefer_driver_list[i]) != strlen(driver_name))
549 if (!strncmp(prefer_driver_list[i], driver_name, strlen(driver_name))) {
556 vaStatus = VA_STATUS_ERROR_INVALID_PARAMETER;
557 va_errorMessage("vaSetDriverName returns %s. Incorrect parameter\n",
558 vaErrorStr(vaStatus));
562 override_driver_name = strdup(driver_name);
564 if (!override_driver_name) {
565 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
566 va_errorMessage("vaSetDriverName returns %s. Out of Memory\n",
567 vaErrorStr(vaStatus));
571 ctx->override_driver_name = override_driver_name;
572 return VA_STATUS_SUCCESS;
575 VAStatus vaInitialize (
577 int *major_version, /* out */
578 int *minor_version /* out */
581 const char *driver_name_env = NULL;
582 char *driver_name = NULL;
584 VADriverContextP ctx;
594 va_infoMessage("VA-API version %s\n", VA_VERSION_S);
596 vaStatus = va_getDriverName(dpy, &driver_name);
598 if (!ctx->override_driver_name) {
599 va_infoMessage("va_getDriverName() returns %d\n", vaStatus);
601 driver_name_env = getenv("LIBVA_DRIVER_NAME");
602 } else if (vaStatus == VA_STATUS_SUCCESS) {
606 driver_name = strdup(ctx->override_driver_name);
608 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
609 va_errorMessage("vaInitialize() failed with %s, out of memory\n",
610 vaErrorStr(vaStatus));
613 va_infoMessage("User requested driver '%s'\n", driver_name);
616 if (driver_name_env && (geteuid() == getuid())) {
617 /* Don't allow setuid apps to use LIBVA_DRIVER_NAME */
618 if (driver_name) /* memory is allocated in va_getDriverName */
621 driver_name = strdup(driver_name_env);
622 vaStatus = VA_STATUS_SUCCESS;
623 va_infoMessage("User requested driver '%s'\n", driver_name);
626 if ((VA_STATUS_SUCCESS == vaStatus) && (driver_name != NULL)) {
627 vaStatus = va_openDriver(dpy, driver_name);
628 va_infoMessage("va_openDriver() returns %d\n", vaStatus);
630 *major_version = VA_MAJOR_VERSION;
631 *minor_version = VA_MINOR_VERSION;
633 va_errorMessage("va_getDriverName() failed with %s,driver_name=%s\n",
634 vaErrorStr(vaStatus), driver_name);
639 VA_TRACE_LOG(va_TraceInitialize, dpy, major_version, minor_version);
646 * After this call, all library internal resources will be cleaned up
648 VAStatus vaTerminate (
652 VAStatus vaStatus = VA_STATUS_SUCCESS;
653 VADisplayContextP pDisplayContext = (VADisplayContextP)dpy;
654 VADriverContextP old_ctx;
659 if (old_ctx->handle) {
660 vaStatus = old_ctx->vtable->vaTerminate(old_ctx);
661 dlclose(old_ctx->handle);
662 old_ctx->handle = NULL;
664 free(old_ctx->vtable);
665 old_ctx->vtable = NULL;
666 free(old_ctx->vtable_vpp);
667 old_ctx->vtable_vpp = NULL;
669 if (old_ctx->override_driver_name) {
670 free(old_ctx->override_driver_name);
671 old_ctx->override_driver_name = NULL;
674 VA_TRACE_LOG(va_TraceTerminate, dpy);
680 if (VA_STATUS_SUCCESS == vaStatus)
681 pDisplayContext->vaDestroy(pDisplayContext);
687 * vaQueryVendorString returns a pointer to a zero-terminated string
688 * describing some aspects of the VA implemenation on a specific
689 * hardware accelerator. The format of the returned string is:
690 * <vendorname>-<major_version>-<minor_version>-<addtional_info>
691 * e.g. for the Intel GMA500 implementation, an example would be:
692 * "IntelGMA500-1.0-0.2-patch3
694 const char *vaQueryVendorString (
698 if (!vaDisplayIsValid(dpy))
701 return CTX(dpy)->str_vendor;
705 /* Get maximum number of profiles supported by the implementation */
706 int vaMaxNumProfiles (
710 if (!vaDisplayIsValid(dpy))
713 return CTX(dpy)->max_profiles;
716 /* Get maximum number of entrypoints supported by the implementation */
717 int vaMaxNumEntrypoints (
721 if (!vaDisplayIsValid(dpy))
724 return CTX(dpy)->max_entrypoints;
728 /* Get maximum number of attributs supported by the implementation */
729 int vaMaxNumConfigAttributes (
733 if (!vaDisplayIsValid(dpy))
736 return CTX(dpy)->max_attributes;
739 VAStatus vaQueryConfigEntrypoints (
742 VAEntrypoint *entrypoints, /* out */
743 int *num_entrypoints /* out */
746 VADriverContextP ctx;
750 return ctx->vtable->vaQueryConfigEntrypoints ( ctx, profile, entrypoints, num_entrypoints);
753 VAStatus vaGetConfigAttributes (
756 VAEntrypoint entrypoint,
757 VAConfigAttrib *attrib_list, /* in/out */
761 VADriverContextP ctx;
765 return ctx->vtable->vaGetConfigAttributes ( ctx, profile, entrypoint, attrib_list, num_attribs );
768 VAStatus vaQueryConfigProfiles (
770 VAProfile *profile_list, /* out */
771 int *num_profiles /* out */
774 VADriverContextP ctx;
778 return ctx->vtable->vaQueryConfigProfiles ( ctx, profile_list, num_profiles );
781 VAStatus vaCreateConfig (
784 VAEntrypoint entrypoint,
785 VAConfigAttrib *attrib_list,
787 VAConfigID *config_id /* out */
790 VADriverContextP ctx;
791 VAStatus vaStatus = VA_STATUS_SUCCESS;
796 vaStatus = ctx->vtable->vaCreateConfig ( ctx, profile, entrypoint, attrib_list, num_attribs, config_id );
798 /* record the current entrypoint for further trace/fool determination */
799 VA_TRACE_ALL(va_TraceCreateConfig, dpy, profile, entrypoint, attrib_list, num_attribs, config_id);
800 VA_FOOL_FUNC(va_FoolCreateConfig, dpy, profile, entrypoint, attrib_list, num_attribs, config_id);
805 VAStatus vaDestroyConfig (
810 VADriverContextP ctx;
811 VAStatus vaStatus = VA_STATUS_SUCCESS;
816 vaStatus = ctx->vtable->vaDestroyConfig ( ctx, config_id );
818 VA_TRACE_ALL(va_TraceDestroyConfig, dpy, config_id);
823 VAStatus vaQueryConfigAttributes (
825 VAConfigID config_id,
826 VAProfile *profile, /* out */
827 VAEntrypoint *entrypoint, /* out */
828 VAConfigAttrib *attrib_list,/* out */
829 int *num_attribs /* out */
832 VADriverContextP ctx;
836 return ctx->vtable->vaQueryConfigAttributes( ctx, config_id, profile, entrypoint, attrib_list, num_attribs);
839 /* XXX: this is a slow implementation that will be removed */
841 va_impl_query_surface_attributes(
842 VADriverContextP ctx,
844 VASurfaceAttrib *out_attribs,
845 unsigned int *out_num_attribs_ptr
848 VASurfaceAttrib *attribs = NULL;
849 unsigned int num_attribs, n;
850 VASurfaceAttrib *out_attrib;
851 unsigned int out_num_attribs;
852 VAImageFormat *image_formats = NULL;
853 int num_image_formats, i;
856 /* List of surface attributes to query */
857 struct va_surface_attrib_map {
858 VASurfaceAttribType type;
859 VAGenericValueType value_type;
861 static const struct va_surface_attrib_map attribs_map[] = {
862 { VASurfaceAttribMinWidth, VAGenericValueTypeInteger },
863 { VASurfaceAttribMaxWidth, VAGenericValueTypeInteger },
864 { VASurfaceAttribMinHeight, VAGenericValueTypeInteger },
865 { VASurfaceAttribMaxHeight, VAGenericValueTypeInteger },
866 { VASurfaceAttribMemoryType, VAGenericValueTypeInteger },
867 { VASurfaceAttribNone, }
870 if (!out_attribs || !out_num_attribs_ptr)
871 return VA_STATUS_ERROR_INVALID_PARAMETER;
872 if (!ctx->vtable->vaGetSurfaceAttributes)
873 return VA_STATUS_ERROR_UNIMPLEMENTED;
875 num_image_formats = ctx->max_image_formats;
876 image_formats = malloc(num_image_formats * sizeof(*image_formats));
877 if (!image_formats) {
878 va_status = VA_STATUS_ERROR_ALLOCATION_FAILED;
882 va_status = ctx->vtable->vaQueryImageFormats(
883 ctx, image_formats, &num_image_formats);
884 if (va_status != VA_STATUS_SUCCESS)
887 num_attribs = VASurfaceAttribCount + num_image_formats;
888 attribs = malloc(num_attribs * sizeof(*attribs));
890 va_status = VA_STATUS_ERROR_ALLOCATION_FAILED;
894 /* Initialize with base surface attributes, except pixel-formats */
895 for (n = 0; attribs_map[n].type != VASurfaceAttribNone; n++) {
896 VASurfaceAttrib * const attrib = &attribs[n];
897 attrib->type = attribs_map[n].type;
898 attrib->flags = VA_SURFACE_ATTRIB_GETTABLE;
899 attrib->value.type = attribs_map[n].value_type;
902 /* Append image formats */
903 for (i = 0; i < num_image_formats; i++) {
904 VASurfaceAttrib * const attrib = &attribs[n];
905 attrib->type = VASurfaceAttribPixelFormat;
906 attrib->flags = VA_SURFACE_ATTRIB_GETTABLE|VA_SURFACE_ATTRIB_SETTABLE;
907 attrib->value.type = VAGenericValueTypeInteger;
908 attrib->value.value.i = image_formats[i].fourcc;
909 if (++n == num_attribs) {
910 va_status = VA_STATUS_ERROR_ALLOCATION_FAILED;
916 va_status = ctx->vtable->vaGetSurfaceAttributes(
917 ctx, config, attribs, num_attribs);
918 if (va_status != VA_STATUS_SUCCESS)
921 /* Remove invalid entries */
923 for (n = 0; n < num_attribs; n++) {
924 VASurfaceAttrib * const attrib = &attribs[n];
926 if (attrib->flags == VA_SURFACE_ATTRIB_NOT_SUPPORTED)
929 // Accept all surface attributes that are not pixel-formats
930 if (attrib->type != VASurfaceAttribPixelFormat) {
935 // Drop invalid pixel-format attribute
936 if (!attrib->value.value.i) {
937 attrib->flags = VA_SURFACE_ATTRIB_NOT_SUPPORTED;
941 // Check for duplicates
942 int is_duplicate = 0;
943 for (i = n - 1; i >= 0 && !is_duplicate; i--) {
944 const VASurfaceAttrib * const prev_attrib = &attribs[i];
945 if (prev_attrib->type != VASurfaceAttribPixelFormat)
947 is_duplicate = prev_attrib->value.value.i == attrib->value.value.i;
950 attrib->flags = VA_SURFACE_ATTRIB_NOT_SUPPORTED;
955 if (*out_num_attribs_ptr < out_num_attribs) {
956 *out_num_attribs_ptr = out_num_attribs;
957 va_status = VA_STATUS_ERROR_MAX_NUM_EXCEEDED;
961 out_attrib = out_attribs;
962 for (n = 0; n < num_attribs; n++) {
963 const VASurfaceAttrib * const attrib = &attribs[n];
964 if (attrib->flags == VA_SURFACE_ATTRIB_NOT_SUPPORTED)
966 *out_attrib++ = *attrib;
976 vaQuerySurfaceAttributes(
979 VASurfaceAttrib *attrib_list,
980 unsigned int *num_attribs
983 VADriverContextP ctx;
989 return VA_STATUS_ERROR_INVALID_DISPLAY;
991 if (!ctx->vtable->vaQuerySurfaceAttributes)
992 vaStatus = va_impl_query_surface_attributes(ctx, config,
993 attrib_list, num_attribs);
995 vaStatus = ctx->vtable->vaQuerySurfaceAttributes(ctx, config,
996 attrib_list, num_attribs);
998 VA_TRACE_LOG(va_TraceQuerySurfaceAttributes, dpy, config, attrib_list, num_attribs);
1006 unsigned int format,
1008 unsigned int height,
1009 VASurfaceID *surfaces,
1010 unsigned int num_surfaces,
1011 VASurfaceAttrib *attrib_list,
1012 unsigned int num_attribs
1015 VADriverContextP ctx;
1021 return VA_STATUS_ERROR_INVALID_DISPLAY;
1023 if (ctx->vtable->vaCreateSurfaces2)
1024 vaStatus = ctx->vtable->vaCreateSurfaces2(ctx, format, width, height,
1025 surfaces, num_surfaces,
1026 attrib_list, num_attribs);
1027 else if (attrib_list && num_attribs > 0)
1028 vaStatus = VA_STATUS_ERROR_ATTR_NOT_SUPPORTED;
1030 vaStatus = ctx->vtable->vaCreateSurfaces(ctx, width, height, format,
1031 num_surfaces, surfaces);
1032 VA_TRACE_LOG(va_TraceCreateSurfaces,
1033 dpy, width, height, format, num_surfaces, surfaces,
1034 attrib_list, num_attribs);
1040 VAStatus vaDestroySurfaces (
1042 VASurfaceID *surface_list,
1046 VADriverContextP ctx;
1052 VA_TRACE_LOG(va_TraceDestroySurfaces,
1053 dpy, surface_list, num_surfaces);
1055 vaStatus = ctx->vtable->vaDestroySurfaces( ctx, surface_list, num_surfaces );
1060 VAStatus vaCreateContext (
1062 VAConfigID config_id,
1066 VASurfaceID *render_targets,
1067 int num_render_targets,
1068 VAContextID *context /* out */
1071 VADriverContextP ctx;
1077 vaStatus = ctx->vtable->vaCreateContext( ctx, config_id, picture_width, picture_height,
1078 flag, render_targets, num_render_targets, context );
1080 /* keep current encode/decode resoluton */
1081 VA_TRACE_ALL(va_TraceCreateContext, dpy, config_id, picture_width, picture_height, flag, render_targets, num_render_targets, context);
1086 VAStatus vaDestroyContext (
1091 VADriverContextP ctx;
1097 vaStatus = ctx->vtable->vaDestroyContext( ctx, context );
1099 VA_TRACE_ALL(va_TraceDestroyContext, dpy, context);
1104 VAStatus vaCreateBuffer (
1106 VAContextID context, /* in */
1107 VABufferType type, /* in */
1108 unsigned int size, /* in */
1109 unsigned int num_elements, /* in */
1110 void *data, /* in */
1111 VABufferID *buf_id /* out */
1114 VADriverContextP ctx;
1120 VA_FOOL_FUNC(va_FoolCreateBuffer, dpy, context, type, size, num_elements, data, buf_id);
1122 vaStatus = ctx->vtable->vaCreateBuffer( ctx, context, type, size, num_elements, data, buf_id);
1124 VA_TRACE_LOG(va_TraceCreateBuffer,
1125 dpy, context, type, size, num_elements, data, buf_id);
1130 VAStatus vaBufferSetNumElements (
1132 VABufferID buf_id, /* in */
1133 unsigned int num_elements /* in */
1136 VADriverContextP ctx;
1140 VA_FOOL_FUNC(va_FoolCheckContinuity, dpy);
1142 return ctx->vtable->vaBufferSetNumElements( ctx, buf_id, num_elements );
1146 VAStatus vaMapBuffer (
1148 VABufferID buf_id, /* in */
1149 void **pbuf /* out */
1152 VADriverContextP ctx;
1158 VA_FOOL_FUNC(va_FoolMapBuffer, dpy, buf_id, pbuf);
1160 va_status = ctx->vtable->vaMapBuffer( ctx, buf_id, pbuf );
1162 VA_TRACE_ALL(va_TraceMapBuffer, dpy, buf_id, pbuf);
1167 VAStatus vaUnmapBuffer (
1169 VABufferID buf_id /* in */
1172 VADriverContextP ctx;
1176 VA_FOOL_FUNC(va_FoolCheckContinuity, dpy);
1178 return ctx->vtable->vaUnmapBuffer( ctx, buf_id );
1181 VAStatus vaDestroyBuffer (
1183 VABufferID buffer_id
1186 VADriverContextP ctx;
1190 VA_FOOL_FUNC(va_FoolCheckContinuity, dpy);
1192 VA_TRACE_LOG(va_TraceDestroyBuffer,
1195 return ctx->vtable->vaDestroyBuffer( ctx, buffer_id );
1198 VAStatus vaBufferInfo (
1200 VAContextID context, /* in */
1201 VABufferID buf_id, /* in */
1202 VABufferType *type, /* out */
1203 unsigned int *size, /* out */
1204 unsigned int *num_elements /* out */
1207 VADriverContextP ctx;
1212 VA_FOOL_FUNC(va_FoolBufferInfo, dpy, buf_id, type, size, num_elements);
1214 return ctx->vtable->vaBufferInfo( ctx, buf_id, type, size, num_elements );
1217 /* Locks buffer for external API usage */
1219 vaAcquireBufferHandle(VADisplay dpy, VABufferID buf_id, VABufferInfo *buf_info)
1221 VADriverContextP ctx;
1226 if (!ctx->vtable->vaAcquireBufferHandle)
1227 return VA_STATUS_ERROR_UNIMPLEMENTED;
1228 return ctx->vtable->vaAcquireBufferHandle(ctx, buf_id, buf_info);
1231 /* Unlocks buffer after usage from external API */
1233 vaReleaseBufferHandle(VADisplay dpy, VABufferID buf_id)
1235 VADriverContextP ctx;
1240 if (!ctx->vtable->vaReleaseBufferHandle)
1241 return VA_STATUS_ERROR_UNIMPLEMENTED;
1242 return ctx->vtable->vaReleaseBufferHandle(ctx, buf_id);
1245 VAStatus vaBeginPicture (
1247 VAContextID context,
1248 VASurfaceID render_target
1251 VADriverContextP ctx;
1257 VA_TRACE_ALL(va_TraceBeginPicture, dpy, context, render_target);
1258 VA_FOOL_FUNC(va_FoolCheckContinuity, dpy);
1260 va_status = ctx->vtable->vaBeginPicture( ctx, context, render_target );
1265 VAStatus vaRenderPicture (
1267 VAContextID context,
1268 VABufferID *buffers,
1272 VADriverContextP ctx;
1277 VA_TRACE_LOG(va_TraceRenderPicture, dpy, context, buffers, num_buffers);
1278 VA_FOOL_FUNC(va_FoolCheckContinuity, dpy);
1280 return ctx->vtable->vaRenderPicture( ctx, context, buffers, num_buffers );
1283 VAStatus vaEndPicture (
1288 VAStatus va_status = VA_STATUS_SUCCESS;
1289 VADriverContextP ctx;
1294 VA_FOOL_FUNC(va_FoolCheckContinuity, dpy);
1296 va_status = ctx->vtable->vaEndPicture( ctx, context );
1298 /* dump surface content */
1299 VA_TRACE_ALL(va_TraceEndPicture, dpy, context, 1);
1304 VAStatus vaSyncSurface (
1306 VASurfaceID render_target
1310 VADriverContextP ctx;
1315 va_status = ctx->vtable->vaSyncSurface( ctx, render_target );
1316 VA_TRACE_LOG(va_TraceSyncSurface, dpy, render_target);
1321 VAStatus vaQuerySurfaceStatus (
1323 VASurfaceID render_target,
1324 VASurfaceStatus *status /* out */
1328 VADriverContextP ctx;
1332 va_status = ctx->vtable->vaQuerySurfaceStatus( ctx, render_target, status );
1334 VA_TRACE_LOG(va_TraceQuerySurfaceStatus, dpy, render_target, status);
1339 VAStatus vaQuerySurfaceError (
1341 VASurfaceID surface,
1342 VAStatus error_status,
1343 void **error_info /*out*/
1347 VADriverContextP ctx;
1351 va_status = ctx->vtable->vaQuerySurfaceError( ctx, surface, error_status, error_info );
1353 VA_TRACE_LOG(va_TraceQuerySurfaceError, dpy, surface, error_status, error_info);
1358 /* Get maximum number of image formats supported by the implementation */
1359 int vaMaxNumImageFormats (
1363 if (!vaDisplayIsValid(dpy))
1366 return CTX(dpy)->max_image_formats;
1369 VAStatus vaQueryImageFormats (
1371 VAImageFormat *format_list, /* out */
1372 int *num_formats /* out */
1375 VADriverContextP ctx;
1379 return ctx->vtable->vaQueryImageFormats ( ctx, format_list, num_formats);
1383 * The width and height fields returned in the VAImage structure may get
1384 * enlarged for some YUV formats. The size of the data buffer that needs
1385 * to be allocated will be given in the "data_size" field in VAImage.
1386 * Image data is not allocated by this function. The client should
1387 * allocate the memory and fill in the VAImage structure's data field
1388 * after looking at "data_size" returned from the library.
1390 VAStatus vaCreateImage (
1392 VAImageFormat *format,
1395 VAImage *image /* out */
1398 VADriverContextP ctx;
1402 return ctx->vtable->vaCreateImage ( ctx, format, width, height, image);
1406 * Should call DestroyImage before destroying the surface it is bound to
1408 VAStatus vaDestroyImage (
1413 VADriverContextP ctx;
1417 return ctx->vtable->vaDestroyImage ( ctx, image);
1420 VAStatus vaSetImagePalette (
1423 unsigned char *palette
1426 VADriverContextP ctx;
1430 return ctx->vtable->vaSetImagePalette ( ctx, image, palette);
1434 * Retrieve surface data into a VAImage
1435 * Image must be in a format supported by the implementation
1437 VAStatus vaGetImage (
1439 VASurfaceID surface,
1440 int x, /* coordinates of the upper left source pixel */
1442 unsigned int width, /* width and height of the region */
1443 unsigned int height,
1447 VADriverContextP ctx;
1451 return ctx->vtable->vaGetImage ( ctx, surface, x, y, width, height, image);
1455 * Copy data from a VAImage to a surface
1456 * Image must be in a format supported by the implementation
1458 VAStatus vaPutImage (
1460 VASurfaceID surface,
1464 unsigned int src_width,
1465 unsigned int src_height,
1468 unsigned int dest_width,
1469 unsigned int dest_height
1472 VADriverContextP ctx;
1476 return ctx->vtable->vaPutImage ( ctx, surface, image, src_x, src_y, src_width, src_height, dest_x, dest_y, dest_width, dest_height );
1480 * Derive an VAImage from an existing surface.
1481 * This interface will derive a VAImage and corresponding image buffer from
1482 * an existing VA Surface. The image buffer can then be mapped/unmapped for
1483 * direct CPU access. This operation is only possible on implementations with
1484 * direct rendering capabilities and internal surface formats that can be
1485 * represented with a VAImage. When the operation is not possible this interface
1486 * will return VA_STATUS_ERROR_OPERATION_FAILED. Clients should then fall back
1487 * to using vaCreateImage + vaPutImage to accomplish the same task in an
1490 * Implementations should only return success when the resulting image buffer
1491 * would be useable with vaMap/Unmap.
1493 * When directly accessing a surface special care must be taken to insure
1494 * proper synchronization with the graphics hardware. Clients should call
1495 * vaQuerySurfaceStatus to insure that a surface is not the target of concurrent
1496 * rendering or currently being displayed by an overlay.
1498 * Additionally nothing about the contents of a surface should be assumed
1499 * following a vaPutSurface. Implementations are free to modify the surface for
1500 * scaling or subpicture blending within a call to vaPutImage.
1502 * Calls to vaPutImage or vaGetImage using the same surface from which the image
1503 * has been derived will return VA_STATUS_ERROR_SURFACE_BUSY. vaPutImage or
1504 * vaGetImage with other surfaces is supported.
1506 * An image created with vaDeriveImage should be freed with vaDestroyImage. The
1507 * image and image buffer structures will be destroyed; however, the underlying
1508 * surface will remain unchanged until freed with vaDestroySurfaces.
1510 VAStatus vaDeriveImage (
1512 VASurfaceID surface,
1513 VAImage *image /* out */
1516 VADriverContextP ctx;
1520 return ctx->vtable->vaDeriveImage ( ctx, surface, image );
1524 /* Get maximum number of subpicture formats supported by the implementation */
1525 int vaMaxNumSubpictureFormats (
1529 if (!vaDisplayIsValid(dpy))
1532 return CTX(dpy)->max_subpic_formats;
1536 * Query supported subpicture formats
1537 * The caller must provide a "format_list" array that can hold at
1538 * least vaMaxNumSubpictureFormats() entries. The flags arrary holds the flag
1539 * for each format to indicate additional capabilities for that format. The actual
1540 * number of formats returned in "format_list" is returned in "num_formats".
1542 VAStatus vaQuerySubpictureFormats (
1544 VAImageFormat *format_list, /* out */
1545 unsigned int *flags, /* out */
1546 unsigned int *num_formats /* out */
1549 VADriverContextP ctx;
1554 return ctx->vtable->vaQuerySubpictureFormats ( ctx, format_list, flags, num_formats);
1558 * Subpictures are created with an image associated.
1560 VAStatus vaCreateSubpicture (
1563 VASubpictureID *subpicture /* out */
1566 VADriverContextP ctx;
1570 return ctx->vtable->vaCreateSubpicture ( ctx, image, subpicture );
1574 * Destroy the subpicture before destroying the image it is assocated to
1576 VAStatus vaDestroySubpicture (
1578 VASubpictureID subpicture
1581 VADriverContextP ctx;
1585 return ctx->vtable->vaDestroySubpicture ( ctx, subpicture);
1588 VAStatus vaSetSubpictureImage (
1590 VASubpictureID subpicture,
1594 VADriverContextP ctx;
1598 return ctx->vtable->vaSetSubpictureImage ( ctx, subpicture, image);
1603 * If chromakey is enabled, then the area where the source value falls within
1604 * the chromakey [min, max] range is transparent
1606 VAStatus vaSetSubpictureChromakey (
1608 VASubpictureID subpicture,
1609 unsigned int chromakey_min,
1610 unsigned int chromakey_max,
1611 unsigned int chromakey_mask
1614 VADriverContextP ctx;
1618 return ctx->vtable->vaSetSubpictureChromakey ( ctx, subpicture, chromakey_min, chromakey_max, chromakey_mask );
1623 * Global alpha value is between 0 and 1. A value of 1 means fully opaque and
1624 * a value of 0 means fully transparent. If per-pixel alpha is also specified then
1625 * the overall alpha is per-pixel alpha multiplied by the global alpha
1627 VAStatus vaSetSubpictureGlobalAlpha (
1629 VASubpictureID subpicture,
1633 VADriverContextP ctx;
1637 return ctx->vtable->vaSetSubpictureGlobalAlpha ( ctx, subpicture, global_alpha );
1641 vaAssociateSubpicture associates the subpicture with the target_surface.
1642 It defines the region mapping between the subpicture and the target
1643 surface through source and destination rectangles (with the same width and height).
1644 Both will be displayed at the next call to vaPutSurface. Additional
1645 associations before the call to vaPutSurface simply overrides the association.
1647 VAStatus vaAssociateSubpicture (
1649 VASubpictureID subpicture,
1650 VASurfaceID *target_surfaces,
1652 short src_x, /* upper left offset in subpicture */
1654 unsigned short src_width,
1655 unsigned short src_height,
1656 short dest_x, /* upper left offset in surface */
1658 unsigned short dest_width,
1659 unsigned short dest_height,
1661 * whether to enable chroma-keying or global-alpha
1662 * see VA_SUBPICTURE_XXX values
1667 VADriverContextP ctx;
1671 return ctx->vtable->vaAssociateSubpicture ( ctx, subpicture, target_surfaces, num_surfaces, src_x, src_y, src_width, src_height, dest_x, dest_y, dest_width, dest_height, flags );
1675 * vaDeassociateSubpicture removes the association of the subpicture with target_surfaces.
1677 VAStatus vaDeassociateSubpicture (
1679 VASubpictureID subpicture,
1680 VASurfaceID *target_surfaces,
1684 VADriverContextP ctx;
1688 return ctx->vtable->vaDeassociateSubpicture ( ctx, subpicture, target_surfaces, num_surfaces );
1692 /* Get maximum number of display attributes supported by the implementation */
1693 int vaMaxNumDisplayAttributes (
1699 if (!vaDisplayIsValid(dpy))
1702 tmp = CTX(dpy)->max_display_attributes;
1704 VA_TRACE_LOG(va_TraceMaxNumDisplayAttributes, dpy, tmp);
1710 * Query display attributes
1711 * The caller must provide a "attr_list" array that can hold at
1712 * least vaMaxNumDisplayAttributes() entries. The actual number of attributes
1713 * returned in "attr_list" is returned in "num_attributes".
1715 VAStatus vaQueryDisplayAttributes (
1717 VADisplayAttribute *attr_list, /* out */
1718 int *num_attributes /* out */
1721 VADriverContextP ctx;
1726 va_status = ctx->vtable->vaQueryDisplayAttributes ( ctx, attr_list, num_attributes );
1728 VA_TRACE_LOG(va_TraceQueryDisplayAttributes, dpy, attr_list, num_attributes);
1735 * Get display attributes
1736 * This function returns the current attribute values in "attr_list".
1737 * Only attributes returned with VA_DISPLAY_ATTRIB_GETTABLE set in the "flags" field
1738 * from vaQueryDisplayAttributes() can have their values retrieved.
1740 VAStatus vaGetDisplayAttributes (
1742 VADisplayAttribute *attr_list, /* in/out */
1746 VADriverContextP ctx;
1751 va_status = ctx->vtable->vaGetDisplayAttributes ( ctx, attr_list, num_attributes );
1753 VA_TRACE_LOG(va_TraceGetDisplayAttributes, dpy, attr_list, num_attributes);
1759 * Set display attributes
1760 * Only attributes returned with VA_DISPLAY_ATTRIB_SETTABLE set in the "flags" field
1761 * from vaQueryDisplayAttributes() can be set. If the attribute is not settable or
1762 * the value is out of range, the function returns VA_STATUS_ERROR_ATTR_NOT_SUPPORTED
1764 VAStatus vaSetDisplayAttributes (
1766 VADisplayAttribute *attr_list,
1770 VADriverContextP ctx;
1775 va_status = ctx->vtable->vaSetDisplayAttributes ( ctx, attr_list, num_attributes );
1776 VA_TRACE_LOG(va_TraceSetDisplayAttributes, dpy, attr_list, num_attributes);
1781 VAStatus vaLockSurface(VADisplay dpy,
1782 VASurfaceID surface,
1783 unsigned int *fourcc, /* following are output argument */
1784 unsigned int *luma_stride,
1785 unsigned int *chroma_u_stride,
1786 unsigned int *chroma_v_stride,
1787 unsigned int *luma_offset,
1788 unsigned int *chroma_u_offset,
1789 unsigned int *chroma_v_offset,
1790 unsigned int *buffer_name,
1794 VADriverContextP ctx;
1798 return ctx->vtable->vaLockSurface( ctx, surface, fourcc, luma_stride, chroma_u_stride, chroma_v_stride, luma_offset, chroma_u_offset, chroma_v_offset, buffer_name, buffer);
1802 VAStatus vaUnlockSurface(VADisplay dpy,
1806 VADriverContextP ctx;
1810 return ctx->vtable->vaUnlockSurface( ctx, surface );
1813 /* Video Processing */
1814 #define VA_VPP_INIT_CONTEXT(ctx, dpy) do { \
1815 CHECK_DISPLAY(dpy); \
1818 return VA_STATUS_ERROR_INVALID_DISPLAY; \
1821 #define VA_VPP_INVOKE(dpy, func, args) do { \
1822 if (!ctx->vtable_vpp->va##func) \
1823 return VA_STATUS_ERROR_UNIMPLEMENTED; \
1824 status = ctx->vtable_vpp->va##func args; \
1828 vaQueryVideoProcFilters(
1830 VAContextID context,
1831 VAProcFilterType *filters,
1832 unsigned int *num_filters
1835 VADriverContextP ctx;
1838 VA_VPP_INIT_CONTEXT(ctx, dpy);
1841 QueryVideoProcFilters,
1842 (ctx, context, filters, num_filters)
1848 vaQueryVideoProcFilterCaps(
1850 VAContextID context,
1851 VAProcFilterType type,
1853 unsigned int *num_filter_caps
1856 VADriverContextP ctx;
1859 VA_VPP_INIT_CONTEXT(ctx, dpy);
1862 QueryVideoProcFilterCaps,
1863 (ctx, context, type, filter_caps, num_filter_caps)
1869 vaQueryVideoProcPipelineCaps(
1871 VAContextID context,
1872 VABufferID *filters,
1873 unsigned int num_filters,
1874 VAProcPipelineCaps *pipeline_caps
1877 VADriverContextP ctx;
1880 VA_VPP_INIT_CONTEXT(ctx, dpy);
1883 QueryVideoProcPipelineCaps,
1884 (ctx, context, filters, num_filters, pipeline_caps)