va_private.h revision fd2cbe94dfaa98b79c16fb81d7bac84c5c683249
1/**************************************************************************
2 *
3 * Copyright 2010 Thomas Balling Sørensen & Orasanu Lucian.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27
28#ifndef VA_PRIVATE_H
29#define VA_PRIVATE_H
30
31#include <va/va.h>
32#include <va/va_backend.h>
33#define VA_DEBUG(_str,...) debug_printf("[Gallium VA backend]: " _str,__VA_ARGS__)
34#define VA_INFO(_str,...) VA_DEBUG("INFO: " _str,__VA_ARGS__)
35#define VA_WARNING(_str,...) VA_DEBUG("WARNING: " _str,__VA_ARGS__)
36#define VA_ERROR(_str,...) VA_DEBUG("ERROR: " _str,__VA_ARGS__)
37
38// Public functions:
39VAStatus __vaDriverInit_0_31 (VADriverContextP ctx);
40
41// Private functions:
42struct VADriverVTable vlVaGetVtable();
43
44// Vtable functions:
45VAStatus vlVaTerminate (VADriverContextP ctx);
46VAStatus vlVaQueryConfigProfiles (VADriverContextP ctx, VAProfile *profile_list,int *num_profiles);
47VAStatus vlVaQueryConfigEntrypoints (VADriverContextP ctx, VAProfile profile, VAEntrypoint  *entrypoint_list, int *num_entrypoints);
48VAStatus vlVaGetConfigAttributes (VADriverContextP ctx, VAProfile profile, VAEntrypoint entrypoint, VAConfigAttrib *attrib_list, int num_attribs);
49VAStatus vlVaCreateConfig (VADriverContextP ctx, VAProfile profile, VAEntrypoint entrypoint, VAConfigAttrib *attrib_list, int num_attribs, VAConfigID *config_id);
50VAStatus vlVaDestroyConfig (VADriverContextP ctx, VAConfigID config_id);
51VAStatus vlVaQueryConfigAttributes (VADriverContextP ctx, VAConfigID config_id, VAProfile *profile, VAEntrypoint *entrypoint, VAConfigAttrib *attrib_list, int *num_attribs);
52VAStatus vlVaCreateSurfaces (VADriverContextP ctx,int width,int height,int format,int num_surfaces,VASurfaceID *surfaces);
53VAStatus vlVaDestroySurfaces (VADriverContextP ctx, VASurfaceID *surface_list, int num_surfaces);
54VAStatus vlVaCreateContext (VADriverContextP ctx,VAConfigID config_id,int picture_width,int picture_height,int flag,VASurfaceID *render_targets,int num_render_targets,VAContextID *context);
55VAStatus vlVaDestroyContext (VADriverContextP ctx,VAContextID context);
56VAStatus vlVaCreateBuffer (VADriverContextP ctx,VAContextID context,VABufferType type,unsigned int size,unsigned int num_elements,void *data,VABufferID *buf_id);
57VAStatus vlVaBufferSetNumElements (VADriverContextP ctx,VABufferID buf_id,unsigned int num_elements);
58VAStatus vlVaMapBuffer (VADriverContextP ctx,VABufferID buf_id,void **pbuf);
59VAStatus vlVaUnmapBuffer (VADriverContextP ctx,VABufferID buf_id);
60VAStatus vlVaDestroyBuffer (VADriverContextP ctx,VABufferID buffer_id);
61VAStatus vlVaBeginPicture (VADriverContextP ctx,VAContextID context,VASurfaceID render_target);
62VAStatus vlVaRenderPicture (VADriverContextP ctx,VAContextID context,VABufferID *buffers,int num_buffers);
63VAStatus vlVaEndPicture (VADriverContextP ctx,VAContextID context);
64VAStatus vlVaSyncSurface (VADriverContextP ctx,VASurfaceID render_target);
65VAStatus vlVaQuerySurfaceStatus (VADriverContextP ctx,VASurfaceID render_target,VASurfaceStatus *status);
66VAStatus vlVaPutSurface (VADriverContextP ctx,
67                         VASurfaceID surface,
68                         void* draw,
69                         short srcx,
70                         short srcy,
71                         unsigned short srcw,
72                         unsigned short srch,
73                         short destx,
74                         short desty,
75                         unsigned short destw,
76                         unsigned short desth,
77                         VARectangle *cliprects,
78                         unsigned int number_cliprects,
79                         unsigned int flags);
80VAStatus vlVaQueryImageFormats (VADriverContextP ctx,VAImageFormat *format_list,int *num_formats);
81VAStatus vlVaQuerySubpictureFormats(VADriverContextP ctx,VAImageFormat *format_list,unsigned int *flags,unsigned int *num_formats);
82VAStatus vlVaCreateImage(VADriverContextP ctx,VAImageFormat *format,int width,int height,VAImage *image);
83VAStatus vlVaDeriveImage(VADriverContextP ctx,VASurfaceID surface,VAImage *image);
84VAStatus vlVaDestroyImage(VADriverContextP ctx,VAImageID image);
85VAStatus vlVaSetImagePalette(VADriverContextP ctx,VAImageID image, unsigned char *palette);
86VAStatus vlVaGetImage(VADriverContextP ctx,VASurfaceID surface,int x,int y,unsigned int width,unsigned int height,VAImageID image);
87VAStatus vlVaPutImage(VADriverContextP ctx,
88                      VASurfaceID surface,
89                      VAImageID image,
90                      int src_x,
91                      int src_y,
92                      unsigned int src_width,
93                      unsigned int src_height,
94                      int dest_x,
95                      int dest_y,
96                      unsigned int dest_width,
97                      unsigned int dest_height);
98VAStatus vlVaQuerySubpictureFormats(VADriverContextP ctx,VAImageFormat *format_list,unsigned int *flags,unsigned int *num_formats);
99VAStatus vlVaCreateSubpicture(VADriverContextP ctx,VAImageID image,VASubpictureID *subpicture);
100VAStatus vlVaDestroySubpicture(VADriverContextP ctx,VASubpictureID subpicture);
101VAStatus vlVaSubpictureImage(VADriverContextP ctx,VASubpictureID subpicture,VAImageID image);
102VAStatus vlVaSetSubpictureChromakey(VADriverContextP ctx,VASubpictureID subpicture,unsigned int chromakey_min,unsigned int chromakey_max,unsigned int chromakey_mask);
103VAStatus vlVaSetSubpictureGlobalAlpha(VADriverContextP ctx,VASubpictureID subpicture,float global_alpha);
104VAStatus vlVaAssociateSubpicture(VADriverContextP ctx,
105                                 VASubpictureID subpicture,
106                                 VASurfaceID *target_surfaces,
107                                 int num_surfaces,
108                                 short src_x,
109                                 short src_y,
110                                 unsigned short src_width,
111                                 unsigned short src_height,
112                                 short dest_x,
113                                 short dest_y,
114                                 unsigned short dest_width,
115                                 unsigned short dest_height,
116                                 unsigned int flags);
117VAStatus vlVaDeassociateSubpicture(VADriverContextP ctx,VASubpictureID subpicture,VASurfaceID *target_surfaces,int num_surfaces);
118VAStatus vlVaQueryDisplayAttributes(VADriverContextP ctx,VADisplayAttribute *attr_list,int *num_attributes);
119VAStatus vlVaGetDisplayAttributes(VADriverContextP ctx,VADisplayAttribute *attr_list,int num_attributes);
120VAStatus vlVaSetDisplayAttributes(VADriverContextP ctx,VADisplayAttribute *attr_list,int num_attributes);
121VAStatus vlVaBufferInfo(VADriverContextP ctx,VAContextID context,VABufferID buf_id,VABufferType *type,unsigned int *size,unsigned int *num_elements);
122VAStatus vlVaLockSurface(VADriverContextP ctx,
123                         VASurfaceID surface,
124                         unsigned int *fourcc,
125                         unsigned int *luma_stride,
126                         unsigned int *chroma_u_stride,
127                         unsigned int *chroma_v_stride,
128                         unsigned int *luma_offset,
129                         unsigned int *chroma_u_offset,
130                         unsigned int *chroma_v_offset,
131                         unsigned int *buffer_name,
132                         void **buffer);
133VAStatus vlVaUnlockSurface(VADriverContextP ctx,VASurfaceID surface);
134
135#endif //VA_PRIVATE_H
136