Merge branch 'mesa_7_7_branch'
[mesa.git] / src / gallium / state_trackers / egl / x11 / x11_screen.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 _X11_SCREEN_H_
26 #define _X11_SCREEN_H_
27
28 #include <X11/Xlib.h>
29 #include <X11/Xutil.h>
30 #include <X11/extensions/dri2tokens.h>
31 #include "pipe/p_compiler.h"
32 #include "common/native.h"
33
34 enum x11_screen_extension {
35 X11_SCREEN_EXTENSION_XSHM,
36 X11_SCREEN_EXTENSION_GLX,
37 X11_SCREEN_EXTENSION_DRI2,
38 };
39
40 /* the same as DRI2Buffer */
41 struct x11_drawable_buffer {
42 unsigned int attachment;
43 unsigned int name;
44 unsigned int pitch;
45 unsigned int cpp;
46 unsigned int flags;
47 };
48
49 struct x11_screen;
50
51 struct x11_screen *
52 x11_screen_create(Display *dpy, int screen);
53
54 void
55 x11_screen_destroy(struct x11_screen *xscr);
56
57 boolean
58 x11_screen_support(struct x11_screen *xscr, enum x11_screen_extension ext);
59
60 const XVisualInfo *
61 x11_screen_get_visuals(struct x11_screen *xscr, int *num_visuals);
62
63 void
64 x11_screen_convert_visual(struct x11_screen *xscr, const XVisualInfo *visual,
65 __GLcontextModes *mode);
66
67 const __GLcontextModes *
68 x11_screen_get_glx_configs(struct x11_screen *xscr);
69
70 const __GLcontextModes *
71 x11_screen_get_glx_visuals(struct x11_screen *xscr);
72
73 const char *
74 x11_screen_probe_dri2(struct x11_screen *xscr);
75
76 int
77 x11_screen_enable_dri2(struct x11_screen *xscr, const char *driver);
78
79 __GLcontextModes *
80 x11_context_modes_create(unsigned count);
81
82 void
83 x11_context_modes_destroy(__GLcontextModes *modes);
84
85 unsigned
86 x11_context_modes_count(const __GLcontextModes *modes);
87
88 void
89 x11_drawable_enable_dri2(struct x11_screen *xscr,
90 Drawable drawable, boolean on);
91
92 void
93 x11_drawable_copy_buffers(struct x11_screen *xscr, Drawable drawable,
94 int x, int y, int width, int height,
95 int src_buf, int dst_buf);
96
97 struct x11_drawable_buffer *
98 x11_drawable_get_buffers(struct x11_screen *xscr, Drawable drawable,
99 int *width, int *height, unsigned int *attachments,
100 boolean with_format, int num_ins, int *num_outs);
101
102 uint
103 x11_drawable_get_depth(struct x11_screen *xscr, Drawable drawable);
104
105 #endif /* _X11_SCREEN_H_ */