[Tizen] Revert "[Tizen] Block NativeTexture dependency codes" 10/315910/1 accepted/tizen/9.0/unified/20241207.044223
authorEunki, Hong <eunkiki.hong@samsung.com>
Fri, 6 Dec 2024 04:26:45 +0000 (13:26 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Fri, 6 Dec 2024 04:26:48 +0000 (13:26 +0900)
This reverts commit 13e5a3e8248ac6f0e4562456278210c8f11835d4.

Change-Id: I8fdf158a9986a46b964da3c2ab08484d124d0e01

48 files changed:
automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-command-buffer.h
dali/devel-api/adaptor-framework/accessibility-bridge.h
dali/devel-api/adaptor-framework/accessibility.cpp
dali/devel-api/adaptor-framework/actor-accessible.cpp
dali/devel-api/adaptor-framework/actor-accessible.h
dali/devel-api/adaptor-framework/capture-devel.h
dali/devel-api/adaptor-framework/native-image-source-devel.cpp
dali/devel-api/adaptor-framework/native-image-source-devel.h
dali/devel-api/atspi-interfaces/accessible.h
dali/internal/accessibility/bridge/accessible.cpp
dali/internal/accessibility/bridge/bridge-base.h
dali/internal/accessibility/bridge/bridge-object.cpp
dali/internal/accessibility/bridge/bridge-object.h
dali/internal/accessibility/bridge/dummy/dummy-atspi.cpp
dali/internal/accessibility/bridge/dummy/dummy-atspi.h
dali/internal/graphics/gles-impl/egl-graphics-controller-debug.cpp
dali/internal/graphics/gles-impl/egl-graphics-controller.cpp
dali/internal/graphics/gles-impl/gles-context.cpp
dali/internal/graphics/gles-impl/gles-context.h
dali/internal/graphics/gles-impl/gles-graphics-command-buffer.cpp
dali/internal/graphics/gles-impl/gles-graphics-command-buffer.h
dali/internal/graphics/gles-impl/gles-graphics-shader.cpp
dali/internal/graphics/gles-impl/gles-texture-dependency-checker.cpp
dali/internal/graphics/vulkan-impl/vulkan-command-buffer-impl.cpp
dali/internal/graphics/vulkan-impl/vulkan-command-buffer-impl.h
dali/internal/graphics/vulkan-impl/vulkan-command-buffer.cpp
dali/internal/graphics/vulkan-impl/vulkan-command-buffer.h
dali/internal/graphics/vulkan-impl/vulkan-shader-impl.cpp
dali/internal/imaging/android/native-image-source-impl-android.cpp
dali/internal/imaging/android/native-image-source-impl-android.h
dali/internal/imaging/common/native-image-source-impl.h
dali/internal/imaging/macos/native-image-source-impl-mac.cpp
dali/internal/imaging/macos/native-image-source-impl-mac.h
dali/internal/imaging/tizen/native-image-source-impl-tizen.cpp
dali/internal/imaging/tizen/native-image-source-impl-tizen.h
dali/internal/imaging/ubuntu-x11/native-image-source-impl-x.cpp
dali/internal/imaging/ubuntu-x11/native-image-source-impl-x.h
dali/internal/imaging/windows/native-image-source-impl-win.cpp
dali/internal/imaging/windows/native-image-source-impl-win.h
dali/internal/imaging/x11/native-image-source-impl-x.cpp
dali/internal/imaging/x11/native-image-source-impl-x.h
dali/internal/system/common/capture-impl.cpp
dali/internal/system/common/capture-impl.h
dali/internal/window-system/common/window-impl.cpp
dali/internal/window-system/tizen-wayland/display-connection-impl-ecore-wl.cpp
dali/internal/window-system/tizen-wayland/display-connection-impl-ecore-wl.h
dali/public-api/capture/capture.cpp
dali/public-api/capture/capture.h

index 9df2d0fafca901a7949ac785976274eb2fadffaf..147246f44e8001d97a347ddaeb9abc1e5894104f 100644 (file)
@@ -834,6 +834,10 @@ public:
     mCallStack.PushCall("EndRenderPass", namedParams.str(), namedParams);
   }
 
+  void ReadPixels(uint8_t* buffer) override
+  {
+  }
+
   void ExecuteCommandBuffers(std::vector<const CommandBuffer*>&& commandBuffers) override
   {
     mCommands.emplace_back();
index b7d1615c2803e46e42045805afc4ef1eabf6c44b..cf57cf7aa18f35922b4c933cd956a67639457ca5 100644 (file)
@@ -325,13 +325,6 @@ struct DALI_ADAPTOR_API Bridge
    **/
   virtual void EmitMovedOutOfScreen(Accessible* obj, ScreenRelativeMoveType type) = 0;
 
-  /**
-   * @brief Emits "org.a11y.atspi.Socket.Available" event on AT-SPI bus.
-   *
-   * @param obj Accessible object
-   */
-  virtual void EmitSocketAvailable(Accessible* obj) = 0;
-
   /**
    * @brief Emits ScrollStarted event on at-spi bus.
    *
index 4c6c0a66f697f4e282206c633209c68164a98e26..f56f6184a3db9d53de81df002c2d33931bed1801 100644 (file)
@@ -530,7 +530,14 @@ public:
 
   void OnPostRender()
   {
-    Accessibility::Bridge::GetCurrentBridge()->EmitPostRender(shared_from_this());
+    try
+    {
+      Accessibility::Bridge::GetCurrentBridge()->EmitPostRender(shared_from_this());
+    }
+    catch(const std::bad_weak_ptr& e)
+    {
+      DALI_LOG_ERROR("bad_weak_ptr exception caught: %s", e.what());
+    }
   }
 }; // AdaptorAccessible
 
index b32ea47379b442f9a4f8351296dee75cd7e7b20a..eadf661625cf9cc9857653e254f164a8eef4a0f6 100644 (file)
 
 // EXTERNAL INCLUDES
 #include <dali/devel-api/actors/actor-devel.h>
+#include <dali/integration-api/debug.h>
 
 // INTERNAL INCLUDES
 #include <dali/devel-api/adaptor-framework/window-devel.h>
 
+using namespace Dali::Accessibility;
+
+namespace
+{
+bool UpdateLastEmitted(std::map<State, int>& lastEmitted, State state, int newValue)
+{
+  bool updated                = false;
+  const auto [iter, inserted] = lastEmitted.emplace(state, newValue);
+  if(!inserted && iter->second != newValue)
+  {
+    iter->second = newValue;
+    updated      = true;
+  }
+
+  return inserted || updated;
+}
+
+bool IsModalRole(Role role)
+{
+  return role == Role::POPUP_MENU || role == Role::PANEL || role == Role::DIALOG || role == Role::PAGE_TAB;
+}
+
+bool IsWindowRole(Role role)
+{
+  return role == Role::WINDOW || role == Role::FRAME || role == Role::INPUT_METHOD_WINDOW;
+}
+
+bool ShouldEmitVisible(Accessible* accessible)
+{
+  Role role = accessible->GetRole();
+  return IsWindowRole(role);
+}
+
+bool ShouldEmitShowing(Accessible* accessible, bool showing)
+{
+  Role role = accessible->GetRole();
+  return IsWindowRole(role) || IsModalRole(role) || (showing && role == Role::NOTIFICATION) ||
+         (!showing && accessible->IsHighlighted()) || accessible->GetStates()[State::MODAL];
+}
+
+} // namespace
+
 namespace Dali::Accessibility
 {
 ActorAccessible::ActorAccessible(Actor actor)
@@ -207,11 +250,187 @@ void ActorAccessible::UpdateChildren()
 
   // Erase-remove idiom
   // TODO (C++20): Replace with std::erase_if
-  auto it = std::remove_if(mChildren.begin(), mChildren.end(), [shouldIncludeHidden](const Accessible* child) {
-    return !child || (!shouldIncludeHidden && child->IsHidden());
-  });
+  auto it = std::remove_if(mChildren.begin(), mChildren.end(), [shouldIncludeHidden](const Accessible* child) { return !child || (!shouldIncludeHidden && child->IsHidden()); });
   mChildren.erase(it, mChildren.end());
   mChildren.shrink_to_fit();
 }
 
+void ActorAccessible::EmitActiveDescendantChanged(Accessible* child)
+{
+  if(auto bridgeData = GetBridgeData())
+  {
+    bridgeData->mBridge->EmitActiveDescendantChanged(this, child);
+  }
+}
+
+void ActorAccessible::EmitStateChanged(State state, int newValue, int reserved)
+{
+  if(auto bridgeData = GetBridgeData())
+  {
+    bool shouldEmit{false};
+
+    switch(state)
+    {
+      case State::SHOWING:
+      {
+        shouldEmit = ShouldEmitShowing(this, static_cast<bool>(newValue));
+        break;
+      }
+      case State::VISIBLE:
+      {
+        shouldEmit = ShouldEmitVisible(this);
+        break;
+      }
+      default:
+      {
+        shouldEmit = UpdateLastEmitted(mLastEmittedState, state, newValue);
+        break;
+      }
+    }
+
+    if(shouldEmit)
+    {
+      try
+      {
+        bridgeData->mBridge->EmitStateChanged(shared_from_this(), state, newValue, reserved);
+      }
+      catch(const std::bad_weak_ptr& e)
+      {
+        DALI_LOG_ERROR("bad_weak_ptr exception caught: %s", e.what());
+      }
+    }
+  }
+}
+
+void ActorAccessible::EmitShowing(bool isShowing)
+{
+  EmitStateChanged(State::SHOWING, isShowing ? 1 : 0);
+}
+
+void ActorAccessible::EmitVisible(bool isVisible)
+{
+  EmitStateChanged(State::VISIBLE, isVisible ? 1 : 0);
+}
+
+void ActorAccessible::EmitHighlighted(bool isHighlighted)
+{
+  EmitStateChanged(State::HIGHLIGHTED, isHighlighted ? 1 : 0);
+}
+
+void ActorAccessible::EmitFocused(bool isFocused)
+{
+  EmitStateChanged(State::FOCUSED, isFocused ? 1 : 0);
+}
+
+void ActorAccessible::EmitTextInserted(unsigned int position, unsigned int length, const std::string& content)
+{
+  if(auto bridgeData = GetBridgeData())
+  {
+    bridgeData->mBridge->EmitTextChanged(this, TextChangedState::INSERTED, position, length, content);
+  }
+}
+void ActorAccessible::EmitTextDeleted(unsigned int position, unsigned int length, const std::string& content)
+{
+  if(auto bridgeData = GetBridgeData())
+  {
+    bridgeData->mBridge->EmitTextChanged(this, TextChangedState::DELETED, position, length, content);
+  }
+}
+void ActorAccessible::EmitTextCursorMoved(unsigned int cursorPosition)
+{
+  if(auto bridgeData = GetBridgeData())
+  {
+    bridgeData->mBridge->EmitCursorMoved(this, cursorPosition);
+  }
+}
+
+void ActorAccessible::EmitMovedOutOfScreen(ScreenRelativeMoveType type)
+{
+  if(auto bridgeData = GetBridgeData())
+  {
+    bridgeData->mBridge->EmitMovedOutOfScreen(this, type);
+  }
+}
+
+void ActorAccessible::EmitScrollStarted()
+{
+  if(auto bridgeData = GetBridgeData())
+  {
+    bridgeData->mBridge->EmitScrollStarted(this);
+  }
+}
+
+void ActorAccessible::EmitScrollFinished()
+{
+  if(auto bridgeData = GetBridgeData())
+  {
+    bridgeData->mBridge->EmitScrollFinished(this);
+  }
+}
+
+void ActorAccessible::Emit(WindowEvent event, unsigned int detail)
+{
+  if(auto bridgeData = GetBridgeData())
+  {
+    bridgeData->mBridge->Emit(this, event, detail);
+  }
+}
+void ActorAccessible::Emit(ObjectPropertyChangeEvent event)
+{
+  if(auto bridgeData = GetBridgeData())
+  {
+    try
+    {
+      bridgeData->mBridge->Emit(shared_from_this(), event);
+    }
+    catch(const std::bad_weak_ptr& e)
+    {
+      DALI_LOG_ERROR("bad_weak_ptr exception caught: %s", e.what());
+    }
+  }
+}
+
+void ActorAccessible::EmitBoundsChanged(Rect<> rect)
+{
+  if(auto bridgeData = GetBridgeData())
+  {
+    try
+    {
+      bridgeData->mBridge->EmitBoundsChanged(shared_from_this(), rect);
+    }
+    catch(const std::bad_weak_ptr& e)
+    {
+      DALI_LOG_ERROR("bad_weak_ptr exception caught: %s", e.what());
+    }
+  }
+}
+
+void ActorAccessible::NotifyAccessibilityStateChange(Dali::Accessibility::States states, bool isRecursive)
+{
+  if(Accessibility::IsUp())
+  {
+    const auto newStates = GetStates();
+    for(auto i = 0u; i < static_cast<unsigned int>(Dali::Accessibility::State::MAX_COUNT); i++)
+    {
+      const auto index = static_cast<Dali::Accessibility::State>(i);
+      if(states[index])
+      {
+        EmitStateChanged(index, newStates[index]);
+      }
+    }
+
+    if(isRecursive)
+    {
+      auto children = GetChildren();
+      for(auto child : children)
+      {
+        if(auto accessible = dynamic_cast<ActorAccessible*>(child))
+        {
+          accessible->NotifyAccessibilityStateChange(states, isRecursive);
+        }
+      }
+    }
+  }
+}
+
 } // namespace Dali::Accessibility
index a1a3e529e66d21f76cb0ef7cc48304f5a6031925..a830a1bbc12b7ea2f10694a892f90d1246998818 100644 (file)
@@ -34,7 +34,8 @@ class DALI_ADAPTOR_API ActorAccessible : public virtual Accessible,
                                          public virtual Collection,
                                          public virtual Component,
                                          public Dali::ConnectionTracker,
-                                         public Dali::BaseObjectObserver
+                                         public Dali::BaseObjectObserver,
+                                         public std::enable_shared_from_this<ActorAccessible>
 {
 public:
   ActorAccessible() = delete;
@@ -124,6 +125,132 @@ public:
    */
   void OnChildrenChanged();
 
+  /**
+   * @brief Helper function for emiting active-descendant-changed event.
+   *
+   * @param[in] child The child of the object
+   */
+  void EmitActiveDescendantChanged(Accessible* child);
+
+  /**
+   * @brief Helper function for emiting state-changed event.
+   *
+   * @param[in] state The accessibility state (SHOWING, HIGHLIGHTED, etc)
+   * @param[in] newValue Whether the state value is changed to new value or not.
+   * @param[in] reserved Reserved. (TODO : Currently, this argument is not implemented in dali)
+   *
+   * @note The second argument determines which value is depending on State.
+   * For instance, if the state is PRESSED, newValue means isPressed or isSelected.
+   * If the state is SHOWING, newValue means isShowing.
+   */
+  void EmitStateChanged(State state, int newValue, int reserved = 0);
+
+  /**
+   * @brief Helper function for emiting bounds-changed event.
+   *
+   * @param rect The rectangle for changed bounds
+   */
+  void EmitBoundsChanged(Rect<> rect);
+
+  /**
+   * @brief Emits "showing" event.
+   * The method informs accessibility clients about "showing" state.
+   *
+   * @param[in] isShowing The flag pointing if object is showing
+   */
+  void EmitShowing(bool isShowing);
+
+  /**
+   * @brief Emits "visible" event.
+   * The method informs accessibility clients about "visible" state.
+   *
+   * @param[in] isVisible The flag pointing if object is visible
+   */
+  void EmitVisible(bool isVisible);
+
+  /**
+   * @brief Emits "highlighted" event.
+   * The method informs accessibility clients about "highlighted" state.
+   *
+   * @param[in] isHighlighted The flag pointing if object is highlighted
+   */
+  void EmitHighlighted(bool isHighlighted);
+
+  /**
+   * @brief Emits "focused" event.
+   * The method informs accessibility clients about "focused" state.
+   *
+   * @param[in] isFocused The flag pointing if object is focused
+   */
+  void EmitFocused(bool isFocused);
+
+  /**
+   * @brief Emits "text inserted" event.
+   *
+   * @param[in] position The cursor position
+   * @param[in] length The text length
+   * @param[in] content The inserted text
+   */
+  void EmitTextInserted(unsigned int position, unsigned int length, const std::string& content);
+
+  /**
+   * @brief Emits "text deleted" event.
+   *
+   * @param[in] position The cursor position
+   * @param[in] length The text length
+   * @param[in] content The deleted text
+   */
+  void EmitTextDeleted(unsigned int position, unsigned int length, const std::string& content);
+
+  /**
+   * @brief Emits "cursor moved" event.
+   *
+   * @param[in] cursorPosition The new cursor position
+   */
+  void EmitTextCursorMoved(unsigned int cursorPosition);
+
+  /**
+   * @brief Emits "MoveOuted" event.
+   *
+   * @param[in] type moved out of screen type
+   */
+  void EmitMovedOutOfScreen(ScreenRelativeMoveType type);
+
+  /**
+   * @brief Emits "ScrollStarted" event.
+   *
+   */
+  void EmitScrollStarted();
+
+  /**
+   * @brief Emits "ScrollFinished" event.
+   *
+   */
+  void EmitScrollFinished();
+
+  /**
+   * @brief Emits "highlighted" event.
+   *
+   * @param[in] event The enumerated window event
+   * @param[in] detail The additional parameter which interpretation depends on chosen event
+   */
+  void Emit(WindowEvent event, unsigned int detail = 0);
+
+  /**
+   * @brief Emits property-changed event.
+   *
+   * @param[in] event Property changed event
+   **/
+  void Emit(ObjectPropertyChangeEvent event);
+
+  /**
+   * @brief Re-emits selected states of an Accessibility Object.
+   *
+   * @param[in] states The chosen states to re-emit
+   * @param[in] isRecursive If true, all children of the Accessibility object will also re-emit the states
+   */
+  void NotifyAccessibilityStateChange(Dali::Accessibility::States states, bool isRecursive);
+
 protected:
   Dali::Actor Self() const
   {
@@ -167,6 +294,7 @@ private:
   std::vector<Accessible*>      mChildren;
   bool                          mChildrenDirty;
   const uint32_t                mActorId;
+  std::map<State, int>          mLastEmittedState;
 };
 
 } // namespace Dali::Accessibility
