OSDN Git Service

decode: release huffman_table from decode state
[android-x86/hardware-intel-common-vaapi.git] / src / i965_drv_video.h
1 /*
2  * Copyright ?2009 Intel Corporation
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  * Authors:
25  *    Xiang Haihao <haihao.xiang@intel.com>
26  *    Zou Nan hai <nanhai.zou@intel.com>
27  *
28  */
29
30 #ifndef _I965_DRV_VIDEO_H_
31 #define _I965_DRV_VIDEO_H_
32
33 #include <va/va.h>
34 #include <va/va_enc_h264.h>
35 #include <va/va_enc_mpeg2.h>
36 #include <va/va_enc_hevc.h>
37 #include <va/va_enc_jpeg.h>
38 #include <va/va_enc_vp8.h>
39 #include <va/va_vpp.h>
40 #include <va/va_backend.h>
41 #include <va/va_backend_vpp.h>
42
43 #include "i965_mutext.h"
44 #include "object_heap.h"
45 #include "intel_driver.h"
46 #include "i965_fourcc.h"
47
48 #define I965_MAX_PROFILES                       20
49 #define I965_MAX_ENTRYPOINTS                    5
50 #define I965_MAX_CONFIG_ATTRIBUTES              32
51 #define I965_MAX_IMAGE_FORMATS                  10
52 #define I965_MAX_SUBPIC_FORMATS                 6
53 #define I965_MAX_SUBPIC_SUM                     4
54 #define I965_MAX_SURFACE_ATTRIBUTES             16
55
56 #define INTEL_STR_DRIVER_VENDOR                 "Intel"
57 #define INTEL_STR_DRIVER_NAME                   "i965"
58
59 #define I965_SURFACE_TYPE_IMAGE                 0
60 #define I965_SURFACE_TYPE_SURFACE               1
61
62 #define I965_SURFACE_FLAG_FRAME                 0x00000000
63 #define I965_SURFACE_FLAG_TOP_FIELD_FIRST       0x00000001
64 #define I965_SURFACE_FLAG_BOTTOME_FIELD_FIRST   0x00000002
65
66 #define DEFAULT_BRIGHTNESS      0
67 #define DEFAULT_CONTRAST        50
68 #define DEFAULT_HUE             0
69 #define DEFAULT_SATURATION      50
70
71 #define ENCODER_QUALITY_RANGE     2
72 #define ENCODER_QUALITY_RANGE_AVC     8
73 #define ENCODER_QUALITY_RANGE_HEVC    8
74 #define ENCODER_DEFAULT_QUALITY   1
75 #define ENCODER_DEFAULT_QUALITY_AVC   4
76 #define ENCODER_DEFAULT_QUALITY_HEVC  4
77 #define ENCODER_HIGH_QUALITY      ENCODER_DEFAULT_QUALITY
78 #define ENCODER_LOW_QUALITY       2
79
80 #define I965_MAX_NUM_ROI_REGIONS                     8
81 #define I965_MAX_NUM_SLICE                           32
82
83 #define ENCODER_LP_QUALITY_RANGE  8
84
85 #define HAS_MPEG2_DECODING(ctx)  ((ctx)->codec_info->has_mpeg2_decoding && \
86                                   (ctx)->intel.has_bsd)
87
88 #define HAS_MPEG2_ENCODING(ctx)  ((ctx)->codec_info->has_mpeg2_encoding && \
89                                   (ctx)->intel.has_bsd)
90
91 #define HAS_H264_DECODING(ctx)  ((ctx)->codec_info->has_h264_decoding && \
92                                  (ctx)->intel.has_bsd)
93
94 #define HAS_H264_ENCODING(ctx)  ((ctx)->codec_info->has_h264_encoding && \
95                                  (ctx)->intel.has_bsd)
96
97 #define HAS_LP_H264_ENCODING(ctx)  ((ctx)->codec_info->has_lp_h264_encoding && \
98                                     (ctx)->intel.has_bsd)
99
100 #define HAS_VC1_DECODING(ctx)   ((ctx)->codec_info->has_vc1_decoding && \
101                                  (ctx)->intel.has_bsd)
102
103 #define HAS_JPEG_DECODING(ctx)  ((ctx)->codec_info->has_jpeg_decoding && \
104                                  (ctx)->intel.has_bsd)
105
106 #define HAS_JPEG_ENCODING(ctx)  ((ctx)->codec_info->has_jpeg_encoding && \
107                                  (ctx)->intel.has_bsd)
108
109 #define HAS_VPP(ctx)    ((ctx)->codec_info->has_vpp)
110
111 #define HAS_ACCELERATED_GETIMAGE(ctx)   ((ctx)->codec_info->has_accelerated_getimage)
112
113 #define HAS_ACCELERATED_PUTIMAGE(ctx)   ((ctx)->codec_info->has_accelerated_putimage)
114
115 #define HAS_TILED_SURFACE(ctx) ((ctx)->codec_info->has_tiled_surface)
116
117 #define HAS_VP8_DECODING(ctx)   ((ctx)->codec_info->has_vp8_decoding && \
118                                  (ctx)->intel.has_bsd)
119
120 #define HAS_VP8_ENCODING(ctx)   ((ctx)->codec_info->has_vp8_encoding && \
121                                  (ctx)->intel.has_bsd)
122
123 #define HAS_H264_MVC_DECODING(ctx) \
124     (HAS_H264_DECODING(ctx) && (ctx)->codec_info->h264_mvc_dec_profiles)
125
126 #define HAS_H264_MVC_DECODING_PROFILE(ctx, profile)                     \
127     (HAS_H264_MVC_DECODING(ctx) &&                                      \
128      ((ctx)->codec_info->h264_mvc_dec_profiles & (1U << profile)))
129
130 #define HAS_H264_MVC_ENCODING(ctx)  ((ctx)->codec_info->has_h264_mvc_encoding && \
131                                      (ctx)->intel.has_bsd)
132
133 #define HAS_HEVC_DECODING(ctx)          ((ctx)->codec_info->has_hevc_decoding && \
134                                          (ctx)->intel.has_bsd)
135
136 #define HAS_HEVC_ENCODING(ctx)          ((ctx)->codec_info->has_hevc_encoding && \
137                                          (ctx)->intel.has_bsd)
138
139 #define HAS_VP9_DECODING(ctx)          ((ctx)->codec_info->has_vp9_decoding && \
140                                          (ctx)->intel.has_bsd)
141
142 #define HAS_VP9_DECODING_PROFILE(ctx, profile)                     \
143     (HAS_VP9_DECODING(ctx) &&                                      \
144      ((ctx)->codec_info->vp9_dec_profiles & (1U << (profile - VAProfileVP9Profile0))))
145
146 #define HAS_HEVC10_DECODING(ctx)        ((ctx)->codec_info->has_hevc10_decoding && \
147                                          (ctx)->intel.has_bsd)
148 #define HAS_HEVC10_ENCODING(ctx)        ((ctx)->codec_info->has_hevc10_encoding && \
149                                          (ctx)->intel.has_bsd)
150
151 #define HAS_VPP_P010(ctx)        ((ctx)->codec_info->has_vpp_p010 && \
152                                          (ctx)->intel.has_bsd)
153
154 #define HAS_VP9_ENCODING(ctx)          ((ctx)->codec_info->has_vp9_encoding && \
155                                          (ctx)->intel.has_bsd)
156
157 #define HAS_VP9_ENCODING_PROFILE(ctx, profile)                     \
158     (HAS_VP9_ENCODING(ctx) &&                                      \
159      ((ctx)->codec_info->vp9_enc_profiles & (1U << (profile - VAProfileVP9Profile0))))
160
161 struct i965_surface {
162     struct object_base *base;
163     int type;
164     int flags;
165 };
166
167 struct i965_kernel {
168     char *name;
169     int interface;
170     const uint32_t (*bin)[4];
171     int size;
172     dri_bo *bo;
173     unsigned int kernel_offset;
174 };
175
176 struct buffer_store {
177     unsigned char *buffer;
178     dri_bo *bo;
179     int ref_count;
180     int num_elements;
181 };
182
183 struct object_config {
184     struct object_base base;
185     VAProfile profile;
186     VAEntrypoint entrypoint;
187     VAConfigAttrib attrib_list[I965_MAX_CONFIG_ATTRIBUTES];
188     int num_attribs;
189
190     VAGenericID wrapper_config;
191 };
192
193 #define NUM_SLICES     10
194
195 struct codec_state_base {
196     uint32_t chroma_formats;
197 };
198
199 struct decode_state {
200     struct codec_state_base base;
201     struct buffer_store *pic_param;
202     struct buffer_store **slice_params;
203     struct buffer_store *iq_matrix;
204     struct buffer_store *bit_plane;
205     struct buffer_store *huffman_table;
206     struct buffer_store **slice_datas;
207     struct buffer_store *probability_data;
208     VASurfaceID current_render_target;
209     int max_slice_params;
210     int max_slice_datas;
211     int num_slice_params;
212     int num_slice_datas;
213
214     struct object_surface *render_object;
215     struct object_surface *reference_objects[16]; /* Up to 2 reference surfaces are valid for MPEG-2,*/
216 };
217
218 #define SLICE_PACKED_DATA_INDEX_TYPE    0x80000000
219 #define SLICE_PACKED_DATA_INDEX_MASK    0x00FFFFFF
220
221 struct encode_state {
222     struct codec_state_base base;
223     struct buffer_store *iq_matrix;
224     struct buffer_store *q_matrix;
225     struct buffer_store *huffman_table;
226
227     /* for ext */
228     struct buffer_store *seq_param_ext;
229     struct buffer_store *pic_param_ext;
230     struct buffer_store *packed_header_param[5];
231     struct buffer_store *packed_header_data[5];
232     struct buffer_store **slice_params_ext;
233     struct buffer_store *encmb_map;
234     int max_slice_params_ext;
235     int num_slice_params_ext;
236
237     /* Check the user-configurable packed_header attribute.
238      * Currently it is mainly used to check whether the packed slice_header data
239      * is provided by user or the driver.
240      * TBD: It will check for the packed SPS/PPS/MISC/RAWDATA and so on.
241      */
242     unsigned int packed_header_flag;
243     /* For the packed data that needs to be inserted into video clip */
244     /* currently it is mainly to track packed raw data and packed slice_header data. */
245     struct buffer_store **packed_header_params_ext;
246     int max_packed_header_params_ext;
247     int num_packed_header_params_ext;
248     struct buffer_store **packed_header_data_ext;
249     int max_packed_header_data_ext;
250     int num_packed_header_data_ext;
251
252     /* the index of current vps and sps ,special for HEVC*/
253     int vps_sps_seq_index;
254     /* the index of current slice */
255     int slice_index;
256     /* the array is determined by max_slice_params_ext */
257     int max_slice_num;
258     /* This is to store the first index of packed data for one slice */
259     int *slice_rawdata_index;
260     /* This is to store the number of packed data for one slice.
261      * Both packed rawdata and slice_header data are tracked by this
262      * variable. That is to say: When one packed slice_header is parsed,
263      * this variable will also be increased.
264      */
265     int *slice_rawdata_count;
266
267     /* This is to store the index of packed slice header for one slice */
268     int *slice_header_index;
269
270     int last_packed_header_type;
271
272     int has_layers;
273
274     struct buffer_store *misc_param[16][8];
275
276     VASurfaceID current_render_target;
277     struct object_surface *input_yuv_object;
278     struct object_surface *reconstructed_object;
279     struct object_buffer *coded_buf_object;
280     struct object_surface *reference_objects[16]; /* Up to 2 reference surfaces are valid for MPEG-2,*/
281 };
282
283 struct proc_state {
284     struct codec_state_base base;
285     struct buffer_store *pipeline_param;
286
287     VASurfaceID current_render_target;
288 };
289
290 #define CODEC_DEC       0
291 #define CODEC_ENC       1
292 #define CODEC_PROC      2
293
294 union codec_state {
295     struct codec_state_base base;
296     struct decode_state decode;
297     struct encode_state encode;
298     struct proc_state proc;
299 };
300
301 struct hw_context {
302     VAStatus(*run)(VADriverContextP ctx,
303                    VAProfile profile,
304                    union codec_state *codec_state,
305                    struct hw_context *hw_context);
306     void (*destroy)(void *);
307     VAStatus(*get_status)(VADriverContextP ctx,
308                           struct hw_context *hw_context,
309                           void *buffer);
310     struct intel_batchbuffer *batch;
311 };
312
313 struct object_context {
314     struct object_base base;
315     VAContextID context_id;
316     struct object_config *obj_config;
317     VASurfaceID *render_targets;        //input->encode, output->decode
318     int num_render_targets;
319     int picture_width;
320     int picture_height;
321     int flags;
322     int codec_type;
323     union codec_state codec_state;
324     struct hw_context *hw_context;
325
326     VAGenericID       wrapper_context;
327 };
328
329 #define SURFACE_REFERENCED      (1 << 0)
330 #define SURFACE_DERIVED         (1 << 2)
331 #define SURFACE_ALL_MASK        ((SURFACE_REFERENCED) | \
332                                  (SURFACE_DERIVED))
333
334 struct object_surface {
335     struct object_base base;
336     VASurfaceStatus status;
337     VASubpictureID subpic[I965_MAX_SUBPIC_SUM];
338     struct object_subpic *obj_subpic[I965_MAX_SUBPIC_SUM];
339     unsigned int subpic_render_idx;
340
341     int width;          /* the pitch of plane 0 in bytes in horizontal direction */
342     int height;         /* the pitch of plane 0 in bytes in vertical direction */
343     int size;
344     int orig_width;     /* the width of plane 0 in pixels */
345     int orig_height;    /* the height of plane 0 in pixels */
346     int flags;
347     unsigned int fourcc;
348     dri_bo *bo;
349     unsigned int expected_format;
350     VAImageID locked_image_id;
351     VAImageID derived_image_id;
352     void (*free_private_data)(void **data);
353     void *private_data;
354     unsigned int subsampling;
355     int x_cb_offset;
356     int y_cb_offset;
357     int x_cr_offset;
358     int y_cr_offset;
359     int cb_cr_width;
360     int cb_cr_height;
361     int cb_cr_pitch;
362     /* user specified attributes see: VASurfaceAttribExternalBuffers/VA_SURFACE_ATTRIB_MEM_TYPE_VA */
363     uint32_t user_disable_tiling : 1;
364     uint32_t user_h_stride_set   : 1;
365     uint32_t user_v_stride_set   : 1;
366     /* we need clear right and bottom border for NV12.
367      * to avoid encode run to run issue*/
368     uint32_t border_cleared      : 1;
369
370     VAGenericID wrapper_surface;
371
372     int exported_primefd;
373 };
374
375 struct object_buffer {
376     struct object_base base;
377     struct buffer_store *buffer_store;
378     int max_num_elements;
379     int num_elements;
380     int size_element;
381     VABufferType type;
382
383     /* Export state */
384     unsigned int export_refcount;
385     VABufferInfo export_state;
386
387     VAGenericID wrapper_buffer;
388     VAContextID context_id;
389 };
390
391 struct object_image {
392     struct object_base base;
393     VAImage image;
394     dri_bo *bo;
395     unsigned int *palette;
396     VASurfaceID derived_surface;
397 };
398
399 struct object_subpic {
400     struct object_base base;
401     VAImageID image;
402     struct object_image *obj_image;
403     VARectangle src_rect;
404     VARectangle dst_rect;
405     unsigned int format;
406     int width;
407     int height;
408     int pitch;
409     float global_alpha;
410     dri_bo *bo;
411     unsigned int flags;
412 };
413
414 #define I965_RING_NULL  0
415 #define I965_RING_BSD   1
416 #define I965_RING_BLT   2
417 #define I965_RING_VEBOX 3
418
419 struct i965_filter {
420     VAProcFilterType type;
421     int ring;
422 };
423
424 struct i965_driver_data;
425
426 struct hw_codec_info {
427     struct hw_context *(*dec_hw_context_init)(VADriverContextP, struct object_config *);
428     struct hw_context *(*enc_hw_context_init)(VADriverContextP, struct object_config *);
429     struct hw_context *(*proc_hw_context_init)(VADriverContextP, struct object_config *);
430     bool (*render_init)(VADriverContextP);
431     void (*post_processing_context_init)(VADriverContextP, void *, struct intel_batchbuffer *);
432     void (*preinit_hw_codec)(VADriverContextP, struct hw_codec_info *);
433
434     /**
435      * Allows HW info to support per-codec max resolution.  If this functor is
436      * not initialized, then @max_width and @max_height will be used as the
437      * default maximum resolution for all codecs on this HW info.
438      */
439     void (*max_resolution)(struct i965_driver_data *, struct object_config *, int *, int *);
440
441     int max_width;
442     int max_height;
443     int min_linear_wpitch;
444     int min_linear_hpitch;
445
446     unsigned int h264_mvc_dec_profiles;
447     unsigned int vp9_dec_profiles;
448     unsigned int vp9_enc_profiles;
449
450     unsigned int h264_dec_chroma_formats;
451     unsigned int jpeg_dec_chroma_formats;
452     unsigned int jpeg_enc_chroma_formats;
453     unsigned int hevc_dec_chroma_formats;
454     unsigned int vp9_dec_chroma_formats;
455
456     unsigned int has_mpeg2_decoding: 1;
457     unsigned int has_mpeg2_encoding: 1;
458     unsigned int has_h264_decoding: 1;
459     unsigned int has_h264_encoding: 1;
460     unsigned int has_vc1_decoding: 1;
461     unsigned int has_vc1_encoding: 1;
462     unsigned int has_jpeg_decoding: 1;
463     unsigned int has_jpeg_encoding: 1;
464     unsigned int has_vpp: 1;
465     unsigned int has_accelerated_getimage: 1;
466     unsigned int has_accelerated_putimage: 1;
467     unsigned int has_tiled_surface: 1;
468     unsigned int has_di_motion_adptive: 1;
469     unsigned int has_di_motion_compensated: 1;
470     unsigned int has_vp8_decoding: 1;
471     unsigned int has_vp8_encoding: 1;
472     unsigned int has_h264_mvc_encoding: 1;
473     unsigned int has_hevc_decoding: 1;
474     unsigned int has_hevc_encoding: 1;
475     unsigned int has_hevc10_encoding: 1;
476     unsigned int has_hevc10_decoding: 1;
477     unsigned int has_vp9_decoding: 1;
478     unsigned int has_vpp_p010: 1;
479     unsigned int has_lp_h264_encoding: 1;
480     unsigned int has_vp9_encoding: 1;
481
482     unsigned int lp_h264_brc_mode;
483
484     unsigned int num_filters;
485     struct i965_filter filters[VAProcFilterCount];
486 };
487
488
489 #include "i965_render.h"
490 #include "i965_gpe_utils.h"
491
492 struct i965_driver_data {
493     struct intel_driver_data intel;
494     struct object_heap config_heap;
495     struct object_heap context_heap;
496     struct object_heap surface_heap;
497     struct object_heap buffer_heap;
498     struct object_heap image_heap;
499     struct object_heap subpic_heap;
500     struct hw_codec_info *codec_info;
501
502     _I965Mutex render_mutex;
503     _I965Mutex pp_mutex;
504     struct intel_batchbuffer *batch;
505     struct intel_batchbuffer *pp_batch;
506     struct i965_render_state render_state;
507     void *pp_context;
508     char va_vendor[256];
509
510     VADisplayAttribute *display_attributes;
511     unsigned int num_display_attributes;
512     VADisplayAttribute *rotation_attrib;
513     VADisplayAttribute *brightness_attrib;
514     VADisplayAttribute *contrast_attrib;
515     VADisplayAttribute *hue_attrib;
516     VADisplayAttribute *saturation_attrib;
517     VAContextID current_context_id;
518
519     /* VA/DRI (X11) specific data */
520     struct va_dri_output *dri_output;
521
522     /* VA/Wayland specific data */
523     struct va_wl_output *wl_output;
524
525     VADriverContextP wrapper_pdrvctx;
526
527     struct i965_gpe_table gpe_table;
528 };
529
530 #define NEW_CONFIG_ID() object_heap_allocate(&i965->config_heap);
531 #define NEW_CONTEXT_ID() object_heap_allocate(&i965->context_heap);
532 #define NEW_SURFACE_ID() object_heap_allocate(&i965->surface_heap);
533 #define NEW_BUFFER_ID() object_heap_allocate(&i965->buffer_heap);
534 #define NEW_IMAGE_ID() object_heap_allocate(&i965->image_heap);
535 #define NEW_SUBPIC_ID() object_heap_allocate(&i965->subpic_heap);
536
537 #define CONFIG(id) ((struct object_config *)object_heap_lookup(&i965->config_heap, id))
538 #define CONTEXT(id) ((struct object_context *)object_heap_lookup(&i965->context_heap, id))
539 #define SURFACE(id) ((struct object_surface *)object_heap_lookup(&i965->surface_heap, id))
540 #define BUFFER(id) ((struct object_buffer *)object_heap_lookup(&i965->buffer_heap, id))
541 #define IMAGE(id) ((struct object_image *)object_heap_lookup(&i965->image_heap, id))
542 #define SUBPIC(id) ((struct object_subpic *)object_heap_lookup(&i965->subpic_heap, id))
543
544 #define FOURCC_IA44 0x34344149
545 #define FOURCC_AI44 0x34344941
546
547 #define STRIDE(w)               (((w) + 0xf) & ~0xf)
548 #define SIZE_YUV420(w, h)       (h * (STRIDE(w) + STRIDE(w >> 1)))
549
550 static INLINE struct i965_driver_data *
551 i965_driver_data(VADriverContextP ctx)
552 {
553     return (struct i965_driver_data *)(ctx->pDriverData);
554 }
555
556 VAStatus
557 i965_check_alloc_surface_bo(VADriverContextP ctx,
558                             struct object_surface *obj_surface,
559                             int tiled,
560                             unsigned int fourcc,
561                             unsigned int subsampling);
562
563 int
564 va_enc_packed_type_to_idx(int packed_type);
565
566 /* reserve 2 byte for internal using */
567 #define CODEC_H264      0
568 #define CODEC_MPEG2     1
569 #define CODEC_H264_MVC  2
570 #define CODEC_JPEG      3
571 #define CODEC_VP8       4
572 #define CODEC_HEVC      5
573 #define CODEC_VP9       6
574
575 #define H264_DELIMITER0 0x00
576 #define H264_DELIMITER1 0x00
577 #define H264_DELIMITER2 0x00
578 #define H264_DELIMITER3 0x00
579 #define H264_DELIMITER4 0x00
580
581 #define MPEG2_DELIMITER0        0x00
582 #define MPEG2_DELIMITER1        0x00
583 #define MPEG2_DELIMITER2        0x00
584 #define MPEG2_DELIMITER3        0x00
585 #define MPEG2_DELIMITER4        0xb0
586
587 #define HEVC_DELIMITER0 0x00
588 #define HEVC_DELIMITER1 0x00
589 #define HEVC_DELIMITER2 0x00
590 #define HEVC_DELIMITER3 0x00
591 #define HEVC_DELIMITER4 0x00
592
593 struct i965_coded_buffer_segment {
594     union {
595         VACodedBufferSegment base;
596         unsigned char pad0[64];                 /* change the size if sizeof(VACodedBufferSegment) > 64 */
597     };
598
599     unsigned int mapped;
600     unsigned int codec;
601     unsigned int status_support;
602     unsigned int pad1;
603
604     unsigned int codec_private_data[512];       /* Store codec private data, must be 16-bytes aligned */
605 };
606
607 #define I965_CODEDBUFFER_HEADER_SIZE   ALIGN(sizeof(struct i965_coded_buffer_segment), 0x1000)
608
609 extern VAStatus i965_MapBuffer(VADriverContextP ctx,
610                                VABufferID buf_id,       /* in */
611                                void **pbuf);            /* out */
612
613 extern VAStatus i965_UnmapBuffer(VADriverContextP ctx, VABufferID buf_id);
614
615 extern VAStatus i965_DestroySurfaces(VADriverContextP ctx,
616                                      VASurfaceID *surface_list,
617                                      int num_surfaces);
618
619 extern VAStatus i965_CreateSurfaces(VADriverContextP ctx,
620                                     int width,
621                                     int height,
622                                     int format,
623                                     int num_surfaces,
624                                     VASurfaceID *surfaces);
625
626 #define I965_SURFACE_MEM_NATIVE             0
627 #define I965_SURFACE_MEM_GEM_FLINK          1
628 #define I965_SURFACE_MEM_DRM_PRIME          2
629
630 void
631 i965_destroy_surface_storage(struct object_surface *obj_surface);
632
633 #endif /* _I965_DRV_VIDEO_H_ */