From 73cfc403e64bb7a85251a6b26a21622b1cf6dc2f Mon Sep 17 00:00:00 2001 From: Jonghyun Ho Date: Mon, 30 Mar 2015 11:57:23 +0900 Subject: [PATCH] Separating integration-devel from devel package for 2nd party to use adaptor #2 (touch issue fixed) - hidden for 3rd party Change-Id: I6cff9c9bd9d17aa465096175ed3eb915a00e6832 --- adaptors/base/display-connection.cpp | 75 ++++++++ adaptors/base/display-connection.h | 107 +++++++++++ adaptors/base/file.list | 1 + .../base/interfaces/adaptor-internal-services.h | 5 +- adaptors/base/interfaces/egl-factory-interface.h | 4 +- .../networking/network-performance-client.h | 2 +- adaptors/base/render-thread.cpp | 37 ++-- adaptors/base/render-thread.h | 27 +-- adaptors/base/update-render-controller.cpp | 1 - adaptors/base/update-render-controller.h | 3 +- adaptors/base/update-render-synchronization.h | 5 +- adaptors/common/adaptor-impl.cpp | 49 +++--- adaptors/common/adaptor-impl.h | 46 +++-- adaptors/common/adaptor.cpp | 38 +++- adaptors/common/application-impl.cpp | 4 +- adaptors/common/events/event-handler.h | 3 +- adaptors/common/file.list | 1 - adaptors/common/gl/egl-implementation.h | 18 +- adaptors/common/render-surface-impl.cpp | 45 ----- adaptors/common/render-surface-impl.h | 167 ------------------ adaptors/common/trigger-event-factory.cpp | 18 +- adaptors/common/trigger-event.h | 2 +- adaptors/common/window-impl.h | 2 +- adaptors/{common => integration-api}/adaptor.h | 66 ++++++- .../interfaces => integration-api}/egl-interface.h | 18 +- adaptors/integration-api/file.list | 17 ++ .../pixmap-render-surface-factory.h} | 36 ++-- .../trigger-event-factory-interface.h | 22 +-- .../trigger-event-factory.h | 21 +-- .../trigger-event-interface.h | 17 +- .../wayland/ecore-wl-render-surface.h | 131 +++++--------- .../{ => integration-api}/wayland/ecore-wl-types.h | 16 +- .../wayland/pixmap-render-surface.h | 57 +++--- .../x11/ecore-x-render-surface.h | 128 +++++--------- adaptors/{ => integration-api}/x11/ecore-x-types.h | 16 +- .../x11/pixmap-render-surface.h | 65 +++---- adaptors/mobile/file.list | 2 +- ...ctory.cpp => pixmap-render-surface-factory.cpp} | 23 +-- .../public-api/adaptor-framework/render-surface.h | 104 ++++++++--- .../adaptor-framework/singleton-service.cpp | 5 + .../adaptor-framework/singleton-service.h | 7 + adaptors/tv/tv-render-surface-factory.cpp | 15 +- adaptors/wayland/display-connection-impl-wl.cpp | 94 ++++++++++ adaptors/wayland/display-connection-impl.h | 109 ++++++++++++ adaptors/wayland/ecore-wl-render-surface.cpp | 157 +++-------------- adaptors/wayland/egl-implementation-wl.cpp | 92 ++-------- adaptors/wayland/event-handler-wl.cpp | 11 +- adaptors/wayland/file.list | 1 + adaptors/wayland/imf-manager-impl.h | 4 +- adaptors/wayland/pixmap-render-surface-wl.cpp | 57 +++--- adaptors/wayland/window-impl-wl.cpp | 7 +- adaptors/wayland/window-render-surface-wl.cpp | 46 ++--- adaptors/wayland/window-render-surface.h | 63 +++---- adaptors/x11/clipboard-impl-x.cpp | 24 +-- adaptors/x11/display-connection-impl-x.cpp | 115 ++++++++++++ adaptors/x11/display-connection-impl.h | 108 ++++++++++++ adaptors/x11/ecore-x-render-surface-factory.cpp | 20 +-- adaptors/x11/ecore-x-render-surface.cpp | 195 +++------------------ adaptors/x11/egl-implementation-x.cpp | 81 ++------- adaptors/x11/event-handler-x.cpp | 14 +- adaptors/x11/file.list | 1 + adaptors/x11/imf-manager-impl-x.cpp | 24 +-- adaptors/x11/imf-manager-impl.h | 4 +- adaptors/x11/pixmap-render-surface-x.cpp | 75 ++++---- adaptors/x11/window-impl-x.cpp | 9 +- adaptors/x11/window-render-surface-x.cpp | 64 +++---- adaptors/x11/window-render-surface.h | 63 +++---- build/tizen/adaptor/Makefile.am | 38 +++- build/tizen/adaptor/dali-adaptor-integration.pc.in | 12 ++ build/tizen/configure.ac | 1 + build/tizen/plugins/Makefile.am | 1 + packaging/dali-adaptor-mobile.spec | 22 ++- packaging/dali-adaptor.spec | 23 ++- 73 files changed, 1466 insertions(+), 1495 deletions(-) create mode 100644 adaptors/base/display-connection.cpp create mode 100644 adaptors/base/display-connection.h delete mode 100644 adaptors/common/render-surface-impl.cpp delete mode 100644 adaptors/common/render-surface-impl.h rename adaptors/{common => integration-api}/adaptor.h (79%) rename adaptors/{base/interfaces => integration-api}/egl-interface.h (84%) create mode 100644 adaptors/integration-api/file.list rename adaptors/{mobile/mobile-render-surface-factory.h => integration-api/pixmap-render-surface-factory.h} (58%) rename adaptors/{base/interfaces => integration-api}/trigger-event-factory-interface.h (83%) rename adaptors/{common => integration-api}/trigger-event-factory.h (76%) rename adaptors/{base/interfaces => integration-api}/trigger-event-interface.h (85%) rename adaptors/{ => integration-api}/wayland/ecore-wl-render-surface.h (52%) rename adaptors/{ => integration-api}/wayland/ecore-wl-types.h (78%) rename adaptors/{ => integration-api}/wayland/pixmap-render-surface.h (66%) rename adaptors/{ => integration-api}/x11/ecore-x-render-surface.h (53%) rename adaptors/{ => integration-api}/x11/ecore-x-types.h (79%) rename adaptors/{ => integration-api}/x11/pixmap-render-surface.h (68%) rename adaptors/mobile/{mobile-render-surface-factory.cpp => pixmap-render-surface-factory.cpp} (65%) create mode 100644 adaptors/wayland/display-connection-impl-wl.cpp create mode 100644 adaptors/wayland/display-connection-impl.h create mode 100644 adaptors/x11/display-connection-impl-x.cpp create mode 100644 adaptors/x11/display-connection-impl.h create mode 100644 build/tizen/adaptor/dali-adaptor-integration.pc.in diff --git a/adaptors/base/display-connection.cpp b/adaptors/base/display-connection.cpp new file mode 100644 index 0000000..e69ef62 --- /dev/null +++ b/adaptors/base/display-connection.cpp @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2015 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// CLASS HEADER +#include + +// EXTERNAL INCLUDES + +// INTERNAL INCLUDES +#include +#include + +namespace Dali +{ + +DisplayConnection* DisplayConnection::New() +{ + Internal::Adaptor::DisplayConnection* internal(Internal::Adaptor::DisplayConnection::New()); + + return new DisplayConnection(internal); +} + +DisplayConnection::DisplayConnection() +{ +} + +DisplayConnection::DisplayConnection(Internal::Adaptor::DisplayConnection* impl) +: mImpl(impl) +{ +} + +DisplayConnection::~DisplayConnection() +{ + if (mImpl) + { + delete mImpl; + mImpl = NULL; + } +} + +Any DisplayConnection::GetDisplay() +{ + return mImpl->GetDisplay(); +} + +void DisplayConnection::GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) +{ + Internal::Adaptor::DisplayConnection::GetDpi(dpiHorizontal, dpiVertical); +} + +void DisplayConnection::ConsumeEvents() +{ + mImpl->ConsumeEvents(); +} + +bool DisplayConnection::InitializeEgl(EglInterface& egl) +{ + return mImpl->InitializeEgl(egl); +} + +} diff --git a/adaptors/base/display-connection.h b/adaptors/base/display-connection.h new file mode 100644 index 0000000..e38cc78 --- /dev/null +++ b/adaptors/base/display-connection.h @@ -0,0 +1,107 @@ +#ifndef __DALI_DISPLAY_CONNECTION_H__ +#define __DALI_DISPLAY_CONNECTION_H__ + +/* + * Copyright (c) 2015 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES + + +namespace Dali +{ + +class EglInterface; + +namespace Internal +{ + namespace Adaptor + { + class DisplayConnection; + } +} + +class DisplayConnection +{ +public: + + /** + * @brief Create an initialized DisplayConnection. + * + * @return A handle to a newly allocated DisplayConnection resource. + */ + static DisplayConnection* New(); + + /** + * @brief Create a DisplayConnection handle; this can be initialised with DisplayConnection::New(). + * + * Calling member functions with an uninitialised handle is not allowed. + */ + DisplayConnection(); + + /** + * @brief Destructor + * + * This is non-virtual since derived Handle types must not contain data or virtual methods. + */ + ~DisplayConnection(); + + /** + * @brief Get display + * + * @return display + */ + Any GetDisplay(); + + /** + * @brief Get DPI + * @param[out] dpiHorizontal set to the horizontal dpi + * @param[out] dpiVertical set to the vertical dpi + */ + static void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical); + + /** + * @brief Consumes any possible events on the queue so that there is no leaking between frames + */ + void ConsumeEvents(); + + /** + * @brief Initialize EGL display + * + * @param egl implementation to use for the creation + */ + bool InitializeEgl(EglInterface& egl); + +public: + + /** + * @brief This constructor is used by DisplayConnection New() methods. + * + * @param [in] handle A pointer to a newly allocated DisplayConnection resource + */ + explicit DALI_INTERNAL DisplayConnection(Internal::Adaptor::DisplayConnection* impl); + +private: + + Internal::Adaptor::DisplayConnection* mImpl; +}; + +} + +#endif // __DALI_DISPLAY_CONNECTION_H__ diff --git a/adaptors/base/file.list b/adaptors/base/file.list index 94c99d5..de1452d 100644 --- a/adaptors/base/file.list +++ b/adaptors/base/file.list @@ -2,6 +2,7 @@ base_adaptor_src_files = \ $(base_adaptor_src_dir)/frame-time.cpp \ + $(base_adaptor_src_dir)/display-connection.cpp \ $(base_adaptor_src_dir)/render-thread.cpp \ $(base_adaptor_src_dir)/update-thread.cpp \ $(base_adaptor_src_dir)/update-render-synchronization.cpp \ diff --git a/adaptors/base/interfaces/adaptor-internal-services.h b/adaptors/base/interfaces/adaptor-internal-services.h index d202da5..e0915e0 100644 --- a/adaptors/base/interfaces/adaptor-internal-services.h +++ b/adaptors/base/interfaces/adaptor-internal-services.h @@ -23,13 +23,14 @@ #include // INTERNAL INCLUDES +#include +#include #include -#include #include #include #include #include -#include // @todo move to base/interfaces +#include namespace Dali diff --git a/adaptors/base/interfaces/egl-factory-interface.h b/adaptors/base/interfaces/egl-factory-interface.h index 6c35bb8..42a6029 100644 --- a/adaptors/base/interfaces/egl-factory-interface.h +++ b/adaptors/base/interfaces/egl-factory-interface.h @@ -20,11 +20,13 @@ namespace Dali { + +class EglInterface; + namespace Internal { namespace Adaptor { -class EglInterface; /** * Factory interface for creating EGL implementation diff --git a/adaptors/base/performance-logging/networking/network-performance-client.h b/adaptors/base/performance-logging/networking/network-performance-client.h index 8784925..646b594 100644 --- a/adaptors/base/performance-logging/networking/network-performance-client.h +++ b/adaptors/base/performance-logging/networking/network-performance-client.h @@ -20,7 +20,7 @@ // INTERNAL INCLUDES #include -#include +#include #include #include diff --git a/adaptors/base/render-thread.cpp b/adaptors/base/render-thread.cpp index bf31e8f..7ef886b 100644 --- a/adaptors/base/render-thread.cpp +++ b/adaptors/base/render-thread.cpp @@ -25,7 +25,7 @@ #include #include #include - +#include namespace Dali { @@ -43,7 +43,6 @@ Integration::Log::Filter* gRenderLogFilter = Integration::Log::Filter::New(Debug #endif } - RenderRequest::RenderRequest(RenderRequest::Request type) : mRequestType(type) { @@ -96,10 +95,18 @@ RenderThread::RenderThread( UpdateRenderSynchronization& sync, { // set the initial values before render thread starts mSurface = adaptorInterfaces.GetRenderSurfaceInterface(); + + mDisplayConnection = Dali::DisplayConnection::New(); } RenderThread::~RenderThread() { + if (mDisplayConnection) + { + delete mDisplayConnection; + mDisplayConnection = NULL; + } + DALI_ASSERT_ALWAYS( mThread == NULL && "RenderThread is still alive"); mEglFactory->Destroy(); } @@ -164,8 +171,8 @@ bool RenderThread::Run() DALI_LOG_INFO( gRenderLogFilter, Debug::Verbose, "RenderThread::Run. 2 - Process requests\n"); - // Consume any pending events - ConsumeEvents(); + // Consume any pending events to avoid memory leaks + mDisplayConnection->ConsumeEvents(); bool processRequests = true; bool requestProcessed = false; @@ -227,31 +234,25 @@ void RenderThread::InitializeEgl() DALI_ASSERT_ALWAYS( mSurface && "NULL surface" ); // initialize egl & OpenGL + mDisplayConnection->InitializeEgl( *mEGL ); mSurface->InitializeEgl( *mEGL ); // create the OpenGL context mEGL->CreateContext(); // create the OpenGL surface - mSurface->CreateEglSurface( *mEGL ); + mSurface->CreateEglSurface(*mEGL); // Make it current mEGL->MakeContextCurrent(); // set the initial sync mode - // tell core it has a context mCore.ContextCreated(); } -void RenderThread::ConsumeEvents() -{ - // tell surface to consume any events to avoid memory leaks - mSurface->ConsumeEvents(); -} - bool RenderThread::ProcessRequest( RenderRequest* request ) { bool processedRequest = false; @@ -280,10 +281,11 @@ void RenderThread::ReplaceSurface( RenderSurface* newSurface ) // we need to delete the egl surface and renderable (pixmap / window) // Then create a new pixmap/window and new egl surface // If the new surface has a different display connection, then the context will be lost - DALI_ASSERT_ALWAYS( newSurface && "NULL surface" ); + DALI_ASSERT_ALWAYS(newSurface && "NULL surface"); - bool contextLost = newSurface->ReplaceEGLSurface( *mEGL ); + mDisplayConnection->InitializeEgl(*mEGL); + bool contextLost = newSurface->ReplaceEGLSurface(*mEGL); if( contextLost ) { DALI_LOG_WARNING("Context lost\n"); @@ -291,11 +293,6 @@ void RenderThread::ReplaceSurface( RenderSurface* newSurface ) mCore.ContextCreated(); } - // if both new and old surface are using the same display, and the display - // connection was created by Dali, then transfer - // display owner ship to the new surface. - mSurface->TransferDisplayOwner( *newSurface ); - // use the new surface from now on mSurface = newSurface; mSurfaceReplaced = true; @@ -330,7 +327,7 @@ void RenderThread::PostRender( unsigned int timeDelta ) mGLES.PostRender(timeDelta); // Inform the surface that rendering this frame has finished. - mSurface->PostRender( *mEGL, mGLES, timeDelta, mSurfaceReplaced ); + mSurface->PostRender( *mEGL, mGLES, mDisplayConnection, timeDelta, mSurfaceReplaced ); mSurfaceReplaced = false; } diff --git a/adaptors/base/render-thread.h b/adaptors/base/render-thread.h index 40463e5..246c3c6 100644 --- a/adaptors/base/render-thread.h +++ b/adaptors/base/render-thread.h @@ -22,13 +22,15 @@ #include // INTERNAL INCLUDES -#include -#include // needed for Dali::Internal::Adaptor::RenderSurface - +#include +#include // needed for Dali::RenderSurface namespace Dali { +class RenderSurface; +class DisplayConnection; + namespace Integration { class GlAbstraction; @@ -41,12 +43,10 @@ namespace Adaptor { class AdaptorInternalServices; -class RenderSurface; class UpdateRenderSynchronization; class EglFactoryInterface; class EnvironmentOptions; - class RenderRequest { public: @@ -118,16 +118,15 @@ public: * @param[in] sync update-render synchronization object * @param[in] adaptorInterfaces base adaptor interface * @param[in] environmentOptions environment options - */ RenderThread( UpdateRenderSynchronization& sync, AdaptorInternalServices& adaptorInterfaces, const EnvironmentOptions& environmentOptions ); /** - * Virtual Destructor + * Destructor */ - virtual ~RenderThread(); + ~RenderThread(); public: @@ -141,11 +140,6 @@ public: */ void Stop(); - /** - * Offscreen was posted to onscreen - */ - void RenderSync(); - private: // Render thread side helpers /** @@ -162,12 +156,6 @@ private: // Render thread side helpers void InitializeEgl(); /** - * Check if display has events - * Called from render thread - */ - void ConsumeEvents(); - - /** * Check if main thread made any requests, e.g. ReplaceSurface * Called from render thread * @return true if a request was processed, false otherwise. @@ -211,6 +199,7 @@ private: // Data EglInterface* mEGL; ///< Interface to EGL implementation boost::thread* mThread; ///< render thread RenderSurface* mSurface; ///< Current surface + Dali::DisplayConnection* mDisplayConnection; ///< Display connection const EnvironmentOptions& mEnvironmentOptions; ///< Environment options bool mSurfaceReplaced; ///< True when new surface has been initialzed. }; diff --git a/adaptors/base/update-render-controller.cpp b/adaptors/base/update-render-controller.cpp index ae773c5..dd80495 100644 --- a/adaptors/base/update-render-controller.cpp +++ b/adaptors/base/update-render-controller.cpp @@ -26,7 +26,6 @@ #include #include - namespace Dali { diff --git a/adaptors/base/update-render-controller.h b/adaptors/base/update-render-controller.h index 64839ff..a8ed9d1 100644 --- a/adaptors/base/update-render-controller.h +++ b/adaptors/base/update-render-controller.h @@ -21,6 +21,8 @@ namespace Dali { +class RenderSurface; + namespace Internal { @@ -31,7 +33,6 @@ class UpdateThread; class RenderThread; class VSyncNotifier; class UpdateRenderSynchronization; -class RenderSurface; class AdaptorInternalServices; class EnvironmentOptions; diff --git a/adaptors/base/update-render-synchronization.h b/adaptors/base/update-render-synchronization.h index 73322b4..1f0ba13 100644 --- a/adaptors/base/update-render-synchronization.h +++ b/adaptors/base/update-render-synchronization.h @@ -25,13 +25,15 @@ // INTERNAL INCLUDES #include -#include +#include #include #include namespace Dali { +class RenderSurface; + namespace Integration { @@ -47,7 +49,6 @@ namespace Adaptor { class AdaptorInternalServices; -class RenderSurface; /** * This object is used to synchronize the update, render and vsync threads. diff --git a/adaptors/common/adaptor-impl.cpp b/adaptors/common/adaptor-impl.cpp index ecaa1e2..c045004 100644 --- a/adaptors/common/adaptor-impl.cpp +++ b/adaptors/common/adaptor-impl.cpp @@ -36,8 +36,7 @@ #include #include -#include -#include +#include #include #include #include @@ -54,11 +53,10 @@ #include #include #include +#include #include - - namespace Dali { @@ -109,13 +107,11 @@ bool GetFloatEnvironmentVariable( const char* variable, float& floatValue ) } // unnamed namespace -Dali::Adaptor* Adaptor::New( RenderSurface *surface, const DeviceLayout& baseLayout, +Dali::Adaptor* Adaptor::New( Any nativeWindow, RenderSurface *surface, const DeviceLayout& baseLayout, Dali::Configuration::ContextLoss configuration ) { - DALI_ASSERT_ALWAYS( surface->GetType() != Dali::RenderSurface::NO_SURFACE && "No surface for adaptor" ); - Dali::Adaptor* adaptor = new Dali::Adaptor; - Adaptor* impl = new Adaptor( *adaptor, surface, baseLayout ); + Adaptor* impl = new Adaptor( nativeWindow, *adaptor, surface, baseLayout ); adaptor->mImpl = impl; impl->Initialize(configuration); @@ -372,15 +368,13 @@ void Adaptor::Start() mDeferredRotationObserver = NULL; } - // guarantee map the surface before starting render-thread. - mSurface->Map(); - + // NOTE: dpi must be set before starting the render thread // use default or command line settings if not run on device if( mHDpi == 0 || mVDpi == 0 ) { unsigned int dpiHor, dpiVer; dpiHor = dpiVer = 0; - mSurface->GetDpi(dpiHor, dpiVer); + Dali::DisplayConnection::GetDpi(dpiHor, dpiVer); // tell core about the value mCore->SetDpi(dpiHor, dpiVer); @@ -556,22 +550,12 @@ void Adaptor::SurfaceResized( const PositionSize& positionSize ) } } -void Adaptor::ReplaceSurface( Dali::RenderSurface& surface ) +void Adaptor::ReplaceSurface( Any nativeWindow, RenderSurface& surface ) { - // adaptor implementation needs the implementation of - RenderSurface* internalSurface = dynamic_cast( &surface ); - DALI_ASSERT_ALWAYS( internalSurface && "Incorrect surface" ); - - ECore::WindowRenderSurface* windowSurface = dynamic_cast( &surface); - if( windowSurface != NULL ) - { - windowSurface->Map(); - // @todo Restart event handler with new surface - } - - mSurface = internalSurface; + mNativeWindow = nativeWindow; + mSurface = &surface; - SurfaceSizeChanged( internalSurface->GetPositionSize() ); + SurfaceSizeChanged(mSurface->GetPositionSize()); // flush the event queue to give update and render threads chance // to start processing messages for new camera setup etc as soon as possible @@ -580,7 +564,7 @@ void Adaptor::ReplaceSurface( Dali::RenderSurface& surface ) mCore->GetContextNotifier()->NotifyContextLost(); // Inform stage // this method blocks until the render thread has completed the replace. - mUpdateRenderController->ReplaceSurface(internalSurface); + mUpdateRenderController->ReplaceSurface(mSurface); // Inform core, so that texture resources can be reloaded mCore->RecoverFromContextLoss(); @@ -588,7 +572,7 @@ void Adaptor::ReplaceSurface( Dali::RenderSurface& surface ) mCore->GetContextNotifier()->NotifyContextRegained(); // Inform stage } -Dali::RenderSurface& Adaptor::GetSurface() const +RenderSurface& Adaptor::GetSurface() const { return *mSurface; } @@ -698,6 +682,7 @@ TriggerEventInterface& Adaptor::GetTriggerEventInterface() { return *mNotificationTrigger; } + TriggerEventFactoryInterface& Adaptor::GetTriggerEventFactoryInterface() { return mTriggerEventFactory; @@ -712,6 +697,7 @@ RenderSurface* Adaptor::GetRenderSurfaceInterface() { return mSurface; } + VSyncMonitorInterface* Adaptor::GetVSyncMonitorInterface() { return mVSyncMonitor; @@ -772,6 +758,10 @@ void Adaptor::SetMinimumPinchDistance(float distance) } } +Any Adaptor::GetNativeWindowHandle() +{ + return mNativeWindow; +} void Adaptor::AddObserver( LifeCycleObserver& observer ) { @@ -904,7 +894,7 @@ void Adaptor::ProcessCoreEventsFromIdle() mNotificationOnIdleInstalled = false; } -Adaptor::Adaptor(Dali::Adaptor& adaptor, RenderSurface* surface, const DeviceLayout& baseLayout) +Adaptor::Adaptor(Any nativeWindow, Dali::Adaptor& adaptor, RenderSurface* surface, const DeviceLayout& baseLayout) : mResizedSignal(), mLanguageChangedSignal(), mAdaptor(adaptor), @@ -914,6 +904,7 @@ Adaptor::Adaptor(Dali::Adaptor& adaptor, RenderSurface* surface, const DeviceLay mVSyncMonitor(NULL), mGLES( NULL ), mEglFactory( NULL ), + mNativeWindow( nativeWindow ), mSurface( surface ), mPlatformAbstraction( NULL ), mEventHandler( NULL ), diff --git a/adaptors/common/adaptor-impl.h b/adaptors/common/adaptor-impl.h index 036dc92..817097c 100644 --- a/adaptors/common/adaptor-impl.h +++ b/adaptors/common/adaptor-impl.h @@ -47,6 +47,8 @@ namespace Dali { +class RenderSurface; + namespace Integration { class Core; @@ -63,7 +65,6 @@ class EglFactory; class GestureManager; class GlImplementation; class GlSyncImplementation; -class RenderSurface; class UpdateRenderController; class TriggerEvent; class CallbackManager; @@ -90,13 +91,15 @@ public: /** * Creates a New Adaptor - * @param[in] surface A render surface can be one of the following - * - Pixmap, adaptor will use existing Pixmap to draw on to - * - Window, adaptor will use existing Window to draw on to - * @param[in] baseLayout The base layout that the application has been written for + * @param[in] nativeWindow native window handle + * @param[in] surface A render surface can be one of the following + * - Pixmap, adaptor will use existing Pixmap to draw on to + * - Window, adaptor will use existing Window to draw on to + * @param[in] baseLayout The base layout that the application has been written for * @param[in] configuration The context loss configuration ( to choose resource discard policy ) */ - static Dali::Adaptor* New( RenderSurface* surface, + static Dali::Adaptor* New( Any nativeWindow, + RenderSurface* surface, const DeviceLayout& baseLayout, Dali::Configuration::ContextLoss configuration ); @@ -169,12 +172,12 @@ public: // AdaptorInternalServices implementation /** * @copydoc AdaptorInterface::ReplaceSurface() */ - virtual void ReplaceSurface( Dali::RenderSurface& surface ); + virtual void ReplaceSurface( Any nativeWindow, RenderSurface& surface ); /** * @copydoc Dali::Adaptor::GetSurface() */ - virtual Dali::RenderSurface& GetSurface() const; + virtual RenderSurface& GetSurface() const; /** * @copydoc Dali::Adaptor::ReleaseSurfaceLock() @@ -267,6 +270,13 @@ public: */ void SetMinimumPinchDistance(float distance); + /** + * Gets native window handle + * + * @return native window handle + */ + Any GetNativeWindowHandle(); + public: /** @@ -456,7 +466,7 @@ private: * Assigns the render surface to the adaptor * */ - void SetSurface(Dali::RenderSurface *surface); + void SetSurface(RenderSurface *surface); /** * Sends an notification message from main loop idle handler @@ -473,13 +483,14 @@ private: /** * Constructor - * @param[in] adaptor The public adaptor - * @param[in] surface A render surface can be one of the following - * - Pixmap, adaptor will use existing Pixmap to draw on to - * - Window, adaptor will use existing Window to draw on to - * @param[in] baseLayout The base layout that the application has been written for + * @param[in] nativeWindow native window handle + * @param[in] adaptor The public adaptor + * @param[in] surface A render surface can be one of the following + * - Pixmap, adaptor will use existing Pixmap to draw on to + * - Window, adaptor will use existing Window to draw on to + * @param[in] baseLayout The base layout that the application has been written for */ - Adaptor( Dali::Adaptor& adaptor, RenderSurface* surface, const DeviceLayout& baseLayout ); + Adaptor( Any nativeWindow, Dali::Adaptor& adaptor, RenderSurface* surface, const DeviceLayout& baseLayout ); private: // Types @@ -496,8 +507,8 @@ private: // Types private: // Data - AdaptorSignalType mResizedSignal; ///< Resized signal. - AdaptorSignalType mLanguageChangedSignal; ///< Language changed signal. + AdaptorSignalType mResizedSignal; ///< Resized signal. + AdaptorSignalType mLanguageChangedSignal; ///< Language changed signal. Dali::Adaptor& mAdaptor; ///< Reference to public adaptor instance. State mState; ///< Current state of the adaptor @@ -508,6 +519,7 @@ private: // Data GlSyncImplementation* mGlSync; ///< GL Sync implementation EglFactory* mEglFactory; ///< EGL Factory + Any mNativeWindow; ///< window identifier RenderSurface* mSurface; ///< Current surface TizenPlatform::TizenPlatformAbstraction* mPlatformAbstraction; ///< Platform abstraction diff --git a/adaptors/common/adaptor.cpp b/adaptors/common/adaptor.cpp index b71b210..5269195 100644 --- a/adaptors/common/adaptor.cpp +++ b/adaptors/common/adaptor.cpp @@ -26,8 +26,8 @@ #include #include #include +#include #include -#include #include namespace Dali @@ -40,12 +40,26 @@ Adaptor& Adaptor::New( Window window ) Adaptor& Adaptor::New( Window window, const DeviceLayout& baseLayout, Configuration::ContextLoss configuration ) { + Any winId = window.GetNativeHandle(); + Internal::Adaptor::Window& windowImpl = GetImplementation(window); - Adaptor* adaptor = Internal::Adaptor::Adaptor::New( windowImpl.GetSurface(), baseLayout, configuration ); + Adaptor* adaptor = Internal::Adaptor::Adaptor::New( winId, windowImpl.GetSurface(), baseLayout, configuration ); windowImpl.SetAdaptor(*adaptor); return *adaptor; } +Adaptor& Adaptor::New( Any nativeWindow, const Dali::RenderSurface& surface ) +{ + return New( nativeWindow, surface, DeviceLayout::DEFAULT_BASE_LAYOUT, Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS ); +} + +Adaptor& Adaptor::New( Any nativeWindow, const Dali::RenderSurface& surface, const DeviceLayout& baseLayout, Configuration::ContextLoss configuration ) +{ + Dali::RenderSurface* pSurface = const_cast(&surface); + Adaptor* adaptor = Internal::Adaptor::Adaptor::New( nativeWindow, pSurface, baseLayout, configuration ); + return *adaptor; +} + Adaptor::~Adaptor() { delete mImpl; @@ -76,6 +90,11 @@ bool Adaptor::AddIdle( CallbackBase* callback ) return mImpl->AddIdle( callback ); } +void Adaptor::ReplaceSurface( Any nativeWindow, Dali::RenderSurface& surface ) +{ + mImpl->ReplaceSurface(nativeWindow, surface); +} + Adaptor::AdaptorSignalType& Adaptor::ResizedSignal() { return mImpl->ResizedSignal(); @@ -126,6 +145,21 @@ void Adaptor::SetMinimumPinchDistance(float distance) mImpl->SetMinimumPinchDistance(distance); } +void Adaptor::FeedTouchPoint( TouchPoint& point, int timeStamp ) +{ + mImpl->FeedTouchPoint(point, timeStamp); +} + +void Adaptor::FeedWheelEvent( MouseWheelEvent& wheelEvent ) +{ + mImpl->FeedWheelEvent(wheelEvent); +} + +void Adaptor::FeedKeyEvent( KeyEvent& keyEvent ) +{ + mImpl->FeedKeyEvent(keyEvent); +} + Adaptor::Adaptor() : mImpl( NULL ) { diff --git a/adaptors/common/application-impl.cpp b/adaptors/common/application-impl.cpp index dfb9f12..79c0347 100644 --- a/adaptors/common/application-impl.cpp +++ b/adaptors/common/application-impl.cpp @@ -334,7 +334,9 @@ void Application::ReplaceWindow(PositionSize windowPosition, const std::string& windowImpl.SetAdaptor(*mAdaptor); newWindow.ShowIndicator(Dali::Window::INVISIBLE); Dali::RenderSurface* renderSurface = windowImpl.GetSurface(); - Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).ReplaceSurface(*renderSurface); + + Any nativeWindow = newWindow.GetNativeHandle(); + Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).ReplaceSurface(nativeWindow, *renderSurface); mWindow = newWindow; } diff --git a/adaptors/common/events/event-handler.h b/adaptors/common/events/event-handler.h index f0d7c29..f6a2fc9 100644 --- a/adaptors/common/events/event-handler.h +++ b/adaptors/common/events/event-handler.h @@ -33,6 +33,8 @@ namespace Dali { +class RenderSurface; + struct StyleChange; namespace Internal @@ -43,7 +45,6 @@ namespace Adaptor class CoreEventInterface; class GestureManager; -class RenderSurface; class StyleMonitor; /** diff --git a/adaptors/common/file.list b/adaptors/common/file.list index c495e49..d1f07af 100644 --- a/adaptors/common/file.list +++ b/adaptors/common/file.list @@ -23,7 +23,6 @@ adaptor_common_internal_src_files = \ $(adaptor_common_dir)/orientation-impl.cpp \ $(adaptor_common_dir)/performance-logger-impl.cpp \ $(adaptor_common_dir)/physical-keyboard-impl.cpp \ - $(adaptor_common_dir)/render-surface-impl.cpp \ $(adaptor_common_dir)/server-connection.cpp \ $(adaptor_common_dir)/shared-file.cpp \ $(adaptor_common_dir)/singleton-service-impl.cpp \ diff --git a/adaptors/common/gl/egl-implementation.h b/adaptors/common/gl/egl-implementation.h index b74830b..b8693b0 100644 --- a/adaptors/common/gl/egl-implementation.h +++ b/adaptors/common/gl/egl-implementation.h @@ -21,25 +21,19 @@ // EXTERNAL INCLUDES #include #include -#include #include // INTERNAL INCLUDES -#include +#include namespace Dali { + namespace Internal { namespace Adaptor { -enum ColorDepth -{ - COLOR_DEPTH_24 = 24, - COLOR_DEPTH_32 = 32 -}; - /** * EglImplementation class provides an EGL implementation. */ @@ -58,7 +52,7 @@ public: public: - /** + /** * (Called from ECoreX::RenderSurface, not RenderThread, so not in i/f, hence, not virtual) * Initialize GL * @param display The display @@ -145,20 +139,18 @@ public: /** * Replaces the render surface * @param[in] window, the window to create the new surface on - * @param[in] display, the display * @return true if the context was lost due to a change in display * between old surface and new surface */ - bool ReplaceSurfaceWindow( EGLNativeWindowType window, EGLNativeDisplayType display ); + bool ReplaceSurfaceWindow( EGLNativeWindowType window ); /** * Replaces the render surface * @param[in] pixmap, the pixmap to create the new surface on - * @param[in] display, the display * @return true if the context was lost due to a change in x-display * between old surface and new surface */ - bool ReplaceSurfacePixmap( EGLNativePixmapType pixmap, EGLNativeDisplayType display ); + bool ReplaceSurfacePixmap( EGLNativePixmapType pixmap ); /** * returns the display with which this object was initialized diff --git a/adaptors/common/render-surface-impl.cpp b/adaptors/common/render-surface-impl.cpp deleted file mode 100644 index 654e080..0000000 --- a/adaptors/common/render-surface-impl.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2014 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include "render-surface-impl.h" - -// EXTERNAL INCLUDES -#include - -namespace Dali -{ - -namespace Internal -{ - -namespace Adaptor -{ - -RenderSurface::RenderSurface() -{ -} - -RenderSurface::~RenderSurface() -{ -} - -} // namespace Adaptor - -} // namespace Internal - -} // namespace Dali diff --git a/adaptors/common/render-surface-impl.h b/adaptors/common/render-surface-impl.h deleted file mode 100644 index 4077f80..0000000 --- a/adaptors/common/render-surface-impl.h +++ /dev/null @@ -1,167 +0,0 @@ -#ifndef __DALI_INTERNAL_RENDER_SURFACE_H__ -#define __DALI_INTERNAL_RENDER_SURFACE_H__ - -/* - * Copyright (c) 2014 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// EXTERNAL INCLUDES -#include -#include - -// INTERNAL INCLUDES -#include -#include - -namespace Dali -{ - -namespace Integration -{ - -class GlAbstraction; - -} // namespace Integration - -namespace Internal -{ - -namespace Adaptor -{ - -class EglInterface; - -/** - * This is the internal RenderSurface API - */ -class RenderSurface : public Dali::RenderSurface -{ -public: - - /** - * Constructor - */ - RenderSurface(); - - /** - * Destructor - */ - virtual ~RenderSurface(); - -public: // API - - /** - * Initialize EGL, RenderSurface should create egl display and initialize - * @param egl implementation to use for the creation - */ - virtual void InitializeEgl( EglInterface& egl ) = 0; - - /** - * Creates EGL Surface - * @param egl implementation to use for the creation - */ - virtual void CreateEglSurface( EglInterface& egl ) = 0; - - /** - * Destroys EGL Surface - * @param egl implementation to use for the destruction - */ - virtual void DestroyEglSurface( EglInterface& egl ) = 0; - - /** - * Replace the EGL Surface - * @param egl implementation to use for the creation - * @return true if context was lost - */ - virtual bool ReplaceEGLSurface( EglInterface& egl ) = 0; - - /** - * Resizes the underlying surface. - * Only available for x window - */ - virtual void MoveResize( Dali::PositionSize positionSize ) = 0; - - /** - * Get DPI - * @param dpiHorizontal set to the horizontal dpi - * @param dpiVertical set to the vertical dpi - */ - virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) const = 0; - - /** - * Call to map the surface (only works if surface is a window) - */ - virtual void Map() = 0; - - /** - * Transfers the ownership of a display - * @param newSurface to transfer - */ - virtual void TransferDisplayOwner( Internal::Adaptor::RenderSurface& newSurface ) = 0; - - /** - * Consumes any possible events on the queue so that there is no leaking between frames - */ - virtual void ConsumeEvents() = 0; - - /** - * Set the stereoscopic 3D view mode - * @param[in] viewMode The new view mode - */ - virtual void SetViewMode( ViewMode viewMode ) = 0; - - /** - * Called when Render thread has started - */ - virtual void StartRender() = 0; - - /** - * Invoked by render thread before Core::Render - * If the operation fails, then Core::Render should not be called until there is - * a surface to render onto. - * @param[in] egl The Egl interface - * @param[in] glAbstraction OpenGLES abstraction interface - * @return True if the operation is successful, False if the operation failed - */ - virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction ) = 0; - - /** - * Invoked by render thread after Core::Render - * @param[in] egl The Egl interface - * @param[in] glAbstraction OpenGLES abstraction interface - * @param[in] deltaTime Time (in microseconds) since PostRender was last called. - * @param[in] replacingSurface True if the surface is being replaced. - */ - virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, unsigned int deltaTime, bool replacingSurface ) = 0; - - /** - * Invoked by render thread when the thread should be stop - */ - virtual void StopRender() = 0; - - /** - * Invoked by Event Thread when the compositor lock should be released and rendering should resume. - */ - virtual void ReleaseLock() = 0; -}; - -} // namespace Adaptor - -} // namespace internal - -} // namespace Dali - -#endif // __DALI_INTERNAL_RENDER_SURFACE_H__ diff --git a/adaptors/common/trigger-event-factory.cpp b/adaptors/common/trigger-event-factory.cpp index 0cfbe0f..68b3614 100644 --- a/adaptors/common/trigger-event-factory.cpp +++ b/adaptors/common/trigger-event-factory.cpp @@ -21,30 +21,18 @@ // INTERNAL INCLUDES #include - namespace Dali { -namespace Internal -{ - -namespace Adaptor -{ - -TriggerEventInterface* TriggerEventFactory::CreateTriggerEvent( CallbackBase* callback, TriggerEventInterface::Options options ) +TriggerEventInterface* TriggerEventFactory::CreateTriggerEvent( CallbackBase* callback, TriggerEventInterface::Options options ) { - return new TriggerEvent( callback, options ); + return new Internal::Adaptor::TriggerEvent( callback, options ); } void TriggerEventFactory::DestroyTriggerEvent( TriggerEventInterface* triggerEventInterface ) { - TriggerEvent* triggerEvent( static_cast< TriggerEvent* >( triggerEventInterface) ); + Internal::Adaptor::TriggerEvent* triggerEvent( static_cast(triggerEventInterface) ); delete triggerEvent; } - -} // namespace Internal - -} // namespace Adaptor - } // namespace Dali diff --git a/adaptors/common/trigger-event.h b/adaptors/common/trigger-event.h index c862748..bd057ac 100644 --- a/adaptors/common/trigger-event.h +++ b/adaptors/common/trigger-event.h @@ -23,7 +23,7 @@ #include // INTERNAL INCLUDES -#include +#include namespace Dali { diff --git a/adaptors/common/window-impl.h b/adaptors/common/window-impl.h index 3a56b27..32068da 100644 --- a/adaptors/common/window-impl.h +++ b/adaptors/common/window-impl.h @@ -34,6 +34,7 @@ namespace Dali { class Adaptor; +class RenderSurface; namespace Integration { @@ -44,7 +45,6 @@ namespace Internal { namespace Adaptor { -class RenderSurface; class Indicator; class Orientation; diff --git a/adaptors/common/adaptor.h b/adaptors/integration-api/adaptor.h similarity index 79% rename from adaptors/common/adaptor.h rename to adaptors/integration-api/adaptor.h index ab5997a..410c59b 100644 --- a/adaptors/common/adaptor.h +++ b/adaptors/integration-api/adaptor.h @@ -1,5 +1,5 @@ -#ifndef __DALI_ADAPTOR_H__ -#define __DALI_ADAPTOR_H__ +#ifndef __DALI_INTEGRATION_ADAPTOR_H__ +#define __DALI_INTEGRATION_ADAPTOR_H__ /* * Copyright (c) 2014 Samsung Electronics Co., Ltd. @@ -27,15 +27,14 @@ // INTERNAL INCLUDES #include "window.h" #include "application-configuration.h" -#include "tts-player.h" -namespace Dali DALI_INTERNAL +namespace Dali { struct DeviceLayout; class RenderSurface; -namespace Internal DALI_INTERNAL +namespace Internal { namespace Adaptor { @@ -101,7 +100,7 @@ class Adaptor; * * @see RenderSurface */ -class Adaptor +class DALI_IMPORT_API Adaptor { public: @@ -128,6 +127,27 @@ public: static Adaptor& New( Window window, const DeviceLayout& baseLayout, Configuration::ContextLoss configuration ); /** + * @brief Create a new adaptor using render surface. + * + * @param[in] nativeWindow native window handle + * @param[in] surface The surface to draw onto + * @note The default base layout DeviceLayout::DEFAULT_BASE_LAYOUT will be used. + * @return a reference to the adaptor handle + */ + static Adaptor& New( Any nativeWindow, const Dali::RenderSurface& surface ); + + /** + * @brief Create a new adaptor using render surface. + * + * @param[in] nativeWindow native window handle + * @param[in] surface The surface to draw onto + * @param[in] baseLayout The base layout that the application has been written for + * @param[in] configuration The context loss configuration. + * @return a reference to the adaptor handle + */ + static Adaptor& New( Any nativeWindow, const Dali::RenderSurface& surface, const DeviceLayout& baseLayout, Configuration::ContextLoss configuration = Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS); + + /** * @brief Virtual Destructor. */ virtual ~Adaptor(); @@ -164,7 +184,7 @@ public: * void MyFunction(); * @endcode * - * @param[in] callBack The function to call. + * @param[in] callback The function to call. * @return true if added successfully, false otherwise * * @note Ownership of the callback is passed onto this class. @@ -172,6 +192,14 @@ public: bool AddIdle( CallbackBase* callback ); /** + * @brief Replaces the rendering surface + * + * @param[in] nativeWindow native window handle + * @param[in] surface to use + */ + void ReplaceSurface( Any nativeWindow, Dali::RenderSurface& surface ); + + /** * @brief Get the render surface the adaptor is using to render to. * * @return reference to current render surface @@ -242,6 +270,28 @@ public: */ void SetMinimumPinchDistance(float distance); + /** + * @brief Feed a touch point to the adaptor. + * + * @param[in] point touch point + * @param[in] timeStamp time value of event + */ + void FeedTouchPoint( TouchPoint& point, int timeStamp ); + + /** + * @brief Feed a mouse wheel event to the adaptor. + * + * @param[in] wheelEvent mouse wheel event + */ + void FeedWheelEvent( MouseWheelEvent& wheelEvent ); + + /** + * @brief Feed a key event to the adaptor. + * + * @param[in] keyEvent The key event holding the key information. + */ + void FeedKeyEvent( KeyEvent& keyEvent ); + public: // Signals /** @@ -278,4 +328,4 @@ private: } // namespace Dali -#endif // __DALI_ADAPTOR_H__ +#endif // __DALI_INTEGRATION_ADAPTOR_H__ diff --git a/adaptors/base/interfaces/egl-interface.h b/adaptors/integration-api/egl-interface.h similarity index 84% rename from adaptors/base/interfaces/egl-interface.h rename to adaptors/integration-api/egl-interface.h index 9eb006f..5208501 100644 --- a/adaptors/base/interfaces/egl-interface.h +++ b/adaptors/integration-api/egl-interface.h @@ -1,5 +1,5 @@ -#ifndef __DALI_INTERNAL_ADAPTOR_BASE_EGL_INTERFACE_H__ -#define __DALI_INTERNAL_ADAPTOR_BASE_EGL_INTERFACE_H__ +#ifndef __DALI_INTEGRATION_EGL_INTERFACE_H__ +#define __DALI_INTEGRATION_EGL_INTERFACE_H__ /* * Copyright (c) 2014 Samsung Electronics Co., Ltd. @@ -20,10 +20,12 @@ namespace Dali { -namespace Internal -{ -namespace Adaptor + +enum ColorDepth { + COLOR_DEPTH_24 = 24, + COLOR_DEPTH_32 = 32 +}; /** * EglInterface provides an interface for managing EGL contexts @@ -69,10 +71,6 @@ protected: virtual ~EglInterface() {} }; -} // namespace Adaptor - -} // namespace Internal - } // namespace Dali -#endif // __DALI_INTERNAL_ADAPTOR_BASE_EGL_INTERFACE_H__ +#endif // __DALI_INTEGRATION_EGL_INTERFACE_H__ diff --git a/adaptors/integration-api/file.list b/adaptors/integration-api/file.list new file mode 100644 index 0000000..9287572 --- /dev/null +++ b/adaptors/integration-api/file.list @@ -0,0 +1,17 @@ +adaptor_integration_api_header_files = \ + $(adaptor_integration_api_dir)/adaptor.h \ + $(adaptor_integration_api_dir)/egl-interface.h \ + $(adaptor_integration_api_dir)/trigger-event-interface.h \ + $(adaptor_integration_api_dir)/trigger-event-factory-interface.h \ + $(adaptor_integration_api_dir)/trigger-event-factory.h \ + $(adaptor_integration_api_dir)/pixmap-render-surface-factory.h + +adaptor_integration_wayland_api_header_files = \ + $(adaptor_integration_api_dir)/wayland/ecore-wl-types.h \ + $(adaptor_integration_api_dir)/wayland/ecore-wl-render-surface.h \ + $(adaptor_integration_api_dir)/wayland/pixmap-render-surface.h + +adaptor_integration_x11_api_header_files = \ + $(adaptor_integration_api_dir)/x11/ecore-x-types.h \ + $(adaptor_integration_api_dir)/x11/ecore-x-render-surface.h \ + $(adaptor_integration_api_dir)/x11/pixmap-render-surface.h diff --git a/adaptors/mobile/mobile-render-surface-factory.h b/adaptors/integration-api/pixmap-render-surface-factory.h similarity index 58% rename from adaptors/mobile/mobile-render-surface-factory.h rename to adaptors/integration-api/pixmap-render-surface-factory.h index a022cbc..971dc35 100644 --- a/adaptors/mobile/mobile-render-surface-factory.h +++ b/adaptors/integration-api/pixmap-render-surface-factory.h @@ -1,5 +1,5 @@ -#ifndef __DALI_INTERNAL_ADAPTOR_MOBILE_RENDER_SURFACE_FACTORY_H__ -#define __DALI_INTERNAL_ADAPTOR_MOBILE_RENDER_SURFACE_FACTORY_H__ +#ifndef __DALI_INTEGRATION_PIXMAP_RENDER_SURFACE_FACTORY_H__ +#define __DALI_INTEGRATION_PIXMAP_RENDER_SURFACE_FACTORY_H__ /* * Copyright (c) 2014 Samsung Electronics Co., Ltd. @@ -19,52 +19,36 @@ */ // EXTERNAL INCLUDES -#include #include -#include +#include #include // INTERNAL INCLUDES -#include namespace Dali { -namespace Internal -{ - -namespace Adaptor -{ - namespace ECore { -class RenderSurface; +class PixmapRenderSurface; /** * Surface factory function for pixmap * A pixmap surface is created. * - * @param [in] type the type of surface to create * @param [in] positionSize the position and size of the surface to create - * @param [in] display X Pixmap to use, or null for default. - * @param [in] display X Display to use, or null for default. + * @param [in] surface X Pixmap to use, or null for default. * @param [in] name Name of surface passed in * @param [in] isTransparent Whether the surface has an alpha channel */ -RenderSurface* CreatePixmapSurface( - PositionSize positionSize, - Any surface, - Any display, - const std::string& name, - bool isTransparent ); +PixmapRenderSurface* CreatePixmapSurface(PositionSize positionSize, + Any surface, + const std::string& name, + bool isTransparent); } // namespace ECoreX -} // namespace Adaptor - -} // namespace Internal - } // namespace Dali -#endif // __DALI_INTERNAL_ADAPTOR_MOBILE_RENDER_SURFACE_FACTORY_H__ +#endif // __DALI_INTEGRATION_PIXMAP_RENDER_SURFACE_FACTORY_H__ diff --git a/adaptors/base/interfaces/trigger-event-factory-interface.h b/adaptors/integration-api/trigger-event-factory-interface.h similarity index 83% rename from adaptors/base/interfaces/trigger-event-factory-interface.h rename to adaptors/integration-api/trigger-event-factory-interface.h index 1c249d9..be3cb3e 100644 --- a/adaptors/base/interfaces/trigger-event-factory-interface.h +++ b/adaptors/integration-api/trigger-event-factory-interface.h @@ -1,5 +1,5 @@ -#ifndef __DALI_INTERNAL_BASE_TRIGGER_EVENT_FACTORY_INTERFACE_H__ -#define __DALI_INTERNAL_BASE_TRIGGER_EVENT_FACTORY_INTERFACE_H__ +#ifndef __DALI_INTEGRATION_TRIGGER_EVENT_FACTORY_INTERFACE_H__ +#define __DALI_INTEGRATION_TRIGGER_EVENT_FACTORY_INTERFACE_H__ /* * Copyright (c) 2014 Samsung Electronics Co., Ltd. @@ -22,17 +22,11 @@ #include // INTERNAL INCLUDES -#include +#include namespace Dali { -namespace Internal -{ - -namespace Adaptor -{ - /** * @brief Trigger interface factory class for creating a TriggerEvents * @@ -45,6 +39,7 @@ public: /** * @brief Create a new concrete implementation of the event trigger interface. * @param callback called when interface->Trigger() is called + * @param options TriggerEventInterface option * @return pointer to a new trigger event * @note Ownership of callback should be taken over by deriving classes */ @@ -52,7 +47,7 @@ public: TriggerEventInterface::Options options = TriggerEventInterface::NONE) = 0; /** * @brief destroy a trigger event - * @param trigger event to destroy + * @param triggerEventInterface event to destroy */ virtual void DestroyTriggerEvent( TriggerEventInterface* triggerEventInterface ) = 0; @@ -83,11 +78,6 @@ private: }; - -} // namespace Internal - -} // namespace Adaptor - } // namespace Dali -#endif // __DALI_INTERNAL_BASE_TRIGGER_EVENT_FACTORY_INTERFACE_H__ +#endif // __DALI_INTEGRATION_TRIGGER_EVENT_FACTORY_INTERFACE_H__ diff --git a/adaptors/common/trigger-event-factory.h b/adaptors/integration-api/trigger-event-factory.h similarity index 76% rename from adaptors/common/trigger-event-factory.h rename to adaptors/integration-api/trigger-event-factory.h index 998de17..1633a0d 100644 --- a/adaptors/common/trigger-event-factory.h +++ b/adaptors/integration-api/trigger-event-factory.h @@ -1,5 +1,5 @@ -#ifndef __DALI_INTERNAL_ADAPTOR_TRIGGER_EVENT_FACTORY_H__ -#define __DALI_INTERNAL_ADAPTOR_TRIGGER_EVENT_FACTORY_H__ +#ifndef __DALI_INTEGRATION_TRIGGER_EVENT_FACTORY_H__ +#define __DALI_INTEGRATION_TRIGGER_EVENT_FACTORY_H__ /* * Copyright (c) 2014 Samsung Electronics Co., Ltd. @@ -19,22 +19,17 @@ */ // INTERNAL INCLUDES -#include +#include +#include namespace Dali { -namespace Internal -{ - -namespace Adaptor -{ - /** * @brief Trigger interface factory class * */ -class TriggerEventFactory : public TriggerEventFactoryInterface +class DALI_IMPORT_API TriggerEventFactory : public TriggerEventFactoryInterface { public: @@ -66,10 +61,6 @@ public: }; -} // namespace Internal - -} // namespace Adaptor - } // namespace Dali -#endif // __DALI_INTERNAL_ADAPTOR_TRIGGER_EVENT_FACTORY_H__ +#endif // __DALI_INTEGRATION_TRIGGER_EVENT_FACTORY_H__ diff --git a/adaptors/base/interfaces/trigger-event-interface.h b/adaptors/integration-api/trigger-event-interface.h similarity index 85% rename from adaptors/base/interfaces/trigger-event-interface.h rename to adaptors/integration-api/trigger-event-interface.h index 15eb377..7dd3287 100644 --- a/adaptors/base/interfaces/trigger-event-interface.h +++ b/adaptors/integration-api/trigger-event-interface.h @@ -1,5 +1,5 @@ -#ifndef __DALI_INTERNAL_ADAPTOR_BASE_TRIGGER_EVENT_INTERFACE_H__ -#define __DALI_INTERNAL_ADAPTOR_BASE_TRIGGER_EVENT_INTERFACE_H__ +#ifndef __DALI_INTEGRATION_TRIGGER_EVENT_INTERFACE_H__ +#define __DALI_INTEGRATION_TRIGGER_EVENT_INTERFACE_H__ /* * Copyright (c) 2014 Samsung Electronics Co., Ltd. @@ -22,12 +22,6 @@ namespace Dali { -namespace Internal -{ - -namespace Adaptor -{ - /** * @brief Interface for a trigger event class. * @@ -64,6 +58,7 @@ protected: { } +public: /** * @brief Virtual destructor */ @@ -82,10 +77,6 @@ private: }; -} // namespace Adaptor - -} // namespace Internal - } // namespace Dali -#endif // __DALI_INTERNAL_ADAPTOR_BASE_TRIGGER_EVENT_INTERFACE_H__ +#endif // __DALI_INTEGRATION_TRIGGER_EVENT_INTERFACE_H__ diff --git a/adaptors/wayland/ecore-wl-render-surface.h b/adaptors/integration-api/wayland/ecore-wl-render-surface.h similarity index 52% rename from adaptors/wayland/ecore-wl-render-surface.h rename to adaptors/integration-api/wayland/ecore-wl-render-surface.h index 04909da..cb595fe 100644 --- a/adaptors/wayland/ecore-wl-render-surface.h +++ b/adaptors/integration-api/wayland/ecore-wl-render-surface.h @@ -1,5 +1,5 @@ -#ifndef __DALI_INTERNAL_ECORE_WL_RENDER_SURFACE_H__ -#define __DALI_INTERNAL_ECORE_WL_RENDER_SURFACE_H__ +#ifndef __DALI_ECORE_WL_RENDER_SURFACE_H__ +#define __DALI_ECORE_WL_RENDER_SURFACE_H__ /* * Copyright (c) 2014 Samsung Electronics Co., Ltd. @@ -19,26 +19,17 @@ */ // EXTERNAL INCLUDES -#include -#include -#include #include #include // INTERNAL INCLUDES -#include -#include -#include +#include +#include namespace Dali { -namespace Internal -{ - -namespace Adaptor -{ -class TriggerEvent; +class TriggerEventInterface; namespace ECore { @@ -48,31 +39,27 @@ namespace ECore * @todo change namespace to ECore_Wayland as the class * is no longer pure Wayland. */ -class RenderSurface : public Internal::Adaptor::RenderSurface +class DALI_IMPORT_API EcoreWlRenderSurface : public Dali::RenderSurface { public: /** * Uses an Wayland surface to render to. - * @param [in] type the type of surface passed in * @param [in] positionSize the position and size of the surface * @param [in] surface can be a X-window or X-pixmap (type must be unsigned int). - * @param [in] display connection to X-server if the surface is a X window or pixmap (type must be void * to X display struct) * @param [in] name optional name of surface passed in * @param [in] isTransparent if it is true, surface has 32 bit color depth, otherwise, 24 bit */ - RenderSurface( SurfaceType type, - Dali::PositionSize positionSize, - Any surface, - Any display, - const std::string& name, - bool isTransparent = false); + EcoreWlRenderSurface(Dali::PositionSize positionSize, + Any surface, + const std::string& name, + bool isTransparent = false); /** * Destructor. * Will delete the display, if it has ownership. * Will delete the window/pixmap if it has owner ship */ - virtual ~RenderSurface(); + virtual ~EcoreWlRenderSurface(); protected: /** @@ -84,114 +71,84 @@ protected: public: // API /** - * @return the Ecore X window handle - */ - Ecore_Wl_Window* GetWlWindow(); - - /** - * @return the Main X display + * @brief Sets the render notification trigger to call when render thread is completed a frame + * + * @param renderNotification to use */ - WlDisplay* GetMainDisplay(); + void SetRenderNotification(TriggerEventInterface* renderNotification); /** - * Sets the render notification trigger to call when render thread is completed a frame - * @param renderNotification to use + * @brief Get window handle + * + * @return the Ecore X window handle */ - void SetRenderNotification( TriggerEvent* renderNotification ); + Ecore_Wl_Window* GetWlWindow(); /** - * Get the surface as an Ecore_X_drawable + * Get the surface as an Ecore_Wl_Window */ virtual Ecore_Wl_Window* GetDrawable(); public: // from Dali::RenderSurface /** - * @copydoc Dali::RenderSurface::GetType() - */ - virtual Dali::RenderSurface::SurfaceType GetType() = 0; - - /** - * @copydoc Dali::RenderSurface::GetSurface() - */ - virtual Any GetSurface() = 0; - - /** - * @copydoc Dali::RenderSurface::GetDisplay() - */ - virtual Any GetDisplay(); - - /** * @copydoc Dali::RenderSurface::GetPositionSize() */ virtual PositionSize GetPositionSize() const; -public: // from Internal::Adaptor::RenderSurface + /** + * @copydoc Dali::RenderSurface::InitializeEgl() + */ + virtual void InitializeEgl( EglInterface& egl ) = 0; /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::CreateEglSurface() + * @copydoc Dali::RenderSurface::CreateEglSurface() */ virtual void CreateEglSurface( EglInterface& egl ) = 0; /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::DestroyEglSurface() + * @copydoc Dali::RenderSurface::DestroyEglSurface() */ virtual void DestroyEglSurface( EglInterface& egl ) = 0; /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::ReplaceEGLSurface() + * @copydoc Dali::RenderSurface::ReplaceEGLSurface() */ virtual bool ReplaceEGLSurface( EglInterface& egl ) = 0; /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::MoveResize() + * @copydoc Dali::RenderSurface::MoveResize() */ virtual void MoveResize( Dali::PositionSize positionSize); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::GetDpi() - */ - virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) const; - - /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::Map() - */ - virtual void Map(); - - /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::TransferDisplayOwner() + * @copydoc Dali::RenderSurface::SetViewMode() */ - virtual void TransferDisplayOwner( Internal::Adaptor::RenderSurface& newSurface ); + void SetViewMode( ViewMode viewMode ); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::ConsumeEvents() + * @copydoc Dali::RenderSurface::StartRender() */ - virtual void ConsumeEvents(); + virtual void StartRender() = 0; /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::SetViewMode() + * @copydoc Dali::RenderSurface::PreRender() */ - void SetViewMode( ViewMode ); + virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction ) = 0; /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::PreRender() + * @copydoc Dali::RenderSurface::PostRender() */ - virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction ) = 0; + virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, unsigned int deltaTime, bool replacingSurface ) = 0; /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::PostRender() + * @copydoc Dali::RenderSurface::ReleaseLock() */ - virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, unsigned int timeDelta, bool replacingSurface ) = 0; + virtual void ReleaseLock() = 0; private: /** - * Sets the display, if display parameter is empty it opens a new display - * @param display - */ - void SetDisplay( Any display ); - - /** * Get the surface id if the surface parameter is not empty * @param surface Any containing a surface id, or can be empty * @return surface id, or zero if surface is empty @@ -213,23 +170,15 @@ protected: protected: // Data - WlDisplay* mMainDisplay; ///< Wayland-connection for rendering - SurfaceType mType; ///< type of renderable PositionSize mPosition; ///< Position std::string mTitle; ///< Title of window which shows from "xinfo -topvwins" command + TriggerEventInterface* mRenderNotification; ///< Render notification trigger ColorDepth mColorDepth; ///< Color depth of surface (32 bit or 24 bit) - TriggerEvent* mRenderNotification; ///< Render notification trigger - bool mOwnSurface; ///< Whether we own the surface (responsible for deleting it) - bool mOwnDisplay; ///< Whether we own the display (responsible for deleting it) }; } // namespace ECore -} // namespace Adaptor - -} // namespace internal - } // namespace Dali -#endif // __DALI_INTERNAL_ECORE_WL_RENDER_SURFACE_H__ +#endif // __DALI_ECORE_WL_RENDER_SURFACE_H__ diff --git a/adaptors/wayland/ecore-wl-types.h b/adaptors/integration-api/wayland/ecore-wl-types.h similarity index 78% rename from adaptors/wayland/ecore-wl-types.h rename to adaptors/integration-api/wayland/ecore-wl-types.h index 7dba22b..97869fb 100644 --- a/adaptors/wayland/ecore-wl-types.h +++ b/adaptors/integration-api/wayland/ecore-wl-types.h @@ -1,5 +1,5 @@ -#ifndef __DALI_INTERNAL_X11_TYPES_H__ -#define __DALI_INTERNAL_X11_TYPES_H__ +#ifndef __DALI_WL_TYPES_H__ +#define __DALI_WL_TYPES_H__ /* * Copyright (c) 2014 Samsung Electronics Co., Ltd. @@ -24,19 +24,9 @@ namespace Dali { -namespace Internal -{ - -namespace Adaptor -{ - typedef ::wl_display WlDisplay; typedef ::wl_surface WlSurface; -} // namespace Adaptor - -} // namespace Internal - } // namespace Dali -#endif /* __DALI_INTERNAL_X11_TYPES_H__ */ +#endif /* __DALI_WL_TYPES_H__ */ diff --git a/adaptors/wayland/pixmap-render-surface.h b/adaptors/integration-api/wayland/pixmap-render-surface.h similarity index 66% rename from adaptors/wayland/pixmap-render-surface.h rename to adaptors/integration-api/wayland/pixmap-render-surface.h index 87a81bf..ede6450 100644 --- a/adaptors/wayland/pixmap-render-surface.h +++ b/adaptors/integration-api/wayland/pixmap-render-surface.h @@ -1,5 +1,5 @@ -#ifndef __DALI_INTERNAL_ECORE_X_PIXMAP_RENDER_SURFACE_H__ -#define __DALI_INTERNAL_ECORE_X_PIXMAP_RENDER_SURFACE_H__ +#ifndef __DALI_ECORE_X_PIXMAP_RENDER_SURFACE_H__ +#define __DALI_ECORE_X_PIXMAP_RENDER_SURFACE_H__ /* * Copyright (c) 2014 Samsung Electronics Co., Ltd. @@ -24,20 +24,13 @@ namespace Dali { -namespace Internal -{ - -namespace Adaptor -{ -class TriggerEvent; - namespace ECore { /** * Ecore X11 implementation of render surface. */ -class PixmapRenderSurface : public RenderSurface +class PixmapRenderSurface : public EcoreWlRenderSurface { public: @@ -45,74 +38,72 @@ public: * Uses an Wayland surface to render to. * @param [in] positionSize the position and size of the surface * @param [in] surface can be a Wayland-window (type must be unsigned int). - * @param [in] display connection to Wayland-server if the surface is a X window or pixmap (type must be void * to X display struct) * @param [in] name optional name of surface passed in * @param [in] isTransparent if it is true, surface has 32 bit color depth, otherwise, 24 bit */ PixmapRenderSurface( Dali::PositionSize positionSize, Any surface, - Any display, const std::string& name, bool isTransparent = false); /** - * @copydoc Dali::Internal::Adaptor::ECore::RenderSurface::~RenderSurface + * @copydoc Dali::RenderSurface::~RenderSurface */ virtual ~PixmapRenderSurface(); public: // API -public: // from Dali::RenderSurface - /** - * @copydoc Dali::RenderSurface::GetType() + * @copydoc Dali::ECore::EcoreWlRenderSurface::GetDrawable() */ - virtual Dali::RenderSurface::SurfaceType GetType(); + virtual Ecore_Wl_Window* GetDrawable(); /** - * @copydoc Dali::RenderSurface::GetSurface() + * @brief GetSurface + * + * @return pixmap */ virtual Any GetSurface(); -public: // from Internal::Adaptor::RenderSurface +public: // from Dali::RenderSurface /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::InitializeEgl() + * @copydoc Dali::RenderSurface::InitializeEgl() */ virtual void InitializeEgl( EglInterface& egl ); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::CreateEglSurface() + * @copydoc Dali::RenderSurface::CreateEglSurface() */ virtual void CreateEglSurface( EglInterface& egl ); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::DestroyEglSurface() + * @copydoc Dali::RenderSurface::DestroyEglSurface() */ virtual void DestroyEglSurface( EglInterface& egl ); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::ReplaceEGLSurface() + * @copydoc Dali::RenderSurface::ReplaceEGLSurface() */ virtual bool ReplaceEGLSurface( EglInterface& egl ); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::StartRender() + * @copydoc Dali::RenderSurface::StartRender() */ virtual void StartRender(); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::PreRender() + * @copydoc Dali::RenderSurface::PreRender() */ virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction ); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::PostRender() + * @copydoc Dali::RenderSurface::PostRender() */ - virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, unsigned int timeDelta, bool replacingSurface ); + virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, unsigned int deltaTime, bool replacingSurface ); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::StopRender() + * @copydoc Dali::RenderSurface::StopRender() */ virtual void StopRender(); @@ -123,6 +114,10 @@ private: SYNC_MODE_WAIT }; + /** + * Set the sync mode. + * @param[in] syncMode The sync mode + */ void SetSyncMode( SyncMode syncMode ); /** @@ -154,10 +149,6 @@ private: // Data } // namespace ECore -} // namespace Adaptor - -} // namespace internal - } // namespace Dali -#endif // __DALI_INTERNAL_ECORE_X_PIXMAP_RENDER_SURFACE_H__ +#endif // __DALI_ECORE_X_PIXMAP_RENDER_SURFACE_H__ diff --git a/adaptors/x11/ecore-x-render-surface.h b/adaptors/integration-api/x11/ecore-x-render-surface.h similarity index 53% rename from adaptors/x11/ecore-x-render-surface.h rename to adaptors/integration-api/x11/ecore-x-render-surface.h index f0618d9..1280125 100644 --- a/adaptors/x11/ecore-x-render-surface.h +++ b/adaptors/integration-api/x11/ecore-x-render-surface.h @@ -1,5 +1,5 @@ -#ifndef __DALI_INTERNAL_ECORE_X_RENDER_SURFACE_H__ -#define __DALI_INTERNAL_ECORE_X_RENDER_SURFACE_H__ +#ifndef __DALI_ECORE_X_RENDER_SURFACE_H__ +#define __DALI_ECORE_X_RENDER_SURFACE_H__ /* * Copyright (c) 2014 Samsung Electronics Co., Ltd. @@ -19,25 +19,18 @@ */ // EXTERNAL INCLUDES -#include -#include #include #include // INTERNAL INCLUDES -#include +#include #include -#include +#include namespace Dali { -namespace Internal -{ - -namespace Adaptor -{ -class TriggerEvent; +class TriggerEventInterface; namespace ECore { @@ -47,31 +40,27 @@ namespace ECore * @todo change namespace to ECore_X11 as the class * is no longer pure X11. */ -class RenderSurface : public Internal::Adaptor::RenderSurface +class DALI_IMPORT_API EcoreXRenderSurface : public Dali::RenderSurface { public: /** * Uses an X11 surface to render to. - * @param [in] type the type of surface passed in * @param [in] positionSize the position and size of the surface * @param [in] surface can be a X-window or X-pixmap (type must be unsigned int). - * @param [in] display connection to X-server if the surface is a X window or pixmap (type must be void * to X display struct) * @param [in] name optional name of surface passed in * @param [in] isTransparent if it is true, surface has 32 bit color depth, otherwise, 24 bit */ - RenderSurface( SurfaceType type, - Dali::PositionSize positionSize, - Any surface, - Any display, - const std::string& name, - bool isTransparent = false); + EcoreXRenderSurface(Dali::PositionSize positionSize, + Any surface, + const std::string& name, + bool isTransparent = false); /** * Destructor. * Will delete the display, if it has ownership. * Will delete the window/pixmap if it has owner ship */ - virtual ~RenderSurface(); + virtual ~EcoreXRenderSurface(); protected: /** @@ -83,114 +72,91 @@ protected: public: // API /** - * @return the Ecore X window handle - */ - Ecore_X_Window GetXWindow(); - - /** - * @return the Main X display + * @brief Sets the render notification trigger to call when render thread is completed a frame + * + * @param renderNotification to use */ - XDisplay* GetMainDisplay(); + void SetRenderNotification(TriggerEventInterface* renderNotification); /** - * Sets the render notification trigger to call when render thread is completed a frame - * @param renderNotification to use + * @brief Get window handle + * + * @return the Ecore X window handle */ - void SetRenderNotification( TriggerEvent* renderNotification ); + Ecore_X_Window GetXWindow(); /** * Get the surface as an Ecore_X_drawable */ virtual Ecore_X_Drawable GetDrawable(); -public: // from Dali::RenderSurface - /** - * @copydoc Dali::RenderSurface::GetType() - */ - virtual Dali::RenderSurface::SurfaceType GetType() = 0; - - /** - * @copydoc Dali::RenderSurface::GetSurface() + * @brief Get the render surface the adaptor is using to render to. + * + * @return reference to current render surface (eg, pixmap / window) */ virtual Any GetSurface() = 0; - /** - * @copydoc Dali::RenderSurface::GetDisplay() - */ - virtual Any GetDisplay(); +public: // from Dali::RenderSurface /** * @copydoc Dali::RenderSurface::GetPositionSize() */ virtual PositionSize GetPositionSize() const; -public: // from Internal::Adaptor::RenderSurface + /** + * @copydoc Dali::RenderSurface::InitializeEgl() + */ + virtual void InitializeEgl( EglInterface& egl ) = 0; /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::CreateEglSurface() + * @copydoc Dali::RenderSurface::CreateEglSurface() */ virtual void CreateEglSurface( EglInterface& egl ) = 0; /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::DestroyEglSurface() + * @copydoc Dali::RenderSurface::DestroyEglSurface() */ virtual void DestroyEglSurface( EglInterface& egl ) = 0; /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::ReplaceEGLSurface() + * @copydoc Dali::RenderSurface::ReplaceEGLSurface() */ virtual bool ReplaceEGLSurface( EglInterface& egl ) = 0; /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::MoveResize() + * @copydoc Dali::RenderSurface::MoveResize() */ virtual void MoveResize( Dali::PositionSize positionSize); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::GetDpi() - */ - virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) const; - - /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::Map() - */ - virtual void Map(); - - /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::TransferDisplayOwner() + * @copydoc Dali::RenderSurface::SetViewMode() */ - virtual void TransferDisplayOwner( Internal::Adaptor::RenderSurface& newSurface ); + void SetViewMode( ViewMode viewMode ); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::ConsumeEvents() + * @copydoc Dali::RenderSurface::StartRender() */ - virtual void ConsumeEvents(); + virtual void StartRender() = 0; /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::SetViewMode() + * @copydoc Dali::RenderSurface::PreRender() */ - void SetViewMode( ViewMode ); + virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction ) = 0; /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::PreRender() + * @copydoc Dali::RenderSurface::PostRender() */ - virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction ) = 0; + virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, unsigned int deltaTime, bool replacingSurface ) = 0; /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::PostRender() + * @copydoc Dali::RenderSurface::ReleaseLock() */ - virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, unsigned int timeDelta, bool replacingSurface ) = 0; + virtual void ReleaseLock() = 0; private: /** - * Sets the display, if display parameter is empty it opens a new display - * @param display - */ - void SetDisplay( Any display ); - - /** * Get the surface id if the surface parameter is not empty * @param surface Any containing a surface id, or can be empty * @return surface id, or zero if surface is empty @@ -212,23 +178,15 @@ protected: protected: // Data - XDisplay* mMainDisplay; ///< X-connection for rendering - SurfaceType mType; ///< type of renderable PositionSize mPosition; ///< Position std::string mTitle; ///< Title of window which shows from "xinfo -topvwins" command + TriggerEventInterface* mRenderNotification; ///< Render notification trigger ColorDepth mColorDepth; ///< Color depth of surface (32 bit or 24 bit) - TriggerEvent* mRenderNotification; ///< Render notification trigger - bool mOwnSurface; ///< Whether we own the surface (responsible for deleting it) - bool mOwnDisplay; ///< Whether we own the display (responsible for deleting it) }; } // namespace ECore -} // namespace Adaptor - -} // namespace internal - } // namespace Dali -#endif // __DALI_INTERNAL_ECORE_X_RENDER_SURFACE_H__ +#endif // __DALI_ECORE_X_RENDER_SURFACE_H__ diff --git a/adaptors/x11/ecore-x-types.h b/adaptors/integration-api/x11/ecore-x-types.h similarity index 79% rename from adaptors/x11/ecore-x-types.h rename to adaptors/integration-api/x11/ecore-x-types.h index febf815..f425033 100644 --- a/adaptors/x11/ecore-x-types.h +++ b/adaptors/integration-api/x11/ecore-x-types.h @@ -1,5 +1,5 @@ -#ifndef __DALI_INTERNAL_X11_TYPES_H__ -#define __DALI_INTERNAL_X11_TYPES_H__ +#ifndef __DALI_X11_TYPES_H__ +#define __DALI_X11_TYPES_H__ /* * Copyright (c) 2014 Samsung Electronics Co., Ltd. @@ -24,21 +24,11 @@ namespace Dali { -namespace Internal -{ - -namespace Adaptor -{ - typedef ::Pixmap XPixmap; typedef ::Window XWindow; typedef ::Display XDisplay; typedef ::Screen XScreen; -} // namespace Adaptor - -} // namespace Internal - } // namespace Dali -#endif /* __DALI_INTERNAL_X11_TYPES_H__ */ +#endif /* __DALI_X11_TYPES_H__ */ diff --git a/adaptors/x11/pixmap-render-surface.h b/adaptors/integration-api/x11/pixmap-render-surface.h similarity index 68% rename from adaptors/x11/pixmap-render-surface.h rename to adaptors/integration-api/x11/pixmap-render-surface.h index b4af9c8..cf0a227 100644 --- a/adaptors/x11/pixmap-render-surface.h +++ b/adaptors/integration-api/x11/pixmap-render-surface.h @@ -1,5 +1,5 @@ -#ifndef __DALI_INTERNAL_ECORE_X_PIXMAP_RENDER_SURFACE_H__ -#define __DALI_INTERNAL_ECORE_X_PIXMAP_RENDER_SURFACE_H__ +#ifndef __DALI_ECORE_X_PIXMAP_RENDER_SURFACE_H__ +#define __DALI_ECORE_X_PIXMAP_RENDER_SURFACE_H__ /* * Copyright (c) 2014 Samsung Electronics Co., Ltd. @@ -18,26 +18,22 @@ * */ +// EXTERNAL INCLUDES +#include + // INTERNAL INCLUDES #include namespace Dali { -namespace Internal -{ - -namespace Adaptor -{ -class TriggerEvent; - namespace ECore { /** * Ecore X11 implementation of render surface. */ -class PixmapRenderSurface : public RenderSurface +class PixmapRenderSurface : public EcoreXRenderSurface { public: @@ -45,79 +41,72 @@ public: * Uses an X11 surface to render to. * @param [in] positionSize the position and size of the surface * @param [in] surface can be a X-window or X-pixmap (type must be unsigned int). - * @param [in] display connection to X-server if the surface is a X window or pixmap (type must be void * to X display struct) * @param [in] name optional name of surface passed in * @param [in] isTransparent if it is true, surface has 32 bit color depth, otherwise, 24 bit */ PixmapRenderSurface( Dali::PositionSize positionSize, Any surface, - Any display, const std::string& name, bool isTransparent = false); /** - * @copydoc Dali::Internal::Adaptor::ECore::RenderSurface::~RenderSurface + * @copydoc Dali::RenderSurface::~RenderSurface */ virtual ~PixmapRenderSurface(); public: // API /** - * @copydoc Dali::Internal::Adaptor::ECore::RenderSurface::GetDrawable() + * @copydoc Dali::ECore::EcoreXRenderSurface::GetDrawable() */ virtual Ecore_X_Drawable GetDrawable(); -public: // from Dali::RenderSurface - - /** - * @copydoc Dali::RenderSurface::GetType() - */ - virtual Dali::RenderSurface::SurfaceType GetType(); - /** - * @copydoc Dali::RenderSurface::GetSurface() + * @brief GetSurface + * + * @return pixmap */ virtual Any GetSurface(); -public: // from Internal::Adaptor::RenderSurface +public: // from Dali::RenderSurface /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::InitializeEgl() + * @copydoc Dali::RenderSurface::InitializeEgl() */ virtual void InitializeEgl( EglInterface& egl ); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::CreateEglSurface() + * @copydoc Dali::RenderSurface::CreateEglSurface() */ virtual void CreateEglSurface( EglInterface& egl ); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::DestroyEglSurface() + * @copydoc Dali::RenderSurface::DestroyEglSurface() */ virtual void DestroyEglSurface( EglInterface& egl ); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::ReplaceEGLSurface() + * @copydoc Dali::RenderSurface::ReplaceEGLSurface() */ virtual bool ReplaceEGLSurface( EglInterface& egl ); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::StartRender() + * @copydoc Dali::RenderSurface::StartRender() */ virtual void StartRender(); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::PreRender() + * @copydoc Dali::RenderSurface::PreRender() */ virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction ); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::PostRender() + * @copydoc Dali::RenderSurface::PostRender() */ - virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, unsigned int timeDelta, bool replacingSurface ); + virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, unsigned int deltaTime, bool replacingSurface ); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::StopRender() + * @copydoc Dali::RenderSurface::StopRender() */ virtual void StopRender(); @@ -138,7 +127,7 @@ private: * If sync mode is WAIT, then acquire a lock. This prevents render thread from * continuing until the pixmap has been drawn by the compositor. * It must be released for rendering to continue. - * @param[in] syncMode The sync mode + * @param[in] syncMode The current sync mode */ void AcquireLock( SyncMode syncMode ); @@ -159,19 +148,15 @@ private: private: // Data + boost::condition_variable mSyncNotify; ///< condition to notify main thread that pixmap was flushed to onscreen + boost::mutex mSyncMutex; ///< mutex to lock during waiting sync Ecore_X_Pixmap mX11Pixmap; ///< X-Pixmap SyncMode mSyncMode; ///< Stores whether the post render should block waiting for compositor - boost::mutex mSyncMutex; ///< mutex to lock during waiting sync - boost::condition_variable mSyncNotify; ///< condition to notify main thread that pixmap was flushed to onscreen bool mSyncReceived; ///< true, when a pixmap sync has occurred, (cleared after reading) }; } // namespace ECore -} // namespace Adaptor - -} // namespace internal - } // namespace Dali -#endif // __DALI_INTERNAL_ECORE_X_PIXMAP_RENDER_SURFACE_H__ +#endif // __DALI_ECORE_X_PIXMAP_RENDER_SURFACE_H__ diff --git a/adaptors/mobile/file.list b/adaptors/mobile/file.list index c88b1db..a38ad4b 100644 --- a/adaptors/mobile/file.list +++ b/adaptors/mobile/file.list @@ -1,5 +1,5 @@ # mobile profile internal files adaptor_common_internal_mobile_profile_src_files = \ - $(adaptor_mobile_dir)/mobile-render-surface-factory.cpp \ + $(adaptor_mobile_dir)/pixmap-render-surface-factory.cpp \ $(adaptor_mobile_dir)/mobile-system-settings.cpp \ $(adaptor_mobile_dir)/mobile-color-controller-impl.cpp diff --git a/adaptors/mobile/mobile-render-surface-factory.cpp b/adaptors/mobile/pixmap-render-surface-factory.cpp similarity index 65% rename from adaptors/mobile/mobile-render-surface-factory.cpp rename to adaptors/mobile/pixmap-render-surface-factory.cpp index 2770ed7..9517ba8 100644 --- a/adaptors/mobile/mobile-render-surface-factory.cpp +++ b/adaptors/mobile/pixmap-render-surface-factory.cpp @@ -21,31 +21,20 @@ namespace Dali { -namespace Internal -{ - -namespace Adaptor -{ - namespace ECore { -DALI_EXPORT_API RenderSurface* CreatePixmapSurface( - PositionSize positionSize, - Any surface, - Any display, - const std::string& name, - bool isTransparent ) +DALI_EXPORT_API PixmapRenderSurface* CreatePixmapSurface( + PositionSize positionSize, + Any surface, + const std::string& name, + bool isTransparent) { - return new PixmapRenderSurface( positionSize, surface, display, name, isTransparent ); + return new PixmapRenderSurface(positionSize, surface, name, isTransparent); } } // namespace ECoreX -} // namespace Adaptor - -} // namespace Internal - } // namespace Dali diff --git a/adaptors/public-api/adaptor-framework/render-surface.h b/adaptors/public-api/adaptor-framework/render-surface.h index bccd440..2611679 100644 --- a/adaptors/public-api/adaptor-framework/render-surface.h +++ b/adaptors/public-api/adaptor-framework/render-surface.h @@ -19,13 +19,26 @@ */ // EXTERNAL INCLUDES -#include #include #include +#include +#include + +// INTERNAL INCLUDES namespace Dali { +class EglInterface; +class DisplayConnection; + +namespace Integration +{ + +class GlAbstraction; + +} // namespace Integration + /** * @brief The position and size of the render surface. */ @@ -43,19 +56,10 @@ typedef Dali::Rect PositionSize; * The implementation of the factory method below should choose an appropriate * implementation of RenderSurface for the given platform */ + class RenderSurface { public: - /** - * @brief enumeration of surface types - */ - enum SurfaceType - { - NO_SURFACE, ///< not configured - PIXMAP, ///< Pixmap - WINDOW, ///< Window - NATIVE_BUFFER ///< Native Buffer - }; /** * @brief Constructor @@ -70,28 +74,81 @@ public: virtual ~RenderSurface() {} /** - * @brief returns the surface type. - * @return the surface type + * @brief Return the size and position of the surface. + * @return The position and size + */ + virtual PositionSize GetPositionSize() const = 0; + + /** + * Initialize EGL, RenderSurface should create egl display and initialize + * @param egl implementation to use for the creation */ - virtual SurfaceType GetType() = 0; + virtual void InitializeEgl( EglInterface& egl ) = 0; /** - * @brief Returns the window or pixmap surface. - * @return surface + * @brief Creates EGL Surface + * @param egl implementation to use for the creation */ - virtual Any GetSurface() = 0; + virtual void CreateEglSurface( EglInterface& egl ) = 0; /** - * @brief Returns the display. - * @return display + * @brief Destroys EGL Surface + * @param egl implementation to use for the destruction */ - virtual Any GetDisplay() = 0; + virtual void DestroyEglSurface( EglInterface& egl ) = 0; /** - * @brief Return the size and position of the surface. - * @return The position and size + * @brief Replace the EGL Surface + * @param egl implementation to use for the creation + * @return true if context was lost */ - virtual PositionSize GetPositionSize() const = 0; + virtual bool ReplaceEGLSurface( EglInterface& egl ) = 0; + + /** + * @brief Resizes the underlying surface. Only available for x window + */ + virtual void MoveResize( Dali::PositionSize positionSize ) = 0; + + /** + * @brief Set the stereoscopic 3D view mode + * @param[in] viewMode The new view mode + */ + virtual void SetViewMode( ViewMode viewMode ) = 0; + + /** + * @brief Called when Render thread has started + */ + virtual void StartRender() = 0; + + /** + * @brief Invoked by render thread before Core::Render + * If the operation fails, then Core::Render should not be called until there is + * a surface to render onto. + * @param[in] egl The Egl interface + * @param[in] glAbstraction OpenGLES abstraction interface + * @return True if the operation is successful, False if the operation failed + */ + virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction ) = 0; + + /** + * @brief Invoked by render thread after Core::Render + * @param[in] egl The Egl interface + * @param[in] glAbstraction OpenGLES abstraction interface + * @param[in] displayConnection display connection + * @param[in] deltaTime Time (in microseconds) since PostRender was last called. + * @param[in] replacingSurface True if the surface is being replaced. + */ + virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, unsigned int deltaTime, bool replacingSurface ) = 0; + + /** + * @brief Invoked by render thread when the thread should be stop + */ + virtual void StopRender() = 0; + + /** + * @brief Invoked by Event Thread when the compositor lock should be released and rendering should resume. + */ + virtual void ReleaseLock() = 0; private: @@ -104,7 +161,6 @@ private: * @brief Undefined assignment operator. RenderSurface cannot be copied */ RenderSurface& operator=( const RenderSurface& rhs ); - }; } // namespace Dali diff --git a/adaptors/public-api/adaptor-framework/singleton-service.cpp b/adaptors/public-api/adaptor-framework/singleton-service.cpp index d8181f2..53e7500 100644 --- a/adaptors/public-api/adaptor-framework/singleton-service.cpp +++ b/adaptors/public-api/adaptor-framework/singleton-service.cpp @@ -28,6 +28,11 @@ SingletonService::SingletonService() { } +SingletonService SingletonService::New() +{ + return Internal::Adaptor::SingletonService::New(); +} + SingletonService SingletonService::Get() { return Internal::Adaptor::SingletonService::Get(); diff --git a/adaptors/public-api/adaptor-framework/singleton-service.h b/adaptors/public-api/adaptor-framework/singleton-service.h index 552e388..1c0fbf9 100644 --- a/adaptors/public-api/adaptor-framework/singleton-service.h +++ b/adaptors/public-api/adaptor-framework/singleton-service.h @@ -52,6 +52,13 @@ public: SingletonService(); /** + * Create a SingletonService. + * This should only be called once by the Application class. + * @return A newly created SingletonService. + */ + static Dali::SingletonService New(); + + /** * @brief Retrieves a handle to the SingletonService. * * @return A handle to the SingletonService if it is available. This will be an empty handle if diff --git a/adaptors/tv/tv-render-surface-factory.cpp b/adaptors/tv/tv-render-surface-factory.cpp index 2770ed7..802810f 100644 --- a/adaptors/tv/tv-render-surface-factory.cpp +++ b/adaptors/tv/tv-render-surface-factory.cpp @@ -21,31 +21,20 @@ namespace Dali { -namespace Internal -{ - -namespace Adaptor -{ - namespace ECore { -DALI_EXPORT_API RenderSurface* CreatePixmapSurface( +DALI_EXPORT_API PixmapRenderSurface* CreatePixmapSurface( PositionSize positionSize, Any surface, - Any display, const std::string& name, bool isTransparent ) { - return new PixmapRenderSurface( positionSize, surface, display, name, isTransparent ); + return new PixmapRenderSurface( positionSize, surface, name, isTransparent ); } } // namespace ECoreX -} // namespace Adaptor - -} // namespace Internal - } // namespace Dali diff --git a/adaptors/wayland/display-connection-impl-wl.cpp b/adaptors/wayland/display-connection-impl-wl.cpp new file mode 100644 index 0000000..89d946c --- /dev/null +++ b/adaptors/wayland/display-connection-impl-wl.cpp @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2015 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// CLASS HEADER +#include "display-connection-impl.h" + +// EXTERNAL_HEADERS +#include +#include + +// INTERNAL HEADERS +#include + +namespace Dali +{ + +namespace Internal +{ + +namespace Adaptor +{ + +DisplayConnection* DisplayConnection::New() +{ + DisplayConnection* pDisplayConnection(new DisplayConnection()); + + return pDisplayConnection; +} + +DisplayConnection::DisplayConnection() +: mDisplay(NULL) +{ + //FIXME +} + +DisplayConnection::~DisplayConnection() +{ + //FIXME +} + +Any DisplayConnection::GetDisplay() +{ + return Any(mDisplay); +} + +void DisplayConnection::ConsumeEvents() +{ +} + +bool DisplayConnection::InitializeEgl(EglInterface& egl) +{ + EglImplementation& eglImpl = static_cast(egl); + + if (!eglImpl.InitializeGles(reinterpret_cast(mDisplay))) + { + DALI_LOG_ERROR("Failed to initialize GLES."); + return false; + } + + return true; +} + +void DisplayConnection::GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) +{ + // calculate DPI + float xres, yres; + + // 1 inch = 25.4 millimeters + xres = ecore_wl_dpi_get(); + yres = ecore_wl_dpi_get(); + + dpiHorizontal = int(xres + 0.5f); // rounding + dpiVertical = int(yres + 0.5f); +} + +} // namespace Adaptor + +} // namespace Internal + +} // namespace Dali diff --git a/adaptors/wayland/display-connection-impl.h b/adaptors/wayland/display-connection-impl.h new file mode 100644 index 0000000..49ba200 --- /dev/null +++ b/adaptors/wayland/display-connection-impl.h @@ -0,0 +1,109 @@ +#ifndef __DALI_INTERNAL_ECORE_X_DIPLAY_CONNECTION_H__ +#define __DALI_INTERNAL_ECORE_X_DIPLAY_CONNECTION_H__ + +/* + * Copyright (c) 2015 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// EXTERNAL INCLUDES +#include +#include +#include + +// INTERNAL INCLUDES +#include +#include +#include + +namespace Dali +{ + +class RenderSurface; +class DisplayConnection; + +namespace Internal +{ + +namespace Adaptor +{ + +/** + * DisplayConnection implementation + */ +class DisplayConnection : public Dali::BaseObject +{ +public: + + /** + * @brief Default constructor + */ + DisplayConnection(); + + /** + * @brief Create an initialized DisplayConnection. + * + * @return A handle to a newly allocated DisplayConnection resource. + */ + static DisplayConnection* New(); + +public: + + /** + * @copydoc Dali::DisplayConnection::GetDisplay + */ + Any GetDisplay(); + + /** + * @copydoc Dali::DisplayConnection::GetDpi + */ + static void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical); + + /** + * @copydoc Dali::DisplayConnection::ConsumeEvents + */ + void ConsumeEvents(); + + /** + * @copydoc Dali::DisplayConnection::InitializeEgl + */ + bool InitializeEgl(EglInterface& egl); + +public: + + /** + * Destructor + */ + virtual ~DisplayConnection(); + +protected: + + // Undefined + DisplayConnection(const DisplayConnection&); + + // Undefined + DisplayConnection& operator=(const DisplayConnection& rhs); + +private: + WlDisplay* mDisplay; ///< Wayland-display for rendering +}; + +} // namespace Adaptor + +} // namespace internal + +} // namespace Dali + +#endif // __DALI_INTERNAL_ECORE_X_DIPLAY_CONNECTION_H__ diff --git a/adaptors/wayland/ecore-wl-render-surface.cpp b/adaptors/wayland/ecore-wl-render-surface.cpp index 98b916c..7f20d65 100644 --- a/adaptors/wayland/ecore-wl-render-surface.cpp +++ b/adaptors/wayland/ecore-wl-render-surface.cpp @@ -25,16 +25,11 @@ // INTERNAL INCLUDES #include #include +#include namespace Dali { -namespace Internal -{ - -namespace Adaptor -{ - #if defined(DEBUG_ENABLED) Debug::Filter* gRenderSurfaceLogFilter = Debug::Filter::New(Debug::Verbose, false, "LOG_ECORE_X_RENDER_SURFACE"); #endif @@ -42,33 +37,19 @@ Debug::Filter* gRenderSurfaceLogFilter = Debug::Filter::New(Debug::Verbose, fals namespace ECore { -namespace -{ - -static bool gWlInitThreadsCalled = false; ///< global to say whether WlInitThreads has been called in this process - -} // unnamed namespace - -RenderSurface::RenderSurface( SurfaceType type, - Dali::PositionSize positionSize, - Any surface, - Any display, - const std::string& name, - bool isTransparent) -: mMainDisplay(NULL), - mType(type), - mPosition(positionSize), +EcoreWlRenderSurface::EcoreWlRenderSurface(Dali::PositionSize positionSize, + Any surface, + const std::string& name, + bool isTransparent) +: mPosition(positionSize), mTitle(name), + mRenderNotification(NULL), mColorDepth(isTransparent ? COLOR_DEPTH_32 : COLOR_DEPTH_24), - mRenderNotification( NULL ), - mOwnSurface(false), - mOwnDisplay(false) + mOwnSurface(false) { - // see if there is a display in Any display - SetDisplay( display ); } -void RenderSurface::Init( Any surface ) +void EcoreWlRenderSurface::Init( Any surface ) { // see if there is a surface in Any surface unsigned int surfaceId = GetSurfaceId( surface ); @@ -76,14 +57,6 @@ void RenderSurface::Init( Any surface ) // if the surface is empty, create a new one. if ( surfaceId == 0 ) { - if ( !gWlInitThreadsCalled ) - { - ecore_wl_init(NULL); - mMainDisplay = ecore_wl_display_get(); - mOwnDisplay = true; - gWlInitThreadsCalled = true; - } - // we own the surface about to created mOwnSurface = true; CreateWlRenderable(); @@ -95,129 +68,49 @@ void RenderSurface::Init( Any surface ) } #ifdef DEBUG_ENABLED - // prints out 'INFO: DALI: new RenderSurface, created display xx, used existing surface xx + // prints out 'INFO: DALI: new EcoreWlRenderSurface, created display xx, used existing surface xx // we can not use LOG_INFO because the surface can be created before Dali Core is created. - printf( "INFO: DALI: new RenderSurface, %s display %p, %s %s surface %X \n", - mOwnDisplay?"created":"used existing",mMainDisplay, - mOwnSurface?"created":"used existing", - Dali::RenderSurface::PIXMAP==mType?" pixmap" :"window", - GetDrawable() ); + printf( "INFO: DALI: new EcoreWlRenderSurface, %s %s surface %X \n", + mOwnSurface?"created":"used existing", + Dali::RenderSurface::PIXMAP==mType?" pixmap" :"window", + GetDrawable() ); #endif } -RenderSurface::~RenderSurface() +EcoreWlRenderSurface::~EcoreWlRenderSurface() { - // release the display connection if we use our own - if( mOwnDisplay ) - { - if( mMainDisplay ) - { - // NOTE, on 64bit desktop with some NVidia driver versions this crashes - } - } } -Ecore_Wl_Window* RenderSurface::GetWlWindow() -{ - return 0; -} - -WlDisplay* RenderSurface::GetMainDisplay() -{ - return mMainDisplay; -} - -void RenderSurface::SetRenderNotification( TriggerEvent* renderNotification ) +void EcoreWlRenderSurface::SetRenderNotification(TriggerEventInterface* renderNotification) { mRenderNotification = renderNotification; } -Ecore_Wl_Window* RenderSurface::GetDrawable() +Ecore_Wl_Window* EcoreWlRenderSurface::GetWlWindow() { return 0; } -Any RenderSurface::GetDisplay() +Ecore_Wl_Window* EcoreWlRenderSurface::GetDrawable() { - // this getter is used by main thread so we need to return the main thread version of the display - return Any( ecore_wl_display_get() ); + return 0; } -PositionSize RenderSurface::GetPositionSize() const +PositionSize EcoreWlRenderSurface::GetPositionSize() const { return mPosition; } -void RenderSurface::MoveResize( Dali::PositionSize positionSize ) +void EcoreWlRenderSurface::MoveResize( Dali::PositionSize positionSize ) { // nothing to do in base class } -void RenderSurface::GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) const -{ - // calculate DPI - float xres, yres; - - // 1 inch = 25.4 millimeters - xres = ecore_wl_dpi_get(); - yres = ecore_wl_dpi_get(); - - dpiHorizontal = int(xres + 0.5f); // rounding - dpiVertical = int(yres + 0.5f); -} - -void RenderSurface::Map() +void EcoreWlRenderSurface::SetViewMode( ViewMode viewMode ) { } -void RenderSurface::TransferDisplayOwner( Internal::Adaptor::RenderSurface& newSurface ) -{ - // if we don't own the display return - if( mOwnDisplay == false ) - { - return; - } - - RenderSurface* other = dynamic_cast< RenderSurface* >( &newSurface ); - if( other ) - { - // if both surfaces share the same display, and this surface owns it, - // then transfer the ownership to the new surface - if( other->mMainDisplay == mMainDisplay ) - { - mOwnDisplay = false; - other->mOwnDisplay = true; - } - } -} - -void RenderSurface::ConsumeEvents() -{ -} - -void RenderSurface::SetViewMode( ViewMode ) -{ -} - -void RenderSurface::SetDisplay( Any display ) -{ - // the render surface can be passed either EFL e-core types, or x11 types - // we use boost any to determine at run time which type - - if ( display.Empty() == false ) - { - // check we have a valid type - DALI_ASSERT_ALWAYS( ( display.GetType() == typeid (WlDisplay *) ) - && - "Display type is invalid" ); - - mOwnDisplay = false; - - mMainDisplay = AnyCast< WlDisplay* >( display ); - } -} - -unsigned int RenderSurface::GetSurfaceId( Any surface ) const +unsigned int EcoreWlRenderSurface::GetSurfaceId( Any surface ) const { unsigned int surfaceId = 0; @@ -234,8 +127,4 @@ unsigned int RenderSurface::GetSurfaceId( Any surface ) const } // namespace ECore -} // namespace Adaptor - -} // namespace Internal - } // namespace Dali diff --git a/adaptors/wayland/egl-implementation-wl.cpp b/adaptors/wayland/egl-implementation-wl.cpp index 72e9696..3e721f1 100644 --- a/adaptors/wayland/egl-implementation-wl.cpp +++ b/adaptors/wayland/egl-implementation-wl.cpp @@ -17,6 +17,7 @@ // CLASS HEADER +#include #include // EXTERNAL INCLUDES @@ -230,7 +231,6 @@ void EglImplementation::MakeContextCurrent() eglQueryString(mEglDisplay, EGL_VERSION), eglQueryString(mEglDisplay, EGL_CLIENT_APIS), eglQueryString(mEglDisplay, EGL_EXTENSIONS)); - } void EglImplementation::MakeContextNull() @@ -368,27 +368,27 @@ void EglImplementation::ChooseConfig( bool isWindowType, ColorDepth depth ) { case EGL_BAD_DISPLAY: { - DALI_LOG_ERROR("Display is not an EGL display connection"); + DALI_LOG_ERROR("Display is not an EGL display connection\n"); break; } case EGL_BAD_ATTRIBUTE: { - DALI_LOG_ERROR("The parameter confirAttribs contains an invalid frame buffer configuration attribute or an attribute value that is unrecognized or out of range"); + DALI_LOG_ERROR("The parameter configAttribs contains an invalid frame buffer configuration attribute or an attribute value that is unrecognized or out of range\n"); break; } case EGL_NOT_INITIALIZED: { - DALI_LOG_ERROR("Display has not been initialized"); + DALI_LOG_ERROR("Display has not been initialized\n"); break; } case EGL_BAD_PARAMETER: { - DALI_LOG_ERROR("The parameter numConfig is NULL"); + DALI_LOG_ERROR("The parameter numConfig is NULL\n"); break; } default: { - DALI_LOG_ERROR("Unknown error"); + DALI_LOG_ERROR("Unknown error.\n"); } } DALI_ASSERT_ALWAYS(false && "eglChooseConfig failed!"); @@ -396,13 +396,12 @@ void EglImplementation::ChooseConfig( bool isWindowType, ColorDepth depth ) if ( numConfigs != 1 ) { - DALI_LOG_ERROR("No configurations found."); + DALI_LOG_ERROR("No configurations found.\n"); TEST_EGL_ERROR("eglChooseConfig"); } } - void EglImplementation::CreateSurfaceWindow( EGLNativeWindowType window, ColorDepth depth ) { DALI_ASSERT_ALWAYS( ( mEglSurface == 0 ) && "EGL surface already exists" ); @@ -437,54 +436,27 @@ void EglImplementation::CreateSurfacePixmap( EGLNativePixmapType pixmap, ColorDe DALI_ASSERT_ALWAYS( mEglSurface && "Create pixmap surface failed" ); } -bool EglImplementation::ReplaceSurfaceWindow( EGLNativeWindowType window, EGLNativeDisplayType display ) +bool EglImplementation::ReplaceSurfaceWindow( EGLNativeWindowType window ) { bool contextLost = false; + // display connection has not changed, then we can just create a new surface // the surface is bound to the context, so set the context to null MakeContextNull(); // destroy the surface DestroySurface(); - // If the display has not changed, then we can just create a new surface - if ( display == mEglNativeDisplay ) - { - // create the EGL surface - CreateSurfaceWindow( window, mColorDepth ); - - // set the context to be current with the new surface - MakeContextCurrent(); - } - else // the display has changed, we need to start egl with a new x-connection - { - // Note! this code path is untested - - // this will release all EGL specific resources - eglTerminate( mEglDisplay ); - - mGlesInitialized = false; - - // let the adaptor know that all resources have been lost - contextLost = true; - - // re-initialise GLES with the new connection - InitializeGles( display ); - - // create the EGL surface - CreateSurfaceWindow( window, mColorDepth ); + // create the EGL surface + CreateSurfaceWindow( window, mColorDepth ); - // create the OpenGL context - CreateContext(); - - // Make it current - MakeContextCurrent(); - } + // set the context to be current with the new surface + MakeContextCurrent(); return contextLost; } -bool EglImplementation::ReplaceSurfacePixmap( EGLNativePixmapType pixmap, EGLNativeDisplayType display ) +bool EglImplementation::ReplaceSurfacePixmap( EGLNativePixmapType pixmap ) { bool contextLost = false; @@ -494,39 +466,13 @@ bool EglImplementation::ReplaceSurfacePixmap( EGLNativePixmapType pixmap, EGLNat // destroy the surface DestroySurface(); - // If the display has not changed, then we can just create a new surface - if ( display == mEglNativeDisplay ) - { - // create the EGL surface - CreateSurfacePixmap( pixmap, mColorDepth ); + // display connection has not changed, then we can just create a new surface + // create the EGL surface + CreateSurfacePixmap( pixmap, mColorDepth ); - // set the context to be current with the new surface - MakeContextCurrent(); - } - else // the display has changed, we need to start egl with a new x-connection - { - // Note! this code path is untested - - // this will release all EGL specific resources - eglTerminate( mEglDisplay ); + // set the context to be current with the new surface + MakeContextCurrent(); - mGlesInitialized = false; - - // let the adaptor know that all resources have been lost - contextLost = true; - - // re-initialise GLES with the new connection - InitializeGles( display ); - - // create the EGL surface - CreateSurfacePixmap( pixmap, mColorDepth ); - - // create the OpenGL context - CreateContext(); - - // Make it current - MakeContextCurrent(); - } return contextLost; } diff --git a/adaptors/wayland/event-handler-wl.cpp b/adaptors/wayland/event-handler-wl.cpp index 43956c0..f8aa01e 100644 --- a/adaptors/wayland/event-handler-wl.cpp +++ b/adaptors/wayland/event-handler-wl.cpp @@ -677,14 +677,11 @@ EventHandler::EventHandler( RenderSurface* surface, CoreEventInterface& coreEven { Ecore_Wl_Window* window = 0; - if( surface->GetType() == Dali::RenderSurface::WINDOW ) + // this code only works with the Ecore RenderSurface so need to downcast + ECore::WindowRenderSurface* ecoreSurface = dynamic_cast< ECore::WindowRenderSurface* >( surface ); + if( ecoreSurface ) { - // this code only works with the Ecore RenderSurface so need to downcast - ECore::WindowRenderSurface* ecoreSurface = dynamic_cast< ECore::WindowRenderSurface* >( surface ); - if( ecoreSurface ) - { - window = ecoreSurface->GetWlWindow(); - } + window = ecoreSurface->GetWlWindow(); } mImpl = new Impl(this, window); diff --git a/adaptors/wayland/file.list b/adaptors/wayland/file.list index 9694a1e..9c415d3 100644 --- a/adaptors/wayland/file.list +++ b/adaptors/wayland/file.list @@ -3,6 +3,7 @@ adaptor_wayland_tizen_internal_src_files = \ $(adaptor_wayland_dir)/accessibility-manager-impl-wl.cpp \ $(adaptor_wayland_dir)/clipboard-impl-wl.cpp \ + $(adaptor_wayland_dir)/display-connection-impl-wl.cpp \ $(adaptor_wayland_dir)/framework-wl.cpp \ $(adaptor_wayland_dir)/imf-manager-impl-wl.cpp \ $(adaptor_wayland_dir)/pixmap-image-impl-wl.cpp \ diff --git a/adaptors/wayland/imf-manager-impl.h b/adaptors/wayland/imf-manager-impl.h index b241f0f..07ec6e3 100644 --- a/adaptors/wayland/imf-manager-impl.h +++ b/adaptors/wayland/imf-manager-impl.h @@ -32,14 +32,14 @@ namespace Dali { +class RenderSurface; + namespace Internal { namespace Adaptor { -class RenderSurface; - class ImfManager : public Dali::BaseObject { public: diff --git a/adaptors/wayland/pixmap-render-surface-wl.cpp b/adaptors/wayland/pixmap-render-surface-wl.cpp index 0ccba73..4d4db90 100644 --- a/adaptors/wayland/pixmap-render-surface-wl.cpp +++ b/adaptors/wayland/pixmap-render-surface-wl.cpp @@ -25,16 +25,12 @@ // INTERNAL INCLUDES #include #include +#include +#include namespace Dali { -namespace Internal -{ - -namespace Adaptor -{ - #if defined(DEBUG_ENABLED) extern Debug::Filter* gRenderSurfaceLogFilter; #endif @@ -42,12 +38,11 @@ extern Debug::Filter* gRenderSurfaceLogFilter; namespace ECore { -PixmapRenderSurface::PixmapRenderSurface( Dali::PositionSize positionSize, - Any surface, - Any display, - const std::string& name, - bool isTransparent) -: RenderSurface( Dali::RenderSurface::PIXMAP, positionSize, surface, display, name, isTransparent ) +PixmapRenderSurface::PixmapRenderSurface(Dali::PositionSize positionSize, + Any surface, + const std::string& name, + bool isTransparent) +: EcoreWlRenderSurface( positionSize, surface, name, isTransparent ) { Init( surface ); } @@ -62,9 +57,9 @@ PixmapRenderSurface::~PixmapRenderSurface() } } -Dali::RenderSurface::SurfaceType PixmapRenderSurface::GetType() +Ecore_Wl_Window* PixmapRenderSurface::GetDrawable() { - return Dali::RenderSurface::PIXMAP; + return NULL; } Any PixmapRenderSurface::GetSurface() @@ -72,42 +67,36 @@ Any PixmapRenderSurface::GetSurface() return Any( NULL ); } -void PixmapRenderSurface::InitializeEgl( EglInterface& eglIf ) +void PixmapRenderSurface::InitializeEgl( EglInterface& egl ) { DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter ); - EglImplementation& eglImpl = static_cast( eglIf ); - eglImpl.InitializeGles( reinterpret_cast< EGLNativeDisplayType >( mMainDisplay ) ); + Internal::Adaptor::EglImplementation& eglImpl = static_cast( egl ); eglImpl.ChooseConfig(false, mColorDepth); } -void PixmapRenderSurface::CreateEglSurface( EglInterface& eglIf ) +void PixmapRenderSurface::CreateEglSurface( EglInterface& egl ) { DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter ); - //EglImplementation& eglImpl = static_cast( eglIf ); - // create the EGL surface // need to cast to X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit // FIXME } -void PixmapRenderSurface::DestroyEglSurface( EglInterface& eglIf ) +void PixmapRenderSurface::DestroyEglSurface( EglInterface& egl ) { DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter ); - EglImplementation& eglImpl = static_cast( eglIf ); + Internal::Adaptor::EglImplementation& eglImpl = static_cast( egl ); eglImpl.DestroySurface(); } -bool PixmapRenderSurface::ReplaceEGLSurface( EglInterface& eglIf ) +bool PixmapRenderSurface::ReplaceEGLSurface( EglInterface& egl ) { DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter ); - EglImplementation& eglImpl = static_cast( eglIf ); - eglImpl.InitializeGles( reinterpret_cast< EGLNativeDisplayType >( mMainDisplay ) ); - // a new surface for the new pixmap // need to cast to X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit // FIXME @@ -116,6 +105,7 @@ bool PixmapRenderSurface::ReplaceEGLSurface( EglInterface& eglIf ) void PixmapRenderSurface::StartRender() { + // FIXME } bool PixmapRenderSurface::PreRender( EglInterface&, Integration::GlAbstraction& ) @@ -124,12 +114,12 @@ bool PixmapRenderSurface::PreRender( EglInterface&, Integration::GlAbstraction& return true; } -void PixmapRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, unsigned int timeDelta, bool replacingSurface ) +void PixmapRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, unsigned int deltaTime, bool replacingSurface ) { // flush gl instruction queue glAbstraction.Flush(); - // create damage for client applications which wish to know the update timing + // create damage for client applications which wish to know the update timing if( mRenderNotification ) { // use notification trigger @@ -138,8 +128,6 @@ void PixmapRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstract } else { - // as a fallback, send damage event. This is needed until livebox is fixed to - // stop using damage events for render // FIXME } @@ -149,6 +137,7 @@ void PixmapRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstract void PixmapRenderSurface::StopRender() { + // FIXME } void PixmapRenderSurface::CreateWlRenderable() @@ -161,24 +150,24 @@ void PixmapRenderSurface::CreateWlRenderable() void PixmapRenderSurface::UseExistingRenderable( unsigned int surfaceId ) { + // FIXME } void PixmapRenderSurface::SetSyncMode( SyncMode syncMode ) { + // FIXME } void PixmapRenderSurface::AcquireLock( SyncMode syncMode ) { + // FIXME } void PixmapRenderSurface::ReleaseLock() { + // FIXME } } // namespace ECore -} // namespace Adaptor - -} // namespace Internal - } // namespace Dali diff --git a/adaptors/wayland/window-impl-wl.cpp b/adaptors/wayland/window-impl-wl.cpp index da7a1c0..b5ceec9 100644 --- a/adaptors/wayland/window-impl-wl.cpp +++ b/adaptors/wayland/window-impl-wl.cpp @@ -224,8 +224,11 @@ void Window::Initialize(const PositionSize& windowPosition, const std::string& n { // create an Wayland window by default Any surface; - Any display; - mSurface = new ECore::WindowRenderSurface( windowPosition, surface, display, name, mIsTransparent ); + ECore::WindowRenderSurface* windowSurface = new ECore::WindowRenderSurface( windowPosition, surface, name, mIsTransparent ); + windowSurface->Map(); + + mSurface = windowSurface; + mOrientation = Orientation::New(this); // create event handler for Wayland window diff --git a/adaptors/wayland/window-render-surface-wl.cpp b/adaptors/wayland/window-render-surface-wl.cpp index a9c0505..f2d83ba 100644 --- a/adaptors/wayland/window-render-surface-wl.cpp +++ b/adaptors/wayland/window-render-surface-wl.cpp @@ -25,16 +25,12 @@ // INTERNAL INCLUDES #include #include +#include +#include namespace Dali { -namespace Internal -{ - -namespace Adaptor -{ - #if defined(DEBUG_ENABLED) extern Debug::Filter* gRenderSurfaceLogFilter; #endif @@ -51,10 +47,9 @@ const int MINIMUM_DIMENSION_CHANGE( 1 ); ///< Minimum change for window to be co WindowRenderSurface::WindowRenderSurface( Dali::PositionSize positionSize, Any surface, - Any display, const std::string& name, bool isTransparent) -: RenderSurface( Dali::RenderSurface::WINDOW, positionSize, surface, display, name, isTransparent ), +: EcoreWlRenderSurface( positionSize, surface, name, isTransparent ), mNeedToApproveDeiconify(false) { DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "Creating Window\n" ); @@ -75,11 +70,6 @@ Ecore_Wl_Window* WindowRenderSurface::GetDrawable() return mWlWindow; } -Dali::RenderSurface::SurfaceType WindowRenderSurface::GetType() -{ - return Dali::RenderSurface::WINDOW; -} - Any WindowRenderSurface::GetSurface() { // already an e-core type @@ -100,8 +90,7 @@ void WindowRenderSurface::InitializeEgl( EglInterface& eglIf ) { DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter ); - EglImplementation& eglImpl = static_cast( eglIf ); - eglImpl.InitializeGles( reinterpret_cast< EGLNativeDisplayType >( mMainDisplay ) ); + Internal::Adaptor::EglImplementation& eglImpl = static_cast( eglIf ); eglImpl.ChooseConfig(true, mColorDepth); } @@ -110,7 +99,7 @@ void WindowRenderSurface::CreateEglSurface( EglInterface& eglIf ) { DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter ); - EglImplementation& eglImpl = static_cast( eglIf ); + Internal::Adaptor::EglImplementation& eglImpl = static_cast( eglIf ); // create the EGL surface ecore_wl_window_surface_create(mWlWindow); @@ -122,23 +111,21 @@ void WindowRenderSurface::DestroyEglSurface( EglInterface& eglIf ) { DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter ); - EglImplementation& eglImpl = static_cast( eglIf ); + Internal::Adaptor::EglImplementation& eglImpl = static_cast( eglIf ); eglImpl.DestroySurface(); wl_egl_window_destroy(mEglWindow); mEglWindow = NULL; } -bool WindowRenderSurface::ReplaceEGLSurface( EglInterface& eglIf ) +bool WindowRenderSurface::ReplaceEGLSurface( EglInterface& egl ) { DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter ); - EglImplementation& egl = static_cast( eglIf ); - egl.InitializeGles( reinterpret_cast< EGLNativeDisplayType >( mMainDisplay ) ); - wl_egl_window_destroy(mEglWindow); mEglWindow = wl_egl_window_create(ecore_wl_window_surface_get(mWlWindow), mPosition.width, mPosition.height); - return egl.ReplaceSurfaceWindow( (EGLNativeWindowType)mEglWindow, // reinterpret_cast does not compile - reinterpret_cast< EGLNativeDisplayType >( mMainDisplay ) ); + + Internal::Adaptor::EglImplementation& eglImpl = static_cast( egl ); + return eglImpl.ReplaceSurfaceWindow( (EGLNativeWindowType)mEglWindow ); // reinterpret_cast does not compile } void WindowRenderSurface::MoveResize( Dali::PositionSize positionSize ) @@ -188,9 +175,9 @@ bool WindowRenderSurface::PreRender( EglInterface&, Integration::GlAbstraction& return true; } -void WindowRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, unsigned int, bool ) +void WindowRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, unsigned int deltaTime, bool replacingSurface ) { - EglImplementation& eglImpl = static_cast( egl ); + Internal::Adaptor::EglImplementation& eglImpl = static_cast( egl ); eglImpl.SwapBuffers(); // When the window is deiconified, it approves the deiconify operation to window manager after rendering @@ -199,6 +186,8 @@ void WindowRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstract // SwapBuffer is desychronized. So make sure to sychronize when window is deiconified. glAbstraction.Finish(); + //FIXME + mNeedToApproveDeiconify = false; } } @@ -209,6 +198,7 @@ void WindowRenderSurface::StopRender() void WindowRenderSurface::SetViewMode( ViewMode viewMode ) { + //FIXME } void WindowRenderSurface::CreateWlRenderable() @@ -229,6 +219,8 @@ void WindowRenderSurface::CreateWlRenderable() { DALI_ASSERT_ALWAYS(0 && "Failed to create X window"); } + + //FIXME } void WindowRenderSurface::UseExistingRenderable( unsigned int surfaceId ) @@ -243,8 +235,4 @@ void WindowRenderSurface::ReleaseLock() } // namespace ECore -} // namespace Adaptor - -} // namespace Internal - } // namespace Dali diff --git a/adaptors/wayland/window-render-surface.h b/adaptors/wayland/window-render-surface.h index 81a1026..4102522 100644 --- a/adaptors/wayland/window-render-surface.h +++ b/adaptors/wayland/window-render-surface.h @@ -25,20 +25,14 @@ namespace Dali { -namespace Internal -{ - -namespace Adaptor -{ - namespace ECore { /** - * @copydoc Dali::Internal::Adaptor::ECore::RenderSurface. + * @copydoc Dali::ECore::EcoreWlRenderSurface. * Window specialization. */ -class WindowRenderSurface : public RenderSurface +class WindowRenderSurface : public EcoreWlRenderSurface { public: @@ -46,18 +40,16 @@ public: * Uses an Wayland surface to render to. * @param [in] positionSize the position and size of the surface * @param [in] surface can be a Wayland-window or Wayland-pixmap (type must be unsigned int). - * @param [in] display connection to Wayland-server if the surface is a X window or pixmap (type must be void * to X display struct) * @param [in] name optional name of surface passed in * @param [in] isTransparent if it is true, surface has 32 bit color depth, otherwise, 24 bit */ WindowRenderSurface( Dali::PositionSize positionSize, Any surface, - Any display, const std::string& name, bool isTransparent = false ); /** - * @copydoc Dali::Internal::Adaptor::ECore::RenderSurface::~RenderSurface + * @copydoc Dali::ECore::EcoreWlRenderSurface::~EcoreWlRenderSurface */ virtual ~WindowRenderSurface(); @@ -74,82 +66,75 @@ public: // API */ void RequestToApproveDeiconify(); -public: // from Dali::RenderSurface - /** - * @copydoc Dali::RenderSurface::GetType() + * Map window */ - virtual Dali::RenderSurface::SurfaceType GetType(); + virtual void Map(); /** - * @copydoc Dali::RenderSurface::GetSurface() + * @copydoc Dali::ECore::EcoreWlRenderSurface::GetSurface() */ virtual Any GetSurface(); /** - * @copydoc Dali::RenderSurface::GetDrawable() + * @copydoc Dali::ECore::EcoreWlRenderSurface::GetWlWindow() */ virtual Ecore_Wl_Window* GetWlWindow(); -public: // from Internal::Adaptor::RenderSurface +public: // from Dali::RenderSurface /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::InitializeEgl() + * @copydoc Dali::RenderSurface::InitializeEgl() */ virtual void InitializeEgl( EglInterface& egl ); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::CreateEglSurface() + * @copydoc Dali::RenderSurface::CreateEglSurface() */ virtual void CreateEglSurface( EglInterface& egl ); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::DestroyEglSurface() + * @copydoc Dali::RenderSurface::DestroyEglSurface() */ virtual void DestroyEglSurface( EglInterface& egl ); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::ReplaceEGLSurface() + * @copydoc Dali::RenderSurface::ReplaceEGLSurface() */ virtual bool ReplaceEGLSurface( EglInterface& egl ); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::MoveResize() + * @copydoc Dali::RenderSurface::MoveResize() */ virtual void MoveResize( Dali::PositionSize positionSize); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::Map() + * @copydoc Dali::RenderSurface::SetViewMode() */ - virtual void Map(); + void SetViewMode( ViewMode viewMode ); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::StartRender() + * @copydoc Dali::RenderSurface::StartRender() */ virtual void StartRender(); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::PreRender() + * @copydoc Dali::RenderSurface::PreRender() */ virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction ); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::PostRender() + * @copydoc Dali::RenderSurface::PostRender() */ - virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, unsigned int timeDelta, bool replacingSurface ); + virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, unsigned int deltaTime, bool replacingSurface ); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::StopRender() + * @copydoc Dali::RenderSurface::StopRender() */ virtual void StopRender(); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::SetViewMode() - */ - void SetViewMode( ViewMode viewMode ); - - /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::ReleaseLock() + * @copydoc Dali::RenderSurface::ReleaseLock() */ virtual void ReleaseLock(); @@ -161,7 +146,7 @@ protected: virtual void CreateWlRenderable(); /** - * @copydoc Dali::Internal::Adaptor::ECoreX::RenderSurface::UseExistingRenderable + * @copydoc Dali::Internal::Adaptor::ECore::EcoreWlRenderSurface::UseExistingRenderable */ virtual void UseExistingRenderable( unsigned int surfaceId ); @@ -175,10 +160,6 @@ private: // Data } // namespace ECore -} // namespace Adaptor - -} // namespace internal - } // namespace Dali #endif // __DALI_INTERNAL_ECORE_X_WINDOW_RENDER_SURFACE_H__ diff --git a/adaptors/x11/clipboard-impl-x.cpp b/adaptors/x11/clipboard-impl-x.cpp index 4ae9647..fdb3650 100644 --- a/adaptors/x11/clipboard-impl-x.cpp +++ b/adaptors/x11/clipboard-impl-x.cpp @@ -66,22 +66,24 @@ BaseHandle Create() if ( service ) { Adaptor& adaptorImpl( Adaptor::GetImplementation( Adaptor::Get() ) ); + Any nativewindow = adaptorImpl.GetNativeWindowHandle(); // The Ecore_X_Window needs to use the Clipboard. // Only when the render surface is window, we can get the Ecore_X_Window. - Ecore_X_Window ecoreXwin( 0 ); - Dali::RenderSurface& surface( adaptorImpl.GetSurface() ); - if( surface.GetType() == Dali::RenderSurface::WINDOW ) + Ecore_X_Window ecoreXwin( AnyCast(nativewindow) ); + if (ecoreXwin) { - ecoreXwin = AnyCast< Ecore_X_Window >( adaptorImpl.GetSurface().GetSurface() ); + // If we fail to get Ecore_X_Window, we can't use the Clipboard correctly. + // Thus you have to call "ecore_imf_context_client_window_set" somewhere. + // In EvasPlugIn, this function is called in EvasPlugin::ConnectEcoreEvent(). + Dali::Clipboard clipboard = Dali::Clipboard( new Clipboard( ecoreXwin ) ); + service.Register( typeid( clipboard ), clipboard ); + handle = clipboard; + } + else + { + DALI_LOG_ERROR("Failed to get native window handle"); } - - // If we fail to get Ecore_X_Window, we can't use the Clipboard correctly. - // Thus you have to call "ecore_imf_context_client_window_set" somewhere. - // In EvasPlugIn, this function is called in EvasPlugin::ConnectEcoreEvent(). - Dali::Clipboard clipboard = Dali::Clipboard( new Clipboard( ecoreXwin ) ); - service.Register( typeid( clipboard ), clipboard ); - handle = clipboard; } } diff --git a/adaptors/x11/display-connection-impl-x.cpp b/adaptors/x11/display-connection-impl-x.cpp new file mode 100644 index 0000000..02deebb --- /dev/null +++ b/adaptors/x11/display-connection-impl-x.cpp @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2015 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// CLASS HEADER +#include "display-connection-impl.h" + +// EXTERNAL_HEADERS +#include +#include + +// INTERNAL HEADERS +#include + +namespace Dali +{ + +namespace Internal +{ + +namespace Adaptor +{ + +DisplayConnection* DisplayConnection::New() +{ + DisplayConnection* pDisplayConnection(new DisplayConnection()); + + return pDisplayConnection; +} + +DisplayConnection::DisplayConnection() +: mDisplay(NULL) +{ + // Because of DDK issue, we need to use separated x display instead of ecore default display + mDisplay = XOpenDisplay(0); +} + +DisplayConnection::~DisplayConnection() +{ + if(mDisplay) + { + XCloseDisplay(mDisplay); + } +} + +Any DisplayConnection::GetDisplay() +{ + return Any(mDisplay); +} + +void DisplayConnection::ConsumeEvents() +{ + // check events so that we can flush the queue and avoid any potential memory leaks in X + // looping if events remain + int events(0); + do + { + // Check if there are any events in the queue + events = XEventsQueued(mDisplay, QueuedAfterFlush); + + if (events > 0) + { + // Just flush event to prevent memory leak from event queue as the events get built up in + // memory but are only deleted when we retrieve them + XEvent ev; + XNextEvent(mDisplay, &ev); + } + } + while (events > 0); +} + +bool DisplayConnection::InitializeEgl(EglInterface& egl) +{ + EglImplementation& eglImpl = static_cast(egl); + + if (!eglImpl.InitializeGles(reinterpret_cast(mDisplay))) + { + DALI_LOG_ERROR("Failed to initialize GLES."); + return false; + } + + return true; +} + +void DisplayConnection::GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) +{ + // calculate DPI + float xres, yres; + + // 1 inch = 25.4 millimeters + xres = ecore_x_dpi_get(); + yres = ecore_x_dpi_get(); + + dpiHorizontal = int(xres + 0.5f); // rounding + dpiVertical = int(yres + 0.5f); +} + +} // namespace Adaptor + +} // namespace Internal + +} // namespace Dali diff --git a/adaptors/x11/display-connection-impl.h b/adaptors/x11/display-connection-impl.h new file mode 100644 index 0000000..c5b7a70 --- /dev/null +++ b/adaptors/x11/display-connection-impl.h @@ -0,0 +1,108 @@ +#ifndef __DALI_INTERNAL_ECORE_X_DIPLAY_CONNECTION_H__ +#define __DALI_INTERNAL_ECORE_X_DIPLAY_CONNECTION_H__ + +/* + * Copyright (c) 2015 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +#include +#include +#include + +namespace Dali +{ + +class RenderSurface; +class DisplayConnection; + +namespace Internal +{ + +namespace Adaptor +{ + +/** + * DisplayConnection implementation + */ +class DisplayConnection : public Dali::BaseObject +{ +public: + + /** + * @brief Default constructor + */ + DisplayConnection(); + + /** + * @brief Create an initialized DisplayConnection. + * + * @return A handle to a newly allocated DisplayConnection resource. + */ + static DisplayConnection* New(); + +public: + + /** + * @copydoc Dali::DisplayConnection::GetDisplay + */ + Any GetDisplay(); + + /** + * @copydoc Dali::DisplayConnection::GetDpi + */ + static void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical); + + /** + * @copydoc Dali::DisplayConnection::ConsumeEvents + */ + void ConsumeEvents(); + + /** + * @copydoc Dali::DisplayConnection::InitializeEgl + */ + bool InitializeEgl(EglInterface& egl); + +public: + + /** + * Destructor + */ + virtual ~DisplayConnection(); + +protected: + + // Undefined + DisplayConnection(const DisplayConnection&); + + // Undefined + DisplayConnection& operator=(const DisplayConnection& rhs); + +private: + XDisplay* mDisplay; ///< X-display for rendering +}; + +} // namespace Adaptor + +} // namespace internal + +} // namespace Dali + +#endif // __DALI_INTERNAL_ECORE_X_DIPLAY_CONNECTION_H__ diff --git a/adaptors/x11/ecore-x-render-surface-factory.cpp b/adaptors/x11/ecore-x-render-surface-factory.cpp index 4e1fee8..552ea12 100644 --- a/adaptors/x11/ecore-x-render-surface-factory.cpp +++ b/adaptors/x11/ecore-x-render-surface-factory.cpp @@ -16,35 +16,25 @@ */ // INTERNAL INCLUDES -#include "pixmap-render-surface.h" +#include namespace Dali { -namespace Internal -{ - -namespace Adaptor -{ - namespace ECore { -DALI_EXPORT_API RenderSurface* CreatePixmapSurface( +DALI_EXPORT_API PixmapRenderSurface* CreatePixmapSurface( PositionSize positionSize, Any surface, - Any display, const std::string& name, - bool isTransparent ) + bool isTransparent) { - return new PixmapRenderSurface( positionSize, surface, display, name, isTransparent ); + return new PixmapRenderSurface(positionSize, surface, name, isTransparent); } -} // namespace ECore - -} // namespace Adaptor -} // namespace Internal +} // namespace ECore } // namespace Dali diff --git a/adaptors/x11/ecore-x-render-surface.cpp b/adaptors/x11/ecore-x-render-surface.cpp index 015d542..e8e7d33 100644 --- a/adaptors/x11/ecore-x-render-surface.cpp +++ b/adaptors/x11/ecore-x-render-surface.cpp @@ -32,16 +32,11 @@ // INTERNAL INCLUDES #include #include +#include namespace Dali { -namespace Internal -{ - -namespace Adaptor -{ - #if defined(DEBUG_ENABLED) Debug::Filter* gRenderSurfaceLogFilter = Debug::Filter::New(Debug::Verbose, false, "LOG_ECORE_X_RENDER_SURFACE"); #endif @@ -49,33 +44,19 @@ Debug::Filter* gRenderSurfaceLogFilter = Debug::Filter::New(Debug::Verbose, fals namespace ECore { -namespace -{ - -static bool gXInitThreadsCalled = false; ///< global to say whether XInitThreads has been called in this process - -} // unnamed namespace - -RenderSurface::RenderSurface( SurfaceType type, - Dali::PositionSize positionSize, - Any surface, - Any display, - const std::string& name, - bool isTransparent) -: mMainDisplay(NULL), - mType(type), - mPosition(positionSize), +EcoreXRenderSurface::EcoreXRenderSurface(Dali::PositionSize positionSize, + Any surface, + const std::string& name, + bool isTransparent) +: mPosition(positionSize), mTitle(name), + mRenderNotification(NULL), mColorDepth(isTransparent ? COLOR_DEPTH_32 : COLOR_DEPTH_24), - mRenderNotification( NULL ), - mOwnSurface(false), - mOwnDisplay(false) + mOwnSurface(false) { - // see if there is a display in Any display - SetDisplay( display ); } -void RenderSurface::Init( Any surface ) +void EcoreXRenderSurface::Init( Any surface ) { // see if there is a surface in Any surface unsigned int surfaceId = GetSurfaceId( surface ); @@ -83,13 +64,6 @@ void RenderSurface::Init( Any surface ) // if the surface is empty, create a new one. if ( surfaceId == 0 ) { - // make sure XInitThreads is called - if ( !gXInitThreadsCalled ) - { - XInitThreads(); - gXInitThreadsCalled = true; - } - // we own the surface about to created mOwnSurface = true; CreateXRenderable(); @@ -101,169 +75,48 @@ void RenderSurface::Init( Any surface ) } #ifdef DEBUG_ENABLED - // prints out 'INFO: DALI: new RenderSurface, created display xx, used existing surface xx + // prints out 'INFO: DALI: new EcoreXRenderSurface, used existing surface xx // we can not use LOG_INFO because the surface can be created before Dali Core is created. - printf( "INFO: DALI: new RenderSurface, %s display %p, %s %s surface %X \n", - mOwnDisplay?"created":"used existing",mMainDisplay, - mOwnSurface?"created":"used existing", - Dali::RenderSurface::PIXMAP==mType?" pixmap" :"window", - GetDrawable() ); + printf( "INFO: DALI: new EcoreXRenderSurface, %s surface %X \n", + mOwnSurface?"created":"used existing", + GetDrawable() ); #endif } -RenderSurface::~RenderSurface() +EcoreXRenderSurface::~EcoreXRenderSurface() { - // release the display connection if we use our own - if( mOwnDisplay ) - { - if( mMainDisplay ) - { - // NOTE, on 64bit desktop with some NVidia driver versions this crashes -#ifdef _ARCH_ARM_ - XCloseDisplay( mMainDisplay ); -#endif - } - } } -Ecore_X_Window RenderSurface::GetXWindow() -{ - return 0; -} - -XDisplay* RenderSurface::GetMainDisplay() -{ - return mMainDisplay; -} - -void RenderSurface::SetRenderNotification( TriggerEvent* renderNotification ) +void EcoreXRenderSurface::SetRenderNotification(TriggerEventInterface* renderNotification) { mRenderNotification = renderNotification; } -Ecore_X_Drawable RenderSurface::GetDrawable() +Ecore_X_Window EcoreXRenderSurface::GetXWindow() { return 0; } -Any RenderSurface::GetDisplay() +Ecore_X_Drawable EcoreXRenderSurface::GetDrawable() { - // this getter is used by main thread so we need to return the main thread version of the display - return Any( ecore_x_display_get() ); + return 0; } -PositionSize RenderSurface::GetPositionSize() const +PositionSize EcoreXRenderSurface::GetPositionSize() const { return mPosition; } -void RenderSurface::MoveResize( Dali::PositionSize positionSize ) +void EcoreXRenderSurface::MoveResize( Dali::PositionSize positionSize ) { // nothing to do in base class } -void RenderSurface::GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) const +void EcoreXRenderSurface::SetViewMode( ViewMode viewMode ) { - // calculate DPI - float xres, yres; - - // 1 inch = 25.4 millimeters - xres = ecore_x_dpi_get(); - yres = ecore_x_dpi_get(); - - dpiHorizontal = int(xres + 0.5f); // rounding - dpiVertical = int(yres + 0.5f); } -void RenderSurface::Map() -{ -} - -void RenderSurface::TransferDisplayOwner( Internal::Adaptor::RenderSurface& newSurface ) -{ - // if we don't own the display return - if( mOwnDisplay == false ) - { - return; - } - - RenderSurface* other = dynamic_cast< RenderSurface* >( &newSurface ); - if( other ) - { - // if both surfaces share the same display, and this surface owns it, - // then transfer the ownership to the new surface - if( other->mMainDisplay == mMainDisplay ) - { - mOwnDisplay = false; - other->mOwnDisplay = true; - } - } -} - -void RenderSurface::ConsumeEvents() -{ - // if the render surface has own display, check events so that we can flush the queue and avoid - // any potential memory leaks in X - if( mOwnDisplay ) - { - // looping if events remain - int events( 0 ); - do - { - // Check if there are any events in the queue - events = XEventsQueued( mMainDisplay, QueuedAfterFlush ); - - if ( events > 0 ) - { - // Just flush event to prevent memory leak from event queue as the events get built up in - // memory but are only deleted when we retrieve them - XEvent ev; - XNextEvent( mMainDisplay, &ev ); - } - } - while( events > 0 ); - } -} - -void RenderSurface::SetViewMode( ViewMode ) -{ -} - -void RenderSurface::SetDisplay( Any display ) -{ - // the render surface can be passed either EFL e-core types, or x11 types - // we use boost any to determine at run time which type - - if ( display.Empty() == false ) - { - // check we have a valid type - DALI_ASSERT_ALWAYS( ( ( display.GetType() == typeid (Ecore_X_Display *)) || - ( display.GetType() == typeid (XDisplay *) ) ) - && - "Display type is invalid" ); - - mOwnDisplay = false; - - // display may point to EcoreXDisplay so may need to cast - if( display.GetType() == typeid (Ecore_X_Display*) ) - { - mMainDisplay = static_cast< XDisplay* >( AnyCast< Ecore_X_Display* >( display ) ); - } - else - { - mMainDisplay = AnyCast< XDisplay* >( display ); - } - } - else - { - mOwnDisplay = true; - // mMainDisplay = (XDisplay*)ecore_x_display_get(); - // Because of DDK issue, we need to use separated x display instead of ecore default display - mMainDisplay = XOpenDisplay(0); - } -} - -unsigned int RenderSurface::GetSurfaceId( Any surface ) const +unsigned int EcoreXRenderSurface::GetSurfaceId( Any surface ) const { unsigned int surfaceId = 0; @@ -288,8 +141,4 @@ unsigned int RenderSurface::GetSurfaceId( Any surface ) const } // namespace ECore -} // namespace Adaptor - -} // namespace Internal - } // namespace Dali diff --git a/adaptors/x11/egl-implementation-x.cpp b/adaptors/x11/egl-implementation-x.cpp index cccf568..fc3979e 100644 --- a/adaptors/x11/egl-implementation-x.cpp +++ b/adaptors/x11/egl-implementation-x.cpp @@ -411,7 +411,6 @@ void EglImplementation::ChooseConfig( bool isWindowType, ColorDepth depth ) } } - void EglImplementation::CreateSurfaceWindow( EGLNativeWindowType window, ColorDepth depth ) { DALI_ASSERT_ALWAYS( ( mEglSurface == 0 ) && "EGL surface already exists" ); @@ -446,49 +445,27 @@ void EglImplementation::CreateSurfacePixmap( EGLNativePixmapType pixmap, ColorDe DALI_ASSERT_ALWAYS( mEglSurface && "Create pixmap surface failed" ); } -bool EglImplementation::ReplaceSurfaceWindow( EGLNativeWindowType window, EGLNativeDisplayType display ) +bool EglImplementation::ReplaceSurfaceWindow( EGLNativeWindowType window ) { bool contextLost = false; - // If the display connection has not changed, then we can just create a new surface - if ( display == mEglNativeDisplay ) - { - // the surface is bound to the context, so set the context to null - MakeContextNull(); - - // destroy the surface - DestroySurface(); - - // create the EGL surface - CreateSurfaceWindow( window, mColorDepth ); - - // set the context to be current with the new surface - MakeContextCurrent(); - } - else // the display connection has changed, we need to start egl with a new x-connection - { - TerminateGles(); - - // let the adaptor know that all resources have been lost - contextLost = true; - - // re-initialise GLES with the new connection - InitializeGles( display ); + // display connection has not changed, then we can just create a new surface + // the surface is bound to the context, so set the context to null + MakeContextNull(); - // create the EGL surface - CreateSurfaceWindow( window, mColorDepth ); + // destroy the surface + DestroySurface(); - // create the OpenGL context - CreateContext(); + // create the EGL surface + CreateSurfaceWindow( window, mColorDepth ); - // Make it current - MakeContextCurrent(); - } + // set the context to be current with the new surface + MakeContextCurrent(); return contextLost; } -bool EglImplementation::ReplaceSurfacePixmap( EGLNativePixmapType pixmap, EGLNativeDisplayType display ) +bool EglImplementation::ReplaceSurfacePixmap( EGLNativePixmapType pixmap ) { bool contextLost = false; @@ -498,39 +475,13 @@ bool EglImplementation::ReplaceSurfacePixmap( EGLNativePixmapType pixmap, EGLNat // destroy the surface DestroySurface(); - // If the display has not changed, then we can just create a new surface - if ( display == mEglNativeDisplay ) - { - // create the EGL surface - CreateSurfacePixmap( pixmap, mColorDepth ); + // display connection has not changed, then we can just create a new surface + // create the EGL surface + CreateSurfacePixmap( pixmap, mColorDepth ); - // set the context to be current with the new surface - MakeContextCurrent(); - } - else // the display has changed, we need to start egl with a new x-connection - { - // Note! this code path is untested - - // this will release all EGL specific resources - eglTerminate( mEglDisplay ); + // set the context to be current with the new surface + MakeContextCurrent(); - mGlesInitialized = false; - - // let the adaptor know that all resources have been lost - contextLost = true; - - // re-initialise GLES with the new connection - InitializeGles( display ); - - // create the EGL surface - CreateSurfacePixmap( pixmap, mColorDepth ); - - // create the OpenGL context - CreateContext(); - - // Make it current - MakeContextCurrent(); - } return contextLost; } diff --git a/adaptors/x11/event-handler-x.cpp b/adaptors/x11/event-handler-x.cpp index 05ca436..42447ff 100644 --- a/adaptors/x11/event-handler-x.cpp +++ b/adaptors/x11/event-handler-x.cpp @@ -1114,16 +1114,12 @@ EventHandler::EventHandler( RenderSurface* surface, CoreEventInterface& coreEven { Ecore_X_Window window = 0; - if( surface->GetType() == Dali::RenderSurface::WINDOW ) + // this code only works with the EcoreX11 RenderSurface so need to downcast + ECore::WindowRenderSurface* ecoreSurface = dynamic_cast< ECore::WindowRenderSurface* >( surface ); + if( ecoreSurface ) { - // this code only works with the EcoreX11 RenderSurface so need to downcast - ECore::WindowRenderSurface* ecoreSurface = dynamic_cast< ECore::WindowRenderSurface* >( surface ); - if( ecoreSurface ) - { - // enable multi touch - window = ecoreSurface->GetXWindow(); - ecore_x_input_multi_select( window ); - } + // enable multi touch + window = ecoreSurface->GetXWindow(); } mImpl = new Impl(this, window); diff --git a/adaptors/x11/file.list b/adaptors/x11/file.list index 8237698..f9573c4 100644 --- a/adaptors/x11/file.list +++ b/adaptors/x11/file.list @@ -2,6 +2,7 @@ _adaptor_x11_internal_src_files = \ $(adaptor_x11_dir)/clipboard-impl-x.cpp \ + $(adaptor_x11_dir)/display-connection-impl-x.cpp \ $(adaptor_x11_dir)/imf-manager-impl-x.cpp \ $(adaptor_x11_dir)/pixmap-image-impl-x.cpp \ $(adaptor_x11_dir)/server-connection-x.cpp \ diff --git a/adaptors/x11/imf-manager-impl-x.cpp b/adaptors/x11/imf-manager-impl-x.cpp index 0dc943a..f64fdd0 100644 --- a/adaptors/x11/imf-manager-impl-x.cpp +++ b/adaptors/x11/imf-manager-impl-x.cpp @@ -157,22 +157,24 @@ Dali::ImfManager ImfManager::Get() // Create instance and register singleton only if the adaptor is available Adaptor& adaptorImpl( Adaptor::GetImplementation( Adaptor::Get() ) ); + Any nativeWindow = adaptorImpl.GetNativeWindowHandle(); // The Ecore_X_Window needs to use the ImfManager. // Only when the render surface is window, we can get the Ecore_X_Window. - Ecore_X_Window ecoreXwin( 0 ); - Dali::RenderSurface& surface( adaptorImpl.GetSurface() ); - if( surface.GetType() == Dali::RenderSurface::WINDOW ) + Ecore_X_Window ecoreXwin( AnyCast(nativeWindow) ); + if (ecoreXwin) { - ecoreXwin = AnyCast< Ecore_X_Window >( adaptorImpl.GetSurface().GetSurface() ); - } - - // If we fail to get Ecore_X_Window, we can't use the ImfManager correctly. - // Thus you have to call "ecore_imf_context_client_window_set" somewhere. - // In EvasPlugIn, this function is called in EvasPlugin::ConnectEcoreEvent(). + // If we fail to get Ecore_X_Window, we can't use the ImfManager correctly. + // Thus you have to call "ecore_imf_context_client_window_set" somewhere. + // In EvasPlugIn, this function is called in EvasPlugin::ConnectEcoreEvent(). - manager = Dali::ImfManager( new ImfManager( ecoreXwin ) ); - service.Register( typeid( manager ), manager ); + manager = Dali::ImfManager( new ImfManager( ecoreXwin ) ); + service.Register( typeid( manager ), manager ); + } + else + { + DALI_LOG_ERROR("Failed to get native window handle"); + } } } diff --git a/adaptors/x11/imf-manager-impl.h b/adaptors/x11/imf-manager-impl.h index f296ece..0ae0f9f 100644 --- a/adaptors/x11/imf-manager-impl.h +++ b/adaptors/x11/imf-manager-impl.h @@ -31,14 +31,14 @@ namespace Dali { +class RenderSurface; + namespace Internal { namespace Adaptor { -class RenderSurface; - class ImfManager : public Dali::BaseObject { public: diff --git a/adaptors/x11/pixmap-render-surface-x.cpp b/adaptors/x11/pixmap-render-surface-x.cpp index 1cfd6ff..ab5b4bd 100644 --- a/adaptors/x11/pixmap-render-surface-x.cpp +++ b/adaptors/x11/pixmap-render-surface-x.cpp @@ -30,18 +30,15 @@ #include // INTERNAL INCLUDES + #include #include +#include +#include namespace Dali { -namespace Internal -{ - -namespace Adaptor -{ - #if defined(DEBUG_ENABLED) extern Debug::Filter* gRenderSurfaceLogFilter; #endif @@ -49,12 +46,11 @@ extern Debug::Filter* gRenderSurfaceLogFilter; namespace ECore { -PixmapRenderSurface::PixmapRenderSurface( Dali::PositionSize positionSize, - Any surface, - Any display, - const std::string& name, - bool isTransparent) -: RenderSurface( Dali::RenderSurface::PIXMAP, positionSize, surface, display, name, isTransparent ), +PixmapRenderSurface::PixmapRenderSurface(Dali::PositionSize positionSize, + Any surface, + const std::string& name, + bool isTransparent) +: EcoreXRenderSurface( positionSize, surface, name, isTransparent ), mSyncMode(SYNC_MODE_NONE), mSyncReceived(false) { @@ -74,12 +70,7 @@ PixmapRenderSurface::~PixmapRenderSurface() Ecore_X_Drawable PixmapRenderSurface::GetDrawable() { - return (Ecore_X_Drawable)mX11Pixmap; -} - -Dali::RenderSurface::SurfaceType PixmapRenderSurface::GetType() -{ - return Dali::RenderSurface::PIXMAP; + return (Ecore_X_Drawable) mX11Pixmap; } Any PixmapRenderSurface::GetSurface() @@ -87,48 +78,46 @@ Any PixmapRenderSurface::GetSurface() return Any( mX11Pixmap ); } -void PixmapRenderSurface::InitializeEgl( EglInterface& eglIf ) +void PixmapRenderSurface::InitializeEgl( EglInterface& egl ) { DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter ); - EglImplementation& eglImpl = static_cast( eglIf ); - eglImpl.InitializeGles( reinterpret_cast< EGLNativeDisplayType >( mMainDisplay ) ); + Internal::Adaptor::EglImplementation& eglImpl = static_cast( egl ); eglImpl.ChooseConfig(false, mColorDepth); } -void PixmapRenderSurface::CreateEglSurface( EglInterface& eglIf ) +void PixmapRenderSurface::CreateEglSurface( EglInterface& egl ) { DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter ); - EglImplementation& eglImpl = static_cast( eglIf ); + Internal::Adaptor::EglImplementation& eglImpl = static_cast( egl ); // create the EGL surface // need to cast to X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit - XPixmap pixmap = static_cast< XPixmap>( mX11Pixmap ); + XPixmap pixmap = static_cast( mX11Pixmap ); eglImpl.CreateSurfacePixmap( (EGLNativePixmapType)pixmap, mColorDepth ); // reinterpret_cast does not compile } -void PixmapRenderSurface::DestroyEglSurface( EglInterface& eglIf ) +void PixmapRenderSurface::DestroyEglSurface( EglInterface& egl ) { DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter ); - EglImplementation& eglImpl = static_cast( eglIf ); + Internal::Adaptor::EglImplementation& eglImpl = static_cast( egl ); eglImpl.DestroySurface(); } -bool PixmapRenderSurface::ReplaceEGLSurface( EglInterface& eglIf ) +bool PixmapRenderSurface::ReplaceEGLSurface( EglInterface& egl ) { DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter ); - EglImplementation& eglImpl = static_cast( eglIf ); - eglImpl.InitializeGles( reinterpret_cast< EGLNativeDisplayType >( mMainDisplay ) ); - // a new surface for the new pixmap // need to cast to X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit - XPixmap pixmap = static_cast< XPixmap>( mX11Pixmap ); - return eglImpl.ReplaceSurfacePixmap( (EGLNativePixmapType)pixmap, // reinterpret_cast does not compile - reinterpret_cast< EGLNativeDisplayType >( mMainDisplay ) ); + XPixmap pixmap = static_cast( mX11Pixmap ); + Internal::Adaptor::EglImplementation& eglImpl = static_cast( egl ); + + return eglImpl.ReplaceSurfacePixmap( (EGLNativePixmapType)pixmap ); // reinterpret_cast does not compile + } void PixmapRenderSurface::StartRender() @@ -142,7 +131,7 @@ bool PixmapRenderSurface::PreRender( EglInterface&, Integration::GlAbstraction& return true; } -void PixmapRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, unsigned int timeDelta, bool replacingSurface ) +void PixmapRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, unsigned int deltaTime, bool replacingSurface ) { // flush gl instruction queue glAbstraction.Flush(); @@ -156,8 +145,7 @@ void PixmapRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstract } else { - // as a fallback, send damage event. This is needed until livebox is fixed to - // stop using damage events for render + // as a fallback, send damage event. Ecore_X_Drawable drawable = GetDrawable(); if( drawable ) @@ -170,13 +158,15 @@ void PixmapRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstract rect.width = mPosition.width; rect.height = mPosition.height; + XDisplay* display = AnyCast(displayConnection->GetDisplay()); + // make a fixes region as updated area - region = XFixesCreateRegion( mMainDisplay, &rect, 1 ); + region = XFixesCreateRegion( display, &rect, 1 ); // add damage event to updated drawable - XDamageAdd( mMainDisplay, (Drawable)drawable, region ); - XFixesDestroyRegion( mMainDisplay, region ); + XDamageAdd( display, (Drawable)drawable, region ); + XFixesDestroyRegion( display, region ); - XFlush( mMainDisplay ); + XFlush( display ); } } @@ -249,11 +239,6 @@ void PixmapRenderSurface::ReleaseLock() mSyncNotify.notify_all(); } - } // namespace ECore -} // namespace Adaptor - -} // namespace Internal - } // namespace Dali diff --git a/adaptors/x11/window-impl-x.cpp b/adaptors/x11/window-impl-x.cpp index f5530b6..c7c1083 100644 --- a/adaptors/x11/window-impl-x.cpp +++ b/adaptors/x11/window-impl-x.cpp @@ -82,6 +82,8 @@ struct Window::EventHandler ECORE_X_ATOM_E_DEICONIFY_APPROVE, &tmp, 1); #endif // DALI_PROFILE_UBUNTU + + ecore_x_input_multi_select( mEcoreWindow ); } /** @@ -361,8 +363,11 @@ void Window::Initialize(const PositionSize& windowPosition, const std::string& n { // create an X11 window by default Any surface; - Any display; - mSurface = new ECore::WindowRenderSurface( windowPosition, surface, display, name, mIsTransparent ); + ECore::WindowRenderSurface* windowSurface = new ECore::WindowRenderSurface( windowPosition, surface, name, mIsTransparent ); + windowSurface->Map(); + + mSurface = windowSurface; + mOrientation = Orientation::New(this); // create event handler for X11 window diff --git a/adaptors/x11/window-render-surface-x.cpp b/adaptors/x11/window-render-surface-x.cpp index 1cf78e1..2bc2f02 100644 --- a/adaptors/x11/window-render-surface-x.cpp +++ b/adaptors/x11/window-render-surface-x.cpp @@ -30,18 +30,15 @@ #include // INTERNAL INCLUDES + #include #include +#include +#include namespace Dali { -namespace Internal -{ - -namespace Adaptor -{ - #if defined(DEBUG_ENABLED) extern Debug::Filter* gRenderSurfaceLogFilter; #endif @@ -58,10 +55,9 @@ const int MINIMUM_DIMENSION_CHANGE( 1 ); ///< Minimum change for window to be co WindowRenderSurface::WindowRenderSurface( Dali::PositionSize positionSize, Any surface, - Any display, const std::string& name, bool isTransparent) -: RenderSurface( Dali::RenderSurface::WINDOW, positionSize, surface, display, name, isTransparent ), +: EcoreXRenderSurface( positionSize, surface, name, isTransparent ), mNeedToApproveDeiconify(false) { DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "Creating Window\n" ); @@ -82,11 +78,6 @@ Ecore_X_Drawable WindowRenderSurface::GetDrawable() return (Ecore_X_Drawable)mX11Window; } -Dali::RenderSurface::SurfaceType WindowRenderSurface::GetType() -{ - return Dali::RenderSurface::WINDOW; -} - Any WindowRenderSurface::GetSurface() { // already an e-core type @@ -107,8 +98,7 @@ void WindowRenderSurface::InitializeEgl( EglInterface& eglIf ) { DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter ); - EglImplementation& eglImpl = static_cast( eglIf ); - eglImpl.InitializeGles( reinterpret_cast< EGLNativeDisplayType >( mMainDisplay ) ); + Internal::Adaptor::EglImplementation& eglImpl = static_cast( eglIf ); eglImpl.ChooseConfig(true, mColorDepth); } @@ -117,7 +107,7 @@ void WindowRenderSurface::CreateEglSurface( EglInterface& eglIf ) { DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter ); - EglImplementation& eglImpl = static_cast( eglIf ); + Internal::Adaptor::EglImplementation& eglImpl = static_cast( eglIf ); // create the EGL surface // need to cast to X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit @@ -129,21 +119,19 @@ void WindowRenderSurface::DestroyEglSurface( EglInterface& eglIf ) { DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter ); - EglImplementation& eglImpl = static_cast( eglIf ); + Internal::Adaptor::EglImplementation& eglImpl = static_cast( eglIf ); eglImpl.DestroySurface(); } -bool WindowRenderSurface::ReplaceEGLSurface( EglInterface& eglIf ) +bool WindowRenderSurface::ReplaceEGLSurface( EglInterface& egl ) { DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter ); - EglImplementation& egl = static_cast( eglIf ); - egl.InitializeGles( reinterpret_cast< EGLNativeDisplayType >( mMainDisplay ) ); - // need to cast to X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit XWindow window = static_cast< XWindow >( mX11Window ); - return egl.ReplaceSurfaceWindow( (EGLNativeWindowType)window, // reinterpret_cast does not compile - reinterpret_cast< EGLNativeDisplayType >( mMainDisplay ) ); + Internal::Adaptor::EglImplementation& eglImpl = static_cast( egl ); + + return eglImpl.ReplaceSurfaceWindow( (EGLNativeWindowType)window ); // reinterpret_cast does not compile } void WindowRenderSurface::MoveResize( Dali::PositionSize positionSize ) @@ -198,9 +186,9 @@ bool WindowRenderSurface::PreRender( EglInterface&, Integration::GlAbstraction& return true; } -void WindowRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, unsigned int, bool ) +void WindowRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, unsigned int deltaTime, bool replacingSurface ) { - EglImplementation& eglImpl = static_cast( egl ); + Internal::Adaptor::EglImplementation& eglImpl = static_cast( egl ); eglImpl.SwapBuffers(); // When the window is deiconified, it approves the deiconify operation to window manager after rendering @@ -209,16 +197,26 @@ void WindowRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstract // SwapBuffer is desychronized. So make sure to sychronize when window is deiconified. glAbstraction.Finish(); + XDisplay* display = AnyCast(displayConnection->GetDisplay()); + #ifndef DALI_PROFILE_UBUNTU /* client sends immediately reply message using value 1 */ - ecore_x_client_message32_send(mX11Window, - ECORE_X_ATOM_E_DEICONIFY_APPROVE, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - mX11Window, 1, - 0, 0, 0); + XEvent xev; + + xev.xclient.window = mX11Window; + xev.xclient.type = ClientMessage; + xev.xclient.message_type = ECORE_X_ATOM_E_DEICONIFY_APPROVE; + xev.xclient.format = 32; + xev.xclient.data.l[0] = mX11Window; + xev.xclient.data.l[1] = 1; + xev.xclient.data.l[2] = 0; + xev.xclient.data.l[3] = 0; + xev.xclient.data.l[4] = 0; + + XSendEvent(display, mX11Window, false, ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, &xev); #endif // DALI_PROFILE_UBUNTU - ecore_x_sync(); + XSync(display, false); mNeedToApproveDeiconify = false; } @@ -303,8 +301,4 @@ void WindowRenderSurface::ReleaseLock() } // namespace ECore -} // namespace Adaptor - -} // namespace Internal - } // namespace Dali diff --git a/adaptors/x11/window-render-surface.h b/adaptors/x11/window-render-surface.h index 3074aeb..02b31bd 100644 --- a/adaptors/x11/window-render-surface.h +++ b/adaptors/x11/window-render-surface.h @@ -24,20 +24,14 @@ namespace Dali { -namespace Internal -{ - -namespace Adaptor -{ - namespace ECore { /** - * @copydoc Dali::Internal::Adaptor::ECore::RenderSurface. + * @copydoc Dali::ECore::EcoreXRenderSurface. * Window specialization. */ -class WindowRenderSurface : public RenderSurface +class WindowRenderSurface : public EcoreXRenderSurface { public: @@ -45,18 +39,16 @@ public: * Uses an X11 surface to render to. * @param [in] positionSize the position and size of the surface * @param [in] surface can be a X-window or X-pixmap (type must be unsigned int). - * @param [in] display connection to X-server if the surface is a X window or pixmap (type must be void * to X display struct) * @param [in] name optional name of surface passed in * @param [in] isTransparent if it is true, surface has 32 bit color depth, otherwise, 24 bit */ WindowRenderSurface( Dali::PositionSize positionSize, Any surface, - Any display, const std::string& name, bool isTransparent = false ); /** - * @copydoc Dali::Internal::Adaptor::ECore::RenderSurface::~RenderSurface + * @copydoc Dali::ECore::EcoreXRenderSurface::~EcoreXRenderSurface */ virtual ~WindowRenderSurface(); @@ -73,82 +65,75 @@ public: // API */ void RequestToApproveDeiconify(); -public: // from Dali::RenderSurface - /** - * @copydoc Dali::RenderSurface::GetType() + * Map window */ - virtual Dali::RenderSurface::SurfaceType GetType(); + virtual void Map(); /** - * @copydoc Dali::RenderSurface::GetSurface() + * @copydoc Dali::ECore::EcoreXRenderSurface::GetSurface() */ virtual Any GetSurface(); /** - * @copydoc Dali::RenderSurface::GetDrawable() + * @copydoc Dali::ECore::EcoreXRenderSurface::GetXWindow() */ virtual Ecore_X_Window GetXWindow(); -public: // from Internal::Adaptor::RenderSurface +public: // from Dali::RenderSurface /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::InitializeEgl() + * @copydoc Dali::RenderSurface::InitializeEgl() */ virtual void InitializeEgl( EglInterface& egl ); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::CreateEglSurface() + * @copydoc Dali::RenderSurface::CreateEglSurface() */ virtual void CreateEglSurface( EglInterface& egl ); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::DestroyEglSurface() + * @copydoc Dali::RenderSurface::DestroyEglSurface() */ virtual void DestroyEglSurface( EglInterface& egl ); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::ReplaceEGLSurface() + * @copydoc Dali::RenderSurface::ReplaceEGLSurface() */ virtual bool ReplaceEGLSurface( EglInterface& egl ); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::MoveResize() + * @copydoc Dali::RenderSurface::MoveResize() */ virtual void MoveResize( Dali::PositionSize positionSize); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::Map() + * @copydoc Dali::RenderSurface::SetViewMode() */ - virtual void Map(); + void SetViewMode( ViewMode viewMode ); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::StartRender() + * @copydoc Dali::RenderSurface::StartRender() */ virtual void StartRender(); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::PreRender() + * @copydoc Dali::RenderSurface::PreRender() */ virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction ); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::PostRender() + * @copydoc Dali::RenderSurface::PostRender() */ - virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, unsigned int timeDelta, bool replacingSurface ); + virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, unsigned int deltaTime, bool replacingSurface ); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::StopRender() + * @copydoc Dali::RenderSurface::StopRender() */ virtual void StopRender(); /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::SetViewMode() - */ - void SetViewMode( ViewMode viewMode ); - - /** - * @copydoc Dali::Internal::Adaptor::RenderSurface::ReleaseLock() + * @copydoc Dali::RenderSurface::ReleaseLock() */ virtual void ReleaseLock(); @@ -160,7 +145,7 @@ protected: virtual void CreateXRenderable(); /** - * @copydoc Dali::Internal::Adaptor::ECore::RenderSurface::UseExistingRenderable + * @copydoc Dali::Internal::Adaptor::ECore::EcoreXRenderSurface::UseExistingRenderable */ virtual void UseExistingRenderable( unsigned int surfaceId ); @@ -173,10 +158,6 @@ private: // Data } // namespace ECore -} // namespace Adaptor - -} // namespace internal - } // namespace Dali #endif // __DALI_INTERNAL_ECORE_X_WINDOW_RENDER_SURFACE_H__ diff --git a/build/tizen/adaptor/Makefile.am b/build/tizen/adaptor/Makefile.am index 3646021..9ef0451 100644 --- a/build/tizen/adaptor/Makefile.am +++ b/build/tizen/adaptor/Makefile.am @@ -28,6 +28,10 @@ tizen_platform_abstraction_src_dir = ../../../platform-abstractions/tizen portable_platform_abstraction_src_dir = ../../../platform-abstractions/portable include ../../../platform-abstractions/tizen/file.list +# Integration +adaptor_integration_api_dir = ../../../adaptors/integration-api +include ../../../adaptors/integration-api/file.list + # Internal Common adaptor_common_dir = ../../../adaptors/common include ../../../adaptors/common/file.list @@ -149,6 +153,9 @@ endif # WAYLAND endif +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = dali-adaptor-integration.pc + # Feedback Plugin if USE_FEEDBACK plugin_themes_dir = ../../../adaptors/common/feedback @@ -181,15 +188,19 @@ libdali_adaptor_la_includes = \ -I../../../platform-abstractions/portable \ -I../../../platform-abstractions/ \ -I../../../adaptors/public-api \ + -I../../../adaptors/integration-api \ -I../../../adaptors/public-api/adaptor-framework \ -I../../../adaptors/common \ + -I../../../adaptors/base/interfaces \ -I../../../adaptors/ if WAYLAND libdali_adaptor_la_includes += \ - -I../../../adaptors/wayland + -I../../../adaptors/wayland \ + -I../../../adaptors/integration-api/wayland else libdali_adaptor_la_includes += \ - -I../../../adaptors/x11 + -I../../../adaptors/x11 \ + -I../../../adaptors/integration-api/x11 endif if UBUNTU_PROFILE @@ -320,6 +331,17 @@ endif tizenadaptorpublicapidir = $(devincludepath)/dali/public-api tizenadaptorpublicapi_HEADERS = $(public_api_header_files) +tizenadaptorintegrationapidir = $(devincludepath)/dali/integration-api/adaptors +tizenadaptorintegrationapi_HEADERS = $(adaptor_integration_api_header_files) + +if WAYLAND +tizenadaptorintegrationwaylandapidir = $(devincludepath)/dali/integration-api/adaptors +tizenadaptorintegrationwaylandapi_HEADERS = $(adaptor_integration_wayland_api_header_files) +else +tizenadaptorintegrationx11apidir = $(devincludepath)/dali/integration-api/adaptors +tizenadaptorintegrationx11api_HEADERS = $(adaptor_integration_x11_api_header_files) +endif + tizenadaptorframeworkpublicapidir = $(tizenadaptorpublicapidir)/adaptor-framework tizenadaptorframeworkpublicapi_HEADERS = $(public_api_adaptor_framework_header_files) @@ -349,6 +371,8 @@ linker_test_SOURCES = linker-test.cpp linker_test_CXXFLAGS = \ -I../../../adaptors/common \ -I../../../adaptors/public-api \ + -I../../../adaptors/integration-api \ + -I../../../adaptors/base/interfaces \ -I../../../adaptors/public-api/adaptor-framework \ $(DALI_ADAPTOR_CFLAGS) \ $(DALICORE_CFLAGS) \ @@ -356,6 +380,16 @@ linker_test_CXXFLAGS = \ $(DALIX11_CFLAGS) \ -Werror -Wall +if WAYLAND +linker_test_CXXFLAGS += \ + -I../../../adaptors/integration-api/wayland +else + +linker_test_CXXFLAGS += \ + -I../../../adaptors/integration-api/x11 +endif + + linker_test_DEPENDENCIES = libdali-adaptor.la linker_test_LDADD = \ $(DALICORE_LIBS) \ diff --git a/build/tizen/adaptor/dali-adaptor-integration.pc.in b/build/tizen/adaptor/dali-adaptor-integration.pc.in new file mode 100644 index 0000000..0e10a68 --- /dev/null +++ b/build/tizen/adaptor/dali-adaptor-integration.pc.in @@ -0,0 +1,12 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +apiversion=@DALI_ADAPTOR_VERSION@ +libdir=@libdir@ +includedir=@devincludepath@ + +Name: Samsung OpenGLES Adaptor Integration +Description: Adaptor integration layer for 3D Canvas using OpenGLES +Version: ${apiversion} +Requires: dali +Libs: -L${libdir} +Cflags: -I${includedir}/dali/public-api/adaptor-framework/ -I${includedir}/dali/integration-api/adaptors/ diff --git a/build/tizen/configure.ac b/build/tizen/configure.ac index 6cfa86b..c37930f 100644 --- a/build/tizen/configure.ac +++ b/build/tizen/configure.ac @@ -270,6 +270,7 @@ AC_CONFIG_FILES([ Makefile adaptor/Makefile dali.pc + adaptor/dali-adaptor-integration.pc ]) AM_CONDITIONAL([USE_PLUGIN], [test x$enable_feedback = xyes || test x$enable_bullet = xyes]) diff --git a/build/tizen/plugins/Makefile.am b/build/tizen/plugins/Makefile.am index ecbb997..18937a4 100644 --- a/build/tizen/plugins/Makefile.am +++ b/build/tizen/plugins/Makefile.am @@ -52,6 +52,7 @@ libdali_feedback_plugin_la_CXXFLAGS = -DDALI_COMPILATION \ $(DALI_PROFILE_CFLAGS) \ $(DALI_ADAPTOR_CFLAGS) \ -I../../../adaptors/public-api \ + -I../../../adaptors/integration-api \ -I../../../adaptors/public-api/adaptor-framework \ -Werror -Wall diff --git a/packaging/dali-adaptor-mobile.spec b/packaging/dali-adaptor-mobile.spec index 573825c..5f23d28 100644 --- a/packaging/dali-adaptor-mobile.spec +++ b/packaging/dali-adaptor-mobile.spec @@ -70,11 +70,23 @@ platform abstraction and application shell Summary: Development components for the DALi Tizen Adaptor Group: Development/Building Requires: %{name} = %{version}-%{release} +Requires: %{name}-integration-devel = %{version}-%{release} %description devel Development components for the DALi Tizen Adaptor - public headers and package configs ############################## +# integration-devel +############################## +%package integration-devel +Summary: Integration development package for the Adaptor +Group: Development/Building +Requires: %{name} = %{version}-%{release} + +%description integration-devel +Integration development package for the Adaptor - headers for integrating with an adaptor library. + +############################## # Dali Feedback Plugin ############################## %package dali-feedback-plugin @@ -253,8 +265,14 @@ exit 0 %files devel %defattr(-,root,root,-) -%{dev_include_path}/dali/* -%{_libdir}/pkgconfig/dali*.pc +%{dev_include_path}/dali/dali.h +%{dev_include_path}/dali/public-api/* +%{_libdir}/pkgconfig/dali.pc + +%files integration-devel +%defattr(-,root,root,-) +%{dev_include_path}/dali/integration-api/adaptors/* +%{_libdir}/pkgconfig/dali-adaptor-integration.pc %if 0%{?dali_feedback_plugin} %files dali-feedback-plugin diff --git a/packaging/dali-adaptor.spec b/packaging/dali-adaptor.spec index 5329ec7..e9b4afa 100644 --- a/packaging/dali-adaptor.spec +++ b/packaging/dali-adaptor.spec @@ -42,6 +42,7 @@ Source0: %{name}-%{version}.tar.gz %define dali_bullet_plugin 0 %define dali_assimp_plugin 0 %define over_tizen_2_2 0 + %define shaderbincache_flag DISABLE %endif @@ -106,11 +107,23 @@ platform abstraction and application shell Summary: Development components for the DALi Tizen Adaptor Group: Development/Building Requires: %{name} = %{version}-%{release} +Requires: %{name}-integration-devel = %{version}-%{release} %description devel Development components for the DALi Tizen Adaptor - public headers and package configs ############################## +# integration-devel +############################## +%package integration-devel +Summary: Integration development package for the Adaptor +Group: Development/Building +Requires: %{name} = %{version}-%{release} + +%description integration-devel +Integration development package for the Adaptor - headers for integrating with an adaptor library. + +############################## # Dali Feedback Plugin ############################## %package dali-feedback-plugin @@ -289,8 +302,14 @@ exit 0 %files devel %defattr(-,root,root,-) -%{dev_include_path}/dali/* -%{_libdir}/pkgconfig/dali*.pc +%{dev_include_path}/dali/dali.h +%{dev_include_path}/dali/public-api/* +%{_libdir}/pkgconfig/dali.pc + +%files integration-devel +%defattr(-,root,root,-) +%{dev_include_path}/dali/integration-api/adaptors/* +%{_libdir}/pkgconfig/dali-adaptor-integration.pc %if 0%{?dali_feedback_plugin} %files dali-feedback-plugin -- 2.7.4