evas gl - fix compositing/native surface with egl/gles after glvnd

this fixes an issue that has cropped up in the past few months - only
nvidia drivers with egl/gles in x11... and compositing won't work
(native surface) and the introduction of libglvnd

it's a combination of libglvnd lying that it has symbols it can't
later find, new features to get core functions via procaddress that we
hadn't migrated to use AND use preferring core functions that libglvnd
will expose, so switching to KHR extensions by preference. we also
need to symmetrically use destroy image khr too...

oddly enough using procaddress purely for create/destroy image makes
wayland fail ... sofor now i'm taking advantage of the fact that
wayland has no extensions string passed in at the moment and still
doing dlsym... this is odd though.

@fix
This commit is contained in:
Carsten Haitzler 2017-07-14 18:55:25 +09:00
parent 53d6486ffa
commit 2e6587a14b
8 changed files with 174 additions and 94 deletions

View File

@ -143,6 +143,7 @@ static void
gl_symbols(void)
{
static Eina_Bool done = EINA_FALSE;
const char *exts = NULL;
if (done) return;
@ -185,7 +186,10 @@ gl_symbols(void)
FINDSYM(glsym_eglGetProcAddress, "eglGetProcAddressARB", glsym_func_eng_fn);
FINDSYM(glsym_eglGetProcAddress, "eglGetProcAddress", glsym_func_eng_fn);
glsym_evas_gl_symbols((void*)glsym_eglGetProcAddress);
// Find EGL extensions
// FIXME: whgen above eglGetDisplay() is fixed... fix the below...
// exts = eglQueryString(ob->egl_disp, EGL_EXTENSIONS);
glsym_evas_gl_symbols((void*)glsym_eglGetProcAddress, exts);
FINDSYM(glsym_eglCreateImage, "eglCreateImageKHR", glsym_func_void_ptr);
FINDSYM(glsym_eglCreateImage, "eglCreateImageEXT", glsym_func_void_ptr);

View File

@ -127,7 +127,9 @@ evas_outbuf_new(Evas_Engine_Info_GL_Cocoa *info,
}
ob->ns_gl_view = glview;
[[glview openGLContext] makeCurrentContext];
glsym_evas_gl_symbols(_dlsym);
* glsym_evas_gl_symbols(_dlsym, NULL); /* XXX: NULL is ok for now for extns
* but i need to find out howon osx to get the extension string list
* for egl/whatever */
ob->gl_context = glsym_evas_gl_common_context_new();
if (EINA_UNLIKELY(!ob->gl_context))

View File

@ -562,7 +562,7 @@ EAPI int evas_gl_common_buffer_dump(Evas_Engine_GL_Context *gc, const c
EAPI void evas_gl_preload_render_lock(evas_gl_make_current_cb make_current, void *engine_data);
EAPI void evas_gl_preload_render_unlock(evas_gl_make_current_cb make_current, void *engine_data);
EAPI void evas_gl_preload_render_relax(evas_gl_make_current_cb make_current, void *engine_data);
EAPI void evas_gl_symbols(void *(*GetProcAddress)(const char *name));
EAPI void evas_gl_symbols(void *(*GetProcAddress)(const char *name), const char *extsn);
EAPI void evas_gl_common_error_set(void *data, int error_enum);
EAPI int evas_gl_common_error_get(void *data);
@ -576,7 +576,7 @@ typedef void (*Evas_GL_Preload_Render_Call)(evas_gl_make_current_cb make_current
typedef Evas_Engine_GL_Context *(*Evas_GL_Common_Context_New)(void);
typedef void (*Evas_GL_Common_Context_Resize_Call)(Evas_Engine_GL_Context *gc, int w, int h, int rot);
typedef int (*Evas_GL_Common_Buffer_Dump_Call)(Evas_Engine_GL_Context *gc,const char* dname, const char* fname, int frame, const char* suffix);
typedef void (*Evas_Gl_Symbols)(void *(*GetProcAddress)(const char *sym));
typedef void (*Evas_Gl_Symbols)(void *(*GetProcAddress)(const char *sym), const char *extsn);
EAPI void __evas_gl_err(int err, const char *file, const char *func, int line, const char *op);
@ -773,6 +773,7 @@ extern void (*glsym_glRenderbufferStorageMultisample)(GLenum target, GLsiz
#ifdef GL_GLES
EAPI void * evas_gl_common_eglCreateImage (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list);
EAPI int evas_gl_common_eglDestroyImage (EGLDisplay dpy, void *im);
extern unsigned int (*secsym_eglDestroyImage) (void *a, void *b);
extern void (*secsym_glEGLImageTargetTexture2DOES) (int a, void *b);
extern void *(*secsym_eglMapImageSEC) (void *a, void *b, int c, int d);

View File

@ -119,11 +119,16 @@ _has_ext(const char *ext, const char **pexts, int *pnum)
}
#ifdef GL_GLES
void *
static int
_has_extn(const char *ext, const char *exts)
{
if (!exts || !ext) return EINA_FALSE;
return strstr(exts, ext) != NULL;
}
EAPI void *
evas_gl_common_eglCreateImage(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list)
{
if (eglsym_eglCreateImage)
return eglsym_eglCreateImage(dpy, ctx, target, buffer, attrib_list);
if (eglsym_eglCreateImageKHR)
{
int count, i;
@ -139,14 +144,24 @@ evas_gl_common_eglCreateImage(EGLDisplay dpy, EGLContext ctx, EGLenum target, EG
}
return eglsym_eglCreateImageKHR(dpy, ctx, target, buffer, ints);
}
if (eglsym_eglCreateImage)
return eglsym_eglCreateImage(dpy, ctx, target, buffer, attrib_list);
return NULL;
}
EAPI int
evas_gl_common_eglDestroyImage(EGLDisplay dpy, void *im)
{
if (secsym_eglDestroyImage)
return secsym_eglDestroyImage(dpy, im);
return EGL_FALSE;
}
#endif
/* FIXME: return error if a required symbol was not found */
EAPI void
evas_gl_symbols(void *(*GetProcAddress)(const char *name))
evas_gl_symbols(void *(*GetProcAddress)(const char *name), const char *extsn EINA_UNUSED)
{
int failed = 0, num = 0;
const char *exts = NULL;
@ -293,34 +308,73 @@ evas_gl_symbols(void *(*GetProcAddress)(const char *name))
FINDSYM(glsym_glRenderbufferStorageMultisample, "glRenderbufferStorageMultisample", NULL, glsym_func_void);
#ifdef GL_GLES
Eina_Bool dl_fallback = EINA_FALSE;
#define FINDSYMN(dst, sym, ext, typ) do { \
if (!dst) { \
if (_has_extn(ext, extsn) && GetProcAddress) \
dst = (typ) GetProcAddress(sym); \
if ((!dst) && dl_fallback) \
dst = (typ) dlsym(RTLD_DEFAULT, sym); \
}} while (0)
// yes - gl core looking for egl stuff. i know it's odd. a reverse-layer thing
// but it will work as the egl/glx layer calls gl core common stuff and thus
// these symbols will work. making the glx/egl + x11 layer do this kind-of is
// wrong as this is not x11 (output) layer specific like the native surface
// stuff. this is generic zero-copy textures for gl
FINDSYM(eglsym_eglCreateImage, "eglCreateImage", NULL, secsym_func_void_ptr);
FINDSYM(eglsym_eglCreateImageKHR, "eglCreateImageKHR", "EGL_KHR_image_base", secsym_func_void_ptr);
FINDSYM(eglsym_eglCreateImageKHR, "eglCreateImageKHR", "EGL_KHR_image", secsym_func_void_ptr);
FINDSYM(eglsym_eglCreateImageKHR, "eglCreateImageOES", "GL_OES_EGL_image_base", secsym_func_void_ptr);
FINDSYM(eglsym_eglCreateImageKHR, "eglCreateImageOES", "GL_OES_EGL_image", secsym_func_void_ptr);
FINDSYM(secsym_eglDestroyImage, "eglDestroyImage", NULL, secsym_func_uint);
FINDSYM(secsym_eglDestroyImage, "eglDestroyImageKHR", "EGL_KHR_image_base", secsym_func_uint);
FINDSYM(secsym_eglDestroyImage, "eglDestroyImageKHR", "EGL_KHR_image", secsym_func_uint);
FINDSYM(secsym_eglDestroyImage, "eglDestroyImageOES", "GL_OES_EGL_image_base", secsym_func_uint);
FINDSYM(secsym_eglDestroyImage, "eglDestroyImageOES", "GL_OES_EGL_image", secsym_func_uint);
if (extsn)
{
FINDSYMN(eglsym_eglCreateImageKHR, "eglCreateImageKHR", "EGL_KHR_image_base", secsym_func_void_ptr);
FINDSYMN(eglsym_eglCreateImageKHR, "eglCreateImageKHR", "EGL_KHR_image", secsym_func_void_ptr);
FINDSYMN(eglsym_eglCreateImageKHR, "eglCreateImageOES", "GL_OES_EGL_image_base", secsym_func_void_ptr);
FINDSYMN(eglsym_eglCreateImageKHR, "eglCreateImageOES", "GL_OES_EGL_image", secsym_func_void_ptr);
if (eglsym_eglCreateImageKHR)
{
FINDSYMN(secsym_eglDestroyImage, "eglDestroyImageKHR", "EGL_KHR_image_base", secsym_func_uint);
FINDSYMN(secsym_eglDestroyImage, "eglDestroyImageKHR", "EGL_KHR_image", secsym_func_uint);
FINDSYMN(secsym_eglDestroyImage, "eglDestroyImageOES", "GL_OES_EGL_image_base", secsym_func_uint);
FINDSYMN(secsym_eglDestroyImage, "eglDestroyImageOES", "GL_OES_EGL_image", secsym_func_uint);
}
else
{
FINDSYMN(eglsym_eglCreateImage, "eglCreateImage", "EGL_KHR_get_all_proc_addresses", secsym_func_void_ptr);
FINDSYMN(eglsym_eglCreateImage, "eglCreateImage", "EGL_KHR_client_get_all_proc_addresses", secsym_func_void_ptr);
FINDSYMN(secsym_eglDestroyImage, "eglDestroyImage", "EGL_KHR_get_all_proc_addresses", secsym_func_uint);
FINDSYMN(secsym_eglDestroyImage, "eglDestroyImage", "EGL_KHR_client_get_all_proc_addresses", secsym_func_uint);
}
}
else
{
// FIXME: this fl_fallback is a hack for wayland gl_drm to work
// .... :(
dl_fallback = EINA_TRUE;
FINDSYMN(eglsym_eglCreateImageKHR, "eglCreateImageKHR", NULL, secsym_func_void_ptr);
FINDSYMN(eglsym_eglCreateImageKHR, "eglCreateImageOES", NULL, secsym_func_void_ptr);
if (eglsym_eglCreateImageKHR)
{
FINDSYMN(secsym_eglDestroyImage, "eglDestroyImageKHR", NULL, secsym_func_uint);
FINDSYMN(secsym_eglDestroyImage, "eglDestroyImageOES", NULL, secsym_func_uint);
}
else
{
FINDSYMN(eglsym_eglCreateImage, "eglCreateImage", NULL, secsym_func_void_ptr);
FINDSYMN(secsym_eglDestroyImage, "eglDestroyImage", NULL, secsym_func_uint);
}
}
FINDSYM(glsym_glProgramParameteri, "glProgramParameteri", NULL, glsym_func_void);
FINDSYM(glsym_glProgramParameteri, "glProgramParameteriEXT", "GL_EXT_geometry_shader4", glsym_func_void);
FINDSYM(glsym_glProgramParameteri, "glProgramParameteriARB", "GL_ARB_geometry_shader4", glsym_func_void);
FINDSYM(secsym_glEGLImageTargetTexture2DOES, "glEGLImageTargetTexture2DOES", "GL_OES_EGL_image_external", glsym_func_void);
FINDSYMN(secsym_glEGLImageTargetTexture2DOES, "glEGLImageTargetTexture2DOES", "GL_OES_EGL_image_external", glsym_func_void);
// Old SEC extensions
FINDSYM(secsym_eglMapImageSEC, "eglMapImageSEC", NULL, secsym_func_void_ptr);
FINDSYM(secsym_eglUnmapImageSEC, "eglUnmapImageSEC", NULL, secsym_func_uint);
FINDSYM(secsym_eglGetImageAttribSEC, "eglGetImageAttribSEC", NULL, secsym_func_uint);
FINDSYMN(secsym_eglMapImageSEC, "eglMapImageSEC", NULL, secsym_func_void_ptr);
FINDSYMN(secsym_eglUnmapImageSEC, "eglUnmapImageSEC", NULL, secsym_func_uint);
FINDSYMN(secsym_eglGetImageAttribSEC, "eglGetImageAttribSEC", NULL, secsym_func_uint);
#undef FINDSYMN
#endif

View File

@ -74,8 +74,8 @@ glsym_func_void_ptr glsym_evas_gl_common_current_context_get = NULL;
/* dynamic loaded local egl function pointers */
_eng_fn (*glsym_eglGetProcAddress)(const char *a) = NULL;
EGLImageKHR (*glsym_evas_gl_common_eglCreateImage) (EGLDisplay a, EGLContext b, EGLenum c, EGLClientBuffer d, const EGLAttrib *e) = NULL;
void (*glsym_eglDestroyImage)(EGLDisplay a, void *b) = NULL;
EGLImageKHR (*glsym_evas_gl_common_eglCreateImage) (EGLDisplay a, EGLContext b, EGLenum c, EGLClientBuffer d, const EGLAttrib *e) = NULL;
int (*glsym_evas_gl_common_eglDestroyImage) (EGLDisplay a, void *b) = NULL;
void (*glsym_glEGLImageTargetTexture2DOES)(int a, void *b) = NULL;
unsigned int (*glsym_eglSwapBuffersWithDamage)(EGLDisplay a, void *b, const EGLint *d, EGLint c) = NULL;
unsigned int (*glsym_eglQueryWaylandBufferWL)(EGLDisplay a, void *b, EGLint c, EGLint *d) = NULL;
@ -155,6 +155,7 @@ static void
gl_symbols(void)
{
static Eina_Bool done = EINA_FALSE;
const char *exts = NULL;
if (done) return;
@ -187,14 +188,15 @@ gl_symbols(void)
LINK2GENERIC(eglGetProcAddress);
LINK2GENERIC(evas_gl_common_eglCreateImage);
LINK2GENERIC(evas_gl_common_eglDestroyImage);
#define FINDSYM(dst, sym, typ) \
if (!dst) dst = (typ)glsym_eglGetProcAddress(sym);
glsym_evas_gl_symbols((void*)glsym_eglGetProcAddress);
FINDSYM(glsym_eglDestroyImage, "eglDestroyImageKHR", glsym_func_void);
FINDSYM(glsym_eglDestroyImage, "eglDestroyImage", glsym_func_void);
// Find EGL extensions
// FIXME: whgen above eglGetDisplay() is fixed... fix the below...
// exts = eglQueryString(ob->egl_disp, EGL_EXTENSIONS);
glsym_evas_gl_symbols((void*)glsym_eglGetProcAddress, exts);
FINDSYM(glsym_glEGLImageTargetTexture2DOES,
"glEGLImageTargetTexture2DOES", glsym_func_void);
@ -620,7 +622,7 @@ gl_import_simple_dmabuf(EGLDisplay display, struct dmabuf_attributes *attributes
int atti = 0;
if (!dmabuf_present) return NULL;
if (!glsym_eglDestroyImage) return NULL;
if (!glsym_evas_gl_common_eglDestroyImage) return NULL;
/* This requires the Mesa commit in
* Mesa 10.3 (08264e5dad4df448e7718e782ad9077902089a07) or
@ -690,7 +692,7 @@ _native_cb_bind(void *image)
/* Must re-import every time for coherency. */
if (n->ns_data.wl_surface_dmabuf.image)
glsym_eglDestroyImage(img->native.disp, n->ns_data.wl_surface_dmabuf.image);
glsym_evas_gl_common_eglDestroyImage(img->native.disp, n->ns_data.wl_surface_dmabuf.image);
v = gl_import_simple_dmabuf(img->native.disp, &n->ns_data.wl_surface_dmabuf.attr);
if (!v) return;
glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, v);
@ -727,7 +729,7 @@ _native_cb_unbind(void *image)
if (n->ns.type == EVAS_NATIVE_SURFACE_WL_DMABUF)
{
if (n->ns_data.wl_surface_dmabuf.image)
glsym_eglDestroyImage(img->native.disp, n->ns_data.wl_surface_dmabuf.image);
glsym_evas_gl_common_eglDestroyImage(img->native.disp, n->ns_data.wl_surface_dmabuf.image);
n->ns_data.wl_surface_dmabuf.image = NULL;
}
else if (n->ns.type == EVAS_NATIVE_SURFACE_WL)
@ -846,9 +848,9 @@ _native_cb_free(void *image)
eina_hash_del(img->native.shared->native_wl_hash, &wlid, img);
if (n->ns_data.wl_surface.surface)
{
if (glsym_eglDestroyImage && n->ns_data.wl_surface_dmabuf.image)
if (glsym_evas_gl_common_eglDestroyImage && n->ns_data.wl_surface_dmabuf.image)
{
glsym_eglDestroyImage(img->native.disp, n->ns_data.wl_surface_dmabuf.image);
glsym_evas_gl_common_eglDestroyImage(img->native.disp, n->ns_data.wl_surface_dmabuf.image);
GLERRV("eglDestroyImage() failed.");
}
}
@ -859,9 +861,9 @@ _native_cb_free(void *image)
eina_hash_del(img->native.shared->native_wl_hash, &wlid, img);
if (n->ns_data.wl_surface.surface)
{
if (glsym_eglDestroyImage)
if (glsym_evas_gl_common_eglDestroyImage)
{
glsym_eglDestroyImage(img->native.disp, n->ns_data.wl_surface.surface);
glsym_evas_gl_common_eglDestroyImage(img->native.disp, n->ns_data.wl_surface.surface);
GLERRV("eglDestroyImage() failed.");
}
else
@ -1204,7 +1206,7 @@ eng_image_native_set(void *engine, void *image, void *native)
v = gl_import_simple_dmabuf(ob->egl.disp, attr);
if (!v) return NULL;
glsym_eglDestroyImage(ob->egl.disp, v);
glsym_evas_gl_common_eglDestroyImage(ob->egl.disp, v);
img =
glsym_evas_gl_common_image_new_from_data(ob->gl_context,
attr->width,
@ -1395,7 +1397,7 @@ eng_image_native_set(void *engine, void *image, void *native)
&wlid, img);
n->ns_data.wl_surface.wl_buf = wl_buf;
if (glsym_eglDestroyImage)
if (glsym_evas_gl_common_eglDestroyImage)
n->ns_data.wl_surface.surface = glsym_evas_gl_common_eglCreateImage(ob->egl.disp,
NULL,
EGL_WAYLAND_BUFFER_WL,

View File

@ -360,6 +360,8 @@ eng_canvas_alpha_get(void *data EINA_UNUSED)
static void
gl_symbols(void)
{
const char *exts = NULL;
#define LINK2GENERIC(sym) \
glsym_##sym = dlsym(RTLD_DEFAULT, #sym);
@ -372,7 +374,12 @@ gl_symbols(void)
LINK2GENERIC(evas_gl_common_context_resize);
LINK2GENERIC(evas_gl_preload_render_lock);
glsym_evas_gl_symbols((void*)SDL_GL_GetProcAddress);
// Find EGL extensions
// FIXME: whgen above eglGetDisplay() is fixed... fix the below...
// exts = eglQueryString(ob->egl_disp, EGL_EXTENSIONS);
// Find EGL extensions
glsym_evas_gl_symbols((void*)SDL_GL_GetProcAddress, exts);
}
static int

View File

@ -79,12 +79,12 @@ glsym_func_void_ptr glsym_evas_gl_common_current_context_get = NULL;
#ifdef GL_GLES
_eng_fn (*glsym_eglGetProcAddress) (const char *a) = NULL;
EGLImageKHR (*glsym_evas_gl_common_eglCreateImage)(EGLDisplay a, EGLContext b, EGLenum c, EGLClientBuffer d, const EGLAttrib *e) = NULL;
void (*glsym_eglDestroyImage) (EGLDisplay a, void *b) = NULL;
void (*glsym_glEGLImageTargetTexture2DOES) (int a, void *b) = NULL;
unsigned int (*glsym_eglSwapBuffersWithDamage) (EGLDisplay a, void *b, const EGLint *d, EGLint c) = NULL;
unsigned int (*glsym_eglSetDamageRegionKHR) (EGLDisplay a, EGLSurface b, EGLint *c, EGLint d) = NULL;
_eng_fn (*glsym_eglGetProcAddress) (const char *a) = NULL;
EGLImageKHR (*glsym_evas_gl_common_eglCreateImage)(EGLDisplay a, EGLContext b, EGLenum c, EGLClientBuffer d, const EGLAttrib *e) = NULL;
int (*glsym_evas_gl_common_eglDestroyImage) (EGLDisplay a, void *b) = NULL;
void (*glsym_glEGLImageTargetTexture2DOES) (int a, void *b) = NULL;
unsigned int (*glsym_eglSwapBuffersWithDamage) (EGLDisplay a, void *b, const EGLint *d, EGLint c) = NULL;
unsigned int (*glsym_eglSetDamageRegionKHR) (EGLDisplay a, EGLSurface b, EGLint *c, EGLint d) = NULL;
unsigned int (*glsym_eglQueryWaylandBufferWL)(EGLDisplay a, /*struct wl_resource */void *b, EGLint c, EGLint *d) = NULL;
#else
@ -1360,17 +1360,14 @@ eng_gl_symbols(Outbuf *ob)
dst = (typ) dlsym(RTLD_DEFAULT, sym); \
}} while (0)
// Find GL extensions
glsym_evas_gl_symbols((void*)glsym_eglGetProcAddress);
// Find EGL extensions
exts = eglQueryString(ob->egl_disp, EGL_EXTENSIONS);
LINK2GENERIC(evas_gl_common_eglCreateImage);
// Find GL extensions
glsym_evas_gl_symbols((void*)glsym_eglGetProcAddress, exts);
FINDSYM(glsym_eglDestroyImage, "eglDestroyImage", NULL, glsym_func_void);
FINDSYM(glsym_eglDestroyImage, "eglDestroyImageKHR", "EGL_KHR_image_base", glsym_func_void);
FINDSYM(glsym_eglDestroyImage, "eglDestroyImageKHR", "EGL_KHR_image", glsym_func_void);
LINK2GENERIC(evas_gl_common_eglCreateImage);
LINK2GENERIC(evas_gl_common_eglDestroyImage);
FINDSYM(glsym_eglSwapBuffersWithDamage, "eglSwapBuffersWithDamage", NULL, glsym_func_uint);
FINDSYM(glsym_eglSwapBuffersWithDamage, "eglSwapBuffersWithDamageEXT", "EGL_EXT_swap_buffers_with_damage", glsym_func_uint);
@ -1396,12 +1393,12 @@ eng_gl_symbols(Outbuf *ob)
dst = (typ) dlsym(RTLD_DEFAULT, sym); \
}} while (0)
// Find GL extensions
glsym_evas_gl_symbols((void*)glsym_glXGetProcAddress);
// Find GLX extensions
exts = glXQueryExtensionsString((Display *) ob->disp, ob->screen);
// Find GL extensions
glsym_evas_gl_symbols((void*)glsym_glXGetProcAddress, exts);
FINDSYM(glsym_glXBindTexImage, "glXBindTexImage", NULL, glsym_func_void);
FINDSYM(glsym_glXBindTexImage, "glXBindTexImageEXT", "GLX_EXT_texture_from_pixmap", glsym_func_void);
FINDSYM(glsym_glXBindTexImage, "glXBindTexImageARB", "GLX_ARB_render_texture", glsym_func_void);
@ -1975,13 +1972,14 @@ _native_bind_cb(void *image)
if (n->ns_data.x11.multiple_buffer)
{
EGLint err;
if (!glsym_eglDestroyImage)
if (!glsym_evas_gl_common_eglDestroyImage)
{
ERR("Try eglDestroyImage()/eglCreateImage() on EGL with no support");
return;
}
glsym_eglDestroyImage(im->native.disp, n->ns_data.x11.surface);
glsym_evas_gl_common_eglDestroyImage(im->native.disp,
n->ns_data.x11.surface);
if ((err = eglGetError()) != EGL_SUCCESS)
{
ERR("eglDestroyImage() failed.");
@ -2145,10 +2143,10 @@ _native_free_cb(void *image)
if (n->ns_data.x11.surface)
{
int err;
if (glsym_eglDestroyImage)
if (glsym_evas_gl_common_eglDestroyImage)
{
glsym_eglDestroyImage(im->native.disp,
n->ns_data.x11.surface);
glsym_evas_gl_common_eglDestroyImage(im->native.disp,
n->ns_data.x11.surface);
if ((err = eglGetError()) != EGL_SUCCESS)
{
ERR("eglDestroyImage() failed.");
@ -2196,10 +2194,10 @@ _native_free_cb(void *image)
if (n->ns_data.tbm.surface)
{
int err;
if (glsym_eglDestroyImage)
if (glsym_evas_gl_common_eglDestroyImage)
{
glsym_eglDestroyImage(im->native.disp,
n->ns_data.tbm.surface);
glsym_evas_gl_common_eglDestroyImage(im->native.disp,
n->ns_data.tbm.surface);
if ((err = eglGetError()) != EGL_SUCCESS)
{
ERR("eglDestroyImage() failed.");
@ -2223,9 +2221,10 @@ _native_free_cb(void *image)
eina_hash_del(im->native.shared->native_wl_hash, &wlid, image);
if (n->ns_data.wl_surface.surface)
{
if (glsym_eglDestroyImage)
if (glsym_evas_gl_common_eglDestroyImage)
{
glsym_eglDestroyImage(im->native.disp, n->ns_data.wl_surface.surface);
glsym_evas_gl_common_eglDestroyImage(im->native.disp,
n->ns_data.wl_surface.surface);
if (eglGetError() != EGL_SUCCESS)
ERR("eglDestroyImage() failed.");
}
@ -2527,7 +2526,7 @@ eng_image_native_set(void *engine, void *image, void *native)
#ifdef GL_GLES
if (native)
{
if (!glsym_eglDestroyImage)
if (!glsym_evas_gl_common_eglDestroyImage)
{
ERR("Try eglCreateImage on EGL with no support");
return NULL;
@ -2874,12 +2873,13 @@ eng_image_native_set(void *engine, void *image, void *native)
memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface));
n->ns_data.tbm.buffer = buffer;
if (glsym_eglDestroyImage)
n->ns_data.tbm.surface = glsym_evas_gl_common_eglCreateImage(eng_get_ob(re)->egl_disp,
EGL_NO_CONTEXT,
EGL_NATIVE_SURFACE_TIZEN,
(void *)buffer,
NULL);
if (glsym_evas_gl_common_eglDestroyImage)
n->ns_data.tbm.surface =
glsym_evas_gl_common_eglCreateImage(eng_get_ob(re)->egl_disp,
EGL_NO_CONTEXT,
EGL_NATIVE_SURFACE_TIZEN,
(void *)buffer,
NULL);
else
ERR("Try eglCreateImage on EGL with no support");
if (!n->ns_data.tbm.surface)
@ -2976,11 +2976,12 @@ eng_image_native_set(void *engine, void *image, void *native)
&wlid, im);
n->ns_data.wl_surface.wl_buf = wl_buf;
if (glsym_eglDestroyImage)
n->ns_data.wl_surface.surface = glsym_evas_gl_common_eglCreateImage(eng_get_ob(re)->egl_disp,
NULL,
EGL_WAYLAND_BUFFER_WL,
wl_buf, attribs);
if (glsym_evas_gl_common_eglDestroyImage)
n->ns_data.wl_surface.surface =
glsym_evas_gl_common_eglCreateImage(eng_get_ob(re)->egl_disp,
NULL,
EGL_WAYLAND_BUFFER_WL,
wl_buf, attribs);
else
{
ERR("Try eglCreateImage on EGL with no support");

View File

@ -68,7 +68,7 @@ Evas_GL_Preload_Render_Call glsym_evas_gl_preload_render_relax = NULL;
_eng_fn (*glsym_eglGetProcAddress) (const char *a) = NULL;
EGLImageKHR (*glsym_evas_gl_common_eglCreateImage)(EGLDisplay a, EGLContext b, EGLenum c, EGLClientBuffer d, const EGLAttrib *e) = NULL;
void (*glsym_eglDestroyImage) (EGLDisplay a, void *b) = NULL;
int (*glsym_evas_gl_common_eglDestroyImage) (EGLDisplay a, void *b) = NULL;
void (*glsym_glEGLImageTargetTexture2DOES) (int a, void *b) = NULL;
unsigned int (*glsym_eglSwapBuffersWithDamage) (EGLDisplay a, void *b, const EGLint *d, EGLint c) = NULL;
unsigned int (*glsym_eglSetDamageRegionKHR) (EGLDisplay a, EGLSurface b, EGLint *c, EGLint d) = NULL;
@ -95,6 +95,7 @@ static void
gl_symbols(void)
{
static Eina_Bool done = EINA_FALSE;
const char *exts = NULL;
if (done) return;
@ -136,6 +137,7 @@ gl_symbols(void)
LINK2GENERIC(evas_gl_symbols);
LINK2GENERIC(eglGetProcAddress);
LINK2GENERIC(evas_gl_common_eglCreateImage);
LINK2GENERIC(evas_gl_common_eglDestroyImage);
#define FINDSYM(dst, sym, typ) \
if (glsym_eglGetProcAddress) { \
@ -144,10 +146,12 @@ gl_symbols(void)
if (!dst) dst = (typ)dlsym(RTLD_DEFAULT, sym); \
}
glsym_evas_gl_symbols((void*)glsym_eglGetProcAddress);
// Find EGL extensions
// FIXME: whgen above eglGetDisplay() is fixed... fix the below...
// exts = eglQueryString(ob->egl_disp, EGL_EXTENSIONS);
FINDSYM(glsym_eglDestroyImage, "eglDestroyImage", glsym_func_void);
FINDSYM(glsym_eglDestroyImage, "eglDestroyImageKHR", glsym_func_void);
// Find GL extensions
glsym_evas_gl_symbols((void*)glsym_eglGetProcAddress, exts);
FINDSYM(glsym_glEGLImageTargetTexture2DOES, "glEGLImageTargetTexture2DOES",
glsym_func_void);
@ -919,17 +923,20 @@ _native_cb_free(void *image)
{
wlid = (void*)n->ns_data.wl_surface.wl_buf;
eina_hash_del(img->native.shared->native_wl_hash, &wlid, img);
#ifdef GL_GLES
if (n->ns_data.wl_surface.surface)
{
if (glsym_eglDestroyImage)
if (glsym_evas_gl_common_eglDestroyImage)
{
glsym_eglDestroyImage(img->native.disp, n->ns_data.wl_surface.surface);
glsym_evas_gl_common_eglDestroyImage(img->native.disp,
n->ns_data.wl_surface.surface);
if (eglGetError() != EGL_SUCCESS)
ERR("eglDestroyImage() failed.");
}
else
ERR("Try eglDestroyImage on EGL with no support");
}
#endif
}
else if (n->ns.type == EVAS_NATIVE_SURFACE_OPENGL)
{
@ -947,10 +954,10 @@ _native_cb_free(void *image)
if (n->ns_data.tbm.surface)
{
int err;
if (glsym_eglDestroyImage)
if (glsym_evas_gl_common_eglDestroyImage)
{
glsym_eglDestroyImage(img->native.disp,
n->ns_data.tbm.surface);
glsym_evas_gl_common_eglDestroyImage(img->native.disp,
n->ns_data.tbm.surface);
if ((err = eglGetError()) != EGL_SUCCESS)
{
ERR("eglDestroyImage() failed.");
@ -1245,8 +1252,9 @@ eng_image_native_set(void *engine, void *image, void *native)
&wlid, img);
n->ns_data.wl_surface.wl_buf = wl_buf;
if (glsym_eglDestroyImage)
n->ns_data.wl_surface.surface = glsym_evas_gl_common_eglCreateImage(ob->egl_disp,
if (glsym_evas_gl_common_eglDestroyImage)
n->ns_data.wl_surface.surface =
glsym_evas_gl_common_eglCreateImage(ob->egl_disp,
NULL,
EGL_WAYLAND_BUFFER_WL,
wl_buf, attribs);
@ -1355,12 +1363,13 @@ eng_image_native_set(void *engine, void *image, void *native)
memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface));
n->ns_data.tbm.buffer = buffer;
if (glsym_eglDestroyImage)
n->ns_data.tbm.surface = glsym_evas_gl_common_eglCreateImage(ob->egl_disp,
EGL_NO_CONTEXT,
EGL_NATIVE_SURFACE_TIZEN,
(void *)buffer,
NULL);
if (glsym_evas_gl_common_eglDestroyImage)
n->ns_data.tbm.surface =
glsym_evas_gl_common_eglCreateImage(ob->egl_disp,
EGL_NO_CONTEXT,
EGL_NATIVE_SURFACE_TIZEN,
(void *)buffer,
NULL);
else
ERR("Try eglCreateImage on EGL with no support");
if (!n->ns_data.tbm.surface)