~misterc/libva/Trunk

« back to all changes in this revision

Viewing changes to libva/dummy_drv_video/dummy_drv_video.c

  • Committer: Austin Yuan
  • Date: 2009-06-13 01:17:46 UTC
  • Revision ID: git-v1:527643827e6589645df6fe2232c2d397f9fe76e9
Fix the issue that all files are moved into a sub-directory libva.

Signed-off-by: Austin Yuan <shengquan.yuan@intel.com>

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (c) 2007 Intel Corporation. All Rights Reserved.
3
 
 *
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:
11
 
 *
12
 
 * The above copyright notice and this permission notice (including the
13
 
 * next paragraph) shall be included in all copies or substantial portions
14
 
 * of the Software.
15
 
 *
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.
23
 
 */
24
 
 
25
 
#include "va_backend.h"
26
 
 
27
 
#include "dummy_drv_video.h"
28
 
 
29
 
#include "assert.h"
30
 
#include <stdio.h>
31
 
#include <string.h>
32
 
#include <stdarg.h>
33
 
 
34
 
#define ASSERT  assert
35
 
 
36
 
#define INIT_DRIVER_DATA        struct dummy_driver_data *driver_data = (struct dummy_driver_data *) ctx->pDriverData;
37
 
 
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 ))
42
 
 
43
 
#define CONFIG_ID_OFFSET                0x01000000
44
 
#define CONTEXT_ID_OFFSET               0x02000000
45
 
#define SURFACE_ID_OFFSET               0x04000000
46
 
#define BUFFER_ID_OFFSET                0x08000000
47
 
 
48
 
static void dummy__error_message(const char *msg, ...)
49
 
{
50
 
    va_list args;
51
 
 
52
 
    fprintf(stderr, "dummy_drv_video error: ");
53
 
    va_start(args, msg);
54
 
    vfprintf(stderr, msg, args);
55
 
    va_end(args);
56
 
}
57
 
 
58
 
static void dummy__information_message(const char *msg, ...)
59
 
{
60
 
    va_list args;
61
 
 
62
 
    fprintf(stderr, "dummy_drv_video: ");
63
 
    va_start(args, msg);
64
 
    vfprintf(stderr, msg, args);
65
 
    va_end(args);
66
 
}
67
 
 
68
 
VAStatus dummy_QueryConfigProfiles(
69
 
                VADriverContextP ctx,
70
 
                VAProfile *profile_list,        /* out */
71
 
                int *num_profiles                       /* out */
72
 
        )
73
 
{
74
 
    INIT_DRIVER_DATA
75
 
    int i = 0;
76
 
 
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;
88
 
 
89
 
    /* If the assert fails then DUMMY_MAX_PROFILES needs to be bigger */
90
 
    ASSERT(i <= DUMMY_MAX_PROFILES);
91
 
    *num_profiles = i;
92
 
 
93
 
    return VA_STATUS_SUCCESS;
94
 
}
95
 
 
96
 
VAStatus dummy_QueryConfigEntrypoints(
97
 
                VADriverContextP ctx,
98
 
                VAProfile profile,
99
 
                VAEntrypoint  *entrypoint_list, /* out */
100
 
                int *num_entrypoints            /* out */
101
 
        )
102
 
{
103
 
    INIT_DRIVER_DATA
104
 
 
105
 
    switch (profile) {
106
 
        case VAProfileMPEG2Simple:
107
 
        case VAProfileMPEG2Main:
108
 
                *num_entrypoints = 2;
109
 
                entrypoint_list[0] = VAEntrypointVLD;
110
 
                entrypoint_list[1] = VAEntrypointMoComp;
111
 
                break;
112
 
 
113
 
        case VAProfileMPEG4Simple:
114
 
        case VAProfileMPEG4AdvancedSimple:
115
 
        case VAProfileMPEG4Main:
116
 
                *num_entrypoints = 1;
117
 
                entrypoint_list[0] = VAEntrypointVLD;
118
 
                break;
119
 
 
120
 
        case VAProfileH264Baseline:
121
 
        case VAProfileH264Main:
122
 
        case VAProfileH264High:
123
 
                *num_entrypoints = 1;
124
 
                entrypoint_list[0] = VAEntrypointVLD;
125
 
                break;
126
 
 
127
 
        case VAProfileVC1Simple:
128
 
        case VAProfileVC1Main:
129
 
        case VAProfileVC1Advanced:
130
 
                *num_entrypoints = 1;
131
 
                entrypoint_list[0] = VAEntrypointVLD;
132
 
                break;
133
 
 
134
 
        default:
135
 
                *num_entrypoints = 0;
136
 
                break;
137
 
    }
138
 
 
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;
142
 
}
143
 
 
144
 
VAStatus dummy_GetConfigAttributes(
145
 
                VADriverContextP ctx,
146
 
                VAProfile profile,
147
 
                VAEntrypoint entrypoint,
148
 
                VAConfigAttrib *attrib_list,    /* in/out */
149
 
                int num_attribs
150
 
        )
151
 
{
152
 
    INIT_DRIVER_DATA
153
 
 
154
 
    int i;
155
 
 
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++)
159
 
    {
160
 
        switch (attrib_list[i].type)
161
 
        {
162
 
          case VAConfigAttribRTFormat:
163
 
              attrib_list[i].value = VA_RT_FORMAT_YUV420;
164
 
              break;
165
 
 
166
 
          default:
167
 
              /* Do nothing */
168
 
              attrib_list[i].value = VA_ATTRIB_NOT_SUPPORTED;
169
 
              break;
170
 
        }
171
 
    }
172
 
 
173
 
    return VA_STATUS_SUCCESS;
174
 
}
175
 
 
176
 
static VAStatus dummy__update_attribute(object_config_p obj_config, VAConfigAttrib *attrib)
177
 
{
178
 
    int i;
179
 
    /* Check existing attrbiutes */
180
 
    for(i = 0; obj_config->attrib_count < i; i++)
181
 
    {
182
 
        if (obj_config->attrib_list[i].type == attrib->type)
183
 
        {
184
 
            /* Update existing attribute */
185
 
            obj_config->attrib_list[i].value = attrib->value;
186
 
            return VA_STATUS_SUCCESS;
187
 
        }
188
 
    }
189
 
    if (obj_config->attrib_count < DUMMY_MAX_CONFIG_ATTRIBUTES)
190
 
    {
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;
196
 
    }
197
 
    return VA_STATUS_ERROR_MAX_NUM_EXCEEDED;
198
 
}
199
 
 
200
 
