diff options
author | Jean-Philippe Andre <jp.andre@samsung.com> | 2016-08-03 11:29:14 +0900 |
---|---|---|
committer | Jean-Philippe Andre <jp.andre@samsung.com> | 2016-08-03 17:32:14 +0900 |
commit | 444ab8fb175d2387513efb5256cc4c3bd4844702 (patch) | |
tree | 30403d85ad238c131e727675af9c15aa8f8ffe7a /src | |
parent | abeeb11b19a30a5721389bbd9699f92d0aca76a4 (diff) |
gl_x11: Minor code refactor around eglCreateImage
Trying to debug T3030... hitting a brick wall at the moment.
Add better error handling (for EGL).
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/evas/engines/gl_x11/evas_engine.c | 33 |
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) | |||
2551 | #ifdef GL_GLES | 2551 | #ifdef GL_GLES |
2552 | if (native) | 2552 | if (native) |
2553 | { | 2553 | { |
2554 | if (!glsym_eglCreateImage) | ||
2555 | { | ||
2556 | ERR("Try eglCreateImage on EGL with no support"); | ||
2557 | return NULL; | ||
2558 | } | ||
2554 | n = calloc(1, sizeof(Native)); | 2559 | n = calloc(1, sizeof(Native)); |
2555 | if (n) | 2560 | if (n) |
2556 | { | 2561 | { |
@@ -2559,8 +2564,6 @@ eng_image_native_set(void *data, void *image, void *native) | |||
2559 | int num_config, i = 0; | 2564 | int num_config, i = 0; |
2560 | int yinvert = 1; | 2565 | int yinvert = 1; |
2561 | 2566 | ||
2562 | eina_hash_add(eng_get_ob(re)->gl_context->shared->native_pm_hash, &pmid, im); | ||
2563 | |||
2564 | // assume 32bit pixmap! :) | 2567 | // assume 32bit pixmap! :) |
2565 | config_attrs[i++] = EGL_RED_SIZE; | 2568 | config_attrs[i++] = EGL_RED_SIZE; |
2566 | config_attrs[i++] = 8; | 2569 | config_attrs[i++] = 8; |
@@ -2587,9 +2590,11 @@ eng_image_native_set(void *data, void *image, void *native) | |||
2587 | &egl_config, 1, &num_config)) | 2590 | &egl_config, 1, &num_config)) |
2588 | { | 2591 | { |
2589 | int err = eglGetError(); | 2592 | int err = eglGetError(); |
2590 | ERR("eglChooseConfig() failed for pixmap 0x%x, num_config = %i with error %d", | 2593 | ERR("eglChooseConfig() failed for pixmap %#lx, " |
2591 | (unsigned int)pm, num_config, err); | 2594 | "num_config = %i with error %d", pm, num_config, err); |
2592 | glsym_evas_gl_common_error_set(err - EGL_SUCCESS); | 2595 | glsym_evas_gl_common_error_set(err - EGL_SUCCESS); |
2596 | free(n); | ||
2597 | return NULL; | ||
2593 | } | 2598 | } |
2594 | else | 2599 | else |
2595 | { | 2600 | { |
@@ -2603,18 +2608,17 @@ eng_image_native_set(void *data, void *image, void *native) | |||
2603 | memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface)); | 2608 | memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface)); |
2604 | n->ns_data.x11.pixmap = pm; | 2609 | n->ns_data.x11.pixmap = pm; |
2605 | n->ns_data.x11.visual = vis; | 2610 | n->ns_data.x11.visual = vis; |
2606 | if (glsym_eglCreateImage) | 2611 | n->ns_data.x11.surface = glsym_eglCreateImage(eng_get_ob(re)->egl_disp, |
2607 | n->ns_data.x11.surface = glsym_eglCreateImage(eng_get_ob(re)->egl_disp, | 2612 | EGL_NO_CONTEXT, |
2608 | EGL_NO_CONTEXT, | 2613 | EGL_NATIVE_PIXMAP_KHR, |
2609 | EGL_NATIVE_PIXMAP_KHR, | 2614 | (void *)pm, NULL); |
2610 | (void *)pm, | ||
2611 | NULL); | ||
2612 | else | ||
2613 | ERR("Try eglCreateImage on EGL with no support"); | ||
2614 | if (!n->ns_data.x11.surface) | 2615 | if (!n->ns_data.x11.surface) |
2615 | ERR("eglCreatePixmapSurface() for 0x%x failed", (unsigned int)pm); | 2616 | { |
2617 | ERR("eglCreateImage() for Pixmap %#lx failed: %#x", pm, eglGetError()); | ||
2618 | free(n); | ||
2619 | return NULL; | ||
2620 | } | ||
2616 | n->ns_data.x11.config = (void *)egl_config; | 2621 | n->ns_data.x11.config = (void *)egl_config; |
2617 | |||
2618 | im->native.yinvert = yinvert; | 2622 | im->native.yinvert = yinvert; |
2619 | im->native.loose = 0; | 2623 | im->native.loose = 0; |
2620 | im->native.disp = eng_get_ob(re)->egl_disp; | 2624 | im->native.disp = eng_get_ob(re)->egl_disp; |
@@ -2625,6 +2629,7 @@ eng_image_native_set(void *data, void *image, void *native) | |||
2625 | im->native.func.free = _native_free_cb; | 2629 | im->native.func.free = _native_free_cb; |
2626 | im->native.target = GL_TEXTURE_2D; | 2630 | im->native.target = GL_TEXTURE_2D; |
2627 | im->native.mipmap = 0; | 2631 | im->native.mipmap = 0; |
2632 | eina_hash_add(eng_get_ob(re)->gl_context->shared->native_pm_hash, &pmid, im); | ||
2628 | glsym_evas_gl_common_image_native_enable(im); | 2633 | glsym_evas_gl_common_image_native_enable(im); |
2629 | } | 2634 | } |
2630 | } | 2635 | } |