diff options
author | Haegeun Park <haegeun.park@samsung.com> | 2016-07-21 15:50:52 +0900 |
---|---|---|
committer | Haegeun Park <haegeun.park@samsung.com> | 2017-01-11 18:20:37 +0900 |
commit | f33c43c01601304824c5e58d69a2fe546fc3aa7b (patch) | |
tree | a4f73b54108afcd30e0c9fe3e8201fc611dddc18 | |
parent | af149f6477043403d349ac7fde97bd6cc9eaf464 (diff) | |
download | efl-f33c43c01601304824c5e58d69a2fe546fc3aa7b.tar.gz |
evas/gl_common: (GL thread) Changed dummy surface creating routine from window to pbuffer
For EvasGL thread rendering, we can't use 'direct surface' which was same as Evas window surface.
Worker thread needs just a dummy surface for make current, but the worker thread can't use window surface
because the main thread uses it for rendering simultaneously.
On TIZEN wayland, There is an unknown error (segfault in wayland) creating additional native window,
therefore we can't create additional window surface for dummy purpose.
So we changed this routine to create a pbuffer instead it.
But after that, some backend (like gl_drm) has an side effect to create a pbuffer.
(these backends haven't implemented pbuffer functions)
So previous code (diret surface) is also affect for these cases,
Thread rendering seems to be hard to support these backends. (currently not)
Perhaps EGL_KHR_surfaceless_context can be final answer. (but it is an extension)
Change-Id: I8e2d9317bb533e897d24c5e0be4763040206d57d
-rw-r--r-- | src/modules/evas/engines/gl_common/evas_gl_core.c | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/src/modules/evas/engines/gl_common/evas_gl_core.c b/src/modules/evas/engines/gl_common/evas_gl_core.c index 50cffccbcc..593130b3dd 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_core.c +++ b/src/modules/evas/engines/gl_common/evas_gl_core.c @@ -170,27 +170,44 @@ _internal_resource_make_current(void *eng_data, EVGL_Surface *sfc, EVGL_Context if (!surface) { // Set the surface to evas surface if it's there - if (rsc->id == evgl_engine->main_tid) + // But this reusing mechanism is only available at the single thread model like direct rendering. + // So avoid it when evasgl thread rendering is used. + if (rsc->id == evgl_engine->main_tid && !evas_gl_thread_enabled()) rsc->direct.surface = evgl_engine->funcs->evas_surface_get(eng_data); if (rsc->direct.surface) surface = (void*)rsc->direct.surface; else { - if (!rsc->window) + if (!rsc->surface) { - // Create resource surface - rsc->window = evgl_engine->funcs->native_window_create(eng_data); - if (!rsc->window) + // Only need a 'dummy' surface to make current with the evasgl context. + if (evgl_engine->funcs->pbuffer_surface_create) { - ERR("Error creating native window"); - return 0; + // Now recommended a smallest (1x1) pbuffer surface instead of a window surface. + // But in the future, EGL_KHR_SURFACELESS_CONTEXT can be used. + EVGL_Surface sfc_attrib; + memset(&sfc_attrib, 0x00, sizeof(EVGL_Surface)); + sfc_attrib.w = 1; + sfc_attrib.h = 1; + rsc->surface = evgl_engine->funcs->pbuffer_surface_create(eng_data, &sfc_attrib, NULL); + } + else + { + // If the engine doesn't support pbuffer, create a dummy window surface. + if (!rsc->window) + { + // Create resource surface + rsc->window = evgl_engine->funcs->native_window_create(eng_data); + if (!rsc->window) + { + ERR("Error creating native window"); + return 0; + } + } + rsc->surface = evgl_engine->funcs->surface_create(eng_data, rsc->window); } - } - if (!rsc->surface) - { - rsc->surface = evgl_engine->funcs->surface_create(eng_data, rsc->window); if (!rsc->surface) { ERR("Error creating native surface"); |