VAStatus dummy_CreateConfig(
201
 
                VADriverContextP ctx,
202
 
                VAProfile profile,
203
 
                VAEntrypoint entrypoint,
204
 
                VAConfigAttrib *attrib_list,
205
 
                int num_attribs,
206
 
                VAConfigID *config_id           /* out */
207
 
        )
208
 
{
209
 
    INIT_DRIVER_DATA
210
 
    VAStatus vaStatus;
211
 
    int configID;
212
 
    object_config_p obj_config;
213
 
    int i;
214
 
 
215
 
    /* Validate profile & entrypoint */
216
 
    switch (profile) {
217
 
        case VAProfileMPEG2Simple:
218
 
        case VAProfileMPEG2Main:
219
 
                if ((VAEntrypointVLD == entrypoint) ||
220
 
                    (VAEntrypointMoComp == entrypoint))
221
 
                {
222
 
                    vaStatus = VA_STATUS_SUCCESS;
223
 
                }
224
 
                else
225
 
                {
226
 
                    vaStatus = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
227
 
                }
228
 
                break;
229
 
 
230
 
        case VAProfileMPEG4Simple:
231
 
        case VAProfileMPEG4AdvancedSimple:
232
 
        case VAProfileMPEG4Main:
233
 
                if (VAEntrypointVLD == entrypoint)
234
 
                {
235
 
                    vaStatus = VA_STATUS_SUCCESS;
236
 
                }
237
 
                else
238
 
                {
239
 
                    vaStatus = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
240
 
                }
241
 
                break;
242
 
 
243
 
        case VAProfileH264Baseline:
244
 
        case VAProfileH264Main:
245
 
        case VAProfileH264High:
246
 
                if (VAEntrypointVLD == entrypoint)
247
 
                {
248
 
                    vaStatus = VA_STATUS_SUCCESS;
249
 
                }
250
 
                else
251
 
                {
252
 
                    vaStatus = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
253
 
                }
254
 
                break;
255
 
 
256
 
        case VAProfileVC1Simple:
257
 
        case VAProfileVC1Main:
258
 
        case VAProfileVC1Advanced:
259
 
                if (VAEntrypointVLD == entrypoint)
260
 
                {
261
 
                    vaStatus = VA_STATUS_SUCCESS;
262
 
                }
263
 
                else
264
 
                {
265
 
                    vaStatus = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
266
 
                }
267
 
                break;
268
 
 
269
 
        default:
270
 
                vaStatus = VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
271
 
                break;
272
 
    }
273
 
 
274
 
    if (VA_STATUS_SUCCESS != vaStatus)
275
 
    {
276
 
        return vaStatus;
277
 
    }
278
 
 
279
 
    configID = object_heap_allocate( &driver_data->config_heap );
280
 
    obj_config = CONFIG(configID);
281
 
    if (NULL == obj_config)
282
 
    {
283
 
        vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
284
 
        return vaStatus;
285
 
    }
286
 
 
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;
292
 
 
293
 
    for(i = 0; i < num_attribs; i++)
294
 
    {
295
 
        vaStatus = dummy__update_attribute(obj_config, &(attrib_list[i]));
296
 
        if (VA_STATUS_SUCCESS != vaStatus)
297
 
        {
298
 
            break;
299
 
        }
300
 
    }
301
 
 
302
 
    /* Error recovery */
303
 
    if (VA_STATUS_SUCCESS != vaStatus)
304
 
    {
305
 
        object_heap_free( &driver_data->config_heap, (object_base_p) obj_config);
306
 
    }
307
 
    else
308
 
    {
309
 
        *config_id = configID;
310
 
    }
311
 
 
312
 
    return vaStatus;
313
 
}
314
 
 
315
 
VAStatus dummy_DestroyConfig(
316
 
                VADriverContextP ctx,
317
 
                VAConfigID config_id
318
 
        )
319
 
{
320
 
    INIT_DRIVER_DATA
321
 
    VAStatus vaStatus;
322
 
    object_config_p obj_config;
323
 
 
324
 
    obj_config = CONFIG(config_id);
325
 
    if (NULL == obj_config)
326
 
    {
327
 
        vaStatus = VA_STATUS_ERROR_INVALID_CONFIG;
328
 
        return vaStatus;
329
 
    }
330
 
 
331
 
    object_heap_free( &driver_data->config_heap, (object_base_p) obj_config);
332
 
    return VA_STATUS_SUCCESS;
333
 
}
334
 
 
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 */
342
 
        )
343
 
{
344
 
    INIT_DRIVER_DATA
345
 
    VAStatus vaStatus = VA_STATUS_SUCCESS;
346
 
    object_config_p obj_config;
347
 
    int i;
348
 
 
349
 
    obj_config = CONFIG(config_id);
350
 
    ASSERT(obj_config);
351
 
 
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++)
356
 
    {
357
 
        attrib_list[i] = obj_config->attrib_list[i];
358
 
    }
359
 
 
360
 
    return vaStatus;
361
 
}
362
 
 
363
 
VAStatus dummy_CreateSurfaces(
364
 
                VADriverContextP ctx,
365
 
                int width,
366
 
                int height,
367
 
                int format,
368
 
                int num_surfaces,
369
 
                VASurfaceID *surfaces           /* out */
370
 
        )
371
 
