Merge remote branch 'origin/master' into nv50-compiler
[mesa.git] / src / gallium / state_trackers / egl / common / egl_g3d.h
1 /*
2 * Mesa 3-D graphics library
3 * Version: 7.8
4 *
5 * Copyright (C) 2009-2010 Chia-I Wu <olv@0xlab.org>
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 * DEALINGS IN THE SOFTWARE.
24 */
25
26 #ifndef _EGL_G3D_H_
27 #define _EGL_G3D_H_
28
29 #include "pipe/p_compiler.h"
30 #include "pipe/p_screen.h"
31 #include "pipe/p_context.h"
32 #include "pipe/p_format.h"
33 #include "os/os_thread.h"
34 #include "egldriver.h"
35 #include "egldisplay.h"
36 #include "eglcontext.h"
37 #include "eglsurface.h"
38 #include "eglconfig.h"
39 #include "eglimage.h"
40 #include "eglsync.h"
41 #include "eglscreen.h"
42 #include "eglmode.h"
43
44 #include "native.h"
45 #include "egl_g3d_st.h"
46 #include "egl_g3d_loader.h"
47
48 struct egl_g3d_driver {
49 _EGLDriver base;
50 const struct egl_g3d_loader *loader;
51 const struct native_platform *platforms[_EGL_NUM_PLATFORMS];
52 };
53
54 struct egl_g3d_display {
55 struct native_display *native;
56
57 const struct egl_g3d_loader *loader;
58 struct st_manager *smapi;
59 struct pipe_context *pipe;
60 };
61
62 struct egl_g3d_context {
63 _EGLContext base;
64
65 struct st_api *stapi;
66
67 struct st_context_iface *stctxi;
68 };
69
70 struct egl_g3d_surface {
71 _EGLSurface base;
72
73 struct st_visual stvis;
74 struct st_framebuffer_iface *stfbi;
75
76 /* the native surface; NULL for pbuffers */
77 struct native_surface *native;
78 struct pipe_resource *render_texture;
79
80 EGLenum client_buffer_type;
81 EGLClientBuffer client_buffer;
82
83 unsigned int sequence_number;
84 };
85
86 struct egl_g3d_config {
87 _EGLConfig base;
88 const struct native_config *native;
89 struct st_visual stvis;
90 };
91
92 struct egl_g3d_image {
93 _EGLImage base;
94 struct pipe_resource *texture;
95 unsigned face;
96 unsigned level;
97 unsigned zslice;
98 };
99
100 /* standard typecasts */
101 _EGL_DRIVER_STANDARD_TYPECASTS(egl_g3d)
102 _EGL_DRIVER_TYPECAST(egl_g3d_image, _EGLImage, obj)
103
104 #ifdef EGL_KHR_reusable_sync
105
106 struct egl_g3d_sync {
107 _EGLSync base;
108
109 int refs;
110
111 /* the mutex protects only the condvar, not the struct */
112 pipe_mutex mutex;
113 pipe_condvar condvar;
114
115 /* for fence sync */
116 struct pipe_fence_handle *fence;
117 };
118 _EGL_DRIVER_TYPECAST(egl_g3d_sync, _EGLSync, obj)
119
120 #endif /* EGL_KHR_reusable_sync */
121
122 #ifdef EGL_MESA_screen_surface
123
124 struct egl_g3d_screen {
125 _EGLScreen base;
126 const struct native_connector *native;
127 const struct native_mode **native_modes;
128 };
129 _EGL_DRIVER_TYPECAST(egl_g3d_screen, _EGLScreen, obj)
130
131 #endif /* EGL_MESA_screen_surface */
132
133 #endif /* _EGL_G3D_H_ */