mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-01 03:26:45 +00:00
Link EGL to Mesa
Link the EGL library with Mesa. SDL's `GL_GetProcAddress` now calls `eglGetProcAddress` rather than lookup procedures directly in the Mesa library. Components may still wish to list 'mesa_api' in LIBS to access OpenGL headers. Fix #2711
This commit is contained in:
parent
964aac599c
commit
4b165190ee
@ -1,6 +1,11 @@
|
|||||||
SHARED_LIB = yes
|
SHARED_LIB = yes
|
||||||
LIBS = libc blit
|
LIBS = libc blit
|
||||||
|
|
||||||
|
# Link to Mesa, EGL clients should use `eglGetProcAddres`
|
||||||
|
# to retrieve Mesa implementations rather than use Mesa
|
||||||
|
# symbols directly.
|
||||||
|
LIBS += mesa
|
||||||
|
|
||||||
include $(REP_DIR)/lib/mk/mesa-common.inc
|
include $(REP_DIR)/lib/mk/mesa-common.inc
|
||||||
|
|
||||||
SRC_C = \
|
SRC_C = \
|
||||||
|
@ -132,6 +132,9 @@ extern "C" {
|
|||||||
typedef EGLBoolean (*eglSwapBuffers_func) (EGLDisplay, EGLSurface);
|
typedef EGLBoolean (*eglSwapBuffers_func) (EGLDisplay, EGLSurface);
|
||||||
typedef EGLBoolean (*eglWaitClient_func) (void);
|
typedef EGLBoolean (*eglWaitClient_func) (void);
|
||||||
typedef char const* (*eglQueryString_func) (EGLDisplay, EGLint);
|
typedef char const* (*eglQueryString_func) (EGLDisplay, EGLint);
|
||||||
|
typedef __eglMustCastToProperFunctionPointerType
|
||||||
|
(*eglGetProcAddress_func) (const char *procname);
|
||||||
|
|
||||||
|
|
||||||
static eglBindAPI_func __eglBindAPI;
|
static eglBindAPI_func __eglBindAPI;
|
||||||
static eglChooseConfig_func __eglChooseConfig;
|
static eglChooseConfig_func __eglChooseConfig;
|
||||||
@ -143,8 +146,7 @@ extern "C" {
|
|||||||
static eglSwapBuffers_func __eglSwapBuffers;
|
static eglSwapBuffers_func __eglSwapBuffers;
|
||||||
static eglWaitClient_func __eglWaitClient;
|
static eglWaitClient_func __eglWaitClient;
|
||||||
static eglQueryString_func __eglQueryString;
|
static eglQueryString_func __eglQueryString;
|
||||||
|
static eglGetProcAddress_func __eglGetProcAddress;
|
||||||
static void *__mesa;
|
|
||||||
|
|
||||||
static bool init_egl()
|
static bool init_egl()
|
||||||
{
|
{
|
||||||
@ -168,7 +170,7 @@ extern "C" {
|
|||||||
LOAD_GL_FUNC(egl, eglQueryString)
|
LOAD_GL_FUNC(egl, eglQueryString)
|
||||||
LOAD_GL_FUNC(egl, eglSwapBuffers)
|
LOAD_GL_FUNC(egl, eglSwapBuffers)
|
||||||
LOAD_GL_FUNC(egl, eglWaitClient)
|
LOAD_GL_FUNC(egl, eglWaitClient)
|
||||||
LOAD_GL_FUNC(egl, eglWaitClient)
|
LOAD_GL_FUNC(egl, eglGetProcAddress)
|
||||||
|
|
||||||
#undef LOAD_GL_FUNC
|
#undef LOAD_GL_FUNC
|
||||||
|
|
||||||
@ -177,12 +179,6 @@ extern "C" {
|
|||||||
|
|
||||||
static bool init_opengl(SDL_VideoDevice *t)
|
static bool init_opengl(SDL_VideoDevice *t)
|
||||||
{
|
{
|
||||||
__mesa = dlopen("mesa.lib.so", 0);
|
|
||||||
if (!__mesa) {
|
|
||||||
Genode::error("could not open mesa library");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!init_egl()) { return false; }
|
if (!init_egl()) { return false; }
|
||||||
|
|
||||||
int maj, min;
|
int maj, min;
|
||||||
@ -594,8 +590,7 @@ extern "C" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void* Genode_Fb_GL_GetProcAddress(SDL_VideoDevice *t, const char *proc)
|
void* Genode_Fb_GL_GetProcAddress(SDL_VideoDevice *t, const char *proc) {
|
||||||
{
|
|
||||||
return !__mesa ? nullptr : dlsym(__mesa, proc);
|
return (void*)__eglGetProcAddress(proc); }
|
||||||
}
|
|
||||||
} //extern "C"
|
} //extern "C"
|
||||||
|
Loading…
Reference in New Issue
Block a user