X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fadaptor%2Fcommon%2Fcombined-update-render-controller.cpp;h=7343b433141ff217740a5454ba05744aecdbb175;hb=5a03a49db1a8e90a7ee79cb225616f1d41747594;hp=a41a61359d7c7f95925c419b5a831dab0967a396;hpb=d1ba62dffa7da6d178a00dd7928e847b7bcd439b;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/internal/adaptor/common/combined-update-render-controller.cpp b/dali/internal/adaptor/common/combined-update-render-controller.cpp index a41a613..7343b43 100644 --- a/dali/internal/adaptor/common/combined-update-render-controller.cpp +++ b/dali/internal/adaptor/common/combined-update-render-controller.cpp @@ -21,6 +21,7 @@ // EXTERNAL INCLUDES #include #include +#include // INTERNAL INCLUDES #include @@ -32,6 +33,7 @@ #include #include #include +#include namespace Dali { @@ -132,8 +134,7 @@ CombinedUpdateRenderController::CombinedUpdateRenderController( AdaptorInternalS currentSurface->SetThreadSynchronization( *this ); } - TriggerEventFactoryInterface& triggerFactory = mAdaptorInterfaces.GetTriggerEventFactoryInterface(); - mSleepTrigger = triggerFactory.CreateTriggerEvent( MakeCallback( this, &CombinedUpdateRenderController::ProcessSleepRequest ), TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER ); + mSleepTrigger = TriggerEventFactory::CreateTriggerEvent( MakeCallback( this, &CombinedUpdateRenderController::ProcessSleepRequest ), TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER ); // Initialize to 0 so that it just waits if sem_post has not been called sem_init( &mEventThreadSemaphore, 0, 0 ); @@ -178,7 +179,7 @@ void CombinedUpdateRenderController::Start() sem_wait( &mEventThreadSemaphore ); } - Integration::RenderSurface* currentSurface = mAdaptorInterfaces.GetRenderSurfaceInterface(); + Dali::RenderSurfaceInterface* currentSurface = mAdaptorInterfaces.GetRenderSurfaceInterface(); if( currentSurface ) { currentSurface->StartRender(); @@ -235,7 +236,7 @@ void CombinedUpdateRenderController::Stop() LOG_EVENT_TRACE; // Stop Rendering and the Update/Render Thread - Integration::RenderSurface* currentSurface = mAdaptorInterfaces.GetRenderSurfaceInterface(); + Dali::RenderSurfaceInterface* currentSurface = mAdaptorInterfaces.GetRenderSurfaceInterface(); if( currentSurface ) { currentSurface->StopRender(); @@ -576,7 +577,7 @@ void CombinedUpdateRenderController::UpdateRenderThread() // REPLACE SURFACE ////////////////////////////// - Integration::RenderSurface* newSurface = ShouldSurfaceBeReplaced(); + Dali::RenderSurfaceInterface* newSurface = ShouldSurfaceBeReplaced(); if( DALI_UNLIKELY( newSurface ) ) { LOG_UPDATE_RENDER_TRACE_FMT( "Replacing Surface" ); @@ -636,6 +637,7 @@ void CombinedUpdateRenderController::UpdateRenderThread() } // Check resize + bool surfaceResized = false; bool shouldSurfaceBeResized = ShouldSurfaceBeResized(); if( DALI_UNLIKELY( shouldSurfaceBeResized ) ) { @@ -643,6 +645,7 @@ void CombinedUpdateRenderController::UpdateRenderThread() { LOG_UPDATE_RENDER_TRACE_FMT( "Resizing Surface" ); SurfaceResized(); + surfaceResized = true; } } @@ -682,18 +685,51 @@ void CombinedUpdateRenderController::UpdateRenderThread() Integration::RenderStatus renderStatus; AddPerformanceMarker( PerformanceInterface::RENDER_START ); - mCore.Render( renderStatus, mForceClear, mUploadWithoutRendering ); + + // Upload shared resources + mCore.PreRender( renderStatus, mForceClear, mUploadWithoutRendering ); + + if ( !mUploadWithoutRendering ) + { + // Go through each window + WindowContainer windows; + mAdaptorInterfaces.GetWindowContainerInterface( windows ); + + for( auto&& window : windows ) + { + Dali::Integration::Scene scene = window->GetScene(); + Dali::RenderSurfaceInterface* windowSurface = window->GetSurface(); + + if ( scene && windowSurface ) + { + windowSurface->InitializeGraphics(); + + // Render off-screen frame buffers first if any + mCore.RenderScene( scene, true ); + + // Switch to the EGL context of the surface + windowSurface->PreRender( surfaceResized ); // Switch GL context + + // Render the surface + mCore.RenderScene( scene, false ); + + windowSurface->PostRender( false, false, surfaceResized ); // Swap Buffer + } + } + } + + mCore.PostRender( mUploadWithoutRendering ); ////////////////////////////// // DELETE SURFACE ////////////////////////////// - Integration::RenderSurface* deletedSurface = ShouldSurfaceBeDeleted(); + Dali::RenderSurfaceInterface* deletedSurface = ShouldSurfaceBeDeleted(); if( DALI_UNLIKELY( deletedSurface ) ) { LOG_UPDATE_RENDER_TRACE_FMT( "Deleting Surface" ); - mCore.SurfaceDeleted( deletedSurface ); + deletedSurface->DestroySurface(); SurfaceDeleted(); } @@ -827,11 +863,11 @@ bool CombinedUpdateRenderController::UpdateRenderReady( bool& useElapsedTime, bo return ! mDestroyUpdateRenderThread; } -Integration::RenderSurface* CombinedUpdateRenderController::ShouldSurfaceBeReplaced() +Dali::RenderSurfaceInterface* CombinedUpdateRenderController::ShouldSurfaceBeReplaced() { ConditionalWait::ScopedLock lock( mUpdateRenderThreadWaitCondition ); - Integration::RenderSurface* newSurface = mNewSurface; + Dali::RenderSurfaceInterface* newSurface = mNewSurface; mNewSurface = NULL; return newSurface; @@ -843,11 +879,11 @@ void CombinedUpdateRenderController::SurfaceReplaced() sem_post( &mEventThreadSemaphore ); } -Integration::RenderSurface* CombinedUpdateRenderController::ShouldSurfaceBeDeleted() +Dali::RenderSurfaceInterface* CombinedUpdateRenderController::ShouldSurfaceBeDeleted() { ConditionalWait::ScopedLock lock( mUpdateRenderThreadWaitCondition ); - Integration::RenderSurface* deletedSurface = mDeletedSurface; + Dali::RenderSurfaceInterface* deletedSurface = mDeletedSurface; mDeletedSurface = NULL; return deletedSurface;