pepper-dali update 60/69860/1 accepted/tizen/common/20160517.174332 accepted/tizen/ivi/20160518.004132 accepted/tizen/mobile/20160518.004329 accepted/tizen/tv/20160518.004208 accepted/tizen/wearable/20160518.004147 submit/tizen/20160517.084439
authorHeeyong Song <heeyong.song@samsung.com>
Tue, 17 May 2016 05:55:11 +0000 (14:55 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Tue, 17 May 2016 05:55:11 +0000 (14:55 +0900)
1. Change post render callback
2. Add API to change the map state of pepper_view according to visible state of ObjectView
3. Change to repaint object at the time of buffer attached

Change-Id: I32a88f9d6a2be57d40d1374a4edd879a22e71741

12 files changed:
configure.ac
packaging/pepper-dali.spec
pepper-dali/Makefile.am
pepper-dali/internal/compositor-impl.cpp
pepper-dali/internal/object-view-impl.cpp
pepper-dali/internal/object-view-impl.h
pepper-dali/internal/output-impl.cpp
pepper-dali/internal/output-impl.h
pepper-dali/internal/shell-client-impl.cpp
pepper-dali/internal/shell-client-impl.h
pepper-dali/public-api/object-view/object-view.cpp
pepper-dali/public-api/object-view/object-view.h

index 314c014..e869ebe 100644 (file)
@@ -15,7 +15,7 @@ AC_PROG_LIBTOOL
 # Checks for libraries.
 PKG_CHECK_MODULES([PEPPER], [pepper xkbcommon])
 PKG_CHECK_MODULES([WAYLAND], [wayland-server xdg-shell-server tizen-extension-client])
-PKG_CHECK_MODULES([DALI], [dali-core dali-adaptor dali-toolkit])
+PKG_CHECK_MODULES([DALI], [dali-core dali-adaptor dali-toolkit dali-adaptor-integration])
 PKG_CHECK_MODULES([EFL], [ecore ecore-input ecore-wayland])
 PKG_CHECK_MODULES([WAYLAND_TBM], [wayland-tbm-server])
 
index 9e47b85..e33c782 100644 (file)
@@ -9,6 +9,7 @@ Source:     %{name}-%{version}.tar.xz
 
 BuildRequires: pkgconfig(dali-core)
 BuildRequires: pkgconfig(dali-adaptor)
+BuildRequires: pkgconfig(dali-adaptor-integration)
 BuildRequires: pkgconfig(dali-toolkit)
 BuildRequires: pkgconfig(wayland-server)
 BuildRequires: pkgconfig(pepper)
index ec7b784..2b748ad 100644 (file)
@@ -16,7 +16,7 @@ libpepper_dali_la_LIBADD = @DALI_LIBS@ @WAYLAND_LIBS@ @PEPPER_LIBS@ @WAYLAND_TBM
 libpepper_dali_la_LDFLAGS = ${LDFLAGS}
 libpepper_dali_la_CXXFLAGS = \
     ${CFLAGS} \
-    $(DALICORE_CFLAGS) \
+    $(DALI_CFLAGS) \
     @EFL_CFLAGS@ \
     @WAYLAND_CFLAGS@ \
     @PEPPER_CFLAGS@ \
index a458cbe..cd59b11 100644 (file)
@@ -21,6 +21,7 @@
 // EXTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
 #include <wayland-server.h>
+#include <wayland-tbm-server.h>
 #include <tizen-extension-client-protocol.h>
 #include <Ecore_Wayland.h>
 
index b03122b..83cfdb8 100644 (file)
@@ -158,6 +158,34 @@ bool ObjectView::CancelTouchEvent()
   return true;
 }
 
