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 (*vaCreateSurfaceFromCIFrame) (
104 VADriverContextP ctx,
105 unsigned long frame_id,
106 VASurfaceID *surface /* out */
109 VAStatus (*vaDestroySurfaces) (
110 VADriverContextP ctx,
111 VASurfaceID *surface_list,
115 VAStatus (*vaCreateContext) (
116 VADriverContextP ctx,
117 VAConfigID config_id,
121 VASurfaceID *render_targets,
122 int num_render_targets,
123 VAContextID *context /* out */
126 VAStatus (*vaDestroyContext) (
127 VADriverContextP ctx,
131 VAStatus (*vaCreateBuffer) (
132 VADriverContextP ctx,
133 VAContextID context, /* in */
134 VABufferType type, /* in */
135 unsigned int size, /* in */
136 unsigned int num_elements, /* in */
138 VABufferID *buf_id /* out */
141 VAStatus (*vaBufferSetNumElements) (
142 VADriverContextP ctx,
143 VABufferID buf_id, /* in */
144 unsigned int num_elements /* in */
147 VAStatus (*vaMapBuffer) (
148 VADriverContextP ctx,
149 VABufferID buf_id, /* in */
150 void **pbuf /* out */
153 VAStatus (*vaUnmapBuffer) (
154 VADriverContextP ctx,
155 VABufferID buf_id /* in */
158 VAStatus (*vaDestroyBuffer) (
159 VADriverContextP ctx,
163 VAStatus (*vaBeginPicture) (
164 VADriverContextP ctx,
166 VASurfaceID render_target
169 VAStatus (*vaRenderPicture) (
170 VADriverContextP ctx,
176 VAStatus (*vaEndPicture) (
177 VADriverContextP ctx,
181 VAStatus (*vaSyncSurface) (
182 VADriverContextP ctx,
184 VASurfaceID render_target
187 VAStatus (*vaQuerySurfaceStatus) (
188 VADriverContextP ctx,
189 VASurfaceID render_target,
190 VASurfaceStatus *status /* out */
193 VAStatus (*vaPutSurface) (
194 VADriverContextP ctx,
196 Drawable draw, /* X Drawable */
203 unsigned short destw,
204 unsigned short desth,
205 VARectangle *cliprects, /* client supplied clip list */
206 unsigned int number_cliprects, /* number of clip rects in the clip list */
207 unsigned int flags /* de-interlacing flags */
210 VAStatus (*vaQueryImageFormats) (
211 VADriverContextP ctx,
212 VAImageFormat *format_list, /* out */
213 int *num_formats /* out */
216 VAStatus (*vaCreateImage) (
217 VADriverContextP ctx,
218 VAImageFormat *format,
221 VAImage *image /* out */
224 VAStatus (*vaDeriveImage) (
225 VADriverContextP ctx,
227 VAImage *image /* out */
230 VAStatus (*vaDestroyImage) (
231 VADriverContextP ctx,
235 VAStatus (*vaSetImagePalette) (
236 VADriverContextP ctx,
239 * pointer to an array holding the palette data. The size of the array is
240 * num_palette_entries * entry_bytes in size. The order of the components
241 * in the palette is described by the component_order in VAImage struct
243 unsigned char *palette
246 VAStatus (*vaGetImage) (
247 VADriverContextP ctx,
249 int x, /* coordinates of the upper left source pixel */
251 unsigned int width, /* width and height of the region */
256 VAStatus (*vaPutImage) (
257 VADriverContextP ctx,
268 VAStatus (*vaPutImage2) (
269 VADriverContextP ctx,
274 unsigned int src_width,
275 unsigned int src_height,
278 unsigned int dest_width,
279 unsigned int dest_height
282 VAStatus (*vaQuerySubpictureFormats) (
283 VADriverContextP ctx,
284 VAImageFormat *format_list, /* out */
285 unsigned int *flags, /* out */
286 unsigned int *num_formats /* out */
289 VAStatus (*vaCreateSubpicture) (
290 VADriverContextP ctx,
292 VASubpictureID *subpicture /* out */
295 VAStatus (*vaDestroySubpicture) (
296 VADriverContextP ctx,
297 VASubpictureID subpicture
300 VAStatus (*vaSetSubpictureImage) (
301 VADriverContextP ctx,
302 VASubpictureID subpicture,
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 */
390 VAStatus (*vaDbgCreateSurfaceFromMrstV4L2Buf) (
391 VADriverContextP ctx,
396 unsigned int luma_stride,
397 unsigned int chroma_u_stride,
398 unsigned int chroma_v_stride,
399 unsigned int luma_offset,
400 unsigned int chroma_u_offset,
401 unsigned int chroma_v_offset,
402 VASurfaceID *surface /* out */
406 struct VADriverContext
408 void *old_pNext; /* preserved for binary compatibility */
411 struct VADriverVTable vtable;
421 int max_image_formats;
422 int max_subpic_formats;
423 int max_display_attributes;
424 const char *str_vendor;
426 void *handle; /* dlopen handle */
429 struct VADisplayContext
431 VADisplayContextP pNext;
432 VADriverContextP pDriverContext;
435 VADisplayContextP ctx
439 VADisplayContextP ctx
442 VAStatus (*vaGetDriverName) (
443 VADisplayContextP ctx,
448 typedef VAStatus (*VADriverInit) (
449 VADriverContextP driver_context
453 #endif /* _VA_BACKEND_H_ */