1 /*
2  * Copyright (c) 2009 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 #ifndef VA_TRACE_H
26 #define VA_TRACE_H
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #include "va/va.h"
33 
34 extern int trace_flag;
35 
36 #define VA_TRACE_FLAG_LOG             0x1
37 #define VA_TRACE_FLAG_BUFDATA         0x2
38 #define VA_TRACE_FLAG_CODEDBUF        0x4
39 #define VA_TRACE_FLAG_SURFACE_DECODE  0x8
40 #define VA_TRACE_FLAG_SURFACE_ENCODE  0x10
41 #define VA_TRACE_FLAG_SURFACE_JPEG    0x20
42 #define VA_TRACE_FLAG_SURFACE         (VA_TRACE_FLAG_SURFACE_DECODE | \
43                                        VA_TRACE_FLAG_SURFACE_ENCODE | \
44                                        VA_TRACE_FLAG_SURFACE_JPEG)
45 
46 #define VA_TRACE_LOG(trace_func,...)            \
47     if (trace_flag & VA_TRACE_FLAG_LOG) {       \
48         trace_func(__VA_ARGS__);                \
49     }
50 #define VA_TRACE_ALL(trace_func,...)            \
51     if (trace_flag) {                           \
52         trace_func(__VA_ARGS__);                \
53     }
54 
55 void va_TraceInit(VADisplay dpy);
56 void va_TraceEnd(VADisplay dpy);
57 
58 void va_TraceInitialize (
59     VADisplay dpy,
60     int *major_version,	 /* out */
61     int *minor_version 	 /* out */
62 );
63 
64 void va_TraceTerminate (
65     VADisplay dpy
66 );
67 
68 void va_TraceCreateConfig(
69     VADisplay dpy,
70     VAProfile profile,
71     VAEntrypoint entrypoint,
72     VAConfigAttrib *attrib_list,
73     int num_attribs,
74     VAConfigID *config_id /* out */
75 );
76 
77 void va_TraceCreateSurfaces(
78     VADisplay dpy,
79     int width,
80     int height,
81     int format,
82     int num_surfaces,
83     VASurfaceID *surfaces,	/* out */
84     VASurfaceAttrib    *attrib_list,
85     unsigned int        num_attribs
86 );
87 
88 void va_TraceDestroySurfaces(
89     VADisplay dpy,
90     VASurfaceID *surface_list,
91     int num_surfaces
92 );
93 
94 void va_TraceCreateContext(
95     VADisplay dpy,
96     VAConfigID config_id,
97     int picture_width,
98     int picture_height,
99     int flag,
100     VASurfaceID *render_targets,
101     int num_render_targets,
102     VAContextID *context		/* out */
103 );
104 
105 void va_TraceCreateBuffer (
106     VADisplay dpy,
107     VAContextID context,	/* in */
108     VABufferType type,		/* in */
109     unsigned int size,		/* in */
110     unsigned int num_elements,	/* in */
111     void *data,			/* in */
112     VABufferID *buf_id		/* out */
113 );
114 
115 void va_TraceDestroyBuffer (
116     VADisplay dpy,
117     VABufferID buf_id    /* in */
118 );
119 
120 void va_TraceMapBuffer (
121     VADisplay dpy,
122     VABufferID buf_id,	/* in */
123     void **pbuf 	/* out */
124 );
125 
126 
127 void va_TraceBeginPicture(
128     VADisplay dpy,
129     VAContextID context,
130     VASurfaceID render_target
131 );
132 
133 void va_TraceRenderPicture(
134     VADisplay dpy,
135     VAContextID context,
136     VABufferID *buffers,
137     int num_buffers
138 );
139 
140 void va_TraceEndPicture(
141     VADisplay dpy,
142     VAContextID context,
143     int endpic_done
144 );
145 
146 void va_TraceSyncSurface(
147     VADisplay dpy,
148     VASurfaceID render_target
149 );
150 
151 void va_TraceQuerySurfaceAttributes(
152     VADisplay           dpy,
153     VAConfigID          config,
154     VASurfaceAttrib    *attrib_list,
155     unsigned int       *num_attribs
156 );
157 
158 void va_TraceQuerySurfaceStatus(
159     VADisplay dpy,
160     VASurfaceID render_target,
161     VASurfaceStatus *status	/* out */
162 );
163 
164 void va_TraceQuerySurfaceError(
165 	VADisplay dpy,
166 	VASurfaceID surface,
167 	VAStatus error_status,
168 	void **error_info /*out*/
169 );
170 
171 
172 void va_TraceMaxNumDisplayAttributes (
173     VADisplay dpy,
174     int number
175 );
176 
177 void va_TraceQueryDisplayAttributes (
178     VADisplay dpy,
179     VADisplayAttribute *attr_list,	/* out */
180     int *num_attributes			/* out */
181 );
182 
183 void va_TraceGetDisplayAttributes (
184     VADisplay dpy,
185     VADisplayAttribute *attr_list,
186     int num_attributes
187 );
188 
189 void va_TraceSetDisplayAttributes (
190     VADisplay dpy,
191     VADisplayAttribute *attr_list,
192     int num_attributes
193 );
194 
195 /* extern function called by display side */
196 void va_TracePutSurface (
197     VADisplay dpy,
198     VASurfaceID surface,
199     void *draw, /* the target Drawable */
200     short srcx,
201     short srcy,
202     unsigned short srcw,
203     unsigned short srch,
204     short destx,
205     short desty,
206     unsigned short destw,
207     unsigned short desth,
208     VARectangle *cliprects, /* client supplied clip list */
209     unsigned int number_cliprects, /* number of clip rects in the clip list */
210     unsigned int flags /* de-interlacing flags */
211 );
212 
213 #ifdef __cplusplus
214 }
215 #endif
216 
217 
218 #endif /* VA_TRACE_H */
219