From 3d372aa910ecc36a50925e4f559e65d000e5eff3 Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Tue, 17 May 2016 14:55:11 +0900 Subject: [PATCH] pepper-dali update 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 --- configure.ac | 2 +- packaging/pepper-dali.spec | 1 + pepper-dali/Makefile.am | 2 +- pepper-dali/internal/compositor-impl.cpp | 1 + pepper-dali/internal/object-view-impl.cpp | 28 +++++++++ pepper-dali/internal/object-view-impl.h | 10 +++ pepper-dali/internal/output-impl.cpp | 71 ++++++---------------- pepper-dali/internal/output-impl.h | 40 ++---------- pepper-dali/internal/shell-client-impl.cpp | 30 +++++++-- pepper-dali/internal/shell-client-impl.h | 5 +- pepper-dali/public-api/object-view/object-view.cpp | 10 +++ pepper-dali/public-api/object-view/object-view.h | 14 +++++ 12 files changed, 121 insertions(+), 93 deletions(-) diff --git a/configure.ac b/configure.ac index 314c014..e869ebe 100644 --- a/configure.ac +++ b/configure.ac @@ -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]) diff --git a/packaging/pepper-dali.spec b/packaging/pepper-dali.spec index 9e47b85..e33c782 100644 --- a/packaging/pepper-dali.spec +++ b/packaging/pepper-dali.spec @@ -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) diff --git a/pepper-dali/Makefile.am b/pepper-dali/Makefile.am index ec7b784..2b748ad 100644 --- a/pepper-dali/Makefile.am +++ b/pepper-dali/Makefile.am @@ -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@ \ diff --git a/pepper-dali/internal/compositor-impl.cpp b/pepper-dali/internal/compositor-impl.cpp index a458cbe..cd59b11 100644 --- a/pepper-dali/internal/compositor-impl.cpp +++ b/pepper-dali/internal/compositor-impl.cpp @@ -21,6 +21,7 @@ // EXTERNAL INCLUDES #include #include +#include #include #include diff --git a/pepper-dali/internal/object-view-impl.cpp b/pepper-dali/internal/object-view-impl.cpp index b03122b..83cfdb8 100644 --- a/pepper-dali/internal/object-view-impl.cpp +++ b/pepper-dali/internal/object-view-impl.cpp @@ -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; diff --git a/pepper-dali/internal/object-view-impl.h b/pepper-dali/internal/object-view-impl.h index eabe70e..6ffe97a 100644 --- a/pepper-dali/internal/object-view-impl.h +++ b/pepper-dali/internal/object-view-impl.h @@ -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 ); diff --git a/pepper-dali/internal/output-impl.cpp b/pepper-dali/internal/output-impl.cpp index 2acb8ce..8051371 100644 --- a/pepper-dali/internal/output-impl.cpp +++ b/pepper-dali/internal/output-impl.cpp @@ -24,6 +24,8 @@ // EXTERNAL INCLUDES #include #include +#include +#include #include 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 diff --git a/pepper-dali/internal/output-impl.h b/pepper-dali/internal/output-impl.h index 4dc66bb..a238138 100644 --- a/pepper-dali/internal/output-impl.h +++ b/pepper-dali/internal/output-impl.h @@ -27,12 +27,8 @@ #include #include #include -#include #include -// TODO: temp -#include - namespace Dali { @@ -45,7 +41,7 @@ namespace Internal class Output; typedef IntrusivePtr 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 diff --git a/pepper-dali/internal/shell-client-impl.cpp b/pepper-dali/internal/shell-client-impl.cpp index 33ff32d..f57ee5a 100644 --- a/pepper-dali/internal/shell-client-impl.cpp +++ b/pepper-dali/internal/shell-client-impl.cpp @@ -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" ); } } diff --git a/pepper-dali/internal/shell-client-impl.h b/pepper-dali/internal/shell-client-impl.h index 273c2b2..6234e28 100644 --- a/pepper-dali/internal/shell-client-impl.h +++ b/pepper-dali/internal/shell-client-impl.h @@ -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; diff --git a/pepper-dali/public-api/object-view/object-view.cpp b/pepper-dali/public-api/object-view/object-view.cpp index 8c8b3fd..eb6f0df 100644 --- a/pepper-dali/public-api/object-view/object-view.cpp +++ b/pepper-dali/public-api/object-view/object-view.cpp @@ -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 ) { diff --git a/pepper-dali/public-api/object-view/object-view.h b/pepper-dali/public-api/object-view/object-view.h index cbbe31e..2252d6e 100644 --- a/pepper-dali/public-api/object-view/object-view.h +++ b/pepper-dali/public-api/object-view/object-view.h @@ -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 /** -- 2.7.4