Implementation of fastpath_eglGetCurrentDisplay() to return locally stored display...
authormythri.venugopal <mythri.venugopal@samsung.com>
Tue, 7 Jan 2014 17:23:35 +0000 (17:23 +0000)
committermythri.venugopal <mythri.venugopal@samsung.com>
Mon, 13 Jan 2014 19:31:14 +0000 (19:31 +0000)
Added null checks & void argument.
Removed additional tstate!=NULL check

src/modules/fastpath/coregl_fastpath.c
src/modules/fastpath/coregl_fastpath_egl.c

index feb958d..a82bff5 100644 (file)
@@ -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);
 
 }
 
index 05e4188..864f9f6 100644 (file)
@@ -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)