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/va_backend.h>
27 #include "dummy_drv_video.h"
37 #define INIT_DRIVER_DATA struct dummy_driver_data *driver_data = (struct dummy_driver_data *) ctx->pDriverData;
39 #define CONFIG(id) ((object_config_p) object_heap_lookup( &driver_data->config_heap, id ))
40 #define CONTEXT(id) ((object_context_p) object_heap_lookup( &driver_data->context_heap, id ))
41 #define SURFACE(id) ((object_surface_p) object_heap_lookup( &driver_data->surface_heap, id ))
42 #define BUFFER(id) ((object_buffer_p) object_heap_lookup( &driver_data->buffer_heap, id ))
44 #define CONFIG_ID_OFFSET 0x01000000
45 #define CONTEXT_ID_OFFSET 0x02000000
46 #define SURFACE_ID_OFFSET 0x04000000
47 #define BUFFER_ID_OFFSET 0x08000000
49 static void dummy__error_message(const char *msg, ...)
53 fprintf(stderr, "dummy_drv_video error: ");
55 vfprintf(stderr, msg, args);
59 static void dummy__information_message(const char *msg, ...)
63 fprintf(stderr, "dummy_drv_video: ");
65 vfprintf(stderr, msg, args);
69 VAStatus dummy_QueryConfigProfiles(
71 VAProfile *profile_list, /* out */
72 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 */
107 case VAProfileMPEG2Simple:
108 case VAProfileMPEG2Main:
109 *num_entrypoints = 2;
110 entrypoint_list[0] = VAEntrypointVLD;
111 entrypoint_list[1] = VAEntrypointMoComp;
114 case VAProfileMPEG4Simple:
115 case VAProfileMPEG4AdvancedSimple:
116 case VAProfileMPEG4Main:
117 *num_entrypoints = 1;
118 entrypoint_list[0] = VAEntrypointVLD;
121 case VAProfileH264Baseline:
122 case VAProfileH264Main:
123 case VAProfileH264High:
124 *num_entrypoints = 1;
125 entrypoint_list[0] = VAEntrypointVLD;
128 case VAProfileVC1Simple:
129 case VAProfileVC1Main:
130 case VAProfileVC1Advanced:
131 *num_entrypoints = 1;
132 entrypoint_list[0] = VAEntrypointVLD;
136 *num_entrypoints = 0;
140 /* If the assert fails then DUMMY_MAX_ENTRYPOINTS needs to be bigger */
141 ASSERT(*num_entrypoints <= DUMMY_MAX_ENTRYPOINTS);
142 return VA_STATUS_SUCCESS;
145 VAStatus dummy_GetConfigAttributes(
146 VADriverContextP ctx,
148 VAEntrypoint entrypoint,
149 VAConfigAttrib *attrib_list, /* in/out */
157 /* Other attributes don't seem to be defined */
158 /* What to do if we don't know the attribute? */
159 for (i = 0; i < num_attribs; i++)
161 switch (attrib_list[i].type)
163 case VAConfigAttribRTFormat:
164 attrib_list[i].value = VA_RT_FORMAT_YUV420;
169 attrib_list[i].value = VA_ATTRIB_NOT_SUPPORTED;
174 return VA_STATUS_SUCCESS;
177 static VAStatus dummy__update_attribute(object_config_p obj_config, VAConfigAttrib *attrib)
180 /* Check existing attrbiutes */
181 for(i = 0; obj_config->attrib_count < i; i++)
183 if (obj_config->attrib_list[i].type == attrib->type)
185 /* Update existing attribute */
186 obj_config->attrib_list[i].value = attrib->value;
187 return VA_STATUS_SUCCESS;
190 if (obj_config->attrib_count < DUMMY_MAX_CONFIG_ATTRIBUTES)
192 i = obj_config->attrib_count;
193 obj_config->attrib_list[i].type = attrib->type;
194 obj_config->attrib_list[i].value = attrib->value;
195 obj_config->attrib_count++;
196 return VA_STATUS_SUCCESS;
198 return VA_STATUS_ERROR_MAX_NUM_EXCEEDED;
201 VAStatus dummy_CreateConfig(
202 VADriverContextP ctx,
204 VAEntrypoint entrypoint,
205 VAConfigAttrib *attrib_list,
207 VAConfigID *config_id /* out */
213 object_config_p obj_config;
216 /* Validate profile & entrypoint */
218 case VAProfileMPEG2Simple:
219 case VAProfileMPEG2Main:
220 if ((VAEntrypointVLD == entrypoint) ||
221 (VAEntrypointMoComp == entrypoint))
223 vaStatus = VA_STATUS_SUCCESS;
227 vaStatus = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
231 case VAProfileMPEG4Simple:
232 case VAProfileMPEG4AdvancedSimple:
233 case VAProfileMPEG4Main:
234 if (VAEntrypointVLD == entrypoint)
236 vaStatus = VA_STATUS_SUCCESS;
240 vaStatus = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
244 case VAProfileH264Baseline:
245 case VAProfileH264Main:
246 case VAProfileH264High:
247 if (VAEntrypointVLD == entrypoint)
249 vaStatus = VA_STATUS_SUCCESS;
253 vaStatus = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
257 case VAProfileVC1Simple:
258 case VAProfileVC1Main:
259 case VAProfileVC1Advanced:
260 if (VAEntrypointVLD == entrypoint)
262 vaStatus = VA_STATUS_SUCCESS;
266 vaStatus = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
271 vaStatus = VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
275 if (VA_STATUS_SUCCESS != vaStatus)
280 configID = object_heap_allocate( &driver_data->config_heap );
281 obj_config = CONFIG(configID);
282 if (NULL == obj_config)
284 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
288 obj_config->profile = profile;
289 obj_config->entrypoint = entrypoint;
290 obj_config->attrib_list[0].type = VAConfigAttribRTFormat;
291 obj_config->attrib_list[0].value = VA_RT_FORMAT_YUV420;
292 obj_config->attrib_count = 1;
294 for(i = 0; i < num_attribs; i++)
296 vaStatus = dummy__update_attribute(obj_config, &(attrib_list[i]));
297 if (VA_STATUS_SUCCESS != vaStatus)
304 if (VA_STATUS_SUCCESS != vaStatus)
306 object_heap_free( &driver_data->config_heap, (object_base_p) obj_config);
310 *config_id = configID;
316 VAStatus dummy_DestroyConfig(
317 VADriverContextP ctx,
323 object_config_p obj_config;
325 obj_config = CONFIG(config_id);
326 if (NULL == obj_config)
328 vaStatus = VA_STATUS_ERROR_INVALID_CONFIG;
332 object_heap_free( &driver_data->config_heap, (object_base_p) obj_config);
333 return VA_STATUS_SUCCESS;
336 VAStatus dummy_QueryConfigAttributes(
337 VADriverContextP ctx,
338 VAConfigID config_id,
339 VAProfile *profile, /* out */
340 VAEntrypoint *entrypoint, /* out */
341 VAConfigAttrib *attrib_list, /* out */
342 int *num_attribs /* out */
346 VAStatus vaStatus = VA_STATUS_SUCCESS;
347 object_config_p obj_config;
350 obj_config = CONFIG(config_id);
353 *profile = obj_config->profile;
354 *entrypoint = obj_config->entrypoint;
355 *num_attribs = obj_config->attrib_count;
356 for(i = 0; i < obj_config->attrib_count; i++)
358 attrib_list[i] = obj_config->attrib_list[i];
364 VAStatus dummy_CreateSurfaces(
365 VADriverContextP ctx,
370 VASurfaceID *surfaces /* out */
374 VAStatus vaStatus = VA_STATUS_SUCCESS;
377 /* We only support one format */
378 if (VA_RT_FORMAT_YUV420 != format)
380 return VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT;
383 for (i = 0; i < num_surfaces; i++)
385 int surfaceID = object_heap_allocate( &driver_data->surface_heap );
386 object_surface_p obj_surface = SURFACE(surfaceID);
387 if (NULL == obj_surface)
389 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
392 obj_surface->surface_id = surfaceID;
393 surfaces[i] = surfaceID;
397 if (VA_STATUS_SUCCESS != vaStatus)
399 /* surfaces[i-1] was the last successful allocation */
402 object_surface_p obj_surface = SURFACE(surfaces[i]);
403 surfaces[i] = VA_INVALID_SURFACE;
405 object_heap_free( &driver_data->surface_heap, (object_base_p) obj_surface);
412 VAStatus dummy_DestroySurfaces(
413 VADriverContextP ctx,
414 VASurfaceID *surface_list,
420 for(i = num_surfaces; i--; )
422 object_surface_p obj_surface = SURFACE(surface_list[i]);
424 object_heap_free( &driver_data->surface_heap, (object_base_p) obj_surface);
426 return VA_STATUS_SUCCESS;
429 VAStatus dummy_QueryImageFormats(
430 VADriverContextP ctx,
431 VAImageFormat *format_list, /* out */
432 int *num_formats /* out */
438 return VA_STATUS_SUCCESS;
441 VAStatus dummy_CreateImage(
442 VADriverContextP ctx,
443 VAImageFormat *format,
446 VAImage *image /* out */
452 return VA_STATUS_SUCCESS;
455 VAStatus dummy_DeriveImage(
456 VADriverContextP ctx,
458 VAImage *image /* out */
464 return VA_STATUS_SUCCESS;
467 VAStatus dummy_DestroyImage(
468 VADriverContextP ctx,
475 return VA_STATUS_SUCCESS;
478 VAStatus dummy_SetImagePalette(
479 VADriverContextP ctx,
481 unsigned char *palette
487 return VA_STATUS_SUCCESS;
490 VAStatus dummy_GetImage(
491 VADriverContextP ctx,
493 int x, /* coordinates of the upper left source pixel */
495 unsigned int width, /* width and height of the region */
503 return VA_STATUS_SUCCESS;
507 VAStatus dummy_PutImage(
508 VADriverContextP ctx,
513 unsigned int src_width,
514 unsigned int src_height,
517 unsigned int dest_width,
518 unsigned int dest_height
524 return VA_STATUS_SUCCESS;
527 VAStatus dummy_QuerySubpictureFormats(
528 VADriverContextP ctx,
529 VAImageFormat *format_list, /* out */
530 unsigned int *flags, /* out */
531 unsigned int *num_formats /* out */
537 return VA_STATUS_SUCCESS;
540 VAStatus dummy_CreateSubpicture(
541 VADriverContextP ctx,
543 VASubpictureID *subpicture /* out */
549 return VA_STATUS_SUCCESS;
552 VAStatus dummy_DestroySubpicture(
553 VADriverContextP ctx,
554 VASubpictureID subpicture
560 return VA_STATUS_SUCCESS;
563 VAStatus dummy_SetSubpictureImage(
564 VADriverContextP ctx,
565 VASubpictureID subpicture,
572 return VA_STATUS_SUCCESS;
575 VAStatus dummy_SetSubpicturePalette(
576 VADriverContextP ctx,
577 VASubpictureID subpicture,
579 * pointer to an array holding the palette data. The size of the array is
580 * num_palette_entries * entry_bytes in size. The order of the components
581 * in the palette is described by the component_order in VASubpicture struct
583 unsigned char *palette
589 return VA_STATUS_SUCCESS;
592 VAStatus dummy_SetSubpictureChromakey(
593 VADriverContextP ctx,
594 VASubpictureID subpicture,
595 unsigned int chromakey_min,
596 unsigned int chromakey_max,
597 unsigned int chromakey_mask
603 return VA_STATUS_SUCCESS;
606 VAStatus dummy_SetSubpictureGlobalAlpha(
607 VADriverContextP ctx,
608 VASubpictureID subpicture,
615 return VA_STATUS_SUCCESS;
619 VAStatus dummy_AssociateSubpicture(
620 VADriverContextP ctx,
621 VASubpictureID subpicture,
622 VASurfaceID *target_surfaces,
624 short src_x, /* upper left offset in subpicture */
626 unsigned short src_width,
627 unsigned short src_height,
628 short dest_x, /* upper left offset in surface */
630 unsigned short dest_width,
631 unsigned short dest_height,
633 * whether to enable chroma-keying or global-alpha
634 * see VA_SUBPICTURE_XXX values
642 return VA_STATUS_SUCCESS;
645 VAStatus dummy_DeassociateSubpicture(
646 VADriverContextP ctx,
647 VASubpictureID subpicture,
648 VASurfaceID *target_surfaces,
655 return VA_STATUS_SUCCESS;
658 VAStatus dummy_CreateContext(
659 VADriverContextP ctx,
660 VAConfigID config_id,
664 VASurfaceID *render_targets,
665 int num_render_targets,
666 VAContextID *context /* out */
670 VAStatus vaStatus = VA_STATUS_SUCCESS;
671 object_config_p obj_config;
674 obj_config = CONFIG(config_id);
675 if (NULL == obj_config)
677 vaStatus = VA_STATUS_ERROR_INVALID_CONFIG;
682 /* Validate picture dimensions */
684 int contextID = object_heap_allocate( &driver_data->context_heap );
685 object_context_p obj_context = CONTEXT(contextID);
686 if (NULL == obj_context)
688 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
692 obj_context->context_id = contextID;
693 *context = contextID;
694 obj_context->current_render_target = -1;
695 obj_context->config_id = config_id;
696 obj_context->picture_width = picture_width;
697 obj_context->picture_height = picture_height;
698 obj_context->num_render_targets = num_render_targets;
699 obj_context->render_targets = (VASurfaceID *) malloc(num_render_targets * sizeof(VASurfaceID));
700 if (obj_context->render_targets == NULL)
702 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
706 for(i = 0; i < num_render_targets; i++)
708 if (NULL == SURFACE(render_targets[i]))
710 vaStatus = VA_STATUS_ERROR_INVALID_SURFACE;
713 obj_context->render_targets[i] = render_targets[i];
715 obj_context->flags = flag;
718 if (VA_STATUS_SUCCESS != vaStatus)
720 obj_context->context_id = -1;
721 obj_context->config_id = -1;
722 free(obj_context->render_targets);
723 obj_context->render_targets = NULL;
724 obj_context->num_render_targets = 0;
725 obj_context->flags = 0;
726 object_heap_free( &driver_data->context_heap, (object_base_p) obj_context);
733 VAStatus dummy_DestroyContext(
734 VADriverContextP ctx,
739 object_context_p obj_context = CONTEXT(context);
742 obj_context->context_id = -1;
743 obj_context->config_id = -1;
744 obj_context->picture_width = 0;
745 obj_context->picture_height = 0;
746 if (obj_context->render_targets)
748 free(obj_context->render_targets);
750 obj_context->render_targets = NULL;
751 obj_context->num_render_targets = 0;
752 obj_context->flags = 0;
754 obj_context->current_render_target = -1;
756 object_heap_free( &driver_data->context_heap, (object_base_p) obj_context);
758 return VA_STATUS_SUCCESS;
763 static VAStatus dummy__allocate_buffer(object_buffer_p obj_buffer, int size)
765 VAStatus vaStatus = VA_STATUS_SUCCESS;
767 obj_buffer->buffer_data = realloc(obj_buffer->buffer_data, size);
768 if (NULL == obj_buffer->buffer_data)
770 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
775 VAStatus dummy_CreateBuffer(
776 VADriverContextP ctx,
777 VAContextID context, /* in */
778 VABufferType type, /* in */
779 unsigned int size, /* in */
780 unsigned int num_elements, /* in */
782 VABufferID *buf_id /* out */
786 VAStatus vaStatus = VA_STATUS_SUCCESS;
788 object_buffer_p obj_buffer;
793 case VAPictureParameterBufferType:
794 case VAIQMatrixBufferType:
795 case VABitPlaneBufferType:
796 case VASliceGroupMapBufferType:
797 case VASliceParameterBufferType:
798 case VASliceDataBufferType:
799 case VAMacroblockParameterBufferType:
800 case VAResidualDataBufferType:
801 case VADeblockingParameterBufferType:
802 case VAImageBufferType:
806 vaStatus = VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE;
810 bufferID = object_heap_allocate( &driver_data->buffer_heap );
811 obj_buffer = BUFFER(bufferID);
812 if (NULL == obj_buffer)
814 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
818 obj_buffer->buffer_data = NULL;
820 vaStatus = dummy__allocate_buffer(obj_buffer, size * num_elements);
821 if (VA_STATUS_SUCCESS == vaStatus)
823 obj_buffer->max_num_elements = num_elements;
824 obj_buffer->num_elements = num_elements;
827 memcpy(obj_buffer->buffer_data, data, size * num_elements);
831 if (VA_STATUS_SUCCESS == vaStatus)
840 VAStatus dummy_BufferSetNumElements(
841 VADriverContextP ctx,
842 VABufferID buf_id, /* in */
843 unsigned int num_elements /* in */
847 VAStatus vaStatus = VA_STATUS_SUCCESS;
848 object_buffer_p obj_buffer = BUFFER(buf_id);
851 if ((num_elements < 0) || (num_elements > obj_buffer->max_num_elements))
853 vaStatus = VA_STATUS_ERROR_UNKNOWN;
855 if (VA_STATUS_SUCCESS == vaStatus)
857 obj_buffer->num_elements = num_elements;
863 VAStatus dummy_MapBuffer(
864 VADriverContextP ctx,
865 VABufferID buf_id, /* in */
866 void **pbuf /* out */
870 VAStatus vaStatus = VA_STATUS_ERROR_UNKNOWN;
871 object_buffer_p obj_buffer = BUFFER(buf_id);
873 if (NULL == obj_buffer)
875 vaStatus = VA_STATUS_ERROR_INVALID_BUFFER;
879 if (NULL != obj_buffer->buffer_data)
881 *pbuf = obj_buffer->buffer_data;
882 vaStatus = VA_STATUS_SUCCESS;
887 VAStatus dummy_UnmapBuffer(
888 VADriverContextP ctx,
889 VABufferID buf_id /* in */
893 return VA_STATUS_SUCCESS;
896 static void dummy__destroy_buffer(struct dummy_driver_data *driver_data, object_buffer_p obj_buffer)
898 if (NULL != obj_buffer->buffer_data)
900 free(obj_buffer->buffer_data);
901 obj_buffer->buffer_data = NULL;
904 object_heap_free( &driver_data->buffer_heap, (object_base_p) obj_buffer);
907 VAStatus dummy_DestroyBuffer(
908 VADriverContextP ctx,
913 object_buffer_p obj_buffer = BUFFER(buffer_id);
916 dummy__destroy_buffer(driver_data, obj_buffer);
917 return VA_STATUS_SUCCESS;
920 VAStatus dummy_BeginPicture(
921 VADriverContextP ctx,
923 VASurfaceID render_target
927 VAStatus vaStatus = VA_STATUS_SUCCESS;
928 object_context_p obj_context;
929 object_surface_p obj_surface;
931 obj_context = CONTEXT(context);
934 obj_surface = SURFACE(render_target);
937 obj_context->current_render_target = obj_surface->base.id;
942 VAStatus dummy_RenderPicture(
943 VADriverContextP ctx,
950 VAStatus vaStatus = VA_STATUS_SUCCESS;
951 object_context_p obj_context;
952 object_surface_p obj_surface;
955 obj_context = CONTEXT(context);
958 obj_surface = SURFACE(obj_context->current_render_target);
961 /* verify that we got valid buffer references */
962 for(i = 0; i < num_buffers; i++)
964 object_buffer_p obj_buffer = BUFFER(buffers[i]);
966 if (NULL == obj_buffer)
968 vaStatus = VA_STATUS_ERROR_INVALID_BUFFER;
973 /* Release buffers */
974 for(i = 0; i < num_buffers; i++)
976 object_buffer_p obj_buffer = BUFFER(buffers[i]);
978 dummy__destroy_buffer(driver_data, obj_buffer);
984 VAStatus dummy_EndPicture(
985 VADriverContextP ctx,
990 VAStatus vaStatus = VA_STATUS_SUCCESS;
991 object_context_p obj_context;
992 object_surface_p obj_surface;
994 obj_context = CONTEXT(context);
997 obj_surface = SURFACE(obj_context->current_render_target);
1000 // For now, assume that we are done with rendering right away
1001 obj_context->current_render_target = -1;
1007 VAStatus dummy_SyncSurface(
1008 VADriverContextP ctx,
1009 VASurfaceID render_target
1013 VAStatus vaStatus = VA_STATUS_SUCCESS;
1014 object_surface_p obj_surface;
1016 obj_surface = SURFACE(render_target);
1017 ASSERT(obj_surface);
1022 VAStatus dummy_QuerySurfaceStatus(
1023 VADriverContextP ctx,
1024 VASurfaceID render_target,
1025 VASurfaceStatus *status /* out */
1029 VAStatus vaStatus = VA_STATUS_SUCCESS;
1030 object_surface_p obj_surface;
1032 obj_surface = SURFACE(render_target);
1033 ASSERT(obj_surface);
1035 *status = VASurfaceReady;
1040 VAStatus dummy_PutSurface(
1041 VADriverContextP ctx,
1042 VASurfaceID surface,
1043 Drawable draw, /* X Drawable */
1046 unsigned short srcw,
1047 unsigned short srch,
1050 unsigned short destw,
1051 unsigned short desth,
1052 VARectangle *cliprects, /* client supplied clip list */
1053 unsigned int number_cliprects, /* number of clip rects in the clip list */
1054 unsigned int flags /* de-interlacing flags */
1058 return VA_STATUS_ERROR_UNKNOWN;
1062 * Query display attributes
1063 * The caller must provide a "attr_list" array that can hold at
1064 * least vaMaxNumDisplayAttributes() entries. The actual number of attributes
1065 * returned in "attr_list" is returned in "num_attributes".
1067 VAStatus dummy_QueryDisplayAttributes (
1068 VADriverContextP ctx,
1069 VADisplayAttribute *attr_list, /* out */
1070 int *num_attributes /* out */
1074 return VA_STATUS_ERROR_UNKNOWN;
1078 * Get display attributes
1079 * This function returns the current attribute values in "attr_list".
1080 * Only attributes returned with VA_DISPLAY_ATTRIB_GETTABLE set in the "flags" field
1081 * from vaQueryDisplayAttributes() can have their values retrieved.
1083 VAStatus dummy_GetDisplayAttributes (
1084 VADriverContextP ctx,
1085 VADisplayAttribute *attr_list, /* in/out */
1090 return VA_STATUS_ERROR_UNKNOWN;
1094 * Set display attributes
1095 * Only attributes returned with VA_DISPLAY_ATTRIB_SETTABLE set in the "flags" field
1096 * from vaQueryDisplayAttributes() can be set. If the attribute is not settable or
1097 * the value is out of range, the function returns VA_STATUS_ERROR_ATTR_NOT_SUPPORTED
1099 VAStatus dummy_SetDisplayAttributes (
1100 VADriverContextP ctx,
1101 VADisplayAttribute *attr_list,
1106 return VA_STATUS_ERROR_UNKNOWN;
1110 VAStatus dummy_CopySurfaceToBuffer(
1111 VADriverContextP ctx,
1112 VASurfaceID surface,
1113 unsigned int *fourcc, /* following are output argument */
1114 unsigned int *luma_stride,
1115 unsigned int *chroma_u_stride,
1116 unsigned int *chroma_v_stride,
1117 unsigned int *luma_offset,
1118 unsigned int *chroma_u_offset,
1119 unsigned int *chroma_v_offset,
1124 return VA_STATUS_ERROR_UNKNOWN;
1127 VAStatus dummy_Terminate( VADriverContextP ctx )
1130 object_buffer_p obj_buffer;
1131 object_surface_p obj_surface;
1132 object_context_p obj_context;
1133 object_config_p obj_config;
1134 object_heap_iterator iter;
1136 /* Clean up left over buffers */
1137 obj_buffer = (object_buffer_p) object_heap_first( &driver_data->buffer_heap, &iter);
1140 dummy__information_message("vaTerminate: bufferID %08x still allocated, destroying\n", obj_buffer->base.id);
1141 dummy__destroy_buffer(driver_data, obj_buffer);
1142 obj_buffer = (object_buffer_p) object_heap_next( &driver_data->buffer_heap, &iter);
1144 object_heap_destroy( &driver_data->buffer_heap );
1147 object_heap_destroy( &driver_data->surface_heap );
1150 object_heap_destroy( &driver_data->context_heap );
1152 /* Clean up configIDs */
1153 obj_config = (object_config_p) object_heap_first( &driver_data->config_heap, &iter);
1156 object_heap_free( &driver_data->config_heap, (object_base_p) obj_config);
1157 obj_config = (object_config_p) object_heap_next( &driver_data->config_heap, &iter);
1159 object_heap_destroy( &driver_data->config_heap );
1161 free(ctx->pDriverData);
1162 ctx->pDriverData = NULL;
1164 return VA_STATUS_SUCCESS;
1167 VAStatus __vaDriverInit_0_31( VADriverContextP ctx )
1171 struct dummy_driver_data *driver_data;
1174 ctx->version_major = VA_MAJOR_VERSION;
1175 ctx->version_minor = VA_MINOR_VERSION;
1176 ctx->max_profiles = DUMMY_MAX_PROFILES;
1177 ctx->max_entrypoints = DUMMY_MAX_ENTRYPOINTS;
1178 ctx->max_attributes = DUMMY_MAX_CONFIG_ATTRIBUTES;
1179 ctx->max_image_formats = DUMMY_MAX_IMAGE_FORMATS;
1180 ctx->max_subpic_formats = DUMMY_MAX_SUBPIC_FORMATS;
1181 ctx->max_display_attributes = DUMMY_MAX_DISPLAY_ATTRIBUTES;
1182 ctx->str_vendor = DUMMY_STR_VENDOR;
1184 ctx->vtable.vaTerminate = dummy_Terminate;
1185 ctx->vtable.vaQueryConfigEntrypoints = dummy_QueryConfigEntrypoints;
1186 ctx->vtable.vaQueryConfigProfiles = dummy_QueryConfigProfiles;
1187 ctx->vtable.vaQueryConfigEntrypoints = dummy_QueryConfigEntrypoints;
1188 ctx->vtable.vaQueryConfigAttributes = dummy_QueryConfigAttributes;
1189 ctx->vtable.vaCreateConfig = dummy_CreateConfig;
1190 ctx->vtable.vaDestroyConfig = dummy_DestroyConfig;
1191 ctx->vtable.vaGetConfigAttributes = dummy_GetConfigAttributes;
1192 ctx->vtable.vaCreateSurfaces = dummy_CreateSurfaces;
1193 ctx->vtable.vaDestroySurfaces = dummy_DestroySurfaces;
1194 ctx->vtable.vaCreateContext = dummy_CreateContext;
1195 ctx->vtable.vaDestroyContext = dummy_DestroyContext;
1196 ctx->vtable.vaCreateBuffer = dummy_CreateBuffer;
1197 ctx->vtable.vaBufferSetNumElements = dummy_BufferSetNumElements;
1198 ctx->vtable.vaMapBuffer = dummy_MapBuffer;
1199 ctx->vtable.vaUnmapBuffer = dummy_UnmapBuffer;
1200 ctx->vtable.vaDestroyBuffer = dummy_DestroyBuffer;
1201 ctx->vtable.vaBeginPicture = dummy_BeginPicture;
1202 ctx->vtable.vaRenderPicture = dummy_RenderPicture;
1203 ctx->vtable.vaEndPicture = dummy_EndPicture;
1204 ctx->vtable.vaSyncSurface = dummy_SyncSurface;
1205 ctx->vtable.vaQuerySurfaceStatus = dummy_QuerySurfaceStatus;
1206 ctx->vtable.vaPutSurface = dummy_PutSurface;
1207 ctx->vtable.vaQueryImageFormats = dummy_QueryImageFormats;
1208 ctx->vtable.vaCreateImage = dummy_CreateImage;
1209 ctx->vtable.vaDeriveImage = dummy_DeriveImage;
1210 ctx->vtable.vaDestroyImage = dummy_DestroyImage;
1211 ctx->vtable.vaSetImagePalette = dummy_SetImagePalette;
1212 ctx->vtable.vaGetImage = dummy_GetImage;
1213 ctx->vtable.vaPutImage = dummy_PutImage;
1214 ctx->vtable.vaQuerySubpictureFormats = dummy_QuerySubpictureFormats;
1215 ctx->vtable.vaCreateSubpicture = dummy_CreateSubpicture;
1216 ctx->vtable.vaDestroySubpicture = dummy_DestroySubpicture;
1217 ctx->vtable.vaSetSubpictureImage = dummy_SetSubpictureImage;
1218 ctx->vtable.vaSetSubpictureChromakey = dummy_SetSubpictureChromakey;
1219 ctx->vtable.vaSetSubpictureGlobalAlpha = dummy_SetSubpictureGlobalAlpha;
1220 ctx->vtable.vaAssociateSubpicture = dummy_AssociateSubpicture;
1221 ctx->vtable.vaDeassociateSubpicture = dummy_DeassociateSubpicture;
1222 ctx->vtable.vaQueryDisplayAttributes = dummy_QueryDisplayAttributes;
1223 ctx->vtable.vaGetDisplayAttributes = dummy_GetDisplayAttributes;
1224 ctx->vtable.vaSetDisplayAttributes = dummy_SetDisplayAttributes;
1226 ctx->vtable.vaCopySurfaceToBuffer = dummy_CopySurfaceToBuffer;
1228 driver_data = (struct dummy_driver_data *) malloc( sizeof(*driver_data) );
1229 ctx->pDriverData = (void *) driver_data;
1231 result = object_heap_init( &driver_data->config_heap, sizeof(struct object_config), CONFIG_ID_OFFSET );
1232 ASSERT( result == 0 );
1234 result = object_heap_init( &driver_data->context_heap, sizeof(struct object_context), CONTEXT_ID_OFFSET );
1235 ASSERT( result == 0 );
1237 result = object_heap_init( &driver_data->surface_heap, sizeof(struct object_surface), SURFACE_ID_OFFSET );
1238 ASSERT( result == 0 );
1240 result = object_heap_init( &driver_data->buffer_heap, sizeof(struct object_buffer), BUFFER_ID_OFFSET );
1241 ASSERT( result == 0 );
1244 return VA_STATUS_SUCCESS;