~glproxy-dev/glproxy/trunk

« back to all changes in this revision

Viewing changes to src/glx_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:
25
25
 *  Marc Ordinas i Llopis, Collabora Ltd <marc.ordinasillopis@linaro.org>
26
26
 */
27
27
 
28
 
#include <GL/gl_proxy.h>
29
 
#include <GL/glx_proxy.h>
30
 
#include <GL/glxext_proxy.h>
 
28
#include "GL/gl_proxy.h"
 
29
#include "GL/glx_proxy.h"
 
30
#include "GL/glxext_proxy.h"
31
31
 
32
32
PFNPROXYCHOOSEVISUALPROC            pfnProxyChooseVisual = NULL;
33
33
PFNPROXYCREATECONTEXTPROC           pfnProxyCreateContext = NULL;
67
67
PFNPROXYQUERYCONTEXTPROC            pfnProxyQueryContext = NULL;
68
68
PFNPROXYSELECTEVENTPROC             pfnProxySelectEvent = NULL;
69
69
PFNPROXYGETSELECTEDEVENTPROC        pfnProxyGetSelectedEvent = NULL;
 
70
/* Proc address for EGL/GLX symbol resolve function
 
71
 * Note:
 
72
 * eglGetProcAddress can only be used for GL or EGL extension function
 
73
 * glXGetProcAddress/glXGetProcAddressARB can be used for all GL/GLX funtions
 
74
 */
 
75
PFNPROXYGLXGETPROCADDRESSPROC pfnProxyGLXGetProcAddressARB = NULL;
 
76
PFNPROXYGLXGETPROCADDRESSPROC pfnProxyGLXGetProcAddress = NULL;
70
77
 
71
78
extern void *glProxyGetProcAddr(void *handle, const char *name);
72
79
 
73
80
int glxProxyInit(void *handle)
74
81
{
75
82
        if (NULL == handle) {
76
 
                return -1;
77
 
        }
78
 
 
79
 
        pfnProxyChooseVisual = glProxyGetProcAddr(handle, "glXChooseVisual");
80
 
        pfnProxyCreateContext = glProxyGetProcAddr(handle, "glXCreateContext");
81
 
        pfnProxyDestroyContext = glProxyGetProcAddr(handle, "glXDestroyContext");
82
 
        pfnProxyMakeCurrent = glProxyGetProcAddr(handle, "glXMakeCurrent");
83
 
        pfnProxyCopyContext = glProxyGetProcAddr(handle, "glXCopyContext");
84
 
        pfnProxySwapBuffers = glProxyGetProcAddr(handle, "glXSwapBuffers");
85
 
        pfnProxyCreateGLXPixmap = glProxyGetProcAddr(handle, "glXCreateGLXPixmap");
86
 
        pfnProxyDestroyGLXPixmap = glProxyGetProcAddr(handle, "glXDestroyGLXPixmap");
87
 
        pfnProxyQueryExtension = glProxyGetProcAddr(handle, "glXQueryExtension");
88
 
        pfnProxyQueryVersion = glProxyGetProcAddr(handle, "glXQueryVersion");
89
 
        pfnProxyIsDirect = glProxyGetProcAddr(handle, "glXIsDirect");
90
 
        pfnProxyGetConfig = glProxyGetProcAddr(handle, "glXGetConfig");
91
 
        pfnProxyGetCurrentContext = glProxyGetProcAddr(handle, "glXGetCurrentContext");
92
 
        pfnProxyGetCurrentDrawable = glProxyGetProcAddr(handle, "glXGetCurrentDrawable");
93
 
        pfnProxyWaitGL = glProxyGetProcAddr(handle, "glXWaitGL");
94
 
        pfnProxyWaitX = glProxyGetProcAddr(handle, "glXWaitX");     
95
 
        pfnProxyUseXFont = glProxyGetProcAddr(handle, "glXUseXFont");
96
 
        pfnProxyQueryExtensionsString = glProxyGetProcAddr(handle, "glXQueryExtensionsString");
97
 
        pfnProxyQueryServerString = glProxyGetProcAddr(handle, "glXQueryServerString");
98
 
        pfnProxyGetClientString = glProxyGetProcAddr(handle, "glXGetClientString");
99
 
        pfnProxyGetCurrentDisplay = glProxyGetProcAddr(handle, "glXGetCurrentDisplay");
100
 
        pfnProxyChooseFBConfig = glProxyGetProcAddr(handle, "glXChooseFBConfig");
101
 
        pfnProxyGetFBConfigAttrib = glProxyGetProcAddr(handle, "glXGetFBConfigAttrib");
102
 
        pfnProxyGetFBConfigs = glProxyGetProcAddr(handle, "glXGetFBConfigs");
103
 
        pfnProxyGetVisualFromFBConfig = glProxyGetProcAddr(handle, "glXGetVisualFromFBConfig");
104
 
        pfnProxyCreateWindow = glProxyGetProcAddr(handle, "glXCreateWindow");
105
 
        pfnProxyDestroyWindow = glProxyGetProcAddr(handle, "glXDestroyWindow");
106
 
        pfnProxyCreatePixmap = glProxyGetProcAddr(handle, "glXCreatePixmap");
107
 
        pfnProxyDestroyPixmap = glProxyGetProcAddr(handle, "glXDestroyPixmap");
108
 
        pfnProxyCreatePBuffer = glProxyGetProcAddr(handle, "glXCreatePBuffer");
109
 
        pfnProxyDestroyPBuffer = glProxyGetProcAddr(handle, "glXDestroyPBuffer");
110
 
        pfnProxyQueryDrawable = glProxyGetProcAddr(handle, "glXQueryDrawable");
111
 
        pfnProxyCreateNewContext = glProxyGetProcAddr(handle, "glXCreateNewContext");
112
 
        pfnProxyMakeContextCurrent = glProxyGetProcAddr(handle, "glXMakeContextCurrent");
113
 
        pfnProxyGetCurrentReadDrawable = glProxyGetProcAddr(handle, "glXGetCurrentReadDrawable");
114
 
        pfnProxyQueryContext = glProxyGetProcAddr(handle, "glXQueryContext");
115
 
        pfnProxySelectEvent = glProxyGetProcAddr(handle, "glXSelectEvent");
116
 
        pfnProxyGetSelectedEvent = glProxyGetProcAddr(handle, "glXGetSelectecEvent");
117
 
 
118
 
        return 0;
 
83
        return -1;
 
84
    }
 
