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_
33 #include "x11/va_x11.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,
173 VASurfaceID render_target
176 VAStatus (*vaQuerySurfaceStatus) (
177 VADriverContextP ctx,
178 VASurfaceID render_target,
179 VASurfaceStatus *status /* out */
182 VAStatus (*vaPutSurface) (
183 VADriverContextP ctx,
185 Drawable draw, /* X Drawable */
192 unsigned short destw,
193 unsigned short desth,
194 VARectangle *cliprects, /* client supplied clip list */
195 unsigned int number_cliprects, /* number of clip rects in the clip list */
196 unsigned int flags /* de-interlacing flags */
199 VAStatus (*vaQueryImageFormats) (
200 VADriverContextP ctx,
201 VAImageFormat *format_list, /* out */
202 int *num_formats /* out */
205 VAStatus (*vaCreateImage) (
206 VADriverContextP ctx,
207 VAImageFormat *format,
210 VAImage *image /* out */
213 VAStatus (*vaDeriveImage) (
214 VADriverContextP ctx,
216 VAImage *image /* out */
219 VAStatus (*vaDestroyImage) (
220 VADriverContextP ctx,
224 VAStatus (*vaSetImagePalette) (
225 VADriverContextP ctx,
228 * pointer to an array holding the palette data. The size of the array is
229 * num_palette_entries * entry_bytes in size. The order of the components
230 * in the palette is described by the component_order in VAImage struct
232 unsigned char *palette
235 VAStatus (*vaGetImage) (
236 VADriverContextP ctx,
238 int x, /* coordinates of the upper left source pixel */
240 unsigned int width, /* width and height of the region */
245 VAStatus (*vaPutImage) (
246 VADriverContextP ctx,
257 VAStatus (*vaPutImage2) (
258 VADriverContextP ctx,
263 unsigned int src_width,
264 unsigned int src_height,
267 unsigned int dest_width,
268 unsigned int dest_height
271 VAStatus (*vaQuerySubpictureFormats) (
272 VADriverContextP ctx,
273 VAImageFormat *format_list, /* out */
274 unsigned int *flags, /* out */
275 unsigned int *num_formats /* out */
278 VAStatus (*vaCreateSubpicture) (
279 VADriverContextP ctx,
281 VASubpictureID *subpicture /* out */
284 VAStatus (*vaDestroySubpicture) (
285 VADriverContextP ctx,
286 VASubpictureID subpicture
289 VAStatus (*vaSetSubpictureImage) (
290 VADriverContextP ctx,
291 VASubpictureID subpicture,
295 VAStatus (*vaSetSubpicturePalette) (
296 VADriverContextP ctx,
297 VASubpictureID subpicture,
299 * pointer to an array holding the palette data. The size of the array is
300 * num_palette_entries * entry_bytes in size. The order of the components
301 * in the palette is described by the component_order in VASubpicture struct
303 unsigned char *palette
306 VAStatus (*vaSetSubpictureChromakey) (
307 VADriverContextP ctx,
308 VASubpictureID subpicture,
309 unsigned int chromakey_min,
310 unsigned int chromakey_max,
311 unsigned int chromakey_mask
314 VAStatus (*vaSetSubpictureGlobalAlpha) (
315 VADriverContextP ctx,
316 VASubpictureID subpicture,
320 VAStatus (*vaAssociateSubpicture) (
321 VADriverContextP ctx,
322 VASubpictureID subpicture,
323 VASurfaceID *target_surfaces,
325 short src_x, /* upper left offset in subpicture */
327 short dest_x, /* upper left offset in surface */
329 unsigned short width,
330 unsigned short height,
332 * whether to enable chroma-keying or global-alpha
333 * see VA_SUBPICTURE_XXX values
338 VAStatus (*vaAssociateSubpicture2) (
339 VADriverContextP ctx,
340 VASubpictureID subpicture,
341 VASurfaceID *target_surfaces,
343 short src_x, /* upper left offset in subpicture */
345 unsigned short src_width,
346 unsigned short src_height,
347 short dest_x, /* upper left offset in surface */
349 unsigned short dest_width,
350 unsigned short dest_height,
352 * whether to enable chroma-keying or global-alpha
353 * see VA_SUBPICTURE_XXX values
358 VAStatus (*vaDeassociateSubpicture) (
359 VADriverContextP ctx,
360 VASubpictureID subpicture,
361 VASurfaceID *target_surfaces,
365 VAStatus (*vaQueryDisplayAttributes) (
366 VADriverContextP ctx,
367 VADisplayAttribute *attr_list, /* out */
368 int *num_attributes /* out */
371 VAStatus (*vaGetDisplayAttributes) (
372 VADriverContextP ctx,
373 VADisplayAttribute *attr_list, /* in/out */
377 VAStatus (*vaSetDisplayAttributes) (
378 VADriverContextP ctx,
379 VADisplayAttribute *attr_list,
384 VAStatus (*vaDbgCopySurfaceToBuffer) (
385 VADriverContextP ctx,
387 void **buffer, /* out */
388 unsigned int *stride /* out */
392 struct VADriverContext
394 void *old_pNext; /* preserved for binary compatibility */
397 struct VADriverVTable vtable;
407 int max_image_formats;
408 int max_subpic_formats;
409 int max_display_attributes;
410 const char *str_vendor;
412 void *handle; /* dlopen handle */
415 struct VADisplayContext
417 VADisplayContextP pNext;
418 VADriverContextP pDriverContext;
421 VADisplayContextP ctx
425 VADisplayContextP ctx
428 VAStatus (*vaGetDriverName) (
429 VADisplayContextP ctx,
434 typedef VAStatus (*VADriverInit) (
435 VADriverContextP driver_context
439 #endif /* _VA_BACKEND_H_ */