X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fgraphics%2Fgles%2Fegl-implementation.cpp;h=76fa78a62b542c5f900fd721a4c43f5ca985f18d;hb=0e542d2c071b28da232aa2827a18935a01592484;hp=6580a6fd3df4e8d80792f596610b0870e064e7c0;hpb=3b72fa2068656331f469979747fac6493d5f9c87;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/internal/graphics/gles/egl-implementation.cpp b/dali/internal/graphics/gles/egl-implementation.cpp index 6580a6f..76fa78a 100755 --- a/dali/internal/graphics/gles/egl-implementation.cpp +++ b/dali/internal/graphics/gles/egl-implementation.cpp @@ -20,6 +20,7 @@ #include // EXTERNAL INCLUDES +#include #include #include @@ -32,6 +33,11 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wold-style-cast" +namespace +{ + const std::string EGL_KHR_SURFACELESS_CONTEXT = "EGL_KHR_surfaceless_context"; +} + namespace Dali { @@ -71,7 +77,8 @@ EglImplementation::EglImplementation( int multiSamplingLevel, mIsOwnSurface( true ), mIsWindow( true ), mDepthBufferRequired( depthBufferRequired == Integration::DepthBufferAvailable::TRUE ), - mStencilBufferRequired( stencilBufferRequired == Integration::StencilBufferAvailable::TRUE ) + mStencilBufferRequired( stencilBufferRequired == Integration::StencilBufferAvailable::TRUE ), + mIsSurfacelessContextSupported( false ) { } @@ -107,6 +114,19 @@ bool EglImplementation::InitializeGles( EGLNativeDisplayType display, bool isOwn mIsOwnSurface = isOwnSurface; } + // Query EGL extensions to check whether surfaceless context is supported + const char* const extensionStr = eglQueryString( mEglDisplay, EGL_EXTENSIONS ); + std::istringstream stream(extensionStr); + std::string currentExtension; + while ( std::getline( stream, currentExtension, ' ' ) ) + { + if ( currentExtension == EGL_KHR_SURFACELESS_CONTEXT ) + { + mIsSurfacelessContextSupported = true; + break; + } + } + // We want to display this information all the time, so use the LogMessage directly Integration::Log::LogMessage(Integration::Log::DebugInfo, "EGL Information\n" " Vendor: %s\n" @@ -116,7 +136,7 @@ bool EglImplementation::InitializeGles( EGLNativeDisplayType display, bool isOwn eglQueryString( mEglDisplay, EGL_VENDOR ), eglQueryString( mEglDisplay, EGL_VERSION ), eglQueryString( mEglDisplay, EGL_CLIENT_APIS ), - eglQueryString( mEglDisplay, EGL_EXTENSIONS )); + extensionStr); return mGlesInitialized; } @@ -381,7 +401,10 @@ bool EglImplementation::ChooseConfig( bool isWindowType, ColorDepth depth ) #endif // DALI_PROFILE_UBUNTU configAttribs.PushBack( EGL_NONE ); - if ( eglChooseConfig( mEglDisplay, &(configAttribs[0]), &mEglConfig, 1, &numConfigs ) != EGL_TRUE ) + // Ensure number of configs is set to 1 as on some drivers, + // eglChooseConfig succeeds but does not actually create a proper configuration. + if ( ( eglChooseConfig( mEglDisplay, &(configAttribs[0]), &mEglConfig, 1, &numConfigs ) != EGL_TRUE ) || + ( numConfigs != 1 ) ) { if( mGlesVersion >= 30 ) { @@ -390,6 +413,13 @@ bool EglImplementation::ChooseConfig( bool isWindowType, ColorDepth depth ) return false; } + if ( numConfigs != 1 ) + { + DALI_LOG_ERROR("No configurations found.\n"); + + TEST_EGL_ERROR("eglChooseConfig"); + } + EGLint error = eglGetError(); switch (error) { @@ -440,13 +470,6 @@ bool EglImplementation::ChooseConfig( bool isWindowType, ColorDepth depth ) } mContextAttribs.PushBack( EGL_NONE ); - if ( numConfigs != 1 ) - { - DALI_LOG_ERROR("No configurations found.\n"); - - TEST_EGL_ERROR("eglChooseConfig"); - } - return true; } @@ -496,10 +519,10 @@ bool EglImplementation::ReplaceSurfaceWindow( EGLNativeWindowType window, EGLSur DestroySurface( eglSurface ); // create the EGL surface - CreateSurfaceWindow( window, mColorDepth ); + EGLSurface newEglSurface = CreateSurfaceWindow( window, mColorDepth ); // set the context to be current with the new surface - MakeContextCurrent( eglSurface, eglContext ); + MakeContextCurrent( newEglSurface, eglContext ); return contextLost; } @@ -538,6 +561,11 @@ int32_t EglImplementation::GetGlesVersion() const return mGlesVersion; } +bool EglImplementation::IsSurfacelessContextSupported() const +{ + return mIsSurfacelessContextSupported; +} + } // namespace Adaptor } // namespace Internal