2 * Copyright (c) 2007 Intel Corporation. All Rights Reserved.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sub license, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
12 * The above copyright notice and this permission notice (including the
13 * next paragraph) shall be included in all copies or substantial portions
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
19 * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
20 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 #include "va_backend.h"
27 #include "dummy_drv_video.h"
36 #define INIT_DRIVER_DATA struct dummy_driver_data *driver_data = (struct dummy_driver_data *) ctx->pDriverData;
38 #define CONFIG(id) ((object_config_p) object_heap_lookup( &driver_data->config_heap, id ))
39 #define CONTEXT(id) ((object_context_p) object_heap_lookup( &driver_data->context_heap, id ))
40 #define SURFACE(id) ((object_surface_p) object_heap_lookup( &driver_data->surface_heap, id ))
41 #define BUFFER(id) ((object_buffer_p) object_heap_lookup( &driver_data->buffer_heap, id ))
43 #define CONFIG_ID_OFFSET 0x01000000
44 #define CONTEXT_ID_OFFSET 0x02000000
45 #define SURFACE_ID_OFFSET 0x04000000
46 #define BUFFER_ID_OFFSET 0x08000000
48 static void dummy__error_message(const char *msg, ...)
52 fprintf(stderr, "dummy_drv_video error: ");
54 vfprintf(stderr, msg, args);
58 static void dummy__information_message(const char *msg, ...)
62 fprintf(stderr, "dummy_drv_video: ");
64 vfprintf(stderr, msg, args);
68 VAStatus dummy_QueryConfigProfiles(
70 VAProfile *profile_list, /* out */
71 int *num_profiles /* out */
77 profile_list[i++] = VAProfileMPEG2Simple;
78 profile_list[i++] = VAProfileMPEG2Main;
79 profile_list[i++] = VAProfileMPEG4Simple;
80 profile_list[i++] = VAProfileMPEG4AdvancedSimple;
81 profile_list[i++] = VAProfileMPEG4Main;
82 profile_list[i++] = VAProfileH264Baseline;
83 profile_list[i++] = VAProfileH264Main;
84 profile_list[i++] = VAProfileH264High;
85 profile_list[i++] = VAProfileVC1Simple;
86 profile_list[i++] = VAProfileVC1Main;
87 profile_list[i++] = VAProfileVC1Advanced;
89 /* If the assert fails then DUMMY_MAX_PROFILES needs to be bigger */
90 ASSERT(i <= DUMMY_MAX_PROFILES);
93 return VA_STATUS_SUCCESS;
96 VAStatus dummy_QueryConfigEntrypoints(
99 VAEntrypoint *entrypoint_list, /* out */
100 int *num_entrypoints /* out */
106 case VAProfileMPEG2Simple:
107 case VAProfileMPEG2Main:
108 *num_entrypoints = 2;
109 entrypoint_list[0] = VAEntrypointVLD;
110 entrypoint_list[1] = VAEntrypointMoComp;
113 case VAProfileMPEG4Simple:
114 case VAProfileMPEG4AdvancedSimple:
115 case VAProfileMPEG4Main:
116 *num_entrypoints = 1;
117 entrypoint_list[0] = VAEntrypointVLD;
120 case VAProfileH264Baseline:
121 case VAProfileH264Main:
122 case VAProfileH264High:
123 *num_entrypoints = 1;
124 entrypoint_list[0] = VAEntrypointVLD;
127 case VAProfileVC1Simple:
128 case VAProfileVC1Main:
129 case VAProfileVC1Advanced:
130 *num_entrypoints = 1;
131 entrypoint_list[0] = VAEntrypointVLD;
135 *num_entrypoints = 0;
139 /* If the assert fails then DUMMY_MAX_ENTRYPOINTS needs to be bigger */
140 ASSERT(*num_entrypoints <= DUMMY_MAX_ENTRYPOINTS);
141 return VA_STATUS_SUCCESS;
144 VAStatus dummy_GetConfigAttributes(
145 VADriverContextP ctx,
147 VAEntrypoint entrypoint,
148 VAConfigAttrib *attrib_list, /* in/out */
156 /* Other attributes don't seem to be defined */
157 /* What to do if we don't know the attribute? */
158 for (i = 0; i < num_attribs; i++)
160 switch (attrib_list[i].type)
162 case VAConfigAttribRTFormat:
163 attrib_list[i].value = VA_RT_FORMAT_YUV420;
168 attrib_list[i].value = VA_ATTRIB_NOT_SUPPORTED;
173 return VA_STATUS_SUCCESS;
176 static VAStatus dummy__update_attribute(object_config_p obj_config, VAConfigAttrib *attrib)
179 /* Check existing attrbiutes */
180 for(i = 0; obj_config->attrib_count < i; i++)
182 if (obj_config->attrib_list[i].type == attrib->type)
184 /* Update existing attribute */
185 obj_config->attrib_list[i].value = attrib->value;
186 return VA_STATUS_SUCCESS;
189 if (obj_config->attrib_count < DUMMY_MAX_CONFIG_ATTRIBUTES)
191 i = obj_config->attrib_count;
192 obj_config->attrib_list[i].type = attrib->type;
193 obj_config->attrib_list[i].value = attrib->value;
194 obj_config->attrib_count++;
195 return VA_STATUS_SUCCESS;
197 return VA_STATUS_ERROR_MAX_NUM_EXCEEDED;
200 VAStatus dummy_CreateConfig(
201 VADriverContextP ctx,
203 VAEntrypoint entrypoint,
204 VAConfigAttrib *attrib_list,
206 VAConfigID *config_id /* out */
212 object_config_p obj_config;
215 /* Validate profile & entrypoint */
217 case VAProfileMPEG2Simple:
218 case VAProfileMPEG2Main:
219 if ((VAEntrypointVLD == entrypoint) ||
220 (VAEntrypointMoComp == entrypoint))
222 vaStatus = VA_STATUS_SUCCESS;
226 vaStatus = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
230 case VAProfileMPEG4Simple:
231 case VAProfileMPEG4AdvancedSimple:
232 case VAProfileMPEG4Main:
233 if (VAEntrypointVLD == entrypoint)
235 vaStatus = VA_STATUS_SUCCESS;
239 vaStatus = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
243 case VAProfileH264Baseline:
244 case VAProfileH264Main:
245 case VAProfileH264High:
246 if (VAEntrypointVLD == entrypoint)
248 vaStatus = VA_STATUS_SUCCESS;
252 vaStatus = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
256 case VAProfileVC1Simple:
257 case VAProfileVC1Main:
258 case VAProfileVC1Advanced:
259 if (VAEntrypointVLD == entrypoint)
261 vaStatus = VA_STATUS_SUCCESS;
265 vaStatus = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
270 vaStatus = VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
274 if (VA_STATUS_SUCCESS != vaStatus)
279 configID = object_heap_allocate( &driver_data->config_heap );
280 obj_config = CONFIG(configID);
281 if (NULL == obj_config)
283 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
287 obj_config->profile = profile;
288 obj_config->entrypoint = entrypoint;
289 obj_config->attrib_list[0].type = VAConfigAttribRTFormat;
290 obj_config->attrib_list[0].value = VA_RT_FORMAT_YUV420;
291 obj_config->attrib_count = 1;
293 for(i = 0; i < num_attribs; i++)
295 vaStatus = dummy__update_attribute(obj_config, &(attrib_list[i]));
296 if (VA_STATUS_SUCCESS != vaStatus)
303 if (VA_STATUS_SUCCESS != vaStatus)
305 object_heap_free( &driver_data->config_heap, (object_base_p) obj_config);
309 *config_id = configID;
315 VAStatus dummy_DestroyConfig(
316 VADriverContextP ctx,
322 object_config_p obj_config;
324 obj_config = CONFIG(config_id);
325 if (NULL == obj_config)
327 vaStatus = VA_STATUS_ERROR_INVALID_CONFIG;
331 object_heap_free( &driver_data->config_heap, (object_base_p) obj_config);
332 return VA_STATUS_SUCCESS;
335 VAStatus dummy_QueryConfigAttributes(
336 VADriverContextP ctx,
337 VAConfigID config_id,
338 VAProfile *profile, /* out */
339 VAEntrypoint *entrypoint, /* out */
340 VAConfigAttrib *attrib_list, /* out */
341 int *num_attribs /* out */
345 VAStatus vaStatus = VA_STATUS_SUCCESS;
346 object_config_p obj_config;
349 obj_config = CONFIG(config_id);
352 *profile = obj_config->profile;
353 *entrypoint = obj_config->entrypoint;
354 *num_attribs = obj_config->attrib_count;
355 for(i = 0; i < obj_config->attrib_count; i++)
357 attrib_list[i] = obj_config->attrib_list[i];
363 VAStatus dummy_CreateSurfaces(
364 VADriverContextP ctx,
369 VASurfaceID *surfaces /* out */
373 VAStatus vaStatus = VA_STATUS_SUCCESS;
376 /* We only support one format */
377 if (VA_RT_FORMAT_YUV420 != format)
379 return VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT;
382 for (i = 0; i < num_surfaces; i++)
384 int surfaceID = object_heap_allocate( &driver_data->surface_heap );
385 object_surface_p obj_surface = SURFACE(surfaceID);
386 if (NULL == obj_surface)
388 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
391 obj_surface->surface_id = surfaceID;
392 surfaces[i] = surfaceID;
396 if (VA_STATUS_SUCCESS != vaStatus)
398 /* surfaces[i-1] was the last successful allocation */
401 object_surface_p obj_surface = SURFACE(surfaces[i]);
402 surfaces[i] = VA_INVALID_SURFACE;
404 object_heap_free( &driver_data->surface_heap, (object_base_p) obj_surface);
411 VAStatus dummy_DestroySurfaces(
412 VADriverContextP ctx,
413 VASurfaceID *surface_list,
419 for(i = num_surfaces; i--; )
421 object_surface_p obj_surface = SURFACE(surface_list[i]);
423 object_heap_free( &driver_data->surface_heap, (object_base_p) obj_surface);
425 return VA_STATUS_SUCCESS;
428 VAStatus dummy_QueryImageFormats(
429 VADriverContextP ctx,
430 VAImageFormat *format_list, /* out */
431 int *num_formats /* out */
437 return VA_STATUS_SUCCESS;
440 VAStatus dummy_CreateImage(
441 VADriverContextP ctx,
442 VAImageFormat *format,
445 VAImage *image /* out */
451 return VA_STATUS_SUCCESS;
454 VAStatus dummy_DeriveImage(
455 VADriverContextP ctx,
457 VAImage *image /* out */
463 return VA_STATUS_SUCCESS;
466 VAStatus dummy_DestroyImage(
467 VADriverContextP ctx,
474 return VA_STATUS_SUCCESS;
477 VAStatus dummy_SetImagePalette(
478 VADriverContextP ctx,
480 unsigned char *palette
486 return VA_STATUS_SUCCESS;
489 VAStatus dummy_GetImage(
490 VADriverContextP ctx,
492 int x, /* coordinates of the upper left source pixel */
494 unsigned int width, /* width and height of the region */
502 return VA_STATUS_SUCCESS;
505 VAStatus dummy_PutImage(
506 VADriverContextP ctx,
520 return VA_STATUS_SUCCESS;
523 VAStatus dummy_PutImage2(
524 VADriverContextP ctx,
529 unsigned int src_width,
530 unsigned int src_height,
533 unsigned int dest_width,
534 unsigned int dest_height
540 return VA_STATUS_SUCCESS;
543 VAStatus dummy_QuerySubpictureFormats(
544 VADriverContextP ctx,
545 VAImageFormat *format_list, /* out */
546 unsigned int *flags, /* out */
547 unsigned int *num_formats /* out */
553 return VA_STATUS_SUCCESS;
556 VAStatus dummy_CreateSubpicture(
557 VADriverContextP ctx,
559 VASubpictureID *subpicture /* out */
565 return VA_STATUS_SUCCESS;
568 VAStatus dummy_DestroySubpicture(
569 VADriverContextP ctx,
570 VASubpictureID subpicture
576 return VA_STATUS_SUCCESS;
579 VAStatus dummy_SetSubpictureImage(
580 VADriverContextP ctx,
581 VASubpictureID subpicture,
588 return VA_STATUS_SUCCESS;
591 VAStatus dummy_SetSubpicturePalette(
592 VADriverContextP ctx,
593 VASubpictureID subpicture,
595 * pointer to an array holding the palette data. The size of the array is
596 * num_palette_entries * entry_bytes in size. The order of the components
597 * in the palette is described by the component_order in VASubpicture struct
599 unsigned char *palette
605 return VA_STATUS_SUCCESS;
608 VAStatus dummy_SetSubpictureChromakey(
609 VADriverContextP ctx,
610 VASubpictureID subpicture,
611 unsigned int chromakey_min,
612 unsigned int chromakey_max,
613 unsigned int chromakey_mask
619 return VA_STATUS_SUCCESS;
622 VAStatus dummy_SetSubpictureGlobalAlpha(
623 VADriverContextP ctx,
624 VASubpictureID subpicture,
631 return VA_STATUS_SUCCESS;
634 VAStatus dummy_AssociateSubpicture(
635 VADriverContextP ctx,
636 VASubpictureID subpicture,
637 VASurfaceID *target_surfaces,
639 short src_x, /* upper left offset in subpicture */
641 short dest_x, /* upper left offset in surface */
643 unsigned short width,
644 unsigned short height,
646 * whether to enable chroma-keying or global-alpha
647 * see VA_SUBPICTURE_XXX values
655 return VA_STATUS_SUCCESS;
658 VAStatus dummy_AssociateSubpicture2(
659 VADriverContextP ctx,
660 VASubpictureID subpicture,
661 VASurfaceID *target_surfaces,
663 short src_x, /* upper left offset in subpicture */
665 unsigned short src_width,
666 unsigned short src_height,
667 short dest_x, /* upper left offset in surface */
669 unsigned short dest_width,
670 unsigned short dest_height,
672 * whether to enable chroma-keying or global-alpha
673 * see VA_SUBPICTURE_XXX values
681 return VA_STATUS_SUCCESS;
684 VAStatus dummy_DeassociateSubpicture(
685 VADriverContextP ctx,
686 VASubpictureID subpicture,
687 VASurfaceID *target_surfaces,
694 return VA_STATUS_SUCCESS;
697 VAStatus dummy_CreateContext(
698 VADriverContextP ctx,
699 VAConfigID config_id,
703 VASurfaceID *render_targets,
704 int num_render_targets,
705 VAContextID *context /* out */
709 VAStatus vaStatus = VA_STATUS_SUCCESS;
710 object_config_p obj_config;
713 obj_config = CONFIG(config_id);
714 if (NULL == obj_config)
716 vaStatus = VA_STATUS_ERROR_INVALID_CONFIG;
721 /* Validate picture dimensions */
723 int contextID = object_heap_allocate( &driver_data->context_heap );
724 object_context_p obj_context = CONTEXT(contextID);
725 if (NULL == obj_context)
727 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
731 obj_context->context_id = contextID;
732 *context = contextID;
733 obj_context->current_render_target = -1;
734 obj_context->config_id = config_id;
735 obj_context->picture_width = picture_width;
736 obj_context->picture_height = picture_height;
737 obj_context->num_render_targets = num_render_targets;
738 obj_context->render_targets = (VASurfaceID *) malloc(num_render_targets * sizeof(VASurfaceID));
739 for(i = 0; i < num_render_targets; i++)
741 if (NULL == SURFACE(render_targets[i]))
743 vaStatus = VA_STATUS_ERROR_INVALID_SURFACE;
746 obj_context->render_targets[i] = render_targets[i];
748 obj_context->flags = flag;
751 if (VA_STATUS_SUCCESS != vaStatus)
753 obj_context->context_id = -1;
754 obj_context->config_id = -1;
755 free(obj_context->render_targets);
756 obj_context->render_targets = NULL;
757 obj_context->num_render_targets = 0;
758 obj_context->flags = 0;
759 object_heap_free( &driver_data->context_heap, (object_base_p) obj_context);
766 VAStatus dummy_DestroyContext(
767 VADriverContextP ctx,
772 object_context_p obj_context = CONTEXT(context);
775 obj_context->context_id = -1;
776 obj_context->config_id = -1;
777 obj_context->picture_width = 0;
778 obj_context->picture_height = 0;
779 if (obj_context->render_targets)
781 free(obj_context->render_targets);
783 obj_context->render_targets = NULL;
784 obj_context->num_render_targets = 0;
785 obj_context->flags = 0;
787 obj_context->current_render_target = -1;
789 object_heap_free( &driver_data->context_heap, (object_base_p) obj_context);
791 return VA_STATUS_SUCCESS;
796 static VAStatus dummy__allocate_buffer(object_buffer_p obj_buffer, int size)
798 VAStatus vaStatus = VA_STATUS_SUCCESS;
800 obj_buffer->buffer_data = realloc(obj_buffer->buffer_data, size);
801 if (NULL == obj_buffer->buffer_data)
803 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
808 VAStatus dummy_CreateBuffer(
809 VADriverContextP ctx,
810 VAContextID context, /* in */
811 VABufferType type, /* in */
812 unsigned int size, /* in */
813 unsigned int num_elements, /* in */
815 VABufferID *buf_id /* out */
819 VAStatus vaStatus = VA_STATUS_SUCCESS;
821 object_buffer_p obj_buffer;
826 case VAPictureParameterBufferType:
827 case VAIQMatrixBufferType:
828 case VABitPlaneBufferType:
829 case VASliceGroupMapBufferType:
830 case VASliceParameterBufferType:
831 case VASliceDataBufferType:
832 case VAMacroblockParameterBufferType:
833 case VAResidualDataBufferType:
834 case VADeblockingParameterBufferType:
835 case VAImageBufferType:
839 vaStatus = VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE;
843 bufferID = object_heap_allocate( &driver_data->buffer_heap );
844 obj_buffer = BUFFER(bufferID);
845 if (NULL == obj_buffer)
847 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
851 obj_buffer->buffer_data = NULL;
853 vaStatus = dummy__allocate_buffer(obj_buffer, size * num_elements);
854 if (VA_STATUS_SUCCESS == vaStatus)
856 obj_buffer->max_num_elements = num_elements;
857 obj_buffer->num_elements = num_elements;
860 memcpy(obj_buffer->buffer_data, data, size * num_elements);
864 if (VA_STATUS_SUCCESS == vaStatus)
873 VAStatus dummy_BufferSetNumElements(
874 VADriverContextP ctx,
875 VABufferID buf_id, /* in */
876 unsigned int num_elements /* in */
880 VAStatus vaStatus = VA_STATUS_SUCCESS;
881 object_buffer_p obj_buffer = BUFFER(buf_id);
884 if ((num_elements < 0) || (num_elements > obj_buffer->max_num_elements))
886 vaStatus = VA_STATUS_ERROR_UNKNOWN;
888 if (VA_STATUS_SUCCESS == vaStatus)
890 obj_buffer->num_elements = num_elements;
896 VAStatus dummy_MapBuffer(
897 VADriverContextP ctx,
898 VABufferID buf_id, /* in */
899 void **pbuf /* out */
903 VAStatus vaStatus = VA_STATUS_ERROR_UNKNOWN;
904 object_buffer_p obj_buffer = BUFFER(buf_id);
906 if (NULL == obj_buffer)
908 vaStatus = VA_STATUS_ERROR_INVALID_BUFFER;
912 if (NULL != obj_buffer->buffer_data)
914 *pbuf = obj_buffer->buffer_data;
915 vaStatus = VA_STATUS_SUCCESS;
920 VAStatus dummy_UnmapBuffer(
921 VADriverContextP ctx,
922 VABufferID buf_id /* in */
926 return VA_STATUS_SUCCESS;
929 static void dummy__destroy_buffer(struct dummy_driver_data *driver_data, object_buffer_p obj_buffer)
931 if (NULL != obj_buffer->buffer_data)
933 free(obj_buffer->buffer_data);
934 obj_buffer->buffer_data = NULL;
937 object_heap_free( &driver_data->buffer_heap, (object_base_p) obj_buffer);
940 VAStatus dummy_DestroyBuffer(
941 VADriverContextP ctx,
946 object_buffer_p obj_buffer = BUFFER(buffer_id);
949 dummy__destroy_buffer(driver_data, obj_buffer);
950 return VA_STATUS_SUCCESS;
953 VAStatus dummy_BeginPicture(
954 VADriverContextP ctx,
956 VASurfaceID render_target
960 VAStatus vaStatus = VA_STATUS_SUCCESS;
961 object_context_p obj_context;
962 object_surface_p obj_surface;
964 obj_context = CONTEXT(context);
967 obj_surface = SURFACE(render_target);
970 obj_context->current_render_target = obj_surface->base.id;
975 VAStatus dummy_RenderPicture(
976 VADriverContextP ctx,
983 VAStatus vaStatus = VA_STATUS_SUCCESS;
984 object_context_p obj_context;
985 object_surface_p obj_surface;
988 obj_context = CONTEXT(context);
991 obj_surface = SURFACE(obj_context->current_render_target);
994 /* verify that we got valid buffer references */
995 for(i = 0; i < num_buffers; i++)
997 object_buffer_p obj_buffer = BUFFER(buffers[i]);
999 if (NULL == obj_buffer)
1001 vaStatus = VA_STATUS_ERROR_INVALID_BUFFER;
1006 /* Release buffers */
1007 for(i = 0; i < num_buffers; i++)
1009 object_buffer_p obj_buffer = BUFFER(buffers[i]);
1011 dummy__destroy_buffer(driver_data, obj_buffer);
1017 VAStatus dummy_EndPicture(
1018 VADriverContextP ctx,
1023 VAStatus vaStatus = VA_STATUS_SUCCESS;
1024 object_context_p obj_context;
1025 object_surface_p obj_surface;
1027 obj_context = CONTEXT(context);
1028 ASSERT(obj_context);
1030 obj_surface = SURFACE(obj_context->current_render_target);
1031 ASSERT(obj_surface);
1033 // For now, assume that we are done with rendering right away
1034 obj_context->current_render_target = -1;
1040 VAStatus dummy_SyncSurface(
1041 VADriverContextP ctx,
1042 VAContextID context,
1043 VASurfaceID render_target
1047 VAStatus vaStatus = VA_STATUS_SUCCESS;
1048 object_context_p obj_context;
1049 object_surface_p obj_surface;
1051 obj_context = CONTEXT(context);
1052 ASSERT(obj_context);
1054 obj_surface = SURFACE(render_target);
1055 ASSERT(obj_surface);
1057 /* Assume that this shouldn't be called before vaEndPicture() */
1058 ASSERT( obj_context->current_render_target != obj_surface->base.id );
1063 VAStatus dummy_QuerySurfaceStatus(
1064 VADriverContextP ctx,
1065 VASurfaceID render_target,
1066 VASurfaceStatus *status /* out */
1070 VAStatus vaStatus = VA_STATUS_SUCCESS;
1071 object_surface_p obj_surface;
1073 obj_surface = SURFACE(render_target);
1074 ASSERT(obj_surface);
1076 *status = VASurfaceReady;
1081 VAStatus dummy_PutSurface(
1082 VADriverContextP ctx,
1083 VASurfaceID surface,
1084 Drawable draw, /* X Drawable */
1087 unsigned short srcw,
1088 unsigned short srch,
1091 unsigned short destw,
1092 unsigned short desth,
1093 VARectangle *cliprects, /* client supplied clip list */
1094 unsigned int number_cliprects, /* number of clip rects in the clip list */
1095 unsigned int flags /* de-interlacing flags */
1099 return VA_STATUS_ERROR_UNKNOWN;
1103 * Query display attributes
1104 * The caller must provide a "attr_list" array that can hold at
1105 * least vaMaxNumDisplayAttributes() entries. The actual number of attributes
1106 * returned in "attr_list" is returned in "num_attributes".
1108 VAStatus dummy_QueryDisplayAttributes (
1109 VADriverContextP ctx,
1110 VADisplayAttribute *attr_list, /* out */
1111 int *num_attributes /* out */
1115 return VA_STATUS_ERROR_UNKNOWN;
1119 * Get display attributes
1120 * This function returns the current attribute values in "attr_list".
1121 * Only attributes returned with VA_DISPLAY_ATTRIB_GETTABLE set in the "flags" field
1122 * from vaQueryDisplayAttributes() can have their values retrieved.
1124 VAStatus dummy_GetDisplayAttributes (
1125 VADriverContextP ctx,
1126 VADisplayAttribute *attr_list, /* in/out */
1131 return VA_STATUS_ERROR_UNKNOWN;
1135 * Set display attributes
1136 * Only attributes returned with VA_DISPLAY_ATTRIB_SETTABLE set in the "flags" field
1137 * from vaQueryDisplayAttributes() can be set. If the attribute is not settable or
1138 * the value is out of range, the function returns VA_STATUS_ERROR_ATTR_NOT_SUPPORTED
1140 VAStatus dummy_SetDisplayAttributes (
1141 VADriverContextP ctx,
1142 VADisplayAttribute *attr_list,
1147 return VA_STATUS_ERROR_UNKNOWN;
1151 VAStatus dummy_DbgCopySurfaceToBuffer(
1152 VADriverContextP ctx,
1153 VASurfaceID surface,
1154 void **buffer, /* out */
1155 unsigned int *stride /* out */
1159 return VA_STATUS_ERROR_UNKNOWN;
1162 VAStatus dummy_Terminate( VADriverContextP ctx )
1165 object_buffer_p obj_buffer;
1166 object_surface_p obj_surface;
1167 object_context_p obj_context;
1168 object_config_p obj_config;
1169 object_heap_iterator iter;
1171 /* Clean up left over buffers */
1172 obj_buffer = (object_buffer_p) object_heap_first( &driver_data->buffer_heap, &iter);
1175 dummy__information_message("vaTerminate: bufferID %08x still allocated, destroying\n", obj_buffer->base.id);
1176 dummy__destroy_buffer(driver_data, obj_buffer);
1177 obj_buffer = (object_buffer_p) object_heap_next( &driver_data->buffer_heap, &iter);
1179 object_heap_destroy( &driver_data->buffer_heap );
1182 object_heap_destroy( &driver_data->surface_heap );
1185 object_heap_destroy( &driver_data->context_heap );
1187 /* Clean up configIDs */
1188 obj_config = (object_config_p) object_heap_first( &driver_data->config_heap, &iter);
1191 object_heap_free( &driver_data->config_heap, (object_base_p) obj_config);
1192 obj_config = (object_config_p) object_heap_next( &driver_data->config_heap, &iter);
1194 object_heap_destroy( &driver_data->config_heap );
1196 free(ctx->pDriverData);
1197 ctx->pDriverData = NULL;
1199 return VA_STATUS_SUCCESS;
1202 VAStatus __vaDriverInit_0_29( VADriverContextP ctx )
1206 struct dummy_driver_data *driver_data;
1209 ctx->version_major = 0;
1210 ctx->version_minor = 29;
1211 ctx->max_profiles = DUMMY_MAX_PROFILES;
1212 ctx->max_entrypoints = DUMMY_MAX_ENTRYPOINTS;
1213 ctx->max_attributes = DUMMY_MAX_CONFIG_ATTRIBUTES;
1214 ctx->max_image_formats = DUMMY_MAX_IMAGE_FORMATS;
1215 ctx->max_subpic_formats = DUMMY_MAX_SUBPIC_FORMATS;
1216 ctx->max_display_attributes = DUMMY_MAX_DISPLAY_ATTRIBUTES;
1217 ctx->str_vendor = DUMMY_STR_VENDOR;
1219 ctx->vtable.vaTerminate = dummy_Terminate;
1220 ctx->vtable.vaQueryConfigEntrypoints = dummy_QueryConfigEntrypoints;
1221 ctx->vtable.vaQueryConfigProfiles = dummy_QueryConfigProfiles;
1222 ctx->vtable.vaQueryConfigEntrypoints = dummy_QueryConfigEntrypoints;
1223 ctx->vtable.vaQueryConfigAttributes = dummy_QueryConfigAttributes;
1224 ctx->vtable.vaCreateConfig = dummy_CreateConfig;
1225 ctx->vtable.vaDestroyConfig = dummy_DestroyConfig;
1226 ctx->vtable.vaGetConfigAttributes = dummy_GetConfigAttributes;
1227 ctx->vtable.vaCreateSurfaces = dummy_CreateSurfaces;
1228 ctx->vtable.vaDestroySurfaces = dummy_DestroySurfaces;
1229 ctx->vtable.vaCreateContext = dummy_CreateContext;
1230 ctx->vtable.vaDestroyContext = dummy_DestroyContext;
1231 ctx->vtable.vaCreateBuffer = dummy_CreateBuffer;
1232 ctx->vtable.vaBufferSetNumElements = dummy_BufferSetNumElements;
1233 ctx->vtable.vaMapBuffer = dummy_MapBuffer;
1234 ctx->vtable.vaUnmapBuffer = dummy_UnmapBuffer;
1235 ctx->vtable.vaDestroyBuffer = dummy_DestroyBuffer;
1236 ctx->vtable.vaBeginPicture = dummy_BeginPicture;
1237 ctx->vtable.vaRenderPicture = dummy_RenderPicture;
1238 ctx->vtable.vaEndPicture = dummy_EndPicture;
1239 ctx->vtable.vaSyncSurface = dummy_SyncSurface;
1240 ctx->vtable.vaQuerySurfaceStatus = dummy_QuerySurfaceStatus;
1241 ctx->vtable.vaPutSurface = dummy_PutSurface;
1242 ctx->vtable.vaQueryImageFormats = dummy_QueryImageFormats;
1243 ctx->vtable.vaCreateImage = dummy_CreateImage;
1244 ctx->vtable.vaDeriveImage = dummy_DeriveImage;
1245 ctx->vtable.vaDestroyImage = dummy_DestroyImage;
1246 ctx->vtable.vaSetImagePalette = dummy_SetImagePalette;
1247 ctx->vtable.vaGetImage = dummy_GetImage;
1248 ctx->vtable.vaPutImage = dummy_PutImage;
1249 ctx->vtable.vaPutImage2 = dummy_PutImage2;
1250 ctx->vtable.vaQuerySubpictureFormats = dummy_QuerySubpictureFormats;
1251 ctx->vtable.vaCreateSubpicture = dummy_CreateSubpicture;
1252 ctx->vtable.vaDestroySubpicture = dummy_DestroySubpicture;
1253 ctx->vtable.vaSetSubpictureImage = dummy_SetSubpictureImage;
1254 ctx->vtable.vaSetSubpicturePalette = dummy_SetSubpicturePalette;
1255 ctx->vtable.vaSetSubpictureChromakey = dummy_SetSubpictureChromakey;
1256 ctx->vtable.vaSetSubpictureGlobalAlpha = dummy_SetSubpictureGlobalAlpha;
1257 ctx->vtable.vaAssociateSubpicture = dummy_AssociateSubpicture;
1258 ctx->vtable.vaAssociateSubpicture2 = dummy_AssociateSubpicture2;
1259 ctx->vtable.vaDeassociateSubpicture = dummy_DeassociateSubpicture;
1260 ctx->vtable.vaQueryDisplayAttributes = dummy_QueryDisplayAttributes;
1261 ctx->vtable.vaGetDisplayAttributes = dummy_GetDisplayAttributes;
1262 ctx->vtable.vaSetDisplayAttributes = dummy_SetDisplayAttributes;
1264 ctx->vtable.vaDbgCopySurfaceToBuffer = dummy_DbgCopySurfaceToBuffer;
1266 driver_data = (struct dummy_driver_data *) malloc( sizeof(*driver_data) );
1267 ctx->pDriverData = (void *) driver_data;
1269 result = object_heap_init( &driver_data->config_heap, sizeof(struct object_config), CONFIG_ID_OFFSET );
1270 ASSERT( result == 0 );
1272 result = object_heap_init( &driver_data->context_heap, sizeof(struct object_context), CONTEXT_ID_OFFSET );
1273 ASSERT( result == 0 );
1275 result = object_heap_init( &driver_data->surface_heap, sizeof(struct object_surface), SURFACE_ID_OFFSET );
1276 ASSERT( result == 0 );
1278 result = object_heap_init( &driver_data->buffer_heap, sizeof(struct object_buffer), BUFFER_ID_OFFSET );
1279 ASSERT( result == 0 );
1282 return VA_STATUS_SUCCESS;