+void ObjectView::Show()
+{
+  if( mSurface )
+  {
+    Pepper::Internal::ShellClientPtr shellClient = reinterpret_cast< Pepper::Internal::ShellClient* >( pepper_object_get_user_data( reinterpret_cast< pepper_object_t* >( mSurface ), pepper_surface_get_role( mSurface ) ) );
+    if( shellClient )
+    {
+      shellClient->MapSurface();
+    }
+  }
+
+  Self().SetVisible( true );
+}
+
+void ObjectView::Hide()
+{
+  if( mSurface )
+  {
+    Pepper::Internal::ShellClientPtr shellClient = reinterpret_cast< Pepper::Internal::ShellClient* >( pepper_object_get_user_data( reinterpret_cast< pepper_object_t* >( mSurface ), pepper_surface_get_role( mSurface ) ) );
+    if( shellClient )
+    {
+      shellClient->UnmapSurface();
+    }
+  }
+
+  Self().SetVisible( false );
+}
+
 void ObjectView::SetSurface( pepper_surface_t* surface )
 {
   mSurface = surface;
index eabe70e..6ffe97a 100644 (file)
@@ -71,6 +71,16 @@ public:
   bool CancelTouchEvent();
 
   /**
+   * @copydoc Dali::Pepper::ObjectView::Show
+   */
+  void Show();
+
+  /**
+   * @copydoc Dali::Pepper::ObjectView::Hide
+   */
+  void Hide();
+
+  /**
    * Set pepper surface
    */
   void SetSurface( pepper_surface_t* surface );
index 2acb8ce..8051371 100644 (file)
@@ -24,6 +24,8 @@
 // EXTERNAL INCLUDES
 #include <dali/integration-api/adaptors/adaptor.h>
 #include <dali/devel-api/adaptor-framework/render-surface.h>
+#include <dali/integration-api/adaptors/ecore-wl-render-surface.h>
+#include <dali/integration-api/adaptors/trigger-event-factory.h>
 #include <dali/integration-api/debug.h>
 
 namespace Dali
@@ -58,7 +60,7 @@ static const struct pepper_output_backend outputInterface =
   Output::OnStartRepaintLoop,
   Output::OnRepaint,
   Output::OnAttachSurface,
-  Output::OnFlushSurface
+  Output::OnFlushSurfaceDamage
 };
 
 } // unnamed namespace
@@ -77,7 +79,7 @@ Output::Output()
 : mSize(),
   mOutput( NULL ),
   mPrimaryPlane( NULL ),
-  mRepaintRequest( false )
+  mBufferAttached( false )
 {
 }
 
@@ -113,8 +115,16 @@ void Output::Initialize( Pepper::Compositor& compositor, Application application
 
   application.ResizeSignal().Connect( this, &Output::OnResize );
 
-  // Set the thread-synchronization interface on the render-surface
-  surface.SetThreadSynchronization( *this );
+  // Sets the render notification trigger to call when rendering is completed a frame
+  TriggerEventFactory triggerEventFactory;
+  TriggerEventInterface* renderNotification = triggerEventFactory.CreateTriggerEvent( MakeCallback( this, &Output::OnPostRender ),
+                                                                                      TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER );
+
+  ECore::EcoreWlRenderSurface* renderSurface = dynamic_cast< ECore::EcoreWlRenderSurface* >( &surface );
+  if( renderSurface )
+  {
+    renderSurface->SetRenderNotification( renderNotification );
+  }
 
   DALI_LOG_INFO( gPepperOutputLogging, Debug::Verbose, "Output::Initialize: success [width = %.2f height = %.2f]\n", mSize.width, mSize.height );
 }
@@ -199,20 +209,6 @@ void Output::OnStartRepaintLoop( void* data )
 
 void Output::OnRepaint( void* data, const pepper_list_t* planeList )
 {
-  Output* output = static_cast< Output* >( data );
-
-  DALI_LOG_INFO( gPepperOutputLogging, Debug::Verbose, "Output::OnRepaint\n" );
-
-  output->mRepaintRequest = true;
-
-  // TODO: temp
-  if( !output->mRenderFinishTimer )
-  {
-    output->mRenderFinishTimer= Timer::New(1);
-    output->mRenderFinishTimer.TickSignal().Connect( output, &Output::OnRenderFinishTimerTick );
-  }
-
-  output->mRenderFinishTimer.Start();
 }
 
 void Output::OnAttachSurface( void* data, pepper_surface_t* surface, int* width, int* height )
@@ -248,14 +244,10 @@ void Output::OnAttachSurface( void* data, pepper_surface_t* surface, int* width,
     *height = 0;
   }
 
-  // TODO: temp
-  struct timespec ts;
-
-  pepper_compositor_get_time( static_cast< pepper_compositor_t* >( Pepper::GetImplementation( output->mCompositor ).GetCompositorHandle() ), &ts );
-  pepper_output_finish_frame( output->mOutput, &ts );
+  output->mBufferAttached = true;
 }
 
-void Output::OnFlushSurface( void* data, pepper_surface_t* surface, pepper_bool_t* keepBuffer )
+void Output::OnFlushSurfaceDamage( void* data, pepper_surface_t* surface, pepper_bool_t* keepBuffer )
 {
 }
 
