~glproxy-dev/glproxy/trunk

« back to all changes in this revision

Viewing changes to src/egl_proxy.c

  • Committer: Marc Ordinas i Llopis
  • Date: 2011-12-08 11:35:53 UTC
  • mfrom: (35.1.7 fixes)
  • Revision ID: marc.ordinasillopis@linaro.org-20111208113553-og785wmh311tv427
EGL support: Add EGL virtualization support to glproxy.

Also,
- Removed the "automagic" best renderer detection, as it needed to start
both EGL and GLX which caused problems on some systems. It will return,
but in a more application-controlled way.
- Now it's necessary to pass the current display to the extensions helper
functions, as using an internal one caused NULL being returned as the
extensions string in some systems.
- A lot of code clean-ups.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2010-2011 Linaro Ltd.
 
2
 *
 
3
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 
4
 * of this software and associated documentation files (the "Software"), to deal
 
5
 * in the Software without restriction, including without limitation the rights
 
6
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 
7
 * copies of the Software, and to permit persons to whom the Software is
 
8
 * furnished to do so, subject to the following conditions:
 
9
 *
 
10
 * The above copyright notice and this permission notice shall be included in
 
11
 * all copies or substantial portions of the Software.
 
12
 *
 
13
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
14
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
15
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 
16
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
17
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 
18
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 
19
 * THE SOFTWARE.
 
20
 */
 
21
 
 
22
/*
 
23
 * Authors:
 
24
 *  Marc Ordinas i Llopis, Collabora Ltd <marc.ordinasillopis@linaro.org>
 
25
 */
 
26
 
 
27
#include "EGL/egl_proxy.h"
 
28
 
 
29
PFNPROXYEGLGETERROR                      pfnProxyEglGetError = NULL;
 
30
PFNPROXYEGLGETDISPLAY                    pfnProxyEglGetDisplay = NULL;
 
31
PFNPROXYEGLINITIALIZE                    pfnProxyEglInitialize = NULL;
 
32
PFNPROXYEGLTERMINATE                     pfnProxyEglTerminate = NULL;
 
33
PFNPROXYEGLQUERYSTRING                   pfnProxyEglQueryString = NULL;
 
34
PFNPROXYEGLGETCONFIGS                    pfnProxyEglGetConfigs = NULL;
 
35
PFNPROXYEGLCHOOSECONFIG                  pfnProxyEglChooseConfig = NULL;
 
36
PFNPROXYEGLGETCONFIGATTRIB               pfnProxyEglGetConfigAttrib = NULL;
 
37
PFNPROXYEGLCREATEWINDOWSURFACE           pfnProxyEglCreateWindowSurface = NULL;
 
38
PFNPROXYEGLCREATEPBUFFERSURFACE          pfnProxyEglCreatePbufferSurface = NULL;
 
39
PFNPROXYEGLCREATEPIXMAPSURFACE           pfnProxyEglCreatePixmapSurface = NULL;
 
40
PFNPROXYEGLDESTROYSURFACE                pfnProxyEglDestroySurface = NULL;
 
41
PFNPROXYEGLQUERYSURFACE                  pfnProxyEglQuerySurface = NULL;
 
42
PFNPROXYEGLBINDAPI                       pfnProxyEglBindAPI = NULL;
 
43
PFNPROXYEGLQUERYAPI                      pfnProxyEglQueryAPI = NULL;
 
44
PFNPROXYEGLWAITCLIENT                    pfnProxyEglWaitClient = NULL;
 
45
PFNPROXYEGLRELEASETHREAD                 pfnProxyEglReleaseThread = NULL;
 
46
PFNPROXYEGLCREATEPBUFFERFROMCLIENTBUFFER pfnProxyEglCreatePbufferFromClientBuffer = NULL;
 
47
PFNPROXYEGLSURFACEATTRIB                 pfnProxyEglSurfaceAttrib = NULL;
 
48
PFNPROXYEGLBINDTEXIMAGE                  pfnProxyEglBindTexImage = NULL;
 
49
PFNPROXYEGLRELEASETEXIMAGE               pfnProxyEglReleaseTexImage = NULL;
 
50
PFNPROXYEGLSWAPINTERVAL                  pfnProxyEglSwapInterval = NULL;
 
51
PFNPROXYEGLCREATECONTEXT                 pfnProxyEglCreateContext = NULL;
 
52
PFNPROXYEGLDESTROYCONTEXT                pfnProxyEglDestroyContext = NULL;
 
53
PFNPROXYEGLMAKECURRENT                   pfnProxyEglMakeCurrent = NULL;
 
54
PFNPROXYEGLGETCURRENTCONTEXT             pfnProxyEglGetCurrentContext = NULL;
 
55
PFNPROXYEGLGETCURRENTSURFACE             pfnProxyEglGetCurrentSurface = NULL;
 
56
PFNPROXYEGLGETCURRENTDISPLAY             pfnProxyEglGetCurrentDisplay = NULL;
 
57
PFNPROXYEGLQUERYCONTEXT                  pfnProxyEglQueryContext = NULL;
 