{
372
 
    INIT_DRIVER_DATA
373
 
    VAStatus vaStatus = VA_STATUS_SUCCESS;
374
 
    int i;
375
 
 
376
 
    /* We only support one format */
377
 
    if (VA_RT_FORMAT_YUV420 != format)
378
 
    {
379
 
        return VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT;
380
 
    }
381
 
 
382
 
    for (i = 0; i < num_surfaces; i++)
383
 
    {
384
 
        int surfaceID = object_heap_allocate( &driver_data->surface_heap );
385
 
        object_surface_p obj_surface = SURFACE(surfaceID);
386
 
        if (NULL == obj_surface)
387
 
        {
388
 
            vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
389
 
            break;
390
 
        }
391
 
        obj_surface->surface_id = surfaceID;
392
 
        surfaces[i] = surfaceID;
393
 
    }
394
 
 
395
 
    /* Error recovery */
396
 
    if (VA_STATUS_SUCCESS != vaStatus)
397
 
    {
398
 
        /* surfaces[i-1] was the last successful allocation */
399
 
        for(; i--; )
400
 
        {
401
 
            object_surface_p obj_surface = SURFACE(surfaces[i]);
402
 
            surfaces[i] = VA_INVALID_SURFACE;
403
 
            ASSERT(obj_surface);
404
 
            object_heap_free( &driver_data->surface_heap, (object_base_p) obj_surface);
405
 
        }
406
 
    }
407
 
 
408
 
    return vaStatus;
409
 
}
410
 
 
411
 
VAStatus dummy_DestroySurfaces(
412
 
                VADriverContextP ctx,
413
 
                VASurfaceID *surface_list,
414
 
                int num_surfaces
415
 
        )
416
 
{
417
 
    INIT_DRIVER_DATA
418
 
    int i;
419
 
    for(i = num_surfaces; i--; )
420
 
    {
421
 
        object_surface_p obj_surface = SURFACE(surface_list[i]);
422
 
        ASSERT(obj_surface);
423
 
        object_heap_free( &driver_data->surface_heap, (object_base_p) obj_surface);
424
 
    }
425
 
    return VA_STATUS_SUCCESS;
426
 
}
427
 
 
428
 
VAStatus dummy_QueryImageFormats(
429
 
        VADriverContextP ctx,
430
 
        VAImageFormat *format_list,        /* out */
431
 
        int *num_formats           /* out */
432
 
)
433
 
{
434
 
    INIT_DRIVER_DATA
435
 
    
436
 
    /* TODO */
437
 
    return VA_STATUS_SUCCESS;
438
 
}
439
 
 
440
 
VAStatus dummy_CreateImage(
441
 
        VADriverContextP ctx,
442
 
        VAImageFormat *format,
443
 
        int width,
444
 
        int height,
445
 
        VAImage *image     /* out */
446
 
)
447
 
{
448
 
    INIT_DRIVER_DATA
449
 
    
450
 
    /* TODO */
451
 
    return VA_STATUS_SUCCESS;
452
 
}
453
 
 
454
 
VAStatus dummy_DeriveImage(
455
 
        VADriverContextP ctx,
456
 
        VASurfaceID surface,
457
 
        VAImage *image     /* out */
458
 
)
459
 
{
460
 
    INIT_DRIVER_DATA
461
 
    
462
 
    /* TODO */
463
 
    return VA_STATUS_SUCCESS;
464
 
}
465
 
 
466
 
VAStatus dummy_DestroyImage(
467
 
        VADriverContextP ctx,
468
 
        VAImageID image
469
 
)
470
 
{
471
 
    INIT_DRIVER_DATA
472
 
    
473
 
    /* TODO */
474
 
    return VA_STATUS_SUCCESS;
475
 
}
476
 
 
477
 
VAStatus dummy_SetImagePalette(
478
 
        VADriverContextP ctx,
479
 
        VAImageID image,
480
 
        unsigned char *palette
481
 
)
482
 
{
483
 
    INIT_DRIVER_DATA
484
 
    
485
 
    /* TODO */
486
 
    return VA_STATUS_SUCCESS;
487
 
}
488
 
 
489
 
VAStatus dummy_GetImage(
490
 
        VADriverContextP ctx,
491
 
        VASurfaceID surface,
492
 
        int x,     /* coordinates of the upper left source pixel */
493
 
        int y,
494
 
        unsigned int width, /* width and height of the region */
495
 
        unsigned int height,
496
 
        VAImageID image
497
 
)
498
 
{
499
 
    INIT_DRIVER_DATA
500
 
    
501
 
    /* TODO */
502
 
    return VA_STATUS_SUCCESS;
503
 
}
504
 
 
505
 
VAStatus dummy_PutImage(
506
 
        VADriverContextP ctx,
507
 
        VASurfaceID surface,
508
 
        VAImageID image,
509
 
        int src_x,
510
 
        int src_y,
511
 
        unsigned int width,
512
 
        unsigned int height,
513
 
        int dest_x,
514
 
        int dest_y 
515
 
)
516
 
{
517
 
    INIT_DRIVER_DATA
518
 
    
519
 
    /* TODO */
520
 
    return VA_STATUS_SUCCESS;
521
 
}
522
 
 
523
 
VAStatus dummy_PutImage2(
524
 
        VADriverContextP ctx,
525
 
        VASurfaceID surface,
526
 
        VAImageID image,
527
 
        int src_x,
528
 
        int src_y,
529
 
        unsigned int src_width,
530
 
        unsigned int src_height,
531
 
        int dest_x,
532
 
        int dest_y,
533
 
        unsigned int dest_width,
534
 
        unsigned int dest_height
535
 
)
536
 
{
537
 
    INIT_DRIVER_DATA
538
 
    
539
 
    /* TODO */
540
 
    return VA_STATUS_SUCCESS;
541
 
}
542
 
 
543
 
VAStatus dummy_QuerySubpictureFormats(
544
 
        VADriverContextP ctx,
545
 
        VAImageFormat *format_list,        /* out */
546
 
        unsigned int *flags,       /* out */
547
 
        unsigned int *num_formats  /* out */
548
 
)
549
 
{
550
 
    INIT_DRIVER_DATA
551
 
    
552
 
    /* TODO */
553
 
    return VA_STATUS_SUCCESS;
554
 
}
555
 
 
556
 
VAStatus dummy_CreateSubpicture(
557
 
        VADriverContextP ctx,
558
 
        VAImageID image,
559
 
        VASubpictureID *subpicture   /* out */
560
 
)
561
 
{
562
 
    INIT_DRIVER_DATA
563
 
    
564
 
    /* TODO */
565
 
    return VA_STATUS_SUCCESS;
566
 
}
567
 
 
568
 
