diff options
author | Jean-Philippe Andre <jp.andre@samsung.com> | 2016-08-11 11:03:54 +0900 |
---|---|---|
committer | Jean-Philippe Andre <jp.andre@samsung.com> | 2016-08-11 11:13:01 +0900 |
commit | eba63b7441a673ad11aa95feb482bb20eb8ffb05 (patch) | |
tree | 51aef9f10575160c276fd45459a0e266f17b10e7 | |
parent | 1a5a04ed494ba32dd04144bfe640c7b1013ad020 (diff) | |
download | efl-eba63b7441a673ad11aa95feb482bb20eb8ffb05.tar.gz |
wayland_shm: Fix basic support for Evas GL
Simply add support for EVASGL native surfaces.
I removed all code related to OPENGL surfaces (deprecated stuff
from old Evas GL).
Fixes T2936
Note that here are still some missing features in Evas GL
support on Wayland (at least pbuffers support is not implemented).
-rw-r--r-- | src/modules/evas/engines/wayland_shm/evas_engine.c | 50 |
1 files changed, 41 insertions, 9 deletions
diff --git a/src/modules/evas/engines/wayland_shm/evas_engine.c b/src/modules/evas/engines/wayland_shm/evas_engine.c index edfc24e96d..561f9e90fb 100644 --- a/src/modules/evas/engines/wayland_shm/evas_engine.c +++ b/src/modules/evas/engines/wayland_shm/evas_engine.c @@ -237,6 +237,8 @@ eng_image_native_init(void *data EINA_UNUSED, Evas_Native_Surface_Type type) { case EVAS_NATIVE_SURFACE_TBM: return _evas_native_tbm_init(); + case EVAS_NATIVE_SURFACE_EVASGL: + return 1; default: ERR("Native surface type %d not supported!", type); return 0; @@ -257,6 +259,20 @@ eng_image_native_shutdown(void *data EINA_UNUSED, Evas_Native_Surface_Type type) } } +static void +_native_evasgl_free(void *image) +{ + RGBA_Image *im = image; + Native *n = im->native.data; + + im->native.data = NULL; + im->native.func.bind = NULL; + im->native.func.unbind = NULL; + im->native.func.free = NULL; + //im->image.data = NULL; + free(n); +} + static void * eng_image_native_set(void *data EINA_UNUSED, void *image, void *native) { @@ -280,14 +296,12 @@ eng_image_native_set(void *data EINA_UNUSED, void *image, void *native) } } - /* FIXME: WTF is this? OPENGL supported here? uh? and x11.visual used??? - * It looks like this code needs to fail and return NULL. */ - if ((ns->type == EVAS_NATIVE_SURFACE_OPENGL) && - (ns->version == EVAS_NATIVE_SURFACE_VERSION)) - im2 = (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(), - ie->w, ie->h, - ns->data.x11.visual, 1, - EVAS_COLORSPACE_ARGB8888); + if (ns->type == EVAS_NATIVE_SURFACE_EVASGL) + { + im2 = (RGBA_Image *) evas_cache_image_data(evas_common_image_cache_get(), + ie->w, ie->h, ns->data.evasgl.surface, 1, + EVAS_COLORSPACE_ARGB8888); + } else if (ns->type == EVAS_NATIVE_SURFACE_TBM) { stride = glsym__evas_native_tbm_surface_stride_get(NULL, ns); @@ -316,7 +330,25 @@ eng_image_native_set(void *data EINA_UNUSED, void *image, void *native) im = im2; if (ns->type == EVAS_NATIVE_SURFACE_TBM) - return glsym__evas_native_tbm_surface_image_set(NULL, im, ns); + { + return glsym__evas_native_tbm_surface_image_set(NULL, im, ns); + } + else if (ns->type == EVAS_NATIVE_SURFACE_EVASGL) + { + /* Native contains Evas_Native_Surface. What a mess. */ + Native *n = calloc(1, sizeof(Native)); + if (n) + { + n->ns_data.evasgl.surface = ns->data.evasgl.surface; + n->ns.type = EVAS_NATIVE_SURFACE_EVASGL; + n->ns.version = EVAS_NATIVE_SURFACE_VERSION; + n->ns.data.evasgl.surface = ns->data.evasgl.surface; + im->native.data = n; + im->native.func.free = _native_evasgl_free; + im->native.func.bind = NULL; + im->native.func.unbind = NULL; + } + } return im; } |