diff options
author | Vasiliy Ulyanov <v.ulyanov@samsung.com> | 2017-04-26 14:59:27 +0300 |
---|---|---|
committer | Vasiliy Ulyanov <v.ulyanov@samsung.com> | 2017-04-26 15:14:40 +0300 |
commit | 56b89b2e3d9d703af2ab845825fae9da1357bfe4 (patch) | |
tree | 7258bf4a95d98a439f639affa7e2f091cf4b19a0 | |
parent | 49d296e27a95a384d77310cf7fdba635f3d4ced0 (diff) | |
download | emulator-yagl-56b89b2e3d9d703af2ab845825fae9da1357bfe4.tar.gz emulator-yagl-56b89b2e3d9d703af2ab845825fae9da1357bfe4.tar.bz2 emulator-yagl-56b89b2e3d9d703af2ab845825fae9da1357bfe4.zip |
Ensure fence_dpy is setup for all threadstizen_4.0.m1_releasesubmit/tizen_4.0_unified/20170814.115522submit/tizen_4.0/20170828.110001submit/tizen_4.0/20170814.115522submit/tizen_4.0/20170811.094300submit/tizen/20170427.063328accepted/tizen/unified/20170428.032549accepted/tizen/4.0/unified/20170828.224236accepted/tizen/4.0/unified/20170816.015300accepted/tizen/4.0/unified/20170816.012405
This is needed in order to be able to create fences in transport layer
and avoid race conditions when invoking yagl_host_* routines with return
values. Previously fence_dpy was assigned only in eglGetDisplay. Though
the app may make EGL calls from auxiliary threads which will have
fence_dpy uninitialized.
Change-Id: Ibe66030cb4a30d189750d1ab233164cfea60b339
Signed-off-by: Vasiliy Ulyanov <v.ulyanov@samsung.com>
-rw-r--r-- | EGL/yagl_display.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/EGL/yagl_display.c b/EGL/yagl_display.c index 60b8d02..1433c8a 100644 --- a/EGL/yagl_display.c +++ b/EGL/yagl_display.c @@ -131,6 +131,20 @@ struct yagl_display *yagl_display_get(EGLDisplay handle) if (dpy->host_dpy == host_dpy) { pthread_mutex_unlock(&g_displays_mutex); + /* + * We need to make sure fence_dpy is setup properly for current + * thread state. Otherwise we may not be able to create fences in + * transport layer and eventually will face a race condition between + * host and target. + * + * E.g. the app may initialize all EGL stuff (i.e. get display, + * choose config, etc.) and save it to some global state var. If + * then it tries to create new context in some other thread, + * fence_dpy will be NULL and as a result we may not get proper + * values returned from the host. + */ + yagl_set_fence_display(dpy); + return dpy; } } |