Merge branch 'mesa_7_7_branch'
[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
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25 #ifndef _EGL_G3D_H_
26 #define _EGL_G3D_H_
27
28 #include "pipe/p_compiler.h"
29 #include "pipe/p_screen.h"
30 #include "pipe/p_context.h"
31 #include "pipe/p_format.h"
32 #include "egldriver.h"
33 #include "egldisplay.h"
34 #include "eglcontext.h"
35 #include "eglsurface.h"
36 #include "eglconfig.h"
37 #include "eglscreen.h"
38 #include "eglmode.h"
39
40 #include "native.h"
41 #include "egl_st.h"
42
43 struct egl_g3d_driver {
44 _EGLDriver base;
45 const struct egl_g3d_st *stapis[NUM_EGL_G3D_STS];
46 EGLint api_mask;
47
48 EGLint probe_key;
49 };
50
51 struct egl_g3d_display {
52 struct native_display *native;
53 };
54
55 struct egl_g3d_buffer {
56 struct st_framebuffer *st_fb;
57 uint attachment_mask;
58 };
59
60 struct egl_g3d_context {
61 _EGLContext base;
62
63 const struct egl_g3d_st *stapi;
64 struct pipe_context *pipe;
65
66 struct st_context *st_ctx;
67 EGLBoolean force_validate;
68 struct egl_g3d_buffer draw, read;
69 };
70
71 struct egl_g3d_surface {
72 _EGLSurface base;
73 struct native_surface *native;
74 enum native_attachment render_att;
75 struct pipe_surface *render_surface;
76 unsigned int sequence_number;
77 };
78
79 struct egl_g3d_config {
80 _EGLConfig base;
81 const struct native_config *native;
82 };
83
84 struct egl_g3d_screen {
85 _EGLScreen base;
86 const struct native_connector *native;
87 const struct native_mode **native_modes;
88 };
89
90 static INLINE struct egl_g3d_driver *
91 egl_g3d_driver(_EGLDriver *drv)
92 {
93 return (struct egl_g3d_driver *) drv;
94 }
95
96 static INLINE struct egl_g3d_display *
97 egl_g3d_display(_EGLDisplay *dpy)
98 {
99 /* note that it is not direct casting */
100 return (struct egl_g3d_display *) dpy->DriverData;
101 }
102
103 static INLINE struct egl_g3d_context *
104 egl_g3d_context(_EGLContext *ctx)
105 {
106 return (struct egl_g3d_context *) ctx;
107 }
108
109 static INLINE struct egl_g3d_surface *
110 egl_g3d_surface(_EGLSurface *surf)
111 {
112 return (struct egl_g3d_surface *) surf;
113 }
114
115 static INLINE struct egl_g3d_config *
116 egl_g3d_config(_EGLConfig *conf)
117 {
118 return (struct egl_g3d_config *) conf;
119 }
120
121 static INLINE struct egl_g3d_screen *
122 egl_g3d_screen(_EGLScreen *scr)
123 {
124 return (struct egl_g3d_screen *) scr;
125 }
126
127 #endif /* _EGL_G3D_H_ */