galliumdxgi.idl revision 6c598c78bd17642d731cf57b8369cc794f64ba2f
1/**************************************************************************
2 *
3 * Copyright 2010 Luca Barbieri
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial
15 * portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
21 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 *
25 **************************************************************************/
26
27/* Header for the Gallium extensions to DXGI */
28
29import "galliumcom.idl";
30import "../d3dapi/dxgi.idl";
31
32/* These calls set the display system that will be associated
33 * to new DXGI factories created with CreateDXGIFactory and
34 * CreateDXGIFactory1 by the current thread.
35 *
36 * Existing factories and DXGI objects created from them are
37 * not affected.
38 *
39 * Gallium DXGI has both per-thread and per-process settings.
40 * If the per-thread display system has been set (i.e. a function
41 * of these was called, and the last one called was not UseNothing),
42 * it will be used.
43 * Otherwise, the per-process display system will be used if set, or
44 * and other the factory creation call may either fail, or use an
45 * user-specified default..
46 *
47 * The per-process setting can be altered by calling
48 * GalliumDXGIMakeDefault, which will set the per-process setting
49 * according to the current per-thread setting.
50 *
51 * GalliumDXGIUseNothing() is the initial state, which means that
52 * the per-process default should be used, and if that is "use nothing"
53 * too, the call will either fail or use a user-specified default.
54 *
55 * NOTE that setting the per-process default is NOT atomic and must
56 * not be done concurrently with other calls to GalliumDXGIMakeDefault,
57 * CreateDXGIFactory or CreateDXGIFactory1.
58 *
59 * The PFNHWNDRESOLVER function is passed HWNDs coming from
60 * the API user and must return window-system-specific values:
61 * - X11: Window*
62 * - GDI: HWND
63 */
64
65[object, local, uuid("c22d2f85-f7dd-40b0-a50b-5d308f973c5e")]
66interface IGalliumDXGIBackend : IUnknown
67{
68	/* Returns a cookie that is passed to EndPresent
69	 *
70	 * *window and *rect are the window and subrectangle
71	 * to present in.
72	 *
73	 * For X11, *window is a Window.
74	 * For other systems, it will be the equivalent way to reference a window.
75	 *
76	 * The rectangle is clipped against the window size, so you can
77	 * specify (0, 0, INT_MAX, INT_MAX) to use the whole window.
78	 *
79	 * rgndata is set to either NULL, or the region, in coordinates relative
80	 * to the subrectangle, to clip presentation to.
81	 * *rgndata is valid until EndPresent is called, at which point EndPresent
82	 * may free the data.
83	 *
84	 * If window is set 0, the window is fully obscured, so don't present
85	 * anything, and tell the app of the obscuration.
86	 *
87	 * If preserve_aspect_ratio is set, *rgndata will be ignored. This
88	 * limitation may be lifted in future versions.
89	 *
90	 * EndPresent is still called even if you return 0 in window.
91	 */
92	void* BeginPresent(
93		[in] HWND hwnd,
94		[out] void** window,
95		[out] RECT* rect,
96		[out] struct _RGNDATA** rgndata,
97		[out] BOOL* preserve_aspect_ratio
98	);
99
100	void EndPresent(
101		[in] HWND hwnd,
102		[out] void* present_cookie
103	);
104}
105
106void GalliumDXGIUseNothing();
107
108/* only a subset of these may be available, depending on platform and compilation options */
109void GalliumDXGIUseX11Display(struct _XDisplay* dpy, IGalliumDXGIBackend* backend);
110
111/* these don't really work for now
112void GalliumDXGIUseDRMCard(int fd);
113void GalliumDXGIUseFBDev(int fd);
114void GalliumDXGIUseHDC(HDC hdc, IGalliumDXGIGDIBackend* backend);
115*/
116
117void GalliumDXGIMakeDefault();
118
119