Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(282)

Side by Side Diff: third_party/libva/va/va_backend.h

Issue 10380004: Add libva, a library for video accelerated video processing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2007 Intel Corporation. All Rights Reserved.
3 *
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:
11 *
12 * The above copyright notice and this permission notice (including the
13 * next paragraph) shall be included in all copies or substantial portions
14 * of the Software.
15 *
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.
23 */
24
25 /*
26 * Video Decode Acceleration -Backend API
27 */
28
29 #ifndef _VA_BACKEND_H_
30 #define _VA_BACKEND_H_
31
32 #include <va/va.h>
33 #ifndef ANDROID
34 #include <X11/Xlib.h>
35 #endif
36 #include <linux/videodev2.h>
37
38 typedef struct VADriverContext *VADriverContextP;
39 typedef struct VADisplayContext *VADisplayContextP;
40
41 struct VADriverVTable
42 {
43 VAStatus (*vaTerminate) ( VADriverContextP ctx );
44
45 VAStatus (*vaQueryConfigProfiles) (
46 VADriverContextP ctx,
47 VAProfile *profile_list, /* out */
48 int *num_profiles /* out */
49 );
50
51 VAStatus (*vaQueryConfigEntrypoints) (
52 VADriverContextP ctx,
53 VAProfile profile,
54 VAEntrypoint *entrypoint_list, /* out */
55 int *num_entrypoints /* out */
56 );
57
58 VAStatus (*vaGetConfigAttributes) (
59 VADriverContextP ctx,
60 VAProfile profile,
61 VAEntrypoint entrypoint,
62 VAConfigAttrib *attrib_list, /* in/out */
63 int num_attribs
64 );
65
66 VAStatus (*vaCreateConfig) (
67 VADriverContextP ctx,
68 VAProfile profile,
69 VAEntrypoint entrypoint,
70 VAConfigAttrib *attrib_list,
71 int num_attribs,
72 VAConfigID *config_id /* out */
73 );
74
75 VAStatus (*vaDestroyConfig) (
76 VADriverContextP ctx,
77 VAConfigID config_id
78 );
79
80 VAStatus (*vaQueryConfigAttributes) (
81 VADriverContextP ctx,
82 VAConfigID config_id,
83 VAProfile *profile, /* out */
84 VAEntrypoint *entrypoint, /* out */
85 VAConfigAttrib *attrib_list, /* out */
86 int *num_attribs /* out */
87 );
88
89 VAStatus (*vaCreateSurfaces) (
90 VADriverContextP ctx,
91 int width,
92 int height,
93 int format,
94 int num_surfaces,
95 VASurfaceID *surfaces /* out */
96 );
97
98 VAStatus (*vaDestroySurfaces) (
99 VADriverContextP ctx,
100 VASurfaceID *surface_list,
101 int num_surfaces
102 );
103
104 VAStatus (*vaCreateContext) (
105 VADriverContextP ctx,
106 VAConfigID config_id,
107 int picture_width,
108 int picture_height,
109 int flag,
110 VASurfaceID *render_targets,
111 int num_render_targets,
112 VAContextID *context /* out */
113 );
114
115 VAStatus (*vaDestroyContext) (
116 VADriverContextP ctx,
117 VAContextID context
118 );
119
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 */
126 void *data, /* in */
127 VABufferID *buf_id /* out */
128 );
129
130 VAStatus (*vaBufferSetNumElements) (
131 VADriverContextP ctx,
132 VABufferID buf_id, /* in */
133 unsigned int num_elements /* in */
134 );
135
136 VAStatus (*vaMapBuffer) (
137 VADriverContextP ctx,
138 VABufferID buf_id, /* in */
139 void **pbuf /* out */
140 );
141
142 VAStatus (*vaUnmapBuffer) (
143 VADriverContextP ctx,
144 VABufferID buf_id /* in */
145 );
146
147 VAStatus (*vaDestroyBuffer) (
148 VADriverContextP ctx,
149 VABufferID buffer_id
150 );
151
152 VAStatus (*vaBeginPicture) (
153 VADriverContextP ctx,
154 VAContextID context,
155 VASurfaceID render_target
156 );
157
158 VAStatus (*vaRenderPicture) (
159 VADriverContextP ctx,
160 VAContextID context,
161 VABufferID *buffers,
162 int num_buffers
163 );
164
165 VAStatus (*vaEndPicture) (
166 VADriverContextP ctx,
167 VAContextID context
168 );
169
170 VAStatus (*vaSyncSurface) (
171 VADriverContextP ctx,
172 VASurfaceID render_target
173 );
174
175 VAStatus (*vaQuerySurfaceStatus) (
176 VADriverContextP ctx,
177 VASurfaceID render_target,
178 VASurfaceStatus *status /* out */
179 );
180
181 VAStatus (*vaQuerySurfaceError) (
182 VADriverContextP ctx,
183 VASurfaceID render_target,
184 VAStatus error_status,
185 void **error_info /*out*/
186 );
187
188 VAStatus (*vaPutSurface) (
189 VADriverContextP ctx,
190 VASurfaceID surface,
191 void* draw, /* Drawable of window system */
192 short srcx,
193 short srcy,
194 unsigned short srcw,
195 unsigned short srch,
196 short destx,
197 short desty,
198 unsigned short destw,
199 unsigned short desth,
200 VARectangle *cliprects, /* client supplied clip list */
201 unsigned int number_cliprects, /* number of clip rects in the cl ip list */
202 unsigned int flags /* de-interlacing flags */
203 );
204
205 VAStatus (*vaQueryImageFormats) (
206 VADriverContextP ctx,
207 VAImageFormat *format_list, /* out */
208 int *num_formats /* out */
209 );
210
211 VAStatus (*vaCreateImage) (
212 VADriverContextP ctx,
213 VAImageFormat *format,
214 int width,
215 int height,
216 VAImage *image /* out */
217 );
218
219 VAStatus (*vaDeriveImage) (
220 VADriverContextP ctx,
221 VASurfaceID surface,
222 VAImage *image /* out */
223 );
224
225 VAStatus (*vaDestroyImage) (
226 VADriverContextP ctx,
227 VAImageID image
228 );
229
230 VAStatus (*vaSetImagePalette) (
231 VADriverContextP ctx,
232 VAImageID image,
233 /*
234 * pointer to an array holding the palette data. The size of th e array is
235 * num_palette_entries * entry_bytes in size. The order of the components
236 * in the palette is described by the component_order in VAImage struct
237 */
238 unsigned char *palette
239 );
240
241 VAStatus (*vaGetImage) (
242 VADriverContextP ctx,
243 VASurfaceID surface,
244 int x, /* coordinates of the upper left source pixel */
245 int y,
246 unsigned int width, /* width and height of the region */
247 unsigned int height,
248 VAImageID image
249 );
250
251 VAStatus (*vaPutImage) (
252 VADriverContextP ctx,
253 VASurfaceID surface,
254 VAImageID image,
255 int src_x,
256 int src_y,
257 unsigned int src_width,
258 unsigned int src_height,
259 int dest_x,
260 int dest_y,
261 unsigned int dest_width,
262 unsigned int dest_height
263 );
264
265 VAStatus (*vaQuerySubpictureFormats) (
266 VADriverContextP ctx,
267 VAImageFormat *format_list, /* out */
268 unsigned int *flags, /* out */
269 unsigned int *num_formats /* out */
270 );
271
272 VAStatus (*vaCreateSubpicture) (
273 VADriverContextP ctx,
274 VAImageID image,
275 VASubpictureID *subpicture /* out */
276 );
277
278 VAStatus (*vaDestroySubpicture) (
279 VADriverContextP ctx,
280 VASubpictureID subpicture
281 );
282
283 VAStatus (*vaSetSubpictureImage) (
284 VADriverContextP ctx,
285 VASubpictureID subpicture,
286 VAImageID image
287 );
288
289 VAStatus (*vaSetSubpictureChromakey) (
290 VADriverContextP ctx,
291 VASubpictureID subpicture,
292 unsigned int chromakey_min,
293 unsigned int chromakey_max,
294 unsigned int chromakey_mask
295 );
296
297 VAStatus (*vaSetSubpictureGlobalAlpha) (
298 VADriverContextP ctx,
299 VASubpictureID subpicture,
300 float global_alpha
301 );
302
303 VAStatus (*vaAssociateSubpicture) (
304 VADriverContextP ctx,
305 VASubpictureID subpicture,
306 VASurfaceID *target_surfaces,
307 int num_surfaces,
308 short src_x, /* upper left offset in subpicture */
309 short src_y,
310 unsigned short src_width,
311 unsigned short src_height,
312 short dest_x, /* upper left offset in surface */
313 short dest_y,
314 unsigned short dest_width,
315 unsigned short dest_height,
316 /*
317 * whether to enable chroma-keying or global-alpha
318 * see VA_SUBPICTURE_XXX values
319 */
320 unsigned int flags
321 );
322
323 VAStatus (*vaDeassociateSubpicture) (
324 VADriverContextP ctx,
325 VASubpictureID subpicture,
326 VASurfaceID *target_surfaces,
327 int num_surfaces
328 );
329
330 VAStatus (*vaQueryDisplayAttributes) (
331 VADriverContextP ctx,
332 VADisplayAttribute *attr_list, /* out */
333 int *num_attributes /* out */
334 );
335
336 VAStatus (*vaGetDisplayAttributes) (
337 VADriverContextP ctx,
338 VADisplayAttribute *attr_list, /* in/out */
339 int num_attributes
340 );
341
342 VAStatus (*vaSetDisplayAttributes) (
343 VADriverContextP ctx,
344 VADisplayAttribute *attr_list,
345 int num_attributes
346 );
347
348 /* used by va trace */
349 VAStatus (*vaBufferInfo) (
350 VADriverContextP ctx, /* in */
351 VABufferID buf_id, /* in */
352 VABufferType *type, /* out */
353 unsigned int *size, /* out */
354 unsigned int *num_elements /* out */
355 );
356
357 /* lock/unlock surface for external access */
358 VAStatus (*vaLockSurface) (
359 VADriverContextP ctx,
360 VASurfaceID surface,
361 unsigned int *fourcc, /* out for follow argument */
362 unsigned int *luma_stride,
363 unsigned int *chroma_u_stride,
364 unsigned int *chroma_v_stride,
365 unsigned int *luma_offset,
366 unsigned int *chroma_u_offset,
367 unsigned int *chroma_v_offset,
368 unsigned int *buffer_name, /* if it is not NULL, assign the low lever
369 * surface buffer name
370 */
371 void **buffer /* if it is not NULL, map the surface buffer for
372 * CPU access
373 */
374 );
375
376 VAStatus (*vaUnlockSurface) (
377 VADriverContextP ctx,
378 VASurfaceID surface
379 );
380 };
381
382 struct VADriverContext
383 {
384 void *pDriverData;
385
386 /**
387 * The core VA implementation hooks.
388 *
389 * This structure is allocated from libva with calloc().
390 */
391 struct VADriverVTable *vtable;
392
393 /**
394 * The VA/GLX implementation hooks.
395 *
396 * This structure is intended for drivers that implement the
397 * VA/GLX API. The driver implementation is responsible for the
398 * allocation and deallocation of this structure.
399 */
400 struct VADriverVTableGLX *vtable_glx;
401
402 /**
403 * The VA/EGL implementation hooks.
404 *
405 * This structure is intended for drivers that implement the
406 * VA/EGL API. The driver implementation is responsible for the
407 * allocation and deallocation of this structure.
408 */
409 struct VADriverVTableEGL *vtable_egl;
410
411 /**
412 * The third-party/private implementation hooks.
413 *
414 * This structure is intended for drivers that implement the
415 * private API. The driver implementation is responsible for the
416 * allocation and deallocation of this structure.
417 */
418 void *vtable_tpi;
419
420 void *native_dpy;
421 int x11_screen;
422 int version_major;
423 int version_minor;
424 int max_profiles;
425 int max_entrypoints;
426 int max_attributes;
427 int max_image_formats;
428 int max_subpic_formats;
429 int max_display_attributes;
430 const char *str_vendor;
431
432 void *handle; /* dlopen handle */
433
434 void *dri_state;
435 void *glx; /* opaque for GLX code */
436
437 unsigned long reserved[45]; /* reserve for future add-ins, decrease the subscript accordingly */
438 };
439
440 #define VA_DISPLAY_MAGIC 0x56414430 /* VAD0 */
441 struct VADisplayContext
442 {
443 int vadpy_magic;
444
445 VADisplayContextP pNext;
446 VADriverContextP pDriverContext;
447
448 int (*vaIsValid) (
449 VADisplayContextP ctx
450 );
451
452 void (*vaDestroy) (
453 VADisplayContextP ctx
454 );
455
456 VAStatus (*vaGetDriverName) (
457 VADisplayContextP ctx,
458 char **driver_name
459 );
460
461 void *opaque; /* opaque for display extensions (e.g. GLX) */
462 };
463
464 typedef VAStatus (*VADriverInit) (
465 VADriverContextP driver_context
466 );
467
468 #endif /* _VA_BACKEND_H_ */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698