aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-08-03 11:29:14 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-08-03 17:32:14 +0900
commit444ab8fb175d2387513efb5256cc4c3bd4844702 (patch)
tree30403d85ad238c131e727675af9c15aa8f8ffe7a
parentelm theme - don't use empty env vars eina_prefix handles anyway (diff)
downloadefl-444ab8fb175d2387513efb5256cc4c3bd4844702.tar.gz
gl_x11: Minor code refactor around eglCreateImage
Trying to debug https://phab.enlightenment.org/T3030... hitting a brick wall at the moment. Add better error handling (for EGL).
-rw-r--r--src/modules/evas/engines/gl_x11/evas_engine.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/modules/evas/engines/gl_x11/evas_engine.c b/src/modules/evas/engines/gl_x11/evas_engine.c
index 19fa9be2a6..7a9f943a55 100644
--- a/src/modules/evas/engines/gl_x11/evas_engine.c
+++ b/src/modules/evas/engines/gl_x11/evas_engine.c
@@ -2551,6 +2551,11 @@ eng_image_native_set(void *data, void *image, void *native)
#ifdef GL_GLES
if (native)
{
+ if (!glsym_eglCreateImage)
+ {
+ ERR("Try eglCreateImage on EGL with no support");
+ return NULL;
+ }
n = calloc(1, sizeof(Native));
if (n)
{
@@ -2559,8 +2564,6 @@ eng_image_native_set(void *data, void *image, void *native)
int num_config, i = 0;
int yinvert = 1;
- eina_hash_add(eng_get_ob(re)->gl_context->shared->native_pm_hash, &pmid, im);
-
// assume 32bit pixmap! :)
config_attrs[i++] = EGL_RED_SIZE;
config_attrs[i++] = 8;
@@ -2587,9 +2590,11 @@ eng_image_native_set(void *data, void *image, void *native)
&egl_config, 1, &num_config))
{
int err = eglGetError();
- ERR("eglChooseConfig() failed for pixmap 0x%x, num_config = %i with error %d",
- (unsigned int)pm, num_config, err);
+ ERR("eglChooseConfig() failed for pixmap %#lx, "
+ "num_config = %i with error %d", pm, num_config, err);
glsym_evas_gl_common_error_set(err - EGL_SUCCESS);
+ free(n);
+ return NULL;
}
else
{
@@ -2603,18 +2608,17 @@ eng_image_native_set(void *data, void *image, void *native)
memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface));
n->ns_data.x11.pixmap = pm;
n->ns_data.x11.visual = vis;
- if (glsym_eglCreateImage)
- n->ns_data.x11.surface = glsym_eglCreateImage(eng_get_ob(re)->egl_disp,
- EGL_NO_CONTEXT,
- EGL_NATIVE_PIXMAP_KHR,
- (void *)pm,
- NULL);
- else
- ERR("Try eglCreateImage on EGL with no support");
+ n->ns_data.x11.surface = glsym_eglCreateImage(eng_get_ob(re)->egl_disp,
+ EGL_NO_CONTEXT,
+ EGL_NATIVE_PIXMAP_KHR,
+ (void *)pm, NULL);
if (!n->ns_data.x11.surface)
- ERR("eglCreatePixmapSurface() for 0x%x failed", (unsigned int)pm);
+ {
+ ERR("eglCreateImage() for Pixmap %#lx failed: %#x", pm, eglGetError());
+ free(n);
+ return NULL;
+ }
n->ns_data.x11.config = (void *)egl_config;
-
im->native.yinvert = yinvert;
im->native.loose = 0;
im->native.disp = eng_get_ob(re)->egl_disp;
@@ -2625,6 +2629,7 @@ eng_image_native_set(void *data, void *image, void *native)
im->native.func.free = _native_free_cb;
im->native.target = GL_TEXTURE_2D;
im->native.mipmap = 0;
+ eina_hash_add(eng_get_ob(re)->gl_context->shared->native_pm_hash, &pmid, im);
glsym_evas_gl_common_image_native_enable(im);
}
}