Esempio n. 1
0
dispatch_table_t *
dispatch_table_get_base ()
{
    static dispatch_table_t dispatch;
    static bool table_initialized = false;

    mutex_lock (dispatch_table_mutex);

    /* In case two threads got here at the same time, we want to return
     * the dispatch table if another thread already initialized it */
    if (table_initialized) {
        mutex_unlock (dispatch_table_mutex);
        return &dispatch;
    }

    FunctionPointerType *temp = NULL;
    temp = (FunctionPointerType *) &real_eglInitialize;
    *temp = dlsym (libegl_handle (), "eglInitialize");
    temp = (FunctionPointerType *) &real_eglGetDisplay;
    *temp = dlsym (libegl_handle (), "eglGetDisplay");

    real_eglInitialize (real_eglGetDisplay (EGL_DEFAULT_DISPLAY), NULL, NULL);
    dispatch_table_fill_base (&dispatch);

    table_initialized = true;

    mutex_unlock (dispatch_table_mutex);

    return &dispatch;
}
Esempio n. 2
0
EGLDisplay eglGetDisplay(NativeDisplayType native_display) {
#ifdef X11EGLRPI_EXPERIMENTAL_DLSYM
	real_eglGetDisplay = dlsym(RTLD_NEXT, "eglGetDisplay");
	real_eglCreateWindowSurface = dlsym(RTLD_NEXT,"eglCreateWindowSurface");
	real_eglSwapBuffers= dlsym(RTLD_NEXT,"eglSwapBuffers");
#endif
	if ( native_display == EGL_DEFAULT_DISPLAY) {
		x11_enabled=0;
		return real_eglGetDisplay(native_display);
	}
	x11_enabled=1;
	puts("Getting an X11 EGL Display.");
	bcm_host_init();
	display = (Display*)native_display;
	root = DefaultRootWindow(display);
	edisplay = real_eglGetDisplay(EGL_DEFAULT_DISPLAY);
	return edisplay;
}