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 char buf[512], *dynbuf;
162 if (va_log_error == NULL)
166 len = vsnprintf(buf, sizeof(buf), msg, args);
169 if (len >= (int)sizeof(buf)) {
170 dynbuf = malloc(len + 1);
174 n = vsnprintf(dynbuf, len + 1, msg, args);
177 va_log_error(dynbuf);
184 void va_infoMessage(const char *msg, ...)
186 char buf[512], *dynbuf;
190 if (va_log_info == NULL)
194 len = vsnprintf(buf, sizeof(buf), msg, args);
197 if (len >= (int)sizeof(buf)) {
198 dynbuf = malloc(len + 1);
202 n = vsnprintf(dynbuf, len + 1, msg, args);
212 static bool va_checkVtable(void *ptr, char *function)
215 va_errorMessage("No valid vtable entry for va%s\n", function);
221 static bool va_checkMaximum(int value, char *variable)
224 va_errorMessage("Failed to define max_%s in init\n", variable);
230 static bool va_checkString(const char* value, char *variable)
233 va_errorMessage("Failed to define str_%s in init\n", variable);
240 va_getDriverInitName(char *name, int namelen, int major, int minor)
242 int ret = snprintf(name, namelen, "__vaDriverInit_%d_%d", major, minor);
243 return ret > 0 && ret < namelen;
246 static VAStatus va_getDriverName(VADisplay dpy, char **driver_name)
248 VADisplayContextP pDisplayContext = (VADisplayContextP)dpy;
250 return pDisplayContext->vaGetDriverName(pDisplayContext, driver_name);
253 static VAStatus va_openDriver(VADisplay dpy, char *driver_name)
255 VADriverContextP ctx = CTX(dpy);
256 VAStatus vaStatus = VA_STATUS_ERROR_UNKNOWN;
257 char *search_path = NULL;
261 if (geteuid() == getuid())
262 /* don't allow setuid apps to use LIBVA_DRIVERS_PATH */
263 search_path = getenv("LIBVA_DRIVERS_PATH");
265 search_path = VA_DRIVERS_PATH;
267 search_path = strdup((const char *)search_path);
268 driver_dir = strtok_r(search_path, ":", &saveptr);
271 char *driver_path = (char *) malloc( strlen(driver_dir) +
272 strlen(driver_name) +
273 strlen(DRIVER_EXTENSION) + 2 );
275 va_errorMessage("%s L%d Out of memory!n",
276 __FUNCTION__, __LINE__);
278 return VA_STATUS_ERROR_ALLOCATION_FAILED;
281 strncpy( driver_path, driver_dir, strlen(driver_dir) + 1);
282 strncat( driver_path, "/", strlen("/") );
283 strncat( driver_path, driver_name, strlen(driver_name) );
284 strncat( driver_path, DRIVER_EXTENSION, strlen(DRIVER_EXTENSION) );
286 va_infoMessage("Trying to open %s\n", driver_path);
288 handle = dlopen( driver_path, RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE );
290 handle = dlopen( driver_path, RTLD_NOW| RTLD_GLOBAL);
293 /* Don't give errors for non-existing files */
294 if (0 == access( driver_path, F_OK))
295 va_errorMessage("dlopen of %s failed: %s\n", driver_path, dlerror());
297 VADriverInit init_func = NULL;
298 char init_func_s[256];
301 static const struct {
304 } compatible_versions[] = {
305 { VA_MAJOR_VERSION, VA_MINOR_VERSION },
316 for (i = 0; compatible_versions[i].major >= 0; i++) {
317 if (va_getDriverInitName(init_func_s, sizeof(init_func_s),
318 compatible_versions[i].major,
319 compatible_versions[i].minor)) {
320 init_func = (VADriverInit)dlsym(handle, init_func_s);
322 va_infoMessage("Found init function %s\n", init_func_s);
328 if (compatible_versions[i].major < 0) {
329 va_errorMessage("%s has no function %s\n",
330 driver_path, init_func_s);
333 struct VADriverVTable *vtable = ctx->vtable;
334 struct VADriverVTableVPP *vtable_vpp = ctx->vtable_vpp;
336 vaStatus = VA_STATUS_SUCCESS;
338 vtable = calloc(1, sizeof(*vtable));
340 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
342 ctx->vtable = vtable;
345 vtable_vpp = calloc(1, sizeof(*vtable_vpp));
347 vtable_vpp->version = VA_DRIVER_VTABLE_VPP_VERSION;
349 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
351 ctx->vtable_vpp = vtable_vpp;
353 if (init_func && VA_STATUS_SUCCESS == vaStatus)
354 vaStatus = (*init_func)(ctx);
356 if (VA_STATUS_SUCCESS == vaStatus) {
357 CHECK_MAXIMUM(vaStatus, ctx, profiles);
358 CHECK_MAXIMUM(vaStatus, ctx, entrypoints);
359 CHECK_MAXIMUM(vaStatus, ctx, attributes);
360 CHECK_MAXIMUM(vaStatus, ctx, image_formats);
361 CHECK_MAXIMUM(vaStatus, ctx, subpic_formats);
362 CHECK_MAXIMUM(vaStatus, ctx, display_attributes);
363 CHECK_STRING(vaStatus, ctx, vendor);
364 CHECK_VTABLE(vaStatus, ctx, Terminate);
365 CHECK_VTABLE(vaStatus, ctx, QueryConfigProfiles);
366 CHECK_VTABLE(vaStatus, ctx, QueryConfigEntrypoints);
367 CHECK_VTABLE(vaStatus, ctx, QueryConfigAttributes);
368 CHECK_VTABLE(vaStatus, ctx, CreateConfig);
369 CHECK_VTABLE(vaStatus, ctx, DestroyConfig);
370 CHECK_VTABLE(vaStatus, ctx, GetConfigAttributes);
371 CHECK_VTABLE(vaStatus, ctx, CreateSurfaces);
372 CHECK_VTABLE(vaStatus, ctx, DestroySurfaces);
373 CHECK_VTABLE(vaStatus, ctx, CreateContext);
374 CHECK_VTABLE(vaStatus, ctx, DestroyContext);
375 CHECK_VTABLE(vaStatus, ctx, CreateBuffer);
376 CHECK_VTABLE(vaStatus, ctx, BufferSetNumElements);
377 CHECK_VTABLE(vaStatus, ctx, MapBuffer);
378 CHECK_VTABLE(vaStatus, ctx, UnmapBuffer);
379 CHECK_VTABLE(vaStatus, ctx, DestroyBuffer);
380 CHECK_VTABLE(vaStatus, ctx, BeginPicture);
381 CHECK_VTABLE(vaStatus, ctx, RenderPicture);
382 CHECK_VTABLE(vaStatus, ctx, EndPicture);
383 CHECK_VTABLE(vaStatus, ctx, SyncSurface);
384 CHECK_VTABLE(vaStatus, ctx, QuerySurfaceStatus);
385 CHECK_VTABLE(vaStatus, ctx, PutSurface);
386 CHECK_VTABLE(vaStatus, ctx, QueryImageFormats);
387 CHECK_VTABLE(vaStatus, ctx, CreateImage);
388 CHECK_VTABLE(vaStatus, ctx, DeriveImage);
389 CHECK_VTABLE(vaStatus, ctx, DestroyImage);
390 CHECK_VTABLE(vaStatus, ctx, SetImagePalette);
391 CHECK_VTABLE(vaStatus, ctx, GetImage);
392 CHECK_VTABLE(vaStatus, ctx, PutImage);
393 CHECK_VTABLE(vaStatus, ctx, QuerySubpictureFormats);
394 CHECK_VTABLE(vaStatus, ctx, CreateSubpicture);
395 CHECK_VTABLE(vaStatus, ctx, DestroySubpicture);
396 CHECK_VTABLE(vaStatus, ctx, SetSubpictureImage);
397 CHECK_VTABLE(vaStatus, ctx, SetSubpictureChromakey);
398 CHECK_VTABLE(vaStatus, ctx, SetSubpictureGlobalAlpha);
399 CHECK_VTABLE(vaStatus, ctx, AssociateSubpicture);
400 CHECK_VTABLE(vaStatus, ctx, DeassociateSubpicture);
401 CHECK_VTABLE(vaStatus, ctx, QueryDisplayAttributes);
402 CHECK_VTABLE(vaStatus, ctx, GetDisplayAttributes);
403 CHECK_VTABLE(vaStatus, ctx, SetDisplayAttributes);
405 if (VA_STATUS_SUCCESS != vaStatus) {
406 va_errorMessage("%s init failed\n", driver_path);
409 if (VA_STATUS_SUCCESS == vaStatus)
410 ctx->handle = handle;
417 driver_dir = strtok_r(NULL, ":", &saveptr);
425 VAPrivFunc vaGetLibFunc(VADisplay dpy, const char *func)
427 VADriverContextP ctx;
428 if (!vaDisplayIsValid(dpy))
432 if (NULL == ctx->handle)
435 return (VAPrivFunc) dlsym(ctx->handle, func);
440 * Returns a short english description of error_status
442 const char *vaErrorStr(VAStatus error_status)
444 switch(error_status) {
445 case VA_STATUS_SUCCESS:
446 return "success (no error)";
447 case VA_STATUS_ERROR_OPERATION_FAILED:
448 return "operation failed";
449 case VA_STATUS_ERROR_ALLOCATION_FAILED:
450 return "resource allocation failed";
451 case VA_STATUS_ERROR_INVALID_DISPLAY:
452 return "invalid VADisplay";
453 case VA_STATUS_ERROR_INVALID_CONFIG:
454 return "invalid VAConfigID";
455 case VA_STATUS_ERROR_INVALID_CONTEXT:
456 return "invalid VAContextID";
457 case VA_STATUS_ERROR_INVALID_SURFACE:
458 return "invalid VASurfaceID";
459 case VA_STATUS_ERROR_INVALID_BUFFER:
460 return "invalid VABufferID";
461 case VA_STATUS_ERROR_INVALID_IMAGE:
462 return "invalid VAImageID";
463 case VA_STATUS_ERROR_INVALID_SUBPICTURE:
464 return "invalid VASubpictureID";
465 case VA_STATUS_ERROR_ATTR_NOT_SUPPORTED:
466 return "attribute not supported";
467 case VA_STATUS_ERROR_MAX_NUM_EXCEEDED:
468 return "list argument exceeds maximum number";
469 case VA_STATUS_ERROR_UNSUPPORTED_PROFILE:
470 return "the requested VAProfile is not supported";
471 case VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT:
472 return "the requested VAEntryPoint is not supported";
473 case VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT:
474 return "the requested RT Format is not supported";
475 case VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE:
476 return "the requested VABufferType is not supported";
477 case VA_STATUS_ERROR_SURFACE_BUSY:
478 return "surface is in use";
479 case VA_STATUS_ERROR_FLAG_NOT_SUPPORTED:
480 return "flag not supported";
481 case VA_STATUS_ERROR_INVALID_PARAMETER:
482 return "invalid parameter";
483 case VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED:
484 return "resolution not supported";
485 case VA_STATUS_ERROR_UNIMPLEMENTED:
486 return "the requested function is not implemented";
487 case VA_STATUS_ERROR_SURFACE_IN_DISPLAYING:
488 return "surface is in displaying (may by overlay)" ;
489 case VA_STATUS_ERROR_INVALID_IMAGE_FORMAT:
490 return "invalid VAImageFormat";
491 case VA_STATUS_ERROR_INVALID_VALUE:
492 return "an invalid/unsupported value was supplied";
493 case VA_STATUS_ERROR_UNSUPPORTED_FILTER:
494 return "the requested filter is not supported";
495 case VA_STATUS_ERROR_INVALID_FILTER_CHAIN:
496 return "an invalid filter chain was supplied";
497 case VA_STATUS_ERROR_UNKNOWN:
498 return "unknown libva error";
500 return "unknown libva error / description missing";
503 const static char *prefer_driver_list[4] = {
510 VAStatus vaSetDriverName(
515 VADriverContextP ctx;
516 VAStatus vaStatus = VA_STATUS_SUCCESS;
517 char *override_driver_name = NULL;
521 if (geteuid() != getuid()) {
522 vaStatus = VA_STATUS_ERROR_OPERATION_FAILED;
523 va_errorMessage("no permission to vaSetDriverName\n");
527 if (strlen(driver_name) == 0 || strlen(driver_name) >=256) {
528 vaStatus = VA_STATUS_ERROR_INVALID_PARAMETER;
529 va_errorMessage("vaSetDriverName returns %s\n",
530 vaErrorStr(vaStatus));
535 for (i = 0; i < sizeof(prefer_driver_list) / sizeof(char *); i++) {
536 if (strlen(prefer_driver_list[i]) != strlen(driver_name))
538 if (!strncmp(prefer_driver_list[i], driver_name, strlen(driver_name))) {
545 vaStatus = VA_STATUS_ERROR_INVALID_PARAMETER;
546 va_errorMessage("vaSetDriverName returns %s. Incorrect parameter\n",
547 vaErrorStr(vaStatus));
551 override_driver_name = strdup(driver_name);
553 if (!override_driver_name) {
554 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
555 va_errorMessage("vaSetDriverName returns %s. Out of Memory\n",
556 vaErrorStr(vaStatus));
560 ctx->override_driver_name = override_driver_name;
561 return VA_STATUS_SUCCESS;
564 VAStatus vaInitialize (
566 int *major_version, /* out */
567 int *minor_version /* out */
570 const char *driver_name_env = NULL;
571 char *driver_name = NULL;
573 VADriverContextP ctx;
583 va_infoMessage("VA-API version %s\n", VA_VERSION_S);
585 vaStatus = va_getDriverName(dpy, &driver_name);
587 if (!ctx->override_driver_name) {
588 va_infoMessage("va_getDriverName() returns %d\n", vaStatus);
590 driver_name_env = getenv("LIBVA_DRIVER_NAME");
591 } else if (vaStatus == VA_STATUS_SUCCESS) {
595 driver_name = strdup(ctx->override_driver_name);
597 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
598 va_errorMessage("vaInitialize() failed with %s, out of memory\n",
599 vaErrorStr(vaStatus));
602 va_infoMessage("User requested driver '%s'\n", driver_name);
605 if (driver_name_env && (geteuid() == getuid())) {
606 /* Don't allow setuid apps to use LIBVA_DRIVER_NAME */
607 if (driver_name) /* memory is allocated in va_getDriverName */
610 driver_name = strdup(driver_name_env);
611 vaStatus = VA_STATUS_SUCCESS;
612 va_infoMessage("User requested driver '%s'\n", driver_name);
615 if ((VA_STATUS_SUCCESS == vaStatus) && (driver_name != NULL)) {
616 vaStatus = va_openDriver(dpy, driver_name);
617 va_infoMessage("va_openDriver() returns %d\n", vaStatus);
619 *major_version = VA_MAJOR_VERSION;
620 *minor_version = VA_MINOR_VERSION;
622 va_errorMessage("va_getDriverName() failed with %s,driver_name=%s\n",
623 vaErrorStr(vaStatus), driver_name);
628 VA_TRACE_LOG(va_TraceInitialize, dpy, major_version, minor_version);
635 * After this call, all library internal resources will be cleaned up
637 VAStatus vaTerminate (
641 VAStatus vaStatus = VA_STATUS_SUCCESS;
642 VADisplayContextP pDisplayContext = (VADisplayContextP)dpy;
643 VADriverContextP old_ctx;
648 if (old_ctx->handle) {
649 vaStatus = old_ctx->vtable->vaTerminate(old_ctx);
650 dlclose(old_ctx->handle);
651 old_ctx->handle = NULL;
653 free(old_ctx->vtable);
654 old_ctx->vtable = NULL;
655 free(old_ctx->vtable_vpp);
656 old_ctx->vtable_vpp = NULL;
658 if (old_ctx->override_driver_name) {
659 free(old_ctx->override_driver_name);
660 old_ctx->override_driver_name = NULL;
663 VA_TRACE_LOG(va_TraceTerminate, dpy);
669 if (VA_STATUS_SUCCESS == vaStatus)
670 pDisplayContext->vaDestroy(pDisplayContext);
676 * vaQueryVendorString returns a pointer to a zero-terminated string
677 * describing some aspects of the VA implemenation on a specific
678 * hardware accelerator. The format of the returned string is:
679 * <vendorname>-<major_version>-<minor_version>-<addtional_info>
680 * e.g. for the Intel GMA500 implementation, an example would be:
681 * "IntelGMA500-1.0-0.2-patch3
683 const char *vaQueryVendorString (
687 if (!vaDisplayIsValid(dpy))
690 return CTX(dpy)->str_vendor;
694 /* Get maximum number of profiles supported by the implementation */
695 int vaMaxNumProfiles (
699 if (!vaDisplayIsValid(dpy))
702 return CTX(dpy)->max_profiles;
705 /* Get maximum number of entrypoints supported by the implementation */
706 int vaMaxNumEntrypoints (
710 if (!vaDisplayIsValid(dpy))
713 return CTX(dpy)->max_entrypoints;
717 /* Get maximum number of attributs supported by the implementation */
718 int vaMaxNumConfigAttributes (
722 if (!vaDisplayIsValid(dpy))
725 return CTX(dpy)->max_attributes;
728 VAStatus vaQueryConfigEntrypoints (
731 VAEntrypoint *entrypoints, /* out */
732 int *num_entrypoints /* out */
735 VADriverContextP ctx;
739 return ctx->vtable->vaQueryConfigEntrypoints ( ctx, profile, entrypoints, num_entrypoints);
742 VAStatus vaGetConfigAttributes (
745 VAEntrypoint entrypoint,
746 VAConfigAttrib *attrib_list, /* in/out */
750 VADriverContextP ctx;
754 return ctx->vtable->vaGetConfigAttributes ( ctx, profile, entrypoint, attrib_list, num_attribs );
757 VAStatus vaQueryConfigProfiles (
759 VAProfile *profile_list, /* out */
760 int *num_profiles /* out */
763 VADriverContextP ctx;
767 return ctx->vtable->vaQueryConfigProfiles ( ctx, profile_list, num_profiles );
770 VAStatus vaCreateConfig (
773 VAEntrypoint entrypoint,
774 VAConfigAttrib *attrib_list,
776 VAConfigID *config_id /* out */
779 VADriverContextP ctx;
780 VAStatus vaStatus = VA_STATUS_SUCCESS;
785 vaStatus = ctx->vtable->vaCreateConfig ( ctx, profile, entrypoint, attrib_list, num_attribs, config_id );
787 /* record the current entrypoint for further trace/fool determination */
788 VA_TRACE_ALL(va_TraceCreateConfig, dpy, profile, entrypoint, attrib_list, num_attribs, config_id);
789 VA_FOOL_FUNC(va_FoolCreateConfig, dpy, profile, entrypoint, attrib_list, num_attribs, config_id);
794 VAStatus vaDestroyConfig (
799 VADriverContextP ctx;
800 VAStatus vaStatus = VA_STATUS_SUCCESS;
805 vaStatus = ctx->vtable->vaDestroyConfig ( ctx, config_id );
807 VA_TRACE_ALL(va_TraceDestroyConfig, dpy, config_id);
812 VAStatus vaQueryConfigAttributes (
814 VAConfigID config_id,
815 VAProfile *profile, /* out */
816 VAEntrypoint *entrypoint, /* out */
817 VAConfigAttrib *attrib_list,/* out */
818 int *num_attribs /* out */
821 VADriverContextP ctx;
825 return ctx->vtable->vaQueryConfigAttributes( ctx, config_id, profile, entrypoint, attrib_list, num_attribs);
828 /* XXX: this is a slow implementation that will be removed */
830 va_impl_query_surface_attributes(
831 VADriverContextP ctx,
833 VASurfaceAttrib *out_attribs,
834 unsigned int *out_num_attribs_ptr
837 VASurfaceAttrib *attribs = NULL;
838 unsigned int num_attribs, n;
839 VASurfaceAttrib *out_attrib;
840 unsigned int out_num_attribs;
841 VAImageFormat *image_formats = NULL;
842 int num_image_formats, i;
845 /* List of surface attributes to query */
846 struct va_surface_attrib_map {
847 VASurfaceAttribType type;
848 VAGenericValueType value_type;
850 static const struct va_surface_attrib_map attribs_map[] = {
851 { VASurfaceAttribMinWidth, VAGenericValueTypeInteger },
852 { VASurfaceAttribMaxWidth, VAGenericValueTypeInteger },
853 { VASurfaceAttribMinHeight, VAGenericValueTypeInteger },
854 { VASurfaceAttribMaxHeight, VAGenericValueTypeInteger },
855 { VASurfaceAttribMemoryType, VAGenericValueTypeInteger },
856 { VASurfaceAttribNone, }
859 if (!out_attribs || !out_num_attribs_ptr)
860 return VA_STATUS_ERROR_INVALID_PARAMETER;
861 if (!ctx->vtable->vaGetSurfaceAttributes)
862 return VA_STATUS_ERROR_UNIMPLEMENTED;
864 num_image_formats = ctx->max_image_formats;
865 image_formats = malloc(num_image_formats * sizeof(*image_formats));
866 if (!image_formats) {
867 va_status = VA_STATUS_ERROR_ALLOCATION_FAILED;
871 va_status = ctx->vtable->vaQueryImageFormats(
872 ctx, image_formats, &num_image_formats);
873 if (va_status != VA_STATUS_SUCCESS)
876 num_attribs = VASurfaceAttribCount + num_image_formats;
877 attribs = malloc(num_attribs * sizeof(*attribs));
879 va_status = VA_STATUS_ERROR_ALLOCATION_FAILED;
883 /* Initialize with base surface attributes, except pixel-formats */
884 for (n = 0; attribs_map[n].type != VASurfaceAttribNone; n++) {
885 VASurfaceAttrib * const attrib = &attribs[n];
886 attrib->type = attribs_map[n].type;
887 attrib->flags = VA_SURFACE_ATTRIB_GETTABLE;
888 attrib->value.type = attribs_map[n].value_type;
891 /* Append image formats */
892 for (i = 0; i < num_image_formats; i++) {
893 VASurfaceAttrib * const attrib = &attribs[n];
894 attrib->type = VASurfaceAttribPixelFormat;
895 attrib->flags = VA_SURFACE_ATTRIB_GETTABLE|VA_SURFACE_ATTRIB_SETTABLE;
896 attrib->value.type = VAGenericValueTypeInteger;
897 attrib->value.value.i = image_formats[i].fourcc;
898 if (++n == num_attribs) {
899 va_status = VA_STATUS_ERROR_ALLOCATION_FAILED;
905 va_status = ctx->vtable->vaGetSurfaceAttributes(
906 ctx, config, attribs, num_attribs);
907 if (va_status != VA_STATUS_SUCCESS)
910 /* Remove invalid entries */
912 for (n = 0; n < num_attribs; n++) {
913 VASurfaceAttrib * const attrib = &attribs[n];
915 if (attrib->flags == VA_SURFACE_ATTRIB_NOT_SUPPORTED)
918 // Accept all surface attributes that are not pixel-formats
919 if (attrib->type != VASurfaceAttribPixelFormat) {
924 // Drop invalid pixel-format attribute
925 if (!attrib->value.value.i) {
926 attrib->flags = VA_SURFACE_ATTRIB_NOT_SUPPORTED;
930 // Check for duplicates
931 int is_duplicate = 0;
932 for (i = n - 1; i >= 0 && !is_duplicate; i--) {
933 const VASurfaceAttrib * const prev_attrib = &attribs[i];
934 if (prev_attrib->type != VASurfaceAttribPixelFormat)
936 is_duplicate = prev_attrib->value.value.i == attrib->value.value.i;
939 attrib->flags = VA_SURFACE_ATTRIB_NOT_SUPPORTED;
944 if (*out_num_attribs_ptr < out_num_attribs) {
945 *out_num_attribs_ptr = out_num_attribs;
946 va_status = VA_STATUS_ERROR_MAX_NUM_EXCEEDED;
950 out_attrib = out_attribs;
951 for (n = 0; n < num_attribs; n++) {
952 const VASurfaceAttrib * const attrib = &attribs[n];
953 if (attrib->flags == VA_SURFACE_ATTRIB_NOT_SUPPORTED)
955 *out_attrib++ = *attrib;
965 vaQuerySurfaceAttributes(
968 VASurfaceAttrib *attrib_list,
969 unsigned int *num_attribs
972 VADriverContextP ctx;
978 return VA_STATUS_ERROR_INVALID_DISPLAY;
980 if (!ctx->vtable->vaQuerySurfaceAttributes)
981 vaStatus = va_impl_query_surface_attributes(ctx, config,
982 attrib_list, num_attribs);
984 vaStatus = ctx->vtable->vaQuerySurfaceAttributes(ctx, config,
985 attrib_list, num_attribs);
987 VA_TRACE_LOG(va_TraceQuerySurfaceAttributes, dpy, config, attrib_list, num_attribs);
998 VASurfaceID *surfaces,
999 unsigned int num_surfaces,
1000 VASurfaceAttrib *attrib_list,
1001 unsigned int num_attribs
1004 VADriverContextP ctx;
1010 return VA_STATUS_ERROR_INVALID_DISPLAY;
1012 if (ctx->vtable->vaCreateSurfaces2)
1013 vaStatus = ctx->vtable->vaCreateSurfaces2(ctx, format, width, height,
1014 surfaces, num_surfaces,
1015 attrib_list, num_attribs);
1016 else if (attrib_list && num_attribs > 0)
1017 vaStatus = VA_STATUS_ERROR_ATTR_NOT_SUPPORTED;
1019 vaStatus = ctx->vtable->vaCreateSurfaces(ctx, width, height, format,
1020 num_surfaces, surfaces);
1021 VA_TRACE_LOG(va_TraceCreateSurfaces,
1022 dpy, width, height, format, num_surfaces, surfaces,
1023 attrib_list, num_attribs);
1029 VAStatus vaDestroySurfaces (
1031 VASurfaceID *surface_list,
1035 VADriverContextP ctx;
1041 VA_TRACE_LOG(va_TraceDestroySurfaces,
1042 dpy, surface_list, num_surfaces);
1044 vaStatus = ctx->vtable->vaDestroySurfaces( ctx, surface_list, num_surfaces );
1049 VAStatus vaCreateContext (
1051 VAConfigID config_id,
1055 VASurfaceID *render_targets,
1056 int num_render_targets,
1057 VAContextID *context /* out */
1060 VADriverContextP ctx;
1066 vaStatus = ctx->vtable->vaCreateContext( ctx, config_id, picture_width, picture_height,
1067 flag, render_targets, num_render_targets, context );
1069 /* keep current encode/decode resoluton */
1070 VA_TRACE_ALL(va_TraceCreateContext, dpy, config_id, picture_width, picture_height, flag, render_targets, num_render_targets, context);
1075 VAStatus vaDestroyContext (
1080 VADriverContextP ctx;
1086 vaStatus = ctx->vtable->vaDestroyContext( ctx, context );
1088 VA_TRACE_ALL(va_TraceDestroyContext, dpy, context);
1093 VAStatus vaCreateBuffer (
1095 VAContextID context, /* in */
1096 VABufferType type, /* in */
1097 unsigned int size, /* in */
1098 unsigned int num_elements, /* in */
1099 void *data, /* in */
1100 VABufferID *buf_id /* out */
1103 VADriverContextP ctx;
1109 VA_FOOL_FUNC(va_FoolCreateBuffer, dpy, context, type, size, num_elements, data, buf_id);
1111 vaStatus = ctx->vtable->vaCreateBuffer( ctx, context, type, size, num_elements, data, buf_id);
1113 VA_TRACE_LOG(va_TraceCreateBuffer,
1114 dpy, context, type, size, num_elements, data, buf_id);
1119 VAStatus vaBufferSetNumElements (
1121 VABufferID buf_id, /* in */
1122 unsigned int num_elements /* in */
1125 VADriverContextP ctx;
1129 VA_FOOL_FUNC(va_FoolCheckContinuity, dpy);
1131 return ctx->vtable->vaBufferSetNumElements( ctx, buf_id, num_elements );
1135 VAStatus vaMapBuffer (
1137 VABufferID buf_id, /* in */
1138 void **pbuf /* out */
1141 VADriverContextP ctx;
1147 VA_FOOL_FUNC(va_FoolMapBuffer, dpy, buf_id, pbuf);
1149 va_status = ctx->vtable->vaMapBuffer( ctx, buf_id, pbuf );
1151 VA_TRACE_ALL(va_TraceMapBuffer, dpy, buf_id, pbuf);
1156 VAStatus vaUnmapBuffer (
1158 VABufferID buf_id /* in */
1161 VADriverContextP ctx;
1165 VA_FOOL_FUNC(va_FoolCheckContinuity, dpy);
1167 return ctx->vtable->vaUnmapBuffer( ctx, buf_id );
1170 VAStatus vaDestroyBuffer (
1172 VABufferID buffer_id
1175 VADriverContextP ctx;
1179 VA_FOOL_FUNC(va_FoolCheckContinuity, dpy);
1181 VA_TRACE_LOG(va_TraceDestroyBuffer,
1184 return ctx->vtable->vaDestroyBuffer( ctx, buffer_id );
1187 VAStatus vaBufferInfo (
1189 VAContextID context, /* in */
1190 VABufferID buf_id, /* in */
1191 VABufferType *type, /* out */
1192 unsigned int *size, /* out */
1193 unsigned int *num_elements /* out */
1196 VADriverContextP ctx;
1201 VA_FOOL_FUNC(va_FoolBufferInfo, dpy, buf_id, type, size, num_elements);
1203 return ctx->vtable->vaBufferInfo( ctx, buf_id, type, size, num_elements );
1206 /* Locks buffer for external API usage */
1208 vaAcquireBufferHandle(VADisplay dpy, VABufferID buf_id, VABufferInfo *buf_info)
1210 VADriverContextP ctx;
1215 if (!ctx->vtable->vaAcquireBufferHandle)
1216 return VA_STATUS_ERROR_UNIMPLEMENTED;
1217 return ctx->vtable->vaAcquireBufferHandle(ctx, buf_id, buf_info);
1220 /* Unlocks buffer after usage from external API */
1222 vaReleaseBufferHandle(VADisplay dpy, VABufferID buf_id)
1224 VADriverContextP ctx;
1229 if (!ctx->vtable->vaReleaseBufferHandle)
1230 return VA_STATUS_ERROR_UNIMPLEMENTED;
1231 return ctx->vtable->vaReleaseBufferHandle(ctx, buf_id);
1234 VAStatus vaBeginPicture (
1236 VAContextID context,
1237 VASurfaceID render_target
1240 VADriverContextP ctx;
1246 VA_TRACE_ALL(va_TraceBeginPicture, dpy, context, render_target);
1247 VA_FOOL_FUNC(va_FoolCheckContinuity, dpy);
1249 va_status = ctx->vtable->vaBeginPicture( ctx, context, render_target );
1254 VAStatus vaRenderPicture (
1256 VAContextID context,
1257 VABufferID *buffers,
1261 VADriverContextP ctx;
1266 VA_TRACE_LOG(va_TraceRenderPicture, dpy, context, buffers, num_buffers);
1267 VA_FOOL_FUNC(va_FoolCheckContinuity, dpy);
1269 return ctx->vtable->vaRenderPicture( ctx, context, buffers, num_buffers );
1272 VAStatus vaEndPicture (
1277 VAStatus va_status = VA_STATUS_SUCCESS;
1278 VADriverContextP ctx;
1283 VA_FOOL_FUNC(va_FoolCheckContinuity, dpy);
1285 va_status = ctx->vtable->vaEndPicture( ctx, context );
1287 /* dump surface content */
1288 VA_TRACE_ALL(va_TraceEndPicture, dpy, context, 1);
1293 VAStatus vaSyncSurface (
1295 VASurfaceID render_target
1299 VADriverContextP ctx;
1304 va_status = ctx->vtable->vaSyncSurface( ctx, render_target );
1305 VA_TRACE_LOG(va_TraceSyncSurface, dpy, render_target);
1310 VAStatus vaQuerySurfaceStatus (
1312 VASurfaceID render_target,
1313 VASurfaceStatus *status /* out */
1317 VADriverContextP ctx;
1321 va_status = ctx->vtable->vaQuerySurfaceStatus( ctx, render_target, status );
1323 VA_TRACE_LOG(va_TraceQuerySurfaceStatus, dpy, render_target, status);
1328 VAStatus vaQuerySurfaceError (
1330 VASurfaceID surface,
1331 VAStatus error_status,
1332 void **error_info /*out*/
1336 VADriverContextP ctx;
1340 va_status = ctx->vtable->vaQuerySurfaceError( ctx, surface, error_status, error_info );
1342 VA_TRACE_LOG(va_TraceQuerySurfaceError, dpy, surface, error_status, error_info);
1347 /* Get maximum number of image formats supported by the implementation */
1348 int vaMaxNumImageFormats (
1352 if (!vaDisplayIsValid(dpy))
1355 return CTX(dpy)->max_image_formats;
1358 VAStatus vaQueryImageFormats (
1360 VAImageFormat *format_list, /* out */
1361 int *num_formats /* out */
1364 VADriverContextP ctx;
1368 return ctx->vtable->vaQueryImageFormats ( ctx, format_list, num_formats);
1372 * The width and height fields returned in the VAImage structure may get
1373 * enlarged for some YUV formats. The size of the data buffer that needs
1374 * to be allocated will be given in the "data_size" field in VAImage.
1375 * Image data is not allocated by this function. The client should
1376 * allocate the memory and fill in the VAImage structure's data field
1377 * after looking at "data_size" returned from the library.
1379 VAStatus vaCreateImage (
1381 VAImageFormat *format,
1384 VAImage *image /* out */
1387 VADriverContextP ctx;
1391 return ctx->vtable->vaCreateImage ( ctx, format, width, height, image);
1395 * Should call DestroyImage before destroying the surface it is bound to
1397 VAStatus vaDestroyImage (
1402 VADriverContextP ctx;
1406 return ctx->vtable->vaDestroyImage ( ctx, image);
1409 VAStatus vaSetImagePalette (
1412 unsigned char *palette
1415 VADriverContextP ctx;
1419 return ctx->vtable->vaSetImagePalette ( ctx, image, palette);
1423 * Retrieve surface data into a VAImage
1424 * Image must be in a format supported by the implementation
1426 VAStatus vaGetImage (
1428 VASurfaceID surface,
1429 int x, /* coordinates of the upper left source pixel */
1431 unsigned int width, /* width and height of the region */
1432 unsigned int height,
1436 VADriverContextP ctx;
1440 return ctx->vtable->vaGetImage ( ctx, surface, x, y, width, height, image);
1444 * Copy data from a VAImage to a surface
1445 * Image must be in a format supported by the implementation
1447 VAStatus vaPutImage (
1449 VASurfaceID surface,
1453 unsigned int src_width,
1454 unsigned int src_height,
1457 unsigned int dest_width,
1458 unsigned int dest_height
1461 VADriverContextP ctx;
1465 return ctx->vtable->vaPutImage ( ctx, surface, image, src_x, src_y, src_width, src_height, dest_x, dest_y, dest_width, dest_height );
1469 * Derive an VAImage from an existing surface.
1470 * This interface will derive a VAImage and corresponding image buffer from
1471 * an existing VA Surface. The image buffer can then be mapped/unmapped for
1472 * direct CPU access. This operation is only possible on implementations with
1473 * direct rendering capabilities and internal surface formats that can be
1474 * represented with a VAImage. When the operation is not possible this interface
1475 * will return VA_STATUS_ERROR_OPERATION_FAILED. Clients should then fall back
1476 * to using vaCreateImage + vaPutImage to accomplish the same task in an
1479 * Implementations should only return success when the resulting image buffer
1480 * would be useable with vaMap/Unmap.
1482 * When directly accessing a surface special care must be taken to insure
1483 * proper synchronization with the graphics hardware. Clients should call
1484 * vaQuerySurfaceStatus to insure that a surface is not the target of concurrent
1485 * rendering or currently being displayed by an overlay.
1487 * Additionally nothing about the contents of a surface should be assumed
1488 * following a vaPutSurface. Implementations are free to modify the surface for
1489 * scaling or subpicture blending within a call to vaPutImage.
1491 * Calls to vaPutImage or vaGetImage using the same surface from which the image
1492 * has been derived will return VA_STATUS_ERROR_SURFACE_BUSY. vaPutImage or
1493 * vaGetImage with other surfaces is supported.
1495 * An image created with vaDeriveImage should be freed with vaDestroyImage. The
1496 * image and image buffer structures will be destroyed; however, the underlying
1497 * surface will remain unchanged until freed with vaDestroySurfaces.
1499 VAStatus vaDeriveImage (
1501 VASurfaceID surface,
1502 VAImage *image /* out */
1505 VADriverContextP ctx;
1509 return ctx->vtable->vaDeriveImage ( ctx, surface, image );
1513 /* Get maximum number of subpicture formats supported by the implementation */
1514 int vaMaxNumSubpictureFormats (
1518 if (!vaDisplayIsValid(dpy))
1521 return CTX(dpy)->max_subpic_formats;
1525 * Query supported subpicture formats
1526 * The caller must provide a "format_list" array that can hold at
1527 * least vaMaxNumSubpictureFormats() entries. The flags arrary holds the flag
1528 * for each format to indicate additional capabilities for that format. The actual
1529 * number of formats returned in "format_list" is returned in "num_formats".
1531 VAStatus vaQuerySubpictureFormats (
1533 VAImageFormat *format_list, /* out */
1534 unsigned int *flags, /* out */
1535 unsigned int *num_formats /* out */
1538 VADriverContextP ctx;
1543 return ctx->vtable->vaQuerySubpictureFormats ( ctx, format_list, flags, num_formats);
1547 * Subpictures are created with an image associated.
1549 VAStatus vaCreateSubpicture (
1552 VASubpictureID *subpicture /* out */
1555 VADriverContextP ctx;
1559 return ctx->vtable->vaCreateSubpicture ( ctx, image, subpicture );
1563 * Destroy the subpicture before destroying the image it is assocated to
1565 VAStatus vaDestroySubpicture (
1567 VASubpictureID subpicture
1570 VADriverContextP ctx;
1574 return ctx->vtable->vaDestroySubpicture ( ctx, subpicture);
1577 VAStatus vaSetSubpictureImage (
1579 VASubpictureID subpicture,
1583 VADriverContextP ctx;
1587 return ctx->vtable->vaSetSubpictureImage ( ctx, subpicture, image);
1592 * If chromakey is enabled, then the area where the source value falls within
1593 * the chromakey [min, max] range is transparent
1595 VAStatus vaSetSubpictureChromakey (
1597 VASubpictureID subpicture,
1598 unsigned int chromakey_min,
1599 unsigned int chromakey_max,
1600 unsigned int chromakey_mask
1603 VADriverContextP ctx;
1607 return ctx->vtable->vaSetSubpictureChromakey ( ctx, subpicture, chromakey_min, chromakey_max, chromakey_mask );
1612 * Global alpha value is between 0 and 1. A value of 1 means fully opaque and
1613 * a value of 0 means fully transparent. If per-pixel alpha is also specified then
1614 * the overall alpha is per-pixel alpha multiplied by the global alpha
1616 VAStatus vaSetSubpictureGlobalAlpha (
1618 VASubpictureID subpicture,
1622 VADriverContextP ctx;
1626 return ctx->vtable->vaSetSubpictureGlobalAlpha ( ctx, subpicture, global_alpha );
1630 vaAssociateSubpicture associates the subpicture with the target_surface.
1631 It defines the region mapping between the subpicture and the target
1632 surface through source and destination rectangles (with the same width and height).
1633 Both will be displayed at the next call to vaPutSurface. Additional
1634 associations before the call to vaPutSurface simply overrides the association.
1636 VAStatus vaAssociateSubpicture (
1638 VASubpictureID subpicture,
1639 VASurfaceID *target_surfaces,
1641 short src_x, /* upper left offset in subpicture */
1643 unsigned short src_width,
1644 unsigned short src_height,
1645 short dest_x, /* upper left offset in surface */
1647 unsigned short dest_width,
1648 unsigned short dest_height,
1650 * whether to enable chroma-keying or global-alpha
1651 * see VA_SUBPICTURE_XXX values
1656 VADriverContextP ctx;
1660 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 );
1664 * vaDeassociateSubpicture removes the association of the subpicture with target_surfaces.
1666 VAStatus vaDeassociateSubpicture (
1668 VASubpictureID subpicture,
1669 VASurfaceID *target_surfaces,
1673 VADriverContextP ctx;
1677 return ctx->vtable->vaDeassociateSubpicture ( ctx, subpicture, target_surfaces, num_surfaces );
1681 /* Get maximum number of display attributes supported by the implementation */
1682 int vaMaxNumDisplayAttributes (
1688 if (!vaDisplayIsValid(dpy))
1691 tmp = CTX(dpy)->max_display_attributes;
1693 VA_TRACE_LOG(va_TraceMaxNumDisplayAttributes, dpy, tmp);
1699 * Query display attributes
1700 * The caller must provide a "attr_list" array that can hold at
1701 * least vaMaxNumDisplayAttributes() entries. The actual number of attributes
1702 * returned in "attr_list" is returned in "num_attributes".
1704 VAStatus vaQueryDisplayAttributes (
1706 VADisplayAttribute *attr_list, /* out */
1707 int *num_attributes /* out */
1710 VADriverContextP ctx;
1715 va_status = ctx->vtable->vaQueryDisplayAttributes ( ctx, attr_list, num_attributes );
1717 VA_TRACE_LOG(va_TraceQueryDisplayAttributes, dpy, attr_list, num_attributes);
1724 * Get display attributes
1725 * This function returns the current attribute values in "attr_list".
1726 * Only attributes returned with VA_DISPLAY_ATTRIB_GETTABLE set in the "flags" field
1727 * from vaQueryDisplayAttributes() can have their values retrieved.
1729 VAStatus vaGetDisplayAttributes (
1731 VADisplayAttribute *attr_list, /* in/out */
1735 VADriverContextP ctx;
1740 va_status = ctx->vtable->vaGetDisplayAttributes ( ctx, attr_list, num_attributes );
1742 VA_TRACE_LOG(va_TraceGetDisplayAttributes, dpy, attr_list, num_attributes);
1748 * Set display attributes
1749 * Only attributes returned with VA_DISPLAY_ATTRIB_SETTABLE set in the "flags" field
1750 * from vaQueryDisplayAttributes() can be set. If the attribute is not settable or
1751 * the value is out of range, the function returns VA_STATUS_ERROR_ATTR_NOT_SUPPORTED
1753 VAStatus vaSetDisplayAttributes (
1755 VADisplayAttribute *attr_list,
1759 VADriverContextP ctx;
1764 va_status = ctx->vtable->vaSetDisplayAttributes ( ctx, attr_list, num_attributes );
1765 VA_TRACE_LOG(va_TraceSetDisplayAttributes, dpy, attr_list, num_attributes);
1770 VAStatus vaLockSurface(VADisplay dpy,
1771 VASurfaceID surface,
1772 unsigned int *fourcc, /* following are output argument */
1773 unsigned int *luma_stride,
1774 unsigned int *chroma_u_stride,
1775 unsigned int *chroma_v_stride,
1776 unsigned int *luma_offset,
1777 unsigned int *chroma_u_offset,
1778 unsigned int *chroma_v_offset,
1779 unsigned int *buffer_name,
1783 VADriverContextP ctx;
1787 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);
1791 VAStatus vaUnlockSurface(VADisplay dpy,
1795 VADriverContextP ctx;
1799 return ctx->vtable->vaUnlockSurface( ctx, surface );
1802 /* Video Processing */
1803 #define VA_VPP_INIT_CONTEXT(ctx, dpy) do { \
1804 CHECK_DISPLAY(dpy); \
1807 return VA_STATUS_ERROR_INVALID_DISPLAY; \
1810 #define VA_VPP_INVOKE(dpy, func, args) do { \
1811 if (!ctx->vtable_vpp->va##func) \
1812 return VA_STATUS_ERROR_UNIMPLEMENTED; \
1813 status = ctx->vtable_vpp->va##func args; \
1817 vaQueryVideoProcFilters(
1819 VAContextID context,
1820 VAProcFilterType *filters,
1821 unsigned int *num_filters
1824 VADriverContextP ctx;
1827 VA_VPP_INIT_CONTEXT(ctx, dpy);
1830 QueryVideoProcFilters,
1831 (ctx, context, filters, num_filters)
1837 vaQueryVideoProcFilterCaps(
1839 VAContextID context,
1840 VAProcFilterType type,
1842 unsigned int *num_filter_caps
1845 VADriverContextP ctx;
1848 VA_VPP_INIT_CONTEXT(ctx, dpy);
1851 QueryVideoProcFilterCaps,
1852 (ctx, context, type, filter_caps, num_filter_caps)
1858 vaQueryVideoProcPipelineCaps(
1860 VAContextID context,
1861 VABufferID *filters,
1862 unsigned int num_filters,
1863 VAProcPipelineCaps *pipeline_caps
1866 VADriverContextP ctx;
1869 VA_VPP_INIT_CONTEXT(ctx, dpy);
1872 QueryVideoProcPipelineCaps,
1873 (ctx, context, filters, num_filters, pipeline_caps)