VAStatus dummy_DestroySubpicture(
569
 
        VADriverContextP ctx,
570
 
        VASubpictureID subpicture
571
 
)
572
 
{
573
 
    INIT_DRIVER_DATA
574
 
    
575
 
    /* TODO */
576
 
    return VA_STATUS_SUCCESS;
577
 
}
578
 
 
579
 
VAStatus dummy_SetSubpictureImage(
580
 
        VADriverContextP ctx,
581
 
        VASubpictureID subpicture,
582
 
        VAImageID image
583
 
)
584
 
{
585
 
    INIT_DRIVER_DATA
586
 
    
587
 
    /* TODO */
588
 
    return VA_STATUS_SUCCESS;
589
 
}
590
 
 
591
 
VAStatus dummy_SetSubpicturePalette(
592
 
        VADriverContextP ctx,
593
 
        VASubpictureID subpicture,
594
 
        /*
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
598
 
         */
599
 
        unsigned char *palette
600
 
)
601
 
{
602
 
    INIT_DRIVER_DATA
603
 
    
604
 
    /* TODO */
605
 
    return VA_STATUS_SUCCESS;
606
 
}
607
 
 
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
614
 
)
615
 
{
616
 
    INIT_DRIVER_DATA
617
 
    
618
 
    /* TODO */
619
 
    return VA_STATUS_SUCCESS;
620
 
}
621
 
 
622
 
VAStatus dummy_SetSubpictureGlobalAlpha(
623
 
        VADriverContextP ctx,
624
 
        VASubpictureID subpicture,
625
 
        float global_alpha 
626
 
)
627
 
{
628
 
    INIT_DRIVER_DATA
629
 
    
630
 
    /* TODO */
631
 
    return VA_STATUS_SUCCESS;
632
 
}
633
 
 
634
 
VAStatus dummy_AssociateSubpicture(
635
 
        VADriverContextP ctx,
636
 
        VASubpictureID subpicture,
637
 
        VASurfaceID *target_surfaces,
638
 
        int num_surfaces,
639
 
        short src_x, /* upper left offset in subpicture */
640
 
        short src_y,
641
 
        short dest_x, /* upper left offset in surface */
642
 
        short dest_y,
643
 
        unsigned short width,
644
 
        unsigned short height,
645
 
        /*
646
 
         * whether to enable chroma-keying or global-alpha
647
 
         * see VA_SUBPICTURE_XXX values
648
 
         */
649
 
        unsigned int flags
650
 
)
651
 
{
652
 
    INIT_DRIVER_DATA
653
 
    
654
 
    /* TODO */
655
 
    return VA_STATUS_SUCCESS;
656
 
}
657
 
 
658
 
VAStatus dummy_AssociateSubpicture2(
659
 
        VADriverContextP ctx,
660
 
        VASubpictureID subpicture,
661
 
        VASurfaceID *target_surfaces,
662
 
        int num_surfaces,
663
 
        short src_x, /* upper left offset in subpicture */
664
 
        short src_y,
665
 
        unsigned short src_width,
666
 
        unsigned short src_height,
667
 
        short dest_x, /* upper left offset in surface */
668
 
        short dest_y,
669
 
        unsigned short dest_width,
670
 
        unsigned short dest_height,
671
 
        /*
672
 
         * whether to enable chroma-keying or global-alpha
673
 
         * see VA_SUBPICTURE_XXX values
674
 
         */
675
 
        unsigned int flags
676
 
)
677
 
{
678
 
    INIT_DRIVER_DATA
679
 
    
680
 
    /* TODO */
681
 
    return VA_STATUS_SUCCESS;
682
 
}
683
 
 
684
 
VAStatus dummy_DeassociateSubpicture(
685
 
        VADriverContextP ctx,
686
 
        VASubpictureID subpicture,
687
 
        VASurfaceID *target_surfaces,
688
 
        int num_surfaces
689
 
)
690
 
{
691
 
    INIT_DRIVER_DATA
692
 
    
693
 
    /* TODO */
694
 
    return VA_STATUS_SUCCESS;
695
 
}
696
 
 
697
 
VAStatus dummy_CreateContext(
698
 
                VADriverContextP ctx,
699
 
                VAConfigID config_id,
700
 
                int picture_width,
701
 
                int picture_height,
702
 
                int flag,
703
 
                VASurfaceID *render_targets,
704
 
                int num_render_targets,
705
 
                VAContextID *context            /* out */
706
 
        )
707
 
{
708
 
    INIT_DRIVER_DATA
709
 
    VAStatus vaStatus = VA_STATUS_SUCCESS;
710
 
    object_config_p obj_config;
711
 
    int i;
712
 
 
713
 
    obj_config = CONFIG(config_id);
714
 
    if (NULL == obj_config)
715
 
    {
716
 
        vaStatus = VA_STATUS_ERROR_INVALID_CONFIG;
717
 
        return vaStatus;
718
 
    }
719
 
 
720
 
    /* Validate flag */
721
 
    /* Validate picture dimensions */
722
 
 
723
 
    int contextID = object_heap_allocate( &driver_data->context_heap );
724
 
    object_context_p obj_context = CONTEXT(contextID);
725
 
    if (NULL == obj_context)
726
 
    {
727
 
        vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
728
 
        return vaStatus;
729
 
    }
730
 
 
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
 
    if (obj_context->render_targets == NULL)
740
 
    {
741
 
        vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
742
 
        return vaStatus;
743
 
    }
744
 
    
745
 
    for(i = 0; i < num_render_targets; i++)
746
 
    {
747
 
        if (NULL == SURFACE(render_targets[i]))
748
 
        {
749
 
            vaStatus = VA_STATUS_ERROR_INVALID_SURFACE;
750
 
            break;
751
 
        }
752
 
        obj_context->render_targets[i] = render_targets[i];
753
 
    }
754
 
    obj_context->flags = flag;
755
 
 
756
 
    /* Error recovery */
757
 
    if (VA_STATUS_SUCCESS != vaStatus)
758
 
    {
759
 
        obj_context->context_id = -1;
760
 
        obj_context->config_id = -1;
761
 
        free(obj_context->render_targets);
762
 
        obj_context->render_targets = NULL;
763
 
        obj_context->num_render_targets = 0;
764
 
        obj_context->flags = 0;
765
 
        object_heap_free( &driver_data->context_heap, (object_base_p) obj_context);
766
 
    }
767
 
 
768
 
    return vaStatus;
769
 
}
770
 
 
771
 
 
772
 
