[Tizen] Use OpenGL es 2.0 if eglCreateContext is fail, Prevent glFinish without makeC...
authorJoogab Yun <joogab.yun@samsung.com>
Mon, 8 Jul 2019 07:21:04 +0000 (16:21 +0900)
committerJoogab Yun <joogab.yun@samsung.com>
Mon, 8 Jul 2019 07:21:09 +0000 (16:21 +0900)
This reverts commit bf82705c82c13f5524851e8af7d603d1c0aa57c4.

Change-Id: I6babf36c278d63711691d06371d4b9d21a6d24b1

dali/internal/adaptor/common/combined-update-render-controller.cpp
dali/internal/graphics/gles/egl-implementation.cpp

index 4486766..2185ed8 100644 (file)
@@ -445,6 +445,15 @@ void CombinedUpdateRenderController::UpdateRenderThread()
     eglGraphics->SetGlesVersion( 20 );
     eglImpl.ChooseConfig( true, COLOR_DEPTH_32 );
   }
+  else
+  {
+    if( !eglImpl.CreateContext() )
+    {
+      // Retry to use OpenGL es 2.0
+      eglGraphics->SetGlesVersion( 20 );
+      eglImpl.ChooseConfig( true, COLOR_DEPTH_32 );
+    }
+  }
 
   // Check whether surfaceless context is supported
   bool isSurfacelessContextSupported = eglImpl.IsSurfacelessContextSupported();
@@ -453,7 +462,10 @@ void CombinedUpdateRenderController::UpdateRenderThread()
   if ( isSurfacelessContextSupported )
   {
     // Create a surfaceless OpenGL context for shared resources
-    eglImpl.CreateContext();
+    if( eglImpl.GetContext() == 0 )
+    {
+      eglImpl.CreateContext();
+    }
     eglImpl.MakeContextCurrent( EGL_NO_SURFACE, eglImpl.GetContext() );
   }
   else
index b8a42f7..a9c5804 100755 (executable)
@@ -156,6 +156,17 @@ bool EglImplementation::CreateContext()
   DALI_ASSERT_ALWAYS( (mEglContext == 0) && "EGL context recreated" );
 
   mEglContext = eglCreateContext(mEglDisplay, mEglConfig, NULL, &(mContextAttribs[0]));
+  if ( eglGetError() != EGL_SUCCESS )
+  {
+    if( mGlesVersion >= 30 )
+    {
+      eglDestroySurface( mEglDisplay, mEglContext );
+      mEglContext = NULL;
+      mEglConfig = NULL;
+      DALI_LOG_ERROR("Fail to use OpenGL es 3.0. Retrying to use OpenGL es 2.0.");
+      return false;
+    }
+  }
   TEST_EGL_ERROR("eglCreateContext render thread");
 
   DALI_ASSERT_ALWAYS( EGL_NO_CONTEXT != mEglContext && "EGL context not created" );