summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2013-10-29 19:06:33 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2013-10-30 19:48:17 +0900
commit82e8028b5d34ccf488eb3faed30f67b4b40bfaed (patch)
tree7760cfde21066c596783c05ed6f9da192f8ae090 /src/modules
parentb3debcc3e1651e41c419db422b465d9070c180b4 (diff)
evas/cserve2: Fix image preload with gl-x11 engine
Cserves supports only the SW (xlib) and GL (gl-x11) engines. Also, improve cs2 support for some lesser used functions in the gl_x11 engine.
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_image.c6
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_preload.c19
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_texture.c10
-rw-r--r--src/modules/evas/engines/gl_x11/evas_engine.c43
-rw-r--r--src/modules/evas/engines/software_generic/evas_engine.c9
5 files changed, 80 insertions, 7 deletions
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 36b40aa5f4..169b48655f 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_image.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_image.c
@@ -8,6 +8,12 @@ void
8evas_gl_common_image_alloc_ensure(Evas_GL_Image *im) 8evas_gl_common_image_alloc_ensure(Evas_GL_Image *im)
9{ 9{
10 if (!im->im) return; 10 if (!im->im) return;
11#ifdef EVAS_CSERVE2
12 if (evas_cache2_image_cached(&im->im->cache_entry))
13 im->im = (RGBA_Image *)evas_cache2_image_size_set(&im->im->cache_entry,
14 im->w, im->h);
15 else
16#endif
11 im->im = (RGBA_Image *)evas_cache_image_size_set(&im->im->cache_entry, 17 im->im = (RGBA_Image *)evas_cache_image_size_set(&im->im->cache_entry,
12 im->w, im->h); 18 im->w, im->h);
13} 19}
diff --git a/src/modules/evas/engines/gl_common/evas_gl_preload.c b/src/modules/evas/engines/gl_common/evas_gl_preload.c
index bdaa8deab9..5ee36b6610 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_preload.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_preload.c
@@ -1,5 +1,9 @@
1#include "evas_gl_private.h" 1#include "evas_gl_private.h"
2 2
3#ifdef EVAS_CSERVE2
4#include "evas_cs2_private.h"
5#endif
6
3static Eina_Thread async_loader_thread; 7static Eina_Thread async_loader_thread;
4static Eina_Condition async_loader_cond; 8static Eina_Condition async_loader_cond;
5static Eina_Lock async_loader_lock; 9static Eina_Lock async_loader_lock;
@@ -50,6 +54,11 @@ evas_gl_preload_pop(Evas_GL_Texture *tex)
50 if (running) evas_gl_preload_render_lock(tmp_cb, tmp_data); 54 if (running) evas_gl_preload_render_lock(tmp_cb, tmp_data);
51 55
52 evas_gl_common_texture_free(async_current->tex, EINA_FALSE); 56 evas_gl_common_texture_free(async_current->tex, EINA_FALSE);
57#ifdef EVAS_CSERVE2
58 if (evas_cache2_image_cached(&async_current->im->cache_entry))
59 evas_cache2_image_close(&async_current->im->cache_entry);
60 else
61#endif
53 evas_cache_image_drop(&async_current->im->cache_entry); 62 evas_cache_image_drop(&async_current->im->cache_entry);
54 free(async_current); 63 free(async_current);
55 64
@@ -66,6 +75,11 @@ evas_gl_preload_pop(Evas_GL_Texture *tex)
66 async_loader_tex = eina_list_remove_list(async_loader_tex, l); 75 async_loader_tex = eina_list_remove_list(async_loader_tex, l);
67 76
68 evas_gl_common_texture_free(async->tex, EINA_FALSE); 77 evas_gl_common_texture_free(async->tex, EINA_FALSE);
78#ifdef EVAS_CSERVE2
79 if (evas_cache2_image_cached(&async->im->cache_entry))
80 evas_cache2_image_close(&async->im->cache_entry);
81 else
82#endif
69 evas_cache_image_drop(&async->im->cache_entry); 83 evas_cache_image_drop(&async->im->cache_entry);
70 free(async); 84 free(async);
71 85
@@ -100,6 +114,11 @@ _evas_gl_preload_main_loop_wakeup(void)
100 async->tex->aptt = NULL; 114 async->tex->aptt = NULL;
101 115
102 evas_gl_common_texture_free(async->tex, EINA_FALSE); 116 evas_gl_common_texture_free(async->tex, EINA_FALSE);
117#ifdef EVAS_CSERVE2
118 if (evas_cache2_image_cached(&async->im->cache_entry))
119 evas_cache2_image_close(&async->im->cache_entry);
120 else
121#endif
103 evas_cache_image_drop(&async->im->cache_entry); 122 evas_cache_image_drop(&async->im->cache_entry);
104 free(async); 123 free(async);
105 } 124 }
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 e254db5393..1cacce3548 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_texture.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_texture.c
@@ -941,6 +941,11 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im)
941 async->tex = tex; 941 async->tex = tex;
942 async->tex->references++; 942 async->tex->references++;
943 async->im = im; 943 async->im = im;
944#ifdef EVAS_CSERVE2
945 if (evas_cache2_image_cached(&async->im->cache_entry))
946 evas_cache2_image_ref(&async->im->cache_entry);
947 else
948#endif
944 evas_cache_image_ref(&async->im->cache_entry); 949 evas_cache_image_ref(&async->im->cache_entry);
945 async->unpack_row_length = tex->gc->shared->info.unpack_row_length; 950 async->unpack_row_length = tex->gc->shared->info.unpack_row_length;
946 951
@@ -949,6 +954,11 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im)
949 954
950 // Failed to start asynchronous upload, likely due to preload not being supported by the backend 955 // Failed to start asynchronous upload, likely due to preload not being supported by the backend
951 async->tex->references--; 956 async->tex->references--;
957#ifdef EVAS_CSERVE2
958 if (evas_cache2_image_cached(&async->im->cache_entry))
959 evas_cache2_image_close(&async->im->cache_entry);
960 else
961#endif
952 evas_cache_image_drop(&async->im->cache_entry); 962 evas_cache_image_drop(&async->im->cache_entry);
953 free(async); 963 free(async);
954 964
diff --git a/src/modules/evas/engines/gl_x11/evas_engine.c b/src/modules/evas/engines/gl_x11/evas_engine.c
index b708bf8fef..0a23ec1234 100644
--- a/src/modules/evas/engines/gl_x11/evas_engine.c
+++ b/src/modules/evas/engines/gl_x11/evas_engine.c
@@ -14,6 +14,10 @@
14# error gl_x11 should not get compiled if dlsym is not found on the system! 14# error gl_x11 should not get compiled if dlsym is not found on the system!
15#endif 15#endif
16 16
17#ifdef EVAS_CSERVE2
18#include "evas_cs2_private.h"
19#endif
20
17#define EVAS_GL_NO_GL_H_CHECK 1 21#define EVAS_GL_NO_GL_H_CHECK 1
18#include "Evas_GL.h" 22#include "Evas_GL.h"
19 23
@@ -1816,7 +1820,14 @@ eng_image_alpha_set(void *data, void *image, int has_alpha)
1816 Evas_GL_Image *im_new; 1820 Evas_GL_Image *im_new;
1817 1821
1818 if (!im->im->image.data) 1822 if (!im->im->image.data)
1819 evas_cache_image_load_data(&im->im->cache_entry); 1823 {
1824#ifdef EVAS_CSERVE2
1825 if (evas_cserve2_use_get() && evas_cache2_image_cached(&im->im->cache_entry))
1826 evas_cache2_image_load_data(&im->im->cache_entry);
1827 else
1828#endif
1829 evas_cache_image_load_data(&im->im->cache_entry);
1830 }
1820 evas_gl_common_image_alloc_ensure(im); 1831 evas_gl_common_image_alloc_ensure(im);
1821 im_new = evas_gl_common_image_new_from_copied_data 1832 im_new = evas_gl_common_image_new_from_copied_data
1822 (im->gc, im->im->cache_entry.w, im->im->cache_entry.h, 1833 (im->gc, im->im->cache_entry.w, im->im->cache_entry.h,
@@ -2745,7 +2756,12 @@ eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data, i
2745 return NULL; 2756 return NULL;
2746 } 2757 }
2747 2758
2748 error = evas_cache_image_load_data(&im->im->cache_entry); 2759#ifdef EVAS_CSERVE2
2760 if (evas_cserve2_use_get() && evas_cache2_image_cached(&im->im->cache_entry))
2761 error = evas_cache2_image_load_data(&im->im->cache_entry);
2762 else
2763#endif
2764 error = evas_cache_image_load_data(&im->im->cache_entry);
2749 evas_gl_common_image_alloc_ensure(im); 2765 evas_gl_common_image_alloc_ensure(im);
2750 switch (im->cs.space) 2766 switch (im->cs.space)
2751 { 2767 {
@@ -2874,7 +2890,13 @@ eng_image_data_preload_request(void *data, void *image, const Eo *target)
2874 if (gim->native.data) return; 2890 if (gim->native.data) return;
2875 im = (RGBA_Image *)gim->im; 2891 im = (RGBA_Image *)gim->im;
2876 if (!im) return; 2892 if (!im) return;
2877 evas_cache_image_preload_data(&im->cache_entry, target, NULL, NULL, NULL); 2893
2894#ifdef EVAS_CSERVE2
2895 if (evas_cserve2_use_get() && evas_cache2_image_cached(&im->cache_entry))
2896 evas_cache2_image_preload_data(&im->cache_entry, target);
2897 else
2898#endif
2899 evas_cache_image_preload_data(&im->cache_entry, target, NULL, NULL, NULL);
2878 if (!gim->tex) 2900 if (!gim->tex)
2879 gim->tex = evas_gl_common_texture_new(re->win->gl_context, gim->im); 2901 gim->tex = evas_gl_common_texture_new(re->win->gl_context, gim->im);
2880 evas_gl_preload_target_register(gim->tex, (Eo*) target); 2902 evas_gl_preload_target_register(gim->tex, (Eo*) target);
@@ -2890,7 +2912,13 @@ eng_image_data_preload_cancel(void *data EINA_UNUSED, void *image, const Eo *tar
2890 if (gim->native.data) return; 2912 if (gim->native.data) return;
2891 im = (RGBA_Image *)gim->im; 2913 im = (RGBA_Image *)gim->im;
2892 if (!im) return; 2914 if (!im) return;
2893 evas_cache_image_preload_cancel(&im->cache_entry, target); 2915
2916#ifdef EVAS_CSERVE2
2917 if (evas_cserve2_use_get() && evas_cache2_image_cached(&im->cache_entry))
2918 evas_cache2_image_preload_cancel(&im->cache_entry, target);
2919 else
2920#endif
2921 evas_cache_image_preload_cancel(&im->cache_entry, target);
2894 evas_gl_preload_target_unregister(gim->tex, (Eo*) target); 2922 evas_gl_preload_target_unregister(gim->tex, (Eo*) target);
2895} 2923}
2896 2924
@@ -3396,7 +3424,12 @@ eng_pixel_alpha_get(void *image, int x, int y, DATA8 *alpha, int src_region_x, i
3396 { 3424 {
3397 DATA32 *pixel; 3425 DATA32 *pixel;
3398 3426
3399 evas_cache_image_load_data(&im->im->cache_entry); 3427#ifdef EVAS_CSERVE2
3428 if (evas_cserve2_use_get() && evas_cache2_image_cached(&im->im->cache_entry))
3429 evas_cache2_image_load_data(&im->im->cache_entry);
3430 else
3431#endif
3432 evas_cache_image_load_data(&im->im->cache_entry);
3400 if (!im->im->cache_entry.flags.loaded) 3433 if (!im->im->cache_entry.flags.loaded)
3401 { 3434 {
3402 ERR("im %p has no pixels loaded yet", im); 3435 ERR("im %p has no pixels loaded yet", im);
diff --git a/src/modules/evas/engines/software_generic/evas_engine.c b/src/modules/evas/engines/software_generic/evas_engine.c
index b3ab2ce6bc..a42cd9cb72 100644
--- a/src/modules/evas/engines/software_generic/evas_engine.c
+++ b/src/modules/evas/engines/software_generic/evas_engine.c
@@ -1195,12 +1195,17 @@ static void
1195eng_image_data_preload_cancel(void *data EINA_UNUSED, void *image, const Eo *target) 1195eng_image_data_preload_cancel(void *data EINA_UNUSED, void *image, const Eo *target)
1196{ 1196{
1197 RGBA_Image *im = image; 1197 RGBA_Image *im = image;
1198
1199 if (!im) return;
1200
1198#ifdef EVAS_CSERVE2 1201#ifdef EVAS_CSERVE2
1199 if (evas_cserve2_use_get() && evas_cache2_image_cached(&im->cache_entry)) 1202 if (evas_cserve2_use_get() && evas_cache2_image_cached(&im->cache_entry))
1200 return; 1203 {
1204 evas_cache2_image_preload_cancel(&im->cache_entry, target);
1205 return;
1206 }
1201#endif 1207#endif
1202 1208
1203 if (!im) return;
1204 evas_cache_image_preload_cancel(&im->cache_entry, target); 1209 evas_cache_image_preload_cancel(&im->cache_entry, target);
1205} 1210}
1206 1211