VAStatus dummy_DestroyContext(
773
 
                VADriverContextP ctx,
774
 
                VAContextID context
775
 
        )
776
 
{
777
 
    INIT_DRIVER_DATA
778
 
    object_context_p obj_context = CONTEXT(context);
779
 
    ASSERT(obj_context);
780
 
 
781
 
    obj_context->context_id = -1;
782
 
    obj_context->config_id = -1;
783
 
    obj_context->picture_width = 0;
784
 
    obj_context->picture_height = 0;
785
 
    if (obj_context->render_targets)
786
 
    {
787
 
        free(obj_context->render_targets);
788
 
    }
789
 
    obj_context->render_targets = NULL;
790
 
    obj_context->num_render_targets = 0;
791
 
    obj_context->flags = 0;
792
 
 
793
 
    obj_context->current_render_target = -1;
794
 
 
795
 
    object_heap_free( &driver_data->context_heap, (object_base_p) obj_context);
796
 
 
797
 
    return VA_STATUS_SUCCESS;
798
 
}
799
 
 
800
 
 
801
 
 
802
 
static VAStatus dummy__allocate_buffer(object_buffer_p obj_buffer, int size)
803
 
{
804
 
    VAStatus vaStatus = VA_STATUS_SUCCESS;
805
 
 
806
 
    obj_buffer->buffer_data = realloc(obj_buffer->buffer_data, size);
807
 
    if (NULL == obj_buffer->buffer_data)
808
 
    {
809
 
        vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
810
 
    }
811
 
    return vaStatus;
812
 
}
813
 
 
814
 
VAStatus dummy_CreateBuffer(
815
 
                VADriverContextP ctx,
816
 
                VAContextID context,    /* in */
817
 
                VABufferType type,      /* in */
818
 
                unsigned int size,              /* in */
819
 
                unsigned int num_elements,      /* in */
820
 
                void *data,                     /* in */
821
 
                VABufferID *buf_id              /* out */
822
 
)
823
 
{
824
 
    INIT_DRIVER_DATA
825
 
    VAStatus vaStatus = VA_STATUS_SUCCESS;
826
 
    int bufferID;
827
 
    object_buffer_p obj_buffer;
828
 
 
829
 
    /* Validate type */
830
 
    switch (type)
831
 
    {
832
 
        case VAPictureParameterBufferType:
833
 
        case VAIQMatrixBufferType:
834
 
        case VABitPlaneBufferType:
835
 
        case VASliceGroupMapBufferType:
836
 
        case VASliceParameterBufferType:
837
 
        case VASliceDataBufferType:
838
 
        case VAMacroblockParameterBufferType:
839
 
        case VAResidualDataBufferType:
840
 
        case VADeblockingParameterBufferType:
841
 
        case VAImageBufferType:
842
 
            /* Ok */
843
 
            break;
844
 
        default:
845
 
            vaStatus = VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE;
846
 
            return vaStatus;
847
 
    }
848
 
 
849
 
    bufferID = object_heap_allocate( &driver_data->buffer_heap );
850
 
    obj_buffer = BUFFER(bufferID);
851
 
    if (NULL == obj_buffer)
852
 
    {
853
 
        vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
854
 
        return vaStatus;
855
 
    }
856
 
 
857
 
    obj_buffer->buffer_data = NULL;
858
 
 
859
 
    vaStatus = dummy__allocate_buffer(obj_buffer, size * num_elements);
860
 
    if (VA_STATUS_SUCCESS == vaStatus)
861
 
    {
862
 
        obj_buffer->max_num_elements = num_elements;
863
 
        obj_buffer->num_elements = num_elements;
864
 
        if (data)
865
 
        {
866
 
            memcpy(obj_buffer->buffer_data, data, size * num_elements);
867
 
        }
868
 
    }
869
 
 
870
 
    if (VA_STATUS_SUCCESS == vaStatus)
871
 
    {
872
 
        *buf_id = bufferID;
873
 
    }
874
 
 
875
 
    return vaStatus;
876
 
}
877
 
 
878
 
 
879
 
VAStatus dummy_BufferSetNumElements(
880
 
                VADriverContextP ctx,
881
 
                VABufferID buf_id,      /* in */
882
 
        unsigned int num_elements       /* in */
883
 
        )
884
 
{
885
 
    INIT_DRIVER_DATA
886
 
    VAStatus vaStatus = VA_STATUS_SUCCESS;
887
 
    object_buffer_p obj_buffer = BUFFER(buf_id);
888
 
    ASSERT(obj_buffer);
889
 
 
890
 
    if ((num_elements < 0) || (num_elements > obj_buffer->max_num_elements))
891
 
    {
892
 
        vaStatus = VA_STATUS_ERROR_UNKNOWN;
893
 
    }
894
 
    if (VA_STATUS_SUCCESS == vaStatus)
895
 
    {
896
 
        obj_buffer->num_elements = num_elements;
897
 
    }
898
 
 
899
 
    return vaStatus;
900
 
}
901
 
 
902
 
VAStatus dummy_MapBuffer(
903
 
                VADriverContextP ctx,
904
 
                VABufferID buf_id,      /* in */
905
 
                void **pbuf         /* out */
906
 
        )
907
 
{
908
 
    INIT_DRIVER_DATA
909
 
    VAStatus vaStatus = VA_STATUS_ERROR_UNKNOWN;
910
 
    object_buffer_p obj_buffer = BUFFER(buf_id);
911
 
    ASSERT(obj_buffer);
912
 
    if (NULL == obj_buffer)
913
 
    {
914
 
        vaStatus = VA_STATUS_ERROR_INVALID_BUFFER;
915
 
        return vaStatus;
916
 
    }
917
 
 
918
 
    if (NULL != obj_buffer->buffer_data)
919
 
    {
920
 
        *pbuf = obj_buffer->buffer_data;
921
 
        vaStatus = VA_STATUS_SUCCESS;
922
 
    }
923
 
    return vaStatus;
924
 
}
925
 
 
926
 
