Delete EglGraphics and shutdown EGL 44/233744/2 dali_1.5.12
authorHeeyong Song <heeyong.song@samsung.com>
Wed, 13 May 2020 08:05:56 +0000 (17:05 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Tue, 19 May 2020 02:34:41 +0000 (11:34 +0900)
Change-Id: Iaaa267481aad15172f8e9e26fd9cc85384dfbb83

dali/internal/adaptor/common/adaptor-impl.cpp
dali/internal/adaptor/common/adaptor-impl.h
dali/internal/adaptor/common/combined-update-render-controller.cpp
dali/internal/graphics/common/graphics-interface.h

index 132e82e2defafbb33205583f7707c5d59b47028e..1b56e54a031c54f5cf6eea516905dec993dd93cc 100755 (executable)
@@ -159,10 +159,11 @@ void Adaptor::Initialize( GraphicsFactory& graphicsFactory, Dali::Configuration:
 
   DALI_ASSERT_DEBUG( defaultWindow->GetSurface() && "Surface not initialized" );
 
-  mGraphics = &( graphicsFactory.Create() );
+  mGraphics = std::unique_ptr< GraphicsInterface >( &graphicsFactory.Create() );
   mGraphics->Initialize( mEnvironmentOptions );
 
-  auto eglGraphics = static_cast<EglGraphics *>( mGraphics ); // This interface is temporary until Core has been updated to match
+  GraphicsInterface* graphics = mGraphics.get(); // This interface is temporary until Core has been updated to match
+  auto eglGraphics = static_cast<EglGraphics *>( graphics );
 
   // This will only be created once
   eglGraphics->Create();
@@ -710,7 +711,7 @@ Dali::DisplayConnection& Adaptor::GetDisplayConnectionInterface()
 GraphicsInterface& Adaptor::GetGraphicsInterface()
 {
   DALI_ASSERT_DEBUG( mGraphics && "Graphics interface not created" );
-  return *mGraphics;
+  return *( mGraphics.get() );
 }
 
 Dali::Integration::PlatformAbstraction& Adaptor::GetPlatformAbstractionInterface()
@@ -801,7 +802,8 @@ Any Adaptor::GetGraphicsDisplay()
 
   if (mGraphics)
   {
-    auto eglGraphics = static_cast<EglGraphics *>( mGraphics ); // This interface is temporary until Core has been updated to match
+    GraphicsInterface* graphics = mGraphics.get(); // This interface is temporary until Core has been updated to match
+    auto eglGraphics = static_cast<EglGraphics *>( graphics );
 
     EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
     display = eglImpl.GetDisplay();
index d0d237932011dd5dd42200f51c0500c1e4ffadc8..9e4c079ae65c3539367d315bd75ad92ecc87f586 100755 (executable)
@@ -664,7 +664,7 @@ private: // Data
   Dali::Integration::Core*              mCore;                        ///< Dali Core
   ThreadController*                     mThreadController;            ///< Controls the threads
 
-  GraphicsInterface*                    mGraphics;                    ///< Graphics interface
+  std::unique_ptr< GraphicsInterface >  mGraphics;                    ///< Graphics interface
   Dali::DisplayConnection*              mDisplayConnection;           ///< Display connection
   WindowContainer                       mWindows;                     ///< A container of all the Windows that are currently created
 
index 7343b433141ff217740a5454ba05744aecdbb175..5c5840a06a75a64793de2bb9db56a6219c9d9c47 100644 (file)
@@ -794,7 +794,7 @@ void CombinedUpdateRenderController::UpdateRenderThread()
     }
   }
 
-  // Inform core of context destruction & shutdown EGL
+  // Inform core of context destruction
   mCore.ContextDestroyed();
   currentSurface = mAdaptorInterfaces.GetRenderSurfaceInterface();
   if( currentSurface )
@@ -803,6 +803,9 @@ void CombinedUpdateRenderController::UpdateRenderThread()
     currentSurface = nullptr;
   }
 
+  // Shutdown EGL
+  eglInterface->TerminateGles();
+
   LOG_UPDATE_RENDER( "THREAD DESTROYED" );
 
   // Uninstall the logging function
index 5e80ef7fe2e640cc804113324636621ed5d7d506..93c1b2f7a1360d591579d867b23f79493ccb2c0c 100644 (file)
@@ -47,6 +47,11 @@ public:
   {
   };
 
+  /**
+   * Destructor
+   */
+  virtual ~GraphicsInterface() {}
+
   /**
    * Initialize the graphics interface
    * @param[in]  environmentOptions  The environment options.
@@ -76,12 +81,6 @@ public:
     return mStencilBufferRequired;
   };
 
-protected:
-  /**
-   * Virtual protected destructor - no deletion through this interface
-   */
-  virtual ~GraphicsInterface() {};
-
 
 protected: