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.
26 #include <va/va_backend.h>
28 #include "dummy_drv_video.h"
38 #define INIT_DRIVER_DATA struct dummy_driver_data * const driver_data = (struct dummy_driver_data *) ctx->pDriverData;
40 #define CONFIG(id) ((object_config_p) object_heap_lookup( &driver_data->config_heap, id ))
41 #define CONTEXT(id) ((object_context_p) object_heap_lookup( &driver_data->context_heap, id ))
42 #define SURFACE(id) ((object_surface_p) object_heap_lookup( &driver_data->surface_heap, id ))
43 #define BUFFER(id) ((object_buffer_p) object_heap_lookup( &driver_data->buffer_heap, id ))
45 #define CONFIG_ID_OFFSET 0x01000000
46 #define CONTEXT_ID_OFFSET 0x02000000
47 #define SURFACE_ID_OFFSET 0x04000000
48 #define BUFFER_ID_OFFSET 0x08000000
50 static void dummy__error_message(const char *msg, ...)
54 fprintf(stderr, "dummy_drv_video error: ");
56 vfprintf(stderr, msg, args);
60 static void dummy__information_message(const char *msg, ...)
64 fprintf(stderr, "dummy_drv_video: ");
66 vfprintf(stderr, msg, args);
70 VAStatus dummy_QueryConfigProfiles(
72 VAProfile *profile_list, /* out */
73 int *num_profiles /* out */
78 profile_list[i++] = VAProfileMPEG2Simple;
79 profile_list[i++] = VAProfileMPEG2Main;
80 profile_list[i++] = VAProfileMPEG4Simple;
81 profile_list[i++] = VAProfileMPEG4AdvancedSimple;
82 profile_list[i++] = VAProfileMPEG4Main;
83 profile_list[i++] = VAProfileH264Baseline;
84 profile_list[i++] = VAProfileH264Main;
85 profile_list[i++] = VAProfileH264High;
86 profile_list[i++] = VAProfileVC1Simple;
87 profile_list[i++] = VAProfileVC1Main;
88 profile_list[i++] = VAProfileVC1Advanced;
90 /* If the assert fails then DUMMY_MAX_PROFILES needs to be bigger */
91 ASSERT(i <= DUMMY_MAX_PROFILES);
94 return VA_STATUS_SUCCESS;
97 VAStatus dummy_QueryConfigEntrypoints(
100 VAEntrypoint *entrypoint_list, /* out */
101 int *num_entrypoints /* out */
105 case VAProfileMPEG2Simple:
106 case VAProfileMPEG2Main:
107 *num_entrypoints = 2;
108 entrypoint_list[0] = VAEntrypointVLD;
109 entrypoint_list[1] = VAEntrypointMoComp;
112 case VAProfileMPEG4Simple:
113 case VAProfileMPEG4AdvancedSimple:
114 case VAProfileMPEG4Main:
115 *num_entrypoints = 1;
116 entrypoint_list[0] = VAEntrypointVLD;
119 case VAProfileH264Baseline:
120 case VAProfileH264Main:
121 case VAProfileH264High:
122 *num_entrypoints = 1;
123 entrypoint_list[0] = VAEntrypointVLD;
126 case VAProfileVC1Simple:
127 case VAProfileVC1Main:
128 case VAProfileVC1Advanced:
129 *num_entrypoints = 1;
130 entrypoint_list[0] = VAEntrypointVLD;
134 *num_entrypoints = 0;
138 /* If the assert fails then DUMMY_MAX_ENTRYPOINTS needs to be bigger */
139 ASSERT(*num_entrypoints <= DUMMY_MAX_ENTRYPOINTS);
140 return VA_STATUS_SUCCESS;
143 VAStatus dummy_GetConfigAttributes(
144 VADriverContextP ctx,
146 VAEntrypoint entrypoint,
147 VAConfigAttrib *attrib_list, /* in/out */
153 /* Other attributes don't seem to be defined */
154 /* What to do if we don't know the attribute? */
155 for (i = 0; i < num_attribs; i++)
157 switch (attrib_list[i].type)
159 case VAConfigAttribRTFormat:
160 attrib_list[i].value = VA_RT_FORMAT_YUV420;
165 attrib_list[i].value = VA_ATTRIB_NOT_SUPPORTED;
170 return VA_STATUS_SUCCESS;
173 static VAStatus dummy__update_attribute(object_config_p obj_config, VAConfigAttrib *attrib)
176 /* Check existing attrbiutes */
177 for(i = 0; obj_config->attrib_count < i; i++)
179 if (obj_config->attrib_list[i].type == attrib->type)
181 /* Update existing attribute */
182 obj_config->attrib_list[i].value = attrib->value;
183 return VA_STATUS_SUCCESS;
186 if (obj_config->attrib_count < DUMMY_MAX_CONFIG_ATTRIBUTES)
188 i = obj_config->attrib_count;
189 obj_config->attrib_list[i].type = attrib->type;
190 obj_config->attrib_list[i].value = attrib->value;
191 obj_config->attrib_count++;
192 return VA_STATUS_SUCCESS;
194 return VA_STATUS_ERROR_MAX_NUM_EXCEEDED;
197 VAStatus dummy_CreateConfig(
198 VADriverContextP ctx,
200 VAEntrypoint entrypoint,
201 VAConfigAttrib *attrib_list,
203 VAConfigID *config_id /* out */
209 object_config_p obj_config;
212 /* Validate profile & entrypoint */
214 case VAProfileMPEG2Simple:
215 case VAProfileMPEG2Main:
216 if ((VAEntrypointVLD == entrypoint) ||
217 (VAEntrypointMoComp == entrypoint))
219 vaStatus = VA_STATUS_SUCCESS;
223 vaStatus = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
227 case VAProfileMPEG4Simple:
228 case VAProfileMPEG4AdvancedSimple:
229 case VAProfileMPEG4Main:
230 if (VAEntrypointVLD == entrypoint)
232 vaStatus = VA_STATUS_SUCCESS;
236 vaStatus = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
240 case VAProfileH264Baseline:
241 case VAProfileH264Main:
242 case VAProfileH264High:
243 if (VAEntrypointVLD == entrypoint)
245 vaStatus = VA_STATUS_SUCCESS;
249 vaStatus = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
253 case VAProfileVC1Simple:
254 case VAProfileVC1Main:
255 case VAProfileVC1Advanced:
256 if (VAEntrypointVLD == entrypoint)
258 vaStatus = VA_STATUS_SUCCESS;
262 vaStatus = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
267 vaStatus = VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
271 if (VA_STATUS_SUCCESS != vaStatus)
276 configID = object_heap_allocate( &driver_data->config_heap );
277 obj_config = CONFIG(configID);
278 if (NULL == obj_config)
280 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
284 obj_config->profile = profile;
285 obj_config->entrypoint = entrypoint;
286 obj_config->attrib_list[0].type = VAConfigAttribRTFormat;
287 obj_config->attrib_list[0].value = VA_RT_FORMAT_YUV420;
288 obj_config->attrib_count = 1;
290 for(i = 0; i < num_attribs; i++)
292 vaStatus = dummy__update_attribute(obj_config, &(attrib_list[i]));
293 if (VA_STATUS_SUCCESS != vaStatus)
300 if (VA_STATUS_SUCCESS != vaStatus)
302 object_heap_free( &driver_data->config_heap, (object_base_p) obj_config);
306 *config_id = configID;
312 VAStatus dummy_DestroyConfig(
313 VADriverContextP ctx,
319 object_config_p obj_config;
321 obj_config = CONFIG(config_id);
322 if (NULL == obj_config)
324 vaStatus = VA_STATUS_ERROR_INVALID_CONFIG;
328 object_heap_free( &driver_data->config_heap, (object_base_p) obj_config);
329 return VA_STATUS_SUCCESS;
332 VAStatus dummy_QueryConfigAttributes(
333 VADriverContextP ctx,
334 VAConfigID config_id,
335 VAProfile *profile, /* out */
336 VAEntrypoint *entrypoint, /* out */
337 VAConfigAttrib *attrib_list, /* out */
338 int *num_attribs /* out */
342 VAStatus vaStatus = VA_STATUS_SUCCESS;
343 object_config_p obj_config;
346 obj_config = CONFIG(config_id);
349 *profile = obj_config->profile;
350 *entrypoint = obj_config->entrypoint;
351 *num_attribs = obj_config->attrib_count;
352 for(i = 0; i < obj_config->attrib_count; i++)
354 attrib_list[i] = obj_config->attrib_list[i];
360 VAStatus dummy_CreateSurfaces(
361 VADriverContextP ctx,
366 VASurfaceID *surfaces /* out */
370 VAStatus vaStatus = VA_STATUS_SUCCESS;
373 /* We only support one format */
374 if (VA_RT_FORMAT_YUV420 != format)
376 return VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT;
379 for (i = 0; i < num_surfaces; i++)
381 int surfaceID = object_heap_allocate( &driver_data->surface_heap );
382 object_surface_p obj_surface = SURFACE(surfaceID);
383 if (NULL == obj_surface)
385 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
388 obj_surface->surface_id = surfaceID;
389 surfaces[i] = surfaceID;
393 if (VA_STATUS_SUCCESS != vaStatus)
395 /* surfaces[i-1] was the last successful allocation */
398 object_surface_p obj_surface = SURFACE(surfaces[i]);
399 surfaces[i] = VA_INVALID_SURFACE;
401 object_heap_free( &driver_data->surface_heap, (object_base_p) obj_surface);
408 VAStatus dummy_DestroySurfaces(
409 VADriverContextP ctx,
410 VASurfaceID *surface_list,
416 for(i = num_surfaces; i--; )
418 object_surface_p obj_surface = SURFACE(surface_list[i]);
420 object_heap_free( &driver_data->surface_heap, (object_base_p) obj_surface);
422 return VA_STATUS_SUCCESS;
425 VAStatus dummy_QueryImageFormats(
426 VADriverContextP ctx,
427 VAImageFormat *format_list, /* out */
428 int *num_formats /* out */
432 return VA_STATUS_SUCCESS;
435 VAStatus dummy_CreateImage(
436 VADriverContextP ctx,
437 VAImageFormat *format,
440 VAImage *image /* out */
444 return VA_STATUS_SUCCESS;
447 VAStatus dummy_DeriveImage(
448 VADriverContextP ctx,
450 VAImage *image /* out */
454 return VA_STATUS_SUCCESS;
457 VAStatus dummy_DestroyImage(
458 VADriverContextP ctx,
463 return VA_STATUS_SUCCESS;
466 VAStatus dummy_SetImagePalette(
467 VADriverContextP ctx,
469 unsigned char *palette
473 return VA_STATUS_SUCCESS;
476 VAStatus dummy_GetImage(
477 VADriverContextP ctx,
479 int x, /* coordinates of the upper left source pixel */
481 unsigned int width, /* width and height of the region */
487 return VA_STATUS_SUCCESS;
491 VAStatus dummy_PutImage(
492 VADriverContextP ctx,
497 unsigned int src_width,
498 unsigned int src_height,
501 unsigned int dest_width,
502 unsigned int dest_height
506 return VA_STATUS_SUCCESS;
509 VAStatus dummy_QuerySubpictureFormats(
510 VADriverContextP ctx,
511 VAImageFormat *format_list, /* out */
512 unsigned int *flags, /* out */
513 unsigned int *num_formats /* out */
517 return VA_STATUS_SUCCESS;
520 VAStatus dummy_CreateSubpicture(
521 VADriverContextP ctx,
523 VASubpictureID *subpicture /* out */
527 return VA_STATUS_SUCCESS;
530 VAStatus dummy_DestroySubpicture(
531 VADriverContextP ctx,
532 VASubpictureID subpicture
536 return VA_STATUS_SUCCESS;
539 VAStatus dummy_SetSubpictureImage(
540 VADriverContextP ctx,
541 VASubpictureID subpicture,
546 return VA_STATUS_SUCCESS;
549 VAStatus dummy_SetSubpicturePalette(
550 VADriverContextP ctx,
551 VASubpictureID subpicture,
553 * pointer to an array holding the palette data. The size of the array is
554 * num_palette_entries * entry_bytes in size. The order of the components
555 * in the palette is described by the component_order in VASubpicture struct
557 unsigned char *palette
561 return VA_STATUS_SUCCESS;
564 VAStatus dummy_SetSubpictureChromakey(
565 VADriverContextP ctx,
566 VASubpictureID subpicture,
567 unsigned int chromakey_min,
568 unsigned int chromakey_max,
569 unsigned int chromakey_mask
573 return VA_STATUS_SUCCESS;
576 VAStatus dummy_SetSubpictureGlobalAlpha(
577 VADriverContextP ctx,
578 VASubpictureID subpicture,
583 return VA_STATUS_SUCCESS;
587 VAStatus dummy_AssociateSubpicture(
588 VADriverContextP ctx,
589 VASubpictureID subpicture,
590 VASurfaceID *target_surfaces,
592 short src_x, /* upper left offset in subpicture */
594 unsigned short src_width,
595 unsigned short src_height,
596 short dest_x, /* upper left offset in surface */
598 unsigned short dest_width,
599 unsigned short dest_height,
601 * whether to enable chroma-keying or global-alpha
602 * see VA_SUBPICTURE_XXX values
608 return VA_STATUS_SUCCESS;
611 VAStatus dummy_DeassociateSubpicture(
612 VADriverContextP ctx,
613 VASubpictureID subpicture,
614 VASurfaceID *target_surfaces,
619 return VA_STATUS_SUCCESS;
622 VAStatus dummy_CreateContext(
623 VADriverContextP ctx,
624 VAConfigID config_id,
628 VASurfaceID *render_targets,
629 int num_render_targets,
630 VAContextID *context /* out */
634 VAStatus vaStatus = VA_STATUS_SUCCESS;
635 object_config_p obj_config;
638 obj_config = CONFIG(config_id);
639 if (NULL == obj_config)
641 vaStatus = VA_STATUS_ERROR_INVALID_CONFIG;
646 /* Validate picture dimensions */
648 int contextID = object_heap_allocate( &driver_data->context_heap );
649 object_context_p obj_context = CONTEXT(contextID);
650 if (NULL == obj_context)
652 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
656 obj_context->context_id = contextID;
657 *context = contextID;
658 obj_context->current_render_target = -1;
659 obj_context->config_id = config_id;
660 obj_context->picture_width = picture_width;
661 obj_context->picture_height = picture_height;
662 obj_context->num_render_targets = num_render_targets;
663 obj_context->render_targets = (VASurfaceID *) malloc(num_render_targets * sizeof(VASurfaceID));
664 if (obj_context->render_targets == NULL)
666 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
670 for(i = 0; i < num_render_targets; i++)
672 if (NULL == SURFACE(render_targets[i]))
674 vaStatus = VA_STATUS_ERROR_INVALID_SURFACE;
677 obj_context->render_targets[i] = render_targets[i];
679 obj_context->flags = flag;
682 if (VA_STATUS_SUCCESS != vaStatus)
684 obj_context->context_id = -1;
685 obj_context->config_id = -1;
686 free(obj_context->render_targets);
687 obj_context->render_targets = NULL;
688 obj_context->num_render_targets = 0;
689 obj_context->flags = 0;
690 object_heap_free( &driver_data->context_heap, (object_base_p) obj_context);
697 VAStatus dummy_DestroyContext(
698 VADriverContextP ctx,
703 object_context_p obj_context = CONTEXT(context);
706 obj_context->context_id = -1;
707 obj_context->config_id = -1;
708 obj_context->picture_width = 0;
709 obj_context->picture_height = 0;
710 if (obj_context->render_targets)
712 free(obj_context->render_targets);
714 obj_context->render_targets = NULL;
715 obj_context->num_render_targets = 0;
716 obj_context->flags = 0;
718 obj_context->current_render_target = -1;
720 object_heap_free( &driver_data->context_heap, (object_base_p) obj_context);
722 return VA_STATUS_SUCCESS;
727 static VAStatus dummy__allocate_buffer(object_buffer_p obj_buffer, int size)
729 VAStatus vaStatus = VA_STATUS_SUCCESS;
731 obj_buffer->buffer_data = realloc(obj_buffer->buffer_data, size);
732 if (NULL == obj_buffer->buffer_data)
734 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
739 VAStatus dummy_CreateBuffer(
740 VADriverContextP ctx,
741 VAContextID context, /* in */
742 VABufferType type, /* in */
743 unsigned int size, /* in */
744 unsigned int num_elements, /* in */
746 VABufferID *buf_id /* out */
750 VAStatus vaStatus = VA_STATUS_SUCCESS;
752 object_buffer_p obj_buffer;
757 case VAPictureParameterBufferType:
758 case VAIQMatrixBufferType:
759 case VABitPlaneBufferType:
760 case VASliceGroupMapBufferType:
761 case VASliceParameterBufferType:
762 case VASliceDataBufferType:
763 case VAMacroblockParameterBufferType:
764 case VAResidualDataBufferType:
765 case VADeblockingParameterBufferType:
766 case VAImageBufferType:
770 vaStatus = VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE;
774 bufferID = object_heap_allocate( &driver_data->buffer_heap );
775 obj_buffer = BUFFER(bufferID);
776 if (NULL == obj_buffer)
778 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
782 obj_buffer->buffer_data = NULL;
784 vaStatus = dummy__allocate_buffer(obj_buffer, size * num_elements);
785 if (VA_STATUS_SUCCESS == vaStatus)
787 obj_buffer->max_num_elements = num_elements;
788 obj_buffer->num_elements = num_elements;
791 memcpy(obj_buffer->buffer_data, data, size * num_elements);
795 if (VA_STATUS_SUCCESS == vaStatus)
804 VAStatus dummy_BufferSetNumElements(
805 VADriverContextP ctx,
806 VABufferID buf_id, /* in */
807 unsigned int num_elements /* in */
811 VAStatus vaStatus = VA_STATUS_SUCCESS;
812 object_buffer_p obj_buffer = BUFFER(buf_id);
815 if ((num_elements < 0) || (num_elements > obj_buffer->max_num_elements))
817 vaStatus = VA_STATUS_ERROR_UNKNOWN;
819 if (VA_STATUS_SUCCESS == vaStatus)
821 obj_buffer->num_elements = num_elements;
827 VAStatus dummy_MapBuffer(
828 VADriverContextP ctx,
829 VABufferID buf_id, /* in */
830 void **pbuf /* out */
834 VAStatus vaStatus = VA_STATUS_ERROR_UNKNOWN;
835 object_buffer_p obj_buffer = BUFFER(buf_id);
837 if (NULL == obj_buffer)
839 vaStatus = VA_STATUS_ERROR_INVALID_BUFFER;
843 if (NULL != obj_buffer->buffer_data)
845 *pbuf = obj_buffer->buffer_data;
846 vaStatus = VA_STATUS_SUCCESS;
851 VAStatus dummy_UnmapBuffer(
852 VADriverContextP ctx,
853 VABufferID buf_id /* in */
857 return VA_STATUS_SUCCESS;
860 static void dummy__destroy_buffer(struct dummy_driver_data *driver_data, object_buffer_p obj_buffer)
862 if (NULL != obj_buffer->buffer_data)
864 free(obj_buffer->buffer_data);
865 obj_buffer->buffer_data = NULL;
868 object_heap_free( &driver_data->buffer_heap, (object_base_p) obj_buffer);
871 VAStatus dummy_DestroyBuffer(
872 VADriverContextP ctx,
877 object_buffer_p obj_buffer = BUFFER(buffer_id);
880 dummy__destroy_buffer(driver_data, obj_buffer);
881 return VA_STATUS_SUCCESS;
884 VAStatus dummy_BeginPicture(
885 VADriverContextP ctx,
887 VASurfaceID render_target
891 VAStatus vaStatus = VA_STATUS_SUCCESS;
892 object_context_p obj_context;
893 object_surface_p obj_surface;
895 obj_context = CONTEXT(context);
898 obj_surface = SURFACE(render_target);
901 obj_context->current_render_target = obj_surface->base.id;
906 VAStatus dummy_RenderPicture(
907 VADriverContextP ctx,
914 VAStatus vaStatus = VA_STATUS_SUCCESS;
915 object_context_p obj_context;
916 object_surface_p obj_surface;
919 obj_context = CONTEXT(context);
922 obj_surface = SURFACE(obj_context->current_render_target);
925 /* verify that we got valid buffer references */
926 for(i = 0; i < num_buffers; i++)
928 object_buffer_p obj_buffer = BUFFER(buffers[i]);
930 if (NULL == obj_buffer)
932 vaStatus = VA_STATUS_ERROR_INVALID_BUFFER;
937 /* Release buffers */
938 for(i = 0; i < num_buffers; i++)
940 object_buffer_p obj_buffer = BUFFER(buffers[i]);
942 dummy__destroy_buffer(driver_data, obj_buffer);
948 VAStatus dummy_EndPicture(
949 VADriverContextP ctx,
954 VAStatus vaStatus = VA_STATUS_SUCCESS;
955 object_context_p obj_context;
956 object_surface_p obj_surface;
958 obj_context = CONTEXT(context);
961 obj_surface = SURFACE(obj_context->current_render_target);
964 // For now, assume that we are done with rendering right away
965 obj_context->current_render_target = -1;
971 VAStatus dummy_SyncSurface(
972 VADriverContextP ctx,
973 VASurfaceID render_target
977 VAStatus vaStatus = VA_STATUS_SUCCESS;
978 object_surface_p obj_surface;
980 obj_surface = SURFACE(render_target);
986 VAStatus dummy_QuerySurfaceStatus(
987 VADriverContextP ctx,
988 VASurfaceID render_target,
989 VASurfaceStatus *status /* out */
993 VAStatus vaStatus = VA_STATUS_SUCCESS;
994 object_surface_p obj_surface;
996 obj_surface = SURFACE(render_target);
999 *status = VASurfaceReady;
1004 VAStatus dummy_PutSurface(
1005 VADriverContextP ctx,
1006 VASurfaceID surface,
1007 void *draw, /* X Drawable */
1010 unsigned short srcw,
1011 unsigned short srch,
1014 unsigned short destw,
1015 unsigned short desth,
1016 VARectangle *cliprects, /* client supplied clip list */
1017 unsigned int number_cliprects, /* number of clip rects in the clip list */
1018 unsigned int flags /* de-interlacing flags */
1022 return VA_STATUS_ERROR_UNKNOWN;
1026 * Query display attributes
1027 * The caller must provide a "attr_list" array that can hold at
1028 * least vaMaxNumDisplayAttributes() entries. The actual number of attributes
1029 * returned in "attr_list" is returned in "num_attributes".
1031 VAStatus dummy_QueryDisplayAttributes (
1032 VADriverContextP ctx,
1033 VADisplayAttribute *attr_list, /* out */
1034 int *num_attributes /* out */
1038 return VA_STATUS_ERROR_UNKNOWN;
1042 * Get display attributes
1043 * This function returns the current attribute values in "attr_list".
1044 * Only attributes returned with VA_DISPLAY_ATTRIB_GETTABLE set in the "flags" field
1045 * from vaQueryDisplayAttributes() can have their values retrieved.
1047 VAStatus dummy_GetDisplayAttributes (
1048 VADriverContextP ctx,
1049 VADisplayAttribute *attr_list, /* in/out */
1054 return VA_STATUS_ERROR_UNKNOWN;
1058 * Set display attributes
1059 * Only attributes returned with VA_DISPLAY_ATTRIB_SETTABLE set in the "flags" field
1060 * from vaQueryDisplayAttributes() can be set. If the attribute is not settable or
1061 * the value is out of range, the function returns VA_STATUS_ERROR_ATTR_NOT_SUPPORTED
1063 VAStatus dummy_SetDisplayAttributes (
1064 VADriverContextP ctx,
1065 VADisplayAttribute *attr_list,
1070 return VA_STATUS_ERROR_UNKNOWN;
1074 VAStatus dummy_BufferInfo(
1075 VADriverContextP ctx,
1076 VABufferID buf_id, /* in */
1077 VABufferType *type, /* out */
1078 unsigned int *size, /* out */
1079 unsigned int *num_elements /* out */
1083 return VA_STATUS_ERROR_UNIMPLEMENTED;
1088 VAStatus dummy_LockSurface(
1089 VADriverContextP ctx,
1090 VASurfaceID surface,
1091 unsigned int *fourcc, /* following are output argument */
1092 unsigned int *luma_stride,
1093 unsigned int *chroma_u_stride,
1094 unsigned int *chroma_v_stride,
1095 unsigned int *luma_offset,
1096 unsigned int *chroma_u_offset,
1097 unsigned int *chroma_v_offset,
1098 unsigned int *buffer_name,
1103 return VA_STATUS_ERROR_UNIMPLEMENTED;
1106 VAStatus dummy_UnlockSurface(
1107 VADriverContextP ctx,
1112 return VA_STATUS_ERROR_UNIMPLEMENTED;
1115 VAStatus dummy_Terminate( VADriverContextP ctx )
1118 object_buffer_p obj_buffer;
1119 object_config_p obj_config;
1120 object_heap_iterator iter;
1122 /* Clean up left over buffers */
1123 obj_buffer = (object_buffer_p) object_heap_first( &driver_data->buffer_heap, &iter);
1126 dummy__information_message("vaTerminate: bufferID %08x still allocated, destroying\n", obj_buffer->base.id);
1127 dummy__destroy_buffer(driver_data, obj_buffer);
1128 obj_buffer = (object_buffer_p) object_heap_next( &driver_data->buffer_heap, &iter);
1130 object_heap_destroy( &driver_data->buffer_heap );
1133 object_heap_destroy( &driver_data->surface_heap );
1136 object_heap_destroy( &driver_data->context_heap );
1138 /* Clean up configIDs */
1139 obj_config = (object_config_p) object_heap_first( &driver_data->config_heap, &iter);
1142 object_heap_free( &driver_data->config_heap, (object_base_p) obj_config);
1143 obj_config = (object_config_p) object_heap_next( &driver_data->config_heap, &iter);
1145 object_heap_destroy( &driver_data->config_heap );
1147 free(ctx->pDriverData);
1148 ctx->pDriverData = NULL;
1150 return VA_STATUS_SUCCESS;
1153 VAStatus VA_DRIVER_INIT_FUNC( VADriverContextP ctx )
1155 struct VADriverVTable * const vtable = ctx->vtable;
1157 struct dummy_driver_data *driver_data;
1159 ctx->version_major = VA_MAJOR_VERSION;
1160 ctx->version_minor = VA_MINOR_VERSION;
1161 ctx->max_profiles = DUMMY_MAX_PROFILES;
1162 ctx->max_entrypoints = DUMMY_MAX_ENTRYPOINTS;
1163 ctx->max_attributes = DUMMY_MAX_CONFIG_ATTRIBUTES;
1164 ctx->max_image_formats = DUMMY_MAX_IMAGE_FORMATS;
1165 ctx->max_subpic_formats = DUMMY_MAX_SUBPIC_FORMATS;
1166 ctx->max_display_attributes = DUMMY_MAX_DISPLAY_ATTRIBUTES;
1167 ctx->str_vendor = DUMMY_STR_VENDOR;
1169 vtable->vaTerminate = dummy_Terminate;
1170 vtable->vaQueryConfigEntrypoints = dummy_QueryConfigEntrypoints;
1171 vtable->vaQueryConfigProfiles = dummy_QueryConfigProfiles;
1172 vtable->vaQueryConfigEntrypoints = dummy_QueryConfigEntrypoints;
1173 vtable->vaQueryConfigAttributes = dummy_QueryConfigAttributes;
1174 vtable->vaCreateConfig = dummy_CreateConfig;
1175 vtable->vaDestroyConfig = dummy_DestroyConfig;
1176 vtable->vaGetConfigAttributes = dummy_GetConfigAttributes;
1177 vtable->vaCreateSurfaces = dummy_CreateSurfaces;
1178 vtable->vaDestroySurfaces = dummy_DestroySurfaces;
1179 vtable->vaCreateContext = dummy_CreateContext;
1180 vtable->vaDestroyContext = dummy_DestroyContext;
1181 vtable->vaCreateBuffer = dummy_CreateBuffer;
1182 vtable->vaBufferSetNumElements = dummy_BufferSetNumElements;
1183 vtable->vaMapBuffer = dummy_MapBuffer;
1184 vtable->vaUnmapBuffer = dummy_UnmapBuffer;
1185 vtable->vaDestroyBuffer = dummy_DestroyBuffer;
1186 vtable->vaBeginPicture = dummy_BeginPicture;
1187 vtable->vaRenderPicture = dummy_RenderPicture;
1188 vtable->vaEndPicture = dummy_EndPicture;
1189 vtable->vaSyncSurface = dummy_SyncSurface;
1190 vtable->vaQuerySurfaceStatus = dummy_QuerySurfaceStatus;
1191 vtable->vaPutSurface = dummy_PutSurface;
1192 vtable->vaQueryImageFormats = dummy_QueryImageFormats;
1193 vtable->vaCreateImage = dummy_CreateImage;
1194 vtable->vaDeriveImage = dummy_DeriveImage;
1195 vtable->vaDestroyImage = dummy_DestroyImage;
1196 vtable->vaSetImagePalette = dummy_SetImagePalette;
1197 vtable->vaGetImage = dummy_GetImage;
1198 vtable->vaPutImage = dummy_PutImage;
1199 vtable->vaQuerySubpictureFormats = dummy_QuerySubpictureFormats;
1200 vtable->vaCreateSubpicture = dummy_CreateSubpicture;
1201 vtable->vaDestroySubpicture = dummy_DestroySubpicture;
1202 vtable->vaSetSubpictureImage = dummy_SetSubpictureImage;
1203 vtable->vaSetSubpictureChromakey = dummy_SetSubpictureChromakey;
1204 vtable->vaSetSubpictureGlobalAlpha = dummy_SetSubpictureGlobalAlpha;
1205 vtable->vaAssociateSubpicture = dummy_AssociateSubpicture;
1206 vtable->vaDeassociateSubpicture = dummy_DeassociateSubpicture;
1207 vtable->vaQueryDisplayAttributes = dummy_QueryDisplayAttributes;
1208 vtable->vaGetDisplayAttributes = dummy_GetDisplayAttributes;
1209 vtable->vaSetDisplayAttributes = dummy_SetDisplayAttributes;
1210 vtable->vaLockSurface = dummy_LockSurface;
1211 vtable->vaUnlockSurface = dummy_UnlockSurface;
1212 vtable->vaBufferInfo = dummy_BufferInfo;
1214 driver_data = (struct dummy_driver_data *) malloc( sizeof(*driver_data) );
1215 ctx->pDriverData = (void *) driver_data;
1217 result = object_heap_init( &driver_data->config_heap, sizeof(struct object_config), CONFIG_ID_OFFSET );
1218 ASSERT( result == 0 );
1220 result = object_heap_init( &driver_data->context_heap, sizeof(struct object_context), CONTEXT_ID_OFFSET );
1221 ASSERT( result == 0 );
1223 result = object_heap_init( &driver_data->surface_heap, sizeof(struct object_surface), SURFACE_ID_OFFSET );
1224 ASSERT( result == 0 );
1226 result = object_heap_init( &driver_data->buffer_heap, sizeof(struct object_buffer), BUFFER_ID_OFFSET );
1227 ASSERT( result == 0 );
1230 return VA_STATUS_SUCCESS;