VAStatus dummy_UnmapBuffer(
927
 
                VADriverContextP ctx,
928
 
                VABufferID buf_id       /* in */
929
 
        )
930
 
{
931
 
    /* Do nothing */
932
 
    return VA_STATUS_SUCCESS;
933
 
}
934
 
 
935
 
static void dummy__destroy_buffer(struct dummy_driver_data *driver_data, object_buffer_p obj_buffer)
936
 
{
937
 
    if (NULL != obj_buffer->buffer_data)
938
 
    {
939
 
        free(obj_buffer->buffer_data);
940
 
        obj_buffer->buffer_data = NULL;
941
 
    }
942
 
 
943
 
    object_heap_free( &driver_data->buffer_heap, (object_base_p) obj_buffer);
944
 
}
945
 
 
946
 
VAStatus dummy_DestroyBuffer(
947
 
                VADriverContextP ctx,
948
 
                VABufferID buffer_id
949
 
        )
950
 
{
951
 
    INIT_DRIVER_DATA
952
 
    object_buffer_p obj_buffer = BUFFER(buffer_id);
953
 
    ASSERT(obj_buffer);
954
 
 
955
 
    dummy__destroy_buffer(driver_data, obj_buffer);
956
 
    return VA_STATUS_SUCCESS;
957
 
}
958
 
 
959
 
VAStatus dummy_BeginPicture(
960
 
                VADriverContextP ctx,
961
 
                VAContextID context,
962
 
                VASurfaceID render_target
963
 
        )
964
 
{
965
 
    INIT_DRIVER_DATA
966
 
    VAStatus vaStatus = VA_STATUS_SUCCESS;
967
 
    object_context_p obj_context;
968
 
    object_surface_p obj_surface;
969
 
 
970
 
    obj_context = CONTEXT(context);
971
 
    ASSERT(obj_context);
972
 
 
973
 
    obj_surface = SURFACE(render_target);
974
 
    ASSERT(obj_surface);
975
 
 
976
 
    obj_context->current_render_target = obj_surface->base.id;
977
 
 
978
 
    return vaStatus;
979
 
}
980
 
 
981
 
VAStatus dummy_RenderPicture(
982
 
                VADriverContextP ctx,
983
 
                VAContextID context,
984
 
                VABufferID *buffers,
985
 
                int num_buffers
986
 
        )
987
 
{
988
 
    INIT_DRIVER_DATA
989
 
    VAStatus vaStatus = VA_STATUS_SUCCESS;
990
 
    object_context_p obj_context;
991
 
    object_surface_p obj_surface;
992
 
    int i;
993
 
 
994
 
    obj_context = CONTEXT(context);
995
 
    ASSERT(obj_context);
996
 
 
997
 
    obj_surface = SURFACE(obj_context->current_render_target);
998
 
    ASSERT(obj_surface);
999
 
 
1000
 
    /* verify that we got valid buffer references */
1001
 
    for(i = 0; i < num_buffers; i++)
1002
 
    {
1003
 
        object_buffer_p obj_buffer = BUFFER(buffers[i]);
1004
 
        ASSERT(obj_buffer);
1005
 
        if (NULL == obj_buffer)
1006
 
        {
1007
 
            vaStatus = VA_STATUS_ERROR_INVALID_BUFFER;
1008
 
            break;
1009
 
        }
1010
 
    }
1011
 
    
1012
 
    /* Release buffers */
1013
 
    for(i = 0; i < num_buffers; i++)
1014
 
    {
1015
 
        object_buffer_p obj_buffer = BUFFER(buffers[i]);
1016
 
        ASSERT(obj_buffer);
1017
 
        dummy__destroy_buffer(driver_data, obj_buffer);
1018
 
    }
1019
 
 
1020
 
    return vaStatus;
1021
 
}
1022
 
 
1023
 
VAStatus dummy_EndPicture(
1024
 
                VADriverContextP ctx,
1025
 
                VAContextID context
1026
 
        )
1027
 
{
1028
 
    INIT_DRIVER_DATA
1029
 
    VAStatus vaStatus = VA_STATUS_SUCCESS;
1030
 
    object_context_p obj_context;
1031
 
    object_surface_p obj_surface;
1032
 
 
1033
 
    obj_context = CONTEXT(context);
1034
 
    ASSERT(obj_context);
1035
 
 
1036
 
    obj_surface = SURFACE(obj_context->current_render_target);
1037
 
    ASSERT(obj_surface);
1038
 
 
1039
 
    // For now, assume that we are done with rendering right away
1040
 
    obj_context->current_render_target = -1;
1041
 
 
1042
 
    return vaStatus;
1043
 
}
1044
 
 
1045
 
 
1046
 
VAStatus dummy_SyncSurface(
1047
 
                VADriverContextP ctx,
1048
 
                VAContextID context,
1049
 
                VASurfaceID render_target
1050
 
        )
1051
 
{
1052
 
    INIT_DRIVER_DATA
1053
 
    VAStatus vaStatus = VA_STATUS_SUCCESS;
1054
 
    object_context_p obj_context;
1055
 
    object_surface_p obj_surface;
1056
 
 
1057
 
    obj_context = CONTEXT(context);
1058
 
    ASSERT(obj_context);
1059
 
 
1060
 
    obj_surface = SURFACE(render_target);
1061
 
    ASSERT(obj_surface);
1062
 
 
1063
 
    /* Assume that this shouldn't be called before vaEndPicture() */
1064
 
    ASSERT( obj_context->current_render_target != obj_surface->base.id );
1065
 
 
1066
 
    return vaStatus;
1067
 
}
1068
 
 
1069
 
VAStatus dummy_QuerySurfaceStatus(
1070
 
                VADriverContextP ctx,
1071
 
                VASurfaceID render_target,
1072
 
                VASurfaceStatus *status /* out */
1073
 
        )
1074
 
