+
+#ifndef DALI_PROFILE_UBUNTU
+ if( mSwapBufferCountAfterResume < THRESHOLD_SWAPBUFFER_COUNT )
+ {
+ DALI_LOG_RELEASE_INFO( "EglImplementation::SwapBuffers finished.\n" );
+ mSwapBufferCountAfterResume++;
+ }
+#endif //DALI_PROFILE_UBUNTU
+ }
+}
+
+EGLint EglImplementation::GetBufferAge(EGLSurface& eglSurface) const
+{
+ EGLint age = 0;
+ eglQuerySurface(mEglDisplay, eglSurface, EGL_BUFFER_AGE_EXT, &age);
+ if (age < 0)
+ {
+ DALI_LOG_ERROR("eglQuerySurface(%d)\n", eglGetError());
+ age = 0;
+ }
+
+ // 0 - invalid buffer
+ // 1, 2, 3
+ if (age > 3)
+ {
+ DALI_LOG_ERROR("EglImplementation::GetBufferAge() buffer age %d > 3\n", age);
+ age = 0; // shoudn't be more than 3 back buffers, if there is just reset, I don't want to add extra history level
+ }
+
+ return age;
+}
+
+void EglImplementation::SetDamageRegion( EGLSurface& eglSurface, std::vector< Rect< int > >& damagedRects )
+{
+ if( !mPartialUpdateRequired )
+ {
+ return;
+ }
+
+ if( eglSurface != EGL_NO_SURFACE ) // skip if using surfaceless context
+ {
+ EGLBoolean result = mEglSetDamageRegionKHR( mEglDisplay, eglSurface, reinterpret_cast< int* >( damagedRects.data() ), 1 );
+ if (result == EGL_FALSE)
+ {
+ DALI_LOG_ERROR( "eglSetDamageRegionKHR(%d)\n", eglGetError() );
+ }
+ }
+}
+
+void EglImplementation::SwapBuffers(EGLSurface& eglSurface, const std::vector<Rect<int>>& damagedRects)
+{
+ if (eglSurface != EGL_NO_SURFACE ) // skip if using surfaceless context
+ {
+ if (!mPartialUpdateRequired )
+ {
+ SwapBuffers(eglSurface);
+ return;
+ }
+
+#ifndef DALI_PROFILE_UBUNTU
+ if( mSwapBufferCountAfterResume < THRESHOLD_SWAPBUFFER_COUNT )
+ {
+ DALI_LOG_RELEASE_INFO( "EglImplementation::SwapBuffers started.\n" );
+ }
+#endif //DALI_PROFILE_UBUNTU
+
+ EGLBoolean result = mEglSwapBuffersWithDamageKHR(mEglDisplay, eglSurface, reinterpret_cast<int*>(const_cast< std::vector< Rect< int > >& >( damagedRects ).data()), damagedRects.size());
+ if (result == EGL_FALSE)
+ {
+ DALI_LOG_ERROR("eglSwapBuffersWithDamageKHR(%d)\n", eglGetError());
+ }
+
+#ifndef DALI_PROFILE_UBUNTU
+ if( mSwapBufferCountAfterResume < THRESHOLD_SWAPBUFFER_COUNT )
+ {
+ DALI_LOG_RELEASE_INFO( "EglImplementation::SwapBuffers finished.\n" );
+ mSwapBufferCountAfterResume++;
+ }
+#endif //DALI_PROFILE_UBUNTU