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 #define DRIVER_EXTENSION "_drv_video.so"
43 #define CTX(dpy) (((VADisplayContextP)dpy)->pDriverContext)
44 #define CHECK_DISPLAY(dpy) if( !vaDisplayIsValid(dpy) ) { return VA_STATUS_ERROR_INVALID_DISPLAY; }
47 #define CHECK_VTABLE(s, ctx, func) if (!va_checkVtable(ctx->vtable->va##func, #func)) s = VA_STATUS_ERROR_UNKNOWN;
48 #define CHECK_MAXIMUM(s, ctx, var) if (!va_checkMaximum(ctx->max_##var, #var)) s = VA_STATUS_ERROR_UNKNOWN;
49 #define CHECK_STRING(s, ctx, var) if (!va_checkString(ctx->str_##var, #var)) s = VA_STATUS_ERROR_UNKNOWN;
52 * read a config "env" for libva.conf or from environment setting
53 * liva.conf has higher priority
54 * return 0: the "env" is set, and the value is copied into env_value
55 * 1: the env is not set
57 int va_parseConfig(char *env, char *env_value)
59 char *token, *value, *saveptr;
66 fp = fopen("/etc/libva.conf", "r");
67 while (fp && (fgets(oneline, 1024, fp) != NULL)) {
68 if (strlen(oneline) == 1)
70 token = strtok_r(oneline, "=\n", &saveptr);
71 value = strtok_r(NULL, "=\n", &saveptr);
73 if (NULL == token || NULL == value)
76 if (strcmp(token, env) == 0) {
78 strncpy(env_value,value, 1024);
79 env_value[1023] = '\0';
90 /* no setting in config file, use env setting */
94 strncpy(env_value, value, 1024);
95 env_value[1023] = '\0';
103 int vaDisplayIsValid(VADisplay dpy)
105 VADisplayContextP pDisplayContext = (VADisplayContextP)dpy;
106 return pDisplayContext && (pDisplayContext->vadpy_magic == VA_DISPLAY_MAGIC) && pDisplayContext->vaIsValid(pDisplayContext);
109 static void default_log_error(const char *buffer)
116 fprintf(stderr, "libva error: %s", buffer);
120 static void default_log_info(const char *buffer)
127 fprintf(stderr, "libva info: %s", buffer);
131 static vaMessageCallback va_log_error = default_log_error;
132 static vaMessageCallback va_log_info = default_log_info;
135 * Set the callback for error messages, or NULL for no logging.
136 * Returns the previous one, or NULL if it was disabled.
138 vaMessageCallback vaSetErrorCallback(vaMessageCallback callback)
140 vaMessageCallback old_callback = va_log_error;
141 va_log_error = callback;
146 * Set the callback for info messages, or NULL for no logging.
147 * Returns the previous one, or NULL if it was disabled.
149 vaMessageCallback vaSetInfoCallback(vaMessageCallback callback)
151 vaMessageCallback old_callback = va_log_info;
152 va_log_info = callback;
156 void va_errorMessage(const char *msg, ...)
158 #if ENABLE_VA_MESSAGING
159 char buf[512], *dynbuf;
163 if (va_log_error == NULL)
167 len = vsnprintf(buf, sizeof(buf), msg, args);
170 if (len >= (int)sizeof(buf)) {
171 dynbuf = malloc(len + 1);
175 n = vsnprintf(dynbuf, len + 1, msg, args);
178 va_log_error(dynbuf);
186 void va_infoMessage(const char *msg, ...)
188 #if ENABLE_VA_MESSAGING
189 char buf[512], *dynbuf;
193 if (va_log_info == NULL)
197 len = vsnprintf(buf, sizeof(buf), msg, args);
200 if (len >= (int)sizeof(buf)) {
201 dynbuf = malloc(len + 1);
205 n = vsnprintf(dynbuf, len + 1, msg, args);
216 static bool va_checkVtable(void *ptr, char *function)
219 va_errorMessage("No valid vtable entry for va%s\n", function);
225 static bool va_checkMaximum(int value, char *variable)
228 va_errorMessage("Failed to define max_%s in init\n", variable);
234 static bool va_checkString(const char* value, char *variable)
237 va_errorMessage("Failed to define str_%s in init\n", variable);
244 va_getDriverInitName(char *name, int namelen, int major, int minor)
246 int ret = snprintf(name, namelen, "__vaDriverInit_%d_%d", major, minor);
247 return ret > 0 && ret < namelen;
250 static VAStatus va_getDriverName(VADisplay dpy, char **driver_name)
252 VADisplayContextP pDisplayContext = (VADisplayContextP)dpy;
254 return pDisplayContext->vaGetDriverName(pDisplayContext, driver_name);
257 static VAStatus va_openDriver(VADisplay dpy, char *driver_name)
259 VADriverContextP ctx = CTX(dpy);
260 VAStatus vaStatus = VA_STATUS_ERROR_UNKNOWN;
261 char *search_path = NULL;
265 if (geteuid() == getuid())
266 /* don't allow setuid apps to use LIBVA_DRIVERS_PATH */
267 search_path = getenv("LIBVA_DRIVERS_PATH");
269 search_path = VA_DRIVERS_PATH;
271 search_path = strdup((const char *)search_path);
272 driver_dir = strtok_r(search_path, ":", &saveptr);
275 char *driver_path = (char *) malloc( strlen(driver_dir) +
276 strlen(driver_name) +
277 strlen(DRIVER_EXTENSION) + 2 );
279 va_errorMessage("%s L%d Out of memory!n",
280 __FUNCTION__, __LINE__);
282 return VA_STATUS_ERROR_ALLOCATION_FAILED;
285 strncpy( driver_path, driver_dir, strlen(driver_dir) + 1);
286 strncat( driver_path, "/", strlen("/") );
287 strncat( driver_path, driver_name, strlen(driver_name) );
288 strncat( driver_path, DRIVER_EXTENSION, strlen(DRIVER_EXTENSION) );
290 va_infoMessage("Trying to open %s\n", driver_path);
292 handle = dlopen( driver_path, RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE );
294 handle = dlopen( driver_path, RTLD_NOW| RTLD_GLOBAL);
297 /* Don't give errors for non-existing files */
298 if (0 == access( driver_path, F_OK))
299 va_errorMessage("dlopen of %s failed: %s\n", driver_path, dlerror());
301 VADriverInit init_func = NULL;
302 char init_func_s[256];
305 static const struct {
308 } compatible_versions[] = {
309 { VA_MAJOR_VERSION, VA_MINOR_VERSION },
321 for (i = 0; compatible_versions[i].major >= 0; i++) {
322 if (va_getDriverInitName(init_func_s, sizeof(init_func_s),
323 compatible_versions[i].major,
324 compatible_versions[i].minor)) {
325 init_func = (VADriverInit)dlsym(handle, init_func_s);
327 va_infoMessage("Found init function %s\n", init_func_s);
333 if (compatible_versions[i].major < 0) {
334 va_errorMessage("%s has no function %s\n",
335 driver_path, init_func_s);
338 struct VADriverVTable *vtable = ctx->vtable;
339 struct VADriverVTableVPP *vtable_vpp = ctx->vtable_vpp;
341 vaStatus = VA_STATUS_SUCCESS;
343 vtable = calloc(1, sizeof(*vtable));
345 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
347 ctx->vtable = vtable;
350 vtable_vpp = calloc(1, sizeof(*vtable_vpp));
352 vtable_vpp->version = VA_DRIVER_VTABLE_VPP_VERSION;
354 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
356 ctx->vtable_vpp = vtable_vpp;
358 if (init_func && VA_STATUS_SUCCESS == vaStatus)
359 vaStatus = (*init_func)(ctx);
361 if (VA_STATUS_SUCCESS == vaStatus) {
362 CHECK_MAXIMUM(vaStatus, ctx, profiles);
363 CHECK_MAXIMUM(vaStatus, ctx, entrypoints);
364 CHECK_MAXIMUM(vaStatus, ctx, attributes);
365 CHECK_MAXIMUM(vaStatus, ctx, image_formats);
366 CHECK_MAXIMUM(vaStatus, ctx, subpic_formats);
367 CHECK_MAXIMUM(vaStatus, ctx, display_attributes);
368 CHECK_STRING(vaStatus, ctx, vendor);
369 CHECK_VTABLE(vaStatus, ctx, Terminate);
370 CHECK_VTABLE(vaStatus, ctx, QueryConfigProfiles);
371 CHECK_VTABLE(vaStatus, ctx, QueryConfigEntrypoints);
372 CHECK_VTABLE(vaStatus, ctx, QueryConfigAttributes);
373 CHECK_VTABLE(vaStatus, ctx, CreateConfig);
374 CHECK_VTABLE(vaStatus, ctx, DestroyConfig);
375 CHECK_VTABLE(vaStatus, ctx, GetConfigAttributes);
376 CHECK_VTABLE(vaStatus, ctx, CreateSurfaces);
377 CHECK_VTABLE(vaStatus, ctx, DestroySurfaces);
378 CHECK_VTABLE(vaStatus, ctx, CreateContext);
379 CHECK_VTABLE(vaStatus, ctx, DestroyContext);
380 CHECK_VTABLE(vaStatus, ctx, CreateBuffer);
381 CHECK_VTABLE(vaStatus, ctx, BufferSetNumElements);
382 CHECK_VTABLE(vaStatus, ctx, MapBuffer);
383 CHECK_VTABLE(vaStatus, ctx, UnmapBuffer);
384 CHECK_VTABLE(vaStatus, ctx, DestroyBuffer);
385 CHECK_VTABLE(vaStatus, ctx, BeginPicture);
386 CHECK_VTABLE(vaStatus, ctx, RenderPicture);
387 CHECK_VTABLE(vaStatus, ctx, EndPicture);
388 CHECK_VTABLE(vaStatus, ctx, SyncSurface);
389 CHECK_VTABLE(vaStatus, ctx, QuerySurfaceStatus);
390 CHECK_VTABLE(vaStatus, ctx, PutSurface);
391 CHECK_VTABLE(vaStatus, ctx, QueryImageFormats);
392 CHECK_VTABLE(vaStatus, ctx, CreateImage);
393 CHECK_VTABLE(vaStatus, ctx, DeriveImage);
394 CHECK_VTABLE(vaStatus, ctx, DestroyImage);
395 CHECK_VTABLE(vaStatus, ctx, SetImagePalette);
396 CHECK_VTABLE(vaStatus, ctx, GetImage);
397 CHECK_VTABLE(vaStatus, ctx, PutImage);
398 CHECK_VTABLE(vaStatus, ctx, QuerySubpictureFormats);
399 CHECK_VTABLE(vaStatus, ctx, CreateSubpicture);
400 CHECK_VTABLE(vaStatus, ctx, DestroySubpicture);
401 CHECK_VTABLE(vaStatus, ctx, SetSubpictureImage);
402 CHECK_VTABLE(vaStatus, ctx, SetSubpictureChromakey);
403 CHECK_VTABLE(vaStatus, ctx, SetSubpictureGlobalAlpha);
404 CHECK_VTABLE(vaStatus, ctx, AssociateSubpicture);
405 CHECK_VTABLE(vaStatus, ctx, DeassociateSubpicture);
406 CHECK_VTABLE(vaStatus, ctx, QueryDisplayAttributes);
407 CHECK_VTABLE(vaStatus, ctx, GetDisplayAttributes);
408 CHECK_VTABLE(vaStatus, ctx, SetDisplayAttributes);
410 if (VA_STATUS_SUCCESS != vaStatus) {
411 va_errorMessage("%s init failed\n", driver_path);
414 if (VA_STATUS_SUCCESS == vaStatus)
415 ctx->handle = handle;
422 driver_dir = strtok_r(NULL, ":", &saveptr);
430 VAPrivFunc vaGetLibFunc(VADisplay dpy, const char *func)
432 VADriverContextP ctx;
433 if (!vaDisplayIsValid(dpy))
437 if (NULL == ctx->handle)
440 return (VAPrivFunc) dlsym(ctx->handle, func);
445 * Returns a short english description of error_status
447 const char *vaErrorStr(VAStatus error_status)
449 switch(error_status) {
450 case VA_STATUS_SUCCESS:
451 return "success (no error)";
452 case VA_STATUS_ERROR_OPERATION_FAILED:
453 return "operation failed";
454 case VA_STATUS_ERROR_ALLOCATION_FAILED:
455 return "resource allocation failed";
456 case VA_STATUS_ERROR_INVALID_DISPLAY:
457 return "invalid VADisplay";
458 case VA_STATUS_ERROR_INVALID_CONFIG:
459 return "invalid VAConfigID";
460 case VA_STATUS_ERROR_INVALID_CONTEXT:
461 return "invalid VAContextID";
462 case VA_STATUS_ERROR_INVALID_SURFACE:
463 return "invalid VASurfaceID";
464 case VA_STATUS_ERROR_INVALID_BUFFER:
465 return "invalid VABufferID";
466 case VA_STATUS_ERROR_INVALID_IMAGE:
467 return "invalid VAImageID";
468 case VA_STATUS_ERROR_INVALID_SUBPICTURE:
469 return "invalid VASubpictureID";
470 case VA_STATUS_ERROR_ATTR_NOT_SUPPORTED:
471 return "attribute not supported";
472 case VA_STATUS_ERROR_MAX_NUM_EXCEEDED:
473 return "list argument exceeds maximum number";
474 case VA_STATUS_ERROR_UNSUPPORTED_PROFILE:
475 return "the requested VAProfile is not supported";
476 case VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT:
477 return "the requested VAEntryPoint is not supported";
478 case VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT:
479 return "the requested RT Format is not supported";
480 case VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE:
481 return "the requested VABufferType is not supported";
482 case VA_STATUS_ERROR_SURFACE_BUSY:
483 return "surface is in use";
484 case VA_STATUS_ERROR_FLAG_NOT_SUPPORTED:
485 return "flag not supported";
486 case VA_STATUS_ERROR_INVALID_PARAMETER:
487 return "invalid parameter";
488 case VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED:
489 return "resolution not supported";
490 case VA_STATUS_ERROR_UNIMPLEMENTED:
491 return "the requested function is not implemented";
492 case VA_STATUS_ERROR_SURFACE_IN_DISPLAYING:
493 return "surface is in displaying (may by overlay)" ;
494 case VA_STATUS_ERROR_INVALID_IMAGE_FORMAT:
495 return "invalid VAImageFormat";
496 case VA_STATUS_ERROR_INVALID_VALUE:
497 return "an invalid/unsupported value was supplied";
498 case VA_STATUS_ERROR_UNSUPPORTED_FILTER:
499 return "the requested filter is not supported";
500 case VA_STATUS_ERROR_INVALID_FILTER_CHAIN:
501 return "an invalid filter chain was supplied";
502 case VA_STATUS_ERROR_UNKNOWN:
503 return "unknown libva error";
505 return "unknown libva error / description missing";
508 const static char *prefer_driver_list[4] = {
515 VAStatus vaSetDriverName(
520 VADriverContextP ctx;
521 VAStatus vaStatus = VA_STATUS_SUCCESS;
522 char *override_driver_name = NULL;
526 if (geteuid() != getuid()) {
527 vaStatus = VA_STATUS_ERROR_OPERATION_FAILED;
528 va_errorMessage("no permission to vaSetDriverName\n");
532 if (strlen(driver_name) == 0 || strlen(driver_name) >=256) {
533 vaStatus = VA_STATUS_ERROR_INVALID_PARAMETER;
534 va_errorMessage("vaSetDriverName returns %s\n",
535 vaErrorStr(vaStatus));
540 for (i = 0; i < sizeof(prefer_driver_list) / sizeof(char *); i++) {
541 if (strlen(prefer_driver_list[i]) != strlen(driver_name))
543 if (!strncmp(prefer_driver_list[i], driver_name, strlen(driver_name))) {
550 vaStatus = VA_STATUS_ERROR_INVALID_PARAMETER;
551 va_errorMessage("vaSetDriverName returns %s. Incorrect parameter\n",
552 vaErrorStr(vaStatus));
556 override_driver_name = strdup(driver_name);
558 if (!override_driver_name) {
559 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
560 va_errorMessage("vaSetDriverName returns %s. Out of Memory\n",
561 vaErrorStr(vaStatus));
565 ctx->override_driver_name = override_driver_name;
566 return VA_STATUS_SUCCESS;
569 VAStatus vaInitialize (
571 int *major_version, /* out */
572 int *minor_version /* out */
575 const char *driver_name_env = NULL;
576 char *driver_name = NULL;
578 VADriverContextP ctx;
588 va_infoMessage("VA-API version %s\n", VA_VERSION_S);
590 vaStatus = va_getDriverName(dpy, &driver_name);
592 if (!ctx->override_driver_name) {
593 va_infoMessage("va_getDriverName() returns %d\n", vaStatus);
595 driver_name_env = getenv("LIBVA_DRIVER_NAME");
596 } else if (vaStatus == VA_STATUS_SUCCESS) {
600 driver_name = strdup(ctx->override_driver_name);
602 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
603 va_errorMessage("vaInitialize() failed with %s, out of memory\n",
604 vaErrorStr(vaStatus));
607 va_infoMessage("User requested driver '%s'\n", driver_name);
610 if (driver_name_env && (geteuid() == getuid())) {
611 /* Don't allow setuid apps to use LIBVA_DRIVER_NAME */
612 if (driver_name) /* memory is allocated in va_getDriverName */
615 driver_name = strdup(driver_name_env);
616 vaStatus = VA_STATUS_SUCCESS;
617 va_infoMessage("User requested driver '%s'\n", driver_name);
620 if ((VA_STATUS_SUCCESS == vaStatus) && (driver_name != NULL)) {
621 vaStatus = va_openDriver(dpy, driver_name);
622 va_infoMessage("va_openDriver() returns %d\n", vaStatus);
624 *major_version = VA_MAJOR_VERSION;
625 *minor_version = VA_MINOR_VERSION;
627 va_errorMessage("va_getDriverName() failed with %s,driver_name=%s\n",
628 vaErrorStr(vaStatus), driver_name);
633 VA_TRACE_LOG(va_TraceInitialize, dpy, major_version, minor_version);
640 * After this call, all library internal resources will be cleaned up
642 VAStatus vaTerminate (
646 VAStatus vaStatus = VA_STATUS_SUCCESS;
647 VADisplayContextP pDisplayContext = (VADisplayContextP)dpy;
648 VADriverContextP old_ctx;
653 if (old_ctx->handle) {
654 vaStatus = old_ctx->vtable->vaTerminate(old_ctx);
655 dlclose(old_ctx->handle);
656 old_ctx->handle = NULL;
658 free(old_ctx->vtable);
659 old_ctx->vtable = NULL;
660 free(old_ctx->vtable_vpp);
661 old_ctx->vtable_vpp = NULL;
663 if (old_ctx->override_driver_name) {
664 free(old_ctx->override_driver_name);
665 old_ctx->override_driver_name = NULL;
668 VA_TRACE_LOG(va_TraceTerminate, dpy);
674 if (VA_STATUS_SUCCESS == vaStatus)
675 pDisplayContext->vaDestroy(pDisplayContext);
681 * vaQueryVendorString returns a pointer to a zero-terminated string
682 * describing some aspects of the VA implemenation on a specific
683 * hardware accelerator. The format of the returned string is:
684 * <vendorname>-<major_version>-<minor_version>-<addtional_info>
685 * e.g. for the Intel GMA500 implementation, an example would be:
686 * "IntelGMA500-1.0-0.2-patch3
688 const char *vaQueryVendorString (
692 if (!vaDisplayIsValid(dpy))
695 return CTX(dpy)->str_vendor;
699 /* Get maximum number of profiles supported by the implementation */
700 int vaMaxNumProfiles (
704 if (!vaDisplayIsValid(dpy))
707 return CTX(dpy)->max_profiles;
710 /* Get maximum number of entrypoints supported by the implementation */
711 int vaMaxNumEntrypoints (
715 if (!vaDisplayIsValid(dpy))
718 return CTX(dpy)->max_entrypoints;
722 /* Get maximum number of attributs supported by the implementation */
723 int vaMaxNumConfigAttributes (
727 if (!vaDisplayIsValid(dpy))
730 return CTX(dpy)->max_attributes;
733 VAStatus vaQueryConfigEntrypoints (
736 VAEntrypoint *entrypoints, /* out */
737 int *num_entrypoints /* out */
740 VADriverContextP ctx;
744 return ctx->vtable->vaQueryConfigEntrypoints ( ctx, profile, entrypoints, num_entrypoints);
747 VAStatus vaGetConfigAttributes (
750 VAEntrypoint entrypoint,
751 VAConfigAttrib *attrib_list, /* in/out */
755 VADriverContextP ctx;
759 return ctx->vtable->vaGetConfigAttributes ( ctx, profile, entrypoint, attrib_list, num_attribs );
762 VAStatus vaQueryConfigProfiles (
764 VAProfile *profile_list, /* out */
765 int *num_profiles /* out */
768 VADriverContextP ctx;
772 return ctx->vtable->vaQueryConfigProfiles ( ctx, profile_list, num_profiles );
775 VAStatus vaCreateConfig (
778 VAEntrypoint entrypoint,
779 VAConfigAttrib *attrib_list,
781 VAConfigID *config_id /* out */
784 VADriverContextP ctx;
785 VAStatus vaStatus = VA_STATUS_SUCCESS;
790 vaStatus = ctx->vtable->vaCreateConfig ( ctx, profile, entrypoint, attrib_list, num_attribs, config_id );
792 /* record the current entrypoint for further trace/fool determination */
793 VA_TRACE_ALL(va_TraceCreateConfig, dpy, profile, entrypoint, attrib_list, num_attribs, config_id);
794 VA_FOOL_FUNC(va_FoolCreateConfig, dpy, profile, entrypoint, attrib_list, num_attribs, config_id);
799 VAStatus vaDestroyConfig (
804 VADriverContextP ctx;
805 VAStatus vaStatus = VA_STATUS_SUCCESS;
810 vaStatus = ctx->vtable->vaDestroyConfig ( ctx, config_id );
812 VA_TRACE_ALL(va_TraceDestroyConfig, dpy, config_id);
817 VAStatus vaQueryConfigAttributes (
819 VAConfigID config_id,
820 VAProfile *profile, /* out */
821 VAEntrypoint *entrypoint, /* out */
822 VAConfigAttrib *attrib_list,/* out */
823 int *num_attribs /* out */
826 VADriverContextP ctx;
830 return ctx->vtable->vaQueryConfigAttributes( ctx, config_id, profile, entrypoint, attrib_list, num_attribs);
833 /* XXX: this is a slow implementation that will be removed */
835 va_impl_query_surface_attributes(
836 VADriverContextP ctx,
838 VASurfaceAttrib *out_attribs,
839 unsigned int *out_num_attribs_ptr
842 VASurfaceAttrib *attribs = NULL;
843 unsigned int num_attribs, n;
844 VASurfaceAttrib *out_attrib;
845 unsigned int out_num_attribs;
846 VAImageFormat *image_formats = NULL;
847 int num_image_formats, i;
850 /* List of surface attributes to query */
851 struct va_surface_attrib_map {
852 VASurfaceAttribType type;
853 VAGenericValueType value_type;
855 static const struct va_surface_attrib_map attribs_map[] = {
856 { VASurfaceAttribMinWidth, VAGenericValueTypeInteger },
857 { VASurfaceAttribMaxWidth, VAGenericValueTypeInteger },
858 { VASurfaceAttribMinHeight, VAGenericValueTypeInteger },
859 { VASurfaceAttribMaxHeight, VAGenericValueTypeInteger },
860 { VASurfaceAttribMemoryType, VAGenericValueTypeInteger },
861 { VASurfaceAttribNone, }
864 if (!out_attribs || !out_num_attribs_ptr)
865 return VA_STATUS_ERROR_INVALID_PARAMETER;
866 if (!ctx->vtable->vaGetSurfaceAttributes)
867 return VA_STATUS_ERROR_UNIMPLEMENTED;
869 num_image_formats = ctx->max_image_formats;
870 image_formats = malloc(num_image_formats * sizeof(*image_formats));
871 if (!image_formats) {
872 va_status = VA_STATUS_ERROR_ALLOCATION_FAILED;
876 va_status = ctx->vtable->vaQueryImageFormats(
877 ctx, image_formats, &num_image_formats);
878 if (va_status != VA_STATUS_SUCCESS)
881 num_attribs = VASurfaceAttribCount + num_image_formats;
882 attribs = malloc(num_attribs * sizeof(*attribs));
884 va_status = VA_STATUS_ERROR_ALLOCATION_FAILED;
888 /* Initialize with base surface attributes, except pixel-formats */
889 for (n = 0; attribs_map[n].type != VASurfaceAttribNone; n++) {
890 VASurfaceAttrib * const attrib = &attribs[n];
891 attrib->type = attribs_map[n].type;
892 attrib->flags = VA_SURFACE_ATTRIB_GETTABLE;
893 attrib->value.type = attribs_map[n].value_type;
896 /* Append image formats */
897 for (i = 0; i < num_image_formats; i++) {
898 VASurfaceAttrib * const attrib = &attribs[n];
899 attrib->type = VASurfaceAttribPixelFormat;
900 attrib->flags = VA_SURFACE_ATTRIB_GETTABLE|VA_SURFACE_ATTRIB_SETTABLE;
901 attrib->value.type = VAGenericValueTypeInteger;
902 attrib->value.value.i = image_formats[i].fourcc;
903 if (++n == num_attribs) {
904 va_status = VA_STATUS_ERROR_ALLOCATION_FAILED;
910 va_status = ctx->vtable->vaGetSurfaceAttributes(
911 ctx, config, attribs, num_attribs);
912 if (va_status != VA_STATUS_SUCCESS)
915 /* Remove invalid entries */
917 for (n = 0; n < num_attribs; n++) {
918 VASurfaceAttrib * const attrib = &attribs[n];
920 if (attrib->flags == VA_SURFACE_ATTRIB_NOT_SUPPORTED)
923 // Accept all surface attributes that are not pixel-formats
924 if (attrib->type != VASurfaceAttribPixelFormat) {
929 // Drop invalid pixel-format attribute
930 if (!attrib->value.value.i) {
931 attrib->flags = VA_SURFACE_ATTRIB_NOT_SUPPORTED;
935 // Check for duplicates
936 int is_duplicate = 0;
937 for (i = n - 1; i >= 0 && !is_duplicate; i--) {
938 const VASurfaceAttrib * const prev_attrib = &attribs[i];
939 if (prev_attrib->type != VASurfaceAttribPixelFormat)
941 is_duplicate = prev_attrib->value.value.i == attrib->value.value.i;
944 attrib->flags = VA_SURFACE_ATTRIB_NOT_SUPPORTED;
949 if (*out_num_attribs_ptr < out_num_attribs) {
950 *out_num_attribs_ptr = out_num_attribs;
951 va_status = VA_STATUS_ERROR_MAX_NUM_EXCEEDED;
955 out_attrib = out_attribs;
956 for (n = 0; n < num_attribs; n++) {
957 const VASurfaceAttrib * const attrib = &attribs[n];
958 if (attrib->flags == VA_SURFACE_ATTRIB_NOT_SUPPORTED)
960 *out_attrib++ = *attrib;
970 vaQuerySurfaceAttributes(
973 VASurfaceAttrib *attrib_list,
974 unsigned int *num_attribs
977 VADriverContextP ctx;
983 return VA_STATUS_ERROR_INVALID_DISPLAY;
985 if (!ctx->vtable->vaQuerySurfaceAttributes)
986 vaStatus = va_impl_query_surface_attributes(ctx, config,
987 attrib_list, num_attribs);
989 vaStatus = ctx->vtable->vaQuerySurfaceAttributes(ctx, config,
990 attrib_list, num_attribs);
992 VA_TRACE_LOG(va_TraceQuerySurfaceAttributes, dpy, config, attrib_list, num_attribs);
1000 unsigned int format,
1002 unsigned int height,
1003 VASurfaceID *surfaces,
1004 unsigned int num_surfaces,
1005 VASurfaceAttrib *attrib_list,
1006 unsigned int num_attribs
1009 VADriverContextP ctx;
1015 return VA_STATUS_ERROR_INVALID_DISPLAY;
1017 if (ctx->vtable->vaCreateSurfaces2)
1018 vaStatus = ctx->vtable->vaCreateSurfaces2(ctx, format, width, height,
1019 surfaces, num_surfaces,
1020 attrib_list, num_attribs);
1021 else if (attrib_list && num_attribs > 0)
1022 vaStatus = VA_STATUS_ERROR_ATTR_NOT_SUPPORTED;
1024 vaStatus = ctx->vtable->vaCreateSurfaces(ctx, width, height, format,
1025 num_surfaces, surfaces);
1026 VA_TRACE_LOG(va_TraceCreateSurfaces,
1027 dpy, width, height, format, num_surfaces, surfaces,
1028 attrib_list, num_attribs);
1034 VAStatus vaDestroySurfaces (
1036 VASurfaceID *surface_list,
1040 VADriverContextP ctx;
1046 VA_TRACE_LOG(va_TraceDestroySurfaces,
1047 dpy, surface_list, num_surfaces);
1049 vaStatus = ctx->vtable->vaDestroySurfaces( ctx, surface_list, num_surfaces );
1054 VAStatus vaCreateContext (
1056 VAConfigID config_id,
1060 VASurfaceID *render_targets,
1061 int num_render_targets,
1062 VAContextID *context /* out */
1065 VADriverContextP ctx;
1071 vaStatus = ctx->vtable->vaCreateContext( ctx, config_id, picture_width, picture_height,
1072 flag, render_targets, num_render_targets, context );
1074 /* keep current encode/decode resoluton */
1075 VA_TRACE_ALL(va_TraceCreateContext, dpy, config_id, picture_width, picture_height, flag, render_targets, num_render_targets, context);
1080 VAStatus vaDestroyContext (
1085 VADriverContextP ctx;
1091 vaStatus = ctx->vtable->vaDestroyContext( ctx, context );
1093 VA_TRACE_ALL(va_TraceDestroyContext, dpy, context);
1098 VAStatus vaCreateBuffer (
1100 VAContextID context, /* in */
1101 VABufferType type, /* in */
1102 unsigned int size, /* in */
1103 unsigned int num_elements, /* in */
1104 void *data, /* in */
1105 VABufferID *buf_id /* out */
1108 VADriverContextP ctx;
1114 VA_FOOL_FUNC(va_FoolCreateBuffer, dpy, context, type, size, num_elements, data, buf_id);
1116 vaStatus = ctx->vtable->vaCreateBuffer( ctx, context, type, size, num_elements, data, buf_id);
1118 VA_TRACE_LOG(va_TraceCreateBuffer,
1119 dpy, context, type, size, num_elements, data, buf_id);
1124 VAStatus vaBufferSetNumElements (
1126 VABufferID buf_id, /* in */
1127 unsigned int num_elements /* in */
1130 VADriverContextP ctx;
1134 VA_FOOL_FUNC(va_FoolCheckContinuity, dpy);
1136 return ctx->vtable->vaBufferSetNumElements( ctx, buf_id, num_elements );
1140 VAStatus vaMapBuffer (
1142 VABufferID buf_id, /* in */
1143 void **pbuf /* out */
1146 VADriverContextP ctx;
1152 VA_FOOL_FUNC(va_FoolMapBuffer, dpy, buf_id, pbuf);
1154 va_status = ctx->vtable->vaMapBuffer( ctx, buf_id, pbuf );
1156 VA_TRACE_ALL(va_TraceMapBuffer, dpy, buf_id, pbuf);
1161 VAStatus vaUnmapBuffer (
1163 VABufferID buf_id /* in */
1166 VADriverContextP ctx;
1170 VA_FOOL_FUNC(va_FoolCheckContinuity, dpy);
1172 return ctx->vtable->vaUnmapBuffer( ctx, buf_id );
1175 VAStatus vaDestroyBuffer (
1177 VABufferID buffer_id
1180 VADriverContextP ctx;
1184 VA_FOOL_FUNC(va_FoolCheckContinuity, dpy);
1186 VA_TRACE_LOG(va_TraceDestroyBuffer,
1189 return ctx->vtable->vaDestroyBuffer( ctx, buffer_id );
1192 VAStatus vaBufferInfo (
1194 VAContextID context, /* in */
1195 VABufferID buf_id, /* in */
1196 VABufferType *type, /* out */
1197 unsigned int *size, /* out */
1198 unsigned int *num_elements /* out */
1201 VADriverContextP ctx;
1206 VA_FOOL_FUNC(va_FoolBufferInfo, dpy, buf_id, type, size, num_elements);
1208 return ctx->vtable->vaBufferInfo( ctx, buf_id, type, size, num_elements );
1211 /* Locks buffer for external API usage */
1213 vaAcquireBufferHandle(VADisplay dpy, VABufferID buf_id, VABufferInfo *buf_info)
1215 VADriverContextP ctx;
1220 if (!ctx->vtable->vaAcquireBufferHandle)
1221 return VA_STATUS_ERROR_UNIMPLEMENTED;
1222 return ctx->vtable->vaAcquireBufferHandle(ctx, buf_id, buf_info);
1225 /* Unlocks buffer after usage from external API */
1227 vaReleaseBufferHandle(VADisplay dpy, VABufferID buf_id)
1229 VADriverContextP ctx;
1234 if (!ctx->vtable->vaReleaseBufferHandle)
1235 return VA_STATUS_ERROR_UNIMPLEMENTED;
1236 return ctx->vtable->vaReleaseBufferHandle(ctx, buf_id);
1239 VAStatus vaBeginPicture (
1241 VAContextID context,
1242 VASurfaceID render_target
1245 VADriverContextP ctx;
1251 VA_TRACE_ALL(va_TraceBeginPicture, dpy, context, render_target);
1252 VA_FOOL_FUNC(va_FoolCheckContinuity, dpy);
1254 va_status = ctx->vtable->vaBeginPicture( ctx, context, render_target );
1259 VAStatus vaRenderPicture (
1261 VAContextID context,
1262 VABufferID *buffers,
1266 VADriverContextP ctx;
1271 VA_TRACE_LOG(va_TraceRenderPicture, dpy, context, buffers, num_buffers);
1272 VA_FOOL_FUNC(va_FoolCheckContinuity, dpy);
1274 return ctx->vtable->vaRenderPicture( ctx, context, buffers, num_buffers );
1277 VAStatus vaEndPicture (
1282 VAStatus va_status = VA_STATUS_SUCCESS;
1283 VADriverContextP ctx;
1288 VA_FOOL_FUNC(va_FoolCheckContinuity, dpy);
1290 va_status = ctx->vtable->vaEndPicture( ctx, context );
1292 /* dump surface content */
1293 VA_TRACE_ALL(va_TraceEndPicture, dpy, context, 1);
1298 VAStatus vaSyncSurface (
1300 VASurfaceID render_target
1304 VADriverContextP ctx;
1309 va_status = ctx->vtable->vaSyncSurface( ctx, render_target );
1310 VA_TRACE_LOG(va_TraceSyncSurface, dpy, render_target);
1315 VAStatus vaQuerySurfaceStatus (
1317 VASurfaceID render_target,
1318 VASurfaceStatus *status /* out */
1322 VADriverContextP ctx;
1326 va_status = ctx->vtable->vaQuerySurfaceStatus( ctx, render_target, status );
1328 VA_TRACE_LOG(va_TraceQuerySurfaceStatus, dpy, render_target, status);
1333 VAStatus vaQuerySurfaceError (
1335 VASurfaceID surface,
1336 VAStatus error_status,
1337 void **error_info /*out*/
1341 VADriverContextP ctx;
1345 va_status = ctx->vtable->vaQuerySurfaceError( ctx, surface, error_status, error_info );
1347 VA_TRACE_LOG(va_TraceQuerySurfaceError, dpy, surface, error_status, error_info);
1352 /* Get maximum number of image formats supported by the implementation */
1353 int vaMaxNumImageFormats (
1357 if (!vaDisplayIsValid(dpy))
1360 return CTX(dpy)->max_image_formats;
1363 VAStatus vaQueryImageFormats (
1365 VAImageFormat *format_list, /* out */
1366 int *num_formats /* out */
1369 VADriverContextP ctx;
1373 return ctx->vtable->vaQueryImageFormats ( ctx, format_list, num_formats);
1377 * The width and height fields returned in the VAImage structure may get
1378 * enlarged for some YUV formats. The size of the data buffer that needs
1379 * to be allocated will be given in the "data_size" field in VAImage.
1380 * Image data is not allocated by this function. The client should
1381 * allocate the memory and fill in the VAImage structure's data field
1382 * after looking at "data_size" returned from the library.
1384 VAStatus vaCreateImage (
1386 VAImageFormat *format,
1389 VAImage *image /* out */
1392 VADriverContextP ctx;
1396 return ctx->vtable->vaCreateImage ( ctx, format, width, height, image);
1400 * Should call DestroyImage before destroying the surface it is bound to
1402 VAStatus vaDestroyImage (
1407 VADriverContextP ctx;
1411 return ctx->vtable->vaDestroyImage ( ctx, image);
1414 VAStatus vaSetImagePalette (
1417 unsigned char *palette
1420 VADriverContextP ctx;
1424 return ctx->vtable->vaSetImagePalette ( ctx, image, palette);
1428 * Retrieve surface data into a VAImage
1429 * Image must be in a format supported by the implementation
1431 VAStatus vaGetImage (
1433 VASurfaceID surface,
1434 int x, /* coordinates of the upper left source pixel */
1436 unsigned int width, /* width and height of the region */
1437 unsigned int height,
1441 VADriverContextP ctx;
1445 return ctx->vtable->vaGetImage ( ctx, surface, x, y, width, height, image);
1449 * Copy data from a VAImage to a surface
1450 * Image must be in a format supported by the implementation
1452 VAStatus vaPutImage (
1454 VASurfaceID surface,
1458 unsigned int src_width,
1459 unsigned int src_height,
1462 unsigned int dest_width,
1463 unsigned int dest_height
1466 VADriverContextP ctx;
1470 return ctx->vtable->vaPutImage ( ctx, surface, image, src_x, src_y, src_width, src_height, dest_x, dest_y, dest_width, dest_height );
1474 * Derive an VAImage from an existing surface.
1475 * This interface will derive a VAImage and corresponding image buffer from
1476 * an existing VA Surface. The image buffer can then be mapped/unmapped for
1477 * direct CPU access. This operation is only possible on implementations with
1478 * direct rendering capabilities and internal surface formats that can be
1479 * represented with a VAImage. When the operation is not possible this interface
1480 * will return VA_STATUS_ERROR_OPERATION_FAILED. Clients should then fall back
1481 * to using vaCreateImage + vaPutImage to accomplish the same task in an
1484 * Implementations should only return success when the resulting image buffer
1485 * would be useable with vaMap/Unmap.
1487 * When directly accessing a surface special care must be taken to insure
1488 * proper synchronization with the graphics hardware. Clients should call
1489 * vaQuerySurfaceStatus to insure that a surface is not the target of concurrent
1490 * rendering or currently being displayed by an overlay.
1492 * Additionally nothing about the contents of a surface should be assumed
1493 * following a vaPutSurface. Implementations are free to modify the surface for
1494 * scaling or subpicture blending within a call to vaPutImage.
1496 * Calls to vaPutImage or vaGetImage using the same surface from which the image
1497 * has been derived will return VA_STATUS_ERROR_SURFACE_BUSY. vaPutImage or
1498 * vaGetImage with other surfaces is supported.
1500 * An image created with vaDeriveImage should be freed with vaDestroyImage. The
1501 * image and image buffer structures will be destroyed; however, the underlying
1502 * surface will remain unchanged until freed with vaDestroySurfaces.
1504 VAStatus vaDeriveImage (
1506 VASurfaceID surface,
1507 VAImage *image /* out */
1510 VADriverContextP ctx;
1514 return ctx->vtable->vaDeriveImage ( ctx, surface, image );
1518 /* Get maximum number of subpicture formats supported by the implementation */
1519 int vaMaxNumSubpictureFormats (
1523 if (!vaDisplayIsValid(dpy))
1526 return CTX(dpy)->max_subpic_formats;
1530 * Query supported subpicture formats
1531 * The caller must provide a "format_list" array that can hold at
1532 * least vaMaxNumSubpictureFormats() entries. The flags arrary holds the flag
1533 * for each format to indicate additional capabilities for that format. The actual
1534 * number of formats returned in "format_list" is returned in "num_formats".
1536 VAStatus vaQuerySubpictureFormats (
1538 VAImageFormat *format_list, /* out */
1539 unsigned int *flags, /* out */
1540 unsigned int *num_formats /* out */
1543 VADriverContextP ctx;
1548 return ctx->vtable->vaQuerySubpictureFormats ( ctx, format_list, flags, num_formats);
1552 * Subpictures are created with an image associated.
1554 VAStatus vaCreateSubpicture (
1557 VASubpictureID *subpicture /* out */
1560 VADriverContextP ctx;
1564 return ctx->vtable->vaCreateSubpicture ( ctx, image, subpicture );
1568 * Destroy the subpicture before destroying the image it is assocated to
1570 VAStatus vaDestroySubpicture (
1572 VASubpictureID subpicture
1575 VADriverContextP ctx;
1579 return ctx->vtable->vaDestroySubpicture ( ctx, subpicture);
1582 VAStatus vaSetSubpictureImage (
1584 VASubpictureID subpicture,
1588 VADriverContextP ctx;
1592 return ctx->vtable->vaSetSubpictureImage ( ctx, subpicture, image);
1597 * If chromakey is enabled, then the area where the source value falls within
1598 * the chromakey [min, max] range is transparent
1600 VAStatus vaSetSubpictureChromakey (
1602 VASubpictureID subpicture,
1603 unsigned int chromakey_min,
1604 unsigned int chromakey_max,
1605 unsigned int chromakey_mask
1608 VADriverContextP ctx;
1612 return ctx->vtable->vaSetSubpictureChromakey ( ctx, subpicture, chromakey_min, chromakey_max, chromakey_mask );
1617 * Global alpha value is between 0 and 1. A value of 1 means fully opaque and
1618 * a value of 0 means fully transparent. If per-pixel alpha is also specified then
1619 * the overall alpha is per-pixel alpha multiplied by the global alpha
1621 VAStatus vaSetSubpictureGlobalAlpha (
1623 VASubpictureID subpicture,
1627 VADriverContextP ctx;
1631 return ctx->vtable->vaSetSubpictureGlobalAlpha ( ctx, subpicture, global_alpha );
1635 vaAssociateSubpicture associates the subpicture with the target_surface.
1636 It defines the region mapping between the subpicture and the target
1637 surface through source and destination rectangles (with the same width and height).
1638 Both will be displayed at the next call to vaPutSurface. Additional
1639 associations before the call to vaPutSurface simply overrides the association.
1641 VAStatus vaAssociateSubpicture (
1643 VASubpictureID subpicture,
1644 VASurfaceID *target_surfaces,
1646 short src_x, /* upper left offset in subpicture */
1648 unsigned short src_width,
1649 unsigned short src_height,
1650 short dest_x, /* upper left offset in surface */
1652 unsigned short dest_width,
1653 unsigned short dest_height,
1655 * whether to enable chroma-keying or global-alpha
1656 * see VA_SUBPICTURE_XXX values
1661 VADriverContextP ctx;
1665 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 );
1669 * vaDeassociateSubpicture removes the association of the subpicture with target_surfaces.
1671 VAStatus vaDeassociateSubpicture (
1673 VASubpictureID subpicture,
1674 VASurfaceID *target_surfaces,
1678 VADriverContextP ctx;
1682 return ctx->vtable->vaDeassociateSubpicture ( ctx, subpicture, target_surfaces, num_surfaces );
1686 /* Get maximum number of display attributes supported by the implementation */
1687 int vaMaxNumDisplayAttributes (
1693 if (!vaDisplayIsValid(dpy))
1696 tmp = CTX(dpy)->max_display_attributes;
1698 VA_TRACE_LOG(va_TraceMaxNumDisplayAttributes, dpy, tmp);
1704 * Query display attributes
1705 * The caller must provide a "attr_list" array that can hold at
1706 * least vaMaxNumDisplayAttributes() entries. The actual number of attributes
1707 * returned in "attr_list" is returned in "num_attributes".
1709 VAStatus vaQueryDisplayAttributes (
1711 VADisplayAttribute *attr_list, /* out */
1712 int *num_attributes /* out */
1715 VADriverContextP ctx;
1720 va_status = ctx->vtable->vaQueryDisplayAttributes ( ctx, attr_list, num_attributes );
1722 VA_TRACE_LOG(va_TraceQueryDisplayAttributes, dpy, attr_list, num_attributes);
1729 * Get display attributes
1730 * This function returns the current attribute values in "attr_list".
1731 * Only attributes returned with VA_DISPLAY_ATTRIB_GETTABLE set in the "flags" field
1732 * from vaQueryDisplayAttributes() can have their values retrieved.
1734 VAStatus vaGetDisplayAttributes (
1736 VADisplayAttribute *attr_list, /* in/out */
1740 VADriverContextP ctx;
1745 va_status = ctx->vtable->vaGetDisplayAttributes ( ctx, attr_list, num_attributes );
1747 VA_TRACE_LOG(va_TraceGetDisplayAttributes, dpy, attr_list, num_attributes);
1753 * Set display attributes
1754 * Only attributes returned with VA_DISPLAY_ATTRIB_SETTABLE set in the "flags" field
1755 * from vaQueryDisplayAttributes() can be set. If the attribute is not settable or
1756 * the value is out of range, the function returns VA_STATUS_ERROR_ATTR_NOT_SUPPORTED
1758 VAStatus vaSetDisplayAttributes (
1760 VADisplayAttribute *attr_list,
1764 VADriverContextP ctx;
1769 va_status = ctx->vtable->vaSetDisplayAttributes ( ctx, attr_list, num_attributes );
1770 VA_TRACE_LOG(va_TraceSetDisplayAttributes, dpy, attr_list, num_attributes);
1775 VAStatus vaLockSurface(VADisplay dpy,
1776 VASurfaceID surface,
1777 unsigned int *fourcc, /* following are output argument */
1778 unsigned int *luma_stride,
1779 unsigned int *chroma_u_stride,
1780 unsigned int *chroma_v_stride,
1781 unsigned int *luma_offset,
1782 unsigned int *chroma_u_offset,
1783 unsigned int *chroma_v_offset,
1784 unsigned int *buffer_name,
1788 VADriverContextP ctx;
1792 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);
1796 VAStatus vaUnlockSurface(VADisplay dpy,
1800 VADriverContextP ctx;
1804 return ctx->vtable->vaUnlockSurface( ctx, surface );
1807 /* Video Processing */
1808 #define VA_VPP_INIT_CONTEXT(ctx, dpy) do { \
1809 CHECK_DISPLAY(dpy); \
1812 return VA_STATUS_ERROR_INVALID_DISPLAY; \
1815 #define VA_VPP_INVOKE(dpy, func, args) do { \
1816 if (!ctx->vtable_vpp->va##func) \
1817 return VA_STATUS_ERROR_UNIMPLEMENTED; \
1818 status = ctx->vtable_vpp->va##func args; \
1822 vaQueryVideoProcFilters(
1824 VAContextID context,
1825 VAProcFilterType *filters,
1826 unsigned int *num_filters
1829 VADriverContextP ctx;
1832 VA_VPP_INIT_CONTEXT(ctx, dpy);
1835 QueryVideoProcFilters,
1836 (ctx, context, filters, num_filters)
1842 vaQueryVideoProcFilterCaps(
1844 VAContextID context,
1845 VAProcFilterType type,
1847 unsigned int *num_filter_caps
1850 VADriverContextP ctx;
1853 VA_VPP_INIT_CONTEXT(ctx, dpy);
1856 QueryVideoProcFilterCaps,
1857 (ctx, context, type, filter_caps, num_filter_caps)
1863 vaQueryVideoProcPipelineCaps(
1865 VAContextID context,
1866 VABufferID *filters,
1867 unsigned int num_filters,
1868 VAProcPipelineCaps *pipeline_caps
1871 VADriverContextP ctx;
1874 VA_VPP_INIT_CONTEXT(ctx, dpy);
1877 QueryVideoProcPipelineCaps,
1878 (ctx, context, filters, num_filters, pipeline_caps)