{
1075
 
    INIT_DRIVER_DATA
1076
 
    VAStatus vaStatus = VA_STATUS_SUCCESS;
1077
 
    object_surface_p obj_surface;
1078
 
 
1079
 
    obj_surface = SURFACE(render_target);
1080
 
    ASSERT(obj_surface);
1081
 
 
1082
 
    *status = VASurfaceReady;
1083
 
 
1084
 
    return vaStatus;
1085
 
}
1086
 
 
1087
 
VAStatus dummy_PutSurface(
1088
 
                VADriverContextP ctx,
1089
 
                VASurfaceID surface,
1090
 
                Drawable draw, /* X Drawable */
1091
 
                short srcx,
1092
 
                short srcy,
1093
 
                unsigned short srcw,
1094
 
                unsigned short srch,
1095
 
                short destx,
1096
 
                short desty,
1097
 
                unsigned short destw,
1098
 
                unsigned short desth,
1099
 
                VARectangle *cliprects, /* client supplied clip list */
1100
 
                unsigned int number_cliprects, /* number of clip rects in the clip list */
1101
 
                unsigned int flags /* de-interlacing flags */
1102
 
        )
1103
 
{
1104
 
    /* TODO */
1105
 
    return VA_STATUS_ERROR_UNKNOWN;
1106
 
}
1107
 
 
1108
 
/* 
1109
 
 * Query display attributes 
1110
 
 * The caller must provide a "attr_list" array that can hold at
1111
 
 * least vaMaxNumDisplayAttributes() entries. The actual number of attributes
1112
 
 * returned in "attr_list" is returned in "num_attributes".
1113
 
 */
1114
 
VAStatus dummy_QueryDisplayAttributes (
1115
 
                VADriverContextP ctx,
1116
 
                VADisplayAttribute *attr_list,  /* out */
1117
 
                int *num_attributes             /* out */
1118
 
        )
1119
 
{
1120
 
    /* TODO */
1121
 
    return VA_STATUS_ERROR_UNKNOWN;
1122
 
}
1123
 
 
1124
 
/* 
1125
 
 * Get display attributes 
1126
 
 * This function returns the current attribute values in "attr_list".
1127
 
 * Only attributes returned with VA_DISPLAY_ATTRIB_GETTABLE set in the "flags" field
1128
 
 * from vaQueryDisplayAttributes() can have their values retrieved.  
1129
 
 */
1130
 
VAStatus dummy_GetDisplayAttributes (
1131
 
                VADriverContextP ctx,
1132
 
                VADisplayAttribute *attr_list,  /* in/out */
1133
 
                int num_attributes
1134
 
        )
1135
 
{
1136
 
    /* TODO */
1137
 
    return VA_STATUS_ERROR_UNKNOWN;
1138
 
}
1139
 
 
1140
 
/* 
1141
 
 * Set display attributes 
1142
 
 * Only attributes returned with VA_DISPLAY_ATTRIB_SETTABLE set in the "flags" field
1143
 
 * from vaQueryDisplayAttributes() can be set.  If the attribute is not settable or 
1144
 
 * the value is out of range, the function returns VA_STATUS_ERROR_ATTR_NOT_SUPPORTED
1145
 
 */
1146
 
VAStatus dummy_SetDisplayAttributes (
1147
 
                VADriverContextP ctx,
1148
 
                VADisplayAttribute *attr_list,
1149
 
                int num_attributes
1150
 
        )
1151
 
{
1152
 
    /* TODO */
1153
 
    return VA_STATUS_ERROR_UNKNOWN;
1154
 
}
1155
 
 
1156
 
 
1157
 
VAStatus dummy_DbgCopySurfaceToBuffer(
1158
 
                VADriverContextP ctx,
1159
 
                VASurfaceID surface,
1160
 
                void **buffer, /* out */
1161
 
                unsigned int *stride /* out */
1162
 
        )
1163
 
{
1164
 
    /* TODO */
1165
 
    return VA_STATUS_ERROR_UNKNOWN;
1166
 
}
1167
 
 
1168
 
VAStatus dummy_Terminate( VADriverContextP ctx )
1169
 
{
1170
 
    INIT_DRIVER_DATA
1171
 
    object_buffer_p obj_buffer;
1172
 
    object_surface_p obj_surface;
1173
 
    object_context_p obj_context;
1174
 
    object_config_p obj_config;
1175
 
    object_heap_iterator iter;
1176
 
 
1177
 
    /* Clean up left over buffers */
1178
 
    obj_buffer = (object_buffer_p) object_heap_first( &driver_data->buffer_heap, &iter);
1179
 
    while (obj_buffer)
1180
 
    {
1181
 
        dummy__information_message("vaTerminate: bufferID %08x still allocated, destroying\n", obj_buffer->base.id);
1182
 
        dummy__destroy_buffer(driver_data, obj_buffer);
1183
 
        obj_buffer = (object_buffer_p) object_heap_next( &driver_data->buffer_heap, &iter);
1184
 
    }
1185
 
    object_heap_destroy( &driver_data->buffer_heap );
1186
 
 
1187
 
    /* TODO cleanup */
1188
 
    object_heap_destroy( &driver_data->surface_heap );
1189
 
 
1190
 
    /* TODO cleanup */
1191
 
    object_heap_destroy( &driver_data->context_heap );
1192
 
 
1193
 
    /* Clean up configIDs */
1194
 
    obj_config = (object_config_p) object_heap_first( &driver_data->config_heap, &iter);
1195
 
    while (obj_config)
1196
 
    {
1197
 
        object_heap_free( &driver_data->config_heap, (object_base_p) obj_config);
1198
 
        obj_config = (object_config_p) object_heap_next( &driver_data->config_heap, &iter);
1199
 
    }
1200
 
    object_heap_destroy( &driver_data->config_heap );
1201
 
 
1202
 
    free(ctx->pDriverData);
1203
 
    ctx->pDriverData = NULL;
1204
 
 
1205
 
    return VA_STATUS_SUCCESS;
1206
 
}
1207
 
 
1208
 
VAStatus __vaDriverInit_0_29(  VADriverContextP ctx )
1209
 
