• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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	/* *present_cookie is set to 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	 * However, the rect field should still be set as normal if possible (especially
85	 * the dimension)..
86	 *
87	 * If preserve_aspect_ratio is set, *rgndata will be ignored. This
88	 * limitation may be lifted in future versions.
89	 *
90	 * If the window is fully obscured, return DXGI_STATUS_OCCLUDED.
91	 * Everything else is ignored in that case.
92	 *
93	 * EndPresent is only called when S_OK is returned.
94	 */
95	HRESULT BeginPresent(
96		[in] HWND hwnd,
97		[out] void** present_cookie,
98		[out] void** window,
99		[out] RECT* rect,
100		[out] struct _RGNDATA** rgndata,
101		[out] BOOL* preserve_aspect_ratio
102	);
103
104	void EndPresent(
105		[in] HWND hwnd,
106		[out] void* present_cookie
107	);
108
109	/* If the window is fully obscured, return DXGI_STATUS_OCCLUDED, else S_OK */
110	HRESULT TestPresent(
111		[in] HWND hwnd
112	);
113
114	/* Get size of rectangle that would be returned by BeginPresent */
115	HRESULT GetPresentSize(
116		[in] HWND hwnd,
117		[out] unsigned* width,
118		[out] unsigned* height
119	);
120}
121
122void GalliumDXGIUseNothing();
123
124/* only a subset of these may be available, depending on platform and compilation options */
125void GalliumDXGIUseX11Display(struct _XDisplay* dpy, IGalliumDXGIBackend* backend);
126
127/* these don't really work for now
128void GalliumDXGIUseDRMCard(int fd);
129void GalliumDXGIUseFBDev(int fd);
130void GalliumDXGIUseHDC(HDC hdc, IGalliumDXGIGDIBackend* backend);
131*/
132
133void GalliumDXGIMakeDefault();
134
135