Revert "[Tizen] Implement partial update"
[platform/core/uifw/dali-adaptor.git] / dali / internal / graphics / gles / egl-implementation.cpp
index ae95d25..3234393 100755 (executable)
@@ -35,6 +35,7 @@
 
 namespace
 {
+  const uint32_t THRESHOLD_SWAPBUFFER_COUNT = 5;
   const uint32_t CHECK_EXTENSION_NUMBER = 2;
   const std::string EGL_KHR_SURFACELESS_CONTEXT = "EGL_KHR_surfaceless_context";
   const std::string EGL_KHR_CREATE_CONTEXT = "EGL_KHR_create_context";
@@ -82,7 +83,7 @@ EglImplementation::EglImplementation( int multiSamplingLevel,
   mStencilBufferRequired( stencilBufferRequired == Integration::StencilBufferAvailable::TRUE ),
   mIsSurfacelessContextSupported( false ),
   mIsKhrCreateContextSupported( false ),
-  mIsFirstFrameAfterResume( false )
+  mSwapBufferCountAfterResume( 0 )
 {
 }
 
@@ -311,12 +312,22 @@ void EglImplementation::SwapBuffers( EGLSurface& eglSurface )
 {
   if ( eglSurface != EGL_NO_SURFACE ) // skip if using surfaceless context
   {
-    if( mIsFirstFrameAfterResume )
+#ifndef DALI_PROFILE_UBUNTU
+    if( mSwapBufferCountAfterResume < THRESHOLD_SWAPBUFFER_COUNT )
     {
-      DALI_LOG_RELEASE_INFO( "EglImplementation::SwapBuffers: First SwapBuffers call.\n" );
-      mIsFirstFrameAfterResume = false;
+      DALI_LOG_RELEASE_INFO( "EglImplementation::SwapBuffers started.\n" );
     }
+#endif //DALI_PROFILE_UBUNTU
+
     eglSwapBuffers( mEglDisplay, eglSurface );
+
+#ifndef DALI_PROFILE_UBUNTU
+    if( mSwapBufferCountAfterResume < THRESHOLD_SWAPBUFFER_COUNT )
+    {
+      DALI_LOG_RELEASE_INFO( "EglImplementation::SwapBuffers finished.\n" );
+      mSwapBufferCountAfterResume++;
+    }
+#endif //DALI_PROFILE_UBUNTU
   }
 }
 
@@ -511,8 +522,11 @@ bool EglImplementation::ReplaceSurfaceWindow( EGLNativeWindowType window, EGLSur
   //  the surface is bound to the context, so set the context to null
   MakeContextNull();
 
-  // destroy the surface
-  DestroySurface( eglSurface );
+  if( eglSurface )
+  {
+    // destroy the surface
+    DestroySurface( eglSurface );
+  }
 
   // create the EGL surface
   EGLSurface newEglSurface = CreateSurfaceWindow( window, mColorDepth );
@@ -544,7 +558,7 @@ void EglImplementation::SetGlesVersion( const int32_t glesVersion )
 
 void EglImplementation::SetFirstFrameAfterResume()
 {
-  mIsFirstFrameAfterResume = true;
+  mSwapBufferCountAfterResume = 0;
 }
 
 EGLDisplay EglImplementation::GetDisplay() const