index d69f4fb23cbafe77e418f300adad16e200e678e8..e8b8f7db6ddf738dbb315f2ba09f926b31ba32dd 100644 (file)
@@ -32,6 +32,7 @@ namespace DevelCapture
  * @brief Get PixelBuffer of captured image.
  *
  * @return PixelBuffer Captured result
+ * @note GetCapturedBuffer is only available inside FinishedSignal, otherwise this returns empty handle.
  */
 DALI_ADAPTOR_API Dali::Devel::PixelBuffer GetCapturedBuffer(Dali::Capture capture);
 
index 96d16964fad9740b917daadc3a4bd28f0b7a31f7..29a8fde746a86b7a1d62272aaca23fdffbc073ce 100644 (file)
@@ -40,6 +40,11 @@ bool ReleaseBuffer(NativeImageSource& image, const Rect<uint32_t>& updatedArea)
   return Dali::Internal::Adaptor::NativeImageSource::GetImplementation(image).ReleaseBuffer(updatedArea);\r
 }\r
 \r
+bool SetPixels(NativeImageSource& image, uint8_t* pixbuf, const Pixel::Format& pixelFormat)\r
+{\r
+  return Dali::Internal::Adaptor::NativeImageSource::GetImplementation(image).SetPixels(pixbuf, pixelFormat);\r
+}\r
+\r
 void SetResourceDestructionCallback(NativeImageSource& image, EventThreadCallback* callback)\r
 {\r
   return Dali::Internal::Adaptor::NativeImageSource::GetImplementation(image).SetResourceDestructionCallback(callback);\r
index 1263696e78055dd08330abb320360a66b662836e..06850014d516171ad1bad8e913b08abfc21f7d3f 100644 (file)
@@ -68,6 +68,18 @@ DALI_ADAPTOR_API uint8_t* AcquireBuffer(NativeImageSource& image, uint32_t& widt
  */\r
 DALI_ADAPTOR_API bool ReleaseBuffer(NativeImageSource& image, const Rect<uint32_t>& updatedArea);\r
 \r
+/**\r
+ * @brief Sets PixelBuffers to NativeImageSource\r
+ *\r
+ * @param[in] image The instance of NativeImageSource.\r
+ * @param[in] pixbuf Pixel buffer to copy.\r
+ * @param[in] pixelFormat Pixel format of the pixel buffer\r
+ * @return @c true If the buffer is successfully set.\r
+ * @note The width and height of the input pixel buffer should be same with those of NativeImageSource.\r
+ * @note Only Pixel::Format::RGB888 and Pixel::Format::RGBA8888 are available as a input pixel format.\r
+ */\r
+DALI_ADAPTOR_API bool SetPixels(NativeImageSource& image, uint8_t* pixbuf, const Pixel::Format& pixelFormat);\r
+\r
 /**\r
  * @brief Set the Resource Destruction Callback object\r
  *\r
index 3ff4dcdb4cf66b491d9dea86a1630a2e16c97f68..e14ffb67adc0d871c33c4edd9e2d8ea0791f860a 100644 (file)
@@ -35,137 +35,11 @@ namespace Dali::Accessibility
 /**
  * @brief Basic interface implemented by all accessibility objects.
  */
-class DALI_ADAPTOR_API Accessible : public std::enable_shared_from_this<Accessible>
+class DALI_ADAPTOR_API Accessible
 {
 public:
   virtual ~Accessible() noexcept;
 
-  /**
-   * @brief Helper function for emiting active-descendant-changed event.
-   *
-   * @param[in] child The child of the object
-   */
-  void EmitActiveDescendantChanged(Accessible* child);
-
-  /**
-   * @brief Helper function for emiting state-changed event.
-   *
-   * @param[in] state The accessibility state (SHOWING, HIGHLIGHTED, etc)
-   * @param[in] newValue Whether the state value is changed to new value or not.
-   * @param[in] reserved Reserved. (TODO : Currently, this argument is not implemented in dali)
-   *
-   * @note The second argument determines which value is depending on State.
-   * For instance, if the state is PRESSED, newValue means isPressed or isSelected.
-   * If the state is SHOWING, newValue means isShowing.
-   */
-  void EmitStateChanged(State state, int newValue, int reserved = 0);
-
-  /**
-   * @brief Helper function for emiting bounds-changed event.
-   *
-   * @param rect The rectangle for changed bounds
-   */
-  void EmitBoundsChanged(Rect<> rect);
-
-  /**
-   * @brief Emits "showing" event.
-   * The method informs accessibility clients about "showing" state.
-   *
-   * @param[in] isShowing The flag pointing if object is showing
-   */
-  void EmitShowing(bool isShowing);
-
-  /**
-   * @brief Emits "visible" event.
-   * The method informs accessibility clients about "visible" state.
-   *
-   * @param[in] isVisible The flag pointing if object is visible
-   */
-  void EmitVisible(bool isVisible);
-
-  /**
-   * @brief Emits "highlighted" event.
-   * The method informs accessibility clients about "highlighted" state.
-   *
-   * @param[in] isHighlighted The flag pointing if object is highlighted
-   */
-  void EmitHighlighted(bool isHighlighted);
-
-  /**
-   * @brief Emits "focused" event.
-   * The method informs accessibility clients about "focused" state.
-   *
-   * @param[in] isFocused The flag pointing if object is focused
-   */
-  void EmitFocused(bool isFocused);
-
-  /**
-   * @brief Emits "text inserted" event.
-   *
-   * @param[in] position The cursor position
-   * @param[in] length The text length
-   * @param[in] content The inserted text
-   */
-  void EmitTextInserted(unsigned int position, unsigned int length, const std::string& content);
-
-  /**
-   * @brief Emits "text deleted" event.
-   *
-   * @param[in] position The cursor position
-   * @param[in] length The text length
-   * @param[in] content The deleted text
-   */
-  void EmitTextDeleted(unsigned int position, unsigned int length, const std::string& content);
-
-  /**
-   * @brief Emits "cursor moved" event.
-   *
-   * @param[in] cursorPosition The new cursor position
-   */
-  void EmitTextCursorMoved(unsigned int cursorPosition);
-
-  /**
-   * @brief Emits "MoveOuted" event.
-   *
-   * @param[in] type moved out of screen type
-   */
-  void EmitMovedOutOfScreen(ScreenRelativeMoveType type);
-
-  /**
-   * @brief Emits "org.a11y.atspi.Socket.Available" signal.
-   */
-  // This belongs to Dali::Accessibility::Socket. However, all Emit*() helpers
-  // are here in Accessible, regardless of what interface they belong to (perhaps
-  // to spare a dynamic_cast if used like this: Accessible::Get()->Emit*(...)).
-  void EmitSocketAvailable();
-
-  /**
-   * @brief Emits "ScrollStarted" event.
-   *
-   */
-  void EmitScrollStarted();
-
-  /**
-   * @brief Emits "ScrollFinished" event.
-   *
-   */
-  void EmitScrollFinished();
-
-  /**
-   * @brief Emits "highlighted" event.
-   *
-   * @param[in] event The enumerated window event
-   * @param[in] detail The additional parameter which interpretation depends on chosen event
-   */
-  void Emit(WindowEvent event, unsigned int detail = 0);
-
-  /**
-   * @brief Emits property-changed event.
-   *
-   * @param[in] event Property changed event
-   **/
-  void Emit(ObjectPropertyChangeEvent event);
-
   /**
    * @brief Gets accessibility name.
    *
@@ -317,14 +191,6 @@ public:
    */
   virtual bool DoGesture(const GestureInfo& gestureInfo) = 0;
 
-  /**
-   * @brief Re-emits selected states of an Accessibility Object.
-   *
-   * @param[in] states The chosen states to re-emit
-   * @param[in] isRecursive If true, all children of the Accessibility object will also re-emit the states
-   */
-  void NotifyAccessibilityStateChange(Dali::Accessibility::States states, bool isRecursive);
-
   /**
    * @brief Gets information about current object and all relations that connects
    * it with other accessibility objects.
@@ -515,7 +381,6 @@ private:
   mutable AtspiInterfaces             mInterfaces;
   AtspiEvents                         mSuppressedEvents;
   bool                                mIsOnRootLevel = false;
-  std::map<State, int>                mLastEmittedState;
 
 }; // Accessible class
 
index 49dd6ee8ec198a1afd6530d6b89180e20efc077b..6661e4f0bb45b82a7eb0dade66736456a913fd18 100644 (file)
 
 using namespace Dali::Accessibility;
 
-namespace
-{
-bool UpdateLastEmitted(std::map<State, int>& lastEmitted, State state, int newValue)
-{
-  bool updated                = false;
-  const auto [iter, inserted] = lastEmitted.emplace(state, newValue);
-  if(!inserted && iter->second != newValue)
-  {
-    iter->second = newValue;
-    updated      = true;
-  }
-
-  return inserted || updated;
-}
-
-bool IsModalRole(Role role)
-{
-  return role == Role::POPUP_MENU || role == Role::PANEL || role == Role::DIALOG || role == Role::PAGE_TAB;
-}
-
-bool IsWindowRole(Role role)
-{
-  return role == Role::WINDOW || role == Role::FRAME || role == Role::INPUT_METHOD_WINDOW;
-}
-
-bool ShouldEmitVisible(Accessible* accessible)
-{
-  Role role = accessible->GetRole();
-  return IsWindowRole(role);
-}
-
-bool ShouldEmitShowing(Accessible* accessible, bool showing)
-{
-  Role role = accessible->GetRole();
-  return IsWindowRole(role) || IsModalRole(role) || (showing && role == Role::NOTIFICATION) ||
-         (!showing && accessible->IsHighlighted()) || accessible->GetStates()[State::MODAL];
-}
-
-} // namespace
-
 Accessible::Accessible()
 {
 }
@@ -78,145 +38,6 @@ Accessible::~Accessible() noexcept
   }
 }
 
-void Accessible::EmitActiveDescendantChanged(Accessible* child)
-{
-  if(auto bridgeData = GetBridgeData())
-  {
-    bridgeData->mBridge->EmitActiveDescendantChanged(this, child);
-  }
-}
-
-void Accessible::EmitStateChanged(State state, int newValue, int reserved)
-{
-  if(auto bridgeData = GetBridgeData())
-  {
-    bool shouldEmit{false};
-
-    switch(state)
-    {
-      case State::SHOWING:
-      {
-        shouldEmit = ShouldEmitShowing(this, static_cast<bool>(newValue));
-        break;
-      }
-      case State::VISIBLE:
-      {
-        shouldEmit = ShouldEmitVisible(this);
-        break;
-      }
-      default:
-      {
-        shouldEmit = UpdateLastEmitted(mLastEmittedState, state, newValue);
-        break;
-      }
-    }
-
-    if(shouldEmit)
-    {
-      bridgeData->mBridge->EmitStateChanged(shared_from_this(), state, newValue, reserved);
-    }
-  }
-}
-
-void Accessible::EmitShowing(bool isShowing)
-{
-  EmitStateChanged(State::SHOWING, isShowing ? 1 : 0);
-}
-
-void Accessible::EmitVisible(bool isVisible)
-{
-  EmitStateChanged(State::VISIBLE, isVisible ? 1 : 0);
-}
-
-void Accessible::EmitHighlighted(bool isHighlighted)
-{
-  EmitStateChanged(State::HIGHLIGHTED, isHighlighted ? 1 : 0);
-}
-
-void Accessible::EmitFocused(bool isFocused)
-{
-  EmitStateChanged(State::FOCUSED, isFocused ? 1 : 0);
-}
-
-void Accessible::EmitTextInserted(unsigned int position, unsigned int length, const std::string& content)
-{
-  if(auto bridgeData = GetBridgeData())
-  {
-    bridgeData->mBridge->EmitTextChanged(this, TextChangedState::INSERTED, position, length, content);
-  }
-}
-void Accessible::EmitTextDeleted(unsigned int position, unsigned int length, const std::string& content)
-{
-  if(auto bridgeData = GetBridgeData())
-  {
-    bridgeData->mBridge->EmitTextChanged(this, TextChangedState::DELETED, position, length, content);
-  }
-}
-void Accessible::EmitTextCursorMoved(unsigned int cursorPosition)
-{
-  if(auto bridgeData = GetBridgeData())
-  {
-    bridgeData->mBridge->EmitCursorMoved(this, cursorPosition);
-  }
-}
-
-void Accessible::EmitMovedOutOfScreen(ScreenRelativeMoveType type)
-{
-  if(auto bridgeData = GetBridgeData())
-  {
-    bridgeData->mBridge->EmitMovedOutOfScreen(this, type);
-  }
-}
-
-void Accessible::EmitSocketAvailable()
-{
-  DALI_ASSERT_DEBUG(Socket::DownCast(this));
-
-  if(auto bridgeData = GetBridgeData())
-  {
-    bridgeData->mBridge->EmitSocketAvailable(this);
-  }
-}
-
-void Accessible::EmitScrollStarted()
-{
-  if(auto bridgeData = GetBridgeData())
-  {
-    bridgeData->mBridge->EmitScrollStarted(this);
-  }
-}
-
-void Accessible::EmitScrollFinished()
-{
-  if(auto bridgeData = GetBridgeData())
-  {
-    bridgeData->mBridge->EmitScrollFinished(this);
-  }
-}
-
-void Accessible::Emit(WindowEvent event, unsigned int detail)
-{
-  if(auto bridgeData = GetBridgeData())
-  {
-    bridgeData->mBridge->Emit(this, event, detail);
-  }
-}
-void Accessible::Emit(ObjectPropertyChangeEvent event)
-{
-  if(auto bridgeData = GetBridgeData())
-  {
-    bridgeData->mBridge->Emit(shared_from_this(), event);
-  }
-}
-
-void Accessible::EmitBoundsChanged(Rect<> rect)
-{
-  if(auto bridgeData = GetBridgeData())
-  {
-    bridgeData->mBridge->EmitBoundsChanged(shared_from_this(), rect);
-  }
-}
-
 std::shared_ptr<Bridge::Data> Accessible::GetBridgeData() const
 {
   auto handle = mBridgeData.lock();
@@ -268,28 +89,3 @@ bool Accessible::IsProxy() const
 {
   return false;
 }
-
-void Accessible::NotifyAccessibilityStateChange(Dali::Accessibility::States states, bool isRecursive)
-{
-  if(Accessibility::IsUp())
-  {
-    const auto newStates = GetStates();
-    for(auto i = 0u; i < static_cast<unsigned int>(Dali::Accessibility::State::MAX_COUNT); i++)
-    {
-      const auto index = static_cast<Dali::Accessibility::State>(i);
-      if(states[index])
-      {
-        EmitStateChanged(index, newStates[index]);
-      }
-    }
-
-    if(isRecursive)
-    {
-      auto children = GetChildren();
-      for(auto iter : children)
-      {
-        iter->NotifyAccessibilityStateChange(states, isRecursive);
-      }
-    }
-  }
-}
index ec6c20d66137cc0556487bb957cfe39e42f2353e..174c0fb3b42cb9684a27ecc544f2f84b05336b86 100644 (file)
@@ -27,6 +27,7 @@
 #include <tuple>
 
 // INTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/actor-accessible.h>
 #include <dali/devel-api/adaptor-framework/proxy-accessible.h>
 #include <dali/devel-api/adaptor-framework/window-devel.h>
 #include <dali/devel-api/atspi-interfaces/accessible.h>
@@ -134,7 +135,7 @@ public:
    * @return Null if mChildren is empty, otherwise the Accessible object
    * @note Currently, the default window would be returned when mChildren is not empty.
    */
-  Dali::Accessibility::Accessible* GetWindowAccessible(Dali::Window window)
+  Dali::Accessibility::ActorAccessible* GetWindowAccessible(Dali::Window window)
   {
     if(mChildren.empty())
     {
@@ -148,12 +149,12 @@ public:
     {
       if(rootLayer == mChildren[i]->GetInternalActor())
       {
-        return mChildren[i];
+        return dynamic_cast<Dali::Accessibility::ActorAccessible*>(mChildren[i]);
       }
     }
 
     // If can't find its children, return the default window.
-    return mChildren[0];
+    return dynamic_cast<Dali::Accessibility::ActorAccessible*>(mChildren[0]);
   }
 
   bool DoGesture(const Dali::Accessibility::GestureInfo& gestureInfo) override
index 42ea5c9cf3a61ea91f2e7ba33f83ff16ce8a0279..86814cc8955355935ca628d331070392ee3d4910 100644 (file)
@@ -330,21 +330,6 @@ void BridgeObject::EmitMovedOutOfScreen(Accessible* obj, ScreenRelativeMoveType
     {"", "root"});
 }
 
-void BridgeObject::EmitSocketAvailable(Accessible* obj)
-{
-  if(!IsUp() || obj->IsHidden()) //TODO Suppress SocketAvailable event
-  {
-    return;
-  }
-
-  mDbusServer.emit2<Address, Address>(
-    GetAccessiblePath(obj),
-    Accessible::GetInterfaceName(AtspiInterface::SOCKET),
-    "Available",
-    obj->GetAddress(),
-    {"", "root"});
-}
-
 void BridgeObject::EmitScrollStarted(Accessible* obj)
 {
   if(!IsUp() || obj->IsHidden() || obj->GetSuppressedEvents()[AtspiEvent::SCROLL_STARTED])
index e7130c38db6e6065c068393e54a9074bd72936d2..77925274a37cfe4975278622698faba7e9037fc9 100644 (file)
@@ -90,11 +90,6 @@ protected:
    */
   void EmitMovedOutOfScreen(Dali::Accessibility::Accessible* obj, Dali::Accessibility::ScreenRelativeMoveType type) override;
 
-  /**
-   * @copydoc Dali::Accessibility::Bridge::EmitSocketAvailable()
-   */
-  void EmitSocketAvailable(Dali::Accessibility::Accessible* obj) override;
-
   /**
    * @copydoc Dali::Accessibility::Bridge::EmitScrollStarted()
    */
index 764a442e614f5a60e1a00f26362f2890b85de2e4..51c9ff3ae43793dd52b6f3a65962a9e7040b3ce6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -93,68 +93,4 @@ std::string MakeBusNameForWidget(std::string_view widgetInstanceId, int widgetPr
   return std::string{widgetInstanceId};
 }
 
-void Accessibility::Accessible::EmitStateChanged(Accessibility::State state, int newValue, int reserved)
-{
-}
-
-void Accessibility::Accessible::Emit(Accessibility::ObjectPropertyChangeEvent event)
-{
-}
-
-void Accessibility::Accessible::EmitHighlighted(bool set)
-{
-}
-
-void Accessibility::Accessible::EmitBoundsChanged(Rect<> rect)
-{
-}
-
-void Accessibility::Accessible::EmitShowing(bool showing)
-{
-}
-
-void Accessibility::Accessible::EmitFocused(bool set)
-{
-}
-
-void Accessibility::Accessible::EmitVisible(bool visible)
-{
-}
-
-void Accessibility::Accessible::EmitTextInserted(unsigned int position, unsigned int length, const std::string& content)
-{
-}
-
-void Accessibility::Accessible::EmitTextDeleted(unsigned int position, unsigned int length, const std::string& content)
-{
-}
-
-void Accessibility::Accessible::EmitTextCursorMoved(unsigned int cursorPosition)
-{
-}
-
-void Accessibility::Accessible::EmitActiveDescendantChanged(Accessibility::Accessible* child)
-{
-}
-
-void Accessibility::Accessible::EmitMovedOutOfScreen(Accessibility::ScreenRelativeMoveType type)
-{
-}
-
-void Accessibility::Accessible::EmitSocketAvailable()
-{
-}
-
-void Accessibility::Accessible::EmitScrollStarted()
-{
-}
-
-void Accessibility::Accessible::EmitScrollFinished()
-{
-}
-
-void Accessibility::Accessible::NotifyAccessibilityStateChange(Accessibility::States states, bool isRecursive)
-{
-}
-
 } // namespace Dali
index 7e1dde95d95b59afde232c2a9ae6acea99ea949c..8b8e2c7c720f0d3a3cf0183b7f81e95e422bd89a 100644 (file)
@@ -150,10 +150,6 @@ struct DummyBridge : Dali::Accessibility::Bridge
   {
   }
 
-  void EmitSocketAvailable(Accessibility::Accessible* obj) override
-  {
-  }
-
   void EmitScrollStarted(Accessibility::Accessible* obj) override
   {
   }
index e02e188160838f30caf747ab5fb0c7afde820309..574f2a91306295b114545283e6a752d812fa08d6 100644 (file)
@@ -273,6 +273,11 @@ void DumpCommandBuffer(FILE* output, const GLES::CommandBuffer* commandBuffer)
         fprintf(output, "{\"Cmd\":\"END_RENDER_PASS\"}\n");
         break;
       }
+      case GLES::CommandType::READ_PIXELS:
+      {
+        fprintf(output, "{\"Cmd\":\"READ_PIXELS\"}\n");
+        break;
+      }
       case GLES::CommandType::PRESENT_RENDER_TARGET:
       {
         fprintf(output, "{\"Cmd\":\"PRESENT_RENDER_TARGET\"}\n");
index 0c42e7eb4eb95dea252faaa1ac449f5fa6b703e4..6faf8b1e024dafe0d41264368b359725e3bbb9c8 100644 (file)
@@ -736,6 +736,11 @@ void EglGraphicsController::ProcessCommandBuffer(const GLES::CommandBuffer& comm
         }
         break;
       }
+      case GLES::CommandType::READ_PIXELS:
+      {
+        mCurrentContext->ReadPixels(cmd.readPixelsBuffer.buffer);
+        break;
+      }
       case GLES::CommandType::PRESENT_RENDER_TARGET:
       {
         ResolvePresentRenderTarget(cmd.presentRenderTarget.targetToPresent);
index 1cf5c90a4d1221b363390bc91ed617a6517cea92..c6c821f998f04ef9bdfc2f818b1a43bb4507829a 100644 (file)
@@ -930,6 +930,21 @@ void Context::EndRenderPass(GLES::TextureDependencyChecker& dependencyChecker)
   }
 }
 
+void Context::ReadPixels(uint8_t* buffer)
+{
+  if(mImpl->mCurrentRenderTarget)
+  {
+    GLES::Framebuffer* framebuffer = mImpl->mCurrentRenderTarget->GetFramebuffer();
+    auto*              gl          = mImpl->GetGL();
+    if(framebuffer && gl)
+    {
+      gl->Finish(); // To guarantee ReadPixels.
+      gl->ReadPixels(0, 0, framebuffer->GetCreateInfo().size.width, framebuffer->GetCreateInfo().size.height, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
+    }
+  }
+}
+
+
 void Context::ClearState()
 {
   mImpl->mCurrentTextureBindings.clear();
index d6273609f4776cd4901adf2572146b5caeea63f5..d9c2047c87ac0578a3fe40aa7346d39a33ee1f4f 100644 (file)
@@ -148,6 +148,12 @@ public:
    */
   void EndRenderPass(TextureDependencyChecker& checker);
 
+  /**
+   * @brief Request to read pixels
+   * @param[out] buffer to load pixel data.
+   */
+  void ReadPixels(uint8_t* buffer);
+
   /**
    * @brief Returns the cache of GL state in the context
    * @return the reference of GL state cache (which can be modified)
index 888c1892d2ebd121f6f27a681945706f29d772d6..41b01799fc9a2aa4603253b5c7c5e64f79ff3fd5 100644 (file)
@@ -407,6 +407,12 @@ void CommandBuffer::EndRenderPass(Graphics::SyncObject* syncObject)
   command->endRenderPass.syncObject = static_cast<GLES::SyncObject*>(syncObject);
 }
 
+void CommandBuffer::ReadPixels(uint8_t* buffer)
+{
+  auto command = mCommandPool->AllocateCommand(CommandType::READ_PIXELS);
+  command->readPixelsBuffer.buffer = buffer;
+}
+
 void CommandBuffer::ExecuteCommandBuffers(std::vector<const Graphics::CommandBuffer*>&& commandBuffers)
 {
   auto  command    = mCommandPool->AllocateCommand(CommandType::EXECUTE_COMMAND_BUFFERS);
index ebe198d3041d22619782fc4d312b608a08953e26..0f7e81bc46abf94c16b3cb81bfca53dffc611572 100644 (file)
@@ -54,6 +54,7 @@ enum class CommandType
   SET_VIEWPORT,
   BEGIN_RENDERPASS,
   END_RENDERPASS,
+  READ_PIXELS,
   EXECUTE_COMMAND_BUFFERS,
   PRESENT_RENDER_TARGET,
   SET_COLOR_MASK,
@@ -169,6 +170,11 @@ struct Command
       Graphics::SyncObject* syncObject;
     } endRenderPass;
 
+    struct
+    {
+      uint8_t* buffer;
+    } readPixelsBuffer;
+
     struct
     {
       IndirectPtr<const GLES::CommandBuffer*> buffers;
@@ -294,6 +300,11 @@ public:
    */
   void EndRenderPass(Graphics::SyncObject* syncObject) override;
 
+  /**
+   * @copydoc Dali::Graphics::CommandBuffer::ReadPixels
+   */
+  void ReadPixels(uint8_t* buffer) override;
+
   /**
    * @copydoc Dali::Graphics::CommandBuffer::ExecuteCommandBuffers
    */
index 3a2d06576cde6e05b70cda691abc949cc1090190..7dbd23a48e06871367e8191601622c3214375fe0 100644 (file)
@@ -106,7 +106,10 @@ struct ShaderImpl::Impl
       {
         auto       shader = gl->CreateShader(pipelineStage);
         const auto src    = !sourcePreprocessed.empty() ? reinterpret_cast<const char*>(sourcePreprocessed.data()) : reinterpret_cast<const char*>(createInfo.sourceData);
-        GLint      size   = !sourcePreprocessed.empty() ? GLint(sourcePreprocessed.size()) : createInfo.sourceSize;
+
+        // null-terminated char already included. So we should remove last character (null terminator) from size.
+        GLint size = (!sourcePreprocessed.empty() ? GLint(sourcePreprocessed.size()) : createInfo.sourceSize) - 1u;
+
         gl->ShaderSource(shader, 1, const_cast<const char**>(&src), &size);
         gl->CompileShader(shader);
 
@@ -148,12 +151,20 @@ struct ShaderImpl::Impl
       return;
     }
 
-    sourcePreprocessed.resize(size + 1 /* Include null-terminated char */);
-    sourcePreprocessed[size] = '\0';
+    const uint8_t* dataPtr = reinterpret_cast<const uint8_t*>(data);
+
+    if(*(dataPtr + size - 1) != '\0')
+    {
+      sourcePreprocessed.resize(size + 1 /* Include null-terminated char */);
+      sourcePreprocessed[size] = '\0';
+    }
+    else
+    {
+      // null-terminated char already included.
+      sourcePreprocessed.resize(size);
+    }
 
-    std::copy(reinterpret_cast<const uint8_t*>(data),
-              reinterpret_cast<const uint8_t*>(data) + size,
-              sourcePreprocessed.data());
+    std::copy(dataPtr, dataPtr + size, sourcePreprocessed.data());
   }
 
   EglGraphicsController& controller;
index e34d7825dd9de78f6f862c126e62c541b98cd10b..dd8df4997ad3df97abc967848ca67b3603a5876c 100644 (file)
@@ -41,15 +41,17 @@ TextureDependencyChecker::~TextureDependencyChecker()
     }
     mFramebufferTextureDependencies.clear();
 
-    // VD TRUNK-2025 block these codes
-    // for(uint32_t nativeIndex = 0u; nativeIndex < 2u; ++nativeIndex)
-    // {
-    //   for(auto& nativeTextureDependency : mNativeTextureDependencies[nativeIndex])
-    //   {
-    //     mController.GetSyncPool().FreeSyncObject(nativeTextureDependency.agingSyncObject);
-    //   }
-    //   mNativeTextureDependencies[nativeIndex].clear();
-    // }
+    for(uint32_t nativeIndex = 0u; nativeIndex < 2u; ++nativeIndex)
+    {
+      for(auto& nativeTextureDependency : mNativeTextureDependencies[nativeIndex])
+      {
+        if(nativeTextureDependency.agingSyncObject != nullptr)
+        {
+          mController.GetSyncPool().FreeSyncObject(nativeTextureDependency.agingSyncObject);
+        }
+      }
+      mNativeTextureDependencies[nativeIndex].clear();
+    }
   }
 }
 void TextureDependencyChecker::Reset()
