summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/d3d1x/gd3dapi/galliumdxgi.idl
blob: c6233c85b9921a6ebfa741c400708d3f747f103d (plain)
1
2
3
4
5
6
7
8
9
10
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/**************************************************************************
 *
 * Copyright 2010 Luca Barbieri
 *
 * 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 (including the
 * next paragraph) 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 COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS 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.
 *
 **************************************************************************/

/* Header for the Gallium extensions to DXGI */

import "galliumcom.idl";
import "../d3dapi/dxgi.idl";

/* These calls set the display system that will be associated
 * to new DXGI factories created with CreateDXGIFactory and
 * CreateDXGIFactory1 by the current thread.
 *
 * Existing factories and DXGI objects created from them are
 * not affected.
 *
 * Gallium DXGI has both per-thread and per-process settings.
 * If the per-thread display system has been set (i.e. a function
 * of these was called, and the last one called was not UseNothing),
 * it will be used.
 * Otherwise, the per-process display system will be used if set, or
 * and other the factory creation call may either fail, or use an
 * user-specified default..
 *
 * The per-process setting can be altered by calling
 * GalliumDXGIMakeDefault, which will set the per-process setting
 * according to the current per-thread setting.
 *
 * GalliumDXGIUseNothing() is the initial state, which means that
 * the per-process default should be used, and if that is "use nothing"
 * too, the call will either fail or use a user-specified default.
 *
 * NOTE that setting the per-process default is NOT atomic and must
 * not be done concurrently with other calls to GalliumDXGIMakeDefault,
 * CreateDXGIFactory or CreateDXGIFactory1.
 *
 * The PFNHWNDRESOLVER function is passed HWNDs coming from
 * the API user and must return window-system-specific values:
 * - X11: Window*
 * - GDI: HWND
 */

[object, local, uuid("c22d2f85-f7dd-40b0-a50b-5d308f973c5e")]
interface IGalliumDXGIBackend : IUnknown
{
	/* *present_cookie is set to a cookie that is passed to EndPresent
	 *
	 * *window and *rect are the window and subrectangle
	 * to present in.
	 *
	 * For X11, *window is a Window.
	 * For other systems, it will be the equivalent way to reference a window.
	 *
	 * The rectangle is clipped against the window size, so you can
	 * specify (0, 0, INT_MAX, INT_MAX) to use the whole window.
	 *
	 * rgndata is set to either NULL, or the region, in coordinates relative
	 * to the subrectangle, to clip presentation to.
	 * *rgndata is valid until EndPresent is called, at which point EndPresent
	 * may free the data.
	 *
	 * However, the rect field should still be set as normal if possible (especially
	 * the dimension)..
	 *
	 * If preserve_aspect_ratio is set, *rgndata will be ignored. This
	 * limitation may be lifted in future versions.
	 *
	 * If the window is fully obscured, return DXGI_STATUS_OCCLUDED.
	 * Everything else is ignored in that case.
	 *
	 * EndPresent is only called when S_OK is returned.
	 */
	HRESULT BeginPresent(
		[in] HWND hwnd,
		[out] void** present_cookie,
		[out] void** window,
		[out] RECT* rect,
		[out] struct _RGNDATA** rgndata,
		[out] BOOL* preserve_aspect_ratio
	);

	void EndPresent(
		[in] HWND hwnd,
		[out] void* present_cookie
	);

	/* If the window is fully obscured, return DXGI_STATUS_OCCLUDED, else S_OK */
	HRESULT TestPresent(
		[in] HWND hwnd
	);

	/* Get size of rectangle that would be returned by BeginPresent */
	HRESULT GetPresentSize(
		[in] HWND hwnd,
		[out] unsigned* width,
		[out] unsigned* height
	);
}

void GalliumDXGIUseNothing();

/* only a subset of these may be available, depending on platform and compilation options */
void GalliumDXGIUseX11Display(struct _XDisplay* dpy, IGalliumDXGIBackend* backend);

/* these don't really work for now
void GalliumDXGIUseDRMCard(int fd);
void GalliumDXGIUseFBDev(int fd);
void GalliumDXGIUseHDC(HDC hdc, IGalliumDXGIGDIBackend* backend);
*/

void GalliumDXGIMakeDefault();