2 * Copyright © 2011 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
25 * Kristian Høgsberg <krh@bitplanet.net>
28 #ifndef EGL_DRI2_INCLUDED
29 #define EGL_DRI2_INCLUDED
33 #include <xcb/xfixes.h>
34 #include <X11/Xlib-xcb.h>
37 #include <GL/internal/dri_interface.h>
39 #include "eglconfig.h"
40 #include "eglcontext.h"
41 #include "egldisplay.h"
42 #include "egldriver.h"
43 #include "eglcurrent.h"
45 #include "eglsurface.h"
48 #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
50 struct dri2_egl_driver
55 _EGLProc (*get_proc_address
)(const char *procname
);
56 void (*glFlush
)(void);
59 struct dri2_egl_display
61 xcb_connection_t
*conn
;
64 __DRIscreen
*dri_screen
;
65 const __DRIconfig
**driver_configs
;
67 __DRIcoreExtension
*core
;
68 __DRIdri2Extension
*dri2
;
69 __DRI2flushExtension
*flush
;
70 __DRItexBufferExtension
*tex_buffer
;
71 __DRIimageExtension
*image
;
77 __DRIdri2LoaderExtension loader_extension
;
78 const __DRIextension
*extensions
[3];
81 struct dri2_egl_context
84 __DRIcontext
*dri_context
;
87 struct dri2_egl_surface
90 __DRIdrawable
*dri_drawable
;
91 xcb_drawable_t drawable
;
92 __DRIbuffer buffers
[5];
94 xcb_xfixes_region_t region
;
99 struct dri2_egl_config
102 const __DRIconfig
*dri_config
;
105 struct dri2_egl_image
108 __DRIimage
*dri_image
;
111 /* standard typecasts */
112 _EGL_DRIVER_STANDARD_TYPECASTS(dri2_egl
)
113 _EGL_DRIVER_TYPECAST(dri2_egl_image
, _EGLImage
, obj
)
115 extern const __DRIimageLookupExtension image_lookup_extension
;
116 extern const __DRIuseInvalidateExtension use_invalidate
;
119 dri2_load_driver(_EGLDisplay
*disp
);
122 dri2_create_screen(_EGLDisplay
*disp
);
124 struct dri2_egl_config
*
125 dri2_add_config(_EGLDisplay
*disp
, const __DRIconfig
*dri_config
, int id
,
126 int depth
, EGLint surface_type
);
129 dri2_create_image_khr(_EGLDriver
*drv
, _EGLDisplay
*disp
,
130 _EGLContext
*ctx
, EGLenum target
,
131 EGLClientBuffer buffer
, const EGLint
*attr_list
);
134 dri2_initialize_x11(_EGLDriver
*drv
, _EGLDisplay
*disp
);
137 dri2_initialize_drm(_EGLDriver
*drv
, _EGLDisplay
*disp
);
139 #endif /* EGL_DRI2_INCLUDED */