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";
}
namespace Dali
mIsWindow( true ),
mDepthBufferRequired( depthBufferRequired == Integration::DepthBufferAvailable::TRUE ),
mStencilBufferRequired( stencilBufferRequired == Integration::StencilBufferAvailable::TRUE ),
- mIsSurfacelessContextSupported( false )
+ mIsSurfacelessContextSupported( false ),
+ mIsKhrCreateContextSupported( false ),
+ mSwapBufferCountAfterResume( 0 )
{
}
// Query EGL extensions to check whether surfaceless context is supported
const char* const extensionStr = eglQueryString( mEglDisplay, EGL_EXTENSIONS );
- std::istringstream stream(extensionStr);
+ std::istringstream stream( extensionStr );
std::string currentExtension;
- while ( std::getline( stream, currentExtension, ' ' ) )
+ uint32_t extensionCheckCount = 0;
+ while( std::getline( stream, currentExtension, ' ' ) && extensionCheckCount < CHECK_EXTENSION_NUMBER )
{
- if ( currentExtension == EGL_KHR_SURFACELESS_CONTEXT )
+ if( currentExtension == EGL_KHR_SURFACELESS_CONTEXT )
{
mIsSurfacelessContextSupported = true;
- break;
+ extensionCheckCount++;
+ }
+ if( currentExtension == EGL_KHR_CREATE_CONTEXT )
+ {
+ mIsKhrCreateContextSupported = true;
+ extensionCheckCount++;
}
}
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" );
if(mIsOwnSurface)
{
- if( mCurrentEglContext != EGL_NO_CONTEXT )
- {
- glFinish();
- }
-
eglMakeCurrent( mEglDisplay, eglSurface, eglSurface, eglContext );
mCurrentEglContext = eglContext;
if(mIsOwnSurface)
{
- if( mCurrentEglContext != EGL_NO_CONTEXT )
- {
- glFinish();
- }
-
eglMakeCurrent( mEglDisplay, eglSurface, eglSurface, mEglContext );
mCurrentEglContext = mEglContext;
{
if ( eglSurface != EGL_NO_SURFACE ) // skip if using surfaceless context
{
+#ifndef DALI_PROFILE_UBUNTU
+ if( mSwapBufferCountAfterResume < THRESHOLD_SWAPBUFFER_COUNT )
+ {
+ 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
}
}
configAttribs.PushBack( EGL_BLUE_SIZE );
configAttribs.PushBack( 8 );
- // In the previous code, there was a branch for ARM.
- // If there is an issue in only ARM, we need to check here again.
+// For underlay video playback, we also need to set the alpha value of the 24/32bit window.
configAttribs.PushBack( EGL_ALPHA_SIZE );
configAttribs.PushBack( 8 );
Integration::Log::LogMessage(Integration::Log::DebugInfo, "Using OpenGL es %d.%d.\n", mGlesVersion / 10, mGlesVersion % 10 );
mContextAttribs.Clear();
- if( mGlesVersion >= 30 )
+ if( mIsKhrCreateContextSupported )
{
mContextAttribs.Reserve(5);
mContextAttribs.PushBack( EGL_CONTEXT_MAJOR_VERSION_KHR );
{
mContextAttribs.Reserve(3);
mContextAttribs.PushBack( EGL_CONTEXT_CLIENT_VERSION );
- mContextAttribs.PushBack( 2 );
+ mContextAttribs.PushBack( mGlesVersion / 10 );
}
mContextAttribs.PushBack( EGL_NONE );
mGlesVersion = glesVersion;
}
+void EglImplementation::SetFirstFrameAfterResume()
+{
+ mSwapBufferCountAfterResume = 0;
+}
+
EGLDisplay EglImplementation::GetDisplay() const
{
return mEglDisplay;
return mIsSurfacelessContextSupported;
}
+void EglImplementation::WaitClient()
+{
+ // Wait for EGL to finish executing all rendering calls for the current context
+ if ( eglWaitClient() != EGL_TRUE )
+ {
+ TEST_EGL_ERROR("eglWaitClient");
+ }
+}
+
} // namespace Adaptor
} // namespace Internal