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.
25 #include "va_backend.h"
27 #include "dummy_drv_video.h"
36 #define INIT_DRIVER_DATA struct dummy_driver_data *driver_data = (struct dummy_driver_data *) ctx->pDriverData;
38 #define CONFIG(id) ((object_config_p) object_heap_lookup( &driver_data->config_heap, id ))
39 #define CONTEXT(id) ((object_context_p) object_heap_lookup( &driver_data->context_heap, id ))
40 #define SURFACE(id) ((object_surface_p) object_heap_lookup( &driver_data->surface_heap, id ))
41 #define BUFFER(id) ((object_buffer_p) object_heap_lookup( &driver_data->buffer_heap, id ))
43 #define CONFIG_ID_OFFSET 0x01000000
44 #define CONTEXT_ID_OFFSET 0x02000000
45 #define SURFACE_ID_OFFSET 0x04000000
46 #define BUFFER_ID_OFFSET 0x08000000
48 static void dummy__error_message(const char *msg, ...)
52 fprintf(stderr, "dummy_drv_video error: ");
54 vfprintf(stderr, msg, args);
58 static void dummy__information_message(const char *msg, ...)
62 fprintf(stderr, "dummy_drv_video: ");
64 vfprintf(stderr, msg, args);
68 VAStatus dummy_QueryConfigProfiles(
70 VAProfile *profile_list, /* out */
71 int *num_profiles /* out */
77 profile_list[i++] = VAProfileMPEG2Simple;
78 profile_list[i++] = VAProfileMPEG2Main;
79 profile_list[i++] = VAProfileMPEG4Simple;
80 profile_list[i++] = VAProfileMPEG4AdvancedSimple;
81 profile_list[i++] = VAProfileMPEG4Main;
82 profile_list[i++] = VAProfileH264Baseline;
83 profile_list[i++] = VAProfileH264Main;
84 profile_list[i++] = VAProfileH264High;
85 profile_list[i++] = VAProfileVC1Simple;
86 profile_list[i++] = VAProfileVC1Main;
87 profile_list[i++] = VAProfileVC1Advanced;
89 /* If the assert fails then DUMMY_MAX_PROFILES needs to be bigger */
90 ASSERT(i <= DUMMY_MAX_PROFILES);
93 return VA_STATUS_SUCCESS;
96 VAStatus dummy_QueryConfigEntrypoints(
99 VAEntrypoint *entrypoint_list, /* out */
100 int *num_entrypoints /* out */
106 case VAProfileMPEG2Simple:
107 case VAProfileMPEG2Main:
108 *num_entrypoints = 2;
109 entrypoint_list[0] = VAEntrypointVLD;
110 entrypoint_list[1] = VAEntrypointMoComp;
113 case VAProfileMPEG4Simple:
114 case VAProfileMPEG4AdvancedSimple:
115 case VAProfileMPEG4Main:
116 *num_entrypoints = 1;
117 entrypoint_list[0] = VAEntrypointVLD;
120 case VAProfileH264Baseline:
121 case VAProfileH264Main:
122 case VAProfileH264High:
123 *num_entrypoints = 1;
124 entrypoint_list[0] = VAEntrypointVLD;
127 case VAProfileVC1Simple:
128 case VAProfileVC1Main:
129 case VAProfileVC1Advanced:
130 *num_entrypoints = 1;
131 entrypoint_list[0] = VAEntrypointVLD;
135 *num_entrypoints = 0;
139 /* If the assert fails then DUMMY_MAX_ENTRYPOINTS needs to be bigger */
140 ASSERT(*num_entrypoints <= DUMMY_MAX_ENTRYPOINTS);
141 return VA_STATUS_SUCCESS;
144 VAStatus dummy_GetConfigAttributes(
145 VADriverContextP ctx,
147 VAEntrypoint entrypoint,
148 VAConfigAttrib *attrib_list, /* in/out */
156 /* Other attributes don't seem to be defined */
157 /* What to do if we don't know the attribute? */
158 for (i = 0; i < num_attribs; i++)
160 switch (attrib_list[i].type)
162 case VAConfigAttribRTFormat:
163 attrib_list[i].value = VA_RT_FORMAT_YUV420;
168 attrib_list[i].value = VA_ATTRIB_NOT_SUPPORTED;
173 return VA_STATUS_SUCCESS;
176 static VAStatus dummy__update_attribute(object_config_p obj_config, VAConfigAttrib *attrib)
179 /* Check existing attrbiutes */
180 for(i = 0; obj_config->attrib_count < i; i++)
182 if (obj_config->attrib_list[i].type == attrib->type)
184 /* Update existing attribute */
185 obj_config->attrib_list[i].value = attrib->value;
186 return VA_STATUS_SUCCESS;
189 if (obj_config->attrib_count < DUMMY_MAX_CONFIG_ATTRIBUTES)
191 i = obj_config->attrib_count;
192 obj_config->attrib_list[i].type = attrib->type;
193 obj_config->attrib_list[i].value = attrib->value;
194 obj_config->attrib_count++;
195 return VA_STATUS_SUCCESS;
197 return VA_STATUS_ERROR_MAX_NUM_EXCEEDED;
200 VAStatus dummy_CreateConfig(
201 VADriverContextP ctx,
203 VAEntrypoint entrypoint,
204 VAConfigAttrib *attrib_list,
206 VAConfigID *config_id /* out */
212 object_config_p obj_config;
215 /* Validate profile & entrypoint */
217 case VAProfileMPEG2Simple:
218 case VAProfileMPEG2Main:
219 if ((VAEntrypointVLD == entrypoint) ||
220 (VAEntrypointMoComp == entrypoint))
222 vaStatus = VA_STATUS_SUCCESS;
226 vaStatus = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
230 case VAProfileMPEG4Simple:
231 case VAProfileMPEG4AdvancedSimple:
232 case VAProfileMPEG4Main:
233 if (VAEntrypointVLD == entrypoint)
235 vaStatus = VA_STATUS_SUCCESS;
239 vaStatus = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
243 case VAProfileH264Baseline:
244 case VAProfileH264Main:
245 case VAProfileH264High:
246 if (VAEntrypointVLD == entrypoint)
248 vaStatus = VA_STATUS_SUCCESS;
252 vaStatus = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
256 case VAProfileVC1Simple:
257 case VAProfileVC1Main:
258 case VAProfileVC1Advanced:
259 if (VAEntrypointVLD == entrypoint)
261 vaStatus = VA_STATUS_SUCCESS;
265 vaStatus = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
270 vaStatus = VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
274 if (VA_STATUS_SUCCESS != vaStatus)
279 configID = object_heap_allocate( &driver_data->config_heap );
280 obj_config = CONFIG(configID);
281 if (NULL == obj_config)
283 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
287 obj_config->profile = profile;
288 obj_config->entrypoint = entrypoint;
289 obj_config->attrib_list[0].type = VAConfigAttribRTFormat;
290 obj_config->attrib_list[0].value = VA_RT_FORMAT_YUV420;
291 obj_config->attrib_count = 1;
293 for(i = 0; i < num_attribs; i++)
295 vaStatus = dummy__update_attribute(obj_config, &(attrib_list[i]));
296 if (VA_STATUS_SUCCESS != vaStatus)
303 if (VA_STATUS_SUCCESS != vaStatus)
305 object_heap_free( &driver_data->config_heap, (object_base_p) obj_config);
309 *config_id = configID;
315 VAStatus dummy_DestroyConfig(
316 VADriverContextP ctx,
322 object_config_p obj_config;
324 obj_config = CONFIG(config_id);
325 if (NULL == obj_config)
327 vaStatus = VA_STATUS_ERROR_INVALID_CONFIG;
331 object_heap_free( &driver_data->config_heap, (object_base_p) obj_config);
332 return VA_STATUS_SUCCESS;
335 VAStatus dummy_QueryConfigAttributes(
336 VADriverContextP ctx,
337 VAConfigID config_id,
338 VAProfile *profile, /* out */
339 VAEntrypoint *entrypoint, /* out */
340 VAConfigAttrib *attrib_list, /* out */
341 int *num_attribs /* out */
345 VAStatus vaStatus = VA_STATUS_SUCCESS;
346 object_config_p obj_config;
349 obj_config = CONFIG(config_id);
352 *profile = obj_config->profile;
353 *entrypoint = obj_config->entrypoint;
354 *num_attribs = obj_config->attrib_count;
355 for(i = 0; i < obj_config->attrib_count; i++)
357 attrib_list[i] = obj_config->attrib_list[i];
363 VAStatus dummy_CreateSurfaces(
364 VADriverContextP ctx,
369 VASurface *surfaces /* out */
373 VAStatus vaStatus = VA_STATUS_SUCCESS;
376 /* We only support one format */
377 if (VA_RT_FORMAT_YUV420 != format)
379 return VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT;
382 for (i = 0; i < num_surfaces; i++)
384 int surfaceID = object_heap_allocate( &driver_data->surface_heap );
385 object_surface_p obj_surface = SURFACE(surfaceID);
386 if (NULL == obj_surface)
388 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
391 obj_surface->surface = &(surfaces[i]);
392 obj_surface->surface->surface_id = surfaceID;
393 obj_surface->surface->context_id = -1;
394 obj_surface->surface->width = width;
395 obj_surface->surface->height = height;
396 obj_surface->surface->format = format;
397 obj_surface->surface->privData = NULL;
401 if (VA_STATUS_SUCCESS != vaStatus)
403 /* surfaces[i-1] was the last successful allocation */
406 object_surface_p obj_surface = SURFACE(surfaces[i].surface_id);
407 surfaces[i].surface_id = -1;
409 object_heap_free( &driver_data->surface_heap, (object_base_p) obj_surface);
416 VAStatus dummy_DestroySurface(
417 VADriverContextP ctx,
418 VASurface *surface_list,
424 for(i = num_surfaces; i--; )
426 object_surface_p obj_surface = SURFACE(surface_list[i].surface_id);
428 object_heap_free( &driver_data->surface_heap, (object_base_p) obj_surface);
430 return VA_STATUS_SUCCESS;
433 VAStatus dummy_QueryImageFormats(
434 VADriverContextP ctx,
435 VAImageFormat *format_list, /* out */
436 int *num_formats /* out */
442 return VA_STATUS_SUCCESS;
445 VAStatus dummy_CreateImage(
446 VADriverContextP ctx,
447 VAImageFormat *format,
450 VAImage *image /* out */
456 return VA_STATUS_SUCCESS;
459 VAStatus dummy_DestroyImage(
460 VADriverContextP ctx,
467 return VA_STATUS_SUCCESS;
470 VAStatus dummy_GetImage(
471 VADriverContextP ctx,
473 int x, /* coordinates of the upper left source pixel */
475 unsigned int width, /* width and height of the region */
483 return VA_STATUS_SUCCESS;
486 VAStatus dummy_PutImage(
487 VADriverContextP ctx,
501 return VA_STATUS_SUCCESS;
504 VAStatus dummy_QuerySubpictureFormats(
505 VADriverContextP ctx,
506 VAImageFormat *format_list, /* out */
507 unsigned int *flags, /* out */
508 unsigned int *num_formats /* out */
514 return VA_STATUS_SUCCESS;
517 VAStatus dummy_CreateSubpicture(
518 VADriverContextP ctx,
520 VASubpicture *subpicture /* out */
526 return VA_STATUS_SUCCESS;
529 VAStatus dummy_DestroySubpicture(
530 VADriverContextP ctx,
531 VASubpicture *subpicture
537 return VA_STATUS_SUCCESS;
540 VAStatus dummy_SetSubpictureImage(
541 VADriverContextP ctx,
542 VASubpicture *subpicture,
549 return VA_STATUS_SUCCESS;
552 VAStatus dummy_SetSubpicturePalette(
553 VADriverContextP ctx,
554 VASubpicture *subpicture,
556 * pointer to an array holding the palette data. The size of the array is
557 * num_palette_entries * entry_bytes in size. The order of the components
558 * in the palette is described by the component_order in VASubpicture struct
560 unsigned char *palette
566 return VA_STATUS_SUCCESS;
569 VAStatus dummy_SetSubpictureChromakey(
570 VADriverContextP ctx,
571 VASubpicture *subpicture,
572 unsigned int chromakey_min,
573 unsigned int chromakey_max
579 return VA_STATUS_SUCCESS;
582 VAStatus dummy_SetSubpictureGlobalAlpha(
583 VADriverContextP ctx,
584 VASubpicture *subpicture,
591 return VA_STATUS_SUCCESS;
594 VAStatus dummy_AssociateSubpicture(
595 VADriverContextP ctx,
596 VASurface *target_surface,
597 VASubpicture *subpicture,
598 short src_x, /* upper left offset in subpicture */
600 short dest_x, /* upper left offset in surface */
602 unsigned short width,
603 unsigned short height,
605 * whether to enable chroma-keying or global-alpha
606 * see VA_SUBPICTURE_XXX values
614 return VA_STATUS_SUCCESS;
617 VAStatus dummy_CreateContext(
618 VADriverContextP ctx,
619 VAConfigID config_id,
623 VASurface *render_targets,
624 int num_render_targets,
625 VAContext *context /* out */
629 VAStatus vaStatus = VA_STATUS_SUCCESS;
630 object_config_p obj_config;
633 obj_config = CONFIG(config_id);
634 if (NULL == obj_config)
636 vaStatus = VA_STATUS_ERROR_INVALID_CONFIG;
641 /* Validate picture dimensions */
643 int contextID = object_heap_allocate( &driver_data->context_heap );
644 object_context_p obj_context = CONTEXT(contextID);
645 if (NULL == obj_context)
647 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
651 obj_context->context = context;
652 obj_context->current_render_target = -1;
654 obj_context->context->context_id = contextID;
655 obj_context->context->config_id = config_id;
656 obj_context->context->picture_width = picture_width;
657 obj_context->context->picture_height = picture_height;
658 obj_context->context->num_render_targets = num_render_targets;
659 obj_context->context->render_targets = (VASurfaceID *) malloc(num_render_targets * sizeof(VASurfaceID));
660 for(i = 0; i < num_render_targets; i++)
662 if (NULL == SURFACE(render_targets[i].surface_id))
664 vaStatus = VA_STATUS_ERROR_INVALID_SURFACE;
667 obj_context->context->render_targets[i] = render_targets[i].surface_id;
669 obj_context->context->flags = flag;
670 obj_context->context->privData = NULL;
673 if (VA_STATUS_SUCCESS != vaStatus)
675 free(obj_context->context->render_targets);
676 obj_context->context->render_targets = NULL;
677 obj_context->context->context_id = -1;
678 obj_context->context->config_id = -1;
679 obj_context->context->picture_width = 0;
680 obj_context->context->picture_height = 0;
681 free(obj_context->context->render_targets);
682 obj_context->context->render_targets = NULL;
683 obj_context->context->num_render_targets = 0;
684 obj_context->context->flags = 0;
685 obj_context->context->privData = NULL;
686 object_heap_free( &driver_data->context_heap, (object_base_p) obj_context);
693 VAStatus dummy_DestroyContext(
694 VADriverContextP ctx,
699 object_context_p obj_context = CONTEXT(context->context_id);
702 obj_context->context->context_id = -1;
703 obj_context->context->config_id = -1;
704 obj_context->context->picture_width = 0;
705 obj_context->context->picture_height = 0;
706 if (obj_context->context->render_targets)
708 free(obj_context->context->render_targets);
710 obj_context->context->render_targets = NULL;
711 obj_context->context->num_render_targets = 0;
712 obj_context->context->flags = 0;
713 obj_context->context->privData = NULL;
715 obj_context->context = NULL;
716 obj_context->current_render_target = -1;
718 object_heap_free( &driver_data->context_heap, (object_base_p) obj_context);
720 return VA_STATUS_SUCCESS;
724 VAStatus dummy_CreateBuffer(
725 VADriverContextP ctx,
726 VABufferType type, /* in */
727 VABufferID *buf_desc /* out */
731 VAStatus vaStatus = VA_STATUS_SUCCESS;
733 object_buffer_p obj_buffer;
738 case VAPictureParameterBufferType:
739 case VAIQMatrixBufferType:
740 case VASliceParameterBufferType:
741 case VASliceDataBufferType:
742 case VAMacroblockParameterBufferType:
743 case VAResidualDataBufferType:
744 case VADeblockingParameterBufferType:
748 vaStatus = VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE;
752 bufferID = object_heap_allocate( &driver_data->buffer_heap );
753 obj_buffer = BUFFER(bufferID);
754 if (NULL == obj_buffer)
756 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
760 obj_buffer->buffer_data = NULL;
762 *buf_desc = bufferID;
767 static VAStatus dummy__allocate_buffer(object_buffer_p obj_buffer, int size)
769 VAStatus vaStatus = VA_STATUS_SUCCESS;
771 obj_buffer->buffer_data = realloc(obj_buffer->buffer_data, size);
772 if (NULL == obj_buffer->buffer_data)
774 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
779 VAStatus dummy_BufferData(
780 VADriverContextP ctx,
781 VABufferID buf_id, /* in */
782 unsigned int size, /* in */
783 unsigned int num_elements, /* in */
788 VAStatus vaStatus = VA_STATUS_SUCCESS;
789 object_buffer_p obj_buffer = BUFFER(buf_id);
792 vaStatus = dummy__allocate_buffer(obj_buffer, size * num_elements);
793 if (VA_STATUS_SUCCESS == vaStatus)
795 obj_buffer->max_num_elements = num_elements;
796 obj_buffer->num_elements = num_elements;
799 memcpy(obj_buffer->buffer_data, data, size * num_elements);
806 VAStatus dummy_BufferSetNumElements(
807 VADriverContextP ctx,
808 VABufferID buf_id, /* in */
809 unsigned int num_elements /* in */
813 VAStatus vaStatus = VA_STATUS_SUCCESS;
814 object_buffer_p obj_buffer = BUFFER(buf_id);
817 if ((num_elements < 0) || (num_elements > obj_buffer->max_num_elements))
819 vaStatus = VA_STATUS_ERROR_UNKNOWN;
821 if (VA_STATUS_SUCCESS == vaStatus)
823 obj_buffer->num_elements = num_elements;
829 VAStatus dummy_MapBuffer(
830 VADriverContextP ctx,
831 VABufferID buf_id, /* in */
832 void **pbuf /* out */
836 VAStatus vaStatus = VA_STATUS_ERROR_UNKNOWN;
837 object_buffer_p obj_buffer = BUFFER(buf_id);
839 if (NULL == obj_buffer)
841 vaStatus = VA_STATUS_ERROR_INVALID_BUFFER;
845 if (NULL != obj_buffer->buffer_data)
847 *pbuf = obj_buffer->buffer_data;
848 vaStatus = VA_STATUS_SUCCESS;
853 VAStatus dummy_UnmapBuffer(
854 VADriverContextP ctx,
855 VABufferID buf_id /* in */
859 return VA_STATUS_SUCCESS;
862 static void dummy__destroy_buffer(struct dummy_driver_data *driver_data, object_buffer_p obj_buffer)
864 if (NULL != obj_buffer->buffer_data)
866 free(obj_buffer->buffer_data);
867 obj_buffer->buffer_data = NULL;
870 object_heap_free( &driver_data->buffer_heap, (object_base_p) obj_buffer);
873 VAStatus dummy_DestroyBuffer(
874 VADriverContextP ctx,
879 object_buffer_p obj_buffer = BUFFER(buffer_id);
882 dummy__destroy_buffer(driver_data, obj_buffer);
883 return VA_STATUS_SUCCESS;
886 VAStatus dummy_BeginPicture(
887 VADriverContextP ctx,
889 VASurface *render_target
893 VAStatus vaStatus = VA_STATUS_SUCCESS;
894 object_context_p obj_context;
895 object_surface_p obj_surface;
897 obj_context = CONTEXT(context->context_id);
900 obj_surface = SURFACE(render_target->surface_id);
903 obj_context->current_render_target = obj_surface->base.id;
908 VAStatus dummy_RenderPicture(
909 VADriverContextP ctx,
916 VAStatus vaStatus = VA_STATUS_SUCCESS;
917 object_context_p obj_context;
918 object_surface_p obj_surface;
921 obj_context = CONTEXT(context->context_id);
924 obj_surface = SURFACE(obj_context->current_render_target);
927 /* verify that we got valid buffer references */
928 for(i = 0; i < num_buffers; i++)
930 object_buffer_p obj_buffer = BUFFER(buffers[i]);
932 if (NULL == obj_buffer)
934 vaStatus = VA_STATUS_ERROR_INVALID_BUFFER;
942 VAStatus dummy_EndPicture(
943 VADriverContextP ctx,
948 VAStatus vaStatus = VA_STATUS_SUCCESS;
949 object_context_p obj_context;
950 object_surface_p obj_surface;
952 obj_context = CONTEXT(context->context_id);
955 obj_surface = SURFACE(obj_context->current_render_target);
958 // For now, assume that we are done with rendering right away
959 obj_context->current_render_target = -1;
965 VAStatus dummy_SyncSurface(
966 VADriverContextP ctx,
968 VASurface *render_target
972 VAStatus vaStatus = VA_STATUS_SUCCESS;
973 object_context_p obj_context;
974 object_surface_p obj_surface;
976 obj_context = CONTEXT(context->context_id);
979 obj_surface = SURFACE(render_target->surface_id);
982 /* Assume that this shouldn't be called before vaEndPicture() */
983 ASSERT( obj_context->current_render_target != obj_surface->base.id );
988 VAStatus dummy_QuerySurfaceStatus(
989 VADriverContextP ctx,
991 VASurface *render_target,
992 VASurfaceStatus *status /* out */
996 VAStatus vaStatus = VA_STATUS_SUCCESS;
997 object_context_p obj_context;
998 object_surface_p obj_surface;
1000 obj_context = CONTEXT(context->context_id);
1001 ASSERT(obj_context);
1003 obj_surface = SURFACE(render_target->surface_id);
1004 ASSERT(obj_surface);
1006 /* Assume that we are busy until vaEndPicture() is called */
1007 if ( obj_context->current_render_target == obj_surface->base.id )
1009 *status = VASurfaceRendering;
1013 *status = VASurfaceReady;
1019 VAStatus dummy_PutSurface(
1020 VADriverContextP ctx,
1022 Drawable draw, /* X Drawable */
1025 unsigned short srcw,
1026 unsigned short srch,
1029 unsigned short destw,
1030 unsigned short desth,
1031 VARectangle *cliprects, /* client supplied clip list */
1032 unsigned int number_cliprects, /* number of clip rects in the clip list */
1033 unsigned int flags /* de-interlacing flags */
1037 return VA_STATUS_ERROR_UNKNOWN;
1041 * Query display attributes
1042 * The caller must provide a "attr_list" array that can hold at
1043 * least vaMaxNumDisplayAttributes() entries. The actual number of attributes
1044 * returned in "attr_list" is returned in "num_attributes".
1046 VAStatus dummy_QueryDisplayAttributes (
1047 VADriverContextP ctx,
1048 VADisplayAttribute *attr_list, /* out */
1049 int *num_attributes /* out */
1053 return VA_STATUS_ERROR_UNKNOWN;
1057 * Get display attributes
1058 * This function returns the current attribute values in "attr_list".
1059 * Only attributes returned with VA_DISPLAY_ATTRIB_GETTABLE set in the "flags" field
1060 * from vaQueryDisplayAttributes() can have their values retrieved.
1062 VAStatus dummy_GetDisplayAttributes (
1063 VADriverContextP ctx,
1064 VADisplayAttribute *attr_list, /* in/out */
1069 return VA_STATUS_ERROR_UNKNOWN;
1073 * Set display attributes
1074 * Only attributes returned with VA_DISPLAY_ATTRIB_SETTABLE set in the "flags" field
1075 * from vaQueryDisplayAttributes() can be set. If the attribute is not settable or
1076 * the value is out of range, the function returns VA_STATUS_ERROR_ATTR_NOT_SUPPORTED
1078 VAStatus dummy_SetDisplayAttributes (
1079 VADriverContextP ctx,
1080 VADisplayAttribute *attr_list,
1085 return VA_STATUS_ERROR_UNKNOWN;
1089 VAStatus dummy_DbgCopySurfaceToBuffer(
1090 VADriverContextP ctx,
1092 void **buffer, /* out */
1093 unsigned int *stride /* out */
1097 return VA_STATUS_ERROR_UNKNOWN;
1100 VAStatus dummy_Terminate( VADriverContextP ctx )
1103 object_buffer_p obj_buffer;
1104 object_surface_p obj_surface;
1105 object_context_p obj_context;
1106 object_config_p obj_config;
1107 object_heap_iterator iter;
1109 /* Clean up left over buffers */
1110 obj_buffer = (object_buffer_p) object_heap_first( &driver_data->buffer_heap, &iter);
1113 dummy__information_message("vaTerminate: bufferID %08x still allocated, destroying\n", obj_buffer->base.id);
1114 dummy__destroy_buffer(driver_data, obj_buffer);
1115 obj_buffer = (object_buffer_p) object_heap_next( &driver_data->buffer_heap, &iter);
1117 object_heap_destroy( &driver_data->buffer_heap );
1120 object_heap_destroy( &driver_data->surface_heap );
1123 object_heap_destroy( &driver_data->context_heap );
1125 /* Clean up configIDs */
1126 obj_config = (object_config_p) object_heap_first( &driver_data->config_heap, &iter);
1129 object_heap_free( &driver_data->config_heap, (object_base_p) obj_config);
1130 obj_config = (object_config_p) object_heap_next( &driver_data->config_heap, &iter);
1132 object_heap_destroy( &driver_data->config_heap );
1134 free(ctx->pDriverData);
1135 ctx->pDriverData = NULL;
1137 return VA_STATUS_SUCCESS;
1140 VAStatus __vaDriverInit_0_24( VADriverContextP ctx )
1144 struct dummy_driver_data *driver_data;
1147 ctx->version_major = 0;
1148 ctx->version_minor = 24;
1149 ctx->max_profiles = DUMMY_MAX_PROFILES;
1150 ctx->max_entrypoints = DUMMY_MAX_ENTRYPOINTS;
1151 ctx->max_attributes = DUMMY_MAX_CONFIG_ATTRIBUTES;
1152 ctx->max_image_formats = DUMMY_MAX_IMAGE_FORMATS;
1153 ctx->max_subpic_formats = DUMMY_MAX_SUBPIC_FORMATS;
1154 ctx->max_display_attributes = DUMMY_MAX_DISPLAY_ATTRIBUTES;
1156 ctx->vtable.vaTerminate = dummy_Terminate;
1157 ctx->vtable.vaQueryConfigEntrypoints = dummy_QueryConfigEntrypoints;
1158 ctx->vtable.vaQueryConfigProfiles = dummy_QueryConfigProfiles;
1159 ctx->vtable.vaQueryConfigEntrypoints = dummy_QueryConfigEntrypoints;
1160 ctx->vtable.vaQueryConfigAttributes = dummy_QueryConfigAttributes;
1161 ctx->vtable.vaCreateConfig = dummy_CreateConfig;
1162 ctx->vtable.vaDestroyConfig = dummy_DestroyConfig;
1163 ctx->vtable.vaGetConfigAttributes = dummy_GetConfigAttributes;
1164 ctx->vtable.vaCreateSurfaces = dummy_CreateSurfaces;
1165 ctx->vtable.vaDestroySurface = dummy_DestroySurface;
1166 ctx->vtable.vaCreateContext = dummy_CreateContext;
1167 ctx->vtable.vaDestroyContext = dummy_DestroyContext;
1168 ctx->vtable.vaCreateBuffer = dummy_CreateBuffer;
1169 ctx->vtable.vaBufferData = dummy_BufferData;
1170 ctx->vtable.vaBufferSetNumElements = dummy_BufferSetNumElements;
1171 ctx->vtable.vaMapBuffer = dummy_MapBuffer;
1172 ctx->vtable.vaUnmapBuffer = dummy_UnmapBuffer;
1173 ctx->vtable.vaDestroyBuffer = dummy_DestroyBuffer;
1174 ctx->vtable.vaBeginPicture = dummy_BeginPicture;
1175 ctx->vtable.vaRenderPicture = dummy_RenderPicture;
1176 ctx->vtable.vaEndPicture = dummy_EndPicture;
1177 ctx->vtable.vaSyncSurface = dummy_SyncSurface;
1178 ctx->vtable.vaQuerySurfaceStatus = dummy_QuerySurfaceStatus;
1179 ctx->vtable.vaPutSurface = dummy_PutSurface;
1180 ctx->vtable.vaQueryImageFormats = dummy_QueryImageFormats;
1181 ctx->vtable.vaCreateImage = dummy_CreateImage;
1182 ctx->vtable.vaDestroyImage = dummy_DestroyImage;
1183 ctx->vtable.vaGetImage = dummy_GetImage;
1184 ctx->vtable.vaPutImage = dummy_PutImage;
1185 ctx->vtable.vaQuerySubpictureFormats = dummy_QuerySubpictureFormats;
1186 ctx->vtable.vaCreateSubpicture = dummy_CreateSubpicture;
1187 ctx->vtable.vaDestroySubpicture = dummy_DestroySubpicture;
1188 ctx->vtable.vaSetSubpictureImage = dummy_SetSubpictureImage;
1189 ctx->vtable.vaSetSubpicturePalette = dummy_SetSubpicturePalette;
1190 ctx->vtable.vaSetSubpictureChromakey = dummy_SetSubpictureChromakey;
1191 ctx->vtable.vaSetSubpictureGlobalAlpha = dummy_SetSubpictureGlobalAlpha;
1192 ctx->vtable.vaAssociateSubpicture = dummy_AssociateSubpicture;
1193 ctx->vtable.vaQueryDisplayAttributes = dummy_QueryDisplayAttributes;
1194 ctx->vtable.vaGetDisplayAttributes = dummy_GetDisplayAttributes;
1195 ctx->vtable.vaSetDisplayAttributes = dummy_SetDisplayAttributes;
1197 ctx->vtable.vaDbgCopySurfaceToBuffer = dummy_DbgCopySurfaceToBuffer;
1199 driver_data = (struct dummy_driver_data *) malloc( sizeof(*driver_data) );
1200 ctx->pDriverData = (void *) driver_data;
1202 result = object_heap_init( &driver_data->config_heap, sizeof(struct object_config), CONFIG_ID_OFFSET );
1203 ASSERT( result == 0 );
1205 result = object_heap_init( &driver_data->context_heap, sizeof(struct object_context), CONTEXT_ID_OFFSET );
1206 ASSERT( result == 0 );
1208 result = object_heap_init( &driver_data->surface_heap, sizeof(struct object_surface), SURFACE_ID_OFFSET );
1209 ASSERT( result == 0 );
1211 result = object_heap_init( &driver_data->buffer_heap, sizeof(struct object_buffer), BUFFER_ID_OFFSET );
1212 ASSERT( result == 0 );
1215 return VA_STATUS_SUCCESS;