forked from enlightenment/efl
gl_drm: Fix eglCreateImage for 32-bit systems
eglCreateImageKHR and eglCreateImage have different prototypes, but we treated them the same. Fix that so 32-bit users can have them too.
This commit is contained in:
parent
adabe89b3a
commit
f0e8ebeaea
|
@ -67,7 +67,8 @@ glsym_func_void_ptr glsym_evas_gl_common_current_context_get = NULL;
|
||||||
|
|
||||||
/* dynamic loaded local egl function pointers */
|
/* dynamic loaded local egl function pointers */
|
||||||
_eng_fn (*glsym_eglGetProcAddress)(const char *a) = NULL;
|
_eng_fn (*glsym_eglGetProcAddress)(const char *a) = NULL;
|
||||||
void *(*glsym_eglCreateImage)(EGLDisplay a, EGLContext b, EGLenum c, EGLClientBuffer d, const int *e) = NULL;
|
EGLImage (*glsym_eglCreateImage) (EGLDisplay a, EGLContext b, EGLenum c, EGLClientBuffer d, const EGLAttrib *e) = NULL;
|
||||||
|
EGLImage (*glsym_eglCreateImageKHR) (EGLDisplay a, EGLContext b, EGLenum c, EGLClientBuffer d, EGLint *e) = NULL;
|
||||||
void (*glsym_eglDestroyImage)(EGLDisplay a, void *b) = NULL;
|
void (*glsym_eglDestroyImage)(EGLDisplay a, void *b) = NULL;
|
||||||
void (*glsym_glEGLImageTargetTexture2DOES)(int 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_eglSwapBuffersWithDamage)(EGLDisplay a, void *b, const EGLint *d, EGLint c) = NULL;
|
||||||
|
@ -143,6 +144,29 @@ eng_gbm_shutdown(Evas_Engine_Info_GL_Drm *info)
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static EGLImage
|
||||||
|
_eflCreateImage(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list)
|
||||||
|
{
|
||||||
|
if (glsym_eglCreateImage)
|
||||||
|
return glsym_eglCreateImage(dpy, ctx, target, buffer, attrib_list);
|
||||||
|
if (glsym_eglCreateImageKHR)
|
||||||
|
{
|
||||||
|
int count, i;
|
||||||
|
EGLint *ints = NULL;
|
||||||
|
|
||||||
|
if (attrib_list)
|
||||||
|
{
|
||||||
|
for (count = 0; attrib_list[count] != EGL_NONE; count += 2);
|
||||||
|
count++;
|
||||||
|
ints = alloca(count * sizeof(EGLint));
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
ints[i] = attrib_list[i];
|
||||||
|
}
|
||||||
|
return glsym_eglCreateImageKHR(dpy, ctx, target, buffer, ints);
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* local functions */
|
/* local functions */
|
||||||
static void
|
static void
|
||||||
gl_symbols(void)
|
gl_symbols(void)
|
||||||
|
@ -192,7 +216,7 @@ gl_symbols(void)
|
||||||
|
|
||||||
glsym_evas_gl_symbols((void*)glsym_eglGetProcAddress);
|
glsym_evas_gl_symbols((void*)glsym_eglGetProcAddress);
|
||||||
|
|
||||||
FINDSYM(glsym_eglCreateImage, "eglCreateImageKHR", glsym_func_void_ptr);
|
FINDSYM(glsym_eglCreateImageKHR, "eglCreateImageKHR", glsym_func_void_ptr);
|
||||||
FINDSYM(glsym_eglCreateImage, "eglCreateImage", glsym_func_void_ptr);
|
FINDSYM(glsym_eglCreateImage, "eglCreateImage", glsym_func_void_ptr);
|
||||||
|
|
||||||
FINDSYM(glsym_eglDestroyImage, "eglDestroyImageKHR", glsym_func_void);
|
FINDSYM(glsym_eglDestroyImage, "eglDestroyImageKHR", glsym_func_void);
|
||||||
|
@ -600,9 +624,11 @@ _re_winfree(Render_Engine *re)
|
||||||
static EGLImageKHR
|
static EGLImageKHR
|
||||||
import_simple_dmabuf(EGLDisplay display, struct dmabuf_attributes *attributes)
|
import_simple_dmabuf(EGLDisplay display, struct dmabuf_attributes *attributes)
|
||||||
{
|
{
|
||||||
EGLint attribs[30];
|
EGLAttrib attribs[30];
|
||||||
int atti = 0;
|
int atti = 0;
|
||||||
|
|
||||||
|
if (!glsym_eglCreateImage && !glsym_eglCreateImageKHR) return NULL;
|
||||||
|
|
||||||
/* This requires the Mesa commit in
|
/* This requires the Mesa commit in
|
||||||
* Mesa 10.3 (08264e5dad4df448e7718e782ad9077902089a07) or
|
* Mesa 10.3 (08264e5dad4df448e7718e782ad9077902089a07) or
|
||||||
* Mesa 10.2.7 (55d28925e6109a4afd61f109e845a8a51bd17652).
|
* Mesa 10.2.7 (55d28925e6109a4afd61f109e845a8a51bd17652).
|
||||||
|
@ -651,7 +677,7 @@ import_simple_dmabuf(EGLDisplay display, struct dmabuf_attributes *attributes)
|
||||||
|
|
||||||
attribs[atti++] = EGL_NONE;
|
attribs[atti++] = EGL_NONE;
|
||||||
|
|
||||||
return glsym_eglCreateImage(display, EGL_NO_CONTEXT,
|
return _eflCreateImage(display, EGL_NO_CONTEXT,
|
||||||
EGL_LINUX_DMA_BUF_EXT,
|
EGL_LINUX_DMA_BUF_EXT,
|
||||||
NULL, attribs);
|
NULL, attribs);
|
||||||
}
|
}
|
||||||
|
@ -673,6 +699,7 @@ _native_cb_bind(void *image)
|
||||||
if (n->ns_data.wl_surface_dmabuf.image)
|
if (n->ns_data.wl_surface_dmabuf.image)
|
||||||
glsym_eglDestroyImage(img->native.disp, n->ns_data.wl_surface_dmabuf.image);
|
glsym_eglDestroyImage(img->native.disp, n->ns_data.wl_surface_dmabuf.image);
|
||||||
v = import_simple_dmabuf(img->native.disp, &n->ns_data.wl_surface_dmabuf.attr);
|
v = import_simple_dmabuf(img->native.disp, &n->ns_data.wl_surface_dmabuf.attr);
|
||||||
|
if (!v) return;
|
||||||
glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, v);
|
glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, v);
|
||||||
n->ns_data.wl_surface_dmabuf.image = v;
|
n->ns_data.wl_surface_dmabuf.image = v;
|
||||||
}
|
}
|
||||||
|
@ -1304,7 +1331,7 @@ eng_image_native_set(void *data, void *image, void *native)
|
||||||
{
|
{
|
||||||
if ((n = calloc(1, sizeof(Native))))
|
if ((n = calloc(1, sizeof(Native))))
|
||||||
{
|
{
|
||||||
EGLint attribs[3];
|
EGLAttrib attribs[3];
|
||||||
int format, yinvert = 1;
|
int format, yinvert = 1;
|
||||||
|
|
||||||
glsym_eglQueryWaylandBufferWL(ob->egl.disp, wl_buf,
|
glsym_eglQueryWaylandBufferWL(ob->egl.disp, wl_buf,
|
||||||
|
@ -1337,8 +1364,8 @@ eng_image_native_set(void *data, void *image, void *native)
|
||||||
&wlid, img);
|
&wlid, img);
|
||||||
|
|
||||||
n->ns_data.wl_surface.wl_buf = wl_buf;
|
n->ns_data.wl_surface.wl_buf = wl_buf;
|
||||||
if (glsym_eglCreateImage)
|
if (glsym_eglCreateImage || glsym_eglCreateImageKHR)
|
||||||
n->ns_data.wl_surface.surface = glsym_eglCreateImage(ob->egl.disp,
|
n->ns_data.wl_surface.surface = _eflCreateImage(ob->egl.disp,
|
||||||
NULL,
|
NULL,
|
||||||
EGL_WAYLAND_BUFFER_WL,
|
EGL_WAYLAND_BUFFER_WL,
|
||||||
wl_buf, attribs);
|
wl_buf, attribs);
|
||||||
|
|
Loading…
Reference in New Issue