Revert "Remove EGL surface in the update thread"
[platform/core/uifw/dali-adaptor.git] / dali / internal / adaptor / common / combined-update-render-controller.h
index 03e511e..ca22517 100644 (file)
@@ -21,6 +21,7 @@
 // EXTERNAL INCLUDES
 #include <pthread.h>
 #include <semaphore.h>
+#include <atomic>
 #include <stdint.h>
 #include <dali/devel-api/threading/conditional-wait.h>
 #include <dali/integration-api/core.h>
@@ -127,11 +128,6 @@ public:
   virtual void ReplaceSurface( Dali::RenderSurfaceInterface* surface );
 
   /**
-   * @copydoc ThreadControllerInterface::DeleteSurface()
-   */
-  virtual void DeleteSurface( Dali::RenderSurfaceInterface* surface );
-
-  /**
    * @copydoc ThreadControllerInterface::ResizeSurface()
    */
   virtual void ResizeSurface();
@@ -151,6 +147,16 @@ public:
    */
   void SetPreRenderCallback( CallbackBase* callback ) override;
 
+  /**
+   * @copydoc ThreadControllerInterface::AddSurface()
+   */
+  virtual void AddSurface( Dali::RenderSurfaceInterface* surface );
+
+  /**
+   * @copydoc ThreadControllerInterface::IsRenderingWindows()
+   */
+  bool IsRenderingWindows() const override { return mIsRenderingWindows; }
+
 private:
 
   // Undefined copy constructor.
@@ -234,7 +240,7 @@ private:
    *
    * @return Pointer to the new surface, NULL otherwise
    */
-  Integration::RenderSurface* ShouldSurfaceBeReplaced();
+  Dali::RenderSurfaceInterface* ShouldSurfaceBeReplaced();
 
   /**
    * Called by the Update/Render thread after a surface has been replaced.
@@ -244,21 +250,6 @@ private:
   void SurfaceReplaced();
 
   /**
-   * Checks to see if the surface needs to be deleted.
-   * This will lock the mutex in mUpdateRenderThreadWaitCondition.
-   *
-   * @return Pointer to the deleted surface, nullptr otherwise
-   */
-  Integration::RenderSurface* ShouldSurfaceBeDeleted();
-
-  /**
-   * Called by the Update/Render thread after a surface has been deleted.
-   *
-   * This will lock the mutex in mEventThreadWaitCondition
-   */
-  void SurfaceDeleted();
-
-  /**
    * Checks to see if the surface needs to be resized.
    * This will lock the mutex in mUpdateRenderThreadWaitCondition.
    *
@@ -373,8 +364,7 @@ private:
 
   volatile unsigned int             mUseElapsedTimeAfterWait;          ///< Whether we should use the elapsed time after waiting (set by the event-thread, read by the update-render-thread).
 
-  Integration::RenderSurface* volatile mNewSurface;                    ///< Will be set to the new-surface if requested (set by the event-thread, read & cleared by the update-render thread).
-  Integration::RenderSurface* volatile mDeletedSurface;                ///< Will be set to the deleted surface if requested (set by the event-thread, read & cleared by the update-render thread).
+  Dali::RenderSurfaceInterface* volatile mNewSurface;                  ///< Will be set to the new-surface if requested (set by the event-thread, read & cleared by the update-render thread).
 
   volatile unsigned int             mPostRendering;                    ///< Whether post-rendering is taking place (set by the event & render threads, read by the render-thread).
   volatile unsigned int             mSurfaceResized;                   ///< Will be set to resize the surface (set by the event-thread, read & cleared by the update-render thread).
@@ -383,6 +373,8 @@ private:
   volatile unsigned int             mUploadWithoutRendering;           ///< Will be set to upload the resource only (with no rendering)
 
   volatile unsigned int             mFirstFrameAfterResume;            ///< Will be set to check the first frame after resume (for log)
+
+  std::atomic<bool>                 mIsRenderingWindows;               ///< This is set only from the render thread and read only from the event thread
 };
 
 } // namespace Adaptor