Merge "Trace use scope macro instead of begin-end" into devel/master
[platform/core/uifw/dali-adaptor.git] / dali / internal / adaptor / common / thread-controller-interface.h
index 2c8e8eb..7d81c1f 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_INTERNAL_THREAD_CONTROLLER_INTERFACE_H__
-#define __DALI_INTERNAL_THREAD_CONTROLLER_INTERFACE_H__
+#ifndef DALI_INTERNAL_THREAD_CONTROLLER_INTERFACE_H
+#define DALI_INTERNAL_THREAD_CONTROLLER_INTERFACE_H
 
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
  *
  */
 
+// EXTERNAL INCLUDES
+#include <dali/public-api/signals/callback.h>
+#include <stdint.h>
+
 namespace Dali
 {
-
-class RenderSurface;
+class RenderSurfaceInterface;
 
 namespace Internal
 {
-
 namespace Adaptor
 {
+enum class UpdateMode
+{
+  NORMAL,      ///< Update and render
+  SKIP_RENDER, ///< Update and resource upload but no rendering
+  FORCE_RENDER ///< Force update and render
+};
+
+enum class ThreadMode
+{
+  NORMAL,          ///< The thread runs continuously
+  RUN_IF_REQUESTED ///< The threads runs when it is requested
+};
 
 /**
  * Interface Class for all controlling threads.
@@ -35,11 +49,12 @@ namespace Adaptor
 class ThreadControllerInterface
 {
 public:
-
   /**
    * Virtual destructor. Not intended as base class.
    */
-  virtual ~ThreadControllerInterface() { }
+  virtual ~ThreadControllerInterface()
+  {
+  }
 
   /**
    * Initializes the thread controller
@@ -73,15 +88,22 @@ public:
 
   /**
    * Called by the adaptor when core requires one update
-   * If Adaptor is paused, we do one update and return to pause
+   * If Adaptor is paused, we do one update/render and return to pause
+   * @param updateMode The update mode (i.e. i.e. either update & render or skip rendering)
    */
-  virtual void RequestUpdateOnce() = 0;
+  virtual void RequestUpdateOnce(UpdateMode updateMode) = 0;
 
   /**
    * Replaces the surface.
    * @param surface new surface
    */
-  virtual void ReplaceSurface( RenderSurface* surface ) = 0;
+  virtual void ReplaceSurface(Dali::RenderSurfaceInterface* surface) = 0;
+
+  /**
+   * Deletes the surface.
+   * @param[in] surface The surface to be deleted
+   */
+  virtual void DeleteSurface(Dali::RenderSurfaceInterface* surface) = 0;
 
   /**
    * Resize the surface.
@@ -89,24 +111,46 @@ public:
   virtual void ResizeSurface() = 0;
 
   /**
+   * Wait until the graphics is initialised.
+   */
+  virtual void WaitForGraphicsInitialization() = 0;
+
+  /**
    * @copydoc Dali::Adaptor::SetRenderRefreshRate()
    */
-  virtual void SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender ) = 0;
+  virtual void SetRenderRefreshRate(unsigned int numberOfVSyncsPerRender) = 0;
 
-protected:
+  /**
+   * @copydoc Dali::Adaptor::SetPreRenderCallback()
+   */
+  virtual void SetPreRenderCallback(CallbackBase* callback) = 0;
 
   /**
+   * @brief Adds the new surface.
+   * @param surface new surface
+   */
+  virtual void AddSurface(Dali::RenderSurfaceInterface* surface) = 0;
+
+  /**
+   * @brief Gets the thread id.
+   * @return The thread id.
+   */
+  virtual int32_t GetThreadId() const = 0;
+
+protected:
+  /**
    * Constructor
    */
-  ThreadControllerInterface() { }
+  ThreadControllerInterface()
+  {
+  }
 
 private:
-
   // Undefined copy constructor.
-  ThreadControllerInterface( const ThreadControllerInterface& );
+  ThreadControllerInterface(const ThreadControllerInterface&);
 
   // Undefined assignment operator.
-  ThreadControllerInterface& operator=( const ThreadControllerInterface& );
+  ThreadControllerInterface& operator=(const ThreadControllerInterface&);
 };
 
 } // namespace Adaptor
@@ -115,4 +159,4 @@ private:
 
 } // namespace Dali
 
-#endif // __DALI_INTERNAL_THREAD_CONTROLLER_INTERFACE_H__
+#endif // DALI_INTERNAL_THREAD_CONTROLLER_INTERFACE_H