58
PFNPROXYEGLWAITGL                        pfnProxyEglWaitGL = NULL;
 
59
PFNPROXYEGLWAITNATIVE                    pfnProxyEglWaitNative = NULL;
 
60
PFNPROXYEGLSWAPBUFFERS                   pfnProxyEglSwapBuffers = NULL;
 
61
PFNPROXYEGLCOPYBUFFERS                   pfnProxyEglCopyBuffers = NULL;
 
62
PFNPROXYEGLGETPROCADDRESS                pfnProxyEglGetProcAddress = NULL;
 
63
 
 
64
extern void *glProxyGetProcAddr(void *handle, const char *name);
 
65
 
 
66
int eglProxyInit(void *handle)
 
67
{
 
68
    if (NULL == handle) {
 
69
        return -1;
 
70
    }
 
71
 
 
72
    if (!pfnProxyEglGetProcAddress)
 
73
        pfnProxyEglGetProcAddress = glProxyGetProcAddr(handle, "eglGetProcAddress");
 
74
 
 
75
    pfnProxyEglGetError = glProxyGetProcAddr(handle, "eglGetError");
 
76
    pfnProxyEglGetDisplay = glProxyGetProcAddr(handle, "eglGetDisplay");
 
77
    pfnProxyEglInitialize = glProxyGetProcAddr(handle, "eglInitialize");
 
78
    pfnProxyEglTerminate = glProxyGetProcAddr(handle, "eglTerminate");
 
79
    pfnProxyEglQueryString = glProxyGetProcAddr(handle, "eglQueryString");
 
80
    pfnProxyEglGetConfigs = glProxyGetProcAddr(handle, "eglGetConfigs");
 
81
    pfnProxyEglChooseConfig = glProxyGetProcAddr(handle, "eglChooseConfig");
 
82
    pfnProxyEglGetConfigAttrib = glProxyGetProcAddr(handle, "eglGetConfigAttrib");
 
83
    pfnProxyEglCreateWindowSurface = glProxyGetProcAddr(handle, "eglCreateWindowSurface");
 
84
    pfnProxyEglCreatePbufferSurface = glProxyGetProcAddr(handle, "eglCreatePbufferSurface");
 
85
    pfnProxyEglCreatePixmapSurface = glProxyGetProcAddr(handle, "eglCreatePixmapSurface");
 
86
    pfnProxyEglDestroySurface = glProxyGetProcAddr(handle, "eglDestroySurface");
 
87
    pfnProxyEglQuerySurface = glProxyGetProcAddr(handle, "eglQuerySurface");
 
88
    pfnProxyEglBindAPI = glProxyGetProcAddr(handle, "eglBindAPI");
 
89
    pfnProxyEglQueryAPI = glProxyGetProcAddr(handle, "eglQueryAPI");
 
90
    pfnProxyEglWaitClient = glProxyGetProcAddr(handle, "eglWaitClient");
 
91
    pfnProxyEglReleaseThread = glProxyGetProcAddr(handle, "eglReleaseThread");
 
92
    pfnProxyEglCreatePbufferFromClientBuffer = glProxyGetProcAddr(handle, "eglCreatePbufferFromClientBuffer");
 
93
    pfnProxyEglSurfaceAttrib = glProxyGetProcAddr(handle, "eglSurfaceAttrib");
 
94
    pfnProxyEglBindTexImage = glProxyGetProcAddr(handle, "eglBindTexImage");
 
95
    pfnProxyEglReleaseTexImage = glProxyGetProcAddr(handle, "eglReleaseTexImage");
 
96
    pfnProxyEglSwapInterval = glProxyGetProcAddr(handle, "eglSwapInterval");
 
97
    pfnProxyEglCreateContext = glProxyGetProcAddr(handle, "eglCreateContext");
 
98
    pfnProxyEglDestroyContext = glProxyGetProcAddr(handle, "eglDestroyContext");
 
99
    pfnProxyEglMakeCurrent = glProxyGetProcAddr(handle, "eglMakeCurrent");
 
100
    pfnProxyEglGetCurrentContext = glProxyGetProcAddr(handle, "eglGetCurrentContext");
 
101
    pfnProxyEglGetCurrentSurface = glProxyGetProcAddr(handle, "eglGetCurrentSurface");
 
102
    pfnProxyEglGetCurrentDisplay = glProxyGetProcAddr(handle, "eglGetCurrentDisplay");
 
103
    pfnProxyEglQueryContext = glProxyGetProcAddr(handle, "eglQueryContext");
 
104
    pfnProxyEglWaitGL = glProxyGetProcAddr(handle, "eglWaitGL");
 
105
    pfnProxyEglWaitNative = glProxyGetProcAddr(handle, "eglWaitNative");
 
106
    pfnProxyEglSwapBuffers = glProxyGetProcAddr(handle, "eglSwapBuffers");
 
107
    pfnProxyEglCopyBuffers = glProxyGetProcAddr(handle, "eglCopyBuffers");
 
108
 
 
109
    return 0;
 
110
}