aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsubhransu mohanty <sub.mohanty@samsung.com>2017-10-27 13:42:01 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-11-10 11:20:38 +0900
commitbefb7701a71e45e9c76fb3873f3056b74d62527c (patch)
tree4ced404473847bb60ba69aade8ee5c9087dbb925
parentevas/vg: added support for engine surface cache. (diff)
downloadefl-befb7701a71e45e9c76fb3873f3056b74d62527c.tar.gz
evas/engine: added new engine api for ector
-rw-r--r--src/lib/evas/common/evas_common_generic_cache.c6
-rw-r--r--src/lib/evas/include/evas_private.h6
-rw-r--r--src/modules/evas/engines/gl_generic/evas_engine.c65
-rw-r--r--src/modules/evas/engines/software_generic/evas_engine.c53
4 files changed, 126 insertions, 4 deletions
diff --git a/src/lib/evas/common/evas_common_generic_cache.c b/src/lib/evas/common/evas_common_generic_cache.c
index 55fd6e06b2..55bcf725d6 100644
--- a/src/lib/evas/common/evas_common_generic_cache.c
+++ b/src/lib/evas/common/evas_common_generic_cache.c
@@ -34,7 +34,7 @@ generic_cache_dump(Generic_Cache *cache)
}
EAPI void
-generic_cache_set(Generic_Cache *cache, void *key, void *surface)
+generic_cache_data_set(Generic_Cache *cache, void *key, void *surface)
{
Generic_Cache_Entry *entry = NULL;
int count;
@@ -59,7 +59,7 @@ generic_cache_set(Generic_Cache *cache, void *key, void *surface)
}
EAPI void *
-generic_cache_get(Generic_Cache *cache, void *key)
+generic_cache_data_get(Generic_Cache *cache, void *key)
{
Generic_Cache_Entry *entry = NULL, *lru_data;
Eina_List *l;
@@ -84,7 +84,7 @@ generic_cache_get(Generic_Cache *cache, void *key)
}
EAPI void
-generic_cache_drop(Generic_Cache *cache, void *key)
+generic_cache_data_drop(Generic_Cache *cache, void *key)
{
Generic_Cache_Entry *entry = NULL;
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h
index 7ec4095692..2fac91e094 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -1513,6 +1513,12 @@ struct _Evas_Func
void* (*ector_new) (void *engine, void *context, Ector_Surface *ector, void *surface);
void (*ector_free) (void *engine_data);
+ void *(*ector_surface_create) (void *engine, int w, int h, int *error);
+ void (*ector_surface_destroy) (void *engine, void *surface);
+ void (*ector_surface_cache_set) (void *engine, void *key, void *surface);
+ void *(*ector_surface_cache_get) (void *engine, void *key);
+ void (*ector_surface_cache_drop) (void *engine, void *key);
+
Evas_Filter_Support (*gfx_filter_supports) (void *engine, Evas_Filter_Command *cmd);
Eina_Bool (*gfx_filter_process) (void *engine, Evas_Filter_Command *cmd);
diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c
index 62f1a38290..6e6d6a9082 100644
--- a/src/modules/evas/engines/gl_generic/evas_engine.c
+++ b/src/modules/evas/engines/gl_generic/evas_engine.c
@@ -2623,6 +2623,65 @@ eng_ector_renderer_draw(void *engine EINA_UNUSED, void *data, void *context, voi
eina_array_free(c);
}
+// Ector functions start
+static void*
+eng_ector_surface_create(void *engine, int width, int height, int *error)
+{
+ void *surface;
+
+ *error = EINA_FALSE;
+
+ if (use_gl)
+ {
+ surface = evas_gl_common_image_surface_new(gl_generic_context_get(engine, EINA_TRUE),
+ width, height, EINA_TRUE, EINA_FALSE);
+ if (!surface) *error = EINA_TRUE;
+ }
+ else
+ {
+ surface = eng_image_new_from_copied_data(engine, width, height, NULL, EINA_TRUE, EVAS_COLORSPACE_ARGB8888);
+ if (!surface)
+ *error = EINA_TRUE;
+ else //Use this hint for ZERO COPY texture upload.
+ eng_image_content_hint_set(engine, surface, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
+ }
+
+ return surface;
+}
+
+static void
+eng_ector_surface_destroy(void *engine, void *surface)
+{
+ if (!surface) return;
+ eng_image_free(engine, surface);
+}
+
+static void
+eng_ector_surface_cache_set(void *engine, void *key , void *surface)
+{
+ Render_Engine_GL_Generic *e = engine;
+
+ generic_cache_data_set(e->software.surface_cache, key, surface);
+
+}
+
+static void *
+eng_ector_surface_cache_get(void *engine, void *key)
+{
+ Render_Engine_GL_Generic *e = engine;
+
+ return generic_cache_data_get(e->software.surface_cache, key);
+}
+
+static void
+eng_ector_surface_cache_drop(void *engine, void *key)
+{
+ Render_Engine_GL_Generic *e = engine;
+
+ generic_cache_data_drop(e->software.surface_cache, key);
+}
+
+
typedef struct _Evas_GL_Ector Evas_GL_Ector;
struct _Evas_GL_Ector
{
@@ -3305,7 +3364,11 @@ module_open(Evas_Module *em)
ORD(ector_end);
ORD(ector_new);
ORD(ector_free);
-
+ ORD(ector_surface_create);
+ ORD(ector_surface_destroy);
+ ORD(ector_surface_cache_set);
+ ORD(ector_surface_cache_get);
+ ORD(ector_surface_cache_drop);
ORD(gfx_filter_supports);
ORD(gfx_filter_process);
diff --git a/src/modules/evas/engines/software_generic/evas_engine.c b/src/modules/evas/engines/software_generic/evas_engine.c
index 8dfafc2d7d..1d7c97c7d4 100644
--- a/src/modules/evas/engines/software_generic/evas_engine.c
+++ b/src/modules/evas/engines/software_generic/evas_engine.c
@@ -4294,6 +4294,8 @@ eng_output_idle_flush(void *engine EINA_UNUSED, void *data)
if (re->outbuf_idle_flush) re->outbuf_idle_flush(re->ob);
}
+// Ector functions
+
static Eina_Bool use_cairo;
static Ector_Surface *
@@ -4318,6 +4320,52 @@ eng_ector_create(void *engine EINA_UNUSED)
return ector;
}
+static void*
+eng_ector_surface_create(void *engine, int width, int height, int *error)
+{
+ void *surface;
+
+ *error = EINA_FALSE;
+
+ surface = eng_image_new_from_copied_data(engine, width, height, NULL, EINA_TRUE, EVAS_COLORSPACE_ARGB8888);
+ if (!surface) *error = EINA_TRUE;
+
+ return surface;
+}
+
+static void
+eng_ector_surface_destroy(void *engine, void *surface)
+{
+ if (!surface) return;
+ eng_image_free(engine, surface);
+}
+
+static void
+eng_ector_surface_cache_set(void *engine, void *key , void *surface)
+{
+ Render_Engine_Software_Generic *e = engine;
+
+ generic_cache_data_set(e->surface_cache, key, surface);
+
+}
+
+static void *
+eng_ector_surface_cache_get(void *engine, void *key)
+{
+ Render_Engine_Software_Generic *e = engine;
+
+ return generic_cache_data_get(e->surface_cache, key);
+}
+
+static void
+eng_ector_surface_cache_drop(void *engine, void *key)
+{
+ Render_Engine_Software_Generic *e = engine;
+
+ generic_cache_data_drop(e->surface_cache, key);
+}
+
+
static void
eng_ector_output_set(void *engine EINA_UNUSED,
Ector_Surface *surface EINA_UNUSED,
@@ -4846,6 +4894,11 @@ static Evas_Func func =
eng_ector_end,
eng_ector_new,
eng_ector_free,
+ eng_ector_surface_create,
+ eng_ector_surface_destroy,
+ eng_ector_surface_cache_set,
+ eng_ector_surface_cache_get,
+ eng_ector_surface_cache_drop,
eng_gfx_filter_supports,
eng_gfx_filter_process,
/* FUTURE software generic calls go here */