From c4839bbdc4cd4a36fe2e00cc71b02963b28d6b3c Mon Sep 17 00:00:00 2001 From: "mythri.venugopal" Date: Tue, 7 Jan 2014 17:23:35 +0000 Subject: [PATCH] Implementation of fastpath_eglGetCurrentDisplay() to return locally stored display instead of querying driver. Added null checks & void argument. Removed additional tstate!=NULL check --- src/modules/fastpath/coregl_fastpath.c | 1 + src/modules/fastpath/coregl_fastpath_egl.c | 39 ++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/src/modules/fastpath/coregl_fastpath.c b/src/modules/fastpath/coregl_fastpath.c index feb958d..a82bff5 100644 --- a/src/modules/fastpath/coregl_fastpath.c +++ b/src/modules/fastpath/coregl_fastpath.c @@ -272,6 +272,7 @@ fastpath_apply_overrides_egl(int enable) COREGL_OVERRIDE(fastpath_, eglReleaseThread); COREGL_OVERRIDE(fastpath_, eglGetCurrentSurface); COREGL_OVERRIDE(fastpath_, eglTerminate); + COREGL_OVERRIDE(fastpath_, eglGetCurrentDisplay); } diff --git a/src/modules/fastpath/coregl_fastpath_egl.c b/src/modules/fastpath/coregl_fastpath_egl.c index 05e4188..864f9f6 100644 --- a/src/modules/fastpath/coregl_fastpath_egl.c +++ b/src/modules/fastpath/coregl_fastpath_egl.c @@ -1061,7 +1061,46 @@ finish: return ret; } +EGLDisplay +fastpath_eglGetCurrentDisplay(void) +{ + MY_MODULE_TSTATE *tstate = NULL; + EGLDisplay dpy = EGL_NO_DISPLAY; + + GET_MY_TSTATE(tstate, get_current_thread_state()); + + if (tstate != NULL) + { + // Special eject condition for binding API + if(tstate->binded_api != EGL_OPENGL_ES_API) + { + return _orig_fastpath_eglGetCurrentDisplay(); + } + + _COREGL_FASTPATH_FUNC_BEGIN(); + + if (tstate->cstate != NULL) + { + dpy = tstate->cstate->rdpy; + + } else + { + COREGL_WRN("\E[40;31;1mError fastpath_eglGetCurrentDisplay No context state \E[0m\n"); + } + _COREGL_FASTPATH_FUNC_END(); + + } else + { + COREGL_WRN("\E[40;31;1mError fastpath_eglGetCurrentDisplay No thread state \E[0m\n"); + } + + goto finish; + +finish: + + return dpy; +} EGLBoolean fastpath_eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx) -- 2.7.4