@@ -301,44 +293,21 @@ void Output::OnObjectViewDeleted( Pepper::Object object, Pepper::ObjectView obje
   }
 }
 
-void Output::PostRenderComplete()
+void Output::OnPostRender()
 {
-  if( mRepaintRequest )
+  if( mBufferAttached )
   {
     struct timespec ts;
 
-    DALI_LOG_INFO( gPepperOutputLogging, Debug::Verbose, "Output::PostRenderComplete" );
+    DALI_LOG_INFO( gPepperOutputLogging, Debug::Verbose, "Output::OnPostRender" );
 
     pepper_compositor_get_time( static_cast< pepper_compositor_t* >( Pepper::GetImplementation( mCompositor ).GetCompositorHandle() ), &ts );
     pepper_output_finish_frame( mOutput, &ts );
 
-    mRepaintRequest = false;
+    mBufferAttached = false;
   }
 }
 
-void Output::PostRenderStarted()
-{
-  // Do nothing
-}
-
-void Output::PostRenderWaitForCompletion()
-{
-  // Do nothing
-}
-
-// TODO: temp
-bool Output::OnRenderFinishTimerTick()
-{
-  struct timespec ts;
-
-  DALI_LOG_INFO( gPepperOutputLogging, Debug::Verbose, "Output::OnRenderFinishTimerTick\n" );
-
-  pepper_compositor_get_time( static_cast< pepper_compositor_t* >( Pepper::GetImplementation( mCompositor ).GetCompositorHandle() ), &ts );
-  pepper_output_finish_frame( mOutput, &ts );
-
-  return false;
-}
-
 } // namespace Internal
 
 } // namespace Pepper
index 4dc66bb..a238138 100644 (file)
 #include <dali/public-api/common/vector-wrapper.h>
 #include <dali/public-api/object/base-object.h>
 #include <dali/public-api/signals/connection-tracker.h>
-#include <dali/integration-api/adaptors/thread-synchronization-interface.h>
 #include <pepper-output-backend.h>
 
-// TODO: temp
-#include <dali/public-api/adaptor-framework/timer.h>
-
 namespace Dali
 {
 
@@ -45,7 +41,7 @@ namespace Internal
 class Output;
 typedef IntrusivePtr<Output> OutputPtr;
 
-class Output : public BaseObject, public ConnectionTracker, public ThreadSynchronizationInterface
+class Output : public BaseObject, public ConnectionTracker
 {
 public:
 
@@ -62,7 +58,7 @@ public:
   static void OnStartRepaintLoop( void* data );
   static void OnRepaint( void* data, const pepper_list_t* planeList );
   static void OnAttachSurface( void* data, pepper_surface_t* surface, int* width, int* height );
-  static void OnFlushSurface( void* data, pepper_surface_t* surface, pepper_bool_t* keepBuffer );
+  static void OnFlushSurfaceDamage( void* data, pepper_surface_t* surface, pepper_bool_t* keepBuffer );
 
 public: //Signals
 
@@ -91,33 +87,10 @@ private:
   void OnObjectViewAdded( Pepper::Object object, Pepper::ObjectView objectView );
   void OnObjectViewDeleted( Pepper::Object object, Pepper::ObjectView objectView );
 
-private: // From ThreadSynchronizationInterface
-
-  /////////////////////////////////////////////////////////////////////////////////////////////////
-  // Called by the Event Thread if post-rendering is required
-  /////////////////////////////////////////////////////////////////////////////////////////////////
-
-  /**
-   * @copydoc ThreadSynchronizationInterface::PostRenderComplete()
-   */
-  virtual void PostRenderComplete();
-
-  /////////////////////////////////////////////////////////////////////////////////////////////////
-  //// Called by the Render Thread if post-rendering is required
-  /////////////////////////////////////////////////////////////////////////////////////////////////
-
-  /**
-   * @copydoc ThreadSynchronizationInterface::PostRenderStarted()
-   */
-  virtual void PostRenderStarted();
-
   /**
-   * @copydoc ThreadSynchronizationInterface::PostRenderStarted()
+   * Callback function that is called when render thread is completed a frame
    */
-  virtual void PostRenderWaitForCompletion();
-
-  // TODO: temp
-  bool OnRenderFinishTimerTick();
+  void OnPostRender();
 
 private:
 
@@ -143,10 +116,7 @@ private: // Data
   Pepper::Output::OutputSignalType mObjectViewAddedSignal;
   Pepper::Output::OutputSignalType mObjectViewDeletedSignal;
 
-  bool mRepaintRequest;
-
-  // TODO: temp
-  Timer mRenderFinishTimer;
+  bool mBufferAttached;
 };
 
 } // namespace Internal
