X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git;a=blobdiff_plain;f=dali%2Finternal%2Fadaptor%2Fcommon%2Fcombined-update-render-controller.cpp;h=ace0a18ea0082cab1544e31bd7de1701becc9fe7;hp=8e124a82b4601ece559d745b488c3b6f82c24b23;hb=263ec21432f3d7c9f9be5b463748fdce8f6942e4;hpb=43235b18c881038f256cc7ebdbaa13d0930122c6 diff --git a/dali/internal/adaptor/common/combined-update-render-controller.cpp b/dali/internal/adaptor/common/combined-update-render-controller.cpp index 8e124a8..ace0a18 100644 --- a/dali/internal/adaptor/common/combined-update-render-controller.cpp +++ b/dali/internal/adaptor/common/combined-update-render-controller.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,9 @@ #include #include #include +#include +#include +#include namespace Dali { @@ -119,7 +122,7 @@ CombinedUpdateRenderController::CombinedUpdateRenderController( AdaptorInternalS SetRenderRefreshRate( environmentOptions.GetRenderRefreshRate() ); // Set the thread-synchronization interface on the render-surface - RenderSurface* currentSurface = mAdaptorInterfaces.GetRenderSurfaceInterface(); + Dali::RenderSurfaceInterface* currentSurface = mAdaptorInterfaces.GetRenderSurfaceInterface(); if( currentSurface ) { currentSurface->SetThreadSynchronization( *this ); @@ -169,7 +172,7 @@ void CombinedUpdateRenderController::Start() sem_wait( &mEventThreadSemaphore ); } - RenderSurface* currentSurface = mAdaptorInterfaces.GetRenderSurfaceInterface(); + Integration::RenderSurface* currentSurface = mAdaptorInterfaces.GetRenderSurfaceInterface(); if( currentSurface ) { currentSurface->StartRender(); @@ -221,7 +224,7 @@ void CombinedUpdateRenderController::Stop() LOG_EVENT_TRACE; // Stop Rendering and the Update/Render Thread - RenderSurface* currentSurface = mAdaptorInterfaces.GetRenderSurfaceInterface(); + Integration::RenderSurface* currentSurface = mAdaptorInterfaces.GetRenderSurfaceInterface(); if( currentSurface ) { currentSurface->StopRender(); @@ -283,7 +286,7 @@ void CombinedUpdateRenderController::RequestUpdateOnce() } } -void CombinedUpdateRenderController::ReplaceSurface( RenderSurface* newSurface ) +void CombinedUpdateRenderController::ReplaceSurface( Dali::RenderSurfaceInterface* newSurface ) { LOG_EVENT_TRACE; @@ -415,12 +418,38 @@ void CombinedUpdateRenderController::UpdateRenderThread() LOG_UPDATE_RENDER( "THREAD CREATED" ); - RenderSurface* currentSurface = mAdaptorInterfaces.GetRenderSurfaceInterface(); + // Initialize EGL & OpenGL + Dali::DisplayConnection& displayConnection = mAdaptorInterfaces.GetDisplayConnectionInterface(); + displayConnection.Initialize(); + + RenderSurfaceInterface* currentSurface = nullptr; + +#if DALI_GLES_VERSION >= 30 + + GraphicsInterface& graphics = mAdaptorInterfaces.GetGraphicsInterface(); + EglGraphics* eglGraphics = static_cast(&graphics); + + // This will only be created once + EglInterface* eglInterface = &eglGraphics->GetEglInterface(); + + Internal::Adaptor::EglImplementation& eglImpl = static_cast( *eglInterface ); + eglImpl.ChooseConfig( true, COLOR_DEPTH_32 ); // Always use this for shared context??? + + // Create a surfaceless OpenGL context for shared resources + eglImpl.CreateContext(); + eglImpl.MakeContextCurrent( EGL_NO_SURFACE, eglImpl.GetContext() ); + +#else // DALI_GLES_VERSION >= 30 + + currentSurface = mAdaptorInterfaces.GetRenderSurfaceInterface(); if( currentSurface ) { - currentSurface->InitializeGraphics( mAdaptorInterfaces.GetGraphicsInterface(), mAdaptorInterfaces.GetDisplayConnectionInterface() ); + currentSurface->InitializeGraphics(); + currentSurface->MakeContextCurrent(); } +#endif + // Tell core it has a context mCore.ContextCreated(); @@ -466,7 +495,7 @@ void CombinedUpdateRenderController::UpdateRenderThread() // REPLACE SURFACE ////////////////////////////// - RenderSurface* newSurface = ShouldSurfaceBeReplaced(); + Integration::RenderSurface* newSurface = ShouldSurfaceBeReplaced(); if( DALI_UNLIKELY( newSurface ) ) { LOG_UPDATE_RENDER_TRACE_FMT( "Replacing Surface" ); @@ -477,7 +506,7 @@ void CombinedUpdateRenderController::UpdateRenderThread() // If the new surface has a different display connection, then the context will be lost mAdaptorInterfaces.GetDisplayConnectionInterface().Initialize(); - newSurface->InitializeGraphics( mAdaptorInterfaces.GetGraphicsInterface(), mAdaptorInterfaces.GetDisplayConnectionInterface() ); + newSurface->InitializeGraphics(); newSurface->ReplaceGraphicsSurface(); SurfaceReplaced(); } @@ -524,7 +553,6 @@ void CombinedUpdateRenderController::UpdateRenderThread() } // Check resize - bool surfaceResized = false; bool shouldSurfaceBeResized = ShouldSurfaceBeResized(); if( DALI_UNLIKELY( shouldSurfaceBeResized ) ) { @@ -532,7 +560,6 @@ void CombinedUpdateRenderController::UpdateRenderThread() { LOG_UPDATE_RENDER_TRACE_FMT( "Resizing Surface" ); SurfaceResized(); - surfaceResized = true; } } @@ -555,11 +582,10 @@ void CombinedUpdateRenderController::UpdateRenderThread() } } - currentSurface = mAdaptorInterfaces.GetRenderSurfaceInterface(); - if( currentSurface ) - { - currentSurface->PreRender( surfaceResized ); - } +#if DALI_GLES_VERSION >= 30 + // Make the shared surfaceless context as current before rendering + eglImpl.MakeContextCurrent( EGL_NO_SURFACE, eglImpl.GetContext() ); +#endif Integration::RenderStatus renderStatus; @@ -569,14 +595,6 @@ void CombinedUpdateRenderController::UpdateRenderThread() mForceClear = false; - if( renderStatus.NeedsPostRender() ) - { - if( currentSurface ) - { - currentSurface->PostRender( isRenderingToFbo, ( mNewSurface != NULL ), surfaceResized ); - } - } - // Trigger event thread to request Update/Render thread to sleep if update not required if( ( Integration::KeepUpdating::NOT_REQUESTED == keepUpdatingStatus ) && !renderStatus.NeedsUpdate() ) { @@ -699,11 +717,11 @@ bool CombinedUpdateRenderController::UpdateRenderReady( bool& useElapsedTime, bo return ! mDestroyUpdateRenderThread; } -RenderSurface* CombinedUpdateRenderController::ShouldSurfaceBeReplaced() +Integration::RenderSurface* CombinedUpdateRenderController::ShouldSurfaceBeReplaced() { ConditionalWait::ScopedLock lock( mUpdateRenderThreadWaitCondition ); - RenderSurface* newSurface = mNewSurface; + Integration::RenderSurface* newSurface = mNewSurface; mNewSurface = NULL; return newSurface;