85
 
 
86
    pfnProxyChooseVisual = glProxyGetProcAddr(handle, "glXChooseVisual");
 
87
    pfnProxyCreateContext = glProxyGetProcAddr(handle, "glXCreateContext");
 
88
    pfnProxyDestroyContext = glProxyGetProcAddr(handle, "glXDestroyContext");
 
89
    pfnProxyMakeCurrent = glProxyGetProcAddr(handle, "glXMakeCurrent");
 
90
    pfnProxyCopyContext = glProxyGetProcAddr(handle, "glXCopyContext");
 
91
    pfnProxySwapBuffers = glProxyGetProcAddr(handle, "glXSwapBuffers");
 
92
    pfnProxyCreateGLXPixmap = glProxyGetProcAddr(handle, "glXCreateGLXPixmap");
 
93
    pfnProxyDestroyGLXPixmap
 
94
            = glProxyGetProcAddr(handle, "glXDestroyGLXPixmap");
 
95
    pfnProxyQueryExtension = glProxyGetProcAddr(handle, "glXQueryExtension");
 
96
    pfnProxyQueryVersion = glProxyGetProcAddr(handle, "glXQueryVersion");
 
97
    pfnProxyIsDirect = glProxyGetProcAddr(handle, "glXIsDirect");
 
98
    pfnProxyGetConfig = glProxyGetProcAddr(handle, "glXGetConfig");
 
99
    pfnProxyGetCurrentContext = glProxyGetProcAddr(handle,
 
100
            "glXGetCurrentContext");
 
101
    pfnProxyGetCurrentDrawable = glProxyGetProcAddr(handle,
 
102
            "glXGetCurrentDrawable");
 
103
    pfnProxyWaitGL = glProxyGetProcAddr(handle, "glXWaitGL");
 
104
    pfnProxyWaitX = glProxyGetProcAddr(handle, "glXWaitX");
 
105
    pfnProxyUseXFont = glProxyGetProcAddr(handle, "glXUseXFont");
 
106
    pfnProxyQueryExtensionsString = glProxyGetProcAddr(handle,
 
107
            "glXQueryExtensionsString");
 
108
    pfnProxyQueryServerString = glProxyGetProcAddr(handle,
 
109
            "glXQueryServerString");
 
110
    pfnProxyGetClientString = glProxyGetProcAddr(handle, "glXGetClientString");
 
111
    pfnProxyGetCurrentDisplay = glProxyGetProcAddr(handle,
 
112
            "glXGetCurrentDisplay");
 
113
    pfnProxyChooseFBConfig = glProxyGetProcAddr(handle, "glXChooseFBConfig");
 
114
    pfnProxyGetFBConfigAttrib = glProxyGetProcAddr(handle,
 
115
            "glXGetFBConfigAttrib");
 
116
    pfnProxyGetFBConfigs = glProxyGetProcAddr(handle, "glXGetFBConfigs");
 
117
    pfnProxyGetVisualFromFBConfig = glProxyGetProcAddr(handle,
 
118
            "glXGetVisualFromFBConfig");
 
119
    pfnProxyCreateWindow = glProxyGetProcAddr(handle, "glXCreateWindow");
 
120
    pfnProxyDestroyWindow = glProxyGetProcAddr(handle, "glXDestroyWindow");
 
121
    pfnProxyCreatePixmap = glProxyGetProcAddr(handle, "glXCreatePixmap");
 
122
    pfnProxyDestroyPixmap = glProxyGetProcAddr(handle, "glXDestroyPixmap");
 
123
    pfnProxyCreatePBuffer = glProxyGetProcAddr(handle, "glXCreatePBuffer");
 
124
    pfnProxyDestroyPBuffer = glProxyGetProcAddr(handle, "glXDestroyPBuffer");
 
125
    pfnProxyQueryDrawable = glProxyGetProcAddr(handle, "glXQueryDrawable");
 
126
    pfnProxyCreateNewContext
 
127
            = glProxyGetProcAddr(handle, "glXCreateNewContext");
 
128
    pfnProxyMakeContextCurrent = glProxyGetProcAddr(handle,
 
129
            "glXMakeContextCurrent");
 
130
    pfnProxyGetCurrentReadDrawable = glProxyGetProcAddr(handle,
 
131
            "glXGetCurrentReadDrawable");
 
132
    pfnProxyQueryContext = glProxyGetProcAddr(handle, "glXQueryContext");
 
133
    pfnProxySelectEvent = glProxyGetProcAddr(handle, "glXSelectEvent");
 
134
    pfnProxyGetSelectedEvent
 
135
            = glProxyGetProcAddr(handle, "glXGetSelectecEvent");
 
136
 
 
137
    return 0;
119
138
}