vdpau_x11.h 6.24 KB
Newer Older
Aaron Plattner's avatar
Aaron Plattner committed
1
2
3
4
5
6
7
8
/*
 * This source file is documented using Doxygen markup.
 * See http://www.stack.nl/~dimitri/doxygen/
 */

/*
 * This copyright notice applies to this header file:
 *
9
 * Copyright (c) 2008-2009 NVIDIA Corporation
10
 *
Aaron Plattner's avatar
Aaron Plattner committed
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use,
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following
 * conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 */

/**
 * \file vdpau_x11.h
 * \brief X11 Window System Integration Layer
36
 *
37
38
 * This file contains the \ref api_winsys_x11 X11 Window System
 * Integration Layer.
39
40
 */

Aaron Plattner's avatar
Aaron Plattner committed
41
42
43
44
45
46
47
48
49
50
51
#ifndef _VDPAU_X11_H
#define _VDPAU_X11_H

#include <X11/Xlib.h>
#include "vdpau.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
52
53
 * \ingroup api_winsys
 * @{
Aaron Plattner's avatar
Aaron Plattner committed
54
55
56
57
 */

/**
 * \defgroup api_winsys_x11 X11 Window System Integration Layer
58
59
 *
 * The set of VDPAU functionality specific to usage with the X
Aaron Plattner's avatar
Aaron Plattner committed
60
 * Window System.
61
62
63
64
65
66
67
 *
 * \section Driver Library Layout
 *
 * An X11-oriented VDPAU installation consists of the following
 * components:
 *
 * - Header files. These files are located in the standard
Aaron Plattner's avatar
Aaron Plattner committed
68
69
70
 *   system header file path.
 *   - \c vdpau/vdpau.h
 *   - \c vdpau/vdpau_x11.h
71
 * - The VDPAU wrapper library. These files are located in the
Aaron Plattner's avatar
Aaron Plattner committed
72
73
74
 *   standard system (possibly X11-specific) library path.
 *   - \c libvdpau.so.1 (runtime)
 *   - \c libvdpau.so (development)
75
76
77
78
79
 * - Back-end driver files. These files are located in a
 *   system-defined library path, which is configurable at compile
 *   time but is typically /usr/lib/vdpau.  Use `pkg-config
 *   --variable=moduledir vdpau` to locate the driver install path.
 *   - \c $moduledir/libvdpau_\%s.so.1
Aaron Plattner's avatar
Aaron Plattner committed
80
 *   For example:
81
82
83
 *   - \c /usr/lib/vdpau/libvdpau_nvidia.so.1
 *   - \c /usr/lib/vdpau/libvdpau_intel.so.1
 *   - \c /usr/lib/vdpau/libvdpau_ati.so.1
Emil Velikov's avatar
Emil Velikov committed
84
85
 *   The library path can be overridden by the VDPAU_DRIVER_PATH
 *   environment variable.
86
87
 *
 * The VDPAU wrapper library implements just one function; \ref
88
89
90
91
92
93
94
 * vdp_device_create_x11. The wrapper implements this function by
 * dynamically loading the appropriate back-end driver file mentioned
 * above. When available, the wrapper uses the DRI2 extension's
 * DRI2Connect request with the driver type 'DRI2DriverVDPAU' to
 * determine which back-end driver to load. If that fails, the wrapper
 * library hard-codes the driver name as "nvidia", although this can
 * be overridden using the environment variable VDPAU_DRIVER.
Aaron Plattner's avatar
Aaron Plattner committed
95
 *
96
 * The back-end driver is expected to implement a function named
Aaron Plattner's avatar
Aaron Plattner committed
97
 * \b vdp_imp_device_create_x11. The wrapper will call this function to
98
99
100
101
102
103
104
 * actually implement the \ref vdp_device_create_x11 application call.
 *
 * Note that it is theoretically possible for an application to
 * create multiple \ref VdpDevice "VdpDevice" objects. In this
 * case, the wrapper library may load multiple back-end drivers
 * into the same application, and/or invoke a specific back-end
 * driver's \b VdpImpDeviceCreateX11 multiple times. The wrapper
José Hiram Soltren's avatar
José Hiram Soltren committed
105
 * library imposes no policy regarding whether the application
Aaron Plattner's avatar
Aaron Plattner committed
106
 * may instantiate multiple \ref VdpDevice "VdpDevice" objects for
107
108
109
110
111
 * the same display and/or screen. However, back-end drivers are
 * free to limit the number of \ref VdpDevice "VdpDevice" objects
 * as required by their implementation.
 *
 * @{
Aaron Plattner's avatar
Aaron Plattner committed
112
113
 */

114
115
/**
 * \brief Create a VdpDevice object for use with X11.
Aaron Plattner's avatar
Aaron Plattner committed
116
117
 * \param[in] display The X Display that the VdpDevice VdpDevice
 *       will operate against.
118
 * \param[in] screen The X screen that the VdpDevice will operate
Aaron Plattner's avatar
Aaron Plattner committed
119
 *       against.
120
121
 * \param[out] device The new device's handle.
 * \param[out] get_proc_address The get_proc_address entry point
Aaron Plattner's avatar
Aaron Plattner committed
122
 *       to use with this device.
123
 * \return VdpStatus The completion status of the operation.
Aaron Plattner's avatar
Aaron Plattner committed
124
125
126
127
128
129
130
131
132
 */
typedef VdpStatus VdpDeviceCreateX11(
    Display *             display,
    int                   screen,
    /* output parameters follow */
    VdpDevice *           device,
    VdpGetProcAddress * * get_proc_address
);

133
134
/**
 * \brief Create a VdpDevice object for use with X11.
Aaron Plattner's avatar
Aaron Plattner committed
135
 * This is an actual symbol of type \ref VdpDeviceCreateX11
136
 *
Aaron Plattner's avatar
Aaron Plattner committed
137
138
139
 */
VdpDeviceCreateX11 vdp_device_create_x11;

140
/**
Aaron Plattner's avatar
Aaron Plattner committed
141
 * \brief Create a VdpPresentationQueueTarget for use with X11.
142
 * \param[in] device The device that will contain the queue
Aaron Plattner's avatar
Aaron Plattner committed
143
 *       target.
144
 * \param[in] drawable The X11 Drawable that the presentation
Aaron Plattner's avatar
Aaron Plattner committed
145
 *       queue will present into.
146
147
 * \param[out] target The new queue target's handle.
 * \return VdpStatus The completion status of the operation.
Aaron Plattner's avatar
Aaron Plattner committed
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
 *
 * Note: VDPAU expects to own the entire drawable for the duration of time
 * that the presentation queue target exists. In particular,
 * implementations may choose to manipulate client-visible X11 window state
 * as required. As such, it is recommended that applications create a
 * dedicated window for the presentation queue target, as a child
 * (grand-child, ...) of their top-level application window.
 *
 * Applications may also create child-windows of the presentation queue
 * target, which will cover any presented video in the normal fashion. VDPAU
 * implementations will not manipulate such child windows in any fashion.
 */
typedef VdpStatus VdpPresentationQueueTargetCreateX11(
    VdpDevice                   device,
    Drawable                    drawable,
    /* output parameters follow */
    VdpPresentationQueueTarget * target
);

/** \hideinitializer */
#define VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_CREATE_X11 (VdpFuncId)(VDP_FUNC_ID_BASE_WINSYS + 0)

170
171
/** @} */
/** @} */
Aaron Plattner's avatar
Aaron Plattner committed
172
173
174
175
176
177
178

#ifdef __cplusplus
}
#endif

#endif