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_
34 #include "X11/va_x11.h"
37 #include <va/va_x11.h>
43 typedef struct VADriverContext *VADriverContextP;
44 typedef struct VADisplayContext *VADisplayContextP;
48 VAStatus (*vaTerminate) ( VADriverContextP ctx );
50 VAStatus (*vaQueryConfigProfiles) (
52 VAProfile *profile_list, /* out */
53 int *num_profiles /* out */
56 VAStatus (*vaQueryConfigEntrypoints) (
59 VAEntrypoint *entrypoint_list, /* out */
60 int *num_entrypoints /* out */
63 VAStatus (*vaGetConfigAttributes) (
66 VAEntrypoint entrypoint,
67 VAConfigAttrib *attrib_list, /* in/out */
71 VAStatus (*vaCreateConfig) (
74 VAEntrypoint entrypoint,
75 VAConfigAttrib *attrib_list,
77 VAConfigID *config_id /* out */
80 VAStatus (*vaDestroyConfig) (
85 VAStatus (*vaQueryConfigAttributes) (
88 VAProfile *profile, /* out */
89 VAEntrypoint *entrypoint, /* out */
90 VAConfigAttrib *attrib_list, /* out */
91 int *num_attribs /* out */
94 VAStatus (*vaCreateSurfaces) (
100 VASurfaceID *surfaces /* out */
103 VAStatus (*vaDestroySurfaces) (
104 VADriverContextP ctx,
105 VASurfaceID *surface_list,
109 VAStatus (*vaCreateContext) (
110 VADriverContextP ctx,
111 VAConfigID config_id,
115 VASurfaceID *render_targets,
116 int num_render_targets,
117 VAContextID *context /* out */
120 VAStatus (*vaDestroyContext) (
121 VADriverContextP ctx,
125 VAStatus (*vaCreateBuffer) (
126 VADriverContextP ctx,
127 VAContextID context, /* in */
128 VABufferType type, /* in */
129 unsigned int size, /* in */
130 unsigned int num_elements, /* in */
132 VABufferID *buf_id /* out */
135 VAStatus (*vaBufferSetNumElements) (
136 VADriverContextP ctx,
137 VABufferID buf_id, /* in */
138 unsigned int num_elements /* in */
141 VAStatus (*vaMapBuffer) (
142 VADriverContextP ctx,
143 VABufferID buf_id, /* in */
144 void **pbuf /* out */
147 VAStatus (*vaUnmapBuffer) (
148 VADriverContextP ctx,
149 VABufferID buf_id /* in */
152 VAStatus (*vaDestroyBuffer) (
153 VADriverContextP ctx,
157 VAStatus (*vaBeginPicture) (
158 VADriverContextP ctx,
160 VASurfaceID render_target
163 VAStatus (*vaRenderPicture) (
164 VADriverContextP ctx,
170 VAStatus (*vaEndPicture) (
171 VADriverContextP ctx,
175 VAStatus (*vaSyncSurface) (
176 VADriverContextP ctx,
178 VASurfaceID render_target
181 VAStatus (*vaQuerySurfaceStatus) (
182 VADriverContextP ctx,
183 VASurfaceID render_target,
184 VASurfaceStatus *status /* out */
187 VAStatus (*vaPutSurface) (
188 VADriverContextP ctx,
190 Drawable draw, /* X Drawable */
197 unsigned short destw,
198 unsigned short desth,
199 VARectangle *cliprects, /* client supplied clip list */
200 unsigned int number_cliprects, /* number of clip rects in the clip list */
201 unsigned int flags /* de-interlacing flags */
204 VAStatus (*vaQueryImageFormats) (
205 VADriverContextP ctx,
206 VAImageFormat *format_list, /* out */
207 int *num_formats /* out */
210 VAStatus (*vaCreateImage) (
211 VADriverContextP ctx,
212 VAImageFormat *format,
215 VAImage *image /* out */
218 VAStatus (*vaDeriveImage) (
219 VADriverContextP ctx,
221 VAImage *image /* out */
224 VAStatus (*vaDestroyImage) (
225 VADriverContextP ctx,
229 VAStatus (*vaSetImagePalette) (
230 VADriverContextP ctx,
233 * pointer to an array holding the palette data. The size of the array is
234 * num_palette_entries * entry_bytes in size. The order of the components
235 * in the palette is described by the component_order in VAImage struct
237 unsigned char *palette
240 VAStatus (*vaGetImage) (
241 VADriverContextP ctx,
243 int x, /* coordinates of the upper left source pixel */
245 unsigned int width, /* width and height of the region */
250 VAStatus (*vaPutImage) (
251 VADriverContextP ctx,
262 VAStatus (*vaPutImage2) (
263 VADriverContextP ctx,
268 unsigned int src_width,
269 unsigned int src_height,
272 unsigned int dest_width,
273 unsigned int dest_height
276 VAStatus (*vaQuerySubpictureFormats) (
277 VADriverContextP ctx,
278 VAImageFormat *format_list, /* out */
279 unsigned int *flags, /* out */
280 unsigned int *num_formats /* out */
283 VAStatus (*vaCreateSubpicture) (
284 VADriverContextP ctx,
286 VASubpictureID *subpicture /* out */
289 VAStatus (*vaDestroySubpicture) (
290 VADriverContextP ctx,
291 VASubpictureID subpicture
294 VAStatus (*vaSetSubpictureImage) (
295 VADriverContextP ctx,
296 VASubpictureID subpicture,
300 VAStatus (*vaSetSubpictureChromakey) (
301 VADriverContextP ctx,
302 VASubpictureID subpicture,
303 unsigned int chromakey_min,
304 unsigned int chromakey_max,
305 unsigned int chromakey_mask
308 VAStatus (*vaSetSubpictureGlobalAlpha) (
309 VADriverContextP ctx,
310 VASubpictureID subpicture,
314 VAStatus (*vaAssociateSubpicture) (
315 VADriverContextP ctx,
316 VASubpictureID subpicture,
317 VASurfaceID *target_surfaces,
319 short src_x, /* upper left offset in subpicture */
321 short dest_x, /* upper left offset in surface */
323 unsigned short width,
324 unsigned short height,
326 * whether to enable chroma-keying or global-alpha
327 * see VA_SUBPICTURE_XXX values
332 VAStatus (*vaAssociateSubpicture2) (
333 VADriverContextP ctx,
334 VASubpictureID subpicture,
335 VASurfaceID *target_surfaces,
337 short src_x, /* upper left offset in subpicture */
339 unsigned short src_width,
340 unsigned short src_height,
341 short dest_x, /* upper left offset in surface */
343 unsigned short dest_width,
344 unsigned short dest_height,
346 * whether to enable chroma-keying or global-alpha
347 * see VA_SUBPICTURE_XXX values
352 VAStatus (*vaDeassociateSubpicture) (
353 VADriverContextP ctx,
354 VASubpictureID subpicture,
355 VASurfaceID *target_surfaces,
359 VAStatus (*vaQueryDisplayAttributes) (
360 VADriverContextP ctx,
361 VADisplayAttribute *attr_list, /* out */
362 int *num_attributes /* out */
365 VAStatus (*vaGetDisplayAttributes) (
366 VADriverContextP ctx,
367 VADisplayAttribute *attr_list, /* in/out */
371 VAStatus (*vaSetDisplayAttributes) (
372 VADriverContextP ctx,
373 VADisplayAttribute *attr_list,
377 /* device specific */
378 VAStatus (*vaCreateSurfaceFromCIFrame) (
379 VADriverContextP ctx,
380 unsigned long frame_id,
381 VASurfaceID *surface /* out */
385 VAStatus (*vaCreateSurfaceFromMrstV4L2Buf) (
386 VADriverContextP ctx,
391 unsigned int luma_stride,
392 unsigned int chroma_u_stride,
393 unsigned int chroma_v_stride,
394 unsigned int luma_offset,
395 unsigned int chroma_u_offset,
396 unsigned int chroma_v_offset,
397 VASurfaceID *surface /* out */
400 VAStatus (*vaCopySurfaceToBuffer) (
401 VADriverContextP ctx,
403 unsigned int *fourcc, /* out for follow argument */
404 unsigned int *luma_stride,
405 unsigned int *chroma_u_stride,
406 unsigned int *chroma_v_stride,
407 unsigned int *luma_offset,
408 unsigned int *chroma_u_offset,
409 unsigned int *chroma_v_offset,
414 struct VADriverContext
416 void *old_pNext; /* preserved for binary compatibility */
419 struct VADriverVTable vtable;
429 int max_image_formats;
430 int max_subpic_formats;
431 int max_display_attributes;
432 const char *str_vendor;
434 void *handle; /* dlopen handle */
437 struct VADisplayContext
439 VADisplayContextP pNext;
440 VADriverContextP pDriverContext;
443 VADisplayContextP ctx
447 VADisplayContextP ctx
450 VAStatus (*vaGetDriverName) (
451 VADisplayContextP ctx,
456 typedef VAStatus (*VADriverInit) (
457 VADriverContextP driver_context
461 #endif /* _VA_BACKEND_H_ */