From 3d1a904d8ff7d8213dd0936fafd44f062ed3de4c Mon Sep 17 00:00:00 2001 From: suhyung Eom Date: Tue, 22 Nov 2016 19:34:02 +0900 Subject: [PATCH] [3.0] Modify to use remote-surface for WatchApplication Signed-off-by: suhyung Eom Change-Id: I1a427e54f82906cdf1eed75ce643875306d23e9e --- adaptors/common/adaptor-impl.cpp | 11 ++++++++++- adaptors/common/adaptor-impl.h | 12 ++++++++++++ adaptors/common/application-impl.cpp | 3 +++ adaptors/common/application-impl.h | 1 + adaptors/tizen/adaptor-impl-tizen.cpp | 19 ++++++++++++++++++- adaptors/ubuntu/adaptor-impl-ubuntu.cpp | 4 ++++ 6 files changed, 48 insertions(+), 2 deletions(-) diff --git a/adaptors/common/adaptor-impl.cpp b/adaptors/common/adaptor-impl.cpp index a24c54c..6e59fbb 100644 --- a/adaptors/common/adaptor-impl.cpp +++ b/adaptors/common/adaptor-impl.cpp @@ -618,6 +618,11 @@ Any Adaptor::GetNativeWindowHandle() return mNativeWindow; } +void Adaptor::SetUseRemoteSurface(bool useRemoteSurface) +{ + mUseRemoteSurface = useRemoteSurface; +} + void Adaptor::AddObserver( LifeCycleObserver& observer ) { ObserverContainer::iterator match ( find(mObservers.begin(), mObservers.end(), &observer) ); @@ -731,6 +736,9 @@ void Adaptor::NotifySceneCreated() // Start thread controller after the scene has been created mThreadController->Start(); + + // process after surface is created (registering to remote surface provider if required) + SurfaceInitialized(); } void Adaptor::NotifyLanguageChanged() @@ -789,7 +797,8 @@ Adaptor::Adaptor(Any nativeWindow, Dali::Adaptor& adaptor, RenderSurface* surfac mTriggerEventFactory(), mObjectProfiler( NULL ), mSocketFactory(), - mEnvironmentOptionsOwned( environmentOptions ? false : true /* If not provided then we own the object */ ) + mEnvironmentOptionsOwned( environmentOptions ? false : true /* If not provided then we own the object */ ), + mUseRemoteSurface( false ) { DALI_ASSERT_ALWAYS( !IsAvailable() && "Cannot create more than one Adaptor per thread" ); gThreadLocalAdaptor = this; diff --git a/adaptors/common/adaptor-impl.h b/adaptors/common/adaptor-impl.h index 62d21fa..b2bd30a 100644 --- a/adaptors/common/adaptor-impl.h +++ b/adaptors/common/adaptor-impl.h @@ -293,6 +293,12 @@ public: */ Any GetNativeWindowHandle(); + /** + * Sets use remote surface for eglSurface output + * @param[in] useRemoteSurface True if the remote surface is used + */ + void SetUseRemoteSurface(bool useRemoteSurface); + public: /** @@ -495,6 +501,11 @@ private: void SetSurface(RenderSurface *surface); /** + * called after surface is created + */ + void SurfaceInitialized(); + + /** * Sends an notification message from main loop idle handler */ void ProcessCoreEventsFromIdle(); @@ -568,6 +579,7 @@ private: // Data ObjectProfiler* mObjectProfiler; ///< Tracks object lifetime for profiling SocketFactory mSocketFactory; ///< Socket factory const bool mEnvironmentOptionsOwned:1; ///< Whether we own the EnvironmentOptions (and thus, need to delete it) + bool mUseRemoteSurface; ///< whether the remoteSurface is used or not public: inline static Adaptor& GetImplementation(Dali::Adaptor& adaptor) {return *adaptor.mImpl;} }; diff --git a/adaptors/common/application-impl.cpp b/adaptors/common/application-impl.cpp index e43871f..c3cdd1e 100644 --- a/adaptors/common/application-impl.cpp +++ b/adaptors/common/application-impl.cpp @@ -94,6 +94,7 @@ Application::Application( int* argc, char** argv[], const std::string& styleshee mCommandLineOptions = new CommandLineOptions(argc, argv); mFramework = new Framework( *this, argc, argv, applicationType ); + mUseRemoteSurface = (applicationType == Framework::WATCH); } Application::~Application() @@ -135,6 +136,8 @@ void Application::CreateAdaptor() mAdaptor = Dali::Internal::Adaptor::Adaptor::New( mWindow, mContextLossConfiguration, &mEnvironmentOptions ); mAdaptor->ResizedSignal().Connect( mSlotDelegate, &Application::OnResize ); + + Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).SetUseRemoteSurface( mUseRemoteSurface ); } void Application::MainLoop(Dali::Configuration::ContextLoss configuration) diff --git a/adaptors/common/application-impl.h b/adaptors/common/application-impl.h index 68de173..8c1de19 100644 --- a/adaptors/common/application-impl.h +++ b/adaptors/common/application-impl.h @@ -309,6 +309,7 @@ private: std::string mName; std::string mStylesheet; EnvironmentOptions mEnvironmentOptions; + bool mUseRemoteSurface; SlotDelegate< Application > mSlotDelegate; }; diff --git a/adaptors/tizen/adaptor-impl-tizen.cpp b/adaptors/tizen/adaptor-impl-tizen.cpp index b4a56eb..cd002cd 100644 --- a/adaptors/tizen/adaptor-impl-tizen.cpp +++ b/adaptors/tizen/adaptor-impl-tizen.cpp @@ -19,8 +19,10 @@ #include // EXTERNAL INCLUDES -#ifdef USE_APPFW #include +#ifdef APPCORE_WATCH_AVAILABLE +#include +#include #endif namespace Dali @@ -65,6 +67,21 @@ void Adaptor::GetAppId( std::string& appId ) #endif } +void Adaptor::SurfaceInitialized() +{ +#ifdef APPCORE_WATCH_AVAILABLE + if ( !mUseRemoteSurface ) + { + return; + } + char *appId; + app_get_id(&appId); + + Ecore_Wl_Window* ecoreWlWindow = AnyCast( mNativeWindow ); + aul_rsm_provider_remote_enable(appId, ecore_wl_window_surface_get(ecoreWlWindow)); +#endif +} + } // namespace Adaptor } // namespace Internal diff --git a/adaptors/ubuntu/adaptor-impl-ubuntu.cpp b/adaptors/ubuntu/adaptor-impl-ubuntu.cpp index 7574dc7..be25b7b 100644 --- a/adaptors/ubuntu/adaptor-impl-ubuntu.cpp +++ b/adaptors/ubuntu/adaptor-impl-ubuntu.cpp @@ -37,6 +37,10 @@ void Adaptor::GetAppId( std::string& appId ) appId = ""; } +void Adaptor::SurfaceInitialized() +{ +} + } // namespace Adaptor } // namespace Internal -- 2.7.4