summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongyeon Kim <dy5.kim@samsung.com>2015-03-02 14:40:12 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-03-02 15:55:47 +0900
commita32edfaf1999f232d923f6bff615c582415d5fbd (patch)
tree4a79081dac233060b52e929e4c3f33b32089d091
parent433d24cfa0ec815de82c8a3b35e57213dcb7b945 (diff)
evas/gl: implement dynamic hint set using tbm surface
Summary: Currently dynamic hint set is implemented using eglMapImageSEC extension, which is no longer supported by any drivers (should be deprecated) This patch implements dynamic hint set using Khronos extension EGL_TIZEN_image_native_surface. Since tbm surface library is required for this, libtbm.so is queried at context new. Test Plan: Local tests Reviewers: raster, Hermet, cedric, jpeg Subscribers: mer.kim, wonsik, cedric Differential Revision: https://phab.enlightenment.org/D2027 Signed-off-by: Jean-Philippe Andre <jp.andre@samsung.com> jpeg: I also fixed a few minor style issues and two warnings (bad function names, glsym instead of secsym).
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_common.h57
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_context.c59
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_image.c3
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_texture.c182
-rw-r--r--src/modules/evas/engines/gl_generic/evas_engine.c37
5 files changed, 257 insertions, 81 deletions
diff --git a/src/modules/evas/engines/gl_common/evas_gl_common.h b/src/modules/evas/engines/gl_common/evas_gl_common.h
index 0770162d1e..21bf4a7326 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_common.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_common.h
@@ -190,6 +190,9 @@
190#ifndef EGL_MAP_GL_TEXTURE_STRIDE_IN_BYTES_SEC 190#ifndef EGL_MAP_GL_TEXTURE_STRIDE_IN_BYTES_SEC
191# define EGL_MAP_GL_TEXTURE_STRIDE_IN_BYTES_SEC 0x320c 191# define EGL_MAP_GL_TEXTURE_STRIDE_IN_BYTES_SEC 0x320c
192#endif 192#endif
193#ifndef EGL_IMAGE_PRESERVED_KHR
194# define EGL_IMAGE_PRESERVED_KHR 0x30D2
195#endif
193#ifndef EGL_NATIVE_SURFACE_TIZEN 196#ifndef EGL_NATIVE_SURFACE_TIZEN
194#define EGL_NATIVE_SURFACE_TIZEN 0x32A1 197#define EGL_NATIVE_SURFACE_TIZEN 0x32A1
195#endif 198#endif
@@ -327,6 +330,7 @@ struct _Evas_GL_Shared
327 Eina_Bool tex_npo2 : 1; 330 Eina_Bool tex_npo2 : 1;
328 Eina_Bool tex_rect : 1; 331 Eina_Bool tex_rect : 1;
329 Eina_Bool sec_image_map : 1; 332 Eina_Bool sec_image_map : 1;
333 Eina_Bool sec_tbm_surface : 1;
330 Eina_Bool bin_program : 1; 334 Eina_Bool bin_program : 1;
331 Eina_Bool unpack_row_length : 1; 335 Eina_Bool unpack_row_length : 1;
332 Eina_Bool etc1 : 1; 336 Eina_Bool etc1 : 1;
@@ -523,6 +527,7 @@ struct _Evas_GL_Texture_Pool
523 int slot, fslot; 527 int slot, fslot;
524 struct { 528 struct {
525 void *img; 529 void *img;
530 void *buffer;
526 unsigned int *data; 531 unsigned int *data;
527 int w, h; 532 int w, h;
528 int stride; 533 int stride;
@@ -834,6 +839,58 @@ extern void (*secsym_glEGLImageTargetTexture2DOES) (int a, void *b);
834extern void *(*secsym_eglMapImageSEC) (void *a, void *b, int c, int d); 839extern void *(*secsym_eglMapImageSEC) (void *a, void *b, int c, int d);
835extern unsigned int (*secsym_eglUnmapImageSEC) (void *a, void *b, int c); 840extern unsigned int (*secsym_eglUnmapImageSEC) (void *a, void *b, int c);
836extern unsigned int (*secsym_eglGetImageAttribSEC) (void *a, void *b, int c, int *d); 841extern unsigned int (*secsym_eglGetImageAttribSEC) (void *a, void *b, int c, int *d);
842
843// TBM Surface stuff
844#define TBM_SURF_PLANE_MAX 4 /**< maximum number of planes */
845
846/* option to map the tbm_surface */
847#define TBM_SURF_OPTION_READ (1 << 0) /**< access option to read */
848#define TBM_SURF_OPTION_WRITE (1 << 1) /**< access option to write */
849
850#define __tbm_fourcc_code(a,b,c,d) ((uint32_t)(a) | ((uint32_t)(b) << 8) | \
851 ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24))
852
853#define TBM_FORMAT_C8 __tbm_fourcc_code('C', '8', ' ', ' ')
854#define TBM_FORMAT_RGBA8888 __tbm_fourcc_code('R', 'A', '2', '4')
855#define TBM_FORMAT_BGRA8888 __tbm_fourcc_code('B', 'A', '2', '4')
856#define TBM_FORMAT_RGB888 __tbm_fourcc_code('R', 'G', '2', '4')
857
858typedef struct _tbm_surface * tbm_surface_h;
859typedef uint32_t tbm_format;
860typedef struct _tbm_surface_plane
861{
862 unsigned char *ptr; /**< Plane pointer */
863 uint32_t size; /**< Plane size */
864 uint32_t offset; /**< Plane offset */
865 uint32_t stride; /**< Plane stride */
866
867 void *reserved1; /**< Reserved pointer1 */
868 void *reserved2; /**< Reserved pointer2 */
869 void *reserved3; /**< Reserved pointer3 */
870} tbm_surface_plane_s;
871
872typedef struct _tbm_surface_info
873{
874 uint32_t width; /**< TBM surface width */
875 uint32_t height; /**< TBM surface height */
876 tbm_format format; /**< TBM surface format*/
877 uint32_t bpp; /**< TBM surface bbp */
878 uint32_t size; /**< TBM surface size */
879
880 uint32_t num_planes; /**< The number of planes */
881 tbm_surface_plane_s planes[TBM_SURF_PLANE_MAX]; /**< Array of planes */
882
883 void *reserved4; /**< Reserved pointer4 */
884 void *reserved5; /**< Reserved pointer5 */
885 void *reserved6; /**< Reserved pointer6 */
886} tbm_surface_info_s;
887
888
889extern void *(*secsym_tbm_surface_create) (int width, int height, unsigned int format);
890extern int (*secsym_tbm_surface_destroy) (void *surface);
891extern int (*secsym_tbm_surface_map) (void *surface, int opt, void *info);
892extern int (*secsym_tbm_surface_unmap) (void *surface);
893extern int (*secsym_tbm_surface_get_info) (void *surface, void *info);
837#endif 894#endif
838 895
839Eina_Bool evas_gl_preload_push(Evas_GL_Texture_Async_Preload *async); 896Eina_Bool evas_gl_preload_push(Evas_GL_Texture_Async_Preload *async);
diff --git a/src/modules/evas/engines/gl_common/evas_gl_context.c b/src/modules/evas/engines/gl_common/evas_gl_context.c
index ff9ff260bf..878484fa54 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_context.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_context.c
@@ -10,6 +10,7 @@
10#define GLPIPES 1 10#define GLPIPES 1
11 11
12static int sym_done = 0; 12static int sym_done = 0;
13static int tbm_sym_done = 0;
13int _evas_engine_GL_common_log_dom = -1; 14int _evas_engine_GL_common_log_dom = -1;
14Cutout_Rects *_evas_gl_common_cutout_rects = NULL; 15Cutout_Rects *_evas_gl_common_cutout_rects = NULL;
15 16
@@ -41,6 +42,7 @@ void (*glsym_glEndTiling) (GLuint a) = NULL;
41typedef void (*_eng_fn) (void); 42typedef void (*_eng_fn) (void);
42 43
43typedef _eng_fn (*glsym_func_eng_fn) (); 44typedef _eng_fn (*glsym_func_eng_fn) ();
45typedef int (*secsym_func_int) ();
44typedef unsigned int (*secsym_func_uint) (); 46typedef unsigned int (*secsym_func_uint) ();
45typedef void *(*secsym_func_void_ptr) (); 47typedef void *(*secsym_func_void_ptr) ();
46 48
@@ -50,6 +52,17 @@ void (*secsym_glEGLImageTargetTexture2DOES) (int a, void *b) = NULL;
50void *(*secsym_eglMapImageSEC) (void *a, void *b, int c, int d) = NULL; 52void *(*secsym_eglMapImageSEC) (void *a, void *b, int c, int d) = NULL;
51unsigned int (*secsym_eglUnmapImageSEC) (void *a, void *b, int c) = NULL; 53unsigned int (*secsym_eglUnmapImageSEC) (void *a, void *b, int c) = NULL;
52unsigned int (*secsym_eglGetImageAttribSEC) (void *a, void *b, int c, int *d) = NULL; 54unsigned int (*secsym_eglGetImageAttribSEC) (void *a, void *b, int c, int *d) = NULL;
55
56////////////////////////////////////
57//libtbm.so.1
58static void *tbm_lib_handle;
59
60void *(*secsym_tbm_surface_create) (int width, int height, unsigned int format) = NULL;
61int (*secsym_tbm_surface_destroy) (void *surface) = NULL;
62int (*secsym_tbm_surface_map) (void *surface, int opt, void *info) = NULL;
63int (*secsym_tbm_surface_unmap) (void *surface) = NULL;
64int (*secsym_tbm_surface_get_info) (void *surface, void *info) = NULL;
65////////////////////////////////////
53#else 66#else
54typedef void (*_eng_fn) (void); 67typedef void (*_eng_fn) (void);
55 68
@@ -194,6 +207,42 @@ evas_gl_symbols(void *(*GetProcAddress)(const char *name))
194 207
195 FINDSYM(secsym_eglGetImageAttribSEC, "eglGetImageAttribSEC", secsym_func_uint); 208 FINDSYM(secsym_eglGetImageAttribSEC, "eglGetImageAttribSEC", secsym_func_uint);
196#endif 209#endif
210
211#undef FINDSYM
212#undef FINDSYM2
213#undef FALLBAK
214}
215
216static void
217tbm_symbols(void)
218{
219 if (tbm_sym_done) return;
220 tbm_sym_done = 1;
221
222#ifdef GL_GLES
223 tbm_lib_handle = dlopen("libtbm.so.1", RTLD_NOW);
224 if (!tbm_lib_handle)
225 {
226 DBG("Unable to open libtbm: %s", dlerror());
227 return;
228 }
229
230#define FINDSYM(dst, sym, typ) \
231 if (!dst) dst = (typ)dlsym(tbm_lib_handle, sym); \
232 if (!dst) \
233 { \
234 ERR("Symbol not found %s\n", sym); \
235 return; \
236 }
237
238 FINDSYM(secsym_tbm_surface_create, "tbm_surface_create", secsym_func_void_ptr);
239 FINDSYM(secsym_tbm_surface_destroy, "tbm_surface_destroy", secsym_func_int);
240 FINDSYM(secsym_tbm_surface_map, "tbm_surface_map", secsym_func_int);
241 FINDSYM(secsym_tbm_surface_unmap, "tbm_surface_unmap", secsym_func_int);
242 FINDSYM(secsym_tbm_surface_get_info, "tbm_surface_get_info", secsym_func_int);
243
244#undef FINDSYM
245#endif
197} 246}
198 247
199static void shader_array_flush(Evas_Engine_GL_Context *gc); 248static void shader_array_flush(Evas_Engine_GL_Context *gc);
@@ -544,6 +593,8 @@ evas_gl_common_context_new(void)
544 gc = calloc(1, sizeof(Evas_Engine_GL_Context)); 593 gc = calloc(1, sizeof(Evas_Engine_GL_Context));
545 if (!gc) return NULL; 594 if (!gc) return NULL;
546 595
596 tbm_symbols();
597
547 gc->references = 1; 598 gc->references = 1;
548 599
549 _evas_gl_common_context = gc; 600 _evas_gl_common_context = gc;
@@ -623,6 +674,14 @@ evas_gl_common_context_new(void)
623 (secsym_eglGetImageAttribSEC)) 674 (secsym_eglGetImageAttribSEC))
624 shared->info.sec_image_map = 1; 675 shared->info.sec_image_map = 1;
625 } 676 }
677 i = 0;
678
679 if ((secsym_tbm_surface_create) &&
680 (secsym_tbm_surface_destroy) &&
681 (secsym_tbm_surface_map) &&
682 (secsym_tbm_surface_unmap) &&
683 (secsym_tbm_surface_get_info))
684 shared->info.sec_tbm_surface = 1;
626#endif 685#endif
627 if (!strstr(ext, "GL_QCOM_tiled_rendering")) 686 if (!strstr(ext, "GL_QCOM_tiled_rendering"))
628 { 687 {
diff --git a/src/modules/evas/engines/gl_common/evas_gl_image.c b/src/modules/evas/engines/gl_common/evas_gl_image.c
index f4efb18ec7..ec5eddb8cc 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_image.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_image.c
@@ -599,7 +599,8 @@ evas_gl_common_image_content_hint_set(Evas_GL_Image *im, int hint)
599 if (im->content_hint == hint) return; 599 if (im->content_hint == hint) return;
600 im->content_hint = hint; 600 im->content_hint = hint;
601 if (!im->gc) return; 601 if (!im->gc) return;
602 if (!im->gc->shared->info.sec_image_map) return; 602 if ((!im->gc->shared->info.sec_image_map)
603 && (!im->gc->shared->info.sec_tbm_surface)) return;
603 if (!im->gc->shared->info.bgra) return; 604 if (!im->gc->shared->info.bgra) return;
604 // does not handle yuv yet. 605 // does not handle yuv yet.
605 // TODO: Check this list of cspaces 606 // TODO: Check this list of cspaces
diff --git a/src/modules/evas/engines/gl_common/evas_gl_texture.c b/src/modules/evas/engines/gl_common/evas_gl_texture.c
index c2af7f349b..2f3852f7cd 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_texture.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_texture.c
@@ -692,33 +692,10 @@ _pool_tex_dynamic_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, i
692 Evas_GL_Texture_Pool *pt = NULL; 692 Evas_GL_Texture_Pool *pt = NULL;
693 693
694#ifdef GL_GLES 694#ifdef GL_GLES
695 int fmt; // EGL_MAP_GL_TEXTURE_RGBA_SEC or EGL_MAP_GL_TEXTURE_RGB_SEC or bust
696 int pixtype; // EGL_MAP_GL_TEXTURE_UNSIGNED_BYTE_SEC or bust
697 int attr[] =
698 {
699 EGL_MAP_GL_TEXTURE_WIDTH_SEC, 32,
700 EGL_MAP_GL_TEXTURE_HEIGHT_SEC, 32,
701 EGL_MAP_GL_TEXTURE_FORMAT_SEC, EGL_MAP_GL_TEXTURE_RGBA_SEC,
702 EGL_MAP_GL_TEXTURE_PIXEL_TYPE_SEC, EGL_MAP_GL_TEXTURE_UNSIGNED_BYTE_SEC,
703 EGL_NONE
704 };
705 void *egldisplay; 695 void *egldisplay;
706 696
707 if (intformat != format) return NULL; 697 if (intformat != format) return NULL;
708 698
709 switch (intformat)
710 {
711#ifdef EGL_MAP_GL_TEXTURE_LUMINANCE_SEC
712 case GL_LUMINANCE: attr[5] = EGL_MAP_GL_TEXTURE_LUMINANCE_SEC; break;
713#endif
714#ifdef EGL_MAP_GL_TEXTURE_LUMINANCE_ALPHA_SEC
715 case GL_LUMINANCE_ALPHA: attr[5] = EGL_MAP_GL_TEXTURE_LUMINANCE_ALPHA_SEC; break;
716#endif
717 case GL_RGBA: attr[5] = EGL_MAP_GL_TEXTURE_RGBA_SEC; break;
718 case GL_BGRA: attr[5] = EGL_MAP_GL_TEXTURE_BGRA_SEC; break;
719 default: fprintf(stderr, "unknown format\n"); return NULL;
720 }
721
722 pt = calloc(1, sizeof(Evas_GL_Texture_Pool)); 699 pt = calloc(1, sizeof(Evas_GL_Texture_Pool));
723 if (!pt) return NULL; 700 if (!pt) return NULL;
724 _tex_adjust(gc, &w, &h); 701 _tex_adjust(gc, &w, &h);
@@ -745,48 +722,110 @@ _pool_tex_dynamic_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, i
745 722
746 egldisplay = pt->gc->egldisp; 723 egldisplay = pt->gc->egldisp;
747 724
748 attr[1] = pt->w; 725 if (gc->shared->info.sec_tbm_surface)
749 attr[3] = pt->h; 726 {
727 tbm_format buffer_format = TBM_FORMAT_RGBA8888;
728 tbm_surface_info_s info;
729 int attr[] =
730 {
731 EGL_IMAGE_PRESERVED_KHR, EGL_TRUE,
732 EGL_NONE,
733 };
750 734
751 // FIXME: seems a bit slower than i'd like - maybe too many flushes? 735 switch (intformat)
752 // FIXME: YCbCr no support as yet 736 {
753 pt->dyn.img = secsym_eglCreateImage(egldisplay, 737 case GL_LUMINANCE: buffer_format = TBM_FORMAT_C8; break;
754 EGL_NO_CONTEXT, 738 case GL_LUMINANCE_ALPHA: buffer_format = TBM_FORMAT_C8; break;
755 EGL_MAP_GL_TEXTURE_2D_SEC, 739 case GL_RGBA: buffer_format = TBM_FORMAT_RGBA8888; break;
756 0, attr); 740 case GL_BGRA: buffer_format = TBM_FORMAT_BGRA8888; break;
757 GLERRV("secsym_eglCreateImage"); 741 case GL_RGB: buffer_format = TBM_FORMAT_RGB888; break;
758 if (!pt->dyn.img) 742 default: ERR("TBM: unknown format"); return NULL;
743 }
744
745 pt->dyn.buffer = (void *)secsym_tbm_surface_create(pt->w, pt->h,
746 buffer_format);
747 if (!pt->dyn.buffer) goto error;
748
749 pt->dyn.img = secsym_eglCreateImage(egldisplay,
750 EGL_NO_CONTEXT,
751 EGL_NATIVE_SURFACE_TIZEN,
752 pt->dyn.buffer, attr);
753 if (!pt->dyn.img)
754 {
755 secsym_tbm_surface_destroy(pt->dyn.buffer);
756 goto error;
757 }
758 secsym_tbm_surface_get_info(pt->dyn.buffer, &info);
759 pt->dyn.w = info.width;
760 pt->dyn.h = info.height;
761 pt->dyn.stride = info.planes[0].stride;
762 }
763 else if (gc->shared->info.sec_image_map)
759 { 764 {
760 glBindTexture(GL_TEXTURE_2D, 0); 765 int fmt; // EGL_MAP_GL_TEXTURE_RGBA_SEC or EGL_MAP_GL_TEXTURE_RGB_SEC or bust
761 glDeleteTextures(1, &(pt->texture)); 766 int pixtype; // EGL_MAP_GL_TEXTURE_UNSIGNED_BYTE_SEC or bust
762 if (pt->eina_pool) 767 int attr[] =
763 eina_rectangle_pool_free(pt->eina_pool); 768 {
764 free(pt); 769 EGL_MAP_GL_TEXTURE_WIDTH_SEC, 32,
765 return NULL; 770 EGL_MAP_GL_TEXTURE_HEIGHT_SEC, 32,
771 EGL_MAP_GL_TEXTURE_FORMAT_SEC, EGL_MAP_GL_TEXTURE_RGBA_SEC,
772 EGL_MAP_GL_TEXTURE_PIXEL_TYPE_SEC, EGL_MAP_GL_TEXTURE_UNSIGNED_BYTE_SEC,
773 EGL_NONE
774 };
775
776 switch (intformat)
777 {
778#ifdef EGL_MAP_GL_TEXTURE_LUMINANCE_SEC
779 case GL_LUMINANCE: attr[5] = EGL_MAP_GL_TEXTURE_LUMINANCE_SEC; break;
780#endif
781#ifdef EGL_MAP_GL_TEXTURE_LUMINANCE_ALPHA_SEC
782 case GL_LUMINANCE_ALPHA: attr[5] = EGL_MAP_GL_TEXTURE_LUMINANCE_ALPHA_SEC; break;
783#endif
784 case GL_RGBA: attr[5] = EGL_MAP_GL_TEXTURE_RGBA_SEC; break;
785 case GL_BGRA: attr[5] = EGL_MAP_GL_TEXTURE_BGRA_SEC; break;
786 default: ERR("SEC map: unknown format"); return NULL;
787 }
788
789 attr[1] = pt->w;
790 attr[3] = pt->h;
791
792 // FIXME: seems a bit slower than i'd like - maybe too many flushes?
793 // FIXME: YCbCr no support as yet
794 pt->dyn.img = secsym_eglCreateImage(egldisplay,
795 EGL_NO_CONTEXT,
796 EGL_MAP_GL_TEXTURE_2D_SEC,
797 0, attr);
798 GLERRV("secsym_eglCreateImage");
799 if (!pt->dyn.img) goto error;
800
801 if (secsym_eglGetImageAttribSEC(egldisplay,
802 pt->dyn.img,
803 EGL_MAP_GL_TEXTURE_WIDTH_SEC,
804 &(pt->dyn.w)) != EGL_TRUE) goto error;
805 if (secsym_eglGetImageAttribSEC(egldisplay,
806 pt->dyn.img,
807 EGL_MAP_GL_TEXTURE_HEIGHT_SEC,
808 &(pt->dyn.h)) != EGL_TRUE) goto error;
809 if (secsym_eglGetImageAttribSEC(egldisplay,
810 pt->dyn.img,
811 EGL_MAP_GL_TEXTURE_STRIDE_IN_BYTES_SEC,
812 &(pt->dyn.stride)) != EGL_TRUE) goto error;
813 if (secsym_eglGetImageAttribSEC(egldisplay,
814 pt->dyn.img,
815 EGL_MAP_GL_TEXTURE_FORMAT_SEC,
816 &(fmt)) != EGL_TRUE) goto error;
817 if (secsym_eglGetImageAttribSEC(egldisplay,
818 pt->dyn.img,
819 EGL_MAP_GL_TEXTURE_PIXEL_TYPE_SEC,
820 &(pixtype)) != EGL_TRUE) goto error;
821
822 if (pixtype != EGL_MAP_GL_TEXTURE_UNSIGNED_BYTE_SEC) goto error;
823 }
824 else
825 {
826 ERR("TBM surface or SEC image map should be enabled!");
827 goto error;
766 } 828 }
767 if (secsym_eglGetImageAttribSEC(egldisplay,
768 pt->dyn.img,
769 EGL_MAP_GL_TEXTURE_WIDTH_SEC,
770 &(pt->dyn.w)) != EGL_TRUE) goto error;
771 if (secsym_eglGetImageAttribSEC(egldisplay,
772 pt->dyn.img,
773 EGL_MAP_GL_TEXTURE_HEIGHT_SEC,
774 &(pt->dyn.h)) != EGL_TRUE) goto error;
775 if (secsym_eglGetImageAttribSEC(egldisplay,
776 pt->dyn.img,
777 EGL_MAP_GL_TEXTURE_STRIDE_IN_BYTES_SEC,
778 &(pt->dyn.stride)) != EGL_TRUE) goto error;
779 if (secsym_eglGetImageAttribSEC(egldisplay,
780 pt->dyn.img,
781 EGL_MAP_GL_TEXTURE_FORMAT_SEC,
782 &(fmt)) != EGL_TRUE) goto error;
783
784 if (secsym_eglGetImageAttribSEC(egldisplay,
785 pt->dyn.img,
786 EGL_MAP_GL_TEXTURE_PIXEL_TYPE_SEC,
787 &(pixtype)) != EGL_TRUE) goto error;
788
789 if (pixtype != EGL_MAP_GL_TEXTURE_UNSIGNED_BYTE_SEC) goto error;
790 829
791 glBindTexture(GL_TEXTURE_2D, gc->pipe[0].shader.cur_tex); 830 glBindTexture(GL_TEXTURE_2D, gc->pipe[0].shader.cur_tex);
792#else 831#else
@@ -797,9 +836,12 @@ _pool_tex_dynamic_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, i
797/* ERROR HANDLING */ 836/* ERROR HANDLING */
798#ifdef GL_GLES 837#ifdef GL_GLES
799error: 838error:
800 secsym_eglDestroyImage(egldisplay, pt->dyn.img); 839 if (pt->dyn.img)
801 GLERRV("secsym_eglDestroyImage"); 840 {
802 pt->dyn.img = NULL; 841 secsym_eglDestroyImage(egldisplay, pt->dyn.img);
842 GLERRV("secsym_eglDestroyImage");
843 pt->dyn.img = NULL;
844 }
803 glBindTexture(GL_TEXTURE_2D, 0); 845 glBindTexture(GL_TEXTURE_2D, 0);
804 glDeleteTextures(1, &(pt->texture)); 846 glDeleteTextures(1, &(pt->texture));
805 if (pt->eina_pool) 847 if (pt->eina_pool)
@@ -853,9 +895,17 @@ evas_gl_texture_pool_empty(Evas_GL_Texture_Pool *pt)
853 if (pt->dyn.img) 895 if (pt->dyn.img)
854 { 896 {
855 if (pt->dyn.checked_out > 0) 897 if (pt->dyn.checked_out > 0)
856 secsym_eglUnmapImageSEC(pt->gc->egldisp, pt->dyn.img, EGL_MAP_GL_TEXTURE_DEVICE_CPU_SEC); 898 {
899 if (pt->gc->shared->info.sec_tbm_surface)
900 secsym_tbm_surface_unmap(pt->dyn.buffer);
901 else if (pt->gc->shared->info.sec_image_map)
902 secsym_eglUnmapImageSEC(pt->gc->egldisp, pt->dyn.img, EGL_MAP_GL_TEXTURE_DEVICE_CPU_SEC);
903 }
904 if (pt->dyn.buffer)
905 secsym_tbm_surface_destroy(pt->dyn.buffer);
857 secsym_eglDestroyImage(pt->gc->egldisp, pt->dyn.img); 906 secsym_eglDestroyImage(pt->gc->egldisp, pt->dyn.img);
858 pt->dyn.img = NULL; 907 pt->dyn.img = NULL;
908 pt->dyn.buffer = NULL;
859 pt->dyn.data = NULL; 909 pt->dyn.data = NULL;
860 pt->dyn.w = 0; 910 pt->dyn.w = 0;
861 pt->dyn.h = 0; 911 pt->dyn.h = 0;
diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c
index edc85b5673..ee7e9be675 100644
--- a/src/modules/evas/engines/gl_generic/evas_engine.c
+++ b/src/modules/evas/engines/gl_generic/evas_engine.c
@@ -558,8 +558,6 @@ eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data, i
558 if ((im->tex) && (im->tex->pt) && (im->tex->pt->dyn.img) && 558 if ((im->tex) && (im->tex->pt) && (im->tex->pt->dyn.img) &&
559 (im->cs.space == EVAS_COLORSPACE_ARGB8888)) 559 (im->cs.space == EVAS_COLORSPACE_ARGB8888))
560 { 560 {
561 void *disp;
562
563 if (im->tex->pt->dyn.checked_out > 0) 561 if (im->tex->pt->dyn.checked_out > 0)
564 { 562 {
565 im->tex->pt->dyn.checked_out++; 563 im->tex->pt->dyn.checked_out++;
@@ -567,12 +565,22 @@ eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data, i
567 if (err) *err = EVAS_LOAD_ERROR_NONE; 565 if (err) *err = EVAS_LOAD_ERROR_NONE;
568 return im; 566 return im;
569 } 567 }
570 disp = re->window_egl_display_get(re->software.ob); 568 if (im->gc->shared->info.sec_tbm_surface)
571 *image_data = im->tex->pt->dyn.data = 569 {
572 secsym_eglMapImageSEC(disp, 570 tbm_surface_info_s info;
573 im->tex->pt->dyn.img, 571 secsym_tbm_surface_map(im->tex->pt->dyn.buffer,
574 EGL_MAP_GL_TEXTURE_DEVICE_CPU_SEC, 572 TBM_SURF_OPTION_READ|TBM_SURF_OPTION_WRITE,
575 EGL_MAP_GL_TEXTURE_OPTION_WRITE_SEC); 573 &info);
574 *image_data = im->tex->pt->dyn.data = (DATA32 *) info.planes[0].ptr;
575 }
576 else if (im->gc->shared->info.sec_image_map)
577 {
578 void *disp = re->window_egl_display_get(re->software.ob);
579 *image_data = im->tex->pt->dyn.data = secsym_eglMapImageSEC(disp,
580 im->tex->pt->dyn.img,
581 EGL_MAP_GL_TEXTURE_DEVICE_CPU_SEC,
582 EGL_MAP_GL_TEXTURE_OPTION_WRITE_SEC);
583 }
576 584
577 if (!im->tex->pt->dyn.data) 585 if (!im->tex->pt->dyn.data)
578 { 586 {
@@ -689,12 +697,13 @@ eng_image_data_put(void *data, void *image, DATA32 *image_data)
689#ifdef GL_GLES 697#ifdef GL_GLES
690 if (im->tex->pt->dyn.checked_out == 0) 698 if (im->tex->pt->dyn.checked_out == 0)
691 { 699 {
692 void *disp; 700 if (im->gc->shared->info.sec_tbm_surface)
693 701 secsym_tbm_surface_unmap(im->tex->pt->dyn.buffer);
694 disp = re->window_egl_display_get(re->software.ob); 702 else if (im->gc->shared->info.sec_image_map)
695 secsym_eglUnmapImageSEC(disp, 703 {
696 im->tex->pt->dyn.img, 704 void *disp = disp = re->window_egl_display_get(re->software.ob);
697 EGL_MAP_GL_TEXTURE_DEVICE_CPU_SEC); 705 secsym_eglUnmapImageSEC(disp, im->tex->pt->dyn.img, EGL_MAP_GL_TEXTURE_DEVICE_CPU_SEC);
706 }
698 } 707 }
699#endif 708#endif
700 } 709 }