vdpau.h revision a4f78def
1/*
2 * This source file is documented using Doxygen markup.
3 * See http://www.stack.nl/~dimitri/doxygen/
4 */
5
6/*
7 * This copyright notice applies to this header file:
8 *
9 * Copyright (c) 2008-2015 NVIDIA Corporation
10 *
11 * Permission is hereby granted, free of charge, to any person
12 * obtaining a copy of this software and associated documentation
13 * files (the "Software"), to deal in the Software without
14 * restriction, including without limitation the rights to use,
15 * copy, modify, merge, publish, distribute, sublicense, and/or sell
16 * copies of the Software, and to permit persons to whom the
17 * Software is furnished to do so, subject to the following
18 * conditions:
19 *
20 * The above copyright notice and this permission notice shall be
21 * included in all copies or substantial portions of the Software.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
25 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
27 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
28 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
30 * OTHER DEALINGS IN THE SOFTWARE.
31 */
32
33/**
34 * \mainpage Video Decode and Presentation API for Unix
35 *
36 * \section intro Introduction
37 *
38 * The Video Decode and Presentation API for Unix (VDPAU) provides
39 * a complete solution for decoding, post-processing, compositing,
40 * and displaying compressed or uncompressed video streams. These
41 * video streams may be combined (composited) with bitmap content,
42 * to implement OSDs and other application user interfaces.
43 *
44 * \section api_partitioning API Partitioning
45 *
46 * VDPAU is split into two distinct modules:
47 * - \ref api_core
48 * - \ref api_winsys
49 *
50 * The intent is that most VDPAU functionality exists and
51 * operates identically across all possible Windowing Systems.
52 * This functionality is the \ref api_core.
53 *
54 * However, a small amount of functionality must be included that
55 * is tightly coupled to the underlying Windowing System. This
56 * functionality is the \ref api_winsys. Possibly examples
57 * include:
58 * - Creation of the initial VDPAU \ref VdpDevice "VdpDevice"
59 *   handle, since this act requires intimate knowledge of the
60 *   underlying Window System, such as specific display handle or
61 *   driver identification.
62 * - Conversion of VDPAU surfaces to/from underlying Window
63 *   System surface types, e.g. to allow manipulation of
64 *   VDPAU-generated surfaces via native Window System APIs.
65 *
66 * \section objects Object Types
67 *
68 * VDPAU is roughly object oriented; most functionality is
69 * exposed by creating an object (handle) of a certain class
70 * (type), then executing various functions against that handle.
71 * The set of object classes supported, and their purpose, is
72 * discussed below.
73 *
74 * \subsection device_type Device Type
75 *
76 * A \ref VdpDevice "VdpDevice" is the root object in VDPAU's
77 * object system. The \ref api_winsys allows creation of a \ref
78 * VdpDevice "VdpDevice" object handle, from which all other API
79 * entry points can be retrieved and invoked.
80 *
81 * \subsection surface_types Surface Types
82 *
83 * A surface stores pixel information. Various types of surfaces
84 * existing for different purposes:
85 *
86 * - \ref VdpVideoSurface "VdpVideoSurface"s store decompressed
87 *   YCbCr video frames in an implementation-defined internal
88 *   format.
89 * - \ref VdpOutputSurface "VdpOutputSurface"s store RGB 4:4:4
90 *   data. They are legal render targets for video
91 *   post-processing and compositing operations.
92 * - \ref VdpBitmapSurface "VdpBitmapSurface"s store RGB 4:4:4
93 *   data. These surfaces are designed to contain read-only
94 *   bitmap data, to be used for OSD or application UI
95 *   compositing.
96 *
97 * \subsection transfer_types Transfer Types
98 *
99 * A data transfer object reads data from a surface (or
100 * surfaces), processes it, and writes the result to another
101 * surface. Various types of processing are possible:
102 *
103 * - \ref VdpDecoder "VdpDecoder" objects process compressed video
104 *   data, and generate decompressed images.
105 * - \ref VdpOutputSurface "VdpOutputSurface"s have their own \ref
106 *   VdpOutputSurfaceRender "rendering functionality".
107 * - \ref VdpVideoMixer "VdpVideoMixer" objects perform video
108 *   post-processing, de-interlacing, and compositing.
109 * - \ref VdpPresentationQueue "VdpPresentationQueue" is
110 *   responsible for timestamp-based display of surfaces.
111 *
112 * \section data_flow Data Flow
113 *
114 * Compressed video data originates in the application's memory
115 * space. This memory is typically obtained using \c malloc, and
116 * filled via regular file or network read system calls.
117 * Alternatively, the application may \c mmap a file.
118 *
119 * The compressed data is then processed using a \ref VdpDecoder
120 * "VdpDecoder", which will decompress the field or frame,
121 * and write the result into a \ref VdpVideoSurface
122 * "VdpVideoSurface". This action may require reading pixel data
123 * from some number of other \ref VdpVideoSurface "VdpVideoSurface"
124 * objects, depending on the type of compressed data and
125 * field/frame in question.
126 *
127 * If the application wishes to display any form of OSD or
128 * user-interface, this must be created in a \ref
129 * VdpOutputSurface "VdpOutputSurface".
130 *
131 * This process begins with the creation of \ref VdpBitmapSurface
132 * "VdpBitmapSurface" objects to contain the OSD/UI's static data,
133 * such as individual glyphs.
134 *
135 * \ref VdpOutputSurface "VdpOutputSurface" \ref
136 * VdpOutputSurfaceRender "rendering functionality" may be used
137 * to composite together various \ref VdpBitmapSurface
138 * "VdpBitmapSurface"s and \ref VdpOutputSurface
139 * "VdpOutputSurface"s, into another VdpOutputSurface
140 * "VdpOutputSurface".
141 *
142 * Once video has been decoded, it must be post-processed. This
143 * involves various steps such as color space conversion,
144 * de-interlacing, and other video adjustments. This step is
145 * performed using an \ref VdpVideoMixer "VdpVideoMixer" object.
146 * This object can not only perform the aforementioned video
147 * post-processing, but also composite the video with a number of
148 * \ref VdpOutputSurface "VdpOutputSurface"s, thus allowing complex
149 * user interfaces to be built. The final result is written into
150 * another \ref VdpOutputSurface "VdpOutputSurface".
151 *
152 * Note that at this point, the resultant \ref VdpOutputSurface
153 * "VdpOutputSurface" may be fed back through the above path,
154 * either using \ref VdpOutputSurface "VdpOutputSurface" \ref
155 * VdpOutputSurfaceRender "rendering functionality",
156 * or as input to the \ref VdpVideoMixer "VdpVideoMixer" object.
157 *
158 * Finally, the resultant \ref VdpOutputSurface
159 * "VdpOutputSurface" must be displayed on screen. This is the job
160 * of the \ref VdpPresentationQueue "VdpPresentationQueue" object.
161 *
162 * \image html vdpau_data_flow.png
163 *
164 * \section entry_point_retrieval Entry Point Retrieval
165 *
166 * VDPAU is designed so that multiple implementations can be
167 * used without application changes. For example, VDPAU could be
168 * hosted on X11, or via direct GPU access.
169 *
170 * The key technology behind this is the use of function
171 * pointers and a "get proc address" style API for all entry
172 * points. Put another way, functions are not called directly
173 * via global symbols set up by the linker, but rather through
174 * pointers.
175 *
176 * In practical terms, the \ref api_winsys provides factory
177 * functions which not only create and return \ref VdpDevice
178 * "VdpDevice" objects, but also a function pointer to a \ref
179 * VdpGetProcAddress function, through which all entry point
180 * function pointers will be retrieved.
181 *
182 * \subsection entry_point_philosophy Philosophy
183 *
184 * It is entirely possible to envisage a simpler scheme whereby
185 * such function pointers are hidden. That is, the application
186 * would link against a wrapper library that exposed "real"
187 * functions. The application would then call such functions
188 * directly, by symbol, like any other function. The wrapper
189 * library would handle loading the appropriate back-end, and
190 * implementing a similar "get proc address" scheme internally.
191 *
192 * However, the above scheme does not work well in the context
193 * of separated \ref api_core and \ref api_winsys. In this
194 * scenario, one would require a separate wrapper library per
195 * Window System, since each Window System would have a
196 * different function name and prototype for the main factory
197 * function. If an application then wanted to be Window System
198 * agnostic (making final determination at run-time via some
199 * form of plugin), it may then need to link against two
200 * wrapper libraries, which would cause conflicts for all
201 * symbols other than the main factory function.
202 *
203 * Another disadvantage of the wrapper library approach is the
204 * extra level of function call required; the wrapper library
205 * would internally implement the existing "get proc address"
206 * and "function pointer" style dispatch anyway. Exposing this
207 * directly to the application is slightly more efficient.
208 *
209 * \section threading Multi-threading
210 *
211 * All VDPAU functionality is fully thread-safe; any number of
212 * threads may call into any VDPAU functions at any time. VDPAU
213 * may not be called from signal-handlers.
214 *
215 * Note, however, that this simply guarantees that internal
216 * VDPAU state will not be corrupted by thread usage, and that
217 * crashes and deadlocks will not occur. Completely arbitrary
218 * thread usage may not generate the results that an application
219 * desires. In particular, care must be taken when multiple
220 * threads are performing operations on the same VDPAU objects.
221 *
222 * VDPAU implementations guarantee correct flow of surface
223 * content through the rendering pipeline, but only when
224 * function calls that read from or write to a surface return to
225 * the caller prior to any thread calling any other function(s)
226 * that read from or write to the surface. Invoking multiple
227 * reads from a surface in parallel is OK.
228 *
229 * Note that this restriction is placed upon VDPAU function
230 * invocations, and specifically not upon any back-end
231 * hardware's physical rendering operations. VDPAU
232 * implementations are expected to internally synchronize such
233 * hardware operations.
234 *
235 * In a single-threaded application, the above restriction comes
236 * naturally; each function call completes before it is possible
237 * to begin a new function call.
238 *
239 * In a multi-threaded application, threads may need to be
240 * synchronized. For example, consider the situation where:
241 *
242 * - Thread 1 is parsing compressed video data, passing them
243 *   through a \ref VdpDecoder "VdpDecoder" object, and filling a
244 *   ring-buffer of \ref VdpVideoSurface "VdpVideoSurface"s
245 * - Thread 2 is consuming those \ref VdpVideoSurface
246 *   "VdpVideoSurface"s, and using a \ref VdpVideoMixer
247 *   "VdpVideoMixer" to process them and composite them with UI.
248 *
249 * In this case, the threads must synchronize to ensure that
250 * thread 1's call to \ref VdpDecoderRender has returned prior to
251 * thread 2's call(s) to \ref VdpVideoMixerRender that use that
252 * specific surface. This could be achieved using the following
253 * pseudo-code:
254 *
255 * \code
256 * Queue<VdpVideoSurface> q_full_surfaces;
257 * Queue<VdpVideoSurface> q_empty_surfaces;
258 *
259 * thread_1() {
260 *     for (;;) {
261 *         VdpVideoSurface s = q_empty_surfaces.get();
262 *         // Parse compressed stream here
263 *         VdpDecoderRender(s, ...);
264 *         q_full_surfaces.put(s);
265 *     }
266 * }
267 *
268 * // This would need to be more complex if
269 * // VdpVideoMixerRender were to be provided with more
270 * // than one field/frame at a time.
271 * thread_2() {
272 *     for (;;) {
273 *         // Possibly, other rendering operations to mixer
274 *         // layer surfaces here.
275 *         VdpOutputSurface t = ...;
276 *         VdpPresentationQueueBlockUntilSurfaceIdle(t);
277 *         VdpVideoSurface s = q_full_surfaces.get();
278 *         VdpVideoMixerRender(s, t, ...);
279 *         q_empty_surfaces.put(s);
280 *         // Possibly, other rendering operations to "t" here
281 *         VdpPresentationQueueDisplay(t, ...);
282 *     }
283 * }
284 * \endcode
285 *
286 * Finally, note that VDPAU makes no guarantees regarding any
287 * level of parallelism in any given implementation. Put another
288 * way, use of multi-threading is not guaranteed to yield any
289 * performance gain, and in theory could even slightly reduce
290 * performance due to threading/synchronization overhead.
291 *
292 * However, the intent of the threading requirements is to allow
293 * for e.g. video decoding and video mixer operations to proceed
294 * in parallel in hardware. Given a (presumably multi-threaded)
295 * application that kept each portion of the hardware busy, this
296 * would yield a performance increase.
297 *
298 * \section endianness Surface Endianness
299 *
300 * When dealing with surface content, i.e. the input/output of
301 * Put/GetBits functions, applications must take care to access
302 * memory in the correct fashion, so as to avoid endianness
303 * issues.
304 *
305 * By established convention in the 3D graphics world, RGBA data
306 * is defined to be an array of 32-bit pixels containing packed
307 * RGBA components, not as an array of bytes or interleaved RGBA
308 * components. VDPAU follows this convention. As such,
309 * applications are expected to access such surfaces as arrays
310 * of 32-bit components (i.e. using a 32-bit pointer), and not
311 * as interleaved arrays of 8-bit components (i.e. using an
312 * 8-bit pointer.) Deviation from this convention will lead to
313 * endianness issues, unless appropriate care is taken.
314 *
315 * The same convention is followed for some packed YCbCr formats
316 * such as \ref VDP_YCBCR_FORMAT_Y8U8V8A8; i.e. they are
317 * considered arrays of 32-bit pixels, and hence should be
318 * accessed as such.
319 *
320 * For YCbCr formats with chroma decimation and/or planar
321 * formats, however, this convention is awkward. Therefore,
322 * formats such as \ref VDP_YCBCR_FORMAT_NV12 are defined as
323 * arrays of (potentially interleaved) byte-sized components.
324 * Hence, applications should manipulate such data 8-bits at a
325 * time, using 8-bit pointers.
326 *
327 * Note that one common usage for the input/output of
328 * Put/GetBits APIs is file I/O. Typical file I/O APIs treat all
329 * memory as a simple array of 8-bit values. This violates the
330 * rule requiring surface data to be accessed in its true native
331 * format. As such, applications may be required to solve
332 * endianness issues. Possible solutions include:
333 *
334 * - Authoring static UI data files according to the endianness
335 *   of the target execution platform.
336 * - Conditionally byte-swapping Put/GetBits data buffers at
337 *   run-time based on execution platform.
338 *
339 * Note: Complete details regarding each surface format's
340 * precise pixel layout is included with the documentation of
341 * each surface type. For example, see \ref
342 * VDP_RGBA_FORMAT_B8G8R8A8.
343 *
344 * \section video_decoder_usage Video Decoder Usage
345 *
346 * VDPAU is a slice-level API. Put another way, VDPAU implementations accept
347 * "slice" data from the bitstream, and perform all required processing of
348 * those slices (e.g VLD decoding, IDCT, motion compensation, in-loop
349 * deblocking, etc.).
350 *
351 * The client application is responsible for:
352 *
353 * - Extracting the slices from the bitstream (e.g. parsing/demultiplexing
354 *   container formats, scanning the data to determine slice start positions
355 *   and slice sizes).
356 * - Parsing various bitstream headers/structures (e.g. sequence header,
357 *   sequence parameter set, picture parameter set, entry point structures,
358 *   etc.) Various fields from the parsed header structures needs to be
359 *   provided to VDPAU alongside the slice bitstream in a "picture info"
360 *   structure.
361 * - Surface management (e.g. H.264 DPB processing, display re-ordering)
362 *
363 * It is recommended that applications pass solely the slice data to VDPAU;
364 * specifically that any header data structures be excluded from the portion
365 * of the bitstream passed to VDPAU. VDPAU implementations must operate
366 * correctly if non-slice data is included, at least for formats employing
367 * start codes to delimit slice data. However, any extra data may need
368 * to be uploaded to hardware for parsing thus lowering performance, and/or,
369 * in the worst case, may even overflow internal buffers that are sized solely
370 * for slice data.
371 *
372 * The exact data that should be passed to VDPAU is detailed below for each
373 * supported format:
374 *
375 * \subsection bitstream_mpeg1_mpeg2 MPEG-1 and MPEG-2
376 *
377 * Include all slices beginning with start codes 0x00000101 through
378 * 0x000001AF. The slice start code must be included for all slices.
379 *
380 * \subsection bitstream_h264 H.264
381 *
382 * Include all NALs with nal_unit_type of 1 or 5 (coded slice of non-IDR/IDR
383 * picture respectively). The complete slice start code (including 0x000001
384 * prefix) must be included for all slices, even when the prefix is not
385 * included in the bitstream.
386 *
387 * Note that if desired:
388 *
389 * - The slice start code prefix may be included in a separate bitstream
390 *   buffer array entry to the actual slice data extracted from the bitstream.
391 * - Multiple bitstream buffer array entries (e.g. one per slice) may point at
392 *   the same physical data storage for the slice start code prefix.
393 *
394 * \subsection bitstream_vc1_sp_mp VC-1 Simple and Main Profile
395 *
396 * VC-1 simple/main profile bitstreams always consist of a single slice per
397 * picture, and do not use start codes to delimit pictures. Instead, the
398 * container format must indicate where each picture begins/ends.
399 *
400 * As such, no slice start codes should be included in the data passed to
401 * VDPAU; simply pass in the exact data from the bitstream.
402 *
403 * Header information contained in the bitstream should be parsed by the
404 * application and passed to VDPAU using the "picture info" data structure;
405 * this header information explicitly must not be included in the bitstream
406 * data passed to VDPAU for this encoding format.
407 *
408 * \subsection bitstream_vc1_ap VC-1 Advanced Profile
409 *
410 * Include all slices beginning with start codes 0x0000010D (frame),
411 * 0x0000010C (field) or 0x0000010B (slice). The slice start code should be
412 * included in all cases.
413 *
414 * Some VC-1 advanced profile streams do not contain slice start codes; again,
415 * the container format must indicate where picture data begins and ends. In
416 * this case, pictures are assumed to be progressive and to contain a single
417 * slice. It is highly recommended that applications detect this condition,
418 * and add the missing start codes to the bitstream passed to VDPAU. However,
419 * VDPAU implementations must allow bitstreams with missing start codes, and
420 * act as if a 0x0000010D (frame) start code had been present.
421 *
422 * Note that pictures containing multiple slices, or interlace streams, must
423 * contain a complete set of slice start codes in the original bitstream;
424 * without them, it is not possible to correctly parse and decode the stream.
425 *
426 * The bitstream passed to VDPAU should contain all original emulation
427 * prevention bytes present in the original bitstream; do not remove these
428 * from the bitstream.
429 *
430 * \subsection bitstream_mpeg4part2 MPEG-4 Part 2 and DivX
431 *
432 * Include all slices beginning with start codes 0x000001B6. The slice start
433 * code must be included for all slices.
434 *
435 * \subsection bitstream_hevc H.265/HEVC - High Efficiency Video Codec
436 *
437 * Include all video coding layer (VCL) NAL units, with nal_unit_type values
438 * of 0 (TRAIL_N) through 31 (RSV_VCL31) inclusive. In addition to parsing
439 * and providing NAL units, an H.265/HEVC decoder application using VDPAU
440 * for decoding must parse certain values of the first slice segment header
441 * in a VCL NAL unit and provide it through VdpPictureInfoHEVC. Please see
442 * the documentation for VdpPictureInfoHEVC below for further details.
443 *
444 * The complete slice start code (including the 0x000001 prefix) must be
445 * included for all slices, even when the prefix is not included in the
446 * bitstream.
447 *
448 * Note that if desired:
449 *
450 * - The slice start code prefix may be included in a separate bitstream
451 *   buffer array entry to the actual slice data extracted from the bitstream.
452 * - Multiple bitstream buffer array entries (e.g. one per slice) may point at
453 *   the same physical data storage for the slice start code prefix.
454 *
455 * \section video_mixer_usage Video Mixer Usage
456 *
457 * \subsection video_surface_content VdpVideoSurface Content
458 *
459 * Each \ref VdpVideoSurface "VdpVideoSurface" is expected to contain an
460 * entire frame's-worth of data, irrespective of whether an interlaced of
461 * progressive sequence is being decoded.
462 *
463 * Depending on the exact encoding structure of the compressed video stream,
464 * the application may need to call \ref VdpDecoderRender twice to fill a
465 * single \ref VdpVideoSurface "VdpVideoSurface". When the stream contains an
466 * encoded progressive frame, or a "frame coded" interlaced field-pair, a
467 * single \ref VdpDecoderRender call will fill the entire surface. When the
468 * stream contains separately encoded interlaced fields, two
469 * \ref VdpDecoderRender calls will be required; one for the top field, and
470 * one for the bottom field.
471 *
472 * Implementation note: When \ref VdpDecoderRender renders an interlaced
473 * field, this operation must not disturb the content of the other field in
474 * the surface.
475 *
476 * \subsection vm_surf_list VdpVideoMixer Surface List
477 *
478 * An video stream is logically composed of a sequence of fields. An
479 * example is shown below, in display order, assuming top field first:
480 *
481 * <pre>t0 b0 t1 b1 t2 b2 t3 b3 t4 b4 t5 b5 t6 b6 t7 b7 t8 b8 t9 b9</pre>
482 *
483 * The canonical usage is to call \ref VdpVideoMixerRender once for decoded
484 * field, in display order, to yield one post-processed frame for display.
485 *
486 * For each call to \ref VdpVideoMixerRender, the field to be processed should
487 * be provided as the \b video_surface_current parameter.
488 *
489 * To enable operation of advanced de-interlacing algorithms and/or
490 * post-processing algorithms, some past and/or future surfaces should be
491 * provided as context. These are provided in the \b video_surface_past and
492 * \b video_surface_future lists. In general, these lists may contain any
493 * number of surfaces. Specific implementations may have specific requirements
494 * determining the minimum required number of surfaces for optimal operation,
495 * and the maximum number of useful surfaces, beyond which surfaces are not
496 * used. It is recommended that in all cases other than plain bob/weave, at
497 * least 2 past and 1 future field be provided.
498 *
499 * Note that it is entirely possible, in general, for any of the
500 * \ref VdpVideoMixer "VdpVideoMixer" post-processing steps other than
501 * de-interlacing to require access to multiple input fields/frames. For
502 * example, an motion-sensitive noise-reduction algorithm.
503 *
504 * For example, when processing field t4, the \ref VdpVideoMixerRender
505 * parameters may contain the following values, if the application chose to
506 * provide 3 fields of context for both the past and future:
507 *
508 * <pre>
509 * current_picture_structure: VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD
510 * past:    [b3, t3, b2]
511 * current: t4
512 * future:  [b4, t5, b5]
513 * </pre>
514 *
515 * Note that for both the past/future lists, array index 0 represents the
516 * field temporally closest to current, in display order.
517 *
518 * The \ref VdpVideoMixerRender parameter \b current_picture_structure applies
519 * to \b video_surface_current. The picture structure for the other surfaces
520 * will be automatically derived from that for the current picture. The
521 * derivation algorithm is extremely simple; the concatenated list
522 * past/current/future is simply assumed to have an alternating top/bottom
523 * pattern throughout.
524 *
525 * Continuing the example above, subsequent calls to \ref VdpVideoMixerRender
526 * would provide the following sets of parameters:
527 *
528 * <pre>
529 * current_picture_structure: VDP_VIDEO_MIXER_PICTURE_STRUCTURE_BOTTOM_FIELD
530 * past:    [t4, b3, t3]
531 * current: b4
532 * future:  [t5, b5, t6]
533 * </pre>
534 *
535 * then:
536 *
537 * <pre>
538 * current_picture_structure: VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD
539 * past:    [b4, t4, b3]
540 * current: t5
541 * future:  [b5, t6, b7]
542 * </pre>
543 *
544 * In other words, the concatenated list of past/current/future frames simply
545 * forms a window that slides through the sequence of decoded fields.
546 *
547 * It is syntactically legal for an application to choose not to provide a
548 * particular entry in the past or future lists. In this case, the "slot" in
549 * the surface list must be filled with the special value
550 * \ref VDP_INVALID_HANDLE, to explicitly indicate that the picture is
551 * missing; do not simply shuffle other surfaces together to fill in the gap.
552 * Note that entries should only be omitted under special circumstances, such
553 * as failed decode due to bitstream error during picture header parsing,
554 * since missing entries will typically cause advanced de-interlacing
555 * algorithms to experience significantly degraded operation.
556 *
557 * Specific examples for different de-interlacing types are presented below.
558 *
559 * \subsection deint_weave Weave De-interlacing
560 *
561 * Weave de-interlacing is the act of interleaving the lines of two temporally
562 * adjacent fields to form a frame for display.
563 *
564 * To disable de-interlacing for progressive streams, simply specify
565 * \b current_picture_structure as \ref VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME;
566 * no de-interlacing will be applied.
567 *
568 * Weave de-interlacing for interlaced streams is identical to disabling
569 * de-interlacing, as describe immediately above, because each
570 * \ref VdpVideoSurface already contains an entire frame's worth (i.e. two
571 * fields) of picture data.
572 *
573 * Inverse telecine is disabled when using weave de-interlacing.
574 *
575 * Weave de-interlacing produces one output frame for each input frame. The
576 * application should make one \ref VdpVideoMixerRender call per pair of
577 * decoded fields, or per decoded frame.
578 *
579 * Weave de-interlacing requires no entries in the past/future lists.
580 *
581 * All implementations must support weave de-interlacing.
582 *
583 * \subsection deint_bob Bob De-interlacing
584 *
585 * Bob de-interlacing is the act of vertically scaling a single field to the
586 * size of a single frame.
587 *
588 * To achieve bob de-interlacing, simply provide a single field as
589 * \b video_surface_current, and set \b current_picture_structure
590 * appropriately, to indicate whether a top or bottom field was provided.
591 *
592 * Inverse telecine is disabled when using bob de-interlacing.
593 *
594 * Bob de-interlacing produces one output frame for each input field. The
595 * application should make one \ref VdpVideoMixerRender call per decoded
596 * field.
597 *
598 * Bob de-interlacing requires no entries in the past/future lists.
599 *
600 * Bob de-interlacing is the default when no advanced method is requested and
601 * enabled. Advanced de-interlacing algorithms may fall back to bob e.g. when
602 * required past/future fields are missing.
603 *
604 * All implementations must support bob de-interlacing.
605 *
606 * \subsection deint_adv Advanced De-interlacing
607 *
608 * Operation of both temporal and temporal-spatial de-interlacing is
609 * identical; the only difference is the internal processing the algorithm
610 * performs in generating the output frame.
611 *
612 * These algorithms use various advanced processing on the pixels of both the
613 * current and various past/future fields in order to determine how best to
614 * de-interlacing individual portions of the image.
615 *
616 * Inverse telecine may be enabled when using advanced de-interlacing.
617 *
618 * Advanced de-interlacing produces one output frame for each input field. The
619 * application should make one \ref VdpVideoMixerRender call per decoded
620 * field.
621 *
622 * Advanced de-interlacing requires entries in the past/future lists.
623 *
624 * Availability of advanced de-interlacing algorithms is implementation
625 * dependent.
626 *
627 * \subsection deint_rate De-interlacing Rate
628 *
629 * For all de-interlacing algorithms except weave, a choice may be made to
630 * call \ref VdpVideoMixerRender for either each decoded field, or every
631 * second decoded field.
632 *
633 * If \ref VdpVideoMixerRender is called for every decoded field, the
634 * generated post-processed frame rate is equal to the decoded field rate.
635 * Put another way, the generated post-processed nominal field rate is equal
636 * to 2x the decoded field rate. This is standard practice.
637 *
638 * If \ref VdpVideoMixerRender is called for every second decoded field (say
639 * every top field), the generated post-processed frame rate is half to the
640 * decoded field rate. This mode of operation is thus referred to as
641 * "half-rate".
642 *
643 * Implementations may choose whether to support half-rate de-interlacing
644 * or not. Regular full-rate de-interlacing should be supported by any
645 * supported advanced de-interlacing algorithm.
646 *
647 * The descriptions of de-interlacing algorithms above assume that regular
648 * (not half-rate) operation is being performed, when detailing the number of
649 * VdpVideoMixerRender calls.
650 *
651 * Recall that the concatenation of past/current/future surface lists simply
652 * forms a window into the stream of decoded fields. To achieve standard
653 * de-interlacing, the window is slid through the list of decoded fields one
654 * field at a time, and a call is made to \ref VdpVideoMixerRender for each
655 * movement of the window. To achieve half-rate de-interlacing, the window is
656 * slid through the* list of decoded fields two fields at a time, and a
657 * call is made to \ref VdpVideoMixerRender for each movement of the window.
658 *
659 * \subsection invtc Inverse Telecine
660 *
661 * Assuming the implementation supports it, inverse telecine may be enabled
662 * alongside any advanced de-interlacing algorithm. Inverse telecine is never
663 * active for bob or weave.
664 *
665 * Operation of \ref VdpVideoMixerRender with inverse telecine active is
666 * identical to the basic operation mechanisms describe above in every way;
667 * all inverse telecine processing is performed internally to the
668 * \ref VdpVideoMixer "VdpVideoMixer".
669 *
670 * In particular, there is no provision way for \ref VdpVideoMixerRender to
671 * indicate when identical input fields have been observed, and consequently
672 * identical output frames may have been produced.
673 *
674 * De-interlacing (and inverse telecine) may be applied to streams that are
675 * marked as being progressive. This will allow detection of, and correct
676 * de-interlacing of, mixed interlace/progressive streams, bad edits, etc.
677 * To implement de-interlacing/inverse-telecine on progressive material,
678 * simply treat the stream of decoded frames as a stream of decoded fields,
679 * apply any telecine flags (see the next section), and then apply
680 * de-interlacing to those fields as described above.
681 *
682 * Implementations are free to determine whether inverse telecine operates
683 * in conjunction with half-rate de-interlacing or not. It should always
684 * operate with regular de-interlacing, when advertized.
685 *
686 * \subsection tcflags Telecine (Pull-Down) Flags
687 *
688 * Some media delivery formats, e.g. DVD-Video, include flags that are
689 * intended to modify the decoded field sequence before display. This allows
690 * e.g. 24p content to be encoded at 48i, which saves space relative to a 60i
691 * encoded stream, but still displayed at 60i, to match target consumer
692 * display equipment.
693 *
694 * If the inverse telecine option is not activated in the
695 * \ref VdpVideoMixer "VdpVideoMixer", these flags should be ignored, and the
696 * decoded fields passed directly to \ref VdpVideoMixerRender as detailed
697 * above.
698 *
699 * However, to make full use of the inverse telecine feature, these flags
700 * should be applied to the field stream, yielding another field stream with
701 * some repeated fields, before passing the field stream to
702 * \ref VdpVideoMixerRender. In this scenario, the sliding window mentioned
703 * in the descriptions above applies to the field stream after application of
704 * flags.
705 *
706 * \section extending Extending the API
707 *
708 * \subsection extend_enums Enumerations and Other Constants
709 *
710 * VDPAU defines a number of enumeration types.
711 *
712 * When modifying VDPAU, existing enumeration constants must
713 * continue to exist (although they may be deprecated), and do
714 * so in the existing order.
715 *
716 * The above discussion naturally applies to "manually" defined
717 * enumerations, using pre-processor macros, too.
718 *
719 * \subsection extend_structs Structures
720 *
721 * In most case, VDPAU includes no provision for modifying existing
722 * structure definitions, although they may be deprecated.
723 *
724 * New structures may be created, together with new API entry
725 * points or feature/attribute/parameter values, to expose new
726 * functionality.
727 *
728 * A few structures are considered plausible candidates for future extension.
729 * Such structures include a version number as the first field, indicating the
730 * exact layout of the client-provided data. When changing such structures, the
731 * old structure must be preserved and a new structure created. This allows
732 * applications built against the old version of the structure to continue to
733 * interoperate. For example, to extend the VdpProcamp structure, define a new
734 * VdpProcamp1 and update VdpGenerateCSCMatrix to take the new structure as an
735 * argument. Document in a comment that the caller must fill the struct_version
736 * field with the value 1. VDPAU implementations should use the struct_version
737 * field to determine which version of the structure the application was built
738 * against.  Note that you cannot simply increment the value of
739 * VDP_PROCAMP_VERSION because applications recompiled against a newer version
740 * of vdpau.h but that have not been updated to use the new structure must still
741 * report that they're using version 0.
742 *
743 * Note that the layouts of VdpPictureInfo structures are defined by their
744 * corresponding VdpDecoderProfile numbers, so no struct_version field is
745 * needed for them. This layout includes the size of the structure, so new
746 * profiles that extend existing functionality may incorporate the old
747 * VdpPictureInfo as a substructure, but may not modify existing VdpPictureInfo
748 * structures.
749 *
750 * \subsection extend_functions Functions
751 *
752 * Existing functions may not be modified, although they may be
753 * deprecated.
754 *
755 * New functions may be added at will. Note the enumeration
756 * requirements when modifying the enumeration that defines the
757 * list of entry points.
758 *
759 * \section preemption_note Display Preemption
760 *
761 * Please note that the display may be preempted away from
762 * VDPAU at any time. See \ref display_preemption for more
763 * details.
764 *
765 * \subsection trademarks Trademarks
766 *
767 * VDPAU is a trademark of NVIDIA Corporation. You may freely use the
768 * VDPAU trademark, as long as trademark ownership is attributed to
769 * NVIDIA Corporation.
770 */
771
772/**
773 * \file vdpau.h
774 * \brief The Core API
775 *
776 * This file contains the \ref api_core "Core API".
777 */
778
779#ifndef _VDPAU_H
780#define _VDPAU_H
781
782#include <stdint.h>
783
784#ifdef __cplusplus
785extern "C" {
786#endif
787
788/**
789 * \defgroup api_core Core API
790 *
791 * The core API encompasses all VDPAU functionality that operates
792 * in the same fashion across all Window Systems.
793 *
794 * @{
795 */
796
797/**
798 * \defgroup base_types Basic Types
799 *
800 * VDPAU primarily uses ISO C99 types from \c stdint.h.
801 *
802 * @{
803 */
804
805/** \brief A true \ref VdpBool value */
806#define VDP_TRUE 1
807/** \brief A false \ref VdpBool value */
808#define VDP_FALSE 0
809/**
810 * \brief A boolean value, holding \ref VDP_TRUE or \ref
811 * VDP_FALSE.
812 */
813typedef int VdpBool;
814
815/*@}*/
816
817/**
818 * \defgroup misc_types Miscellaneous Types
819 *
820 * @{
821 */
822
823/**
824 * \brief An invalid object handle value.
825 *
826 * This value may be used to represent an invalid, or
827 * non-existent, object (\ref VdpDevice "VdpDevice",
828 * \ref VdpVideoSurface "VdpVideoSurface", etc.)
829 *
830 * Note that most APIs require valid object handles in all
831 * cases, and will fail when presented with this value.
832 */
833#define VDP_INVALID_HANDLE 0xffffffffU
834
835/**
836 * \brief The set of all chroma formats for \ref VdpVideoSurface
837 * "VdpVideoSurface"s.
838 */
839typedef uint32_t VdpChromaType;
840
841/** \hideinitializer \brief 4:2:0 chroma format. */
842#define VDP_CHROMA_TYPE_420 ((VdpChromaType)0)
843/** \hideinitializer \brief 4:2:2 chroma format. */
844#define VDP_CHROMA_TYPE_422 ((VdpChromaType)1)
845/** \hideinitializer \brief 4:4:4 chroma format. */
846#define VDP_CHROMA_TYPE_444 ((VdpChromaType)2)
847
848/**
849 * \brief The set of all known YCbCr surface formats.
850 */
851typedef uint32_t VdpYCbCrFormat;
852
853/**
854 * \hideinitializer
855 * \brief The "NV12" YCbCr surface format.
856 *
857 * This format has a two planes, a Y plane and a UV plane.
858 *
859 * The Y plane is an array of byte-sized Y components.
860 * Applications should access this data via a uint8_t pointer.
861 *
862 * The UV plane is an array of interleaved byte-sized U and V
863 * components, in the order U, V, U, V. Applications should
864 * access this data via a uint8_t pointer.
865 */
866#define VDP_YCBCR_FORMAT_NV12     ((VdpYCbCrFormat)0)
867/**
868 * \hideinitializer
869 * \brief The "YV12" YCbCr surface format.
870 *
871 * This format has a three planes, a Y plane, a V plane, and a U
872 * plane.
873 *
874 * Each of the planes is an array of byte-sized components.
875 *
876 * Applications should access this data via a uint8_t pointer.
877 */
878#define VDP_YCBCR_FORMAT_YV12     ((VdpYCbCrFormat)1)
879/**
880 * \hideinitializer
881 * \brief The "UYVY" YCbCr surface format.
882 *
883 * This format may also be known as Y422, UYNV, HDYC.
884 *
885 * This format has a single plane.
886 *
887 * This plane is an array of interleaved byte-sized Y, U, and V
888 * components, in the order U, Y, V, Y, U, Y, V, Y.
889 *
890 * Applications should access this data via a uint8_t pointer.
891 */
892#define VDP_YCBCR_FORMAT_UYVY     ((VdpYCbCrFormat)2)
893/**
894 * \hideinitializer
895 * \brief The "YUYV" YCbCr surface format.
896 *
897 * This format may also be known as YUY2, YUNV, V422.
898 *
899 * This format has a single plane.
900 *
901 * This plane is an array of interleaved byte-sized Y, U, and V
902 * components, in the order Y, U, Y, V, Y, U, Y, V.
903 *
904 * Applications should access this data via a uint8_t pointer.
905 */
906#define VDP_YCBCR_FORMAT_YUYV     ((VdpYCbCrFormat)3)
907/**
908 * \hideinitializer
909 * \brief A packed YCbCr format.
910 *
911 * This format has a single plane.
912 *
913 * This plane is an array packed 32-bit pixel data. Within each
914 * 32-bit pixel, bits [31:24] contain A, bits [23:16] contain V,
915 * bits [15:8] contain U, and bits [7:0] contain Y.
916 *
917 * Applications should access this data via a uint32_t pointer.
918 */
919#define VDP_YCBCR_FORMAT_Y8U8V8A8 ((VdpYCbCrFormat)4)
920/**
921 * \hideinitializer
922 * \brief A packed YCbCr format.
923 *
924 * This format has a single plane.
925 *
926 * This plane is an array packed 32-bit pixel data. Within each
927 * 32-bit pixel, bits [31:24] contain A, bits [23:16] contain Y,
928 * bits [15:8] contain U, and bits [7:0] contain V.
929 *
930 * Applications should access this data via a uint32_t pointer.
931 */
932#define VDP_YCBCR_FORMAT_V8U8Y8A8 ((VdpYCbCrFormat)5)
933
934/**
935 * \brief  The set of all known RGB surface formats.
936 */
937typedef uint32_t VdpRGBAFormat;
938
939/**
940 * \hideinitializer
941 * \brief A packed RGB format.
942 *
943 * This format has a single plane.
944 *
945 * This plane is an array packed 32-bit pixel data. Within each
946 * 32-bit pixel, bits [31:24] contain A, bits [23:16] contain R,
947 * bits [15:8] contain G, and bits [7:0] contain B.
948 *
949 * Applications should access this data via a uint32_t pointer.
950 */
951#define VDP_RGBA_FORMAT_B8G8R8A8    ((VdpRGBAFormat)0)
952/**
953 * \hideinitializer
954 * \brief A packed RGB format.
955 *
956 * This format has a single plane.
957 *
958 * This plane is an array packed 32-bit pixel data. Within each
959 * 32-bit pixel, bits [31:24] contain A, bits [23:16] contain B,
960 * bits [15:8] contain G, and bits [7:0] contain R.
961 *
962 * Applications should access this data via a uint32_t pointer.
963 */
964#define VDP_RGBA_FORMAT_R8G8B8A8    ((VdpRGBAFormat)1)
965/**
966 * \hideinitializer
967 * \brief A packed RGB format.
968 *
969 * This format has a single plane.
970 *
971 * This plane is an array packed 32-bit pixel data. Within each
972 * 32-bit pixel, bits [31:30] contain A, bits [29:20] contain B,
973 * bits [19:10] contain G, and bits [9:0] contain R.
974 *
975 * Applications should access this data via a uint32_t pointer.
976 */
977#define VDP_RGBA_FORMAT_R10G10B10A2 ((VdpRGBAFormat)2)
978/**
979 * \hideinitializer
980 * \brief A packed RGB format.
981 *
982 * This format has a single plane.
983 *
984 * This plane is an array packed 32-bit pixel data. Within each
985 * 32-bit pixel, bits [31:30] contain A, bits [29:20] contain R,
986 * bits [19:10] contain G, and bits [9:0] contain B.
987 *
988 * Applications should access this data via a uint32_t pointer.
989 */
990#define VDP_RGBA_FORMAT_B10G10R10A2 ((VdpRGBAFormat)3)
991/**
992 * \hideinitializer
993 * \brief An alpha-only surface format.
994 *
995 * This format has a single plane.
996 *
997 * This plane is an array of byte-sized components.
998 *
999 * Applications should access this data via a uint8_t pointer.
1000 */
1001#define VDP_RGBA_FORMAT_A8          ((VdpRGBAFormat)4)
1002
1003/**
1004 * \brief  The set of all known indexed surface formats.
1005 */
1006typedef uint32_t VdpIndexedFormat;
1007
1008/**
1009 * \hideinitializer
1010 * \brief A 4-bit indexed format, with alpha.
1011 *
1012 * This format has a single plane.
1013 *
1014 * This plane is an array of byte-sized components. Within each
1015 * byte, bits [7:4] contain I (index), and bits [3:0] contain A.
1016 *
1017 * Applications should access this data via a uint8_t pointer.
1018 */
1019#define VDP_INDEXED_FORMAT_A4I4 ((VdpIndexedFormat)0)
1020/**
1021 * \hideinitializer
1022 * \brief A 4-bit indexed format, with alpha.
1023 *
1024 * This format has a single plane.
1025 *
1026 * This plane is an array of byte-sized components. Within each
1027 * byte, bits [7:4] contain A, and bits [3:0] contain I (index).
1028 *
1029 * Applications should access this data via a uint8_t pointer.
1030 */
1031#define VDP_INDEXED_FORMAT_I4A4 ((VdpIndexedFormat)1)
1032/**
1033 * \hideinitializer
1034 * \brief A 8-bit indexed format, with alpha.
1035 *
1036 * This format has a single plane.
1037 *
1038 * This plane is an array of interleaved byte-sized A and I
1039 * (index) components, in the order A, I, A, I.
1040 *
1041 * Applications should access this data via a uint8_t pointer.
1042 */
1043#define VDP_INDEXED_FORMAT_A8I8 ((VdpIndexedFormat)2)
1044/**
1045 * \hideinitializer
1046 * \brief A 8-bit indexed format, with alpha.
1047 *
1048 * This format has a single plane.
1049 *
1050 * This plane is an array of interleaved byte-sized A and I
1051 * (index) components, in the order I, A, I, A.
1052 *
1053 * Applications should access this data via a uint8_t pointer.
1054 */
1055#define VDP_INDEXED_FORMAT_I8A8 ((VdpIndexedFormat)3)
1056
1057/**
1058 * \brief A location within a surface.
1059 *
1060 * The VDPAU co-ordinate system has its origin at the top-left
1061 * of a surface, with x and y components increasing right and
1062 * down.
1063 */
1064typedef struct {
1065    /** X co-ordinate. */
1066    uint32_t x;
1067    /** Y co-ordinate. */
1068    uint32_t y;
1069} VdpPoint;
1070
1071/**
1072 * \brief A rectangular region of a surface.
1073 *
1074 * The co-ordinates are top-left inclusive, bottom-right
1075 * exclusive.
1076 *
1077 * The VDPAU co-ordinate system has its origin at the top-left
1078 * of a surface, with x and y components increasing right and
1079 * down.
1080 */
1081typedef struct {
1082    /** Left X co-ordinate. Inclusive. */
1083    uint32_t x0;
1084    /** Top Y co-ordinate. Inclusive. */
1085    uint32_t y0;
1086    /** Right X co-ordinate. Exclusive. */
1087    uint32_t x1;
1088    /** Bottom Y co-ordinate. Exclusive. */
1089    uint32_t y1;
1090} VdpRect;
1091
1092/**
1093 * A constant RGBA color.
1094 *
1095 * Note that the components are stored as float values in the
1096 * range 0.0...1.0 rather than format-specific integer values.
1097 * This allows VdpColor values to be independent from the exact
1098 * surface format(s) in use.
1099 */
1100typedef struct {
1101    float red;
1102    float green;
1103    float blue;
1104    float alpha;
1105} VdpColor;
1106
1107/*@}*/
1108
1109/**
1110 * \defgroup error_handling Error Handling
1111 *
1112 * @{
1113 */
1114
1115/**
1116 * \hideinitializer
1117 * \brief The set of all possible error codes.
1118 */
1119typedef enum {
1120    /** The operation completed successfully; no error. */
1121    VDP_STATUS_OK = 0,
1122    /**
1123     * No backend implementation could be loaded.
1124     */
1125    VDP_STATUS_NO_IMPLEMENTATION,
1126    /**
1127     * The display was preempted, or a fatal error occurred.
1128     *
1129     * The application must re-initialize VDPAU.
1130     */
1131    VDP_STATUS_DISPLAY_PREEMPTED,
1132    /**
1133     * An invalid handle value was provided.
1134     *
1135     * Either the handle does not exist at all, or refers to an object of an
1136     * incorrect type.
1137     */
1138    VDP_STATUS_INVALID_HANDLE,
1139    /**
1140     * An invalid pointer was provided.
1141     *
1142     * Typically, this means that a NULL pointer was provided for an "output"
1143     * parameter.
1144     */
1145    VDP_STATUS_INVALID_POINTER,
1146    /**
1147     * An invalid/unsupported \ref VdpChromaType value was supplied.
1148     */
1149    VDP_STATUS_INVALID_CHROMA_TYPE,
1150    /**
1151     * An invalid/unsupported \ref VdpYCbCrFormat value was supplied.
1152     */
1153    VDP_STATUS_INVALID_Y_CB_CR_FORMAT,
1154    /**
1155     * An invalid/unsupported \ref VdpRGBAFormat value was supplied.
1156     */
1157    VDP_STATUS_INVALID_RGBA_FORMAT,
1158    /**
1159     * An invalid/unsupported \ref VdpIndexedFormat value was supplied.
1160     */
1161    VDP_STATUS_INVALID_INDEXED_FORMAT,
1162    /**
1163     * An invalid/unsupported \ref VdpColorStandard value was supplied.
1164     */
1165    VDP_STATUS_INVALID_COLOR_STANDARD,
1166    /**
1167     * An invalid/unsupported \ref VdpColorTableFormat value was supplied.
1168     */
1169    VDP_STATUS_INVALID_COLOR_TABLE_FORMAT,
1170    /**
1171     * An invalid/unsupported \ref VdpOutputSurfaceRenderBlendFactor value was
1172     * supplied.
1173     */
1174    VDP_STATUS_INVALID_BLEND_FACTOR,
1175    /**
1176     * An invalid/unsupported \ref VdpOutputSurfaceRenderBlendEquation value
1177     * was supplied.
1178     */
1179    VDP_STATUS_INVALID_BLEND_EQUATION,
1180    /**
1181     * An invalid/unsupported flag value/combination was supplied.
1182     */
1183    VDP_STATUS_INVALID_FLAG,
1184    /**
1185     * An invalid/unsupported \ref VdpDecoderProfile value was supplied.
1186     */
1187    VDP_STATUS_INVALID_DECODER_PROFILE,
1188    /**
1189     * An invalid/unsupported \ref VdpVideoMixerFeature value was supplied.
1190     */
1191    VDP_STATUS_INVALID_VIDEO_MIXER_FEATURE,
1192    /**
1193     * An invalid/unsupported \ref VdpVideoMixerParameter value was supplied.
1194     */
1195    VDP_STATUS_INVALID_VIDEO_MIXER_PARAMETER,
1196    /**
1197     * An invalid/unsupported \ref VdpVideoMixerAttribute value was supplied.
1198     */
1199    VDP_STATUS_INVALID_VIDEO_MIXER_ATTRIBUTE,
1200    /**
1201     * An invalid/unsupported \ref VdpVideoMixerPictureStructure value was
1202     * supplied.
1203     */
1204    VDP_STATUS_INVALID_VIDEO_MIXER_PICTURE_STRUCTURE,
1205    /**
1206     * An invalid/unsupported \ref VdpFuncId value was supplied.
1207     */
1208    VDP_STATUS_INVALID_FUNC_ID,
1209    /**
1210     * The size of a supplied object does not match the object it is being
1211     * used with.
1212     *
1213     * For example, a \ref VdpVideoMixer "VdpVideoMixer" is configured to
1214     * process \ref VdpVideoSurface "VdpVideoSurface" objects of a specific
1215     * size. If presented with a \ref VdpVideoSurface "VdpVideoSurface" of a
1216     * different size, this error will be raised.
1217     */
1218    VDP_STATUS_INVALID_SIZE,
1219    /**
1220     * An invalid/unsupported value was supplied.
1221     *
1222     * This is a catch-all error code for values of type other than those
1223     * with a specific error code.
1224     */
1225    VDP_STATUS_INVALID_VALUE,
1226    /**
1227     * An invalid/unsupported structure version was specified in a versioned
1228     * structure. This implies that the implementation is older than the
1229     * header file the application was built against.
1230     */
1231    VDP_STATUS_INVALID_STRUCT_VERSION,
1232    /**
1233     * The system does not have enough resources to complete the requested
1234     * operation at this time.
1235     */
1236    VDP_STATUS_RESOURCES,
1237    /**
1238     * The set of handles supplied are not all related to the same VdpDevice.
1239     *
1240     * When performing operations that operate on multiple surfaces, such as
1241     * \ref  VdpOutputSurfaceRenderOutputSurface or \ref VdpVideoMixerRender,
1242     * all supplied surfaces must have been created within the context of the
1243     * same \ref VdpDevice "VdpDevice" object. This error is raised if they were
1244     * not.
1245     */
1246    VDP_STATUS_HANDLE_DEVICE_MISMATCH,
1247    /**
1248     * A catch-all error, used when no other error code applies.
1249     */
1250    VDP_STATUS_ERROR,
1251} VdpStatus;
1252
1253/**
1254 * \brief Retrieve a string describing an error code.
1255 * \param[in] status The error code.
1256 * \return A pointer to the string. Note that this is a
1257 *       statically allocated read-only string. As such, the
1258 *       application must not free the returned pointer. The
1259 *       pointer is valid as long as the VDPAU implementation is
1260 *       present within the application's address space.
1261 */
1262typedef char const * VdpGetErrorString(
1263    VdpStatus status
1264);
1265
1266/*@}*/
1267
1268/**
1269 * \defgroup versioning Versioning
1270 *
1271 *
1272 * @{
1273 */
1274
1275/**
1276 * \brief The VDPAU interface version described by this header file.
1277 *
1278 * This version will only increase if a major incompatible change is made.
1279 * For example, if the parameters passed to an existing function are modified,
1280 * rather than simply adding new functions/enumerations), or if the mechanism
1281 * used to load the backend driver is modified incompatibly. Such changes are
1282 * unlikely.
1283 *
1284 * This value also represents the DSO version of VDPAU-related
1285 * shared-libraries.
1286 *
1287 * VDPAU version numbers are simple integers that increase monotonically
1288 * (typically by value 1).
1289 */
1290#define VDPAU_INTERFACE_VERSION 1
1291
1292/**
1293 * \brief The VDPAU version described by this header file.
1294 *
1295 * This version will increase whenever any non-documentation change is made to
1296 * vdpau.h, or related header files such as vdpau_x11.h. Such changes
1297 * typically involve the addition of new functions, constants, or features.
1298 * Such changes are expected to be completely backwards-compatible.
1299 *
1300 * VDPAU version numbers are simple integers that increase monotonically
1301 * (typically by value 1).
1302 */
1303#define VDPAU_VERSION 1
1304
1305/**
1306 * \brief Retrieve the VDPAU version implemented by the backend.
1307 * \param[out] api_version The API version.
1308 * \return VdpStatus The completion status of the operation.
1309 */
1310typedef VdpStatus VdpGetApiVersion(
1311    /* output parameters follow */
1312    uint32_t * api_version
1313);
1314
1315/**
1316 * \brief Retrieve an implementation-specific string description
1317 *        of the implementation. This typically includes detailed version
1318 *        information.
1319 * \param[out] information_string A pointer to the information
1320 *       string. Note that this is a statically allocated
1321 *       read-only string. As such, the application must not
1322 *       free the returned pointer. The pointer is valid as long
1323 *       as the implementation is present within the
1324 *       application's address space.
1325 * \return VdpStatus The completion status of the operation.
1326 *
1327 * Note that the returned string is useful for information
1328 * reporting. It is not intended that the application should
1329 * parse this string in order to determine any information about
1330 * the implementation.
1331 */
1332typedef VdpStatus VdpGetInformationString(
1333    /* output parameters follow */
1334    char const * * information_string
1335);
1336
1337/*@}*/
1338
1339/**
1340 * \defgroup VdpDevice VdpDevice; Primary API object
1341 *
1342 * The VdpDevice is the root of the VDPAU object system. Using a
1343 * VdpDevice object, all other object types may be created. See
1344 * the sections describing those other object types for details
1345 * on object creation.
1346 *
1347 * Note that VdpDevice objects are created using the \ref
1348 * api_winsys.
1349 *
1350 * @{
1351 */
1352
1353/**
1354 * \brief  An opaque handle representing a VdpDevice object.
1355 */
1356typedef uint32_t VdpDevice;
1357
1358/**
1359 * \brief Destroy a VdpDevice.
1360 * \param[in] device The device to destroy.
1361 * \return VdpStatus The completion status of the operation.
1362 */
1363typedef VdpStatus VdpDeviceDestroy(
1364    VdpDevice device
1365);
1366
1367/*@}*/
1368
1369/**
1370 * \defgroup VdpCSCMatrix VdpCSCMatrix; CSC Matrix Manipulation
1371 *
1372 * When converting from YCbCr to RGB data formats, a color space
1373 * conversion operation must be performed. This operation is
1374 * parameterized using a "color space conversion matrix". The
1375 * VdpCSCMatrix is a data structure representing this
1376 * information.
1377 *
1378 * @{
1379 */
1380
1381/**
1382 * \brief Storage for a color space conversion matrix.
1383 *
1384 * Note that the application may choose to construct the matrix
1385 * content by either:
1386 * - Directly filling in the fields of the CSC matrix
1387 * - Using the \ref VdpGenerateCSCMatrix helper function.
1388 *
1389 * The color space conversion equation is as follows:
1390 *
1391 * \f[
1392 * \left( \begin{array}{c} R \\ G \\ B \end{array} \right)
1393 * =
1394 * \left( \begin{array}{cccc}
1395 * m_{0,0} & m_{0,1} & m_{0,2} & m_{0,3} \\
1396 * m_{1,0} & m_{1,1} & m_{1,2} & m_{1,3} \\
1397 * m_{2,0} & m_{2,1} & m_{2,2} & m_{2,3}
1398 * \end{array}
1399 * \right)
1400 * *
1401 * \left( \begin{array}{c} Y \\ Cb \\ Cr \\ 1.0 \end{array}
1402 *      \right)
1403 * \f]
1404 */
1405typedef float VdpCSCMatrix[3][4];
1406
1407#define VDP_PROCAMP_VERSION 0
1408
1409/**
1410 * \brief Procamp operation parameterization data.
1411 *
1412 * When performing a color space conversion operation, various
1413 * adjustments can be performed at the same time, such as
1414 * brightness and contrast. This structure defines the level of
1415 * adjustments to make.
1416 */
1417typedef struct {
1418    /**
1419     * This field must be filled with VDP_PROCAMP_VERSION
1420     */
1421    uint32_t struct_version;
1422    /**
1423     * Brightness adjustment amount. A value clamped between
1424     * -1.0 and 1.0. 0.0 represents no modification.
1425     */
1426    float brightness;
1427    /**
1428     * Contrast adjustment amount. A value clamped between
1429     * 0.0 and 10.0. 1.0 represents no modification.
1430     */
1431    float contrast;
1432    /**
1433     * Saturation adjustment amount. A value clamped between 0.0 and
1434     * 10.0. 1.0 represents no modification.
1435     */
1436    float saturation;
1437    /**
1438     * Hue adjustment amount. A value clamped between
1439     * -PI and PI. 0.0 represents no modification.
1440     */
1441    float hue;
1442} VdpProcamp;
1443
1444/**
1445 * \brief YCbCr color space specification.
1446 *
1447 * A number of YCbCr color spaces exist. This enumeration
1448 * defines the specifications known to VDPAU.
1449 */
1450typedef uint32_t VdpColorStandard;
1451
1452/** \hideinitializer \brief ITU-R BT.601 */
1453#define VDP_COLOR_STANDARD_ITUR_BT_601 ((VdpColorStandard)0)
1454/** \hideinitializer \brief ITU-R BT.709 */
1455#define VDP_COLOR_STANDARD_ITUR_BT_709 ((VdpColorStandard)1)
1456/** \hideinitializer \brief SMPTE-240M */
1457#define VDP_COLOR_STANDARD_SMPTE_240M  ((VdpColorStandard)2)
1458
1459/**
1460 * \brief Generate a color space conversion matrix
1461 * \param[in] procamp The procamp adjustments to make. If NULL,
1462 *        no adjustments will be made.
1463 * \param[in] standard The YCbCr color space to convert from.
1464 * \param[out] csc_matrix The CSC matrix to initialize.
1465 * \return VdpStatus The completion status of the operation.
1466 */
1467typedef VdpStatus VdpGenerateCSCMatrix(
1468    VdpProcamp *     procamp,
1469    VdpColorStandard standard,
1470    /* output parameters follow */
1471    VdpCSCMatrix *   csc_matrix
1472);
1473
1474/*@}*/
1475
1476/**
1477 * \defgroup VdpVideoSurface VdpVideoSurface; Video Surface object
1478 *
1479 * A VdpVideoSurface stores YCbCr data in an internal format,
1480 * with a variety of possible chroma sub-sampling options.
1481 *
1482 * A VdpVideoSurface may be filled with:
1483 * - Data provided by the CPU via \ref
1484 *   VdpVideoSurfacePutBitsYCbCr (i.e. software decode.)
1485 * - The result of applying a \ref VdpDecoder "VdpDecoder" to
1486 *   compressed video data.
1487 *
1488 * VdpVideoSurface content may be accessed by:
1489 * - The application via \ref VdpVideoSurfaceGetBitsYCbCr
1490 * - The Hardware that implements \ref VdpOutputSurface
1491 *   "VdpOutputSurface" \ref VdpOutputSurfaceRender
1492 *   "rendering functionality".
1493 * - The Hardware the implements \ref VdpVideoMixer
1494 *   "VdpVideoMixer" functionality.
1495 *
1496 * VdpVideoSurfaces are not directly displayable. They must be
1497 * converted into a displayable format using \ref VdpVideoMixer
1498 * "VdpVideoMixer" objects.
1499 *
1500 * See \ref video_mixer_usage for additional information.
1501 *
1502 * @{
1503 */
1504
1505/**
1506 * \brief Query the implementation's VdpVideoSurface
1507 *        capabilities.
1508 * \param[in] device The device to query.
1509 * \param[in] surface_chroma_type The type of chroma type for
1510 *       which information is requested.
1511 * \param[out] is_supported Is this chroma type supported?
1512 * \param[out] max_width The maximum supported surface width for
1513 *       this chroma type.
1514 * \param[out] max_height The maximum supported surface height
1515 *       for this chroma type.
1516 * \return VdpStatus The completion status of the operation.
1517 */
1518typedef VdpStatus VdpVideoSurfaceQueryCapabilities(
1519    VdpDevice     device,
1520    VdpChromaType surface_chroma_type,
1521    /* output parameters follow */
1522    VdpBool *     is_supported,
1523    uint32_t *    max_width,
1524    uint32_t *    max_height
1525);
1526
1527/**
1528 * \brief Query the implementation's VdpVideoSurface
1529 *        GetBits/PutBits capabilities.
1530 * \param[in] device The device to query.
1531 * \param[in] surface_chroma_type The type of chroma type for
1532 *       which information is requested.
1533 * \param[in] bits_ycbcr_format The format of application "bits"
1534 *       buffer for which information is requested.
1535 * \param[out] is_supported Is this chroma type supported?
1536 * \return VdpStatus The completion status of the operation.
1537 */
1538typedef VdpStatus VdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities(
1539    VdpDevice      device,
1540    VdpChromaType  surface_chroma_type,
1541    VdpYCbCrFormat bits_ycbcr_format,
1542    /* output parameters follow */
1543    VdpBool *      is_supported
1544);
1545
1546/**
1547 * \brief An opaque handle representing a VdpVideoSurface
1548 *        object.
1549 */
1550typedef uint32_t VdpVideoSurface;
1551
1552/**
1553 * \brief Create a VdpVideoSurface.
1554 * \param[in] device The device that will contain the surface.
1555 * \param[in] chroma_type The chroma type of the new surface.
1556 * \param[in] width The width of the new surface.
1557 * \param[in] height The height of the new surface.
1558 * \param[out] surface The new surface's handle.
1559 * \return VdpStatus The completion status of the operation.
1560 *
1561 * The memory backing the surface may not be initialized during
1562 * creation. Applications are expected to initialize any region
1563 * that they use, via \ref VdpDecoderRender or \ref
1564 * VdpVideoSurfacePutBitsYCbCr.
1565 *
1566 * Note that certain widths/heights are impossible for specific values of
1567 * chroma_type. For example, the definition of VDP_CHROMA_TYPE_420 implies
1568 * that the width must be even, since each single chroma sample covers two
1569 * luma samples horizontally. A similar argument applies to surface heights,
1570 * although doubly so, since interlaced pictures must be supported; each
1571 * field's height must itself be a multiple of 2. Hence the overall surface's
1572 * height must be a multiple of 4.
1573 *
1574 * Similar rules apply to other chroma_type values.
1575 *
1576 * Implementations may also impose additional restrictions on the surface
1577 * sizes they support, potentially requiring additional rounding of actual
1578 * surface sizes.
1579 *
1580 * In most cases, this is not an issue, since:
1581 * - Video streams are encoded as an array of macro-blocks, which typically
1582 *   have larger size alignment requirements than video surfaces do.
1583 * - APIs such as \ref VdpVideoMixerRender allow specification of a sub-region
1584 *   of the surface to read, which allows the padding data to be clipped away.
1585 *
1586 * However, other APIs such as \ref VdpVideoSurfaceGetBitsYCbCr and
1587 * \ref VdpVideoSurfacePutBitsYCbCr do not allow a sub-region to be specified,
1588 * and always operate on surface size that was actually allocated, rather
1589 * than the surface size that was requested. In this case, applications need
1590 * to be aware of the actual surface size, in order to allocate appropriately
1591 * sized buffers for the get-/put-bits operations.
1592 *
1593 * For this reason, applications may need to call
1594 * \ref VdpVideoSurfaceGetParameters after creation, in order to retrieve the
1595 * actual surface size.
1596 */
1597typedef VdpStatus VdpVideoSurfaceCreate(
1598    VdpDevice         device,
1599    VdpChromaType     chroma_type,
1600    uint32_t          width,
1601    uint32_t          height,
1602    /* output parameters follow */
1603    VdpVideoSurface * surface
1604);
1605
1606/**
1607 * \brief Destroy a VdpVideoSurface.
1608 * \param[in] surface The surface's handle.
1609 * \return VdpStatus The completion status of the operation.
1610 */
1611typedef VdpStatus VdpVideoSurfaceDestroy(
1612    VdpVideoSurface surface
1613);
1614
1615/**
1616 * \brief Retrieve the parameters used to create a
1617 *        VdpVideoSurface.
1618 * \param[in] surface The surface's handle.
1619 * \param[out] chroma_type The chroma type of the surface.
1620 * \param[out] width The width of the surface.
1621 * \param[out] height The height of the surface.
1622 * \return VdpStatus The completion status of the operation.
1623 */
1624typedef VdpStatus VdpVideoSurfaceGetParameters(
1625    VdpVideoSurface surface,
1626    /* output parameters follow */
1627    VdpChromaType * chroma_type,
1628    uint32_t *      width,
1629    uint32_t *      height
1630);
1631
1632/**
1633 * \brief Copy image data from a VdpVideoSurface to application
1634 *        memory in a specified YCbCr format.
1635 * \param[in] surface The surface's handle.
1636 * \param[in] destination_ycbcr_format The format of the
1637 *       application's data buffers.
1638 * \param[in] destination_data Pointers to the application data
1639 *       buffers into which the image data will be written. Note
1640 *       that this is an array of pointers, one per plane. The
1641 *       destination_format parameter will define how many
1642 *       planes are required.
1643 * \param[in] destination_pitches Pointers to the pitch values
1644 *       for the application data buffers. Note that this is an
1645 *       array of pointers, one per plane. The
1646 *       destination_format parameter will define how many
1647 *       planes are required.
1648 * \return VdpStatus The completion status of the operation.
1649 */
1650typedef VdpStatus VdpVideoSurfaceGetBitsYCbCr(
1651    VdpVideoSurface  surface,
1652    VdpYCbCrFormat   destination_ycbcr_format,
1653    void * const *   destination_data,
1654    uint32_t const * destination_pitches
1655);
1656
1657/**
1658 * \brief Copy image data from application memory in a specific
1659 *        YCbCr format to a VdpVideoSurface.
1660 * \param[in] surface The surface's handle.
1661 * \param[in] source_ycbcr_format The format of the
1662 *       application's data buffers.
1663 * \param[in] source_data Pointers to the application data
1664 *       buffers from which the image data will be copied. Note
1665 *       that this is an array of pointers, one per plane. The
1666 *       source_format parameter will define how many
1667 *       planes are required.
1668 * \param[in] source_pitches Pointers to the pitch values
1669 *       for the application data buffers. Note that this is an
1670 *       array of pointers, one per plane. The
1671 *       source_format parameter will define how many
1672 *       planes are required.
1673 * \return VdpStatus The completion status of the operation.
1674 */
1675typedef VdpStatus VdpVideoSurfacePutBitsYCbCr(
1676    VdpVideoSurface      surface,
1677    VdpYCbCrFormat       source_ycbcr_format,
1678    void const * const * source_data,
1679    uint32_t const *     source_pitches
1680);
1681
1682/*@}*/
1683
1684/**
1685 * \defgroup VdpOutputSurface VdpOutputSurface; Output Surface \
1686 * object
1687 *
1688 * A VdpOutputSurface stores RGBA data in a defined format.
1689 *
1690 * A VdpOutputSurface may be filled with:
1691 * - Data provided by the CPU via the various
1692 *   VdpOutputSurfacePutBits functions.
1693 * - Using the VdpOutputSurface \ref VdpOutputSurfaceRender
1694 *   "rendering functionality".
1695 * - Using a \ref VdpVideoMixer "VdpVideoMixer" object.
1696 *
1697 * VdpOutputSurface content may be accessed by:
1698 * - The application via the various VdpOutputSurfaceGetBits
1699 *   functions.
1700 * - The Hardware that implements VdpOutputSurface
1701 *   \ref VdpOutputSurfaceRender "rendering functionality".
1702 * - The Hardware the implements \ref VdpVideoMixer
1703 *   "VdpVideoMixer" functionality.
1704 * - The Hardware that implements \ref VdpPresentationQueue
1705 *   "VdpPresentationQueue" functionality,
1706 *
1707 * VdpVideoSurfaces are directly displayable using a \ref
1708 * VdpPresentationQueue "VdpPresentationQueue" object.
1709 *
1710 * @{
1711 */
1712
1713/**
1714 * \brief The set of all known color table formats, for use with
1715 * \ref VdpOutputSurfacePutBitsIndexed.
1716 */
1717typedef uint32_t VdpColorTableFormat;
1718
1719/**
1720 * \hideinitializer
1721 * \brief 8-bit per component packed into 32-bits
1722 *
1723 * This format is an array of packed 32-bit RGB color values.
1724 * Bits [31:24] are unused, bits [23:16] contain R, bits [15:8]
1725 * contain G, and bits [7:0] contain B. Note: The format is
1726 * physically an array of uint32_t values, and should be accessed
1727 * as such by the application in order to avoid endianness
1728 * issues.
1729 */
1730#define VDP_COLOR_TABLE_FORMAT_B8G8R8X8 ((VdpColorTableFormat)0)
1731
1732/**
1733 * \brief Query the implementation's VdpOutputSurface
1734 *        capabilities.
1735 * \param[in] device The device to query.
1736 * \param[in] surface_rgba_format The surface format for
1737 *       which information is requested.
1738 * \param[out] is_supported Is this surface format supported?
1739 * \param[out] max_width The maximum supported surface width for
1740 *       this chroma type.
1741 * \param[out] max_height The maximum supported surface height
1742 *       for this chroma type.
1743 * \return VdpStatus The completion status of the operation.
1744 */
1745typedef VdpStatus VdpOutputSurfaceQueryCapabilities(
1746    VdpDevice     device,
1747    VdpRGBAFormat surface_rgba_format,
1748    /* output parameters follow */
1749    VdpBool *     is_supported,
1750    uint32_t *    max_width,
1751    uint32_t *    max_height
1752);
1753
1754/**
1755 * \brief Query the implementation's capability to perform a
1756 *        PutBits operation using application data matching the
1757 *        surface's format.
1758 * \param[in] device The device to query.
1759 * \param[in] surface_rgba_format The surface format for
1760 *       which information is requested.
1761 * \param[out] is_supported Is this surface format supported?
1762 * \return VdpStatus The completion status of the operation.
1763 */
1764typedef VdpStatus VdpOutputSurfaceQueryGetPutBitsNativeCapabilities(
1765    VdpDevice     device,
1766    VdpRGBAFormat surface_rgba_format,
1767    /* output parameters follow */
1768    VdpBool *     is_supported
1769);
1770
1771/**
1772 * \brief Query the implementation's capability to perform a
1773 *        PutBits operation using application data in a specific
1774 *        indexed format.
1775 * \param[in] device The device to query.
1776 * \param[in] surface_rgba_format The surface format for
1777 *       which information is requested.
1778 * \param[in] bits_indexed_format The format of the application
1779 *       data buffer.
1780 * \param[in] color_table_format The format of the color lookup
1781 *       table.
1782 * \param[out] is_supported Is this surface format supported?
1783 * \return VdpStatus The completion status of the operation.
1784 */
1785typedef VdpStatus VdpOutputSurfaceQueryPutBitsIndexedCapabilities(
1786    VdpDevice           device,
1787    VdpRGBAFormat       surface_rgba_format,
1788    VdpIndexedFormat    bits_indexed_format,
1789    VdpColorTableFormat color_table_format,
1790    /* output parameters follow */
1791    VdpBool *           is_supported
1792);
1793
1794/**
1795 * \brief Query the implementation's capability to perform a
1796 *        PutBits operation using application data in a specific
1797 *        YCbCr/YUB format.
1798 * \param[in] device The device to query.
1799 * \param[in] surface_rgba_format The surface format for which
1800 *       information is requested.
1801 * \param[in] bits_ycbcr_format The format of the application
1802 *       data buffer.
1803 * \param[out] is_supported Is this surface format supported?
1804 * \return VdpStatus The completion status of the operation.
1805 */
1806typedef VdpStatus VdpOutputSurfaceQueryPutBitsYCbCrCapabilities(
1807    VdpDevice      device,
1808    VdpRGBAFormat  surface_rgba_format,
1809    VdpYCbCrFormat bits_ycbcr_format,
1810    /* output parameters follow */
1811    VdpBool *      is_supported
1812);
1813
1814/**
1815 * \brief An opaque handle representing a VdpOutputSurface
1816 *        object.
1817 */
1818typedef uint32_t VdpOutputSurface;
1819
1820/**
1821 * \brief Create a VdpOutputSurface.
1822 * \param[in] device The device that will contain the surface.
1823 * \param[in] rgba_format The format of the new surface.
1824 * \param[in] width The width of the new surface.
1825 * \param[in] height The height of the new surface.
1826 * \param[out] surface The new surface's handle.
1827 * \return VdpStatus The completion status of the operation.
1828 *
1829 * The memory backing the surface will be initialized to 0 color
1830 * and 0 alpha (i.e. black.)
1831 */
1832typedef VdpStatus VdpOutputSurfaceCreate(
1833    VdpDevice          device,
1834    VdpRGBAFormat      rgba_format,
1835    uint32_t           width,
1836    uint32_t           height,
1837    /* output parameters follow */
1838    VdpOutputSurface * surface
1839);
1840
1841/**
1842 * \brief Destroy a VdpOutputSurface.
1843 * \param[in] surface The surface's handle.
1844 * \return VdpStatus The completion status of the operation.
1845 */
1846typedef VdpStatus VdpOutputSurfaceDestroy(
1847    VdpOutputSurface surface
1848);
1849
1850/**
1851 * \brief Retrieve the parameters used to create a
1852 *        VdpOutputSurface.
1853 * \param[in] surface The surface's handle.
1854 * \param[out] rgba_format The format of the surface.
1855 * \param[out] width The width of the surface.
1856 * \param[out] height The height of the surface.
1857 * \return VdpStatus The completion status of the operation.
1858 */
1859typedef VdpStatus VdpOutputSurfaceGetParameters(
1860    VdpOutputSurface surface,
1861    /* output parameters follow */
1862    VdpRGBAFormat *  rgba_format,
1863    uint32_t *       width,
1864    uint32_t *       height
1865);
1866
1867/**
1868 * \brief Copy image data from a VdpOutputSurface to application
1869 *        memory in the surface's native format.
1870 * \param[in] surface The surface's handle.
1871 * \param[in] source_rect The sub-rectangle of the source
1872 *       surface to copy. If NULL, the entire surface will be
1873 *       retrieved.
1874 * \param[in] destination_data Pointers to the application data
1875 *       buffers into which the image data will be written. Note
1876 *       that this is an array of pointers, one per plane. The
1877 *       destination_format parameter will define how many
1878 *       planes are required.
1879 * \param[in] destination_pitches Pointers to the pitch values
1880 *       for the application data buffers. Note that this is an
1881 *       array of pointers, one per plane. The
1882 *       destination_format parameter will define how many
1883 *       planes are required.
1884 * \return VdpStatus The completion status of the operation.
1885 */
1886typedef VdpStatus VdpOutputSurfaceGetBitsNative(
1887    VdpOutputSurface surface,
1888    VdpRect const *  source_rect,
1889    void * const *   destination_data,
1890    uint32_t const * destination_pitches
1891);
1892
1893/**
1894 * \brief Copy image data from application memory in the
1895 *        surface's native format to a VdpOutputSurface.
1896 * \param[in] surface The surface's handle.
1897 * \param[in] source_data Pointers to the application data
1898 *       buffers from which the image data will be copied. Note
1899 *       that this is an array of pointers, one per plane. The
1900 *       source_format parameter will define how many
1901 *       planes are required.
1902 * \param[in] source_pitches Pointers to the pitch values
1903 *       for the application data buffers. Note that this is an
1904 *       array of pointers, one per plane. The
1905 *       source_format parameter will define how many
1906 *       planes are required.
1907 * \param[in] destination_rect The sub-rectangle of the surface
1908 *       to fill with application data. If NULL, the entire
1909 *       surface will be updated.
1910 * \return VdpStatus The completion status of the operation.
1911 */
1912typedef VdpStatus VdpOutputSurfacePutBitsNative(
1913    VdpOutputSurface     surface,
1914    void const * const * source_data,
1915    uint32_t const *     source_pitches,
1916    VdpRect const *      destination_rect
1917);
1918
1919/**
1920 * \brief Copy image data from application memory in a specific
1921 *        indexed format to a VdpOutputSurface.
1922 * \param[in] surface The surface's handle.
1923 * \param[in] source_indexed_format The format of the
1924 *       application's data buffers.
1925 * \param[in] source_data Pointers to the application data
1926 *       buffers from which the image data will be copied. Note
1927 *       that this is an array of pointers, one per plane. The
1928 *       source_indexed_format parameter will define how many
1929 *       planes are required.
1930 * \param[in] source_pitches Pointers to the pitch values
1931 *       for the application data buffers. Note that this is an
1932 *       array of pointers, one per plane. The
1933 *       source_indexed_format parameter will define how many
1934 *       planes are required.
1935 * \param[in] destination_rect The sub-rectangle of the surface
1936 *       to fill with application data. If NULL, the entire
1937 *       surface will be updated.
1938 * \param[in] color_table_format The format of the color_table.
1939 * \param[in] color_table A table that maps between source index
1940 *       and target color data. See \ref VdpColorTableFormat for
1941 *       details regarding the memory layout.
1942 * \return VdpStatus The completion status of the operation.
1943 */
1944typedef VdpStatus VdpOutputSurfacePutBitsIndexed(
1945    VdpOutputSurface     surface,
1946    VdpIndexedFormat     source_indexed_format,
1947    void const * const * source_data,
1948    uint32_t const *     source_pitch,
1949    VdpRect const *      destination_rect,
1950    VdpColorTableFormat  color_table_format,
1951    void const *         color_table
1952);
1953
1954/**
1955 * \brief Copy image data from application memory in a specific
1956 *        YCbCr format to a VdpOutputSurface.
1957 * \param[in] surface The surface's handle.
1958 * \param[in] source_ycbcr_format The format of the
1959 *       application's data buffers.
1960 * \param[in] source_data Pointers to the application data
1961 *       buffers from which the image data will be copied. Note
1962 *       that this is an array of pointers, one per plane. The
1963 *       source_ycbcr_format parameter will define how many
1964 *       planes are required.
1965 * \param[in] source_pitches Pointers to the pitch values
1966 *       for the application data buffers. Note that this is an
1967 *       array of pointers, one per plane. The
1968 *       source_ycbcr_format parameter will define how many
1969 *       planes are required.
1970 * \param[in] destination_rect The sub-rectangle of the surface
1971 *       to fill with application data. If NULL, the entire
1972 *       surface will be updated.
1973 * \param[in] csc_matrix The color space conversion matrix used
1974 *       by the copy operation. If NULL, a default matrix will
1975 *       be used internally. Th default matrix is equivalent to
1976 *       ITU-R BT.601 with no procamp changes.
1977 * \return VdpStatus The completion status of the operation.
1978 */
1979typedef VdpStatus VdpOutputSurfacePutBitsYCbCr(
1980    VdpOutputSurface     surface,
1981    VdpYCbCrFormat       source_ycbcr_format,
1982    void const * const * source_data,
1983    uint32_t const *     source_pitches,
1984    VdpRect const *      destination_rect,
1985    VdpCSCMatrix const * csc_matrix
1986);
1987
1988/*@}*/
1989
1990/**
1991 * \defgroup VdpBitmapSurface VdpBitmapSurface; Bitmap Surface \
1992 * object
1993 *
1994 * A VdpBitmapSurface stores RGBA data in a defined format.
1995 *
1996 * A VdpBitmapSurface may be filled with:
1997 * - Data provided by the CPU via the \ref
1998 *   VdpBitmapSurfacePutBitsNative function.
1999 *
2000 * VdpBitmapSurface content may be accessed by:
2001 * - The Hardware that implements \ref VdpOutputSurface
2002 *   "VdpOutputSurface" \ref VdpOutputSurfaceRender
2003 *   "rendering functionality"
2004 *
2005 * VdpBitmapSurface objects are intended to store static read-only data, such
2006 * as font glyphs, and the bitmaps used to compose an applications'
2007 * user-interface.
2008 *
2009 * The primary differences between VdpBitmapSurfaces and
2010 * \ref VdpOutputSurface "VdpOutputSurface"s are:
2011 *
2012 * - You cannot render to a VdpBitmapSurface, just upload native data via
2013 *   the PutBits API.
2014 *
2015 * - The read-only nature of a VdpBitmapSurface gives the implementation more
2016 *   flexibility in its choice of data storage location for the bitmap data.
2017 *   For example, some implementations may choose to store some/all
2018 *   VdpBitmapSurface objects in system memory to relieve GPU memory pressure.
2019 *
2020 * - VdpBitmapSurface and VdpOutputSurface may support different subsets of all
2021 *   known RGBA formats.
2022 *
2023 * @{
2024 */
2025
2026/**
2027 * \brief Query the implementation's VdpBitmapSurface
2028 *        capabilities.
2029 * \param[in] device The device to query.
2030 * \param[in] surface_rgba_format The surface format for
2031 *       which information is requested.
2032 * \param[out] is_supported Is this surface format supported?
2033 * \param[out] max_width The maximum supported surface width for
2034 *       this chroma type.
2035 * \param[out] max_height The maximum supported surface height
2036 *       for this chroma type.
2037 * \return VdpStatus The completion status of the operation.
2038 */
2039typedef VdpStatus VdpBitmapSurfaceQueryCapabilities(
2040    VdpDevice     device,
2041    VdpRGBAFormat surface_rgba_format,
2042    /* output parameters follow */
2043    VdpBool *     is_supported,
2044    uint32_t *    max_width,
2045    uint32_t *    max_height
2046);
2047
2048/**
2049 * \brief An opaque handle representing a VdpBitmapSurface
2050 *        object.
2051 */
2052typedef uint32_t VdpBitmapSurface;
2053
2054/**
2055 * \brief Create a VdpBitmapSurface.
2056 * \param[in] device The device that will contain the surface.
2057 * \param[in] rgba_format The format of the new surface.
2058 * \param[in] width The width of the new surface.
2059 * \param[in] height The height of the new surface.
2060 * \param[in] frequently_accessed Is this bitmap used
2061 *       frequently, or infrequently, by compositing options?
2062 *       Implementations may use this as a hint to determine how
2063 *       to allocate the underlying storage for the surface.
2064 * \param[out] surface The new surface's handle.
2065 * \return VdpStatus The completion status of the operation.
2066 *
2067 * The memory backing the surface may not be initialized
2068 * during creation. Applications are expected initialize any
2069 * region that they use, via \ref VdpBitmapSurfacePutBitsNative.
2070 */
2071typedef VdpStatus VdpBitmapSurfaceCreate(
2072    VdpDevice          device,
2073    VdpRGBAFormat      rgba_format,
2074    uint32_t           width,
2075    uint32_t           height,
2076    VdpBool            frequently_accessed,
2077    /* output parameters follow */
2078    VdpBitmapSurface * surface
2079);
2080
2081/**
2082 * \brief Destroy a VdpBitmapSurface.
2083 * \param[in] surface The surface's handle.
2084 * \return VdpStatus The completion status of the operation.
2085 */
2086typedef VdpStatus VdpBitmapSurfaceDestroy(
2087    VdpBitmapSurface surface
2088);
2089
2090/**
2091 * \brief Retrieve the parameters used to create a
2092 *        VdpBitmapSurface.
2093 * \param[in] surface The surface's handle.
2094 * \param[out] rgba_format The format of the surface.
2095 * \param[out] width The width of the surface.
2096 * \param[out] height The height of the surface.
2097 * \param[out] frequently_accessed The frequently_accessed state
2098 *       of the surface.
2099 * \return VdpStatus The completion status of the operation.
2100 */
2101typedef VdpStatus VdpBitmapSurfaceGetParameters(
2102    VdpBitmapSurface surface,
2103    /* output parameters follow */
2104    VdpRGBAFormat *  rgba_format,
2105    uint32_t *       width,
2106    uint32_t *       height,
2107    VdpBool *        frequently_accessed
2108);
2109
2110/**
2111 * \brief Copy image data from application memory in the
2112 *        surface's native format to a VdpBitmapSurface.
2113 * \param[in] surface The surface's handle.
2114 * \param[in] source_data Pointers to the application data
2115 *       buffers from which the image data will be copied. Note
2116 *       that this is an array of pointers, one per plane. The
2117 *       source_format parameter will define how many
2118 *       planes are required.
2119 * \param[in] source_pitches Pointers to the pitch values
2120 *       for the application data buffers. Note that this is an
2121 *       array of pointers, one per plane. The
2122 *       source_format parameter will define how many
2123 *       planes are required.
2124 * \param[in] destination_rect The sub-rectangle of the surface
2125 *       to fill with application data. If NULL, the entire
2126 *       surface will be updated.
2127 * \return VdpStatus The completion status of the operation.
2128 */
2129typedef VdpStatus VdpBitmapSurfacePutBitsNative(
2130    VdpBitmapSurface     surface,
2131    void const * const * source_data,
2132    uint32_t const *     source_pitches,
2133    VdpRect const *      destination_rect
2134);
2135
2136/*@}*/
2137
2138/**
2139 * \defgroup VdpOutputSurfaceRender VdpOutputSurface Rendering \
2140 *           Functionality
2141 *
2142 * \ref VdpOutputSurface "VdpOutputSurface" objects
2143 * directly provide some rendering/compositing operations. These
2144 * are described below.
2145 *
2146 * @{
2147 */
2148
2149/**
2150 * \hideinitializer
2151 * \brief The blending equation factors.
2152 */
2153typedef enum {
2154    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ZERO                     = 0,
2155    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE                      = 1,
2156    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_SRC_COLOR                = 2,
2157    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_COLOR      = 3,
2158    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_SRC_ALPHA                = 4,
2159    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA      = 5,
2160    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_DST_ALPHA                = 6,
2161    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_DST_ALPHA      = 7,
2162    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_DST_COLOR                = 8,
2163    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_DST_COLOR      = 9,
2164    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_SRC_ALPHA_SATURATE       = 10,
2165    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_CONSTANT_COLOR           = 11,
2166    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR = 12,
2167    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_CONSTANT_ALPHA           = 13,
2168    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA = 14,
2169} VdpOutputSurfaceRenderBlendFactor;
2170
2171/**
2172 * \hideinitializer
2173 * \brief The blending equations.
2174 */
2175typedef enum {
2176    VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_SUBTRACT         = 0,
2177    VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_REVERSE_SUBTRACT = 1,
2178    VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD              = 2,
2179    VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_MIN              = 3,
2180    VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_MAX              = 4,
2181} VdpOutputSurfaceRenderBlendEquation;
2182
2183#define VDP_OUTPUT_SURFACE_RENDER_BLEND_STATE_VERSION 0
2184
2185/**
2186 * \brief Complete blending operation definition.
2187 *
2188 * A "blend state" operation controls the math behind certain rendering
2189 * operations.
2190 *
2191 * The blend math is the familiar OpenGL blend math:
2192 *     \f[
2193 *     dst.a = equation(blendFactorDstAlpha*dst.a,
2194 *     blendFactorSrcAlpha*src.a);
2195 *     \f]
2196 *     \f[
2197 *     dst.rgb = equation(blendFactorDstColor*dst.rgb,
2198 *     blendFactorSrcColor*src.rgb);
2199 *     \f]
2200 *
2201 * Note that when equation is MIN or MAX, the blend factors and constants
2202 * are ignored, and are treated as if they were 1.0.
2203 */
2204typedef struct {
2205    /**
2206     * This field must be filled with VDP_OUTPUT_SURFACE_RENDER_BLEND_STATE_VERSIION
2207     */
2208    uint32_t struct_version;
2209    VdpOutputSurfaceRenderBlendFactor   blend_factor_source_color;
2210    VdpOutputSurfaceRenderBlendFactor   blend_factor_destination_color;
2211    VdpOutputSurfaceRenderBlendFactor   blend_factor_source_alpha;
2212    VdpOutputSurfaceRenderBlendFactor   blend_factor_destination_alpha;
2213    VdpOutputSurfaceRenderBlendEquation blend_equation_color;
2214    VdpOutputSurfaceRenderBlendEquation blend_equation_alpha;
2215    VdpColor                            blend_constant;
2216} VdpOutputSurfaceRenderBlendState;
2217
2218/**
2219 * \hideinitializer
2220 * \brief Do not rotate source_surface prior to compositing.
2221 */
2222#define VDP_OUTPUT_SURFACE_RENDER_ROTATE_0   0
2223
2224/**
2225 * \hideinitializer
2226 * \brief Rotate source_surface 90 degrees clockwise prior to
2227 *        compositing.
2228 */
2229#define VDP_OUTPUT_SURFACE_RENDER_ROTATE_90  1
2230
2231/**
2232 * \hideinitializer
2233 * \brief Rotate source_surface 180 degrees prior to
2234 *        compositing.
2235 */
2236#define VDP_OUTPUT_SURFACE_RENDER_ROTATE_180 2
2237
2238/**
2239 * \hideinitializer
2240 * \brief Rotate source_surface 270 degrees clockwise prior to
2241 *        compositing.
2242 */
2243#define VDP_OUTPUT_SURFACE_RENDER_ROTATE_270 3
2244
2245/**
2246 * \hideinitializer
2247 * \brief A separate color is used for each vertex of the
2248 *        smooth-shaded quad. Hence, colors array contains 4
2249 *        elements rather than 1. See description of colors
2250 *        array.
2251 */
2252#define VDP_OUTPUT_SURFACE_RENDER_COLOR_PER_VERTEX (1 << 2)
2253
2254/**
2255 * \brief Composite a sub-rectangle of a \ref VdpOutputSurface
2256 *        "VdpOutputSurface" into a sub-rectangle of another
2257 *        \ref VdpOutputSurface VdpOutputSurface.
2258 * \param[in] destination_surface The destination surface of the
2259 *       compositing operation.
2260 * \param[in] destination_rect The sub-rectangle of the
2261 *       destination surface to update. If NULL, the entire
2262 *       destination surface will be updated.
2263 * \param[in] source_surface The source surface for the
2264 *       compositing operation. The surface is treated as having
2265 *       four components: red, green, blue and alpha. Any
2266 *       missing components are treated as 1.0. For example, for
2267 *       an A8 VdpOutputSurface, alpha will come from the surface
2268 *       but red, green and blue will be treated as 1.0. If
2269 *       source_surface is VDP_INVALID_HANDLE, all components will
2270 *       be treated as 1.0. Note that destination_surface and
2271 *       source_surface must have been allocated via the same
2272 *       \ref VdpDevice "VdpDevice".
2273 * \param[in] source_rect The sub-rectangle of the source
2274 *       surface to read from. If NULL, the entire
2275 *       source_surface will be read. Left/right and/or top/bottom
2276 *       co-ordinates may be swapped to flip the source. Any
2277 *       flip occurs prior to any requested rotation. Values
2278 *       from outside the source surface are valid and samples
2279 *       at those locations will be taken from the nearest edge.
2280 * \param[in] colors A pointer to an array of \ref VdpColor
2281 *      "VdpColor" objects. If the flag
2282 *      VDP_OUTPUT_SURFACE_RENDER_COLOR_PER_VERTEX is set,
2283 *      VDPAU will four entries from the array, and treat them
2284 *      as the colors corresponding to the upper-left,
2285 *      upper-right, lower-right and lower-left corners of the
2286 *      post-rotation source (i.e. indices 0, 1, 2 and 3 run
2287 *      clockwise from the upper left corner). If the flag
2288 *      VDP_OUTPUT_SURFACE_RENDER_COLOR_PER_VERTEX is not
2289 *      set, VDPAU will use the single VdpColor for all four
2290 *      corners. If colors is NULL then red, green, blue and
2291 *      alpha values of 1.0 will be used.
2292 * \param[in] blend_state If a blend state is provided, the
2293 *     blend state will be used for the composite operation. If
2294 *     NULL, blending is effectively disabled, which is
2295 *     equivalent to a blend equation of ADD, source blend
2296 *     factors of ONE and destination blend factors of ZERO.
2297 *     See \ref VdpOutputSurfaceRenderBlendState for details
2298 *     regarding the mathematics of the blending operation.
2299 * \param[in] flags A set of flags influencing how the
2300 *       compositing operation works.
2301 * \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_0
2302 * \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_90
2303 * \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_180
2304 * \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_270
2305 * \arg \ref VDP_OUTPUT_SURFACE_RENDER_COLOR_PER_VERTEX
2306 * \return VdpStatus The completion status of the operation.
2307 *
2308 * The general compositing pipeline is as follows.
2309 *
2310 * -# Extract source_rect from source_surface.
2311 *
2312 * -# The extracted source is rotated 0, 90, 180 or 270 degrees
2313 *    according to the flags.
2314 *
2315 * -# The rotated source is component-wise multiplied by a
2316 *    smooth-shaded quad with a (potentially) different color at
2317 *    each vertex.
2318 *
2319 * -# The resulting rotated, smooth-shaded quad is scaled to the
2320 *    size of destination_rect and composited with
2321 *    destination_surface using the provided blend state.
2322 *
2323 */
2324typedef VdpStatus VdpOutputSurfaceRenderOutputSurface(
2325    VdpOutputSurface                         destination_surface,
2326    VdpRect const *                          destination_rect,
2327    VdpOutputSurface                         source_surface,
2328    VdpRect const *                          source_rect,
2329    VdpColor const *                         colors,
2330    VdpOutputSurfaceRenderBlendState const * blend_state,
2331    uint32_t                                 flags
2332);
2333
2334/**
2335 * \brief Composite a sub-rectangle of a \ref VdpBitmapSurface
2336 *        "VdpBitmapSurface" into a sub-rectangle of a
2337 *        \ref VdpOutputSurface VdpOutputSurface.
2338 * \param[in] destination_surface The destination surface of the
2339 *       compositing operation.
2340 * \param[in] destination_rect The sub-rectangle of the
2341 *       destination surface to update. If NULL, the entire
2342 *       destination surface will be updated.
2343 * \param[in] source_surface The source surface for the
2344 *       compositing operation. The surface is treated as having
2345 *       four components: red, green, blue and alpha. Any
2346 *       missing components are treated as 1.0. For example, for
2347 *       an A8 VdpBitmapSurface, alpha will come from the surface
2348 *       but red, green and blue will be treated as 1.0. If
2349 *       source_surface is VDP_INVALID_HANDLE, all components will
2350 *       be treated as 1.0. Note that destination_surface and
2351 *       source_surface must have been allocated via the same
2352 *       \ref VdpDevice "VdpDevice".
2353 * \param[in] source_rect The sub-rectangle of the source
2354 *       surface to read from. If NULL, the entire
2355 *       source_surface will be read. Left/right ot top/bottom
2356 *       co-ordinates may be swapped to flip the source. Any
2357 *       flip occurs prior to any requested rotation. Values
2358 *       from outside the source surface are valid and samples
2359 *       at those locations will be taken from the nearest edge.
2360 * \param[in] colors A pointer to an array of \ref VdpColor
2361 *      "VdpColor" objects. If the flag
2362 *      VDP_OUTPUT_SURFACE_RENDER_COLOR_PER_VERTEX is set,
2363 *      VDPAU will four entries from the array, and treat them
2364 *      as the colors corresponding to the upper-left,
2365 *      upper-right, lower-right and lower-left corners of the
2366 *      post-rotation source (i.e. indices 0, 1, 2 and 3 run
2367 *      clockwise from the upper left corner). If the flag
2368 *      VDP_OUTPUT_SURFACE_RENDER_COLOR_PER_VERTEX is not
2369 *      set, VDPAU will use the single VdpColor for all four
2370 *      corners. If colors is NULL then red, green, blue and
2371 *      alpha values of 1.0 will be used.
2372 * \param[in] blend_state If a blend state is provided, the
2373 *     blend state will be used for the composite operation. If
2374 *     NULL, blending is effectively disabled, which is
2375 *     equivalent to a blend equation of ADD, source blend
2376 *     factors of ONE and destination blend factors of ZERO.
2377 *     See \ref VdpOutputSurfaceRenderBlendState for details
2378 *     regarding the mathematics of the blending operation.
2379 * \param[in] flags A set of flags influencing how the
2380 *       compositing operation works.
2381 * \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_0
2382 * \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_90
2383 * \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_180
2384 * \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_270
2385 * \arg \ref VDP_OUTPUT_SURFACE_RENDER_COLOR_PER_VERTEX
2386 * \return VdpStatus The completion status of the operation.
2387 *
2388 * The general compositing pipeline is as follows.
2389 *
2390 * -# Extract source_rect from source_surface.
2391 *
2392 * -# The extracted source is rotated 0, 90, 180 or 270 degrees
2393 *   according to the flags.
2394 *
2395 * -# The rotated source is component-wise multiplied by a
2396 *    smooth-shaded quad with a (potentially) different color at
2397 *    each vertex.
2398 *
2399 * -# The resulting rotated, smooth-shaded quad is scaled to the
2400 *    size of destination_rect and composited with
2401 *    destination_surface using the provided blend state.
2402 *
2403 */
2404typedef VdpStatus VdpOutputSurfaceRenderBitmapSurface(
2405    VdpOutputSurface                         destination_surface,
2406    VdpRect const *                          destination_rect,
2407    VdpBitmapSurface                         source_surface,
2408    VdpRect const *                          source_rect,
2409    VdpColor const *                         colors,
2410    VdpOutputSurfaceRenderBlendState const * blend_state,
2411    uint32_t                                 flags
2412);
2413
2414/*@}*/
2415
2416/**
2417 * \defgroup VdpDecoder VdpDecoder; Video Decoding object
2418 *
2419 * The VdpDecoder object decodes compressed video data, writing
2420 * the results to a \ref VdpVideoSurface "VdpVideoSurface".
2421 *
2422 * A specific VDPAU implementation may support decoding multiple
2423 * types of compressed video data. However, VdpDecoder objects
2424 * are able to decode a specific type of compressed video data.
2425 * This type must be specified during creation.
2426 *
2427 * @{
2428 */
2429
2430/**
2431 * \brief The set of all known compressed video formats, and
2432 *        associated profiles, that may be decoded.
2433 */
2434typedef uint32_t VdpDecoderProfile;
2435
2436/** \hideinitializer */
2437#define VDP_DECODER_PROFILE_MPEG1                       ((VdpDecoderProfile)0)
2438/** \hideinitializer */
2439#define VDP_DECODER_PROFILE_MPEG2_SIMPLE                ((VdpDecoderProfile)1)
2440/** \hideinitializer */
2441#define VDP_DECODER_PROFILE_MPEG2_MAIN                  ((VdpDecoderProfile)2)
2442/** \hideinitializer */
2443/** \brief MPEG 4 part 10 == H.264 == AVC */
2444#define VDP_DECODER_PROFILE_H264_BASELINE               ((VdpDecoderProfile)6)
2445/** \hideinitializer */
2446#define VDP_DECODER_PROFILE_H264_MAIN                   ((VdpDecoderProfile)7)
2447/** \hideinitializer */
2448#define VDP_DECODER_PROFILE_H264_HIGH                   ((VdpDecoderProfile)8)
2449/** \hideinitializer */
2450#define VDP_DECODER_PROFILE_VC1_SIMPLE                  ((VdpDecoderProfile)9)
2451/** \hideinitializer */
2452#define VDP_DECODER_PROFILE_VC1_MAIN                    ((VdpDecoderProfile)10)
2453/** \hideinitializer */
2454#define VDP_DECODER_PROFILE_VC1_ADVANCED                ((VdpDecoderProfile)11)
2455/** \hideinitializer */
2456#define VDP_DECODER_PROFILE_MPEG4_PART2_SP              ((VdpDecoderProfile)12)
2457/** \hideinitializer */
2458#define VDP_DECODER_PROFILE_MPEG4_PART2_ASP             ((VdpDecoderProfile)13)
2459/** \hideinitializer */
2460#define VDP_DECODER_PROFILE_DIVX4_QMOBILE               ((VdpDecoderProfile)14)
2461/** \hideinitializer */
2462#define VDP_DECODER_PROFILE_DIVX4_MOBILE                ((VdpDecoderProfile)15)
2463/** \hideinitializer */
2464#define VDP_DECODER_PROFILE_DIVX4_HOME_THEATER          ((VdpDecoderProfile)16)
2465/** \hideinitializer */
2466#define VDP_DECODER_PROFILE_DIVX4_HD_1080P              ((VdpDecoderProfile)17)
2467/** \hideinitializer */
2468#define VDP_DECODER_PROFILE_DIVX5_QMOBILE               ((VdpDecoderProfile)18)
2469/** \hideinitializer */
2470#define VDP_DECODER_PROFILE_DIVX5_MOBILE                ((VdpDecoderProfile)19)
2471/** \hideinitializer */
2472#define VDP_DECODER_PROFILE_DIVX5_HOME_THEATER          ((VdpDecoderProfile)20)
2473/** \hideinitializer */
2474#define VDP_DECODER_PROFILE_DIVX5_HD_1080P              ((VdpDecoderProfile)21)
2475/** \hideinitializer */
2476#define VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE   ((VdpDecoderProfile)22)
2477/** \hideinitializer */
2478#define VDP_DECODER_PROFILE_H264_EXTENDED               ((VdpDecoderProfile)23)
2479/** \hideinitializer */
2480#define VDP_DECODER_PROFILE_H264_PROGRESSIVE_HIGH       ((VdpDecoderProfile)24)
2481/** \hideinitializer */
2482#define VDP_DECODER_PROFILE_H264_CONSTRAINED_HIGH       ((VdpDecoderProfile)25)
2483/** \hideinitializer */
2484/** \brief Support for 8 bit depth only */
2485#define VDP_DECODER_PROFILE_H264_HIGH_444_PREDICTIVE    ((VdpDecoderProfile)26)
2486/** \hideinitializer */
2487/** \brief MPEG-H Part 2 == H.265 == HEVC */
2488#define VDP_DECODER_PROFILE_HEVC_MAIN                   ((VdpDecoderProfile)100)
2489/** \hideinitializer */
2490#define VDP_DECODER_PROFILE_HEVC_MAIN_10                ((VdpDecoderProfile)101)
2491/** \hideinitializer */
2492#define VDP_DECODER_PROFILE_HEVC_MAIN_STILL             ((VdpDecoderProfile)102)
2493/** \hideinitializer */
2494#define VDP_DECODER_PROFILE_HEVC_MAIN_12                ((VdpDecoderProfile)103)
2495/** \hideinitializer */
2496#define VDP_DECODER_PROFILE_HEVC_MAIN_444               ((VdpDecoderProfile)104)
2497
2498/** \hideinitializer */
2499#define VDP_DECODER_LEVEL_MPEG1_NA 0
2500
2501/** \hideinitializer */
2502#define VDP_DECODER_LEVEL_MPEG2_LL   0
2503/** \hideinitializer */
2504#define VDP_DECODER_LEVEL_MPEG2_ML   1
2505/** \hideinitializer */
2506#define VDP_DECODER_LEVEL_MPEG2_HL14 2
2507/** \hideinitializer */
2508#define VDP_DECODER_LEVEL_MPEG2_HL   3
2509
2510/** \hideinitializer */
2511#define VDP_DECODER_LEVEL_H264_1     10
2512/** \hideinitializer */
2513#define VDP_DECODER_LEVEL_H264_1b    9
2514/** \hideinitializer */
2515#define VDP_DECODER_LEVEL_H264_1_1   11
2516/** \hideinitializer */
2517#define VDP_DECODER_LEVEL_H264_1_2   12
2518/** \hideinitializer */
2519#define VDP_DECODER_LEVEL_H264_1_3   13
2520/** \hideinitializer */
2521#define VDP_DECODER_LEVEL_H264_2     20
2522/** \hideinitializer */
2523#define VDP_DECODER_LEVEL_H264_2_1   21
2524/** \hideinitializer */
2525#define VDP_DECODER_LEVEL_H264_2_2   22
2526/** \hideinitializer */
2527#define VDP_DECODER_LEVEL_H264_3     30
2528/** \hideinitializer */
2529#define VDP_DECODER_LEVEL_H264_3_1   31
2530/** \hideinitializer */
2531#define VDP_DECODER_LEVEL_H264_3_2   32
2532/** \hideinitializer */
2533#define VDP_DECODER_LEVEL_H264_4     40
2534/** \hideinitializer */
2535#define VDP_DECODER_LEVEL_H264_4_1   41
2536/** \hideinitializer */
2537#define VDP_DECODER_LEVEL_H264_4_2   42
2538/** \hideinitializer */
2539#define VDP_DECODER_LEVEL_H264_5     50
2540/** \hideinitializer */
2541#define VDP_DECODER_LEVEL_H264_5_1   51
2542
2543/** \hideinitializer */
2544#define VDP_DECODER_LEVEL_VC1_SIMPLE_LOW    0
2545/** \hideinitializer */
2546#define VDP_DECODER_LEVEL_VC1_SIMPLE_MEDIUM 1
2547
2548/** \hideinitializer */
2549#define VDP_DECODER_LEVEL_VC1_MAIN_LOW    0
2550/** \hideinitializer */
2551#define VDP_DECODER_LEVEL_VC1_MAIN_MEDIUM 1
2552/** \hideinitializer */
2553#define VDP_DECODER_LEVEL_VC1_MAIN_HIGH   2
2554
2555/** \hideinitializer */
2556#define VDP_DECODER_LEVEL_VC1_ADVANCED_L0 0
2557/** \hideinitializer */
2558#define VDP_DECODER_LEVEL_VC1_ADVANCED_L1 1
2559/** \hideinitializer */
2560#define VDP_DECODER_LEVEL_VC1_ADVANCED_L2 2
2561/** \hideinitializer */
2562#define VDP_DECODER_LEVEL_VC1_ADVANCED_L3 3
2563/** \hideinitializer */
2564#define VDP_DECODER_LEVEL_VC1_ADVANCED_L4 4
2565
2566/** \hideinitializer */
2567#define VDP_DECODER_LEVEL_MPEG4_PART2_SP_L0 0
2568/** \hideinitializer */
2569#define VDP_DECODER_LEVEL_MPEG4_PART2_SP_L1 1
2570/** \hideinitializer */
2571#define VDP_DECODER_LEVEL_MPEG4_PART2_SP_L2 2
2572/** \hideinitializer */
2573#define VDP_DECODER_LEVEL_MPEG4_PART2_SP_L3 3
2574
2575/** \hideinitializer */
2576#define VDP_DECODER_LEVEL_MPEG4_PART2_ASP_L0 0
2577/** \hideinitializer */
2578#define VDP_DECODER_LEVEL_MPEG4_PART2_ASP_L1 1
2579/** \hideinitializer */
2580#define VDP_DECODER_LEVEL_MPEG4_PART2_ASP_L2 2
2581/** \hideinitializer */
2582#define VDP_DECODER_LEVEL_MPEG4_PART2_ASP_L3 3
2583/** \hideinitializer */
2584#define VDP_DECODER_LEVEL_MPEG4_PART2_ASP_L4 4
2585/** \hideinitializer */
2586#define VDP_DECODER_LEVEL_MPEG4_PART2_ASP_L5 5
2587
2588/** \hideinitializer */
2589#define VDP_DECODER_LEVEL_DIVX_NA 0
2590
2591/**
2592 * The VDPAU H.265/HEVC decoder levels correspond to the values of
2593 * general_level_idc as described in the H.265 Specification, Annex A,
2594 * Table A.1. The enumeration values are equal to thirty times the level
2595 * number.
2596 */
2597#define VDP_DECODER_LEVEL_HEVC_1         30
2598/** \hideinitializer */
2599#define VDP_DECODER_LEVEL_HEVC_2         60
2600/** \hideinitializer */
2601#define VDP_DECODER_LEVEL_HEVC_2_1       63
2602/** \hideinitializer */
2603#define VDP_DECODER_LEVEL_HEVC_3         90
2604/** \hideinitializer */
2605#define VDP_DECODER_LEVEL_HEVC_3_1       93
2606/** \hideinitializer */
2607#define VDP_DECODER_LEVEL_HEVC_4        120
2608/** \hideinitializer */
2609#define VDP_DECODER_LEVEL_HEVC_4_1      123
2610/** \hideinitializer */
2611#define VDP_DECODER_LEVEL_HEVC_5        150
2612/** \hideinitializer */
2613#define VDP_DECODER_LEVEL_HEVC_5_1      153
2614/** \hideinitializer */
2615#define VDP_DECODER_LEVEL_HEVC_5_2      156
2616/** \hideinitializer */
2617#define VDP_DECODER_LEVEL_HEVC_6        180
2618/** \hideinitializer */
2619#define VDP_DECODER_LEVEL_HEVC_6_1      183
2620/** \hideinitializer */
2621#define VDP_DECODER_LEVEL_HEVC_6_2      186
2622
2623/**
2624 * \brief Query the implementation's VdpDecoder capabilities.
2625 * \param[in] device The device to query.
2626 * \param[in] profile The decoder profile for which information is requested.
2627 * \param[out] is_supported Is this profile supported?
2628 * \param[out] max_level The maximum specification level supported for this
2629 *       profile.
2630 * \param[out] max_macroblocks The maximum supported surface size in
2631 *       macroblocks. Note that this could be greater than that dictated by
2632 *       the maximum level.
2633 * \param[out] max_width The maximum supported surface width for this profile.
2634 *       Note that this could be greater than that dictated by the maximum
2635 *       level.
2636 * \param[out] max_height The maximum supported surface height for this
2637 *       profile. Note that this could be greater than that dictated by the
2638 *       maximum level.
2639 * \return VdpStatus The completion status of the operation.
2640 */
2641typedef VdpStatus VdpDecoderQueryCapabilities(
2642    VdpDevice         device,
2643    VdpDecoderProfile profile,
2644    /* output parameters follow */
2645    VdpBool *         is_supported,
2646    uint32_t *        max_level,
2647    uint32_t *        max_macroblocks,
2648    uint32_t *        max_width,
2649    uint32_t *        max_height
2650);
2651
2652/**
2653 * \brief An opaque handle representing a VdpDecoder object.
2654 */
2655typedef uint32_t VdpDecoder;
2656
2657/**
2658 * \brief Create a VdpDecoder.
2659 * \param[in] device The device that will contain the surface.
2660 * \param[in] profile The video format the decoder will decode.
2661 * \param[in] width The width of the new surface.
2662 * \param[in] height The height of the new surface.
2663 * \param[in] max_references The maximum number of references that may be
2664 *       used by a single frame in the stream to be decoded. This parameter
2665 *       exists mainly for formats such as H.264, where different streams
2666 *       may use a different number of references. Requesting too many
2667 *       references may waste memory, but decoding should still operate
2668 *       correctly. Requesting too few references will cause decoding to
2669 *       fail.
2670 * \param[out] decoder The new decoder's handle.
2671 * \return VdpStatus The completion status of the operation.
2672 */
2673typedef VdpStatus VdpDecoderCreate(
2674    VdpDevice         device,
2675    VdpDecoderProfile profile,
2676    uint32_t          width,
2677    uint32_t          height,
2678    uint32_t          max_references,
2679    /* output parameters follow */
2680    VdpDecoder *      decoder
2681);
2682
2683/**
2684 * \brief Destroy a VdpDecoder.
2685 * \param[in] surface The decoder's handle.
2686 * \return VdpStatus The completion status of the operation.
2687 */
2688typedef VdpStatus VdpDecoderDestroy(
2689    VdpDecoder decoder
2690);
2691
2692/**
2693 * \brief Retrieve the parameters used to create a
2694 *        VdpDecoder.
2695 * \param[in] surface The surface's handle.
2696 * \param[out] profile The video format used to create the
2697 *       decoder.
2698 * \param[out] width The width of surfaces decode by the
2699 *       decoder.
2700 * \param[out] height The height of surfaces decode by the
2701 *       decoder
2702 * \return VdpStatus The completion status of the operation.
2703 */
2704typedef VdpStatus VdpDecoderGetParameters(
2705    VdpDecoder          decoder,
2706    /* output parameters follow */
2707    VdpDecoderProfile * profile,
2708    uint32_t *          width,
2709    uint32_t *          height
2710);
2711
2712#define VDP_BITSTREAM_BUFFER_VERSION 0
2713
2714/**
2715 * \brief Application data buffer containing compressed video
2716 *        data.
2717 */
2718typedef struct {
2719    /**
2720     * This field must be filled with VDP_BITSTREAM_BUFFER_VERSION
2721     */
2722    uint32_t     struct_version;
2723    /** A pointer to the bitstream data bytes */
2724    void const * bitstream;
2725    /** The number of data bytes */
2726    uint32_t     bitstream_bytes;
2727} VdpBitstreamBuffer;
2728
2729/**
2730 * \brief A generic "picture information" type.
2731 *
2732 * This type serves solely to document the expected usage of a
2733 * generic (void *) function parameter. In actual usage, the
2734 * application is expected to physically provide a pointer to an
2735 * instance of one of the "real" VdpPictureInfo* structures,
2736 * picking the type appropriate for the decoder object in
2737 * question.
2738 */
2739typedef void VdpPictureInfo;
2740
2741/**
2742 * \brief Picture parameter information for an MPEG 1 or MPEG 2
2743 *        picture.
2744 *
2745 * Note: References to bitstream fields below may refer to data literally parsed
2746 * from the bitstream, or derived from the bitstream using a mechanism described
2747 * in the specification.
2748 */
2749typedef struct {
2750    /**
2751     * Reference used by B and P frames.
2752     * Set to VDP_INVALID_HANDLE when not used.
2753     */
2754    VdpVideoSurface forward_reference;
2755    /**
2756     * Reference used by B frames.
2757     * Set to VDP_INVALID_HANDLE when not used.
2758     */
2759    VdpVideoSurface backward_reference;
2760    /** Number of slices in the bitstream provided. */
2761    uint32_t        slice_count;
2762
2763    /** \name MPEG bitstream
2764     *
2765     * Copies of the MPEG bitstream fields.
2766     * @{ */
2767    uint8_t picture_structure;
2768    uint8_t picture_coding_type;
2769    uint8_t intra_dc_precision;
2770    uint8_t frame_pred_frame_dct;
2771    uint8_t concealment_motion_vectors;
2772    uint8_t intra_vlc_format;
2773    uint8_t alternate_scan;
2774    uint8_t q_scale_type;
2775    uint8_t top_field_first;
2776    /** MPEG-1 only. For MPEG-2, set to 0. */
2777    uint8_t full_pel_forward_vector;
2778    /** MPEG-1 only. For MPEG-2, set to 0. */
2779    uint8_t full_pel_backward_vector;
2780    /** For MPEG-1, fill both horizontal and vertical entries. */
2781    uint8_t f_code[2][2];
2782    /** Convert to raster order. */
2783    uint8_t intra_quantizer_matrix[64];
2784    /** Convert to raster order. */
2785    uint8_t non_intra_quantizer_matrix[64];
2786    /** @} */
2787} VdpPictureInfoMPEG1Or2;
2788
2789/**
2790 * \brief Information about an H.264 reference frame
2791 *
2792 * Note: References to bitstream fields below may refer to data literally parsed
2793 * from the bitstream, or derived from the bitstream using a mechanism described
2794 * in the specification.
2795 */
2796typedef struct {
2797    /**
2798     * The surface that contains the reference image.
2799     * Set to VDP_INVALID_HANDLE for unused entries.
2800     */
2801    VdpVideoSurface surface;
2802    /** Is this a long term reference (else short term). */
2803    VdpBool         is_long_term;
2804    /**
2805     * Is the top field used as a reference.
2806     * Set to VDP_FALSE for unused entries.
2807     */
2808    VdpBool         top_is_reference;
2809    /**
2810     * Is the bottom field used as a reference.
2811     * Set to VDP_FALSE for unused entries.
2812     */
2813    VdpBool         bottom_is_reference;
2814    /** [0]: top, [1]: bottom */
2815    int32_t         field_order_cnt[2];
2816    /**
2817     * Copy of the H.264 bitstream field:
2818     * frame_num from slice_header for short-term references,
2819     * LongTermPicNum from decoding algorithm for long-term references.
2820     */
2821    uint16_t        frame_idx;
2822} VdpReferenceFrameH264;
2823
2824/**
2825 * \brief Picture parameter information for an H.264 picture.
2826 *
2827 * Note: The \ref referenceFrames array must contain the "DPB" as
2828 * defined by the H.264 specification. In particular, once a
2829 * reference frame has been decoded to a surface, that surface must
2830 * continue to appear in the DPB until no longer required to predict
2831 * any future frame. Once a surface is removed from the DPB, it can
2832 * no longer be used as a reference, unless decoded again.
2833 *
2834 * Also note that only surfaces previously generated using \ref
2835 * VdpDecoderRender may be used as reference frames. In particular,
2836 * surfaces filled using any "put bits" API will not work.
2837 *
2838 * Note: References to bitstream fields below may refer to data literally parsed
2839 * from the bitstream, or derived from the bitstream using a mechanism described
2840 * in the specification.
2841 *
2842 * Note: VDPAU clients must use VdpPictureInfoH264Predictive to describe the
2843 * attributes of a frame being decoded with
2844 * VDP_DECODER_PROFILE_H264_HIGH_444_PREDICTIVE.
2845 */
2846typedef struct {
2847    /** Number of slices in the bitstream provided. */
2848    uint32_t slice_count;
2849    /** [0]: top, [1]: bottom */
2850    int32_t  field_order_cnt[2];
2851    /** Will the decoded frame be used as a reference later. */
2852    VdpBool  is_reference;
2853
2854    /** \name H.264 bitstream
2855     *
2856     * Copies of the H.264 bitstream fields.
2857     * @{ */
2858    uint16_t frame_num;
2859    uint8_t  field_pic_flag;
2860    uint8_t  bottom_field_flag;
2861    uint8_t  num_ref_frames;
2862    uint8_t  mb_adaptive_frame_field_flag;
2863    uint8_t  constrained_intra_pred_flag;
2864    uint8_t  weighted_pred_flag;
2865    uint8_t  weighted_bipred_idc;
2866    uint8_t  frame_mbs_only_flag;
2867    uint8_t  transform_8x8_mode_flag;
2868    int8_t   chroma_qp_index_offset;
2869    int8_t   second_chroma_qp_index_offset;
2870    int8_t   pic_init_qp_minus26;
2871    uint8_t  num_ref_idx_l0_active_minus1;
2872    uint8_t  num_ref_idx_l1_active_minus1;
2873    uint8_t  log2_max_frame_num_minus4;
2874    uint8_t  pic_order_cnt_type;
2875    uint8_t  log2_max_pic_order_cnt_lsb_minus4;
2876    uint8_t  delta_pic_order_always_zero_flag;
2877    uint8_t  direct_8x8_inference_flag;
2878    uint8_t  entropy_coding_mode_flag;
2879    uint8_t  pic_order_present_flag;
2880    uint8_t  deblocking_filter_control_present_flag;
2881    uint8_t  redundant_pic_cnt_present_flag;
2882    /** Convert to raster order. */
2883    uint8_t scaling_lists_4x4[6][16];
2884    /** Convert to raster order. */
2885    uint8_t scaling_lists_8x8[2][64];
2886    /** @} */
2887
2888    /** See \ref VdpPictureInfoH264 for instructions regarding this field. */
2889    VdpReferenceFrameH264 referenceFrames[16];
2890} VdpPictureInfoH264;
2891
2892/**
2893 * \brief Picture parameter information for an H.264 Hi444PP picture.
2894 *
2895 * Note: VDPAU clients must use VdpPictureInfoH264Predictive to describe the
2896 * attributes of a frame being decoded with
2897 * VDP_DECODER_PROFILE_H264_HIGH_444_PREDICTIVE.
2898 *
2899 * Note: software drivers may choose to honor values of
2900 * qpprime_y_zero_transform_bypass_flag greater than 1 for internal use.
2901 */
2902typedef struct {
2903    /** \ref VdpPictureInfoH264 struct. */
2904    VdpPictureInfoH264 pictureInfo;
2905
2906    /** \name H.264 bitstream
2907     *
2908     * Copies of the H.264 bitstream fields.
2909     * @{ */
2910    /**
2911     *  0 - lossless disabled
2912     *  1 - lossless enabled
2913     */
2914    uint8_t qpprime_y_zero_transform_bypass_flag;
2915    /**
2916     *  0 - disabled
2917     *  1 - enabled
2918     */
2919    uint8_t separate_colour_plane_flag;
2920    /** @} */
2921} VdpPictureInfoH264Predictive;
2922
2923/**
2924 * \brief Picture parameter information for a VC1 picture.
2925 *
2926 * Note: References to bitstream fields below may refer to data literally parsed
2927 * from the bitstream, or derived from the bitstream using a mechanism described
2928 * in the specification.
2929 */
2930typedef struct {
2931    /**
2932     * Reference used by B and P frames.
2933     * Set to VDP_INVALID_HANDLE when not used.
2934     */
2935    VdpVideoSurface forward_reference;
2936    /**
2937     * Reference used by B frames.
2938     * Set to VDP_INVALID_HANDLE when not used.
2939     */
2940    VdpVideoSurface backward_reference;
2941
2942    /** Number of slices in the bitstream provided. */
2943    uint32_t slice_count;
2944    /** I=0, P=1, B=3, BI=4  from 7.1.1.4. */
2945    uint8_t  picture_type;
2946    /** Progressive=0, Frame-interlace=2, Field-interlace=3; see VC-1 7.1.1.15. */
2947    uint8_t  frame_coding_mode;
2948
2949    /** \name VC-1 bitstream
2950     *
2951     * Copies of the VC-1 bitstream fields.
2952     * @{ */
2953    /** See VC-1 6.1.5. */
2954    uint8_t postprocflag;
2955    /** See VC-1 6.1.8. */
2956    uint8_t pulldown;
2957    /** See VC-1 6.1.9. */
2958    uint8_t interlace;
2959    /** See VC-1 6.1.10. */
2960    uint8_t tfcntrflag;
2961    /** See VC-1 6.1.11. */
2962    uint8_t finterpflag;
2963    /** See VC-1 6.1.3. */
2964    uint8_t psf;
2965    /** See VC-1 6.2.8. */
2966    uint8_t dquant;
2967    /** See VC-1 6.2.3. */
2968    uint8_t panscan_flag;
2969    /** See VC-1 6.2.4. */
2970    uint8_t refdist_flag;
2971    /** See VC-1 6.2.11. */
2972    uint8_t quantizer;
2973    /** See VC-1 6.2.7. */
2974    uint8_t extended_mv;
2975    /** See VC-1 6.2.14. */
2976    uint8_t extended_dmv;
2977    /** See VC-1 6.2.10. */
2978    uint8_t overlap;
2979    /** See VC-1 6.2.9. */
2980    uint8_t vstransform;
2981    /** See VC-1 6.2.5. */
2982    uint8_t loopfilter;
2983    /** See VC-1 6.2.6. */
2984    uint8_t fastuvmc;
2985    /** See VC-1 6.12.15. */
2986    uint8_t range_mapy_flag;
2987    uint8_t range_mapy;
2988    /** See VC-1 6.2.16. */
2989    uint8_t range_mapuv_flag;
2990    uint8_t range_mapuv;
2991
2992    /**
2993     * See VC-1 J.1.10.
2994     * Only used by simple and main profiles.
2995     */
2996    uint8_t multires;
2997    /**
2998     * See VC-1 J.1.16.
2999     * Only used by simple and main profiles.
3000     */
3001    uint8_t syncmarker;
3002    /**
3003     * VC-1 SP/MP range reduction control.
3004     * Only used by simple and main profiles.
3005     * Bit 0: Copy of rangered VC-1 bitstream field; See VC-1 J.1.17.
3006     * Bit 1: Copy of rangeredfrm VC-1 bitstream fiels; See VC-1 7.1.13.
3007     */
3008    uint8_t rangered;
3009    /**
3010     * See VC-1 J.1.17.
3011     * Only used by simple and main profiles.
3012     */
3013    uint8_t maxbframes;
3014    /** @} */
3015
3016    /**
3017     * Out-of-loop deblocking enable.
3018     * Bit 0 of POSTPROC from VC-1 7.1.1.27
3019     * Note that bit 1 of POSTPROC (dering enable) should not be included.
3020     */
3021    uint8_t deblockEnable;
3022    /**
3023     * Parameter used by VC-1 Annex H deblocking algorithm. Note that VDPAU
3024     * implementations may choose which deblocking algorithm to use.
3025     * See VC-1 7.1.1.6
3026     */
3027    uint8_t pquant;
3028} VdpPictureInfoVC1;
3029
3030/**
3031 * \brief Picture parameter information for an MPEG-4 Part 2 picture.
3032 *
3033 * Note: References to bitstream fields below may refer to data literally parsed
3034 * from the bitstream, or derived from the bitstream using a mechanism described
3035 * in the specification.
3036 */
3037typedef struct {
3038    /**
3039     * Reference used by B and P frames.
3040     * Set to VDP_INVALID_HANDLE when not used.
3041     */
3042    VdpVideoSurface forward_reference;
3043    /**
3044     * Reference used by B frames.
3045     * Set to VDP_INVALID_HANDLE when not used.
3046     */
3047    VdpVideoSurface backward_reference;
3048
3049    /** \name MPEG 4 part 2 bitstream
3050     *
3051     * Copies of the MPEG 4 part 2 bitstream fields.
3052     * @{ */
3053    int32_t trd[2];
3054    int32_t trb[2];
3055    uint16_t vop_time_increment_resolution;
3056    uint8_t vop_coding_type;
3057    uint8_t vop_fcode_forward;
3058    uint8_t vop_fcode_backward;
3059    uint8_t resync_marker_disable;
3060    uint8_t interlaced;
3061    uint8_t quant_type;
3062    uint8_t quarter_sample;
3063    uint8_t short_video_header;
3064    /** Derived from vop_rounding_type bitstream field. */
3065    uint8_t rounding_control;
3066    uint8_t alternate_vertical_scan_flag;
3067    uint8_t top_field_first;
3068    uint8_t intra_quantizer_matrix[64];
3069    uint8_t non_intra_quantizer_matrix[64];
3070    /** @} */
3071} VdpPictureInfoMPEG4Part2;
3072
3073/**
3074 * \brief Picture parameter information for a DivX 4 picture.
3075 *
3076 * Due to similarites between MPEG-4 Part 2 and DivX 4, the picture
3077 * parameter structure is re-used.
3078 */
3079typedef VdpPictureInfoMPEG4Part2 VdpPictureInfoDivX4;
3080
3081/**
3082 * \brief Picture parameter information for a DivX 5 picture.
3083 *
3084 * Due to similarites between MPEG-4 Part 2 and DivX 5, the picture
3085 * parameter structure is re-used.
3086 */
3087typedef VdpPictureInfoMPEG4Part2 VdpPictureInfoDivX5;
3088
3089/**
3090 * \brief Picture parameter information for an H.265/HEVC picture.
3091 *
3092 * References to bitsream fields below may refer to data literally parsed from
3093 * the bitstream, or derived from the bitstream using a mechanism described in
3094 * Rec. ITU-T H.265 (04/2013), hereafter referred to as "the H.265/HEVC
3095 * Specification".
3096 *
3097 * VDPAU H.265/HEVC implementations implement the portion of the decoding
3098 * process described by clauses 8.4, 8.5, 8.6 and 8.7 of the the
3099 * H.265/HEVC Specification. VdpPictureInfoHEVC provides enough data
3100 * to complete this portion of the decoding process, plus additional
3101 * information not defined in the H.265/HEVC Specification that may be
3102 * useful to particular implementations.
3103 *
3104 * Client applications must supply every field in this struct.
3105 */
3106typedef struct {
3107    /** \name HEVC Sequence Parameter Set
3108     *
3109     * Copies of the HEVC Sequence Parameter Set bitstream fields.
3110     * @{ */
3111    uint8_t chroma_format_idc;
3112    /** Only valid if chroma_format_idc == 3. Ignored otherwise.*/
3113    uint8_t separate_colour_plane_flag;
3114    uint32_t pic_width_in_luma_samples;
3115    uint32_t pic_height_in_luma_samples;
3116    uint8_t bit_depth_luma_minus8;
3117    uint8_t bit_depth_chroma_minus8;
3118    uint8_t log2_max_pic_order_cnt_lsb_minus4;
3119    /** Provides the value corresponding to the nuh_temporal_id of the frame
3120        to be decoded. */
3121    uint8_t sps_max_dec_pic_buffering_minus1;
3122    uint8_t log2_min_luma_coding_block_size_minus3;
3123    uint8_t log2_diff_max_min_luma_coding_block_size;
3124    uint8_t log2_min_transform_block_size_minus2;
3125    uint8_t log2_diff_max_min_transform_block_size;
3126    uint8_t max_transform_hierarchy_depth_inter;
3127    uint8_t max_transform_hierarchy_depth_intra;
3128    uint8_t scaling_list_enabled_flag;
3129    /** Scaling lists, in diagonal order, to be used for this frame. */
3130    /** Scaling List for 4x4 quantization matrix,
3131       indexed as ScalingList4x4[matrixId][i]. */
3132    uint8_t ScalingList4x4[6][16];
3133    /** Scaling List for 8x8 quantization matrix,
3134       indexed as ScalingList8x8[matrixId][i]. */
3135    uint8_t ScalingList8x8[6][64];
3136    /** Scaling List for 16x16 quantization matrix,
3137       indexed as ScalingList16x16[matrixId][i]. */
3138    uint8_t ScalingList16x16[6][64];
3139    /** Scaling List for 32x32 quantization matrix,
3140       indexed as ScalingList32x32[matrixId][i]. */
3141    uint8_t ScalingList32x32[2][64];
3142    /** Scaling List DC Coefficients for 16x16,
3143       indexed as ScalingListDCCoeff16x16[matrixId]. */
3144    uint8_t ScalingListDCCoeff16x16[6];
3145    /** Scaling List DC Coefficients for 32x32,
3146       indexed as ScalingListDCCoeff32x32[matrixId]. */
3147    uint8_t ScalingListDCCoeff32x32[2];
3148    uint8_t amp_enabled_flag;
3149    uint8_t sample_adaptive_offset_enabled_flag;
3150    uint8_t pcm_enabled_flag;
3151    /** Only needs to be set if pcm_enabled_flag is set. Ignored otherwise. */
3152    uint8_t pcm_sample_bit_depth_luma_minus1;
3153    /** Only needs to be set if pcm_enabled_flag is set. Ignored otherwise. */
3154    uint8_t pcm_sample_bit_depth_chroma_minus1;
3155    /** Only needs to be set if pcm_enabled_flag is set. Ignored otherwise. */
3156    uint8_t log2_min_pcm_luma_coding_block_size_minus3;
3157    /** Only needs to be set if pcm_enabled_flag is set. Ignored otherwise. */
3158    uint8_t log2_diff_max_min_pcm_luma_coding_block_size;
3159    /** Only needs to be set if pcm_enabled_flag is set. Ignored otherwise. */
3160    uint8_t pcm_loop_filter_disabled_flag;
3161    /** Per spec, when zero, assume short_term_ref_pic_set_sps_flag
3162        is also zero. */
3163    uint8_t num_short_term_ref_pic_sets;
3164    uint8_t long_term_ref_pics_present_flag;
3165    /** Only needed if long_term_ref_pics_present_flag is set. Ignored
3166        otherwise. */
3167    uint8_t num_long_term_ref_pics_sps;
3168    uint8_t sps_temporal_mvp_enabled_flag;
3169    uint8_t strong_intra_smoothing_enabled_flag;
3170    /** @} */
3171
3172    /** \name HEVC Picture Parameter Set
3173     *
3174     * Copies of the HEVC Picture Parameter Set bitstream fields.
3175     * @{ */
3176    uint8_t dependent_slice_segments_enabled_flag;
3177    uint8_t output_flag_present_flag;
3178    uint8_t num_extra_slice_header_bits;
3179    uint8_t sign_data_hiding_enabled_flag;
3180    uint8_t cabac_init_present_flag;
3181    uint8_t num_ref_idx_l0_default_active_minus1;
3182    uint8_t num_ref_idx_l1_default_active_minus1;
3183    int8_t init_qp_minus26;
3184    uint8_t constrained_intra_pred_flag;
3185    uint8_t transform_skip_enabled_flag;
3186    uint8_t cu_qp_delta_enabled_flag;
3187    /** Only needed if cu_qp_delta_enabled_flag is set. Ignored otherwise. */
3188    uint8_t diff_cu_qp_delta_depth;
3189    int8_t pps_cb_qp_offset;
3190    int8_t pps_cr_qp_offset;
3191    uint8_t pps_slice_chroma_qp_offsets_present_flag;
3192    uint8_t weighted_pred_flag;
3193    uint8_t weighted_bipred_flag;
3194    uint8_t transquant_bypass_enabled_flag;
3195    uint8_t tiles_enabled_flag;
3196    uint8_t entropy_coding_sync_enabled_flag;
3197    /** Only valid if tiles_enabled_flag is set. Ignored otherwise. */
3198    uint8_t num_tile_columns_minus1;
3199    /** Only valid if tiles_enabled_flag is set. Ignored otherwise. */
3200    uint8_t num_tile_rows_minus1;
3201    /** Only valid if tiles_enabled_flag is set. Ignored otherwise. */
3202    uint8_t uniform_spacing_flag;
3203    /** Only need to set 0..num_tile_columns_minus1. The struct
3204        definition reserves up to the maximum of 20. Invalid values are
3205        ignored. */
3206    uint16_t column_width_minus1[20];
3207    /** Only need to set 0..num_tile_rows_minus1. The struct
3208        definition reserves up to the maximum of 22. Invalid values are
3209        ignored.*/
3210    uint16_t row_height_minus1[22];
3211    /** Only needed if tiles_enabled_flag is set. Invalid values are
3212        ignored. */
3213    uint8_t loop_filter_across_tiles_enabled_flag;
3214    uint8_t pps_loop_filter_across_slices_enabled_flag;
3215    uint8_t deblocking_filter_control_present_flag;
3216    /** Only valid if deblocking_filter_control_present_flag is set. Ignored
3217        otherwise. */
3218    uint8_t deblocking_filter_override_enabled_flag;
3219    /** Only valid if deblocking_filter_control_present_flag is set. Ignored
3220        otherwise. */
3221    uint8_t pps_deblocking_filter_disabled_flag;
3222    /** Only valid if deblocking_filter_control_present_flag is set and
3223        pps_deblocking_filter_disabled_flag is not set. Ignored otherwise.*/
3224    int8_t pps_beta_offset_div2;
3225    /** Only valid if deblocking_filter_control_present_flag is set and
3226        pps_deblocking_filter_disabled_flag is not set. Ignored otherwise. */
3227    int8_t pps_tc_offset_div2;
3228    uint8_t lists_modification_present_flag;
3229    uint8_t log2_parallel_merge_level_minus2;
3230    uint8_t slice_segment_header_extension_present_flag;
3231
3232    /** \name HEVC Slice Segment Header
3233     *
3234     * Copies of the HEVC Slice Segment Header bitstream fields and calculated
3235     * values detailed in the specification.
3236     * @{ */
3237    /** Set to 1 if nal_unit_type is equal to IDR_W_RADL or IDR_N_LP.
3238        Set to zero otherwise. */
3239    uint8_t IDRPicFlag;
3240    /** Set to 1 if nal_unit_type in the range of BLA_W_LP to
3241        RSV_IRAP_VCL23, inclusive. Set to zero otherwise.*/
3242    uint8_t RAPPicFlag;
3243    /** See section 7.4.7.1 of the specification. */
3244    uint8_t CurrRpsIdx;
3245    /** See section 7.4.7.2 of the specification. */
3246    uint32_t NumPocTotalCurr;
3247    /** Corresponds to specification field, NumDeltaPocs[RefRpsIdx].
3248        Only applicable when short_term_ref_pic_set_sps_flag == 0.
3249        Implementations will ignore this value in other cases. See 7.4.8. */
3250    uint32_t NumDeltaPocsOfRefRpsIdx;
3251    /** Section 7.6.3.1 of the H.265/HEVC Specification defines the syntax of
3252        the slice_segment_header. This header contains information that
3253        some VDPAU implementations may choose to skip. The VDPAU API
3254        requires client applications to track the number of bits used in the
3255        slice header for structures associated with short term and long term
3256        reference pictures. First, VDPAU requires the number of bits used by
3257        the short_term_ref_pic_set array in the slice_segment_header. */
3258    uint32_t NumShortTermPictureSliceHeaderBits;
3259    /** Second, VDPAU requires the number of bits used for long term reference
3260        pictures in the slice_segment_header. This is equal to the number
3261        of bits used for the contents of the block beginning with
3262        "if(long_term_ref_pics_present_flag)". */
3263    uint32_t NumLongTermPictureSliceHeaderBits;
3264    /** @} */
3265
3266    /** Slice Decoding Process - Picture Order Count */
3267    /** The value of PicOrderCntVal of the picture in the access unit
3268        containing the SEI message. The picture being decoded. */
3269    int32_t CurrPicOrderCntVal;
3270
3271    /** Slice Decoding Process - Reference Picture Sets */
3272    /** Array of video reference surfaces.
3273        Set any unused positions to VDP_INVALID_HANDLE. */
3274    VdpVideoSurface RefPics[16];
3275    /** Array of picture order counts. These correspond to positions
3276        in the RefPics array. */
3277    int32_t PicOrderCntVal[16];
3278    /** Array used to specify whether a particular RefPic is
3279        a long term reference. A value of "1" indicates a long-term
3280        reference. */
3281    uint8_t IsLongTerm[16];
3282    /** Copy of specification field, see Section 8.3.2 of the
3283        H.265/HEVC Specification. */
3284    uint8_t NumPocStCurrBefore;
3285    /** Copy of specification field, see Section 8.3.2 of the
3286        H.265/HEVC Specification. */
3287    uint8_t NumPocStCurrAfter;
3288    /** Copy of specification field, see Section 8.3.2 of the
3289        H.265/HEVC Specification. */
3290    uint8_t NumPocLtCurr;
3291    /** Reference Picture Set list, one of the short-term RPS. These
3292        correspond to positions in the RefPics array. */
3293    uint8_t RefPicSetStCurrBefore[8];
3294    /** Reference Picture Set list, one of the short-term RPS. These
3295        correspond to positions in the RefPics array. */
3296    uint8_t RefPicSetStCurrAfter[8];
3297    /** Reference Picture Set list, one of the long-term RPS. These
3298        correspond to positions in the RefPics array. */
3299    uint8_t RefPicSetLtCurr[8];
3300} VdpPictureInfoHEVC;
3301
3302/**
3303 * \brief Decode a compressed field/frame and render the result
3304 *        into a \ref VdpVideoSurface "VdpVideoSurface".
3305 * \param[in] decoder The decoder object that will perform the
3306 *       decode operation.
3307 * \param[in] target The video surface to render to.
3308 * \param[in] picture_info A (pointer to a) structure containing
3309 *       information about the picture to be decoded. Note that
3310 *       the appropriate type of VdpPictureInfo* structure must
3311 *       be provided to match to profile that the decoder was
3312 *       created for.
3313 * \param[in] bitstream_buffer_count The number of bitstream
3314 *       buffers containing compressed data for this picture.
3315 * \param[in] bitstream_buffers An array of bitstream buffers.
3316 * \return VdpStatus The completion status of the operation.
3317 *
3318 * See \ref video_mixer_usage for additional information.
3319 */
3320typedef VdpStatus VdpDecoderRender(
3321    VdpDecoder                 decoder,
3322    VdpVideoSurface            target,
3323    VdpPictureInfo const *     picture_info,
3324    uint32_t                   bitstream_buffer_count,
3325    VdpBitstreamBuffer const * bitstream_buffers
3326);
3327
3328/*@}*/
3329
3330/**
3331 * \defgroup VdpVideoMixer VdpVideoMixer; Video Post-processing \
3332 *           and Compositing object
3333 *
3334 * VdpVideoMixer can perform some subset of the following
3335 * post-processing steps on video:
3336 * - De-interlacing
3337 *   - Various types, with or without inverse telecine
3338 * - Noise-reduction
3339 * - Sharpness adjustment
3340 * - Color space conversion to RGB
3341 * - Chroma format upscaling to 4:4:4
3342 *
3343 * A VdpVideoMixer takes a source \ref VdpVideoSurface
3344 * "VdpVideoSurface" VdpVideoSurface and performs various video
3345 * processing steps on it (potentially using information from
3346 * past or future video surfaces). It scales the video and
3347 * converts it to RGB, then optionally composites it with
3348 * multiple auxiliary \ref VdpOutputSurface "VdpOutputSurface"s
3349 * before writing the result to the destination \ref
3350 * VdpOutputSurface "VdpOutputSurface".
3351 *
3352 * The video mixer compositing model is as follows:
3353 *
3354 * - A rectangle will be rendered on an output surface. No
3355 *   pixels will be rendered outside of this output rectangle.
3356 *   The contents of this rectangle will be a composite of many
3357 *   layers.
3358 *
3359 * - The first layer is the background color. The background
3360 *   color will fill the entire rectangle.
3361 *
3362 * - The second layer is the processed video which has been
3363 *   converted to RGB. These pixels will overwrite the
3364 *   background color of the first layer except where the second
3365 *   layer's rectangle does not completely cover the output
3366 *   rectangle. In those regions the background color will
3367 *   continue to show. If any portion of the second layer's
3368 *   output rectangle is outside of the output rectangle, those
3369 *   portions will be clipped.
3370 *
3371 * - The third layer contains some number of auxiliary layers
3372 *   (in the form of \ref VdpOutputSurface "VdpOutputSurface"s)
3373 *   which will be composited using the alpha value from the
3374 *   those surfaces. The compositing operations are equivalent
3375 *   to rendering with \ref VdpOutputSurfaceRenderOutputSurface
3376 *   using a source blend factor of SOURCE_ALPHA, a destination
3377 *   blend factor of ONE_MINUS_SOURCE_ALPHA and an equation of
3378 *   ADD.
3379 *
3380 * @{
3381 */
3382
3383/**
3384 * \brief A VdpVideoMixer feature that must be requested at
3385 *        creation time to be used.
3386 *
3387 * Certain advanced VdpVideoMixer features are optional, and the
3388 * ability to use those features at all must be requested when
3389 * the VdpVideoMixer object is created. Each feature is named via
3390 * a specific VdpVideoMixerFeature value.
3391 *
3392 * Once requested, these features are permanently available
3393 * within that specific VdpVideoMixer object. All features that
3394 * are not explicitly requested at creation time default to
3395 * being permanently unavailable.
3396 *
3397 * Even when requested, all features default to being initially
3398 * disabled. However, applications can subsequently enable and
3399 * disable features at any time. See \ref
3400 * VdpVideoMixerSetFeatureEnables.
3401 *
3402 * Some features allow configuration of their operation. Each
3403 * configurable item is an \ref VdpVideoMixerAttribute. These
3404 * attributes may be manipulated at any time using \ref
3405 * VdpVideoMixerSetAttributeValues.
3406 */
3407typedef uint32_t VdpVideoMixerFeature;
3408
3409/**
3410 * \hideinitializer
3411 * \brief A VdpVideoMixerFeature.
3412 *
3413 * When requested and enabled, motion adaptive temporal
3414 * deinterlacing will be used on interlaced content.
3415 *
3416 * When multiple de-interlacing options are requested and
3417 * enabled, the back-end implementation chooses the best
3418 * algorithm to apply.
3419 */
3420#define VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL         ((VdpVideoMixerFeature)0)
3421/**
3422 * \hideinitializer
3423 * \brief A VdpVideoMixerFeature.
3424 *
3425 * When requested and enabled, this enables a more advanced
3426 * version of temporal de-interlacing, that additionally uses
3427 * edge-guided spatial interpolation.
3428 *
3429 * When multiple de-interlacing options are requested and
3430 * enabled, the back-end implementation chooses the best
3431 * algorithm to apply.
3432 */
3433#define VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL ((VdpVideoMixerFeature)1)
3434/**
3435 * \hideinitializer
3436 * \brief A VdpVideoMixerFeature.
3437 *
3438 * When requested and enabled, cadence detection will be enabled
3439 * on interlaced content and the video mixer will try to extract
3440 * progressive frames from pull-down material.
3441 */
3442#define VDP_VIDEO_MIXER_FEATURE_INVERSE_TELECINE             ((VdpVideoMixerFeature)2)
3443/**
3444 * \hideinitializer
3445 * \brief A VdpVideoMixerFeature.
3446 *
3447 * When requested and enabled, a noise reduction algorithm will
3448 * be applied to the video.
3449 */
3450#define VDP_VIDEO_MIXER_FEATURE_NOISE_REDUCTION              ((VdpVideoMixerFeature)3)
3451/**
3452 * \hideinitializer
3453 * \brief A VdpVideoMixerFeature.
3454 *
3455 * When requested and enabled, a sharpening algorithm will be
3456 * applied to the video.
3457 */
3458#define VDP_VIDEO_MIXER_FEATURE_SHARPNESS                    ((VdpVideoMixerFeature)4)
3459/**
3460 * \hideinitializer
3461 * \brief A VdpVideoMixerFeature.
3462 *
3463 * When requested and enabled, the alpha of the rendered
3464 * surface, which is normally set to the alpha of the background
3465 * color, will be forced to 0.0 on pixels corresponding to
3466 * source video surface luminance values in the range specified
3467 * by attributes \ref VDP_VIDEO_MIXER_ATTRIBUTE_LUMA_KEY_MIN_LUMA
3468 * to \ref VDP_VIDEO_MIXER_ATTRIBUTE_LUMA_KEY_MAX_LUMA. This
3469 * keying is performed after scaling and de-interlacing.
3470 */
3471#define VDP_VIDEO_MIXER_FEATURE_LUMA_KEY                     ((VdpVideoMixerFeature)5)
3472/**
3473 * \hideinitializer
3474 * \brief A VdpVideoMixerFeature.
3475 *
3476 * A VDPAU implementation may support multiple scaling algorithms of
3477 * differing quality, and may potentially support a different subset
3478 * of algorithms on different hardware.
3479 *
3480 * In some cases, higher quality algorithms may require more resources
3481 * (memory size, memory bandwidth, etc.) to operate. Hence, these high
3482 * quality algorithms must be explicitly requested and enabled by the client
3483 * application. This allows applications operating in a resource-constrained
3484 * environment to have some level of control over resource usage.
3485 *
3486 * Basic scaling is always built into any video mixer, and is known as
3487 * level 0. Scaling quality increases beginning with optional level 1,
3488 * through optional level 9.
3489 *
3490 * If an application requests and enables multiple high quality scaling
3491 * algorithms, the highest level enabled scaling algorithm will be used.
3492 */
3493#define VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1      ((VdpVideoMixerFeature)11)
3494/**
3495 * \hideinitializer
3496 * \brief A VdpVideoMixerFeature.
3497 *
3498 * See \ref VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 for details.
3499 */
3500#define VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L2      ((VdpVideoMixerFeature)12)
3501/**
3502 * \hideinitializer
3503 * \brief A VdpVideoMixerFeature.
3504 *
3505 * See \ref VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 for details.
3506 */
3507#define VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L3      ((VdpVideoMixerFeature)13)
3508/**
3509 * \hideinitializer
3510 * \brief A VdpVideoMixerFeature.
3511 *
3512 * See \ref VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 for details.
3513 */
3514#define VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L4      ((VdpVideoMixerFeature)14)
3515/**
3516 * \hideinitializer
3517 * \brief A VdpVideoMixerFeature.
3518 *
3519 * See \ref VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 for details.
3520 */
3521#define VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L5      ((VdpVideoMixerFeature)15)
3522/**
3523 * \hideinitializer
3524 * \brief A VdpVideoMixerFeature.
3525 *
3526 * See \ref VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 for details.
3527 */
3528#define VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L6      ((VdpVideoMixerFeature)16)
3529/**
3530 * \hideinitializer
3531 * \brief A VdpVideoMixerFeature.
3532 *
3533 * See \ref VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 for details.
3534 */
3535#define VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L7      ((VdpVideoMixerFeature)17)
3536/**
3537 * \hideinitializer
3538 * \brief A VdpVideoMixerFeature.
3539 *
3540 * See \ref VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 for details.
3541 */
3542#define VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L8      ((VdpVideoMixerFeature)18)
3543/**
3544 * \hideinitializer
3545 * \brief A VdpVideoMixerFeature.
3546 *
3547 * See \ref VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 for details.
3548 */
3549#define VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L9      ((VdpVideoMixerFeature)19)
3550
3551/**
3552 * \brief A VdpVideoMixer creation parameter.
3553 *
3554 * When a VdpVideoMixer is created, certain parameters may be
3555 * supplied. Each parameter is named via a specific
3556 * VdpVideoMixerParameter value.
3557 *
3558 * Each parameter has a specific type, and specific default
3559 * value if not specified at VdpVideoMixer creation time. The
3560 * application may query the legal supported range for some
3561 * parameters.
3562 */
3563typedef uint32_t VdpVideoMixerParameter;
3564
3565/**
3566 * \hideinitializer
3567 * \brief The exact width of input video surfaces.
3568 *
3569 * This parameter's type is uint32_t.
3570 *
3571 * This parameter defaults to 0 if not specified, which entails
3572 * that it must be specified.
3573 *
3574 * The application may query this parameter's supported
3575 * range.
3576 */
3577#define VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_WIDTH  ((VdpVideoMixerParameter)0)
3578/**
3579 * \hideinitializer
3580 * \brief The exact height of input video surfaces.
3581 *
3582 * This parameter's type is uint32_t.
3583 *
3584 * This parameter defaults to 0 if not specified, which entails
3585 * that it must be specified.
3586 *
3587 * The application may query this parameter's supported
3588 * range.
3589 */
3590#define VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_HEIGHT ((VdpVideoMixerParameter)1)
3591/**
3592 * \hideinitializer
3593 * \brief The chroma type of the input video surfaces the will
3594 *        process.
3595 *
3596 * This parameter's type is VdpChromaType.
3597 *
3598 * If not specified, this parameter defaults to
3599 * VDP_CHROMA_TYPE_420.
3600 *
3601 * The application may not query this application's supported
3602 * range, since it is a potentially disjoint enumeration.
3603 */
3604#define VDP_VIDEO_MIXER_PARAMETER_CHROMA_TYPE          ((VdpVideoMixerParameter)2)
3605/**
3606 * \hideinitializer
3607 * \brief The number of auxiliary layers in the mixer's
3608 *        compositing model.
3609 *
3610 * Note that this indicates the maximum number of layers that
3611 * may be processed by a given \ref VdpVideoMixer "VdpVideoMixer"
3612 * object. Each individual \ref VdpVideoMixerRender invocation
3613 * may choose to use a different number of actual layers, from 0
3614 * up to this limit.
3615 *
3616 * This attribute's type is uint32_t.
3617 *
3618 * If not specified, this parameter defaults to 0.
3619 *
3620 * The application may query this parameter's supported
3621 * range.
3622 */
3623#define VDP_VIDEO_MIXER_PARAMETER_LAYERS               ((VdpVideoMixerParameter)3)
3624
3625/**
3626 * \brief An adjustable attribute of VdpVideoMixer operation.
3627 *
3628 * Various attributes of VdpVideoMixer operation may be adjusted
3629 * at any time. Each attribute is named via a specific
3630 * VdpVideoMixerAttribute value.
3631 *
3632 * Each attribute has a specific type, and specific default
3633 * value if not specified at VdpVideoMixer creation time. The
3634 * application may query the legal supported range for some
3635 * attributes.
3636 */
3637typedef uint32_t VdpVideoMixerAttribute;
3638
3639/**
3640 * \hideinitializer
3641 * \brief The background color in the VdpVideoMixer's compositing
3642 *        model.
3643 *
3644 * This attribute's type is VdpColor.
3645 *
3646 * This parameter defaults to black (all color components 0.0
3647 * and alpha 1.0).
3648 *
3649 * The application may not query this parameter's supported
3650 * range, since the type is not scalar.
3651 */
3652#define VDP_VIDEO_MIXER_ATTRIBUTE_BACKGROUND_COLOR      ((VdpVideoMixerAttribute)0)
3653/**
3654 * \hideinitializer
3655 * \brief The color-space conversion matrix used by the
3656 *        VdpVideoMixer.
3657 *
3658 * This attribute's type is \ref VdpCSCMatrix.
3659 *
3660 * Note: When using \ref VdpVideoMixerGetAttributeValues to retrieve the
3661 * current CSC matrix, the attribute_values array must contain a pointer to
3662 * a pointer a VdpCSCMatrix (VdpCSCMatrix** as a void *). The get function will
3663 * either initialize the referenced CSC matrix to the current value, *or*
3664 * clear the supplied pointer to NULL, if the previous set call supplied a
3665 * value of NULL in parameter_values, to request the default matrix.
3666 *
3667 * \code
3668 * VdpCSCMatrix   matrix;
3669 * VdpCSCMatrix * matrix_ptr;
3670 * void * attribute_values[] = {&matrix_ptr};
3671 * VdpStatus st = vdp_video_mixer_get_attribute_values(..., attribute_values, ...);
3672 * \endcode
3673 *
3674 * This parameter defaults to a matrix suitable for ITU-R BT.601
3675 * input surfaces, with no procamp adjustments.
3676 *
3677 * The application may not query this parameter's supported
3678 * range, since the type is not scalar.
3679 */
3680#define VDP_VIDEO_MIXER_ATTRIBUTE_CSC_MATRIX            ((VdpVideoMixerAttribute)1)
3681/**
3682 * \hideinitializer
3683 * \brief The amount of noise reduction algorithm to apply.
3684 *
3685 * This attribute's type is float.
3686 *
3687 * This parameter defaults to 0.0, which equates to no noise
3688 * reduction.
3689 *
3690 * The application may query this parameter's supported range.
3691 * However, the range is fixed as 0.0...1.0.
3692 */
3693#define VDP_VIDEO_MIXER_ATTRIBUTE_NOISE_REDUCTION_LEVEL ((VdpVideoMixerAttribute)2)
3694/**
3695 * \hideinitializer
3696 * \brief The amount of sharpening, or blurring, to apply.
3697 *
3698 * This attribute's type is float.
3699 *
3700 * This parameter defaults to 0.0, which equates to no
3701 * sharpening.
3702 *
3703 * Positive values request sharpening. Negative values request
3704 * blurring.
3705 *
3706 * The application may query this parameter's supported range.
3707 * However, the range is fixed as -1.0...1.0.
3708 */
3709#define VDP_VIDEO_MIXER_ATTRIBUTE_SHARPNESS_LEVEL       ((VdpVideoMixerAttribute)3)
3710/**
3711 * \hideinitializer
3712 * \brief The minimum luma value for the luma key algorithm.
3713 *
3714 * This attribute's type is float.
3715 *
3716 * This parameter defaults to 0.0.
3717 *
3718 * The application may query this parameter's supported range.
3719 * However, the range is fixed as 0.0...1.0.
3720 */
3721#define VDP_VIDEO_MIXER_ATTRIBUTE_LUMA_KEY_MIN_LUMA     ((VdpVideoMixerAttribute)4)
3722/**
3723 * \hideinitializer
3724 * \brief The maximum luma value for the luma key algorithm.
3725 *
3726 * This attribute's type is float.
3727 *
3728 * This parameter defaults to 1.0.
3729 *
3730 * The application may query this parameter's supported range.
3731 * However, the range is fixed as 0.0...1.0.
3732 */
3733#define VDP_VIDEO_MIXER_ATTRIBUTE_LUMA_KEY_MAX_LUMA     ((VdpVideoMixerAttribute)5)
3734/**
3735 * \hideinitializer
3736 * \brief Whether de-interlacers should operate solely on luma, and bob chroma.
3737 *
3738 * Note: This attribute only affects advanced de-interlacing algorithms, not
3739 * bob or weave.
3740 *
3741 * This attribute's type is uint8_t.
3742 *
3743 * This parameter defaults to 0.
3744 *
3745 * The application may query this parameter's supported range.
3746 * However, the range is fixed as 0 (no/off) ... 1 (yes/on).
3747 */
3748#define VDP_VIDEO_MIXER_ATTRIBUTE_SKIP_CHROMA_DEINTERLACE ((VdpVideoMixerAttribute)6)
3749
3750/**
3751 * \brief Query the implementation's support for a specific
3752 *        feature.
3753 * \param[in] device The device to query.
3754 * \param[in] feature The feature for which support is to be
3755 *       queried.
3756 * \param[out] is_supported Is the specified feature supported?
3757 * \return VdpStatus The completion status of the operation.
3758 */
3759typedef VdpStatus VdpVideoMixerQueryFeatureSupport(
3760    VdpDevice            device,
3761    VdpVideoMixerFeature feature,
3762    /* output parameters follow */
3763    VdpBool *            is_supported
3764);
3765
3766/**
3767 * \brief Query the implementation's support for a specific
3768 *        parameter.
3769 * \param[in] device The device to query.
3770 * \param[in] parameter The parameter for which support is to be
3771 *       queried.
3772 * \param[out] is_supported Is the specified parameter
3773 *       supported?
3774 * \return VdpStatus The completion status of the operation.
3775 */
3776typedef VdpStatus VdpVideoMixerQueryParameterSupport(
3777    VdpDevice              device,
3778    VdpVideoMixerParameter parameter,
3779    /* output parameters follow */
3780    VdpBool *              is_supported
3781);
3782
3783/**
3784 * \brief Query the implementation's support for a specific
3785 *        attribute.
3786 * \param[in] device The device to query.
3787 * \param[in] feature The feature for which support is to be
3788 *       queried.
3789 * \param[out] is_supported Is the specified feature supported?
3790 * \return VdpStatus The completion status of the operation.
3791 */
3792typedef VdpStatus VdpVideoMixerQueryAttributeSupport(
3793    VdpDevice              device,
3794    VdpVideoMixerAttribute attribute,
3795    /* output parameters follow */
3796    VdpBool *              is_supported
3797);
3798
3799/**
3800 * \brief Query the implementation's supported for a specific
3801 *        parameter.
3802 * \param[in] device The device to query.
3803 * \param[in] parameter The parameter for which support is to be
3804 *       queried.
3805 * \param[out] min_value The minimum supported value.
3806 * \param[out] max_value The maximum supported value.
3807 * \return VdpStatus The completion status of the operation.
3808 */
3809typedef VdpStatus VdpVideoMixerQueryParameterValueRange(
3810    VdpDevice              device,
3811    VdpVideoMixerParameter parameter,
3812    /* output parameters follow */
3813    void *                min_value,
3814    void *                max_value
3815);
3816
3817/**
3818 * \brief Query the implementation's supported for a specific
3819 *        attribute.
3820 * \param[in] device The device to query.
3821 * \param[in] attribute The attribute for which support is to be
3822 *       queried.
3823 * \param[out] min_value The minimum supported value.
3824 * \param[out] max_value The maximum supported value.
3825 * \return VdpStatus The completion status of the operation.
3826 */
3827typedef VdpStatus VdpVideoMixerQueryAttributeValueRange(
3828    VdpDevice              device,
3829    VdpVideoMixerAttribute attribute,
3830    /* output parameters follow */
3831    void *                min_value,
3832    void *                max_value
3833);
3834
3835/**
3836 * \brief An opaque handle representing a VdpVideoMixer object.
3837 */
3838typedef uint32_t VdpVideoMixer;
3839
3840/**
3841 * \brief Create a VdpVideoMixer.
3842 * \param[in] device The device that will contain the mixer.
3843 * \param[in] feature_count The number of features to request.
3844 * \param[in] features The list of features to request.
3845 * \param[in] parameter_count The number of parameters to set.
3846 * \param[in] parameters The list of parameters to set.
3847 * \param[in] parameter_values The values for the parameters. Note that each
3848 *     entry in the value array is a pointer to the actual value. In other
3849 *     words, the values themselves are not cast to "void *" and passed
3850 *     "inside" the array.
3851 * \param[out] mixer The new mixer's handle.
3852 * \return VdpStatus The completion status of the operation.
3853 *
3854 * Initially, all requested features will be disabled. They can
3855 * be enabled using \ref VdpVideoMixerSetFeatureEnables.
3856 *
3857 * Initially, all attributes will have default values. Values
3858 * can be changed using \ref VdpVideoMixerSetAttributeValues.
3859 */
3860typedef VdpStatus VdpVideoMixerCreate(
3861    VdpDevice                      device,
3862    // The set of features to request
3863    uint32_t                       feature_count,
3864    VdpVideoMixerFeature const *   features,
3865    // The parameters used during creation
3866    uint32_t                       parameter_count,
3867    VdpVideoMixerParameter const * parameters,
3868    void const * const *           parameter_values,
3869    /* output parameters follow */
3870    VdpVideoMixer *                mixer
3871);
3872
3873/**
3874 * \brief Enable or disable features.
3875 * \param[in] mixer The mixer to manipulate.
3876 * \param[in] feature_count The number of features to
3877 *       enable/disable.
3878 * \param[in] features The list of features to enable/disable.
3879 * \param[in] feature_enables The list of new feature enable
3880 *       values.
3881 * \return VdpStatus The completion status of the operation.
3882 */
3883typedef VdpStatus VdpVideoMixerSetFeatureEnables(
3884    VdpVideoMixer                mixer,
3885    uint32_t                     feature_count,
3886    VdpVideoMixerFeature const * features,
3887    VdpBool const *              feature_enables
3888);
3889
3890/**
3891 * \brief Set attribute values
3892 * \param[in] mixer The mixer to manipulate.
3893 * \param[in] attribute_count The number of attributes to set.
3894 * \param[in] attributes The list of attributes to set.
3895 * \param[in] attribute_values The values for the attributes. Note that each
3896 *     entry in the value array is a pointer to the actual value. In other
3897 *     words, the values themselves are not cast to "void *" and passed
3898 *     "inside" the array. A NULL pointer requests that the default value be
3899 *     set for that attribute.
3900 * \return VdpStatus The completion status of the operation.
3901 */
3902typedef VdpStatus VdpVideoMixerSetAttributeValues(
3903    VdpVideoMixer                  mixer,
3904    uint32_t                       attribute_count,
3905    VdpVideoMixerAttribute const * attributes,
3906    void const * const *           attribute_values
3907);
3908
3909/**
3910 * \brief Retrieve whether features were requested at creation
3911 *        time.
3912 * \param[in] mixer The mixer to query.
3913 * \param[in] feature_count The number of features to query.
3914 * \param[in] features The list of features to query.
3915 * \param[out] feature_supported A list of values indicating
3916 *       whether the feature was requested, and hence is
3917 *       available.
3918 * \return VdpStatus The completion status of the operation.
3919 */
3920typedef VdpStatus VdpVideoMixerGetFeatureSupport(
3921    VdpVideoMixer                mixer,
3922    uint32_t                     feature_count,
3923    VdpVideoMixerFeature const * features,
3924    /* output parameters follow */
3925    VdpBool *                    feature_supports
3926);
3927
3928/**
3929 * \brief Retrieve whether features are enabled.
3930 * \param[in] mixer The mixer to manipulate.
3931 * \param[in] feature_count The number of features to query.
3932 * \param[in] features The list of features to query.
3933 * \param[out] feature_enabled A list of values indicating
3934 *       whether the feature is enabled.
3935 * \return VdpStatus The completion status of the operation.
3936 */
3937typedef VdpStatus VdpVideoMixerGetFeatureEnables(
3938    VdpVideoMixer                mixer,
3939    uint32_t                     feature_count,
3940    VdpVideoMixerFeature const * features,
3941    /* output parameters follow */
3942    VdpBool *                    feature_enables
3943);
3944
3945/**
3946 * \brief Retrieve parameter values given at creation time.
3947 * \param[in] mixer The mixer to manipulate.
3948 * \param[in] parameter_count The number of parameters to query.
3949 * \param[in] parameters The list of parameters to query.
3950 * \param[out] parameter_values The list of current values for
3951 *     the parameters. Note that each entry in the value array is a pointer to
3952 *     storage that will receive the actual value. If the attribute's type is
3953 *     a pointer itself, please closely read the documentation for that
3954 *     attribute type for any other data passing requirements.
3955 * \return VdpStatus The completion status of the operation.
3956 */
3957typedef VdpStatus VdpVideoMixerGetParameterValues(
3958    VdpVideoMixer                  mixer,
3959    uint32_t                       parameter_count,
3960    VdpVideoMixerParameter const * parameters,
3961    /* output parameters follow */
3962    void * const *                 parameter_values
3963);
3964
3965/**
3966 * \brief Retrieve current attribute values.
3967 * \param[in] mixer The mixer to manipulate.
3968 * \param[in] attribute_count The number of attributes to query.
3969 * \param[in] attributes The list of attributes to query.
3970 * \param[out] attribute_values The list of current values for
3971 *     the attributes. Note that each entry in the value array is a pointer to
3972 *     storage that will receive the actual value. If the attribute's type is
3973 *     a pointer itself, please closely read the documentation for that
3974 *     attribute type for any other data passing requirements.
3975 * \return VdpStatus The completion status of the operation.
3976 */
3977typedef VdpStatus VdpVideoMixerGetAttributeValues(
3978    VdpVideoMixer                  mixer,
3979    uint32_t                       attribute_count,
3980    VdpVideoMixerAttribute const * attributes,
3981    /* output parameters follow */
3982    void * const *                 attribute_values
3983);
3984
3985/**
3986 * \brief Destroy a VdpVideoMixer.
3987 * \param[in] device The device to destroy.
3988 * \return VdpStatus The completion status of the operation.
3989 */
3990typedef VdpStatus VdpVideoMixerDestroy(
3991    VdpVideoMixer mixer
3992);
3993
3994/**
3995 * \hideinitializer
3996 * \brief The structure of the picture present in a \ref
3997 *        VdpVideoSurface "VdpVideoSurface".
3998 */
3999typedef enum {
4000    /**
4001     * The picture is a field, and is the top field of the surface.
4002     */
4003    VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD,
4004    /**
4005     * The picture is a field, and is the bottom field of the
4006     * surface.
4007     */
4008    VDP_VIDEO_MIXER_PICTURE_STRUCTURE_BOTTOM_FIELD,
4009    /**
4010     * The picture is a frame, and hence is the entire surface.
4011     */
4012    VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME,
4013} VdpVideoMixerPictureStructure;
4014
4015#define VDP_LAYER_VERSION 0
4016
4017/**
4018 * \brief Definition of an additional \ref VdpOutputSurface
4019 *        "VdpOutputSurface" layer in the composting model.
4020 */
4021typedef struct {
4022    /**
4023     * This field must be filled with VDP_LAYER_VERSION
4024     */
4025    uint32_t struct_version;
4026    /**
4027     * The surface to composite from.
4028     */
4029    VdpOutputSurface source_surface;
4030    /**
4031     * The sub-rectangle of the source surface to use. If NULL, the
4032     * entire source surface will be used.
4033     */
4034    VdpRect const *  source_rect;
4035    /**
4036     * The sub-rectangle of the destination surface to map
4037     * this layer into. This rectangle is relative to the entire
4038     * destination surface. This rectangle will be clipped by \ref
4039     * VdpVideoMixerRender's \b destination_rect. If NULL, the
4040     * destination rectangle will be sized to match the source
4041     * rectangle, and will be located at the origin.
4042     */
4043     VdpRect const * destination_rect;
4044} VdpLayer;
4045
4046/**
4047 * \brief Perform a video post-processing and compositing
4048 *        operation.
4049 * \param[in] mixer The mixer object that will perform the
4050 *       mixing/rendering operation.
4051 * \param[in] background_surface A background image. If set to any value other
4052 *       than VDP_INVALID_HANDLE, the specific surface will be used instead of
4053 *       the background color as the first layer in the mixer's compositing
4054 *       process.
4055 * \param[in] background_source_rect When background_surface is specified,
4056 *       this parameter indicates the portion of background_surface that will
4057 *       be used as the background layer. The specified region will be
4058 *       extracted and scaled to match the size of destination_rect. If NULL,
4059 *       the entire background_surface will be used.
4060 * \param[in] current_picture_structure The picture structure of
4061 *       the field/frame to be processed. This field/frame is
4062 *       presented in the \b video_surface_current parameter. If
4063 *       frame, then all \b video_surface_* parameters are
4064 *       assumed to be frames. If field, then all
4065 *       video_surface_* parameters are assumed to be fields,
4066 *       with alternating top/bottom-ness derived from
4067 *       video_surface_current.
4068 * \param[in] video_surfaces_past_count The number of provided
4069 *       fields/frames prior to the current picture.
4070 * \param[in] video_surfaces_past The fields/frames prior to the
4071 *       current field/frame. Note that array index 0 is the
4072 *       field/frame temporally nearest to the current
4073 *       field/frame, with increasing array indices used for
4074 *       older frames. Unavailable entries may be set to
4075 *       \ref VDP_INVALID_HANDLE.
4076 * \param[in] video_surface_current The field/frame to be
4077 *       processed.
4078 * \param[in] video_surfaces_future_count The number of provided
4079 *       fields/frames following the current picture.
4080 * \param[in] video_surfaces_future The fields/frames that
4081 *       follow the current field/frame. Note that array index 0
4082 *       is the field/frame temporally nearest to the current
4083 *       field/frame, with increasing array indices used for
4084 *       newer frames. Unavailable entries may be set to \ref
4085 *       VDP_INVALID_HANDLE.
4086 * \param[in] video_source_rect The sub-rectangle of the source
4087 *       video surface to extract and process. If NULL, the
4088 *       entire surface will be used. Left/right and/or top/bottom
4089 *       co-ordinates may be swapped to flip the source. Values
4090 *       from outside the video surface are valid and samples
4091 *       at those locations will be taken from the nearest edge.
4092 * \param[in] destination_surface
4093 * \param[in] destination_rect The sub-rectangle of the
4094 *       destination surface to modify. Note that rectangle clips
4095 *       all other actions.
4096 * \param[in] destination_video_rect The sub-rectangle of the
4097 *       destination surface that will contain the processed
4098 *       video. This rectangle is relative to the entire
4099 *       destination surface. This rectangle is clipped by \b
4100 *       destination_rect. If NULL, the destination rectangle
4101 *       will be sized to match the source rectangle, and will
4102 *       be located at the origin.
4103 * \param[in] layer_count The number of additional layers to
4104 *       composite above the video.
4105 * \param[in] layers The array of additional layers to composite
4106 *       above the video.
4107 * \return VdpStatus The completion status of the operation.
4108 *
4109 * For a complete discussion of how to use this API, please see
4110 * \ref video_mixer_usage.
4111 */
4112typedef VdpStatus VdpVideoMixerRender(
4113    VdpVideoMixer                 mixer,
4114    VdpOutputSurface              background_surface,
4115    VdpRect const *               background_source_rect,
4116    VdpVideoMixerPictureStructure current_picture_structure,
4117    uint32_t                      video_surface_past_count,
4118    VdpVideoSurface const *       video_surface_past,
4119    VdpVideoSurface               video_surface_current,
4120    uint32_t                      video_surface_future_count,
4121    VdpVideoSurface const *       video_surface_future,
4122    VdpRect const *               video_source_rect,
4123    VdpOutputSurface              destination_surface,
4124    VdpRect const *               destination_rect,
4125    VdpRect const *               destination_video_rect,
4126    uint32_t                      layer_count,
4127    VdpLayer const *              layers
4128);
4129
4130/*@}*/
4131
4132/**
4133 * \defgroup VdpPresentationQueue VdpPresentationQueue; Video \
4134 *           presentation (display) object
4135 *
4136 * The VdpPresentationQueue manages a queue of surfaces and
4137 * associated timestamps. For each surface in the queue, once
4138 * the associated timestamp is reached, the surface is displayed
4139 * to the user. This timestamp-based approach yields high
4140 * quality video delivery.
4141 *
4142 * The exact location of the displayed content is Window System
4143 * specific. For this reason, the \ref api_winsys provides an
4144 * API to create a \ref VdpPresentationQueueTarget object (e.g.
4145 * via \ref VdpPresentationQueueTargetCreateX11) which
4146 * encapsulates this information.
4147 *
4148 * Note that the presentation queue performs no scaling of
4149 * surfaces to match the display target's size, aspect ratio,
4150 * etc.
4151 *
4152 * Surfaces that are too large to fit into the display target
4153 * will be clipped. Surfaces that are too small to fill the
4154 * display target will be aligned to the top-left corner of the
4155 * display target, with the balance of the display target being
4156 * filled with a constant configurable "background" color.
4157 *
4158 * Note that the presentation queue operates in a manner that is
4159 * semantically equivalent to an overlay surface, with any
4160 * required color key painting hidden internally. However,
4161 * implementations are free to use whatever semantically
4162 * equivalent technique they wish. Note that implementations
4163 * that actually use color-keyed overlays will typically use
4164 * the "background" color as the overlay color key value, so
4165 * this color should be chosen with care.
4166 *
4167 * @{
4168 */
4169
4170/**
4171 * \brief The representation of a point in time.
4172 *
4173 * VdpTime timestamps are intended to be a high-precision timing
4174 * system, potentially independent from any other time domain in
4175 * the system.
4176 *
4177 * Time is represented in units of nanoseconds. The origin
4178 * (i.e. the time represented by a value of 0) is implementation
4179 * dependent.
4180 */
4181typedef uint64_t VdpTime;
4182
4183/**
4184 * \brief An opaque handle representing the location where
4185 *        video will be presented.
4186 *
4187 * VdpPresentationQueueTarget are created using a \ref api_winsys
4188 * specific API, such as \ref
4189 * VdpPresentationQueueTargetCreateX11.
4190 */
4191typedef uint32_t VdpPresentationQueueTarget;
4192
4193/**
4194 * \brief Destroy a VdpPresentationQueueTarget.
4195 * \param[in] presentation_queue_target The target to destroy.
4196 * \return VdpStatus The completion status of the operation.
4197 */
4198typedef VdpStatus VdpPresentationQueueTargetDestroy(
4199    VdpPresentationQueueTarget presentation_queue_target
4200);
4201
4202/**
4203 * \brief An opaque handle representing a presentation queue
4204 *        object.
4205 */
4206typedef uint32_t VdpPresentationQueue;
4207
4208/**
4209 * \brief Create a VdpPresentationQueue.
4210 * \param[in] device The device that will contain the queue.
4211 * \param[in] presentation_queue_target The location to display
4212 *       the content.
4213 * \param[out] presentation_queue The new queue's handle.
4214 * \return VdpStatus The completion status of the operation.
4215 *
4216 * Note: The initial value for the background color will be set to
4217 * an implementation-defined value.
4218 */
4219typedef VdpStatus VdpPresentationQueueCreate(
4220    VdpDevice                  device,
4221    VdpPresentationQueueTarget presentation_queue_target,
4222    /* output parameters follow */
4223    VdpPresentationQueue *     presentation_queue
4224);
4225
4226/**
4227 * \brief Destroy a VdpPresentationQueue.
4228 * \param[in] presentation_queue The queue to destroy.
4229 * \return VdpStatus The completion status of the operation.
4230 */
4231typedef VdpStatus VdpPresentationQueueDestroy(
4232    VdpPresentationQueue presentation_queue
4233);
4234
4235/**
4236 * \brief Configure the background color setting.
4237 * \param[in] presentation_queue The queue to manipulate.
4238 * \param[in] background_color The new background color.
4239 *
4240 * Note: Implementations may choose whether to apply the
4241 * new background color value immediately, or defer it until
4242 * the next surface is presented.
4243 */
4244typedef VdpStatus VdpPresentationQueueSetBackgroundColor(
4245    VdpPresentationQueue presentation_queue,
4246    VdpColor * const     background_color
4247);
4248
4249/**
4250 * \brief Retrieve the current background color setting.
4251 * \param[in] presentation_queue The queue to query.
4252 * \param[out] background_color The current background color.
4253 */
4254typedef VdpStatus VdpPresentationQueueGetBackgroundColor(
4255    VdpPresentationQueue presentation_queue,
4256    VdpColor *           background_color
4257);
4258
4259/**
4260 * \brief Retrieve the presentation queue's "current" time.
4261 * \param[in] presentation_queue The queue to query.
4262 * \param[out] current_time The current time, which may
4263 *       represent a point between display VSYNC events.
4264 * \return VdpStatus The completion status of the operation.
4265 */
4266typedef VdpStatus VdpPresentationQueueGetTime(
4267    VdpPresentationQueue presentation_queue,
4268    /* output parameters follow */
4269    VdpTime *            current_time
4270);
4271
4272/**
4273 * \brief Enter a surface into the presentation queue.
4274 * \param[in] presentation_queue The queue to query.
4275 * \param[in] surface The surface to enter into the queue.
4276 * \param[in] clip_width If set to a non-zero value, the presentation queue
4277 *       will display only clip_width pixels of the surface (anchored to the
4278 *       top-left corner of the surface.
4279 * \param[in] clip_height If set to a non-zero value, the presentation queue
4280 *       will display only clip_height lines of the surface (anchored to the
4281 *       top-left corner of the surface.
4282 * \param[in] earliest_presentation_time The timestamp
4283 *       associated with the surface. The presentation queue
4284 *       will not display the surface until the presentation
4285 *       queue's current time is at least this value.
4286 * \return VdpStatus The completion status of the operation.
4287 *
4288 * Applications may choose to allow resizing of the presentation queue target
4289 * (which may be e.g. a regular Window when using an X11-based
4290 * implementation).
4291 *
4292 * \b clip_width and \b clip_height may be used to limit the size of the
4293 * displayed region of a surface, in order to match the specific region that
4294 * was rendered to.
4295 *
4296 * In turn, this allows the application to allocate over-sized (e.g.
4297 * screen-sized) surfaces, but render to a region that matches the current
4298 * size of the video window.
4299 *
4300 * Using this technique, an application's response to window resizing may
4301 * simply be to render to, and display, a different region of the surface,
4302 * rather than de-/re-allocation of surfaces to match the updated window size.
4303 *
4304 * Implementations may impose an upper bound on the number of entries
4305 * contained by the presentation queue at a given time. This limit is likely
4306 * different to the number of \ref VdpOutputSurface "VdpOutputSurface"s that
4307 * may be allocated at a given time. This limit applies to entries in the
4308 * QUEUED or VISIBLE state only. In other words, entries that have
4309 * transitioned from a QUEUED or VISIBLE state to an IDLE state do not count
4310 * toward this limit.
4311 */
4312typedef VdpStatus VdpPresentationQueueDisplay(
4313    VdpPresentationQueue presentation_queue,
4314    VdpOutputSurface     surface,
4315    uint32_t             clip_width,
4316    uint32_t             clip_height,
4317    VdpTime              earliest_presentation_time
4318);
4319
4320/**
4321 * \brief Wait for a surface to finish being displayed.
4322 * \param[in] presentation_queue The queue to query.
4323 * \param[in] surface The surface to wait for.
4324 * \param[out] first_presentation_time The timestamp of the
4325 *       VSYNC at which this surface was first displayed. Note
4326 *       that 0 means the surface was never displayed.
4327 * \return VdpStatus The completion status of the operation.
4328 *
4329 * Note that this API would block forever if queried about the surface most
4330 * recently added to a presentation queue. That is because there would be no
4331 * other surface that could possibly replace that surface as the currently
4332 * displayed surface, and hence that surface would never become idle. For
4333 * that reason, this function will return an error in that case.
4334 */
4335typedef VdpStatus VdpPresentationQueueBlockUntilSurfaceIdle(
4336    VdpPresentationQueue presentation_queue,
4337    VdpOutputSurface     surface,
4338    /* output parameters follow */
4339    VdpTime *            first_presentation_time
4340);
4341
4342/**
4343 * \hideinitializer
4344 * \brief The status of a surface within a presentation queue.
4345 */
4346typedef enum {
4347    /** The surface is not queued or currently visible. */
4348    VDP_PRESENTATION_QUEUE_STATUS_IDLE,
4349    /** The surface is in the queue, and not currently visible. */
4350    VDP_PRESENTATION_QUEUE_STATUS_QUEUED,
4351    /** The surface is the currently visible surface. */
4352    VDP_PRESENTATION_QUEUE_STATUS_VISIBLE,
4353} VdpPresentationQueueStatus;
4354
4355/**
4356 * \brief Poll the current queue status of a surface.
4357 * \param[in] presentation_queue The queue to query.
4358 * \param[in] surface The surface to query.
4359 * \param[out] status The current status of the surface within
4360 *       the queue.
4361 * \param[out] first_presentation_time The timestamp of the
4362 *       VSYNC at which this surface was first displayed. Note
4363 *       that 0 means the surface was never displayed.
4364 * \return VdpStatus The completion status of the operation.
4365 */
4366typedef VdpStatus VdpPresentationQueueQuerySurfaceStatus(
4367    VdpPresentationQueue         presentation_queue,
4368    VdpOutputSurface             surface,
4369    /* output parameters follow */
4370    VdpPresentationQueueStatus * status,
4371    VdpTime *                    first_presentation_time
4372);
4373
4374/*@}*/
4375
4376/**
4377 * \defgroup display_preemption Display Preemption
4378 *
4379 * The Window System may operate within a frame-work (such as
4380 * Linux's VT switching) where the display is shared between the
4381 * Window System (e.g. X) and some other output mechanism (e.g.
4382 * the VT.) Given this scenario, the Window System's control of
4383 * the display could be preempted, and restored, at any time.
4384 *
4385 * VDPAU does not mandate that implementations hide such
4386 * preemptions from VDPAU client applications; doing so may
4387 * impose extreme burdens upon VDPAU implementations. Equally,
4388 * however, implementations are free to hide such preemptions
4389 * from client applications.
4390 *
4391 * VDPAU allows implementations to inform the client application
4392 * when such a preemption has occurred, and then refuse to
4393 * continue further operation.
4394 *
4395 * Similarly, some form of fatal hardware error could prevent further
4396 * operation of the VDPAU implementation, without a complete
4397 * re-initialization.
4398 *
4399 * The following discusses the behavior of implementations that
4400 * choose not to hide preemption from client applications.
4401 *
4402 * When preemption occurs, VDPAU internally destroys all
4403 * objects; the client application need not do this. However, if
4404 * the client application wishes to continue operation, it must
4405 * recreate all objects that it uses. It is probable that this
4406 * recreation will not succeed until the display ownership is
4407 * restored to the Window System.
4408 *
4409 * Once preemption has occurred, all VDPAU entry points will
4410 * return the specific error code \ref
4411 * VDP_STATUS_DISPLAY_PREEMPTED.
4412 *
4413 * VDPAU client applications may also be notified of such
4414 * preemptions and fatal errors via a callback. See \ref
4415 * VdpPreemptionCallbackRegister for more details.
4416 *
4417 * @{
4418 */
4419
4420/**
4421 * \brief A callback to notify the client application that a
4422 *        device's display has been preempted.
4423 * \param[in] device The device that had its display preempted.
4424 * \param[in] context The client-supplied callback context
4425 *       information.
4426 * \return void No return value
4427 */
4428typedef void VdpPreemptionCallback(
4429    VdpDevice device,
4430    void *   context
4431);
4432
4433/**
4434 * \brief Configure the display preemption callback.
4435 * \param[in] device The device to be monitored for preemption.
4436 * \param[in] callback The client application's callback
4437 *       function. If NULL, the callback is unregistered.
4438 * \param[in] context The client-supplied callback context
4439 *       information. This information will be passed to the
4440 *       callback function if/when invoked.
4441 * \return VdpStatus The completion status of the operation.
4442 */
4443typedef VdpStatus VdpPreemptionCallbackRegister(
4444    VdpDevice             device,
4445    VdpPreemptionCallback callback,
4446    void *               context
4447);
4448
4449/*@}*/
4450
4451/**
4452 * \defgroup get_proc_address Entry Point Retrieval
4453 *
4454 * In order to facilitate multiple implementations of VDPAU
4455 * co-existing within a single process, all functionality is
4456 * available via function pointers. The mechanism to retrieve
4457 * those function pointers is described below.
4458 *
4459 * @{
4460 */
4461
4462/**
4463 * \brief A type suitable for \ref VdpGetProcAddress
4464 *        "VdpGetProcAddress"'s \b function_id parameter.
4465 */
4466typedef uint32_t VdpFuncId;
4467
4468/** \hideinitializer */
4469#define VDP_FUNC_ID_GET_ERROR_STRING                                            ((VdpFuncId)0)
4470/** \hideinitializer */
4471#define VDP_FUNC_ID_GET_PROC_ADDRESS                                            ((VdpFuncId)1)
4472/** \hideinitializer */
4473#define VDP_FUNC_ID_GET_API_VERSION                                             ((VdpFuncId)2)
4474/** \hideinitializer */
4475#define VDP_FUNC_ID_GET_INFORMATION_STRING                                      ((VdpFuncId)4)
4476/** \hideinitializer */
4477#define VDP_FUNC_ID_DEVICE_DESTROY                                              ((VdpFuncId)5)
4478/** \hideinitializer */
4479#define VDP_FUNC_ID_GENERATE_CSC_MATRIX                                         ((VdpFuncId)6)
4480/** \hideinitializer */
4481#define VDP_FUNC_ID_VIDEO_SURFACE_QUERY_CAPABILITIES                            ((VdpFuncId)7)
4482/** \hideinitializer */
4483#define VDP_FUNC_ID_VIDEO_SURFACE_QUERY_GET_PUT_BITS_Y_CB_CR_CAPABILITIES       ((VdpFuncId)8)
4484/** \hideinitializer */
4485#define VDP_FUNC_ID_VIDEO_SURFACE_CREATE                                        ((VdpFuncId)9)
4486/** \hideinitializer */
4487#define VDP_FUNC_ID_VIDEO_SURFACE_DESTROY                                       ((VdpFuncId)10)
4488/** \hideinitializer */
4489#define VDP_FUNC_ID_VIDEO_SURFACE_GET_PARAMETERS                                ((VdpFuncId)11)
4490/** \hideinitializer */
4491#define VDP_FUNC_ID_VIDEO_SURFACE_GET_BITS_Y_CB_CR                              ((VdpFuncId)12)
4492/** \hideinitializer */
4493#define VDP_FUNC_ID_VIDEO_SURFACE_PUT_BITS_Y_CB_CR                              ((VdpFuncId)13)
4494/** \hideinitializer */
4495#define VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_CAPABILITIES                           ((VdpFuncId)14)
4496/** \hideinitializer */
4497#define VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_GET_PUT_BITS_NATIVE_CAPABILITIES       ((VdpFuncId)15)
4498/** \hideinitializer */
4499#define VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_PUT_BITS_INDEXED_CAPABILITIES          ((VdpFuncId)16)
4500/** \hideinitializer */
4501#define VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_PUT_BITS_Y_CB_CR_CAPABILITIES          ((VdpFuncId)17)
4502/** \hideinitializer */
4503#define VDP_FUNC_ID_OUTPUT_SURFACE_CREATE                                       ((VdpFuncId)18)
4504/** \hideinitializer */
4505#define VDP_FUNC_ID_OUTPUT_SURFACE_DESTROY                                      ((VdpFuncId)19)
4506/** \hideinitializer */
4507#define VDP_FUNC_ID_OUTPUT_SURFACE_GET_PARAMETERS                               ((VdpFuncId)20)
4508/** \hideinitializer */
4509#define VDP_FUNC_ID_OUTPUT_SURFACE_GET_BITS_NATIVE                              ((VdpFuncId)21)
4510/** \hideinitializer */
4511#define VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_NATIVE                              ((VdpFuncId)22)
4512/** \hideinitializer */
4513#define VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_INDEXED                             ((VdpFuncId)23)
4514/** \hideinitializer */
4515#define VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_Y_CB_CR                             ((VdpFuncId)24)
4516/** \hideinitializer */
4517#define VDP_FUNC_ID_BITMAP_SURFACE_QUERY_CAPABILITIES                           ((VdpFuncId)25)
4518/** \hideinitializer */
4519#define VDP_FUNC_ID_BITMAP_SURFACE_CREATE                                       ((VdpFuncId)26)
4520/** \hideinitializer */
4521#define VDP_FUNC_ID_BITMAP_SURFACE_DESTROY                                      ((VdpFuncId)27)
4522/** \hideinitializer */
4523#define VDP_FUNC_ID_BITMAP_SURFACE_GET_PARAMETERS                               ((VdpFuncId)28)
4524/** \hideinitializer */
4525#define VDP_FUNC_ID_BITMAP_SURFACE_PUT_BITS_NATIVE                              ((VdpFuncId)29)
4526/** \hideinitializer */
4527#define VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_OUTPUT_SURFACE                        ((VdpFuncId)33)
4528/** \hideinitializer */
4529#define VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_BITMAP_SURFACE                        ((VdpFuncId)34)
4530/** \hideinitializer */
4531#define VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_VIDEO_SURFACE_LUMA                    ((VdpFuncId)35)
4532/** \hideinitializer */
4533#define VDP_FUNC_ID_DECODER_QUERY_CAPABILITIES                                  ((VdpFuncId)36)
4534/** \hideinitializer */
4535#define VDP_FUNC_ID_DECODER_CREATE                                              ((VdpFuncId)37)
4536/** \hideinitializer */
4537#define VDP_FUNC_ID_DECODER_DESTROY                                             ((VdpFuncId)38)
4538/** \hideinitializer */
4539#define VDP_FUNC_ID_DECODER_GET_PARAMETERS                                      ((VdpFuncId)39)
4540/** \hideinitializer */
4541#define VDP_FUNC_ID_DECODER_RENDER                                              ((VdpFuncId)40)
4542/** \hideinitializer */
4543#define VDP_FUNC_ID_VIDEO_MIXER_QUERY_FEATURE_SUPPORT                           ((VdpFuncId)41)
4544/** \hideinitializer */
4545#define VDP_FUNC_ID_VIDEO_MIXER_QUERY_PARAMETER_SUPPORT                         ((VdpFuncId)42)
4546/** \hideinitializer */
4547#define VDP_FUNC_ID_VIDEO_MIXER_QUERY_ATTRIBUTE_SUPPORT                         ((VdpFuncId)43)
4548/** \hideinitializer */
4549#define VDP_FUNC_ID_VIDEO_MIXER_QUERY_PARAMETER_VALUE_RANGE                     ((VdpFuncId)44)
4550/** \hideinitializer */
4551#define VDP_FUNC_ID_VIDEO_MIXER_QUERY_ATTRIBUTE_VALUE_RANGE                     ((VdpFuncId)45)
4552/** \hideinitializer */
4553#define VDP_FUNC_ID_VIDEO_MIXER_CREATE                                          ((VdpFuncId)46)
4554/** \hideinitializer */
4555#define VDP_FUNC_ID_VIDEO_MIXER_SET_FEATURE_ENABLES                             ((VdpFuncId)47)
4556/** \hideinitializer */
4557#define VDP_FUNC_ID_VIDEO_MIXER_SET_ATTRIBUTE_VALUES                            ((VdpFuncId)48)
4558/** \hideinitializer */
4559#define VDP_FUNC_ID_VIDEO_MIXER_GET_FEATURE_SUPPORT                             ((VdpFuncId)49)
4560/** \hideinitializer */
4561#define VDP_FUNC_ID_VIDEO_MIXER_GET_FEATURE_ENABLES                             ((VdpFuncId)50)
4562/** \hideinitializer */
4563#define VDP_FUNC_ID_VIDEO_MIXER_GET_PARAMETER_VALUES                            ((VdpFuncId)51)
4564/** \hideinitializer */
4565#define VDP_FUNC_ID_VIDEO_MIXER_GET_ATTRIBUTE_VALUES                            ((VdpFuncId)52)
4566/** \hideinitializer */
4567#define VDP_FUNC_ID_VIDEO_MIXER_DESTROY                                         ((VdpFuncId)53)
4568/** \hideinitializer */
4569#define VDP_FUNC_ID_VIDEO_MIXER_RENDER                                          ((VdpFuncId)54)
4570/** \hideinitializer */
4571#define VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_DESTROY                           ((VdpFuncId)55)
4572/** \hideinitializer */
4573#define VDP_FUNC_ID_PRESENTATION_QUEUE_CREATE                                   ((VdpFuncId)56)
4574/** \hideinitializer */
4575#define VDP_FUNC_ID_PRESENTATION_QUEUE_DESTROY                                  ((VdpFuncId)57)
4576/** \hideinitializer */
4577#define VDP_FUNC_ID_PRESENTATION_QUEUE_SET_BACKGROUND_COLOR                     ((VdpFuncId)58)
4578/** \hideinitializer */
4579#define VDP_FUNC_ID_PRESENTATION_QUEUE_GET_BACKGROUND_COLOR                     ((VdpFuncId)59)
4580/** \hideinitializer */
4581#define VDP_FUNC_ID_PRESENTATION_QUEUE_GET_TIME                                 ((VdpFuncId)62)
4582/** \hideinitializer */
4583#define VDP_FUNC_ID_PRESENTATION_QUEUE_DISPLAY                                  ((VdpFuncId)63)
4584/** \hideinitializer */
4585#define VDP_FUNC_ID_PRESENTATION_QUEUE_BLOCK_UNTIL_SURFACE_IDLE                 ((VdpFuncId)64)
4586/** \hideinitializer */
4587#define VDP_FUNC_ID_PRESENTATION_QUEUE_QUERY_SURFACE_STATUS                     ((VdpFuncId)65)
4588/** \hideinitializer */
4589#define VDP_FUNC_ID_PREEMPTION_CALLBACK_REGISTER                                ((VdpFuncId)66)
4590
4591#define VDP_FUNC_ID_BASE_WINSYS 0x1000
4592
4593/**
4594 * \brief Retrieve a VDPAU function pointer.
4595 * \param[in] device The device that the function will operate
4596 *       against.
4597 * \param[in] function_id The specific function to retrieve.
4598 * \param[out] function_pointer The actual pointer for the
4599 *       application to call.
4600 * \return VdpStatus The completion status of the operation.
4601 */
4602typedef VdpStatus VdpGetProcAddress(
4603    VdpDevice device,
4604    VdpFuncId function_id,
4605    /* output parameters follow */
4606    void * *  function_pointer
4607);
4608
4609/*@}*/
4610/*@}*/
4611
4612/**
4613 * \defgroup api_winsys Window System Integration Layer
4614 *
4615 * The set of VDPAU functionality specific to an individual
4616 * Windowing System.
4617 */
4618
4619#ifdef __cplusplus
4620}
4621#endif
4622
4623#endif
4624
4625