st/egl: Remove buffer from screen
[mesa.git] / src / gallium / state_trackers / egl / egl_tracker.h
1
2 #ifndef _EGL_TRACKER_H_
3 #define _EGL_TRACKER_H_
4
5 #include <stdint.h>
6
7 #include "eglconfig.h"
8 #include "eglcontext.h"
9 #include "egldisplay.h"
10 #include "egldriver.h"
11 #include "eglglobals.h"
12 #include "eglmode.h"
13 #include "eglscreen.h"
14 #include "eglsurface.h"
15
16 #include "xf86drm.h"
17 #include "xf86drmMode.h"
18
19 #include "pipe/p_compiler.h"
20
21 #include "state_tracker/st_public.h"
22
23 #define MAX_SCREENS 16
24
25 struct pipe_winsys;
26 struct pipe_screen;
27 struct pipe_context;
28 struct state_tracker;
29
30 struct drm_screen;
31 struct drm_context;
32
33 struct drm_device
34 {
35 /*
36 * pipe
37 */
38
39 struct drm_api *api;
40 struct pipe_winsys *winsys;
41 struct pipe_screen *screen;
42
43 /*
44 * drm
45 */
46
47 int drmFD;
48 drmVersionPtr version;
49 int deviceID;
50
51 drmModeResPtr res;
52
53 struct drm_screen *screens[MAX_SCREENS];
54 size_t count_screens;
55 };
56
57 struct drm_surface
58 {
59 _EGLSurface base; /* base class/object */
60
61 /*
62 * pipe
63 */
64
65
66 struct st_framebuffer *stfb;
67
68 /*
69 * drm
70 */
71
72 struct drm_context *user;
73 struct drm_screen *screen;
74
75 int w;
76 int h;
77 };
78
79 struct drm_context
80 {
81 _EGLContext base; /* base class/object */
82
83 /* pipe */
84
85 struct pipe_context *pipe;
86 struct st_context *st;
87 };
88
89 struct drm_screen
90 {
91 _EGLScreen base;
92
93 /*
94 * pipe
95 */
96
97 struct pipe_texture *tex;
98 struct pipe_surface *surface;
99
100 /*
101 * drm
102 */
103
104 struct {
105 unsigned height;
106 unsigned width;
107 unsigned pitch;
108 unsigned handle;
109 } front;
110
111 /* currently only support one connector */
112 drmModeConnectorPtr connector;
113 uint32_t connectorID;
114
115 /* dpms property */
116 drmModePropertyPtr dpms;
117
118 /* Has this screen been shown */
119 int shown;
120
121 /* Surface that is currently attached to this screen */
122 struct drm_surface *surf;
123
124 /* framebuffer */
125 drmModeFBPtr fb;
126 uint32_t fbID;
127
128 /* crtc and mode used */
129 /*drmModeCrtcPtr crtc;*/
130 uint32_t crtcID;
131
132 drmModeModeInfoPtr mode;
133 };
134
135
136 static INLINE struct drm_device *
137 lookup_drm_device(_EGLDisplay *d)
138 {
139 return (struct drm_device *) d->DriverData;
140 }
141
142
143 static INLINE struct drm_context *
144 lookup_drm_context(_EGLContext *c)
145 {
146 return (struct drm_context *) c;
147 }
148
149
150 static INLINE struct drm_surface *
151 lookup_drm_surface(_EGLSurface *s)
152 {
153 return (struct drm_surface *) s;
154 }
155
156 static INLINE struct drm_screen *
157 lookup_drm_screen(_EGLScreen *s)
158 {
159 return (struct drm_screen *) s;
160 }
161
162 /**
163 * egl_visual.h
164 */
165 /*@{*/
166 void drm_visual_modes_destroy(__GLcontextModes *modes);
167 __GLcontextModes* drm_visual_modes_create(unsigned count, size_t minimum_size);
168 __GLcontextModes* drm_visual_from_config(_EGLConfig *conf);
169 /*@}*/
170
171 /**
172 * egl_surface.h
173 */
174 /*@{*/
175 void drm_takedown_shown_screen(_EGLDisplay *dpy, struct drm_screen *screen);
176 /*@}*/
177
178 /**
179 * All function exported to the egl side.
180 */
181 /*@{*/
182 EGLBoolean drm_initialize(_EGLDriver *drv, _EGLDisplay *dpy, EGLint *major, EGLint *minor);
183 EGLBoolean drm_terminate(_EGLDriver *drv, _EGLDisplay *dpy);
184 _EGLContext *drm_create_context(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, _EGLContext *share_list, const EGLint *attrib_list);
185 EGLBoolean drm_destroy_context(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *context);
186 _EGLSurface *drm_create_window_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, NativeWindowType window, const EGLint *attrib_list);
187 _EGLSurface *drm_create_pixmap_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, NativePixmapType pixmap, const EGLint *attrib_list);
188 _EGLSurface *drm_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, const EGLint *attrib_list);
189 _EGLSurface *drm_create_screen_surface_mesa(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, const EGLint *attrib_list);
190 EGLBoolean drm_show_screen_surface_mesa(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *screen, _EGLSurface *surface, _EGLMode *mode);
191 EGLBoolean drm_destroy_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface);
192 EGLBoolean drm_make_current(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw, _EGLSurface *read, _EGLContext *context);
193 EGLBoolean drm_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw);
194 /*@}*/
195
196 #endif