X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fadaptor%2Fcommon%2Fadaptor-impl.cpp;h=868345d9d9e57da039c0b137f5503d148c0b0c20;hb=573600ba751204639c5ee68a528f2b72acf8385c;hp=0aa9feb72e067d52d81df6864b35590c2de83e49;hpb=daf1d29c7b0cacec913a850e2216c5253fc779c3;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/internal/adaptor/common/adaptor-impl.cpp b/dali/internal/adaptor/common/adaptor-impl.cpp index 0aa9feb..868345d 100755 --- a/dali/internal/adaptor/common/adaptor-impl.cpp +++ b/dali/internal/adaptor/common/adaptor-impl.cpp @@ -34,6 +34,8 @@ #include #include +#include + // INTERNAL INCLUDES #include #include @@ -54,7 +56,6 @@ #include #include #include -#include #include #include #include @@ -66,9 +67,12 @@ #include #include +#include using Dali::TextAbstraction::FontClient; +extern std::string GetSystemCachePath(); + namespace Dali { @@ -170,11 +174,13 @@ void Adaptor::Initialize( GraphicsFactory& graphicsFactory, Dali::Configuration: GlImplementation& mGLES = eglGraphics->GetGlesInterface(); EglSyncImplementation& eglSyncImpl = eglGraphics->GetSyncImplementation(); + EglContextHelperImplementation& eglContextHelperImpl = eglGraphics->GetContextHelperImplementation(); mCore = Integration::Core::New( *this, *mPlatformAbstraction, mGLES, eglSyncImpl, + eglContextHelperImpl, dataRetentionPolicy , ( 0u != mEnvironmentOptions->GetRenderToFboInterval() ) ? Integration::RenderToFrameBuffer::TRUE : Integration::RenderToFrameBuffer::FALSE, mGraphics->GetDepthBufferRequired(), @@ -196,8 +202,6 @@ void Adaptor::Initialize( GraphicsFactory& graphicsFactory, Dali::Configuration: mNotificationTrigger = mTriggerEventFactory.CreateTriggerEvent( MakeCallback( this, &Adaptor::ProcessCoreEvents ), TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER); - mVSyncMonitor = new VSyncMonitor; - mDisplayConnection = Dali::DisplayConnection::New( *mGraphics, defaultWindow->GetSurface()->GetSurfaceType() ); mThreadController = new ThreadController( *this, *mEnvironmentOptions ); @@ -285,6 +289,40 @@ void Adaptor::Initialize( GraphicsFactory& graphicsFactory, Dali::Configuration: { Dali::TizenPlatform::ImageLoader::SetMaxTextureSize( mEnvironmentOptions->GetMaxTextureSize() ); } + + std::string systemCachePath = GetSystemCachePath(); + if ( systemCachePath.c_str() != NULL ) + { + Dali::FileStream fileStream( systemCachePath + "gpu-environment.conf", Dali::FileStream::READ | Dali::FileStream::TEXT ); + std::fstream& stream = dynamic_cast( fileStream.GetStream() ); + if( stream.is_open() ) + { + std::string line; + while( std::getline( stream, line ) ) + { + line.erase( line.find_last_not_of( " \t\r\n" ) + 1 ); + line.erase( 0, line.find_first_not_of( " \t\r\n" ) ); + if( '#' == *( line.cbegin() ) || line == "" ) + { + continue; + } + + std::istringstream stream( line ); + std::string environmentVariableName, environmentVariableValue; + std::getline(stream, environmentVariableName, ' '); + if( environmentVariableName == "DALI_ENV_MAX_TEXTURE_SIZE" && mEnvironmentOptions->GetMaxTextureSize() == 0 ) + { + std::getline(stream, environmentVariableValue); + setenv( environmentVariableName.c_str() , environmentVariableValue.c_str(), 1 ); + Dali::TizenPlatform::ImageLoader::SetMaxTextureSize( std::atoi( environmentVariableValue.c_str() ) ); + } + } + } + else + { + DALI_LOG_ERROR( "Fail to open file : %s\n", ( systemCachePath + "gpu-environment.conf" ).c_str() ); + } + } } Adaptor::~Adaptor() @@ -304,7 +342,6 @@ Adaptor::~Adaptor() mWindows.clear(); delete mThreadController; // this will shutdown render thread, which will call Core::ContextDestroyed before exit - delete mVSyncMonitor; delete mObjectProfiler; delete mCore; @@ -352,12 +389,34 @@ void Adaptor::Start() FontClient fontClient = FontClient::Get(); fontClient.SetDpi( dpiHor, dpiVer ); - // Tell the core the size of the surface just before we start the render-thread - mCore->SurfaceResized( defaultWindow->GetSurface() ); - // Initialize the thread controller mThreadController->Initialize(); + if( !Dali::TizenPlatform::ImageLoader::MaxTextureSizeUpdated() ) + { + auto eglGraphics = static_cast( mGraphics ); + GlImplementation& mGLES = eglGraphics->GetGlesInterface(); + Dali::TizenPlatform::ImageLoader::SetMaxTextureSize( mGLES.GetMaxTextureSize() ); + + std::string systemCachePath = GetSystemCachePath(); + if( systemCachePath.c_str() != NULL ) + { + const int dir_err = system( std::string( "mkdir " + systemCachePath ).c_str() ); + if (-1 == dir_err) + { + printf("Error creating directory!n"); + exit(1); + } + + Dali::FileStream fileStream( systemCachePath + "gpu-environment.conf", Dali::FileStream::WRITE | Dali::FileStream::TEXT ); + std::fstream& configFile = dynamic_cast( fileStream.GetStream() ); + if( configFile.is_open() ) + { + configFile << "DALI_ENV_MAX_TEXTURE_SIZE " << mGLES.GetMaxTextureSize() << std::endl; + } + } + } + ProcessCoreEvents(); // Ensure any startup messages are processed. // Initialize the image loader plugin @@ -509,9 +568,6 @@ void Adaptor::ReplaceSurface( Dali::Integration::SceneHolder window, Dali::Rende { if( windowPtr == windowImpl ) // the window is not deleted { - // Let the core know the surface size has changed - mCore->SurfaceResized( &newSurface ); - mResizedSignal.Emit( mAdaptor ); windowImpl->SetSurface( &newSurface ); @@ -527,6 +583,16 @@ void Adaptor::ReplaceSurface( Dali::Integration::SceneHolder window, Dali::Rende } } +void Adaptor::DeleteSurface( Dali::RenderSurfaceInterface& surface ) +{ + // Flush the event queue to give the update-render thread chance + // to start processing messages for new camera setup etc as soon as possible + ProcessCoreEvents(); + + // This method blocks until the render thread has finished rendering the current surface. + mThreadController->DeleteSurface( &surface ); +} + Dali::RenderSurfaceInterface& Adaptor::GetSurface() const { return *mWindows.front()->GetSurface(); @@ -571,9 +637,9 @@ void Adaptor::SetPreRenderCallback( CallbackBase* callback ) mThreadController->SetPreRenderCallback( callback ); } -bool Adaptor::AddWindow( Dali::Integration::SceneHolder* childWindow, const std::string& childWindowName, const std::string& childWindowClassName, const bool& childWindowMode ) +bool Adaptor::AddWindow( Dali::Integration::SceneHolder childWindow, const std::string& childWindowName, const std::string& childWindowClassName, bool childWindowMode ) { - Internal::Adaptor::SceneHolder& windowImpl = Dali::GetImplementation( *childWindow ); + Internal::Adaptor::SceneHolder& windowImpl = Dali::GetImplementation( childWindow ); windowImpl.SetAdaptor( Get() ); // Add the new Window to the container - the order is not important @@ -657,11 +723,6 @@ void Adaptor::SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender ) mThreadController->SetRenderRefreshRate( numberOfVSyncsPerRender ); } -void Adaptor::SetUseHardwareVSync( bool useHardware ) -{ - mVSyncMonitor->SetUseHardwareVSync( useHardware ); -} - Dali::DisplayConnection& Adaptor::GetDisplayConnectionInterface() { DALI_ASSERT_DEBUG( mDisplayConnection && "Display connection not created" ); @@ -704,11 +765,6 @@ Dali::RenderSurfaceInterface* Adaptor::GetRenderSurfaceInterface() return nullptr; } -VSyncMonitorInterface* Adaptor::GetVSyncMonitorInterface() -{ - return mVSyncMonitor; -} - TraceInterface& Adaptor::GetKernelTraceInterface() { return mKernelTracer; @@ -743,6 +799,24 @@ Any Adaptor::GetNativeWindowHandle() return mWindows.front()->GetNativeHandle(); } +Any Adaptor::GetNativeWindowHandle( Dali::Actor actor ) +{ + Any nativeWindowHandle; + + Dali::Integration::Scene scene = Dali::Integration::Scene::Get( actor ); + + for( auto sceneHolder : mWindows ) + { + if ( scene == sceneHolder->GetScene() ) + { + nativeWindowHandle = sceneHolder->GetNativeHandle(); + break; + } + } + + return nativeWindowHandle; +} + Any Adaptor::GetGraphicsDisplay() { Any display; @@ -859,6 +933,13 @@ void Adaptor::OnWindowShown() // Force a render task RequestUpdateOnce(); } + else if( RUNNING == mState ) + { + // Force a render task + RequestUpdateOnce(); + + DALI_LOG_RELEASE_INFO( "Adaptor::OnWindowShown: Update requested.\n" ); + } else { DALI_LOG_RELEASE_INFO( "Adaptor::OnWindowShown: Adaptor is not paused state.[%d]\n", mState ); @@ -916,9 +997,6 @@ void Adaptor::OnDamaged( const DamageArea& area ) void Adaptor::SurfaceResizePrepare( Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize ) { - // Let the core know the surface size has changed - mCore->SurfaceResized( surface ); - mResizedSignal.Emit( mAdaptor ); } @@ -1046,7 +1124,6 @@ Adaptor::Adaptor(Dali::Integration::SceneHolder window, Dali::Adaptor& adaptor, mState( READY ), mCore( nullptr ), mThreadController( nullptr ), - mVSyncMonitor( nullptr ), mGraphics( nullptr ), mDisplayConnection( nullptr ), mWindows(),