index 33ff32d..f57ee5a 100644 (file)
@@ -178,7 +178,7 @@ ShellClient::ShellClient()
   mSurfaceCommitListener( NULL ),
   mTitle(),
   mAppId(),
-  mSurfaceMapped( false ),
+  mNeedSurfaceMap( false ),
   mAckConfigure( false ),
   mConfigureCallback( NULL ),
   mConfigureCallbackData( NULL ),
@@ -293,7 +293,7 @@ void ShellClient::GetSurface( wl_client* client, unsigned int id, wl_resource* s
 
   mSurfaceCommitListener = pepper_object_add_event_listener( reinterpret_cast< pepper_object_t* >( mSurface ), PEPPER_EVENT_SURFACE_COMMIT, 0, ShellClient::OnSurfaceCommit, this );
 
-  mSurfaceMapped = false;
+  mNeedSurfaceMap = true;
 
   pepper_surface_set_role( mSurface, "xdg_surface" );
 
@@ -322,6 +322,28 @@ const std::string& ShellClient::GetAppId() const
   return mAppId;
 }
 
+void ShellClient::MapSurface()
+{
+  if( !mNeedSurfaceMap )
+  {
+    pepper_view_map( mView );
+    mNeedSurfaceMap = true;
+
+    DALI_LOG_INFO( gPepperShellClientLogging, Debug::Verbose, "ShellClient::MapSurface: view is mapped.\n" );
+  }
+}
+
+void ShellClient::UnmapSurface()
+{
+  if( mNeedSurfaceMap )
+  {
+    pepper_view_unmap( mView );
+    mNeedSurfaceMap = false;
+
+    DALI_LOG_INFO( gPepperShellClientLogging, Debug::Verbose, "ShellClient::UnmapSurface: view is unmapped.\n" );
+  }
+}
+
 void ShellClient::SurfaceResourceDestroy( struct wl_resource* resource )
 {
   ShellClient* shellClient = static_cast< ShellClient* >( wl_resource_get_user_data( resource ) );
@@ -361,11 +383,11 @@ void ShellClient::OnSurfaceCommit( pepper_event_listener_t* listener, pepper_obj
 {
   ShellClient* shellClient = static_cast< ShellClient* >( data );
 
-  if( !shellClient->mSurfaceMapped )
+  if( shellClient->mNeedSurfaceMap && !pepper_view_is_mapped( shellClient->mView ) )
   {
     pepper_view_map( shellClient->mView );
 
-    shellClient->mSurfaceMapped = true;
+    DALI_LOG_INFO( gPepperShellClientLogging, Debug::Verbose, "ShellClient::OnSurfaceCommit: view is mapped.\n" );
   }
 }
 
index 273c2b2..6234e28 100644 (file)
@@ -59,6 +59,9 @@ public:
   void SetAppId( const std::string& appId );
   const std::string& GetAppId() const;
 
+  void MapSurface();
+  void UnmapSurface();
+
 private:
 
   /**
@@ -104,7 +107,7 @@ private: // Data
   std::string mTitle;
   std::string mAppId;
 
-  bool mSurfaceMapped;
+  bool mNeedSurfaceMap;
   bool mAckConfigure;
 
   ConfigureCallback mConfigureCallback;
index 8c8b3fd..eb6f0df 100644 (file)
@@ -84,6 +84,16 @@ bool ObjectView::CancelTouchEvent()
   return Dali::Pepper::GetImplementation( *this ).CancelTouchEvent();
 }
 
+void ObjectView::Show()
+{
+  Dali::Pepper::GetImplementation( *this ).Show();
+}
+
+void ObjectView::Hide()
+{
+  Dali::Pepper::GetImplementation( *this ).Hide();
+}
+
 ObjectView::ObjectView( Internal::ObjectView& implementation )
 : Control( implementation )
 {
index cbbe31e..2252d6e 100644 (file)
@@ -139,6 +139,20 @@ public:
    */
   bool CancelTouchEvent();
 
+  /**
+   * @brief Shows the ObjectView
+   *
+   * @since_tizen 3.0
+   */
+  void Show();
+
+  /**
+   * @brief Hides the ObjectView
+   *
+   * @since_tizen 3.0
+   */
+  void Hide();
+
 public: // Not intended for application developers
 
   /**