Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4358 Serge 1
/*
2
 * Mesa 3-D graphics library
3
 *
4
 * Copyright (C) 2009-2010 Chia-I Wu 
5
 *
6
 * Permission is hereby granted, free of charge, to any person obtaining a
7
 * copy of this software and associated documentation files (the "Software"),
8
 * to deal in the Software without restriction, including without limitation
9
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
 * and/or sell copies of the Software, and to permit persons to whom the
11
 * Software is furnished to do so, subject to the following conditions:
12
 *
13
 * The above copyright notice and this permission notice shall be included
14
 * in all copies or substantial portions of the Software.
15
 *
16
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22
 * DEALINGS IN THE SOFTWARE.
23
 */
24
 
25
#ifndef _X11_SCREEN_H_
26
#define _X11_SCREEN_H_
27
 
28
#include 
29
#include 
30
#include 
31
#include "GL/gl.h" /* for GL types needed by __GLcontextModes */
32
#include "glcore.h"  /* for __GLcontextModes */
33
#include "pipe/p_compiler.h"
34
#include "common/native.h"
35
 
36
enum x11_screen_extension {
37
   X11_SCREEN_EXTENSION_XSHM,
38
   X11_SCREEN_EXTENSION_GLX,
39
   X11_SCREEN_EXTENSION_DRI2,
40
};
41
 
42
/* the same as DRI2Buffer */
43
struct x11_drawable_buffer {
44
   unsigned int attachment;
45
   unsigned int name;
46
   unsigned int pitch;
47
   unsigned int cpp;
48
   unsigned int flags;
49
};
50
 
51
struct x11_screen;
52
 
53
typedef void (*x11_drawable_invalidate_buffers)(struct x11_screen *xscr,
54
                                                Drawable drawable,
55
                                                void *user_data);
56
 
57
struct x11_screen *
58
x11_screen_create(Display *dpy, int screen);
59
 
60
void
61
x11_screen_destroy(struct x11_screen *xscr);
62
 
63
boolean
64
x11_screen_support(struct x11_screen *xscr, enum x11_screen_extension ext);
65
 
66
const XVisualInfo *
67
x11_screen_get_visuals(struct x11_screen *xscr, int *num_visuals);
68
 
69
uint
70
x11_drawable_get_depth(struct x11_screen *xscr, Drawable drawable);
71
 
72
#ifdef GLX_DIRECT_RENDERING
73
 
74
/* GLX */
75
const __GLcontextModes *
76
x11_screen_get_glx_configs(struct x11_screen *xscr);
77
 
78
const __GLcontextModes *
79
x11_screen_get_glx_visuals(struct x11_screen *xscr);
80
 
81
__GLcontextModes *
82
x11_context_modes_create(unsigned count);
83
 
84
void
85
x11_context_modes_destroy(__GLcontextModes *modes);
86
 
87
unsigned
88
x11_context_modes_count(const __GLcontextModes *modes);
89
 
90
/* DRI2 */
91
const char *
92
x11_screen_probe_dri2(struct x11_screen *xscr, int *major, int *minor);
93
 
94
int
95
x11_screen_enable_dri2(struct x11_screen *xscr,
96
                       x11_drawable_invalidate_buffers invalidate_buffers,
97
                       void *user_data);
98
 
99
char *
100
x11_screen_get_device_name(struct x11_screen *xscr);
101
 
102
int
103
x11_screen_authenticate(struct x11_screen *xscr, uint32_t id);
104
 
105
void
106
x11_drawable_enable_dri2(struct x11_screen *xscr,
107
                         Drawable drawable, boolean on);
108
 
109
void
110
x11_drawable_copy_buffers_region(struct x11_screen *xscr, Drawable drawable,
111
                                 int num_rects, const int *rects,
112
                                 int src_buf, int dst_buf);
113
 
114
/**
115
 * Copy between buffers of the DRI2 drawable.
116
 */
117
static INLINE void
118
x11_drawable_copy_buffers(struct x11_screen *xscr, Drawable drawable,
119
                          int x, int y, int width, int height,
120
                          int src_buf, int dst_buf)
121
{
122
    int rect[4] = { x, y, width, height };
123
    x11_drawable_copy_buffers_region(xscr, drawable, 1, rect, src_buf, dst_buf);
124
}
125
 
126
struct x11_drawable_buffer *
127
x11_drawable_get_buffers(struct x11_screen *xscr, Drawable drawable,
128
                         int *width, int *height, unsigned int *attachments,
129
                         boolean with_format, int num_ins, int *num_outs);
130
 
131
#endif /* GLX_DIRECT_RENDERING */
132
 
133
#endif /* _X11_SCREEN_H_ */