@@ -67,21 +69,22 @@ void TextureDependencyChecker::Reset()
   }
   mFramebufferTextureDependencies.clear();
 
-  // VD TRUNK-2025 block these codes
-
-  // if(mNativeTextureDependencies[0].size() > 0 || mNativeTextureDependencies[1].size())
-  // {
-  //   DALI_ASSERT_ALWAYS(mIsFirstPreparedNativeTextureDependency && "CreateNativeTextureSync should be called before PostRender!");
+  if(mNativeTextureDependencies[0].size() > 0 || mNativeTextureDependencies[1].size())
+  {
+    DALI_ASSERT_ALWAYS(mIsFirstPreparedNativeTextureDependency && "CreateNativeTextureSync should be called before PostRender!");
 
-  //   // Remove all infomations about previous native textures
-  //   for(auto& nativeTextureDependency : mNativeTextureDependencies[mPreviousNativeTextureDependencyIndex])
-  //   {
-  //     mController.GetSyncPool().FreeSyncObject(nativeTextureDependency.agingSyncObject);
-  //   }
-  //   mNativeTextureDependencies[mPreviousNativeTextureDependencyIndex].clear();
+    // Remove all infomations about previous native textures
+    for(auto& nativeTextureDependency : mNativeTextureDependencies[mPreviousNativeTextureDependencyIndex])
+    {
+      if(nativeTextureDependency.agingSyncObject != nullptr)
+      {
+        mController.GetSyncPool().FreeSyncObject(nativeTextureDependency.agingSyncObject);
+      }
+    }
+    mNativeTextureDependencies[mPreviousNativeTextureDependencyIndex].clear();
 
-  //   mCurrentNativeTextureDependencyIndex = __sync_fetch_and_xor(&mPreviousNativeTextureDependencyIndex, 1);
-  // }
+    mCurrentNativeTextureDependencyIndex = __sync_fetch_and_xor(&mPreviousNativeTextureDependencyIndex, 1);
+  }
 }
 
 void TextureDependencyChecker::AddTextures(const GLES::Context* writeContext, const GLES::Framebuffer* framebuffer)
