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 extern int va_trace_flag;
33 
34 #define VA_TRACE_FLAG_LOG             0x1
35 #define VA_TRACE_FLAG_BUFDATA         0x2
36 #define VA_TRACE_FLAG_CODEDBUF        0x4
37 #define VA_TRACE_FLAG_SURFACE_DECODE  0x8
38 #define VA_TRACE_FLAG_SURFACE_ENCODE  0x10
39 #define VA_TRACE_FLAG_SURFACE_JPEG    0x20
40 #define VA_TRACE_FLAG_SURFACE         (VA_TRACE_FLAG_SURFACE_DECODE | \
41                                        VA_TRACE_FLAG_SURFACE_ENCODE | \
42                                        VA_TRACE_FLAG_SURFACE_JPEG)
43 
44 #define VA_TRACE_LOG(trace_func,...)            \
45     if (va_trace_flag & VA_TRACE_FLAG_LOG) {    \
46         trace_func(__VA_ARGS__);                \
47     }
48 #define VA_TRACE_ALL(trace_func,...)            \
49     if (va_trace_flag) {                        \
50         trace_func(__VA_ARGS__);                \
51     }
52 #define VA_TRACE_RET(dpy,ret)                   \
53     if (va_trace_flag){                         \
54         va_TraceStatus(dpy, __func__, ret);     \
55     }
56 
57 DLL_HIDDEN
58 void va_TraceInit(VADisplay dpy);
59 DLL_HIDDEN
60 void va_TraceEnd(VADisplay dpy);
61 
62 DLL_HIDDEN
63 void va_TraceInitialize(
64     VADisplay dpy,
65     int *major_version,  /* out */
66     int *minor_version   /* out */
67 );
68 
69 DLL_HIDDEN
70 void va_TraceTerminate(
71     VADisplay dpy
72 );
73 
74 DLL_HIDDEN
75 void va_TraceCreateConfig(
76     VADisplay dpy,
77     VAProfile profile,
78     VAEntrypoint entrypoint,
79     VAConfigAttrib *attrib_list,
80     int num_attribs,
81     VAConfigID *config_id /* out */
82 );
83 
84 DLL_HIDDEN
85 void va_TraceDestroyConfig(
86     VADisplay dpy,
87     VAConfigID config_id
88 );
89 
90 DLL_HIDDEN
91 void va_TraceCreateSurfaces(
92     VADisplay dpy,
93     int width,
94     int height,
95     int format,
96     int num_surfaces,
97     VASurfaceID *surfaces,  /* out */
98     VASurfaceAttrib    *attrib_list,
99     unsigned int        num_attribs
100 );
101 
102 DLL_HIDDEN
103 void va_TraceDestroySurfaces(
104     VADisplay dpy,
105     VASurfaceID *surface_list,
106     int num_surfaces
107 );
108 
109 DLL_HIDDEN
110 void va_TraceCreateContext(
111     VADisplay dpy,
112     VAConfigID config_id,
113     int picture_width,
114     int picture_height,
115     int flag,
116     VASurfaceID *render_targets,
117     int num_render_targets,
118     VAContextID *context        /* out */
119 );
120 
121 DLL_HIDDEN
122 void va_TraceDestroyContext(
123     VADisplay dpy,
124     VAContextID context
125 );
126 
127 DLL_HIDDEN
128 void va_TraceCreateMFContext(
129     VADisplay dpy,
130     VAContextID *mf_context /* out */
131 );
132 
133 DLL_HIDDEN
134 void va_TraceMFAddContext(
135     VADisplay dpy,
136     VAMFContextID mf_context,
137     VAContextID context
138 );
139 
140 DLL_HIDDEN
141 void va_TraceMFReleaseContext(
142     VADisplay dpy,
143     VAMFContextID mf_context,
144     VAContextID context
145 );
146 
147 DLL_HIDDEN
148 void va_TraceMFSubmit(
149     VADisplay dpy,
150     VAMFContextID mf_context,
151     VAContextID *contexts,
152     int num_contexts
153 );
154 
155 DLL_HIDDEN
156 void va_TraceCreateBuffer(
157     VADisplay dpy,
158     VAContextID context,    /* in */
159     VABufferType type,      /* in */
160     unsigned int size,      /* in */
161     unsigned int num_elements,  /* in */
162     void *data,         /* in */
163     VABufferID *buf_id      /* out */
164 );
165 
166 DLL_HIDDEN
167 void va_TraceDestroyBuffer(
168     VADisplay dpy,
169     VABufferID buf_id    /* in */
170 );
171 
172 DLL_HIDDEN
173 void va_TraceMapBuffer(
174     VADisplay dpy,
175     VABufferID buf_id,  /* in */
176     void **pbuf     /* out */
177 );
178 
179 
180 DLL_HIDDEN
181 void va_TraceBeginPicture(
182     VADisplay dpy,
183     VAContextID context,
184     VASurfaceID render_target
185 );
186 
187 DLL_HIDDEN
188 void va_TraceRenderPicture(
189     VADisplay dpy,
190     VAContextID context,
191     VABufferID *buffers,
192     int num_buffers
193 );
194 
195 DLL_HIDDEN
196 void va_TraceEndPicture(
197     VADisplay dpy,
198     VAContextID context,
199     int endpic_done
200 );
201 
202 DLL_HIDDEN
203 void va_TraceEndPictureExt(
204     VADisplay dpy,
205     VAContextID context,
206     int endpic_done
207 );
208 
209 DLL_HIDDEN
210 void va_TraceSyncSurface(
211     VADisplay dpy,
212     VASurfaceID render_target
213 );
214 
215 DLL_HIDDEN
216 void va_TraceSyncSurface2(
217     VADisplay dpy,
218     VASurfaceID surface,
219     uint64_t timeout_ns
220 );
221 
222 DLL_HIDDEN
223 void va_TraceQuerySurfaceAttributes(
224     VADisplay           dpy,
225     VAConfigID          config,
226     VASurfaceAttrib    *attrib_list,
227     unsigned int       *num_attribs
228 );
229 
230 DLL_HIDDEN
231 void va_TraceQuerySurfaceStatus(
232     VADisplay dpy,
233     VASurfaceID render_target,
234     VASurfaceStatus *status /* out */
235 );
236 
237 DLL_HIDDEN
238 void va_TraceQuerySurfaceError(
239     VADisplay dpy,
240     VASurfaceID surface,
241     VAStatus error_status,
242     void **error_info /*out*/
243 );
244 
245 DLL_HIDDEN
246 void va_TraceSyncBuffer(
247     VADisplay dpy,
248     VABufferID buf_id,
249     uint64_t timeout_ns
250 );
251 
252 DLL_HIDDEN
253 void va_TraceMaxNumDisplayAttributes(
254     VADisplay dpy,
255     int number
256 );
257 
258 DLL_HIDDEN
259 void va_TraceQueryDisplayAttributes(
260     VADisplay dpy,
261     VADisplayAttribute *attr_list,  /* out */
262     int *num_attributes         /* out */
263 );
264 
265 DLL_HIDDEN
266 void va_TraceGetDisplayAttributes(
267     VADisplay dpy,
268     VADisplayAttribute *attr_list,
269     int num_attributes
270 );
271 
272 DLL_HIDDEN
273 void va_TraceSetDisplayAttributes(
274     VADisplay dpy,
275     VADisplayAttribute *attr_list,
276     int num_attributes
277 );
278 
279 /* extern function called by display side */
280 void va_TracePutSurface(
281     VADisplay dpy,
282     VASurfaceID surface,
283     void *draw, /* the target Drawable */
284     short srcx,
285     short srcy,
286     unsigned short srcw,
287     unsigned short srch,
288     short destx,
289     short desty,
290     unsigned short destw,
291     unsigned short desth,
292     VARectangle *cliprects, /* client supplied clip list */
293     unsigned int number_cliprects, /* number of clip rects in the clip list */
294     unsigned int flags /* de-interlacing flags */
295 );
296 
297 void va_TraceStatus(VADisplay dpy, const char * funcName, VAStatus status);
298 
299 #ifdef __cplusplus
300 }
301 #endif
302 
303 
304 #endif /* VA_TRACE_H */
305