2 * Copyright (c) 2007 Intel Corporation. All Rights Reserved.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sub license, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
12 * The above copyright notice and this permission notice (including the
13 * next paragraph) shall be included in all copies or substantial portions
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
19 * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
20 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 * Video Decode Acceleration -Backend API
29 #ifndef _VA_BACKEND_H_
30 #define _VA_BACKEND_H_
36 #include <linux/videodev2.h>
38 typedef struct VADriverContext *VADriverContextP;
39 typedef struct VADisplayContext *VADisplayContextP;
47 VAStatus (*vaTerminate) ( VADriverContextP ctx );
49 VAStatus (*vaQueryConfigProfiles) (
51 VAProfile *profile_list, /* out */
52 int *num_profiles /* out */
55 VAStatus (*vaQueryConfigEntrypoints) (
58 VAEntrypoint *entrypoint_list, /* out */
59 int *num_entrypoints /* out */
62 VAStatus (*vaGetConfigAttributes) (
65 VAEntrypoint entrypoint,
66 VAConfigAttrib *attrib_list, /* in/out */
70 VAStatus (*vaCreateConfig) (
73 VAEntrypoint entrypoint,
74 VAConfigAttrib *attrib_list,
76 VAConfigID *config_id /* out */
79 VAStatus (*vaDestroyConfig) (
84 VAStatus (*vaQueryConfigAttributes) (
87 VAProfile *profile, /* out */
88 VAEntrypoint *entrypoint, /* out */
89 VAConfigAttrib *attrib_list, /* out */
90 int *num_attribs /* out */
93 VAStatus (*vaCreateSurfaces) (
99 VASurfaceID *surfaces /* out */
102 VAStatus (*vaDestroySurfaces) (
103 VADriverContextP ctx,
104 VASurfaceID *surface_list,
108 VAStatus (*vaCreateContext) (
109 VADriverContextP ctx,
110 VAConfigID config_id,
114 VASurfaceID *render_targets,
115 int num_render_targets,
116 VAContextID *context /* out */
119 VAStatus (*vaDestroyContext) (
120 VADriverContextP ctx,
124 VAStatus (*vaCreateBuffer) (
125 VADriverContextP ctx,
126 VAContextID context, /* in */
127 VABufferType type, /* in */
128 unsigned int size, /* in */
129 unsigned int num_elements, /* in */
131 VABufferID *buf_id /* out */
134 VAStatus (*vaBufferSetNumElements) (
135 VADriverContextP ctx,
136 VABufferID buf_id, /* in */
137 unsigned int num_elements /* in */
140 VAStatus (*vaMapBuffer) (
141 VADriverContextP ctx,
142 VABufferID buf_id, /* in */
143 void **pbuf /* out */
146 VAStatus (*vaUnmapBuffer) (
147 VADriverContextP ctx,
148 VABufferID buf_id /* in */
151 VAStatus (*vaDestroyBuffer) (
152 VADriverContextP ctx,
156 VAStatus (*vaBeginPicture) (
157 VADriverContextP ctx,
159 VASurfaceID render_target
162 VAStatus (*vaRenderPicture) (
163 VADriverContextP ctx,
169 VAStatus (*vaEndPicture) (
170 VADriverContextP ctx,
174 VAStatus (*vaSyncSurface) (
175 VADriverContextP ctx,
176 VASurfaceID render_target
179 VAStatus (*vaQuerySurfaceStatus) (
180 VADriverContextP ctx,
181 VASurfaceID render_target,
182 VASurfaceStatus *status /* out */
185 VAStatus (*vaPutSurface) (
186 VADriverContextP ctx,
188 Surface* draw, /* Drawable of window system */
195 unsigned short destw,
196 unsigned short desth,
197 VARectangle *cliprects, /* client supplied clip list */
198 unsigned int number_cliprects, /* number of clip rects in the clip list */
199 unsigned int flags /* de-interlacing flags */
202 VAStatus (*vaQueryImageFormats) (
203 VADriverContextP ctx,
204 VAImageFormat *format_list, /* out */
205 int *num_formats /* out */
208 VAStatus (*vaCreateImage) (
209 VADriverContextP ctx,
210 VAImageFormat *format,
213 VAImage *image /* out */
216 VAStatus (*vaDeriveImage) (
217 VADriverContextP ctx,
219 VAImage *image /* out */
222 VAStatus (*vaDestroyImage) (
223 VADriverContextP ctx,
227 VAStatus (*vaSetImagePalette) (
228 VADriverContextP ctx,
231 * pointer to an array holding the palette data. The size of the array is
232 * num_palette_entries * entry_bytes in size. The order of the components
233 * in the palette is described by the component_order in VAImage struct
235 unsigned char *palette
238 VAStatus (*vaGetImage) (
239 VADriverContextP ctx,
241 int x, /* coordinates of the upper left source pixel */
243 unsigned int width, /* width and height of the region */
248 VAStatus (*vaPutImage) (
249 VADriverContextP ctx,
254 unsigned int src_width,
255 unsigned int src_height,
258 unsigned int dest_width,
259 unsigned int dest_height
262 VAStatus (*vaQuerySubpictureFormats) (
263 VADriverContextP ctx,
264 VAImageFormat *format_list, /* out */
265 unsigned int *flags, /* out */
266 unsigned int *num_formats /* out */
269 VAStatus (*vaCreateSubpicture) (
270 VADriverContextP ctx,
272 VASubpictureID *subpicture /* out */
275 VAStatus (*vaDestroySubpicture) (
276 VADriverContextP ctx,
277 VASubpictureID subpicture
280 VAStatus (*vaSetSubpictureImage) (
281 VADriverContextP ctx,
282 VASubpictureID subpicture,
286 VAStatus (*vaSetSubpictureChromakey) (
287 VADriverContextP ctx,
288 VASubpictureID subpicture,
289 unsigned int chromakey_min,
290 unsigned int chromakey_max,
291 unsigned int chromakey_mask
294 VAStatus (*vaSetSubpictureGlobalAlpha) (
295 VADriverContextP ctx,
296 VASubpictureID subpicture,
300 VAStatus (*vaAssociateSubpicture) (
301 VADriverContextP ctx,
302 VASubpictureID subpicture,
303 VASurfaceID *target_surfaces,
305 short src_x, /* upper left offset in subpicture */
307 unsigned short src_width,
308 unsigned short src_height,
309 short dest_x, /* upper left offset in surface */
311 unsigned short dest_width,
312 unsigned short dest_height,
314 * whether to enable chroma-keying or global-alpha
315 * see VA_SUBPICTURE_XXX values
320 VAStatus (*vaDeassociateSubpicture) (
321 VADriverContextP ctx,
322 VASubpictureID subpicture,
323 VASurfaceID *target_surfaces,
327 VAStatus (*vaQueryDisplayAttributes) (
328 VADriverContextP ctx,
329 VADisplayAttribute *attr_list, /* out */
330 int *num_attributes /* out */
333 VAStatus (*vaGetDisplayAttributes) (
334 VADriverContextP ctx,
335 VADisplayAttribute *attr_list, /* in/out */
339 VAStatus (*vaSetDisplayAttributes) (
340 VADriverContextP ctx,
341 VADisplayAttribute *attr_list,
345 /* device specific */
346 VAStatus (*vaCreateSurfaceFromCIFrame) (
347 VADriverContextP ctx,
348 unsigned long frame_id,
349 VASurfaceID *surface /* out */
353 VAStatus (*vaCreateSurfaceFromV4L2Buf) (
354 VADriverContextP ctx,
355 int v4l2_fd, /* file descriptor of V4L2 device */
356 struct v4l2_format *v4l2_fmt, /* format of V4L2 */
357 struct v4l2_buffer *v4l2_buf, /* V4L2 buffer */
358 VASurfaceID *surface /* out */
361 VAStatus (*vaBufferInfo) (
362 VADriverContextP ctx,
363 VAContextID context, /* in */
364 VABufferID buf_id, /* in */
365 VABufferType *type, /* out */
366 unsigned int *size, /* out */
367 unsigned int *num_elements /* out */
371 VAStatus (*vaCopySurfaceToBuffer) (
372 VADriverContextP ctx,
374 unsigned int *fourcc, /* out for follow argument */
375 unsigned int *luma_stride,
376 unsigned int *chroma_u_stride,
377 unsigned int *chroma_v_stride,
378 unsigned int *luma_offset,
379 unsigned int *chroma_u_offset,
380 unsigned int *chroma_v_offset,
385 struct VADriverContext
388 struct VADriverVTable vtable;
397 int max_image_formats;
398 int max_subpic_formats;
399 int max_display_attributes;
400 const char *str_vendor;
402 void *handle; /* dlopen handle */
407 #define VA_DISPLAY_MAGIC 0x56414430 /* VAD0 */
408 struct VADisplayContext
412 VADisplayContextP pNext;
413 VADriverContextP pDriverContext;
416 VADisplayContextP ctx
420 VADisplayContextP ctx
423 VAStatus (*vaGetDriverName) (
424 VADisplayContextP ctx,
429 typedef VAStatus (*VADriverInit) (
430 VADriverContextP driver_context
434 #endif /* _VA_BACKEND_H_ */