@@ -152,118 +155,120 @@ void TextureDependencyChecker::CheckNeedsSync(const GLES::Context* readContext,
     }
   }
 
-  // VD TRUNK-2025 block these codes
+  // Native dependency check
+  if(texture->IsNativeTexture())
+  {
+    // TODO : Optimize here. For now, we don't have too much EndPass call. So just keep this logic.
+    for(auto& nativeTextureDependency : mNativeTextureDependencies[mPreviousNativeTextureDependencyIndex])
+    {
+      if(nativeTextureDependency.synced)
+      {
+        // Fast-out if we know it is already synced
+        continue;
+      }
 
-  // // Native dependency check
-  // if(texture->IsNativeTexture())
-  // {
-  //   // TODO : Optimize here. For now, we don't have too much EndPass call. So just keep this logic.
-  //   for(auto& nativeTextureDependency : mNativeTextureDependencies[mPreviousNativeTextureDependencyIndex])
-  //   {
-  //     if(nativeTextureDependency.synced)
-  //     {
-  //       // Fast-out if we know it is already synced
-  //       continue;
-  //     }
+      auto iter = nativeTextureDependency.textures.find(texture);
+      if(iter != nativeTextureDependency.textures.end())
+      {
+        if(nativeTextureDependency.agingSyncObject != nullptr)
+        {
+          if(cpu)
+          {
+            DALI_LOG_INFO(gLogSyncFilter, Debug::Verbose, "TextureDependencyChecker::CheckNeedsSync (for native) Insert CPU WAIT");
+            nativeTextureDependency.synced = mController.GetSyncPool().ClientWait(nativeTextureDependency.agingSyncObject);
 
-  //     auto iter = nativeTextureDependency.textures.find(texture);
-  //     if(iter != nativeTextureDependency.textures.end())
-  //     {
-  //       if(nativeTextureDependency.agingSyncObject != nullptr)
-  //       {
-  //         if(cpu)
-  //         {
-  //           DALI_LOG_INFO(gLogSyncFilter, Debug::Verbose, "TextureDependencyChecker::CheckNeedsSync (for native) Insert CPU WAIT");
-  //           nativeTextureDependency.synced = mController.GetSyncPool().ClientWait(nativeTextureDependency.agingSyncObject);
-  //         }
-  //         else
-  //         {
-  //           // Wait on the sync object in GPU. This will ensure that the writeContext completes its tasks prior
-  //           // to the sync point.
-  //           // However, this may instead timeout, and we can't tell the difference (at least, for glFenceSync)
-  //           DALI_LOG_INFO(gLogSyncFilter, Debug::Verbose, "TextureDependencyChecker::CheckNeedsSync (for native) Insert GPU WAIT");
-  //           mController.GetSyncPool().Wait(nativeTextureDependency.agingSyncObject);
-  //         }
-  //       }
+            if(DALI_LIKELY(nativeTextureDependency.synced) && readContext == nativeTextureDependency.agingSyncObject->writeContext)
+            {
+              // We can free sync object immediatly if we are using same context.
+              mController.GetSyncPool().FreeSyncObject(nativeTextureDependency.agingSyncObject);
+              nativeTextureDependency.agingSyncObject = nullptr;
+            }
+          }
+          else
+          {
+            // Wait on the sync object in GPU. This will ensure that the writeContext completes its tasks prior
+            // to the sync point.
+            // However, this may instead timeout, and we can't tell the difference (at least, for glFenceSync)
+            DALI_LOG_INFO(gLogSyncFilter, Debug::Verbose, "TextureDependencyChecker::CheckNeedsSync (for native) Insert GPU WAIT");
+            mController.GetSyncPool().Wait(nativeTextureDependency.agingSyncObject);
+          }
+        }
 
-  //       nativeTextureDependency.textures.erase(iter);
-  //     }
-  //   }
-  // }
+        nativeTextureDependency.textures.erase(iter);
+      }
+    }
+  }
 }
 
 void TextureDependencyChecker::MarkNativeTexturePrepared(const GLES::Texture* texture)
 {
-  // VD TRUNK-2025 block these codes
-  // if(DALI_LIKELY(texture->IsNativeTexture()))
-  // {
-  //   if(mIsFirstPreparedNativeTextureDependency)
-  //   {
-  //     mNativeTextureDependencies[mCurrentNativeTextureDependencyIndex].emplace_back();
-  //     mIsFirstPreparedNativeTextureDependency = false;
-  //   }
+  if(DALI_LIKELY(texture->IsNativeTexture()))
+  {
+    if(mIsFirstPreparedNativeTextureDependency)
+    {
+      mNativeTextureDependencies[mCurrentNativeTextureDependencyIndex].emplace_back();
+      mIsFirstPreparedNativeTextureDependency = false;
+    }
 
-  //   if(DALI_LIKELY(!mNativeTextureDependencies[mCurrentNativeTextureDependencyIndex].empty()))
-  //   {
-  //     auto& nativeTextureDependency = mNativeTextureDependencies[mCurrentNativeTextureDependencyIndex].back();
-  //     nativeTextureDependency.textures.insert(texture);
-  //   }
-  // }
+    if(DALI_LIKELY(!mNativeTextureDependencies[mCurrentNativeTextureDependencyIndex].empty()))
+    {
+      auto& nativeTextureDependency = mNativeTextureDependencies[mCurrentNativeTextureDependencyIndex].back();
+      nativeTextureDependency.textures.insert(texture);
+    }
+  }
 }
 
 void TextureDependencyChecker::DiscardNativeTexture(const GLES::Texture* texture)
 {
-  // VD TRUNK-2025 block these codes
-  // if(DALI_LIKELY(texture->IsNativeTexture()))
-  // {
-  //   for(uint32_t nativeIndex = 0u; nativeIndex < 2u; ++nativeIndex)
-  //   {
-  //     for(auto iter = mNativeTextureDependencies[nativeIndex].begin(); iter != mNativeTextureDependencies[nativeIndex].end();)
-  //     {
-  //       auto& nativeTextureDependency = *iter;
+  if(DALI_LIKELY(texture->IsNativeTexture()))
+  {
+    for(uint32_t nativeIndex = 0u; nativeIndex < 2u; ++nativeIndex)
+    {
+      for(auto iter = mNativeTextureDependencies[nativeIndex].begin(); iter != mNativeTextureDependencies[nativeIndex].end();)
+      {
+        auto& nativeTextureDependency = *iter;
 
-  //       bool isErased = false;
+        bool isErased = false;
 
-  //       auto jter = nativeTextureDependency.textures.find(texture);
-  //       if(jter != nativeTextureDependency.textures.end())
-  //       {
-  //         nativeTextureDependency.textures.erase(jter);
-  //         if(nativeTextureDependency.textures.empty())
-  //         {
-  //           mController.GetSyncPool().FreeSyncObject(nativeTextureDependency.agingSyncObject);
-  //           iter = mNativeTextureDependencies[nativeIndex].erase(iter);
+        auto jter = nativeTextureDependency.textures.find(texture);
+        if(jter != nativeTextureDependency.textures.end())
+        {
+          nativeTextureDependency.textures.erase(jter);
+          if(nativeTextureDependency.textures.empty())
+          {
+            mController.GetSyncPool().FreeSyncObject(nativeTextureDependency.agingSyncObject);
+            iter = mNativeTextureDependencies[nativeIndex].erase(iter);
 
-  //           isErased = true;
-  //         }
-  //       }
+            isErased = true;
+          }
+        }
 
-  //       if(!isErased)
-  //       {
-  //         ++iter;
-  //       }
-  //     }
-  //   }
-  // }
+        if(!isErased)
+        {
+          ++iter;
+        }
+      }
+    }
+  }
 }
 
 void TextureDependencyChecker::CreateNativeTextureSync(const GLES::Context* writeContext)
 {
-  // VD TRUNK-2025 block these codes
-  // if(mIsFirstPreparedNativeTextureDependency)
-  // {
-  //   return;
-  // }
+  if(mIsFirstPreparedNativeTextureDependency)
+  {
+    return;
+  }
 
-  // // Reset flag
-  // mIsFirstPreparedNativeTextureDependency = true;
+  // Reset flag
+  mIsFirstPreparedNativeTextureDependency = true;
 
-  // if(DALI_LIKELY(!mNativeTextureDependencies[mCurrentNativeTextureDependencyIndex].empty()))
-  // {
-  //   auto& nativeTextureDependency = mNativeTextureDependencies[mCurrentNativeTextureDependencyIndex].back();
+  if(DALI_LIKELY(!mNativeTextureDependencies[mCurrentNativeTextureDependencyIndex].empty()))
+  {
+    auto& nativeTextureDependency = mNativeTextureDependencies[mCurrentNativeTextureDependencyIndex].back();
 
-  //   DALI_LOG_INFO(gLogSyncFilter, Debug::Verbose, "TextureDependencyChecker::CreateNativeTextureSync() Allocating sync object\n");
-  //   nativeTextureDependency.agingSyncObject = mController.GetSyncPool().AllocateSyncObject(writeContext, SyncPool::SyncContext::EGL);
-  // }
+    DALI_LOG_INFO(gLogSyncFilter, Debug::Verbose, "TextureDependencyChecker::CreateNativeTextureSync() Allocating sync object\n");
+    nativeTextureDependency.agingSyncObject = mController.GetSyncPool().AllocateSyncObject(writeContext, SyncPool::SyncContext::EGL);
+  }
 }
 
 } // namespace Dali::Graphics::GLES
