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;
43 VAStatus (*vaTerminate) ( VADriverContextP ctx );
45 VAStatus (*vaQueryConfigProfiles) (
47 VAProfile *profile_list, /* out */
48 int *num_profiles /* out */
51 VAStatus (*vaQueryConfigEntrypoints) (
54 VAEntrypoint *entrypoint_list, /* out */
55 int *num_entrypoints /* out */
58 VAStatus (*vaGetConfigAttributes) (
61 VAEntrypoint entrypoint,
62 VAConfigAttrib *attrib_list, /* in/out */
66 VAStatus (*vaCreateConfig) (
69 VAEntrypoint entrypoint,
70 VAConfigAttrib *attrib_list,
72 VAConfigID *config_id /* out */
75 VAStatus (*vaDestroyConfig) (
80 VAStatus (*vaQueryConfigAttributes) (
83 VAProfile *profile, /* out */
84 VAEntrypoint *entrypoint, /* out */
85 VAConfigAttrib *attrib_list, /* out */
86 int *num_attribs /* out */
89 VAStatus (*vaCreateSurfaces) (
95 VASurfaceID *surfaces /* out */
98 VAStatus (*vaDestroySurfaces) (
100 VASurfaceID *surface_list,
104 VAStatus (*vaCreateContext) (
105 VADriverContextP ctx,
106 VAConfigID config_id,
110 VASurfaceID *render_targets,
111 int num_render_targets,
112 VAContextID *context /* out */
115 VAStatus (*vaDestroyContext) (
116 VADriverContextP ctx,
120 VAStatus (*vaCreateBuffer) (
121 VADriverContextP ctx,
122 VAContextID context, /* in */
123 VABufferType type, /* in */
124 unsigned int size, /* in */
125 unsigned int num_elements, /* in */
127 VABufferID *buf_id /* out */
130 VAStatus (*vaBufferSetNumElements) (
131 VADriverContextP ctx,
132 VABufferID buf_id, /* in */
133 unsigned int num_elements /* in */
136 VAStatus (*vaMapBuffer) (
137 VADriverContextP ctx,
138 VABufferID buf_id, /* in */
139 void **pbuf /* out */
142 VAStatus (*vaUnmapBuffer) (
143 VADriverContextP ctx,
144 VABufferID buf_id /* in */
147 VAStatus (*vaDestroyBuffer) (
148 VADriverContextP ctx,
152 VAStatus (*vaBeginPicture) (
153 VADriverContextP ctx,
155 VASurfaceID render_target
158 VAStatus (*vaRenderPicture) (
159 VADriverContextP ctx,
165 VAStatus (*vaEndPicture) (
166 VADriverContextP ctx,
170 VAStatus (*vaSyncSurface) (
171 VADriverContextP ctx,
172 VASurfaceID render_target
175 VAStatus (*vaQuerySurfaceStatus) (
176 VADriverContextP ctx,
177 VASurfaceID render_target,
178 VASurfaceStatus *status /* out */
181 VAStatus (*vaPutSurface) (
182 VADriverContextP ctx,
184 void* draw, /* Drawable of window system */
191 unsigned short destw,
192 unsigned short desth,
193 VARectangle *cliprects, /* client supplied clip list */
194 unsigned int number_cliprects, /* number of clip rects in the clip list */
195 unsigned int flags /* de-interlacing flags */
198 VAStatus (*vaQueryImageFormats) (
199 VADriverContextP ctx,
200 VAImageFormat *format_list, /* out */
201 int *num_formats /* out */
204 VAStatus (*vaCreateImage) (
205 VADriverContextP ctx,
206 VAImageFormat *format,
209 VAImage *image /* out */
212 VAStatus (*vaDeriveImage) (
213 VADriverContextP ctx,
215 VAImage *image /* out */
218 VAStatus (*vaDestroyImage) (
219 VADriverContextP ctx,
223 VAStatus (*vaSetImagePalette) (
224 VADriverContextP ctx,
227 * pointer to an array holding the palette data. The size of the array is
228 * num_palette_entries * entry_bytes in size. The order of the components
229 * in the palette is described by the component_order in VAImage struct
231 unsigned char *palette
234 VAStatus (*vaGetImage) (
235 VADriverContextP ctx,
237 int x, /* coordinates of the upper left source pixel */
239 unsigned int width, /* width and height of the region */
244 VAStatus (*vaPutImage) (
245 VADriverContextP ctx,
250 unsigned int src_width,
251 unsigned int src_height,
254 unsigned int dest_width,
255 unsigned int dest_height
258 VAStatus (*vaQuerySubpictureFormats) (
259 VADriverContextP ctx,
260 VAImageFormat *format_list, /* out */
261 unsigned int *flags, /* out */
262 unsigned int *num_formats /* out */
265 VAStatus (*vaCreateSubpicture) (
266 VADriverContextP ctx,
268 VASubpictureID *subpicture /* out */
271 VAStatus (*vaDestroySubpicture) (
272 VADriverContextP ctx,
273 VASubpictureID subpicture
276 VAStatus (*vaSetSubpictureImage) (
277 VADriverContextP ctx,
278 VASubpictureID subpicture,
282 VAStatus (*vaSetSubpictureChromakey) (
283 VADriverContextP ctx,
284 VASubpictureID subpicture,
285 unsigned int chromakey_min,
286 unsigned int chromakey_max,
287 unsigned int chromakey_mask
290 VAStatus (*vaSetSubpictureGlobalAlpha) (
291 VADriverContextP ctx,
292 VASubpictureID subpicture,
296 VAStatus (*vaAssociateSubpicture) (
297 VADriverContextP ctx,
298 VASubpictureID subpicture,
299 VASurfaceID *target_surfaces,
301 short src_x, /* upper left offset in subpicture */
303 unsigned short src_width,
304 unsigned short src_height,
305 short dest_x, /* upper left offset in surface */
307 unsigned short dest_width,
308 unsigned short dest_height,
310 * whether to enable chroma-keying or global-alpha
311 * see VA_SUBPICTURE_XXX values
316 VAStatus (*vaDeassociateSubpicture) (
317 VADriverContextP ctx,
318 VASubpictureID subpicture,
319 VASurfaceID *target_surfaces,
323 VAStatus (*vaQueryDisplayAttributes) (
324 VADriverContextP ctx,
325 VADisplayAttribute *attr_list, /* out */
326 int *num_attributes /* out */
329 VAStatus (*vaGetDisplayAttributes) (
330 VADriverContextP ctx,
331 VADisplayAttribute *attr_list, /* in/out */
335 VAStatus (*vaSetDisplayAttributes) (
336 VADriverContextP ctx,
337 VADisplayAttribute *attr_list,
341 /* used by va trace */
342 VAStatus (*vaBufferInfo) (
343 VADriverContextP ctx,
344 VAContextID context, /* in */
345 VABufferID buf_id, /* in */
346 VABufferType *type, /* out */
347 unsigned int *size, /* out */
348 unsigned int *num_elements /* out */
351 /* lock/unlock surface for external access */
352 VAStatus (*vaLockSurface) (
353 VADriverContextP ctx,
355 unsigned int *fourcc, /* out for follow argument */
356 unsigned int *luma_stride,
357 unsigned int *chroma_u_stride,
358 unsigned int *chroma_v_stride,
359 unsigned int *luma_offset,
360 unsigned int *chroma_u_offset,
361 unsigned int *chroma_v_offset,
362 unsigned int *buffer_name, /* if it is not NULL, assign the low lever
363 * surface buffer name
365 void **buffer /* if it is not NULL, map the surface buffer for
370 VAStatus (*vaUnlockSurface) (
371 VADriverContextP ctx,
375 /* Optional: GLX support hooks */
376 struct VADriverVTableGLX *glx;
379 struct VADriverContext
382 struct VADriverVTable vtable;
383 void *vtable_tpi; /* the structure is malloc-ed */
392 int max_image_formats;
393 int max_subpic_formats;
394 int max_display_attributes;
395 const char *str_vendor;
397 void *handle; /* dlopen handle */
400 void *glx; /* opaque for GLX code */
403 #define VA_DISPLAY_MAGIC 0x56414430 /* VAD0 */
404 struct VADisplayContext
408 VADisplayContextP pNext;
409 VADriverContextP pDriverContext;
412 VADisplayContextP ctx
416 VADisplayContextP ctx
419 VAStatus (*vaGetDriverName) (
420 VADisplayContextP ctx,
424 void *opaque; /* opaque for display extensions (e.g. GLX) */
427 typedef VAStatus (*VADriverInit) (
428 VADriverContextP driver_context
431 #endif /* _VA_BACKEND_H_ */