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_CreateContext(
414 VADriverContextP ctx,
415 VAConfigID config_id,
419 VASurface *render_targets,
420 int num_render_targets,
421 VAContext *context /* out */
425 VAStatus vaStatus = VA_STATUS_SUCCESS;
426 object_config_p obj_config;
429 obj_config = CONFIG(config_id);
430 if (NULL == obj_config)
432 vaStatus = VA_STATUS_ERROR_INVALID_CONFIG;
437 /* Validate picture dimensions */
439 int contextID = object_heap_allocate( &driver_data->context_heap );
440 object_context_p obj_context = CONTEXT(contextID);
441 if (NULL == obj_context)
443 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
447 obj_context->context = context;
448 obj_context->current_render_target = -1;
450 obj_context->context->context_id = contextID;
451 obj_context->context->config_id = config_id;
452 obj_context->context->picture_width = picture_width;
453 obj_context->context->picture_height = picture_height;
454 obj_context->context->num_render_targets = num_render_targets;
455 obj_context->context->render_targets = (VASurfaceID *) malloc(num_render_targets * sizeof(VASurfaceID));
456 for(i = 0; i < num_render_targets; i++)
458 if (NULL == SURFACE(render_targets[i].surface_id))
460 vaStatus = VA_STATUS_ERROR_INVALID_SURFACE;
463 obj_context->context->render_targets[i] = render_targets[i].surface_id;
465 obj_context->context->flags = flag;
466 obj_context->context->privData = NULL;
469 if (VA_STATUS_SUCCESS != vaStatus)
471 free(obj_context->context->render_targets);
472 obj_context->context->render_targets = NULL;
473 obj_context->context->context_id = -1;
474 obj_context->context->config_id = -1;
475 obj_context->context->picture_width = 0;
476 obj_context->context->picture_height = 0;
477 free(obj_context->context->render_targets);
478 obj_context->context->render_targets = NULL;
479 obj_context->context->num_render_targets = 0;
480 obj_context->context->flags = 0;
481 obj_context->context->privData = NULL;
482 object_heap_free( &driver_data->context_heap, (object_base_p) obj_context);
489 VAStatus dummy_DestroyContext(
490 VADriverContextP ctx,
495 object_context_p obj_context = CONTEXT(context->context_id);
498 obj_context->context->context_id = -1;
499 obj_context->context->config_id = -1;
500 obj_context->context->picture_width = 0;
501 obj_context->context->picture_height = 0;
502 if (obj_context->context->render_targets)
504 free(obj_context->context->render_targets);
506 obj_context->context->render_targets = NULL;
507 obj_context->context->num_render_targets = 0;
508 obj_context->context->flags = 0;
509 obj_context->context->privData = NULL;
511 obj_context->context = NULL;
512 obj_context->current_render_target = -1;
514 object_heap_free( &driver_data->context_heap, (object_base_p) obj_context);
516 return VA_STATUS_SUCCESS;
520 VAStatus dummy_CreateBuffer(
521 VADriverContextP ctx,
522 VABufferType type, /* in */
523 VABufferID *buf_desc /* out */
527 VAStatus vaStatus = VA_STATUS_SUCCESS;
529 object_buffer_p obj_buffer;
534 case VAPictureParameterBufferType:
535 case VAIQMatrixBufferType:
536 case VASliceParameterBufferType:
537 case VASliceDataBufferType:
538 case VAMacroblockParameterBufferType:
539 case VAResidualDataBufferType:
540 case VADeblockingParameterBufferType:
544 vaStatus = VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE;
548 bufferID = object_heap_allocate( &driver_data->buffer_heap );
549 obj_buffer = BUFFER(bufferID);
550 if (NULL == obj_buffer)
552 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
556 obj_buffer->buffer_data = NULL;
558 *buf_desc = bufferID;
563 static VAStatus dummy__allocate_buffer(object_buffer_p obj_buffer, int size)
565 VAStatus vaStatus = VA_STATUS_SUCCESS;
567 obj_buffer->buffer_data = realloc(obj_buffer->buffer_data, size);
568 if (NULL == obj_buffer->buffer_data)
570 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
575 VAStatus dummy_BufferData(
576 VADriverContextP ctx,
577 VABufferID buf_id, /* in */
578 unsigned int size, /* in */
579 unsigned int num_elements, /* in */
584 VAStatus vaStatus = VA_STATUS_SUCCESS;
585 object_buffer_p obj_buffer = BUFFER(buf_id);
588 vaStatus = dummy__allocate_buffer(obj_buffer, size * num_elements);
589 if (VA_STATUS_SUCCESS == vaStatus)
591 obj_buffer->max_num_elements = num_elements;
592 obj_buffer->num_elements = num_elements;
595 memcpy(obj_buffer->buffer_data, data, size * num_elements);
602 VAStatus dummy_BufferSetNumElements(
603 VADriverContextP ctx,
604 VABufferID buf_id, /* in */
605 unsigned int num_elements /* in */
609 VAStatus vaStatus = VA_STATUS_SUCCESS;
610 object_buffer_p obj_buffer = BUFFER(buf_id);
613 if ((num_elements < 0) || (num_elements > obj_buffer->max_num_elements))
615 vaStatus = VA_STATUS_ERROR_UNKNOWN;
617 if (VA_STATUS_SUCCESS == vaStatus)
619 obj_buffer->num_elements = num_elements;
625 VAStatus dummy_MapBuffer(
626 VADriverContextP ctx,
627 VABufferID buf_id, /* in */
628 void **pbuf /* out */
632 VAStatus vaStatus = VA_STATUS_ERROR_UNKNOWN;
633 object_buffer_p obj_buffer = BUFFER(buf_id);
635 if (NULL == obj_buffer)
637 vaStatus = VA_STATUS_ERROR_INVALID_BUFFER;
641 if (NULL != obj_buffer->buffer_data)
643 *pbuf = obj_buffer->buffer_data;
644 vaStatus = VA_STATUS_SUCCESS;
649 VAStatus dummy_UnmapBuffer(
650 VADriverContextP ctx,
651 VABufferID buf_id /* in */
655 return VA_STATUS_SUCCESS;
658 static void dummy__destroy_buffer(struct dummy_driver_data *driver_data, object_buffer_p obj_buffer)
660 if (NULL != obj_buffer->buffer_data)
662 free(obj_buffer->buffer_data);
663 obj_buffer->buffer_data = NULL;
666 object_heap_free( &driver_data->buffer_heap, (object_base_p) obj_buffer);
669 VAStatus dummy_DestroyBuffer(
670 VADriverContextP ctx,
675 object_buffer_p obj_buffer = BUFFER(buffer_id);
678 dummy__destroy_buffer(driver_data, obj_buffer);
679 return VA_STATUS_SUCCESS;
682 VAStatus dummy_BeginPicture(
683 VADriverContextP ctx,
685 VASurface *render_target
689 VAStatus vaStatus = VA_STATUS_SUCCESS;
690 object_context_p obj_context;
691 object_surface_p obj_surface;
693 obj_context = CONTEXT(context->context_id);
696 obj_surface = SURFACE(render_target->surface_id);
699 obj_context->current_render_target = obj_surface->base.id;
704 VAStatus dummy_RenderPicture(
705 VADriverContextP ctx,
712 VAStatus vaStatus = VA_STATUS_SUCCESS;
713 object_context_p obj_context;
714 object_surface_p obj_surface;
717 obj_context = CONTEXT(context->context_id);
720 obj_surface = SURFACE(obj_context->current_render_target);
723 /* verify that we got valid buffer references */
724 for(i = 0; i < num_buffers; i++)
726 object_buffer_p obj_buffer = BUFFER(buffers[i]);
728 if (NULL == obj_buffer)
730 vaStatus = VA_STATUS_ERROR_INVALID_BUFFER;
738 VAStatus dummy_EndPicture(
739 VADriverContextP ctx,
744 VAStatus vaStatus = VA_STATUS_SUCCESS;
745 object_context_p obj_context;
746 object_surface_p obj_surface;
748 obj_context = CONTEXT(context->context_id);
751 obj_surface = SURFACE(obj_context->current_render_target);
754 // For now, assume that we are done with rendering right away
755 obj_context->current_render_target = -1;
761 VAStatus dummy_SyncSurface(
762 VADriverContextP ctx,
764 VASurface *render_target
768 VAStatus vaStatus = VA_STATUS_SUCCESS;
769 object_context_p obj_context;
770 object_surface_p obj_surface;
772 obj_context = CONTEXT(context->context_id);
775 obj_surface = SURFACE(render_target->surface_id);
778 /* Assume that this shouldn't be called before vaEndPicture() */
779 ASSERT( obj_context->current_render_target != obj_surface->base.id );
784 VAStatus dummy_QuerySurfaceStatus(
785 VADriverContextP ctx,
787 VASurface *render_target,
788 VASurfaceStatus *status /* out */
792 VAStatus vaStatus = VA_STATUS_SUCCESS;
793 object_context_p obj_context;
794 object_surface_p obj_surface;
796 obj_context = CONTEXT(context->context_id);
799 obj_surface = SURFACE(render_target->surface_id);
802 /* Assume that we are busy until vaEndPicture() is called */
803 if ( obj_context->current_render_target == obj_surface->base.id )
805 *status = VASurfaceRendering;
809 *status = VASurfaceReady;
815 VAStatus dummy_PutSurface(
816 VADriverContextP ctx,
818 Drawable draw, /* X Drawable */
825 unsigned short destw,
826 unsigned short desth,
827 int flags /* de-interlacing flags */
831 return VA_STATUS_ERROR_UNKNOWN;
834 VAStatus dummy_DbgCopySurfaceToBuffer(
835 VADriverContextP ctx,
837 void **buffer, /* out */
838 unsigned int *stride /* out */
842 return VA_STATUS_ERROR_UNKNOWN;
845 VAStatus dummy_Terminate( VADriverContextP ctx )
848 object_buffer_p obj_buffer;
849 object_surface_p obj_surface;
850 object_context_p obj_context;
851 object_config_p obj_config;
852 object_heap_iterator iter;
854 /* Clean up left over buffers */
855 obj_buffer = (object_buffer_p) object_heap_first( &driver_data->buffer_heap, &iter);
858 dummy__information_message("vaTerminate: bufferID %08x still allocated, destroying\n", obj_buffer->base.id);
859 dummy__destroy_buffer(driver_data, obj_buffer);
860 obj_buffer = (object_buffer_p) object_heap_next( &driver_data->buffer_heap, &iter);
862 object_heap_destroy( &driver_data->buffer_heap );
865 object_heap_destroy( &driver_data->surface_heap );
868 object_heap_destroy( &driver_data->context_heap );
870 /* Clean up configIDs */
871 obj_config = (object_config_p) object_heap_first( &driver_data->config_heap, &iter);
874 object_heap_free( &driver_data->config_heap, (object_base_p) obj_config);
875 obj_config = (object_config_p) object_heap_next( &driver_data->config_heap, &iter);
877 object_heap_destroy( &driver_data->config_heap );
879 free(ctx->pDriverData);
880 ctx->pDriverData = NULL;
882 return VA_STATUS_SUCCESS;
885 VAStatus __vaDriverInit_0_20( VADriverContextP ctx )
889 struct dummy_driver_data *driver_data;
892 ctx->version_major = 0;
893 ctx->version_minor = 20;
894 ctx->max_profiles = DUMMY_MAX_PROFILES;
895 ctx->max_entrypoints = DUMMY_MAX_ENTRYPOINTS;
896 ctx->max_attributes = DUMMY_MAX_CONFIG_ATTRIBUTES;
898 ctx->vtable.vaTerminate = dummy_Terminate;
899 ctx->vtable.vaQueryConfigEntrypoints = dummy_QueryConfigEntrypoints;
900 ctx->vtable.vaTerminate = dummy_Terminate;
901 ctx->vtable.vaQueryConfigProfiles = dummy_QueryConfigProfiles;
902 ctx->vtable.vaQueryConfigEntrypoints = dummy_QueryConfigEntrypoints;
903 ctx->vtable.vaQueryConfigAttributes = dummy_QueryConfigAttributes;
904 ctx->vtable.vaCreateConfig = dummy_CreateConfig;
905 ctx->vtable.vaGetConfigAttributes = dummy_GetConfigAttributes;
906 ctx->vtable.vaCreateSurfaces = dummy_CreateSurfaces;
907 ctx->vtable.vaDestroySurface = dummy_DestroySurface;
908 ctx->vtable.vaCreateContext = dummy_CreateContext;
909 ctx->vtable.vaDestroyContext = dummy_DestroyContext;
910 ctx->vtable.vaCreateBuffer = dummy_CreateBuffer;
911 ctx->vtable.vaBufferData = dummy_BufferData;
912 ctx->vtable.vaBufferSetNumElements = dummy_BufferSetNumElements;
913 ctx->vtable.vaMapBuffer = dummy_MapBuffer;
914 ctx->vtable.vaUnmapBuffer = dummy_UnmapBuffer;
915 ctx->vtable.vaDestroyBuffer = dummy_DestroyBuffer;
916 ctx->vtable.vaBeginPicture = dummy_BeginPicture;
917 ctx->vtable.vaRenderPicture = dummy_RenderPicture;
918 ctx->vtable.vaEndPicture = dummy_EndPicture;
919 ctx->vtable.vaSyncSurface = dummy_SyncSurface;
920 ctx->vtable.vaQuerySurfaceStatus = dummy_QuerySurfaceStatus;
921 ctx->vtable.vaPutSurface = dummy_PutSurface;
922 ctx->vtable.vaDbgCopySurfaceToBuffer = dummy_DbgCopySurfaceToBuffer;
924 driver_data = (struct dummy_driver_data *) malloc( sizeof(*driver_data) );
925 ctx->pDriverData = (void *) driver_data;
927 result = object_heap_init( &driver_data->config_heap, sizeof(struct object_config), CONFIG_ID_OFFSET );
928 ASSERT( result == 0 );
930 result = object_heap_init( &driver_data->context_heap, sizeof(struct object_context), CONTEXT_ID_OFFSET );
931 ASSERT( result == 0 );
933 result = object_heap_init( &driver_data->surface_heap, sizeof(struct object_surface), SURFACE_ID_OFFSET );
934 ASSERT( result == 0 );
936 result = object_heap_init( &driver_data->buffer_heap, sizeof(struct object_buffer), BUFFER_ID_OFFSET );
937 ASSERT( result == 0 );
940 return VA_STATUS_SUCCESS;