index b53a6bce0a2937c52783d8cb71f75c1aad2fe63b..061c3da187b05cf00970e5f3d37e2a9afa3db5e4 100644 (file)
@@ -260,6 +260,10 @@ void CommandBufferImpl::EndRenderPass()
   mCommandBuffer.endRenderPass();
 }
 
+void CommandBufferImpl::ReadPixels(uint8_t* buffer)
+{
+}
+
 void CommandBufferImpl::PipelineBarrier(
   vk::PipelineStageFlags               srcStageMask,
   vk::PipelineStageFlags               dstStageMask,
index 98b4db802055a02aac8d7f00bef55fae48915fe9..6d2c04c4b1eae0211f04745d5966efded5ae1c5e 100644 (file)
@@ -92,6 +92,11 @@ public:
    */
   void EndRenderPass();
 
+  /**
+   * Request to read pixels.
+   */
+  void ReadPixels(uint8_t* buffer);
+
   void PipelineBarrier(vk::PipelineStageFlags               srcStageMask,
                        vk::PipelineStageFlags               dstStageMask,
                        vk::DependencyFlags                  dependencyFlags,
index f344178df84b5fdc524213bfd8ddd2efc685823f..d7aa5bf11734e38182e322e76b7843f5764c41f8 100644 (file)
@@ -243,6 +243,11 @@ void CommandBuffer::EndRenderPass(Graphics::SyncObject* syncObject)
   mCommandBufferImpl->EndRenderPass();
 }
 
+void CommandBuffer::ReadPixels(uint8_t* buffer)
+{
+  mCommandBufferImpl->ReadPixels(buffer);
+}
+
 void CommandBuffer::ExecuteCommandBuffers(std::vector<const Graphics::CommandBuffer*>&& gfxCommandBuffers)
 {
   std::vector<vk::CommandBuffer> vkCommandBuffers;
index ea5efe6c2b5cf7ff5c24254154b740783f57ba6c..296faded5655d334f8455621089f5747bbe36fca 100644 (file)
@@ -151,6 +151,11 @@ public:
    */
   void EndRenderPass(Graphics::SyncObject* syncObject) override;
 
+  /**
+   * @copydoc Dali::Graphics::CommandBuffer::ReadPixels
+   */
+  void ReadPixels(uint8_t* buffer) override;
+
   /**
    * @brief Executes a list of secondary command buffers
    *
index f1942b3a25697a4e230eab23202711d4a24c559c..b62dae2febca8ea41778040d9f92764554f43e5b 100644 (file)
@@ -125,12 +125,20 @@ struct ShaderImpl::Impl
       return;
     }
 
-    sourcePreprocessed.resize(size + 1 /* Include null-terminated char */);
-    sourcePreprocessed[size] = '\0';
+    const uint8_t* dataPtr = reinterpret_cast<const uint8_t*>(data);
 
-    std::copy(reinterpret_cast<const uint8_t*>(data),
-              reinterpret_cast<const uint8_t*>(data) + size,
-              sourcePreprocessed.data());
+    if(*(dataPtr + size - 1) != '\0')
+    {
+      sourcePreprocessed.resize(size + 1 /* Include null-terminated char */);
+      sourcePreprocessed[size] = '\0';
+    }
+    else
+    {
+      // null-terminated char already included.
+      sourcePreprocessed.resize(size);
+    }
+
+    std::copy(dataPtr, dataPtr + size, sourcePreprocessed.data());
   }
 
   VulkanGraphicsController&       controller;
