diff options
-rwxr-xr-x | src/modules/evas/engines/gl_common/evas_gl_common.h | 10 | ||||
-rw-r--r-- | src/modules/evas/engines/gl_generic/Evas_Engine_GL_Generic.h | 3 | ||||
-rwxr-xr-x | src/modules/evas/engines/gl_generic/evas_engine.c | 40 |
3 files changed, 52 insertions, 1 deletions
diff --git a/src/modules/evas/engines/gl_common/evas_gl_common.h b/src/modules/evas/engines/gl_common/evas_gl_common.h index 9d1779dfea..caecdd16e3 100755 --- a/src/modules/evas/engines/gl_common/evas_gl_common.h +++ b/src/modules/evas/engines/gl_common/evas_gl_common.h @@ -848,6 +848,11 @@ extern void (*secsym_glEGLImageTargetTexture2DOES) (int a, void *b); extern void *(*secsym_eglMapImageSEC) (void *a, void *b, int c, int d); extern unsigned int (*secsym_eglUnmapImageSEC) (void *a, void *b, int c); extern unsigned int (*secsym_eglGetImageAttribSEC) (void *a, void *b, int c, int *d); +//TIZEN_ONLY(20241028): evas: added egl fence before surface map. +extern void *(*eglsym_eglCreateSyncKHR) (void *a, void *b, const int *c); +extern unsigned int (*eglsym_eglWaitSyncKHR) (void *a, void *b, unsigned long d); +extern unsigned int (*eglsym_eglDestroySyncKHR) (void *a, void *b); +// // TBM Surface stuff #define TBM_SURF_PLANE_MAX 4 /**< maximum number of planes */ @@ -1012,6 +1017,11 @@ __evas_gl_errdyn(int err, const char *file, const char *func, int line, const ch # define secsym_eglMapImageSEC(...) GL_ERROR_TRACE_RET(void *, eglMapImageSEC, secsym_eglMapImageSEC, secsym_eglMapImageSEC, #__VA_ARGS__, __VA_ARGS__) # define secsym_eglUnmapImageSEC(...) GL_ERROR_TRACE_RET(unsigned int, eglUnmapImageSEC, secsym_eglUnmapImageSEC, #__VA_ARGS__, __VA_ARGS__) # define secsym_eglGetImageAttribSEC(...) GL_ERROR_TRACE_RET(unsigned int, eglGetImageAttribSEC, secsym_eglGetImageAttribSEC, #__VA_ARGS__, __VA_ARGS__) +//TIZEN_ONLY(20241028): evas: added egl fence before surface map. +# define eglsym_eglCreateSyncKHR(...) GL_ERROR_TRACE_RET(void *, eglCreateSyncKHR, eglsym_eglCreateSyncKHR, #__VA_ARGS__, __VA_ARGS__) +# define eglsym_eglWaitSyncKHR(...) GL_ERROR_TRACE_RET(unsigned int, eglWaitSyncKHR, eglsym_eglWaitSyncKHR, #__VA_ARGS__, __VA_ARGS__) +# define eglsym_eglDestroySyncKHR(...) GL_ERROR_TRACE_RET(unsigned int, eglDestroySyncKHR, eglsym_eglDestroySyncKHR, #__VA_ARGS__, __VA_ARGS__) +// # endif #else # define GLERRV(op) diff --git a/src/modules/evas/engines/gl_generic/Evas_Engine_GL_Generic.h b/src/modules/evas/engines/gl_generic/Evas_Engine_GL_Generic.h index d48b82199b..27a81ecc84 100644 --- a/src/modules/evas/engines/gl_generic/Evas_Engine_GL_Generic.h +++ b/src/modules/evas/engines/gl_generic/Evas_Engine_GL_Generic.h @@ -30,6 +30,9 @@ struct _Render_Engine_GL_Generic Evas_Object *obj; } func; + //TIZEN_ONLY(20241028): evas: added egl fence before surface map. + EGLSyncKHR egl_fence; + // Eina_Bool evgl_initted : 1; }; diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c index ee86e06989..aeb27874fc 100755 --- a/src/modules/evas/engines/gl_generic/evas_engine.c +++ b/src/modules/evas/engines/gl_generic/evas_engine.c @@ -157,7 +157,6 @@ eng_engine_new(void) engine = calloc(1, sizeof (Render_Engine_GL_Generic)); if (!engine) return NULL; engine->software.surface_cache = generic_cache_new(engine, eng_image_free); - return engine; } @@ -922,6 +921,42 @@ on_error: return NULL; } +//TIZEN_ONLY(20241028): evas: added egl fence before surface map. +static void +_eng_egl_wait_sync(Render_Engine_GL_Generic *engine) +{ + EGLBoolean wait_result = EGL_FALSE; + EGLBoolean destroy_result = EGL_FALSE; + EGLDisplay display = EGL_NO_DISPLAY; + + if (!engine) + return; + + display = egl_display_get(engine); + + if (engine->egl_fence == EGL_NO_SYNC) + { + if (eglsym_eglCreateSyncKHR) + engine->egl_fence = eglsym_eglCreateSyncKHR(display, EGL_SYNC_FENCE_KHR, NULL); + + if (engine->egl_fence == EGL_NO_SYNC) + ERR("eglCreateSync failed. error:%x", GL_TH(eglGetError)); + + wait_result = eglsym_eglWaitSyncKHR(display, engine->egl_fence, 0); + if (!wait_result) + ERR("eglWaitSync failed %x", GL_TH(eglGetError)); + + if (eglsym_eglDestroySyncKHR) + destroy_result = eglsym_eglDestroySyncKHR(display, engine->egl_fence); + + if (!destroy_result) + ERR("eglDestroySync failed %x", GL_TH(eglGetError)); + + engine->egl_fence = EGL_NO_SYNC; + } +} +// + void * eng_image_data_get(void *engine, void *image, int to_write, DATA32 **image_data, int *err, Eina_Bool *tofree) { @@ -961,6 +996,9 @@ eng_image_data_get(void *engine, void *image, int to_write, DATA32 **image_data, if ((im->gc->shared->info.sec_tbm_surface) && (secsym_tbm_surface_map)) { tbm_surface_info_s info; + //TIZEN_ONLY(20241028): evas: added egl fence before surface map. + _eng_egl_wait_sync(engine); + // if (secsym_tbm_surface_map(im->tex->pt->dyn.buffer, TBM_SURF_OPTION_READ|TBM_SURF_OPTION_WRITE, &info)) |