1a4f78defSmrg/*
2a4f78defSmrg * This source file is documented using Doxygen markup.
3a4f78defSmrg * See http://www.stack.nl/~dimitri/doxygen/
4a4f78defSmrg */
5a4f78defSmrg
6a4f78defSmrg/*
7a4f78defSmrg * This copyright notice applies to this header file:
8a4f78defSmrg *
9a4f78defSmrg * Copyright (c) 2008-2009 NVIDIA Corporation
10a4f78defSmrg *
11a4f78defSmrg * Permission is hereby granted, free of charge, to any person
12a4f78defSmrg * obtaining a copy of this software and associated documentation
13a4f78defSmrg * files (the "Software"), to deal in the Software without
14a4f78defSmrg * restriction, including without limitation the rights to use,
15a4f78defSmrg * copy, modify, merge, publish, distribute, sublicense, and/or sell
16a4f78defSmrg * copies of the Software, and to permit persons to whom the
17a4f78defSmrg * Software is furnished to do so, subject to the following
18a4f78defSmrg * conditions:
19a4f78defSmrg *
20a4f78defSmrg * The above copyright notice and this permission notice shall be
21a4f78defSmrg * included in all copies or substantial portions of the Software.
22a4f78defSmrg *
23a4f78defSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24a4f78defSmrg * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
25a4f78defSmrg * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26a4f78defSmrg * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
27a4f78defSmrg * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
28a4f78defSmrg * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29a4f78defSmrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
30a4f78defSmrg * OTHER DEALINGS IN THE SOFTWARE.
31a4f78defSmrg */
32a4f78defSmrg
33a4f78defSmrg/**
34a4f78defSmrg * \file vdpau_x11.h
35a4f78defSmrg * \brief X11 Window System Integration Layer
36a4f78defSmrg *
37a4f78defSmrg * This file contains the \ref api_winsys_x11 X11 Window System
38a4f78defSmrg * Integration Layer.
39a4f78defSmrg */
40a4f78defSmrg
41a4f78defSmrg#ifndef _VDPAU_X11_H
42a4f78defSmrg#define _VDPAU_X11_H
43a4f78defSmrg
44a4f78defSmrg#include <X11/Xlib.h>
45a4f78defSmrg#include "vdpau.h"
46a4f78defSmrg
47a4f78defSmrg#ifdef __cplusplus
48a4f78defSmrgextern "C" {
49a4f78defSmrg#endif
50a4f78defSmrg
51a4f78defSmrg/**
52a4f78defSmrg * \ingroup api_winsys
53a4f78defSmrg * @{
54a4f78defSmrg */
55a4f78defSmrg
56a4f78defSmrg/**
57a4f78defSmrg * \defgroup api_winsys_x11 X11 Window System Integration Layer
58a4f78defSmrg *
59a4f78defSmrg * The set of VDPAU functionality specific to usage with the X
60a4f78defSmrg * Window System.
61a4f78defSmrg *
62a4f78defSmrg * \section Driver Library Layout
63a4f78defSmrg *
64a4f78defSmrg * An X11-oriented VDPAU installation consists of the following
65a4f78defSmrg * components:
66a4f78defSmrg *
67a4f78defSmrg * - Header files. These files are located in the standard
68a4f78defSmrg *   system header file path.
69a4f78defSmrg *   - \c vdpau/vdpau.h
70a4f78defSmrg *   - \c vdpau/vdpau_x11.h
71a4f78defSmrg * - The VDPAU wrapper library. These files are located in the
72a4f78defSmrg *   standard system (possibly X11-specific) library path.
73a4f78defSmrg *   - \c libvdpau.so.1 (runtime)
74a4f78defSmrg *   - \c libvdpau.so (development)
75a4f78defSmrg * - Back-end driver files. These files are located in a
76a4f78defSmrg *   system-defined library path, which is configurable at compile
77a4f78defSmrg *   time but is typically /usr/lib/vdpau.  Use `pkg-config
78a4f78defSmrg *   --variable=moduledir vdpau` to locate the driver install path.
79a4f78defSmrg *   - \c $moduledir/libvdpau_\%s.so.1
80a4f78defSmrg *   For example:
81a4f78defSmrg *   - \c /usr/lib/vdpau/libvdpau_nvidia.so.1
82a4f78defSmrg *   - \c /usr/lib/vdpau/libvdpau_intel.so.1
83a4f78defSmrg *   - \c /usr/lib/vdpau/libvdpau_ati.so.1
84a4f78defSmrg *   The library path can be overridden by the VDPAU_DRIVER_PATH
85a4f78defSmrg *   environment variable.
86a4f78defSmrg *
87a4f78defSmrg * The VDPAU wrapper library implements just one function; \ref
88a4f78defSmrg * vdp_device_create_x11. The wrapper implements this function by
89a4f78defSmrg * dynamically loading the appropriate back-end driver file mentioned
90a4f78defSmrg * above. When available, the wrapper uses the DRI2 extension's
91a4f78defSmrg * DRI2Connect request with the driver type 'DRI2DriverVDPAU' to
92a4f78defSmrg * determine which back-end driver to load. If that fails, the wrapper
93a4f78defSmrg * library hard-codes the driver name as "nvidia", although this can
94a4f78defSmrg * be overridden using the environment variable VDPAU_DRIVER.
95a4f78defSmrg *
96a4f78defSmrg * The back-end driver is expected to implement a function named
97a4f78defSmrg * \b vdp_imp_device_create_x11. The wrapper will call this function to
98a4f78defSmrg * actually implement the \ref vdp_device_create_x11 application call.
99a4f78defSmrg *
100a4f78defSmrg * Note that it is theoretically possible for an application to
101a4f78defSmrg * create multiple \ref VdpDevice "VdpDevice" objects. In this
102a4f78defSmrg * case, the wrapper library may load multiple back-end drivers
103a4f78defSmrg * into the same application, and/or invoke a specific back-end
104a4f78defSmrg * driver's \b VdpImpDeviceCreateX11 multiple times. The wrapper
105a4f78defSmrg * library imposes no policy regarding whether the application
106a4f78defSmrg * may instantiate multiple \ref VdpDevice "VdpDevice" objects for
107a4f78defSmrg * the same display and/or screen. However, back-end drivers are
108a4f78defSmrg * free to limit the number of \ref VdpDevice "VdpDevice" objects
109a4f78defSmrg * as required by their implementation.
110a4f78defSmrg *
111a4f78defSmrg * @{
112a4f78defSmrg */
113a4f78defSmrg
114a4f78defSmrg/**
115a4f78defSmrg * \brief Create a VdpDevice object for use with X11.
116a4f78defSmrg * \param[in] display The X Display that the VdpDevice VdpDevice
117a4f78defSmrg *       will operate against.
118a4f78defSmrg * \param[in] screen The X screen that the VdpDevice will operate
119a4f78defSmrg *       against.
120a4f78defSmrg * \param[out] device The new device's handle.
121a4f78defSmrg * \param[out] get_proc_address The get_proc_address entry point
122a4f78defSmrg *       to use with this device.
123a4f78defSmrg * \return VdpStatus The completion status of the operation.
124a4f78defSmrg */
125a4f78defSmrgtypedef VdpStatus VdpDeviceCreateX11(
126a4f78defSmrg    Display *             display,
127a4f78defSmrg    int                   screen,
128a4f78defSmrg    /* output parameters follow */
129a4f78defSmrg    VdpDevice *           device,
130a4f78defSmrg    VdpGetProcAddress * * get_proc_address
131a4f78defSmrg);
132a4f78defSmrg
133a4f78defSmrg/**
134a4f78defSmrg * \brief Create a VdpDevice object for use with X11.
135a4f78defSmrg * This is an actual symbol of type \ref VdpDeviceCreateX11
136a4f78defSmrg *
137a4f78defSmrg */
138a4f78defSmrgVdpDeviceCreateX11 vdp_device_create_x11;
139a4f78defSmrg
140a4f78defSmrg/**
141a4f78defSmrg * \brief Create a VdpPresentationQueueTarget for use with X11.
142a4f78defSmrg * \param[in] device The device that will contain the queue
143a4f78defSmrg *       target.
144a4f78defSmrg * \param[in] drawable The X11 Drawable that the presentation
145a4f78defSmrg *       queue will present into.
146a4f78defSmrg * \param[out] target The new queue target's handle.
147a4f78defSmrg * \return VdpStatus The completion status of the operation.
148a4f78defSmrg *
149a4f78defSmrg * Note: VDPAU expects to own the entire drawable for the duration of time
150a4f78defSmrg * that the presentation queue target exists. In particular,
151a4f78defSmrg * implementations may choose to manipulate client-visible X11 window state
152a4f78defSmrg * as required. As such, it is recommended that applications create a
153a4f78defSmrg * dedicated window for the presentation queue target, as a child
154a4f78defSmrg * (grand-child, ...) of their top-level application window.
155a4f78defSmrg *
156a4f78defSmrg * Applications may also create child-windows of the presentation queue
157a4f78defSmrg * target, which will cover any presented video in the normal fashion. VDPAU
158a4f78defSmrg * implementations will not manipulate such child windows in any fashion.
159a4f78defSmrg */
160a4f78defSmrgtypedef VdpStatus VdpPresentationQueueTargetCreateX11(
161a4f78defSmrg    VdpDevice                   device,
162a4f78defSmrg    Drawable                    drawable,
163a4f78defSmrg    /* output parameters follow */
164a4f78defSmrg    VdpPresentationQueueTarget * target
165a4f78defSmrg);
166a4f78defSmrg
167a4f78defSmrg/** \hideinitializer */
168a4f78defSmrg#define VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_CREATE_X11 (VdpFuncId)(VDP_FUNC_ID_BASE_WINSYS + 0)
169a4f78defSmrg
170a4f78defSmrg/*@}*/
171a4f78defSmrg/*@}*/
172a4f78defSmrg
173a4f78defSmrg#ifdef __cplusplus
174a4f78defSmrg}
175a4f78defSmrg#endif
176a4f78defSmrg
177a4f78defSmrg#endif
178a4f78defSmrg
179