{
1210
 
    object_base_p obj;
1211
 
    int result;
1212
 
    struct dummy_driver_data *driver_data;
1213
 
    int i;
1214
 
 
1215
 
    ctx->version_major = 0;
1216
 
    ctx->version_minor = 29;
1217
 
    ctx->max_profiles = DUMMY_MAX_PROFILES;
1218
 
    ctx->max_entrypoints = DUMMY_MAX_ENTRYPOINTS;
1219
 
    ctx->max_attributes = DUMMY_MAX_CONFIG_ATTRIBUTES;
1220
 
    ctx->max_image_formats = DUMMY_MAX_IMAGE_FORMATS;
1221
 
    ctx->max_subpic_formats = DUMMY_MAX_SUBPIC_FORMATS;
1222
 
    ctx->max_display_attributes = DUMMY_MAX_DISPLAY_ATTRIBUTES;
1223
 
    ctx->str_vendor = DUMMY_STR_VENDOR;
1224
 
 
1225
 
    ctx->vtable.vaTerminate = dummy_Terminate;
1226
 
    ctx->vtable.vaQueryConfigEntrypoints = dummy_QueryConfigEntrypoints;
1227
 
    ctx->vtable.vaQueryConfigProfiles = dummy_QueryConfigProfiles;
1228
 
    ctx->vtable.vaQueryConfigEntrypoints = dummy_QueryConfigEntrypoints;
1229
 
    ctx->vtable.vaQueryConfigAttributes = dummy_QueryConfigAttributes;
1230
 
    ctx->vtable.vaCreateConfig = dummy_CreateConfig;
1231
 
    ctx->vtable.vaDestroyConfig = dummy_DestroyConfig;
1232
 
    ctx->vtable.vaGetConfigAttributes = dummy_GetConfigAttributes;
1233
 
    ctx->vtable.vaCreateSurfaces = dummy_CreateSurfaces;
1234
 
    ctx->vtable.vaDestroySurfaces = dummy_DestroySurfaces;
1235
 
    ctx->vtable.vaCreateContext = dummy_CreateContext;
1236
 
    ctx->vtable.vaDestroyContext = dummy_DestroyContext;
1237
 
    ctx->vtable.vaCreateBuffer = dummy_CreateBuffer;
1238
 
    ctx->vtable.vaBufferSetNumElements = dummy_BufferSetNumElements;
1239
 
    ctx->vtable.vaMapBuffer = dummy_MapBuffer;
1240
 
    ctx->vtable.vaUnmapBuffer = dummy_UnmapBuffer;
1241
 
    ctx->vtable.vaDestroyBuffer = dummy_DestroyBuffer;
1242
 
    ctx->vtable.vaBeginPicture = dummy_BeginPicture;
1243
 
    ctx->vtable.vaRenderPicture = dummy_RenderPicture;
1244
 
    ctx->vtable.vaEndPicture = dummy_EndPicture;
1245
 
    ctx->vtable.vaSyncSurface = dummy_SyncSurface;
1246
 
    ctx->vtable.vaQuerySurfaceStatus = dummy_QuerySurfaceStatus;
1247
 
    ctx->vtable.vaPutSurface = dummy_PutSurface;
1248
 
    ctx->vtable.vaQueryImageFormats = dummy_QueryImageFormats;
1249
 
    ctx->vtable.vaCreateImage = dummy_CreateImage;
1250
 
    ctx->vtable.vaDeriveImage = dummy_DeriveImage;
1251
 
    ctx->vtable.vaDestroyImage = dummy_DestroyImage;
1252
 
    ctx->vtable.vaSetImagePalette = dummy_SetImagePalette;
1253
 
    ctx->vtable.vaGetImage = dummy_GetImage;
1254
 
    ctx->vtable.vaPutImage = dummy_PutImage;
1255
 
    ctx->vtable.vaPutImage2 = dummy_PutImage2;
1256
 
    ctx->vtable.vaQuerySubpictureFormats = dummy_QuerySubpictureFormats;
1257
 
    ctx->vtable.vaCreateSubpicture = dummy_CreateSubpicture;
1258
 
    ctx->vtable.vaDestroySubpicture = dummy_DestroySubpicture;
1259
 
    ctx->vtable.vaSetSubpictureImage = dummy_SetSubpictureImage;
1260
 
    ctx->vtable.vaSetSubpictureChromakey = dummy_SetSubpictureChromakey;
1261
 
    ctx->vtable.vaSetSubpictureGlobalAlpha = dummy_SetSubpictureGlobalAlpha;
1262
 
    ctx->vtable.vaAssociateSubpicture = dummy_AssociateSubpicture;
1263
 
    ctx->vtable.vaAssociateSubpicture2 = dummy_AssociateSubpicture2;
1264
 
    ctx->vtable.vaDeassociateSubpicture = dummy_DeassociateSubpicture;
1265
 
    ctx->vtable.vaQueryDisplayAttributes = dummy_QueryDisplayAttributes;
1266
 
    ctx->vtable.vaGetDisplayAttributes = dummy_GetDisplayAttributes;
1267
 
    ctx->vtable.vaSetDisplayAttributes = dummy_SetDisplayAttributes;
1268
 
    
1269
 
    ctx->vtable.vaDbgCopySurfaceToBuffer = dummy_DbgCopySurfaceToBuffer;
1270
 
 
1271
 
    driver_data = (struct dummy_driver_data *) malloc( sizeof(*driver_data) );
1272
 
    ctx->pDriverData = (void *) driver_data;
1273
 
 
1274
 
    result = object_heap_init( &driver_data->config_heap, sizeof(struct object_config), CONFIG_ID_OFFSET );
1275
 
    ASSERT( result == 0 );
1276
 
 
1277
 
    result = object_heap_init( &driver_data->context_heap, sizeof(struct object_context), CONTEXT_ID_OFFSET );
1278
 
    ASSERT( result == 0 );
1279
 
 
1280
 
    result = object_heap_init( &driver_data->surface_heap, sizeof(struct object_surface), SURFACE_ID_OFFSET );
1281
 
    ASSERT( result == 0 );
1282
 
 
1283
 
    result = object_heap_init( &driver_data->buffer_heap, sizeof(struct object_buffer), BUFFER_ID_OFFSET );
1284
 
    ASSERT( result == 0 );
1285
 
 
1286
 
 
1287
 
    return VA_STATUS_SUCCESS;
1288
 
}
1289