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_QueryConfigAttributes(
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_GetConfigAttributes(
316 VADriverContextP ctx,
317 VAConfigID config_id,
318 VAProfile *profile, /* out */
319 VAEntrypoint *entrypoint, /* out */
320 VAConfigAttrib *attrib_list, /* out */
321 int *num_attribs /* out */
325 VAStatus vaStatus = VA_STATUS_SUCCESS;
326 object_config_p obj_config;
329 obj_config = CONFIG(config_id);
332 *profile = obj_config->profile;
333 *entrypoint = obj_config->entrypoint;
334 *num_attribs = obj_config->attrib_count;
335 for(i = 0; i < obj_config->attrib_count; i++)
337 attrib_list[i] = obj_config->attrib_list[i];
343 VAStatus dummy_CreateSurfaces(
344 VADriverContextP ctx,
349 VASurface *surfaces /* out */
353 VAStatus vaStatus = VA_STATUS_SUCCESS;
356 /* We only support one format */
357 if (VA_RT_FORMAT_YUV420 != format)
359 return VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT;
362 for (i = 0; i < num_surfaces; i++)
364 int surfaceID = object_heap_allocate( &driver_data->surface_heap );
365 object_surface_p obj_surface = SURFACE(surfaceID);
366 if (NULL == obj_surface)
368 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
371 obj_surface->surface = &(surfaces[i]);
372 obj_surface->surface->surface_id = surfaceID;
373 obj_surface->surface->context_id = -1;
374 obj_surface->surface->width = width;
375 obj_surface->surface->height = height;
376 obj_surface->surface->format = format;
377 obj_surface->surface->privData = NULL;
381 if (VA_STATUS_SUCCESS != vaStatus)
383 /* surfaces[i-1] was the last successful allocation */
386 object_surface_p obj_surface = SURFACE(surfaces[i].surface_id);
387 surfaces[i].surface_id = -1;
389 object_heap_free( &driver_data->surface_heap, (object_base_p) obj_surface);
396 VAStatus dummy_DestroySurface(
397 VADriverContextP ctx,
398 VASurface *surface_list,
404 for(i = num_surfaces; i--; )
406 object_surface_p obj_surface = SURFACE(surface_list[i].surface_id);
408 object_heap_free( &driver_data->surface_heap, (object_base_p) obj_surface);
410 return VA_STATUS_SUCCESS;
413 VAStatus dummy_QueryImageFormats(
414 VADriverContextP ctx,
415 VAImageFormat *format_list, /* out */
416 int *num_formats /* out */
422 return VA_STATUS_SUCCESS;
425 VAStatus dummy_CreateImage(
426 VADriverContextP ctx,
427 VAImageFormat *format,
430 VAImage *image /* out */
436 return VA_STATUS_SUCCESS;
439 VAStatus dummy_DestroyImage(
440 VADriverContextP ctx,
447 return VA_STATUS_SUCCESS;
450 VAStatus dummy_GetImage(
451 VADriverContextP ctx,
453 int x, /* coordinates of the upper left source pixel */
455 unsigned int width, /* width and height of the region */
463 return VA_STATUS_SUCCESS;
466 VAStatus dummy_PutImage(
467 VADriverContextP ctx,
481 return VA_STATUS_SUCCESS;
484 VAStatus dummy_QuerySubpictureFormats(
485 VADriverContextP ctx,
486 VAImageFormat *format_list, /* out */
487 unsigned int *flags, /* out */
488 unsigned int *num_formats /* out */
494 return VA_STATUS_SUCCESS;
497 VAStatus dummy_CreateSubpicture(
498 VADriverContextP ctx,
500 VASubpicture *subpicture /* out */
506 return VA_STATUS_SUCCESS;
509 VAStatus dummy_DestroySubpicture(
510 VADriverContextP ctx,
511 VASubpicture *subpicture
517 return VA_STATUS_SUCCESS;
520 VAStatus dummy_SetSubpicturePalette(
521 VADriverContextP ctx,
522 VASubpicture *subpicture,
524 * pointer to an array holding the palette data. The size of the array is
525 * num_palette_entries * entry_bytes in size. The order of the components
526 * in the palette is described by the component_order in VASubpicture struct
528 unsigned char *palette
534 return VA_STATUS_SUCCESS;
537 VAStatus dummy_SetSubpictureChromakey(
538 VADriverContextP ctx,
539 VASubpicture *subpicture,
540 unsigned int chromakey_min,
541 unsigned int chromakey_max
547 return VA_STATUS_SUCCESS;
550 VAStatus dummy_SetSubpictureGlobalAlpha(
551 VADriverContextP ctx,
552 VASubpicture *subpicture,
559 return VA_STATUS_SUCCESS;
562 VAStatus dummy_AssociateSubpicture(
563 VADriverContextP ctx,
564 VASurface *target_surface,
565 VASubpicture *subpicture,
566 short src_x, /* upper left offset in subpicture */
568 short dest_x, /* upper left offset in surface */
570 unsigned short width,
571 unsigned short height,
573 * whether to enable chroma-keying or global-alpha
574 * see VA_SUBPICTURE_XXX values
582 return VA_STATUS_SUCCESS;
585 VAStatus dummy_CreateContext(
586 VADriverContextP ctx,
587 VAConfigID config_id,
591 VASurface *render_targets,
592 int num_render_targets,
593 VAContext *context /* out */
597 VAStatus vaStatus = VA_STATUS_SUCCESS;
598 object_config_p obj_config;
601 obj_config = CONFIG(config_id);
602 if (NULL == obj_config)
604 vaStatus = VA_STATUS_ERROR_INVALID_CONFIG;
609 /* Validate picture dimensions */
611 int contextID = object_heap_allocate( &driver_data->context_heap );
612 object_context_p obj_context = CONTEXT(contextID);
613 if (NULL == obj_context)
615 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
619 obj_context->context = context;
620 obj_context->current_render_target = -1;
622 obj_context->context->context_id = contextID;
623 obj_context->context->config_id = config_id;
624 obj_context->context->picture_width = picture_width;
625 obj_context->context->picture_height = picture_height;
626 obj_context->context->num_render_targets = num_render_targets;
627 obj_context->context->render_targets = (VASurfaceID *) malloc(num_render_targets * sizeof(VASurfaceID));
628 for(i = 0; i < num_render_targets; i++)
630 if (NULL == SURFACE(render_targets[i].surface_id))
632 vaStatus = VA_STATUS_ERROR_INVALID_SURFACE;
635 obj_context->context->render_targets[i] = render_targets[i].surface_id;
637 obj_context->context->flags = flag;
638 obj_context->context->privData = NULL;
641 if (VA_STATUS_SUCCESS != vaStatus)
643 free(obj_context->context->render_targets);
644 obj_context->context->render_targets = NULL;
645 obj_context->context->context_id = -1;
646 obj_context->context->config_id = -1;
647 obj_context->context->picture_width = 0;
648 obj_context->context->picture_height = 0;
649 free(obj_context->context->render_targets);
650 obj_context->context->render_targets = NULL;
651 obj_context->context->num_render_targets = 0;
652 obj_context->context->flags = 0;
653 obj_context->context->privData = NULL;
654 object_heap_free( &driver_data->context_heap, (object_base_p) obj_context);
661 VAStatus dummy_DestroyContext(
662 VADriverContextP ctx,
667 object_context_p obj_context = CONTEXT(context->context_id);
670 obj_context->context->context_id = -1;
671 obj_context->context->config_id = -1;
672 obj_context->context->picture_width = 0;
673 obj_context->context->picture_height = 0;
674 if (obj_context->context->render_targets)
676 free(obj_context->context->render_targets);
678 obj_context->context->render_targets = NULL;
679 obj_context->context->num_render_targets = 0;
680 obj_context->context->flags = 0;
681 obj_context->context->privData = NULL;
683 obj_context->context = NULL;
684 obj_context->current_render_target = -1;
686 object_heap_free( &driver_data->context_heap, (object_base_p) obj_context);
688 return VA_STATUS_SUCCESS;
692 VAStatus dummy_CreateBuffer(
693 VADriverContextP ctx,
694 VABufferType type, /* in */
695 VABufferID *buf_desc /* out */
699 VAStatus vaStatus = VA_STATUS_SUCCESS;
701 object_buffer_p obj_buffer;
706 case VAPictureParameterBufferType:
707 case VAIQMatrixBufferType:
708 case VASliceParameterBufferType:
709 case VASliceDataBufferType:
710 case VAMacroblockParameterBufferType:
711 case VAResidualDataBufferType:
712 case VADeblockingParameterBufferType:
716 vaStatus = VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE;
720 bufferID = object_heap_allocate( &driver_data->buffer_heap );
721 obj_buffer = BUFFER(bufferID);
722 if (NULL == obj_buffer)
724 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
728 obj_buffer->buffer_data = NULL;
730 *buf_desc = bufferID;
735 static VAStatus dummy__allocate_buffer(object_buffer_p obj_buffer, int size)
737 VAStatus vaStatus = VA_STATUS_SUCCESS;
739 obj_buffer->buffer_data = realloc(obj_buffer->buffer_data, size);
740 if (NULL == obj_buffer->buffer_data)
742 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
747 VAStatus dummy_BufferData(
748 VADriverContextP ctx,
749 VABufferID buf_id, /* in */
750 unsigned int size, /* in */
751 unsigned int num_elements, /* in */
756 VAStatus vaStatus = VA_STATUS_SUCCESS;
757 object_buffer_p obj_buffer = BUFFER(buf_id);
760 vaStatus = dummy__allocate_buffer(obj_buffer, size * num_elements);
761 if (VA_STATUS_SUCCESS == vaStatus)
763 obj_buffer->max_num_elements = num_elements;
764 obj_buffer->num_elements = num_elements;
767 memcpy(obj_buffer->buffer_data, data, size * num_elements);
774 VAStatus dummy_BufferSetNumElements(
775 VADriverContextP ctx,
776 VABufferID buf_id, /* in */
777 unsigned int num_elements /* in */
781 VAStatus vaStatus = VA_STATUS_SUCCESS;
782 object_buffer_p obj_buffer = BUFFER(buf_id);
785 if ((num_elements < 0) || (num_elements > obj_buffer->max_num_elements))
787 vaStatus = VA_STATUS_ERROR_UNKNOWN;
789 if (VA_STATUS_SUCCESS == vaStatus)
791 obj_buffer->num_elements = num_elements;
797 VAStatus dummy_MapBuffer(
798 VADriverContextP ctx,
799 VABufferID buf_id, /* in */
800 void **pbuf /* out */
804 VAStatus vaStatus = VA_STATUS_ERROR_UNKNOWN;
805 object_buffer_p obj_buffer = BUFFER(buf_id);
807 if (NULL == obj_buffer)
809 vaStatus = VA_STATUS_ERROR_INVALID_BUFFER;
813 if (NULL != obj_buffer->buffer_data)
815 *pbuf = obj_buffer->buffer_data;
816 vaStatus = VA_STATUS_SUCCESS;
821 VAStatus dummy_UnmapBuffer(
822 VADriverContextP ctx,
823 VABufferID buf_id /* in */
827 return VA_STATUS_SUCCESS;
830 static void dummy__destroy_buffer(struct dummy_driver_data *driver_data, object_buffer_p obj_buffer)
832 if (NULL != obj_buffer->buffer_data)
834 free(obj_buffer->buffer_data);
835 obj_buffer->buffer_data = NULL;
838 object_heap_free( &driver_data->buffer_heap, (object_base_p) obj_buffer);
841 VAStatus dummy_DestroyBuffer(
842 VADriverContextP ctx,
847 object_buffer_p obj_buffer = BUFFER(buffer_id);
850 dummy__destroy_buffer(driver_data, obj_buffer);
851 return VA_STATUS_SUCCESS;
854 VAStatus dummy_BeginPicture(
855 VADriverContextP ctx,
857 VASurface *render_target
861 VAStatus vaStatus = VA_STATUS_SUCCESS;
862 object_context_p obj_context;
863 object_surface_p obj_surface;
865 obj_context = CONTEXT(context->context_id);
868 obj_surface = SURFACE(render_target->surface_id);
871 obj_context->current_render_target = obj_surface->base.id;
876 VAStatus dummy_RenderPicture(
877 VADriverContextP ctx,
884 VAStatus vaStatus = VA_STATUS_SUCCESS;
885 object_context_p obj_context;
886 object_surface_p obj_surface;
889 obj_context = CONTEXT(context->context_id);
892 obj_surface = SURFACE(obj_context->current_render_target);
895 /* verify that we got valid buffer references */
896 for(i = 0; i < num_buffers; i++)
898 object_buffer_p obj_buffer = BUFFER(buffers[i]);
900 if (NULL == obj_buffer)
902 vaStatus = VA_STATUS_ERROR_INVALID_BUFFER;
910 VAStatus dummy_EndPicture(
911 VADriverContextP ctx,
916 VAStatus vaStatus = VA_STATUS_SUCCESS;
917 object_context_p obj_context;
918 object_surface_p obj_surface;
920 obj_context = CONTEXT(context->context_id);
923 obj_surface = SURFACE(obj_context->current_render_target);
926 // For now, assume that we are done with rendering right away
927 obj_context->current_render_target = -1;
933 VAStatus dummy_SyncSurface(
934 VADriverContextP ctx,
936 VASurface *render_target
940 VAStatus vaStatus = VA_STATUS_SUCCESS;
941 object_context_p obj_context;
942 object_surface_p obj_surface;
944 obj_context = CONTEXT(context->context_id);
947 obj_surface = SURFACE(render_target->surface_id);
950 /* Assume that this shouldn't be called before vaEndPicture() */
951 ASSERT( obj_context->current_render_target != obj_surface->base.id );
956 VAStatus dummy_QuerySurfaceStatus(
957 VADriverContextP ctx,
959 VASurface *render_target,
960 VASurfaceStatus *status /* out */
964 VAStatus vaStatus = VA_STATUS_SUCCESS;
965 object_context_p obj_context;
966 object_surface_p obj_surface;
968 obj_context = CONTEXT(context->context_id);
971 obj_surface = SURFACE(render_target->surface_id);
974 /* Assume that we are busy until vaEndPicture() is called */
975 if ( obj_context->current_render_target == obj_surface->base.id )
977 *status = VASurfaceRendering;
981 *status = VASurfaceReady;
987 VAStatus dummy_PutSurface(
988 VADriverContextP ctx,
990 Drawable draw, /* X Drawable */
997 unsigned short destw,
998 unsigned short desth,
999 VARectangle *cliprects, /* client supplied clip list */
1000 unsigned int number_cliprects, /* number of clip rects in the clip list */
1001 int flags /* de-interlacing flags */
1005 return VA_STATUS_ERROR_UNKNOWN;
1008 VAStatus dummy_DbgCopySurfaceToBuffer(
1009 VADriverContextP ctx,
1011 void **buffer, /* out */
1012 unsigned int *stride /* out */
1016 return VA_STATUS_ERROR_UNKNOWN;
1019 VAStatus dummy_Terminate( VADriverContextP ctx )
1022 object_buffer_p obj_buffer;
1023 object_surface_p obj_surface;
1024 object_context_p obj_context;
1025 object_config_p obj_config;
1026 object_heap_iterator iter;
1028 /* Clean up left over buffers */
1029 obj_buffer = (object_buffer_p) object_heap_first( &driver_data->buffer_heap, &iter);
1032 dummy__information_message("vaTerminate: bufferID %08x still allocated, destroying\n", obj_buffer->base.id);
1033 dummy__destroy_buffer(driver_data, obj_buffer);
1034 obj_buffer = (object_buffer_p) object_heap_next( &driver_data->buffer_heap, &iter);
1036 object_heap_destroy( &driver_data->buffer_heap );
1039 object_heap_destroy( &driver_data->surface_heap );
1042 object_heap_destroy( &driver_data->context_heap );
1044 /* Clean up configIDs */
1045 obj_config = (object_config_p) object_heap_first( &driver_data->config_heap, &iter);
1048 object_heap_free( &driver_data->config_heap, (object_base_p) obj_config);
1049 obj_config = (object_config_p) object_heap_next( &driver_data->config_heap, &iter);
1051 object_heap_destroy( &driver_data->config_heap );
1053 free(ctx->pDriverData);
1054 ctx->pDriverData = NULL;
1056 return VA_STATUS_SUCCESS;
1059 VAStatus __vaDriverInit_0_22( VADriverContextP ctx )
1063 struct dummy_driver_data *driver_data;
1066 ctx->version_major = 0;
1067 ctx->version_minor = 22;
1068 ctx->max_profiles = DUMMY_MAX_PROFILES;
1069 ctx->max_entrypoints = DUMMY_MAX_ENTRYPOINTS;
1070 ctx->max_attributes = DUMMY_MAX_CONFIG_ATTRIBUTES;
1071 ctx->max_image_formats = DUMMY_MAX_IMAGE_FORMATS;
1072 ctx->max_subpic_formats = DUMMY_MAX_SUBPIC_FORMATS;
1074 ctx->vtable.vaTerminate = dummy_Terminate;
1075 ctx->vtable.vaQueryConfigEntrypoints = dummy_QueryConfigEntrypoints;
1076 ctx->vtable.vaQueryConfigProfiles = dummy_QueryConfigProfiles;
1077 ctx->vtable.vaQueryConfigEntrypoints = dummy_QueryConfigEntrypoints;
1078 ctx->vtable.vaQueryConfigAttributes = dummy_QueryConfigAttributes;
1079 ctx->vtable.vaCreateConfig = dummy_CreateConfig;
1080 ctx->vtable.vaGetConfigAttributes = dummy_GetConfigAttributes;
1081 ctx->vtable.vaCreateSurfaces = dummy_CreateSurfaces;
1082 ctx->vtable.vaDestroySurface = dummy_DestroySurface;
1083 ctx->vtable.vaCreateContext = dummy_CreateContext;
1084 ctx->vtable.vaDestroyContext = dummy_DestroyContext;
1085 ctx->vtable.vaCreateBuffer = dummy_CreateBuffer;
1086 ctx->vtable.vaBufferData = dummy_BufferData;
1087 ctx->vtable.vaBufferSetNumElements = dummy_BufferSetNumElements;
1088 ctx->vtable.vaMapBuffer = dummy_MapBuffer;
1089 ctx->vtable.vaUnmapBuffer = dummy_UnmapBuffer;
1090 ctx->vtable.vaDestroyBuffer = dummy_DestroyBuffer;
1091 ctx->vtable.vaBeginPicture = dummy_BeginPicture;
1092 ctx->vtable.vaRenderPicture = dummy_RenderPicture;
1093 ctx->vtable.vaEndPicture = dummy_EndPicture;
1094 ctx->vtable.vaSyncSurface = dummy_SyncSurface;
1095 ctx->vtable.vaQuerySurfaceStatus = dummy_QuerySurfaceStatus;
1096 ctx->vtable.vaPutSurface = dummy_PutSurface;
1097 ctx->vtable.vaQueryImageFormats = dummy_QueryImageFormats;
1098 ctx->vtable.vaCreateImage = dummy_CreateImage;
1099 ctx->vtable.vaDestroyImage = dummy_DestroyImage;
1100 ctx->vtable.vaGetImage = dummy_GetImage;
1101 ctx->vtable.vaPutImage = dummy_PutImage;
1102 ctx->vtable.vaQuerySubpictureFormats = dummy_QuerySubpictureFormats;
1103 ctx->vtable.vaCreateSubpicture = dummy_CreateSubpicture;
1104 ctx->vtable.vaDestroySubpicture = dummy_DestroySubpicture;
1105 ctx->vtable.vaSetSubpicturePalette = dummy_SetSubpicturePalette;
1106 ctx->vtable.vaSetSubpictureChromakey = dummy_SetSubpictureChromakey;
1107 ctx->vtable.vaSetSubpictureGlobalAlpha = dummy_SetSubpictureGlobalAlpha;
1108 ctx->vtable.vaAssociateSubpicture = dummy_AssociateSubpicture;
1109 ctx->vtable.vaDbgCopySurfaceToBuffer = dummy_DbgCopySurfaceToBuffer;
1111 driver_data = (struct dummy_driver_data *) malloc( sizeof(*driver_data) );
1112 ctx->pDriverData = (void *) driver_data;
1114 result = object_heap_init( &driver_data->config_heap, sizeof(struct object_config), CONFIG_ID_OFFSET );
1115 ASSERT( result == 0 );
1117 result = object_heap_init( &driver_data->context_heap, sizeof(struct object_context), CONTEXT_ID_OFFSET );
1118 ASSERT( result == 0 );
1120 result = object_heap_init( &driver_data->surface_heap, sizeof(struct object_surface), SURFACE_ID_OFFSET );
1121 ASSERT( result == 0 );
1123 result = object_heap_init( &driver_data->buffer_heap, sizeof(struct object_buffer), BUFFER_ID_OFFSET );
1124 ASSERT( result == 0 );
1127 return VA_STATUS_SUCCESS;