EAPI void *
eglGetProcAddress_thread_cmd(char const * procname)
{
- if (!evas_gl_thread_enabled())
+ if (!evas_evgl_thread_enabled())
return eglGetProcAddress(procname);
Evas_Thread_Command_eglGetProcAddress thread_data;
thread_data.procname = procname;
- evas_gl_thread_cmd_enqueue(EVAS_GL_THREAD_TYPE_GL,
+ evas_gl_thread_cmd_enqueue(EVAS_GL_THREAD_TYPE_EVGL,
_gl_thread_eglGetProcAddress,
&thread_data,
EVAS_GL_THREAD_MODE_FINISH);
}
+
+
+typedef struct
+{
+ EGLSurface return_value;
+ EGLDisplay egl_disp;
+ EGLConfig egl_config;
+ EGLNativeWindowType egl_win;
+ EGLint const * attrib_list;
+} Evas_GL_Thread_Command_eglCreateWindowSurface;
+
+static void
+_evgl_thread_eglCreateWindowSurface(void *data)
+{
+ Evas_GL_Thread_Command_eglCreateWindowSurface *thread_data = data;
+
+ thread_data->return_value = eglCreateWindowSurface(thread_data->egl_disp,
+ thread_data->egl_config,
+ thread_data->egl_win,
+ thread_data->attrib_list);
+}
+
+EAPI EGLSurface
+eglCreateWindowSurface_evgl_thread_cmd(EGLDisplay egl_disp, EGLConfig egl_config,
+ EGLNativeWindowType egl_win, EGLint const * attrib_list)
+{
+ if (!evas_evgl_thread_enabled())
+ return eglCreateWindowSurface(egl_disp, egl_config,
+ egl_win, attrib_list);
+
+ Evas_GL_Thread_Command_eglCreateWindowSurface thread_data;
+
+ thread_data.egl_disp = egl_disp;
+ thread_data.egl_config = egl_config;
+ thread_data.egl_win = egl_win;
+ thread_data.attrib_list = attrib_list;
+
+ evas_gl_thread_cmd_enqueue(EVAS_GL_THREAD_TYPE_EVGL,
+ _evgl_thread_eglCreateWindowSurface,
+ &thread_data,
+ EVAS_GL_THREAD_MODE_FINISH);
+
+ return thread_data.return_value;
+}
+
+typedef struct
+{
+ EGLBoolean return_value;
+ EGLDisplay egl_disp;
+ EGLSurface egl_surf;
+} Evas_GL_Thread_Command_eglDestroySurface;
+
+static void
+_evgl_thread_eglDestroySurface(void *data)
+{
+ Evas_GL_Thread_Command_eglDestroySurface *thread_data = data;
+
+ thread_data->return_value = eglDestroySurface(thread_data->egl_disp,
+ thread_data->egl_surf);
+}
+
+EAPI EGLSurface
+eglDestroySurface_evgl_thread_cmd(EGLDisplay egl_disp, EGLSurface egl_surf)
+{
+ if (!evas_evgl_thread_enabled())
+ return eglDestroySurface(egl_disp, egl_surf);
+
+ Evas_GL_Thread_Command_eglDestroySurface thread_data;
+
+ thread_data.egl_disp = egl_disp;
+ thread_data.egl_surf = egl_surf;
+
+ evas_gl_thread_cmd_enqueue(EVAS_GL_THREAD_TYPE_EVGL,
+ _evgl_thread_eglDestroySurface,
+ &thread_data,
+ EVAS_GL_THREAD_MODE_FINISH);
+
+ return thread_data.return_value;
+}
+
+
+typedef struct
+{
+ EGLContext return_value;
+ EGLDisplay display;
+ EGLConfig config;
+ EGLContext share_context;
+ EGLint const * attrib_list;
+} Evas_GL_Thread_Command_eglCreateContext;
+
+static void
+_evgl_thread_eglCreateContext(void *data)
+{
+ Evas_GL_Thread_Command_eglCreateContext *thread_data = data;
+
+ thread_data->return_value = eglCreateContext(thread_data->display,
+ thread_data->config,
+ thread_data->share_context,
+ thread_data->attrib_list);
+}
+
+EAPI EGLContext
+eglCreateContext_evgl_thread_cmd(EGLDisplay display,
+ EGLConfig config,
+ EGLContext share_context,
+ EGLint const * attrib_list)
+{
+ if (!evas_evgl_thread_enabled())
+ return eglCreateContext(display, config, share_context, attrib_list);
+
+ Evas_GL_Thread_Command_eglCreateContext thread_data;
+
+ thread_data.display = display;
+ thread_data.config = config;
+ thread_data.share_context = share_context;
+ thread_data.attrib_list = attrib_list;
+
+ evas_gl_thread_cmd_enqueue(EVAS_GL_THREAD_TYPE_EVGL,
+ _evgl_thread_eglCreateContext,
+ &thread_data,
+ EVAS_GL_THREAD_MODE_FINISH);
+
+ return thread_data.return_value;
+}
+
+typedef struct
+{
+ EGLBoolean return_value;
+ EGLDisplay display;
+ EGLContext context;
+} Evas_GL_Thread_Command_eglDestroyContext;
+
+static void
+_evgl_thread_eglDestroyContext(void *data)
+{
+ Evas_GL_Thread_Command_eglDestroyContext *thread_data = data;
+
+ thread_data->return_value = eglDestroyContext(thread_data->display,
+ thread_data->context);
+}
+
+EAPI EGLBoolean
+eglDestroyContext_evgl_thread_cmd(EGLDisplay display,
+ EGLContext context)
+{
+ if (!evas_evgl_thread_enabled())
+ return eglDestroyContext(display, context);
+
+ Evas_GL_Thread_Command_eglDestroyContext thread_data;
+
+ thread_data.display = display;
+ thread_data.context = context;
+
+ evas_gl_thread_cmd_enqueue(EVAS_GL_THREAD_TYPE_EVGL,
+ _evgl_thread_eglDestroyContext,
+ &thread_data,
+ EVAS_GL_THREAD_MODE_FINISH);
+
+ return thread_data.return_value;
+}
+
+
+typedef struct
+{
+ char const * return_value;
+ EGLDisplay display;
+ EGLint name;
+} Evas_GL_Thread_Command_eglQueryString;
+
+static void
+_evgl_thread_eglQueryString(void *data)
+{
+ Evas_GL_Thread_Command_eglQueryString *thread_data = data;
+
+ thread_data->return_value = eglQueryString(thread_data->display,
+ thread_data->name);
+}
+
+EAPI char const *
+eglQueryString_evgl_thread_cmd(EGLDisplay display, EGLint name)
+{
+ if (!evas_evgl_thread_enabled())
+ return eglQueryString(display, name);
+
+ Evas_GL_Thread_Command_eglQueryString thread_data;
+
+ thread_data.display = display;
+ thread_data.name = name;
+
+ evas_gl_thread_cmd_enqueue(EVAS_GL_THREAD_TYPE_EVGL,
+ _evgl_thread_eglQueryString,
+ &thread_data,
+ EVAS_GL_THREAD_MODE_FINISH);
+
+ return thread_data.return_value;
+}
+
+
#else /* ! EVAS_GL_RENDER_THREAD_COMPILE_FOR_GL_GENERIC */
EGLContext (*eglGetCurrentContext_evgl_thread_cmd)(void);
EGLSurface (*eglGetCurrentSurface_evgl_thread_cmd)(EGLint readdraw);
EGLDisplay (*eglGetCurrentDisplay_evgl_thread_cmd)(void);
+EGLSurface (*eglCreateWindowSurface_evgl_thread_cmd)(EGLDisplay egl_disp, EGLConfig egl_config, EGLNativeWindowType egl_win, EGLint const * attrib_list);
+EGLSurface (*eglDestroySurface_evgl_thread_cmd)(EGLDisplay egl_disp, EGLSurface egl_surf);
+EGLContext (*eglCreateContext_evgl_thread_cmd)(EGLDisplay display, EGLConfig config, EGLContext share_context, EGLint const * attrib_list);
+EGLBoolean (*eglDestroyContext_evgl_thread_cmd)(EGLDisplay display, EGLContext context);
+char const *(*eglQueryString_evgl_thread_cmd)(EGLDisplay display, EGLint name);
void _egl_thread_link_init()
LINK2GENERIC(eglGetCurrentContext_evgl_thread_cmd);
LINK2GENERIC(eglGetCurrentSurface_evgl_thread_cmd);
LINK2GENERIC(eglGetCurrentDisplay_evgl_thread_cmd);
+ LINK2GENERIC(eglCreateWindowSurface_evgl_thread_cmd);
+ LINK2GENERIC(eglDestroySurface_evgl_thread_cmd);
+ LINK2GENERIC(eglCreateContext_evgl_thread_cmd);
+ LINK2GENERIC(eglDestroyContext_evgl_thread_cmd);
+ LINK2GENERIC(eglQueryString_evgl_thread_cmd);
+
+
}
#endif /* EVAS_GL_RENDER_THREAD_COMPILE_FOR_GL_GENERIC */
EAPI EGLContext eglGetCurrentContext_evgl_thread_cmd(void);
EAPI EGLSurface eglGetCurrentSurface_evgl_thread_cmd(EGLint readdraw);
EAPI EGLDisplay eglGetCurrentDisplay_evgl_thread_cmd(void);
+EAPI EGLSurface eglCreateWindowSurface_evgl_thread_cmd(EGLDisplay egl_disp, EGLConfig egl_config, EGLNativeWindowType egl_win, EGLint const * attrib_list);
+EAPI EGLSurface eglDestroySurface_evgl_thread_cmd(EGLDisplay egl_disp, EGLSurface egl_surf);
+EAPI EGLContext eglCreateContext_evgl_thread_cmd(EGLDisplay display, EGLConfig config, EGLContext share_context, EGLint const * attrib_list);
+EAPI EGLBoolean eglDestroyContext_evgl_thread_cmd(EGLDisplay display, EGLContext context);
+EAPI char const *eglQueryString_evgl_thread_cmd(EGLDisplay display, EGLint name);
#else /* ! EVAS_GL_RENDER_THREAD_COMPILE_FOR_GL_GENERIC */
extern EGLContext (*eglGetCurrentContext_evgl_thread_cmd)(void);
extern EGLSurface (*eglGetCurrentSurface_evgl_thread_cmd)(EGLint readdraw);
extern EGLDisplay (*eglGetCurrentDisplay_evgl_thread_cmd)(void);
+extern EGLSurface (*eglCreateWindowSurface_evgl_thread_cmd)(EGLDisplay egl_disp, EGLConfig egl_config, EGLNativeWindowType egl_win, EGLint const * attrib_list);
+extern EGLSurface (*eglDestroySurface_evgl_thread_cmd)(EGLDisplay egl_disp, EGLSurface egl_surf);
+extern EGLContext (*eglCreateContext_evgl_thread_cmd)(EGLDisplay display, EGLConfig config, EGLContext share_context, EGLint const * attrib_list);
+extern EGLBoolean (*eglDestroyContext_evgl_thread_cmd)(EGLDisplay display, EGLContext context);
+extern char const *(*eglQueryString_evgl_thread_cmd)(EGLDisplay display, EGLint name);
if (!(evgl_surface = (Evgl_wl_Surface *)win)) return NULL;
if (!(evgl_surface->egl_win)) return NULL;
- surface = eglCreateWindowSurface(ob->egl_disp, ob->egl_config,
+ surface = eglCreateWindowSurface_evgl_thread_cmd(ob->egl_disp, ob->egl_config,
(EGLNativeWindowType)evgl_surface->egl_win, NULL);
if (!surface)
{
- ERR("Could not create egl window surface: %#x", eglGetError());
+ int err = eglGetError_evgl_thread_cmd();
+ glsym_evas_gl_common_error_set(err - EGL_SUCCESS);
+ ERR("Could not create egl window surface: %#x", err);
return NULL;
}
glsym_evas_gl_common_error_set(data, EVAS_GL_BAD_SURFACE);
return 0;
}
- eglDestroySurface(ob->egl_disp, (EGLSurface)surface);
+ eglDestroySurface_evgl_thread_cmd(ob->egl_disp, (EGLSurface)surface);
return 1;
}
if (ctxt)
{
context =
- eglCreateContext(ob->egl_disp, ob->egl_config,
- (EGLContext)ctxt, attrs);
+ eglCreateContext_evgl_thread_cmd(ob->egl_disp, ob->egl_config,
+ (EGLContext)ctxt, attrs);
}
else if (version == EVAS_GL_GLES_1_X || version == EVAS_GL_GLES_3_X)
{
context =
- eglCreateContext(ob->egl_disp, ob->egl_config,
- NULL, attrs);
+ eglCreateContext_evgl_thread_cmd(ob->egl_disp, ob->egl_config,
+ NULL, attrs);
}
else
{
context =
- eglCreateContext(ob->egl_disp, ob->egl_config,
- ob->egl_context[0], attrs);
+ eglCreateContext_evgl_thread_cmd(ob->egl_disp, ob->egl_config,
+ ob->egl_context[0], attrs);
}
if (!context)
{
- int err = eglGetError();
+ int err = eglGetError_evgl_thread_cmd();
ERR("Failed to create egl context: %#x", err);
glsym_evas_gl_common_error_set(data, err - EGL_SUCCESS);
return NULL;
return 0;
}
- eglDestroyContext(ob->egl_disp, (EGLContext)ctxt);
+ eglDestroyContext_evgl_thread_cmd(ob->egl_disp, (EGLContext)ctxt);
return 1;
}
if ((!ctxt) && (!surface))
{
ret =
- eglMakeCurrent_thread_cmd(ob->egl_disp, EGL_NO_SURFACE,
+ eglMakeCurrent_evgl_thread_cmd(ob->egl_disp, EGL_NO_SURFACE,
EGL_NO_SURFACE, EGL_NO_CONTEXT);
if (!ret)
{
- int err = eglGetError_thread_cmd();
+ int err = eglGetError_evgl_thread_cmd();
glsym_evas_gl_common_error_set(err - EGL_SUCCESS);
ERR("eglMakeCurrent() failed! Error Code=%#x", err);
return 0;
return 1;
}
- if ((eglGetCurrentContext_thread_cmd() != ctx) ||
- (eglGetCurrentSurface_thread_cmd(EGL_READ) != surf) ||
- (eglGetCurrentSurface_thread_cmd(EGL_DRAW) != surf))
+ if ((eglGetCurrentContext_evgl_thread_cmd() != ctx) ||
+ (eglGetCurrentSurface_evgl_thread_cmd(EGL_READ) != surf) ||
+ (eglGetCurrentSurface_evgl_thread_cmd(EGL_DRAW) != surf))
{
if (flush) eng_window_use(NULL);
- ret = eglMakeCurrent_thread_cmd(ob->egl_disp, surf, surf, ctx);
+ ret = eglMakeCurrent_evgl_thread_cmd(ob->egl_disp, surf, surf, ctx);
if (!ret)
{
- int err = eglGetError_thread_cmd();
+ int err = eglGetError_evgl_thread_cmd();
glsym_evas_gl_common_error_set(err - EGL_SUCCESS);
ERR("eglMakeCurrent() failed! Error Code=%#x", err);
return 0;
}
if (!(ob = eng_get_ob(re))) return NULL;
- return eglQueryString(ob->egl_disp, EGL_EXTENSIONS);
+ return eglQueryString_evgl_thread_cmd(ob->egl_disp, EGL_EXTENSIONS);
}
static int
return NULL;
#ifdef GL_GLES
- if (eglGetCurrentContext_thread_cmd() == (ctx->context))
+ if (eglGetCurrentContext_evgl_thread_cmd() == (ctx->context))
return ctx;
else
return NULL;
eng_gl_error_get(void *data)
{
int err;
-
- if ((err = glsym_evas_gl_common_error_get(data)) != EVAS_GL_SUCCESS)
+ err = glsym_evas_gl_common_error_get(data);
+ if (err != EVAS_GL_SUCCESS && err != EVAS_GL_NOT_INITIALIZED)
goto end;
- err = eglGetError() - EGL_SUCCESS;
+ err = eglGetError_evgl_thread_cmd() - EGL_SUCCESS;
end:
glsym_evas_gl_common_error_set(data, EVAS_GL_SUCCESS);
if (glsym_glEGLImageTargetTexture2DOES)
{
glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, surface);
- if (eglGetError() != EGL_SUCCESS)
+ if (eglGetError_thread_cmd() != EGL_SUCCESS)
ERR("glEGLImageTargetTexture2DOES() failed.");
}
else
if (glsym_glEGLImageTargetTexture2DOES)
{
glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, n->ns_data.tbm.surface);
- if (eglGetError() != EGL_SUCCESS)
+ if (eglGetError_thread_cmd() != EGL_SUCCESS)
ERR("glEGLImageTargetTexture2DOES() failed.");
}
else