index 8c6ed5bec43b40997063c9042edede63ec3eaa34..0b6e726eabc0c63ad41d64b16958d657666f44b6 100644 (file)
@@ -208,6 +208,11 @@ bool NativeImageSourceAndroid::GetPixels(std::vector<uint8_t>& pixbuf, uint32_t&
   return success;
 }
 
+bool NativeImageSourceAndroid::SetPixels(uint8_t* pixbuf, const Pixel::Format& pixelFormat)
+{
+  return false;
+}
+
 void NativeImageSourceAndroid::SetSource(Any source)
 {
   if(mPixmap)
index 3da39a8e0c3fc38414bd358674c07c96d007e2d3..331eaac10817788dfee65fb4518d60ee7191ddd9 100644 (file)
@@ -66,6 +66,11 @@ public:
    */
   bool GetPixels(std::vector<uint8_t>& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const override;
 
+  /**
+   * @copydoc Dali::NativeImageSource::SetPixels()
+   */
+  bool SetPixels(uint8_t* pixbuf, const Pixel::Format& pixelFormat) override;
+
   /**
    * @copydoc Dali::NativeImageSource::SetSource( Any source )
    */
index 6b90eb876054f40a19d78a18e5c0d1d21dd811bf..16d19c868e56a294d331d5e04c68219bbf47e122 100644 (file)
@@ -60,6 +60,11 @@ public:
    */
   virtual bool GetPixels(std::vector<uint8_t>& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const = 0;
 
+  /**
+   * @copydoc Dali::NativeImageSource::SetPixels()
+   */
+  virtual bool SetPixels(uint8_t* pixbuf, const Pixel::Format& pixelFormat) = 0;
+
   /**
    * @copydoc Dali::NativeImageSource::SetSource( Any source )
    */
index d386b2dc7b7db26d78f5b94f8fffd6fe030572bc..54d0fc652d5aa9062140a1f78faf67223d720b35 100644 (file)
@@ -128,6 +128,11 @@ bool NativeImageSourceCocoa::GetPixels(
   return true;
 }
 
+bool NativeImageSourceCocoa::SetPixels(uint8_t* pixbuf, const Pixel::Format& pixelFormat)
+{
+  return false;
+}
+
 void NativeImageSourceCocoa::SetSource(Any source)
 {
 }
index 576f56d5e0b1004c83227910781dcbc858260aa6..11c39782e3ef683688d785d8d7993a26a1b9aab3 100644 (file)
@@ -61,6 +61,11 @@ public:
     uint32_t&             height,
     Pixel::Format&        pixelFormat) const override;
 
+  /**
+   * @copydoc Dali::NativeImageSource::SetPixels()
+   */
+  bool SetPixels(uint8_t* pixbuf, const Pixel::Format& pixelFormat) override;
+
   /**
    * @copydoc Dali::NativeImageSource::SetSource( Any source )
    */
index b33a51cfc7ecb0878a0787eab35ee4ea462d39ec..9f4c91c62dc9992c782c33e298e84896466c7c82 100644 (file)
@@ -336,6 +336,116 @@ bool NativeImageSourceTizen::GetPixels(std::vector<uint8_t>& pixbuf, uint32_t& w
   return false;
 }
 
+bool NativeImageSourceTizen::SetPixels(uint8_t* pixbuf, const Pixel::Format& pixelFormat)
+{
+  std::scoped_lock lock(mMutex);
+  if(mTbmSurface != NULL)
+  {
+    tbm_surface_info_s surface_info;
+
+    if(tbm_surface_map(mTbmSurface, TBM_SURF_OPTION_READ | TBM_SURF_OPTION_WRITE, &surface_info) != TBM_SURFACE_ERROR_NONE)
+    {
+      DALI_LOG_ERROR("Fail to map tbm_surface\n");
+      return false;
+    }
+    tbm_surface_internal_ref(mTbmSurface);
+
+    if(pixelFormat != Pixel::Format::RGBA8888 && pixelFormat != Pixel::Format::RGB888)
+    {
+      DALI_LOG_ERROR("Not Supported PixelFormat\n");
+      return false;
+    }
+
+    tbm_format format = surface_info.format;
+    uint32_t   stride = surface_info.planes[0].stride;
+    uint8_t*   ptr    = surface_info.planes[0].ptr;
+
+    size_t lineSize;
+    size_t inputBufferLinePixelSize = Dali::Pixel::GetBytesPerPixel(pixelFormat);
+
+    switch(format)
+    {
+      case TBM_FORMAT_RGB888:
+      {
+        lineSize        = mWidth * inputBufferLinePixelSize;
+        uint8_t* bufptr = &pixbuf[0];
+
+        for(uint32_t r = 0; r < mHeight; ++r, bufptr += lineSize)
+        {
+          for(uint32_t c = 0; c < mWidth; ++c)
+          {
+            size_t sOffset  = c * inputBufferLinePixelSize;
+            size_t dOffset  = c * 3;
+            size_t offset          = dOffset + r * stride;
+            ptr[offset + 2] = *(bufptr + sOffset);
+            ptr[offset + 1] = *(bufptr + sOffset + 1);
+            ptr[offset]     = *(bufptr + sOffset + 2);
+          }
+        }
+        break;
+      }
+      case TBM_FORMAT_RGBA8888:
+      {
+        lineSize        = mWidth * inputBufferLinePixelSize;
+        uint8_t* bufptr = &pixbuf[0];
+
+        for(uint32_t r = 0; r < mHeight; ++r, bufptr += lineSize)
+        {
+          for(uint32_t c = 0; c < mWidth; ++c)
+          {
+            size_t sOffset  = c * inputBufferLinePixelSize;
+            size_t dOffset  = c * 4;
+            size_t offset          = dOffset + r * stride;
+            ptr[offset + 3] = *(bufptr + sOffset);
+            ptr[offset + 2] = *(bufptr + sOffset + 1);
+            ptr[offset + 1] = *(bufptr + sOffset + 2);
+            ptr[offset]     = (inputBufferLinePixelSize == 4) ? *(bufptr + sOffset + 3) : 0xFF;
+          }
+        }
+        break;
+      }
+      case TBM_FORMAT_ARGB8888:
+      {
+        lineSize        = mWidth * inputBufferLinePixelSize;
+        uint8_t* bufptr = &pixbuf[0];
+
+        for(uint32_t r = 0; r < mHeight; ++r, bufptr += lineSize)
+        {
+          for(uint32_t c = 0; c < mWidth; ++c)
+          {
+            size_t sOffset  = c * inputBufferLinePixelSize;
+            size_t dOffset  = c * 4;
+            size_t offset          = dOffset + r * stride;
+            ptr[offset + 2] = *(bufptr + sOffset);
+            ptr[offset + 1] = *(bufptr + sOffset + 1);
+            ptr[offset]     = *(bufptr + sOffset + 2);
+            ptr[offset + 3] = (inputBufferLinePixelSize == 4) ? *(bufptr + sOffset + 3) : 0xFF;
+          }
+        }
+        break;
+      }
+      default:
+      {
+        DALI_ASSERT_ALWAYS(0 && "Tbm surface has unsupported pixel format.\n");
+
+        return false;
+      }
+    }
+
+    if(tbm_surface_unmap(mTbmSurface) != TBM_SURFACE_ERROR_NONE)
+    {
+      DALI_LOG_ERROR("Fail to unmap tbm_surface\n");
+    }
+    tbm_surface_internal_unref(mTbmSurface);
+
+    return true;
+  }
+
+  DALI_LOG_WARNING("TBM surface does not exist.\n");
+
+  return false;
+}
+
 void NativeImageSourceTizen::SetSource(Any source)
 {
   std::scoped_lock lock(mMutex);
index 70f0340dd2020f560b67f564a677214ad537a421..9d85dcfa2b4a0909d954d0614723c620c43b0a99 100644 (file)
@@ -67,6 +67,11 @@ public:
    */
   bool GetPixels(std::vector<uint8_t>& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const override;
 
+  /**
+   * @copydoc Dali::NativeImageSource::SetPixels()
+   */
+  bool SetPixels(uint8_t* pixbuf, const Pixel::Format& pixelFormat) override;
+
   /**
    * @copydoc Dali::NativeImageSource::SetSource( Any source )
    */
index 28be8a293b34dfa933f80292ec49371d92f61bd1..efbeeb592f8d7b2004582c2f593e5bb2eb0f9058 100644 (file)
@@ -264,6 +264,11 @@ bool NativeImageSourceX::GetPixels(std::vector<uint8_t>& pixbuf, uint32_t& width
   return success;
 }
 
+bool NativeImageSourceX::SetPixels(uint8_t* pixbuf, const Pixel::Format& pixelFormat)
+{
+  return false;
+}
+
 void NativeImageSourceX::SetSource(Any source)
 {
   mPixmap = GetPixmapFromAny(source);
index 6745c6416935572058f03839c0dc23b8cb4e3c95..7105d031e1ddd39bda388a3e0325446e7798c67b 100644 (file)
@@ -64,6 +64,11 @@ public:
    */
   bool GetPixels(std::vector<uint8_t>& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const override;
 
+  /**
+   * @copydoc Dali::NativeImageSource::SetPixels()
+   */
+  bool SetPixels(uint8_t* pixbuf, const Pixel::Format& pixelFormat) override;
+
   /**
    * @copydoc Dali::NativeImageSource::SetSource( Any source )
    */
index 2eaa812c65e77ac3bef3085c27b7ebfa59e5c237..21a5859812edd9bb07517a8a39cd797e7e8ed840 100644 (file)
@@ -115,6 +115,11 @@ bool NativeImageSourceWin::GetPixels(std::vector<uint8_t>& pixbuf, uint32_t& wid
   return success;
 }
 
+bool NativeImageSourceWin::SetPixels(uint8_t* pixbuf, const Pixel::Format& pixelFormat)
+{
+  return false;
+}
+
 void NativeImageSourceWin::SetSource(Any source)
 {
   mPixmap = GetPixmapFromAny(source);
index 88059d6e4b06dfce025baf9e5c7253cd78f64fd6..4accc7adb4d949bf6f15752ae777d2fdb290c9da 100644 (file)
@@ -62,6 +62,11 @@ public:
    */
   bool GetPixels(std::vector<uint8_t>& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const override;
 
+  /**
+   * @copydoc Dali::NativeImageSource::SetPixels()
+   */
+  bool SetPixels(uint8_t* pixbuf, const Pixel::Format& pixelFormat) override;
+
   /**
    * @copydoc Dali::NativeImageSource::SetSource( Any source )
    */
index 8eb5d353d71f12d6189847f7cd75cd25818e90cb..32eedc6c9946719aad4c19e0f8ff62a44993b88b 100644 (file)
@@ -268,6 +268,11 @@ bool NativeImageSourceX::GetPixels(std::vector<unsigned char>& pixbuf, unsigned&
   return success;
 }
 
+bool NativeImageSourceX::SetPixels(uint8_t* pixbuf, const Pixel::Format& pixelFormat)
+{
+  return false;
+}
+
 void NativeImageSourceX::SetSource(Any source)
 {
   mPixmap = GetPixmapFromAny(source);
index 68c4126aa74f023084850b82c1beac7ab476d17a..115626fed8077b8fba97ae423bb9e38e3e2062de 100644 (file)
@@ -63,6 +63,11 @@ public:
    */
   bool GetPixels(std::vector<unsigned char>& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const override;
 
+  /**
+   * @copydoc Dali::NativeImageSource::SetPixels()
+   */
+  bool SetPixels(uint8_t* pixbuf, const Pixel::Format& pixelFormat) override;
+
   /**
    * @copydoc Dali::NativeImageSource::SetSource( Any source )
    */
index e4495b90c2486cae1fe8979d00af2b97c16f62ff..4781684f390e8661ce7ef53f25f0a2cc6a9bd6d9 100644 (file)
@@ -20,6 +20,7 @@
 
 // EXTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
+#include <dali/integration-api/pixel-data-integ.h>
 #include <dali/public-api/common/vector-wrapper.h>
 #include <dali/public-api/render-tasks/render-task-list.h>
 #include <string.h>
@@ -41,7 +42,6 @@ namespace Adaptor
 namespace
 {
 static constexpr uint32_t ORDER_INDEX_CAPTURE_RENDER_TASK              = 1000;
-constexpr int32_t         SHADER_VERSION_NATIVE_IMAGE_SOURCE_AVAILABLE = 300;
 constexpr uint32_t        TIME_OUT_DURATION                            = 1000;
 constexpr int32_t  GL_VERSION_NATIVE_IMAGE_SOURCE_AVAILABLE = 30;
 } // namespace
@@ -50,7 +50,6 @@ Capture::Capture()
 : mQuality(DEFAULT_QUALITY),
   mTimer(),
   mPath(),
-  mNativeImageSourcePtr(NULL),
   mFileSave(false),
   mUseDefaultCamera(true),
   mSceneOffCameraAfterCaptureFinished(false)
@@ -62,7 +61,6 @@ Capture::Capture(Dali::CameraActor cameraActor)
   mCameraActor(cameraActor),
   mTimer(),
   mPath(),
-  mNativeImageSourcePtr(NULL),
   mFileSave(false),
   mUseDefaultCamera(!cameraActor),
   mSceneOffCameraAfterCaptureFinished(false)
@@ -75,7 +73,6 @@ Capture::~Capture()
   {
     Adaptor::Get().UnregisterProcessorOnce(*this, true);
   }
-  DeleteNativeImageSource();
   mTexture.Reset();
 }
 
@@ -120,14 +117,15 @@ void Capture::Start(Dali::Actor source, const Dali::Vector2& position, const Dal
   // Increase the reference count focely to avoid application mistake.
   Reference();
 
+  UnsetResources();
+  SetupResources(position, size, clearColor, source);
+
   mPath = path;
   if(!mPath.empty())
   {
     mFileSave = true;
   }
-
-  UnsetResources();
-  SetupResources(position, size, clearColor, source);
+  mRenderTask.KeepRenderResult();
 
   mInCapture = true;
   Adaptor::Get().RegisterProcessorOnce(*this, true);
@@ -155,9 +153,24 @@ bool Capture::IsExclusive() const
   return mIsExclusive;
 }
 
-Dali::NativeImageSourcePtr Capture::GetNativeImageSource() const
+Dali::NativeImageSourcePtr Capture::GetNativeImageSource()
 {
-  return mNativeImageSourcePtr;
+  Dali::NativeImageSourcePtr result;
+  if(mRenderTask)
+  {
+    Dali::PixelData pixelData = mRenderTask.GetRenderResult();
+    if(pixelData)
+    {
+      auto pixelDataBuffer = Dali::Integration::GetPixelDataBuffer(pixelData);
+      NativeImageSourcePtr nativeImageSourcePtr = Dali::NativeImageSource::New(pixelData.GetWidth(), pixelData.GetHeight(), Dali::NativeImageSource::COLOR_DEPTH_32);  // Texture pixel format is RGBA8888
+
+      if(Dali::DevelNativeImageSource::SetPixels(*nativeImageSourcePtr, pixelDataBuffer.buffer, pixelData.GetPixelFormat()))
+      {
+        result = nativeImageSourcePtr;
+      }
+    }
+  }
+  return result;
 }
 
 Dali::Texture Capture::GetTexture() const
@@ -167,19 +180,18 @@ Dali::Texture Capture::GetTexture() const
 
 Dali::Devel::PixelBuffer Capture::GetCapturedBuffer()
 {
-  if(!mPixelBuffer || (mPixelBuffer && !mPixelBuffer.GetBuffer()))
+  Devel::PixelBuffer pixelBuffer;
+  if(mRenderTask)
   {
-    std::vector<uint8_t> buffer;
-    uint32_t             width, height;
-    Dali::Pixel::Format  pixelFormat;
-    if(!mNativeImageSourcePtr->GetPixels(buffer, width, height, pixelFormat))
+    Dali::PixelData pixelData = mRenderTask.GetRenderResult();
+    if(pixelData)
     {
-      return Dali::Devel::PixelBuffer();
+      auto pixelDataBuffer = Dali::Integration::GetPixelDataBuffer(pixelData);
+      pixelBuffer          = Dali::Devel::PixelBuffer::New(pixelData.GetWidth(), pixelData.GetHeight(), pixelData.GetPixelFormat());
+      memcpy(pixelBuffer.GetBuffer(), pixelDataBuffer.buffer, pixelDataBuffer.bufferSize);
     }
-    mPixelBuffer = Dali::Devel::PixelBuffer::New(width, height, pixelFormat);
-    memcpy(mPixelBuffer.GetBuffer(), &buffer[0], width * height * Dali::Pixel::GetBytesPerPixel(pixelFormat));
   }
-  return mPixelBuffer;
+  return pixelBuffer;
 }
 
 Dali::Capture::CaptureFinishedSignalType& Capture::FinishedSignal()
@@ -189,19 +201,7 @@ Dali::Capture::CaptureFinishedSignalType& Capture::FinishedSignal()
 
 void Capture::CreateTexture(const Vector2& size)
 {
-  if(!mNativeImageSourcePtr)
-  {
-    mNativeImageSourcePtr = Dali::NativeImageSource::New(size.width, size.height, Dali::NativeImageSource::COLOR_DEPTH_DEFAULT);
-    mTexture              = Dali::Texture::New(*mNativeImageSourcePtr);
-  }
-}
-
-void Capture::DeleteNativeImageSource()
-{
-  if(mNativeImageSourcePtr)
-  {
-    mNativeImageSourcePtr.Reset();
-  }
+  mTexture = Dali::Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, unsigned(size.width), unsigned(size.height));
 }
 
 void Capture::CreateFrameBuffer()
@@ -313,8 +313,10 @@ void Capture::UnsetRenderTask()
     Dali::RenderTaskList taskList = sceneHolder.GetRenderTaskList();
     taskList.RemoveTask(mRenderTask);
   }
+  mRenderTask.ClearRenderResult();
   mRenderTask.Reset();
   mSource.Reset();
+  mTexture.Reset();
   mSceneHolderHandle.Reset();
 }
 
@@ -398,9 +400,11 @@ bool Capture::OnTimeOut()
 
 bool Capture::SaveFile()
 {
-  if(mNativeImageSourcePtr)
+  Dali::PixelData pixelData = mRenderTask.GetRenderResult();
+  if(pixelData)
   {
-    return Dali::DevelNativeImageSource::EncodeToFile(*mNativeImageSourcePtr, mPath, mQuality);
+    auto pixelDataBuffer = Dali::Integration::GetPixelDataBuffer(pixelData);
+    return Dali::EncodeToFile(pixelDataBuffer.buffer, mPath, pixelData.GetPixelFormat(), pixelData.GetWidth(), pixelData.GetHeight(), mQuality);
   }
 
   return false;
index 446e7d8da53bdbc7b0b9321aa983096558e11a87..402fd0b639948ea6e760d6e42b3d1e83dc11a136 100644 (file)
@@ -96,7 +96,7 @@ public:
   /**
    * @copydoc Dali::Capture::GetNativeImageSource
    */
-  Dali::NativeImageSourcePtr GetNativeImageSource() const;
+  Dali::NativeImageSourcePtr GetNativeImageSource();
 
   /**
    * @copydoc Dali::Capture::GetCapturedBuffer
@@ -125,11 +125,6 @@ private:
    */
   void CreateTexture(const Dali::Vector2& size);
 
-  /**
-   * @brief Delete native image source.
-   */
-  void DeleteNativeImageSource();
-
   /**
    * @brief Create frame buffer.
    */
@@ -239,8 +234,6 @@ private:
   Dali::Timer                                      mTimer; ///< For timeout.
   Dali::Capture::CaptureFinishedSignalType         mFinishedSignal;
   std::string                                      mPath;
-  Dali::NativeImageSourcePtr                       mNativeImageSourcePtr; ///< pointer to surface image
-  Dali::Devel::PixelBuffer                         mPixelBuffer;
   bool                                             mInCapture{false};
   bool                                             mIsExclusive{false};
   bool                                             mFileSave;
index ad0f3cfe7acaee55767e93f0c591bf3ab91bc673..2687a32e5d65ebf3ba3aaef616fbc96cdcc8b020 100644 (file)
@@ -32,7 +32,7 @@
 
 // INTERNAL HEADERS
 #include <dali/devel-api/adaptor-framework/accessibility-bridge.h>
-#include <dali/devel-api/atspi-interfaces/accessible.h>
+#include <dali/devel-api/adaptor-framework/actor-accessible.h>
 #include <dali/integration-api/adaptor-framework/render-surface-interface.h>
 #include <dali/internal/window-system/common/event-handler.h>
 #include <dali/internal/window-system/common/orientation-impl.h>
@@ -763,7 +763,7 @@ void Window::SetSize(Dali::Window::WindowSize size)
 
     if(Dali::Accessibility::IsUp())
     {
-      if(auto accessible = Dali::Accessibility::Accessible::Get(mScene.GetRootLayer()))
+      if(auto accessible = dynamic_cast<Accessibility::ActorAccessible*>(Accessibility::Accessible::Get(mScene.GetRootLayer())))
       {
         accessible->EmitBoundsChanged(Dali::Rect<>(oldRect.x, oldRect.y, size.GetWidth(), size.GetHeight()));
       }
@@ -804,7 +804,7 @@ void Window::SetPosition(Dali::Window::WindowPosition position)
 
     if(Dali::Accessibility::IsUp())
     {
-      if(auto accessible = Dali::Accessibility::Accessible::Get(mScene.GetRootLayer()))
+      if(auto accessible = dynamic_cast<Accessibility::ActorAccessible*>(Accessibility::Accessible::Get(mScene.GetRootLayer())))
       {
         accessible->EmitBoundsChanged(Dali::Rect<>(position.GetX(), position.GetY(), oldRect.width, oldRect.height));
       }
@@ -881,7 +881,7 @@ void Window::SetPositionSize(PositionSize positionSize)
 
   if((moved || resize) && Dali::Accessibility::IsUp())
   {
-    if(auto accessible = Dali::Accessibility::Accessible::Get(mScene.GetRootLayer()))
+    if(auto accessible = dynamic_cast<Accessibility::ActorAccessible*>(Accessibility::Accessible::Get(mScene.GetRootLayer())))
     {
       accessible->EmitBoundsChanged(Dali::Rect<>(positionSize.x, positionSize.y, positionSize.width, positionSize.height));
     }
@@ -1145,7 +1145,7 @@ void Window::OnUpdatePositionSize(Dali::PositionSize& positionSize)
 
   if((moved || resize) && Dali::Accessibility::IsUp())
   {
-    if(auto accessible = Dali::Accessibility::Accessible::Get(mScene.GetRootLayer()))
+    if(auto accessible = dynamic_cast<Accessibility::ActorAccessible*>(Accessibility::Accessible::Get(mScene.GetRootLayer())))
     {
       accessible->EmitBoundsChanged(Dali::Rect<>(positionSize.x, positionSize.y, positionSize.width, positionSize.height));
     }
index 4251e325297699fe1bb5e6350ba2aa020f7f1886..ac93f9afe9b798bf89432f5fc99e49f4f97facde 100644 (file)
@@ -20,6 +20,7 @@
 
 // EXTERNAL_HEADERS
 #include <dali/integration-api/debug.h>
+#include <tbm_bufmgr.h>
 #include <tbm_dummy_display.h>
 
 #ifdef ECORE_WAYLAND2
@@ -38,6 +39,81 @@ namespace Internal
 {
 namespace Adaptor
 {
+namespace
+{
+/**
+ * @brief Helper class to make we keep NativeDisplay for NativeRenderSurface as unique pointer
+ * even if Application terminated and restart again.
+ *
+ * @note Follow by eglSpec, eglGetDipslay() creates new EGLDisplay per each input paramater,
+ * and never be deleted until process terminated. But we can re-create DisplayConnecter multiple times
+ * when we are using OffscreenApplication.
+ * So, we need to keep dummy NativeDisplay pointer to avoid creating multiple EGLDisplay.
+ */
+struct NativeRenderSurfaceDisplayHolder
+{
+  NativeRenderSurfaceDisplayHolder()
+  : mBufMgr(nullptr),
+    mDisplay(nullptr)
+  {
+    Initialize();
+  }
+  ~NativeRenderSurfaceDisplayHolder()
+  {
+    Destroy();
+  }
+
+  void Initialize()
+  {
+    mBufMgr = tbm_bufmgr_init(-1); // -1 is meaningless. The parameter in this function is deprecated.
+    if(mBufMgr)
+    {
+      mDisplay = reinterpret_cast<NativeDisplayType>(tbm_dummy_display_create());
+    }
+  }
+  void Destroy()
+  {
+#ifdef VULKAN_ENABLED
+    if(!mDisplay.Empty())
+    {
+      // TODO: Fix this call for Vulkan
+      //tbm_dummy_display_destroy(mDisplay.Get<tbm_dummy_display>());
+    }
+#else
+    if(mDisplay)
+    {
+      tbm_dummy_display_destroy(reinterpret_cast<tbm_dummy_display*>(mDisplay));
+    }
+#endif
+    if(mBufMgr)
+    {
+      tbm_bufmgr_deinit(mBufMgr);
+    }
+  }
+
+  tbm_bufmgr mBufMgr; ///< For creating tbm_dummy_display
+
+  NativeDisplayType mDisplay;
+};
+
+static NativeDisplayType GetUniqueTbmDummyDisplay()
+{
+  static NativeRenderSurfaceDisplayHolder sNativeRenderSurfaceDisplayHolder;
+  if(sNativeRenderSurfaceDisplayHolder.mBufMgr == nullptr)
+  {
+    // Retry to initialize tbm bufmgr
+    sNativeRenderSurfaceDisplayHolder.Destroy();
+    sNativeRenderSurfaceDisplayHolder.Initialize();
+    if(sNativeRenderSurfaceDisplayHolder.mBufMgr == nullptr)
+    {
+      DALI_LOG_ERROR("Fail to init tbm buf mgr\n");
+      return nullptr;
+    }
+  }
+  return sNativeRenderSurfaceDisplayHolder.mDisplay;
+}
+} // namespace
+
 DisplayConnection* DisplayConnectionEcoreWl::New()
 {
   DisplayConnection* pDisplayConnection(new DisplayConnectionEcoreWl());
@@ -47,8 +123,7 @@ DisplayConnection* DisplayConnectionEcoreWl::New()
 
 DisplayConnectionEcoreWl::DisplayConnectionEcoreWl()
 : mDisplay(NULL),
-  mSurfaceType(Integration::RenderSurfaceInterface::WINDOW_RENDER_SURFACE),
-  mBufMgr(nullptr)
+  mSurfaceType(Integration::RenderSurfaceInterface::WINDOW_RENDER_SURFACE)
 {
 }
 
@@ -95,33 +170,11 @@ Any DisplayConnectionEcoreWl::GetNativeGraphicsDisplay()
 
 NativeDisplayType DisplayConnectionEcoreWl::GetNativeDisplay()
 {
-  mBufMgr = tbm_bufmgr_init(-1); // -1 is meaningless. The parameter in this function is deprecated.
-  if(mBufMgr == nullptr)
-  {
-    DALI_LOG_ERROR("Fail to init tbm buf mgr\n");
-    return nullptr;
-  }
-  return NativeDisplayType(tbm_dummy_display_create());
+  return GetUniqueTbmDummyDisplay();
 }
 
 void DisplayConnectionEcoreWl::ReleaseNativeDisplay()
 {
-#ifdef VULKAN_ENABLED
-  if(!mDisplay.Empty())
-  {
-    // TODO: Fix this call for Vulkan
-    //tbm_dummy_display_destroy(mDisplay.Get<tbm_dummy_display>());
-  }
-#else
-  if(mDisplay)
-  {
-    tbm_dummy_display_destroy(reinterpret_cast<tbm_dummy_display*>(mDisplay));
-  }
-#endif
-  if(mBufMgr != nullptr)
-  {
-    tbm_bufmgr_deinit(mBufMgr);
-  }
 }
 
 } // namespace Adaptor
index da7c91a622fbd22e80a12bcd3a7529ad8bc1dc9b..bfbede6401e149b3c6c89adfee08e851f11a9e79 100644 (file)
@@ -19,7 +19,6 @@
  */
 
 // EXTERNAL INCLUDES
-#include <tbm_bufmgr.h>
 
 // INTERNAL INCLUDES
 #include <dali/internal/window-system/common/display-connection-impl.h>
@@ -105,7 +104,6 @@ protected:
 private:
   NativeDisplayType                               mDisplay;     ///< Wayland-display for rendering
   Dali::Integration::RenderSurfaceInterface::Type mSurfaceType; ///< The surface type
-  tbm_bufmgr                                      mBufMgr;      ///< For creating tbm_dummy_display
 };
 
 } // namespace Adaptor
index 4c96a617b51c673d96be4a870b95c3240f0fa557..0915a103d43e3dc203ff8e784096852010e516f5 100644 (file)
@@ -93,7 +93,7 @@ bool Capture::IsExclusive() const
   return GetImpl(*this).IsExclusive();
 }
 
-Dali::NativeImageSourcePtr Capture::GetNativeImageSource() const
+Dali::NativeImageSourcePtr Capture::GetNativeImageSource()
 {
   return GetImpl(*this).GetNativeImageSource();
 }
index 6f133da644b25f27c18f1d058c0be339a9f81ed9..c719e477c5bf489e0196c8034b85facae7d4d716 100644 (file)
@@ -271,13 +271,15 @@ public:
    * @SINCE_1_9.10
    *
    * @return NativeImageSourcePtr Captured result that can be rendered with DALi
+   * @note GetNativeImageSource is only available inside FinishedSignal.
    */
-  Dali::NativeImageSourcePtr GetNativeImageSource() const;
+  Dali::NativeImageSourcePtr GetNativeImageSource();
 
   /**
    * @brief Get Texture of captured image.
    *
    * @return Texture Captured result
+   * @note GetTexture is only available inside FinishedSignal.
    */
   Dali::Texture GetTexture() const;