summaryrefslogtreecommitdiff
path: root/src/modules/evas/engines/wayland_shm/evas_engine.c
diff options
context:
space:
mode:
authorWonsik Jung <sidein@samsung.com>2016-01-05 16:41:14 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-01-05 17:01:45 +0900
commit7db9613e8c95268acfa6d51ea6aa45418ee8e697 (patch)
tree90c8b334eaef11377194911c3bfeac5a1ce02c7c /src/modules/evas/engines/wayland_shm/evas_engine.c
parentc1b4728487715c66120ed4c4d75065012bd42682 (diff)
Evas_Engine: add TBM surface and clean up Native Struct
Summary: Add TBM surface in wayland and clean up Native struct on Evas Engine. Previous TBM surface for evas_object_image's native_surface_set is only in Evas X11 backend. This patch has the code for wayland backend. In addition, evas_native_tbm.c is moved to software_generic. Becuase this file is common. And, Native in Evas_Engine is clean-up. @feature Test Plan: TBM surface is tested with spacegrapher's test app(tbm.c) in Tizen Device. Pixmap surface is tested in ubuntu with same test app. EvasGL is tested with elementary_test. Reviewers: jpeg, spacegrapher, raster, cedric Subscribers: dkdk, scholb.kim, JoogabYun Differential Revision: https://phab.enlightenment.org/D3501
Diffstat (limited to '')
-rw-r--r--src/modules/evas/engines/wayland_shm/evas_engine.c91
1 files changed, 91 insertions, 0 deletions
diff --git a/src/modules/evas/engines/wayland_shm/evas_engine.c b/src/modules/evas/engines/wayland_shm/evas_engine.c
index 82500908b3..e6a810c130 100644
--- a/src/modules/evas/engines/wayland_shm/evas_engine.c
+++ b/src/modules/evas/engines/wayland_shm/evas_engine.c
@@ -5,6 +5,11 @@
5#endif 5#endif
6 6
7#include "evas_engine.h" 7#include "evas_engine.h"
8#include "../software_generic/evas_native_common.h"
9
10#ifdef HAVE_DLSYM
11# include <dlfcn.h>
12#endif
8 13
9/* logging domain variable */ 14/* logging domain variable */
10int _evas_engine_way_shm_log_dom = -1; 15int _evas_engine_way_shm_log_dom = -1;
@@ -12,6 +17,8 @@ int _evas_engine_way_shm_log_dom = -1;
12/* evas function tables - filled in later (func and parent func) */ 17/* evas function tables - filled in later (func and parent func) */
13static Evas_Func func, pfunc; 18static Evas_Func func, pfunc;
14 19
20Evas_Native_Tbm_Surface_Image_Set_Call glsym_evas_native_tbm_surface_image_set = NULL;
21
15/* engine structure data */ 22/* engine structure data */
16typedef struct _Render_Engine Render_Engine; 23typedef struct _Render_Engine Render_Engine;
17struct _Render_Engine 24struct _Render_Engine
@@ -77,6 +84,22 @@ err:
77 return NULL; 84 return NULL;
78} 85}
79 86
87static void
88_symbols(void)
89{
90 static int done = 0;
91
92 if (done) return;
93
94#define LINK2GENERIC(sym) \
95 glsym_##sym = dlsym(RTLD_DEFAULT, #sym);
96
97 // Get function pointer to native_common that is now provided through the link of SW_Generic.
98 LINK2GENERIC(evas_native_tbm_surface_image_set);
99
100 done = 1;
101}
102
80/* ENGINE API FUNCTIONS WE PROVIDE */ 103/* ENGINE API FUNCTIONS WE PROVIDE */
81static void * 104static void *
82eng_info(Evas *eo_evas EINA_UNUSED) 105eng_info(Evas *eo_evas EINA_UNUSED)
@@ -242,6 +265,71 @@ eng_output_resize(void *data, int w, int h)
242 re->generic.h = h; 265 re->generic.h = h;
243} 266}
244 267
268static void *
269eng_image_native_set(void *data EINA_UNUSED, void *image, void *native)
270{
271 Evas_Native_Surface *ns = native;
272 Image_Entry *ie = image;
273 RGBA_Image *im = image, *im2;
274
275 if (!im || !ns) return im;
276
277 if (ns->type == EVAS_NATIVE_SURFACE_TBM)
278 {
279 if (im->native.data)
280 {
281 //image have native surface already
282 Evas_Native_Surface *ens = im->native.data;
283
284 if ((ens->type == ns->type) &&
285 (ens->data.tbm.buffer == ns->data.tbm.buffer))
286 return im;
287 }
288 }
289
290 if ((ns->type == EVAS_NATIVE_SURFACE_OPENGL) &&
291 (ns->version == EVAS_NATIVE_SURFACE_VERSION))
292 im2 = evas_cache_image_data(evas_common_image_cache_get(),
293 ie->w, ie->h,
294 ns->data.x11.visual, 1,
295 EVAS_COLORSPACE_ARGB8888);
296 else
297 im2 = evas_cache_image_data(evas_common_image_cache_get(),
298 ie->w, ie->h,
299 NULL, 1,
300 EVAS_COLORSPACE_ARGB8888);
301
302 if (im->native.data)
303 {
304 if (im->native.func.free)
305 im->native.func.free(im->native.func.data, im);
306 }
307
308#ifdef EVAS_CSERVE2
309 if (evas_cserve2_use_get() && evas_cache2_image_cached(ie))
310 evas_cache2_image_close(ie);
311 else
312#endif
313 evas_cache_image_drop(ie);
314 im = im2;
315
316 if (ns->type == EVAS_NATIVE_SURFACE_TBM)
317 return glsym_evas_native_tbm_surface_image_set(NULL, im, ns);
318
319 return im;
320}
321
322static void *
323eng_image_native_get(void *data EINA_UNUSED, void *image)
324{
325 RGBA_Image *im = image;
326 Native *n;
327 if (!im) return NULL;
328 n = im->native.data;
329 if (!n) return NULL;
330 return &(n->ns);
331}
332
245/* EVAS MODULE FUNCTIONS */ 333/* EVAS MODULE FUNCTIONS */
246static int 334static int
247module_open(Evas_Module *em) 335module_open(Evas_Module *em)
@@ -273,7 +361,10 @@ module_open(Evas_Module *em)
273 ORD(setup); 361 ORD(setup);
274 ORD(output_free); 362 ORD(output_free);
275 ORD(output_resize); 363 ORD(output_resize);
364 ORD(image_native_set);
365 ORD(image_native_get);
276 366
367 _symbols();
277 /* advertise our own engine functions */ 368 /* advertise our own engine functions */
278 em->functions = (void *)(&func); 369 em->functions = (void *)(&func);
279 370