1 | /* |
2 | Copyright (c) 2012, Broadcom Europe Ltd |
3 | All rights reserved. |
4 | |
5 | Redistribution and use in source and binary forms, with or without |
6 | modification, are permitted provided that the following conditions are met: |
7 | * Redistributions of source code must retain the above copyright |
8 | notice, this list of conditions and the following disclaimer. |
9 | * Redistributions in binary form must reproduce the above copyright |
10 | notice, this list of conditions and the following disclaimer in the |
11 | documentation and/or other materials provided with the distribution. |
12 | * Neither the name of the copyright holder nor the |
13 | names of its contributors may be used to endorse or promote products |
14 | derived from this software without specific prior written permission. |
15 | |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY |
20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ |
27 | |
28 | #ifndef EGL_CLIENT_CONTEXT_H |
29 | #define EGL_CLIENT_CONTEXT_H |
30 | |
31 | #include "interface/khronos/egl/egl_int.h" |
32 | |
33 | typedef struct { |
34 | EGLContext name; |
35 | EGLDisplay display; |
36 | EGLConfig configname; |
37 | |
38 | EGL_CONTEXT_TYPE_T type; |
39 | |
40 | EGLint renderbuffer; //EGL_NONE, EGL_BACK_BUFFER or EGL_SINGLE_BUFFER |
41 | |
42 | void *state; // GLXX_CLIENT_STATE_T or VG_CLIENT_STATE_T |
43 | EGL_CONTEXT_ID_T servercontext; |
44 | |
45 | struct CLIENT_THREAD_STATE *thread; // If we are current, which the client state for the thread are we associated with. |
46 | |
47 | /* |
48 | is_current |
49 | |
50 | Invariant: |
51 | |
52 | (EGL_CONTEXT_IS_CURRENT) |
53 | Iff true, the context is current to some thread. |
54 | */ |
55 | bool is_current; |
56 | /* |
57 | is_destroyed |
58 | |
59 | Invariant: |
60 | |
61 | (EGL_CONTEXT_IS_DESTROYED) |
62 | Iff true, is not a member of the CLIENT_PROCESS_STATE_T.contexts |
63 | */ |
64 | bool is_destroyed; |
65 | } EGL_CONTEXT_T; |
66 | |
67 | extern EGLBoolean egl_context_check_attribs(const EGLint *attrib_list, EGLint max_version, EGLint *version); |
68 | |
69 | extern EGL_CONTEXT_T *egl_context_create(EGL_CONTEXT_T *share_context, EGLContext name, EGLDisplay display, EGLConfig configname, EGL_CONTEXT_TYPE_T type); |
70 | extern void egl_context_term(EGL_CONTEXT_T *context); |
71 | |
72 | extern void egl_context_set_callbacks(EGL_CONTEXT_T *context, |
73 | void (*gl_render_callback)(void), |
74 | void (*gl_flush_callback)(bool), |
75 | void (*vg_render_callback)(void), |
76 | void (*vg_flush_callback)(bool)); |
77 | |
78 | extern EGLBoolean egl_context_get_attrib(EGL_CONTEXT_T *context, EGLint attrib, EGLint *value); |
79 | extern void egl_context_maybe_free(EGL_CONTEXT_T *context); |
80 | |
81 | #endif |
82 | |