return Internal::Adaptor::GetImplementation( application ).AddIdle( callback, true );
}
+Dali::Window CreateWindow( Application application, PositionSize childPosSize, const std::string& childWindowName, const std::string& childWindowClassName, bool childWindowMode )
+{
+ auto& adaptor = Internal::Adaptor::GetImplementation( application ).GetAdaptor();
+
+ Dali::Window childWindow = Dali::Window::New( childPosSize, childWindowName, childWindowClassName, childWindowMode );
+ Internal::Adaptor::Adaptor::GetImplementation( adaptor ).AddWindow( &childWindow, childWindowName, childWindowClassName, childWindowMode );
+ return childWindow;
+}
+
+bool DestroyWindow( Application application, Dali::Window* childWindow )
+{
+ auto& adaptor = Internal::Adaptor::GetImplementation( application ).GetAdaptor();
+
+ return Internal::Adaptor::Adaptor::GetImplementation( adaptor ).RemoveWindow( childWindow );
+}
+
+bool DestroyWindow( Application application, const std::string& childWindowName )
+{
+ auto& adaptor = Internal::Adaptor::GetImplementation( application ).GetAdaptor();
+
+ return Internal::Adaptor::Adaptor::GetImplementation( adaptor ).RemoveWindow( childWindowName );
+}
+
} // namespace DevelApplication
} // namespace Dali
*/
DALI_ADAPTOR_API bool AddIdleWithReturnValue( Application application, CallbackBase* callback );
+/**
+ * @brief Create and Add a child window to the application instance
+ * @param[in] application A handle to the Application
+ * @param[in] childPosSize The position and size of the child window to be created
+ * @param[in] childWindowName The title of the child window
+ * @param[in] childWindowClassName The class name of the child window
+ * @param[in] childWindowMode The mode of the newly created child window
+ * @return @c a window handle if added successfully, @c null otherwise
+ *
+ * @note Function must be called from main event thread only
+ */
+DALI_ADAPTOR_API Dali::Window CreateWindow( Application application, PositionSize childPosSize, const std::string& childWindowName, const std::string& childWindowClassName, bool childWindowMode );
+
+/**
+ * @brief Removes a previously created Window instance from the Adaptor internal list
+ * @note Function must be called from the main event thread only.
+ * @param[in] application A handle to the Application
+ * @param[in] childWindow The created Window instance
+ * @return true if removed successfully, false otherwise
+ */
+DALI_ADAPTOR_API bool DestroyWindow( Application application, Dali::Window* childWindow );
+
+/**
+ * @brief Removes a previously created Window instance from the Adaptor internal list
+ * @note Function must be called from the main event thread only.
+ * @param[in] application A handle to the Application
+ * @param[in] childWindowName The title of the window
+ * @return true if removed successfully, false otherwise
+ */
+DALI_ADAPTOR_API bool DestroyWindow( Application application, const std::string& childWindowName );
+
} // namespace DevelApplication
} // namespace Dali
-#ifndef __DALI_INTEGRATION_ADAPTOR_H__
-#define __DALI_INTEGRATION_ADAPTOR_H__
+#ifndef DALI_INTEGRATION_ADAPTOR_H
+#define DALI_INTEGRATION_ADAPTOR_H
/*
* Copyright (c) 2018 Samsung Electronics Co., Ltd.
{
namespace Adaptor
{
+class GraphicsFactory;
class Adaptor;
}
}
} // namespace Dali
-#endif // __DALI_INTEGRATION_ADAPTOR_H__
+#endif // DALI_INTEGRATION_ADAPTOR_H
-#ifndef __DALI_RENDER_SURFACE_H__
-#define __DALI_RENDER_SURFACE_H__
+#ifndef DALI_RENDER_SURFACE_H
+#define DALI_RENDER_SURFACE_H
/*
* Copyright (c) 2018 Samsung Electronics Co., Ltd.
// INTERNAL INCLUDES
#include <dali/public-api/dali-adaptor-common.h>
+
namespace Dali
{
-class EglInterface;
class DisplayConnection;
class ThreadSynchronizationInterface;
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+class GraphicsInterface;
+
+} // namespace Adaptor
+
+} // namespace Internal
+
namespace Integration
{
virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) = 0;
/**
- * Initialize EGL, RenderSurface should create egl display and initialize
- * @param egl implementation to use for the creation
+ * @brief InitializeGraphics the platform specific graphics surface interfaces
+ * @param[in] graphics The abstracted graphics interface
+ * @param[in] displayConnection The display connection interface
*/
- virtual void InitializeEgl( EglInterface& egl ) = 0;
+ virtual void InitializeGraphics( Dali::Internal::Adaptor::GraphicsInterface& graphics, Dali::DisplayConnection& displayConnection ) = 0;
/**
- * @brief Creates EGL Surface
- * @param egl implementation to use for the creation
+ * @brief Creates the Surface
*/
- virtual void CreateEglSurface( EglInterface& egl ) = 0;
+ virtual void CreateSurface() = 0;
/**
- * @brief Destroys EGL Surface
- * @param egl implementation to use for the destruction
+ * @brief Destroys the Surface
*/
- virtual void DestroyEglSurface( EglInterface& egl ) = 0;
+ virtual void DestroySurface() = 0;
/**
- * @brief Replace the EGL Surface
- * @param egl implementation to use for the creation
+ * @brief Replace the Surface
* @return true if context was lost
*/
- virtual bool ReplaceEGLSurface( EglInterface& egl ) = 0;
+ virtual bool ReplaceGraphicsSurface() = 0;
/**
* @brief Resizes the underlying surface.
+ * @param[in] The dimensions of the new position
*/
virtual void MoveResize( Dali::PositionSize positionSize ) = 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
* @param[in] resizingSurface True if the surface is being resized
* @return True if the operation is successful, False if the operation failed
*/
- virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, bool resizingSurface ) = 0;
+ virtual bool PreRender( bool resizingSurface ) = 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] renderToFbo True if render to FBO.
* @param[in] replacingSurface True if the surface is being replaced.
* @param[in] resizingSurface True if the surface is being resized.
*/
- virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface, bool resizingSurface ) = 0;
-
+ virtual void PostRender( bool renderToFbo, bool replacingSurface, bool resizingSurface ) = 0;
/**
* @brief Invoked by render thread when the thread should be stop
*/
} // namespace Dali
-#endif // __DALI_RENDER_SURFACE_H__
+#endif // DALI_RENDER_SURFACE_H
--- /dev/null
+/*
+ * Copyright (c) 2018 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 <dali/internal/adaptor/common/adaptor-builder-impl.h>
+
+// INTERNAL INCLUDES
+#include <dali/public-api/dali-adaptor-common.h>
+#include <dali/internal/graphics/gles20/egl-graphics-factory.h>
+#include <dali/internal/window-system/common/display-utils.h>
+
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+AdaptorBuilder::AdaptorBuilder()
+{
+ // Construct Graphics Factory
+ mGraphicsFactory = Utils::MakeUnique< GraphicsFactory >();
+}
+
+GraphicsFactory& AdaptorBuilder::GetGraphicsFactory() const
+{
+ return *mGraphicsFactory.get();
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_INTERNAL_ADAPTOR_BUILDER_IMPL_H
+#define DALI_INTERNAL_ADAPTOR_BUILDER_IMPL_H
+
+/*
+ * Copyright (c) 2018 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.
+ *
+ */
+
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/environment-options.h>
+#include <dali/internal/graphics/gles20/egl-graphics-factory.h>
+
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+/**
+ * Implementation of the Adaptor Builder class.
+ */
+class AdaptorBuilder
+{
+public:
+
+ /**
+ * Constructor
+ */
+ AdaptorBuilder();
+
+
+ /**
+ * Destructor
+ */
+ ~AdaptorBuilder() {};
+
+
+public:
+
+ /**
+ * @return reference to the GraphicsFactory object
+ */
+ GraphicsFactory& GetGraphicsFactory() const;
+
+
+private:
+ // Eliminate copy and assigned operations
+ AdaptorBuilder(const AdaptorBuilder&) = delete;
+ AdaptorBuilder& operator=(AdaptorBuilder&) = delete;
+
+
+private:
+ std::unique_ptr< GraphicsFactory > mGraphicsFactory; ///< GraphicsFactory object
+
+};
+
+} // namespace Internal
+
+} // namespace Adaptor
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_BUILDER_IMPL_H
// CLASS HEADER
#include <dali/internal/adaptor/common/adaptor-impl.h>
+#include <dali/internal/adaptor/common/adaptor-builder-impl.h>
// EXTERNAL INCLUDES
#include <dali/public-api/common/stage.h>
#include <dali/internal/system/common/performance-interface-factory.h>
#include <dali/internal/adaptor/common/lifecycle-observer.h>
+#include <dali/internal/graphics/gles20/egl-graphics-factory.h>
+#include <dali/internal/graphics/gles20/egl-graphics.h> // Temporary until Core is abstracted
+
#include <dali/devel-api/text-abstraction/font-client.h>
#include <dali/internal/system/common/callback-manager.h>
#include <dali/internal/graphics/gles20/gl-implementation.h>
#include <dali/internal/graphics/gles20/egl-sync-implementation.h>
#include <dali/internal/graphics/common/egl-image-extensions.h>
-#include <dali/internal/graphics/gles20/egl-factory.h>
#include <dali/internal/clipboard/common/clipboard-impl.h>
#include <dali/internal/graphics/common/vsync-monitor.h>
#include <dali/internal/system/common/object-profiler.h>
#include <dali/internal/system/common/locale-utils.h>
#include <dali/internal/imaging/common/image-loader-plugin-proxy.h>
+
using Dali::TextAbstraction::FontClient;
namespace Dali
thread_local Adaptor* gThreadLocalAdaptor = NULL; // raw thread specific pointer to allow Adaptor::Get
} // unnamed namespace
+
Dali::Adaptor* Adaptor::New( Any nativeWindow, RenderSurface *surface, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions )
{
Dali::Adaptor* adaptor = new Dali::Adaptor;
Adaptor* impl = new Adaptor( nativeWindow, *adaptor, surface, environmentOptions );
adaptor->mImpl = impl;
- impl->Initialize(configuration);
+ Dali::Internal::Adaptor::AdaptorBuilder* mAdaptorBuilder = new AdaptorBuilder();
+ auto graphicsFactory = mAdaptorBuilder->GetGraphicsFactory();
+
+ impl->Initialize( graphicsFactory, configuration );
+ delete mAdaptorBuilder; // Not needed anymore as the graphics interface has now been created
return adaptor;
}
{
Any winId = window.GetNativeHandle();
- Window& windowImpl = Dali::GetImplementation(window);
+ Window& windowImpl = Dali::GetImplementation( window );
Dali::Adaptor* adaptor = New( winId, windowImpl.GetSurface(), configuration, environmentOptions );
- windowImpl.SetAdaptor(*adaptor);
+ windowImpl.SetAdaptor( *adaptor );
return adaptor;
}
-void Adaptor::Initialize( Dali::Configuration::ContextLoss configuration )
+Dali::Adaptor* Adaptor::New( GraphicsFactory& graphicsFactory, Any nativeWindow, RenderSurface *surface, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions )
+{
+ Dali::Adaptor* adaptor = new Dali::Adaptor; // Public adaptor
+ Adaptor* impl = new Adaptor( nativeWindow, *adaptor, surface, environmentOptions ); // Impl adaptor
+ adaptor->mImpl = impl;
+
+ impl->Initialize( graphicsFactory, configuration );
+
+ return adaptor;
+} // Called second
+
+Dali::Adaptor* Adaptor::New( GraphicsFactory& graphicsFactory, Dali::Window window, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions )
+{
+ Any winId = window.GetNativeHandle();
+
+ Window& windowImpl = Dali::GetImplementation( window );
+ Dali::Adaptor* adaptor = New( graphicsFactory, winId, windowImpl.GetSurface(), configuration, environmentOptions );
+ windowImpl.SetAdaptor( *adaptor );
+ return adaptor;
+} // Called first
+
+void Adaptor::Initialize( GraphicsFactory& graphicsFactory, Dali::Configuration::ContextLoss configuration )
{
// all threads here (event, update, and render) will send their logs to TIZEN Platform's LogMessage handler.
Dali::Integration::Log::LogFunction logFunction( Dali::TizenPlatform::LogMessage );
{
dataRetentionPolicy = ResourcePolicy::DALI_DISCARDS_ALL_DATA;
}
- // Note, Tizen does not use DALI_RETAINS_ALL_DATA, as it can reload images from
- // files automatically.
+
+ // Note, Tizen does not use DALI_RETAINS_ALL_DATA, as it can reload images from files automatically.
if( mEnvironmentOptions->PerformanceServerRequired() )
{
mCallbackManager = CallbackManager::New();
- PositionSize size = mSurface->GetPositionSize();
+ WindowPane defaultWindow = mWindowFrame.front();
+ PositionSize size = defaultWindow.surface->GetPositionSize();
mGestureManager = new GestureManager(*this, Vector2(size.width, size.height), mCallbackManager, *mEnvironmentOptions);
- if( mEnvironmentOptions->GetGlesCallTime() > 0 )
- {
- mGLES = new GlProxyImplementation( *mEnvironmentOptions );
- }
- else
- {
- mGLES = new GlImplementation();
- }
-
- const Integration::DepthBufferAvailable depthBufferAvailable = static_cast< Integration::DepthBufferAvailable >( mEnvironmentOptions->DepthBufferRequired() );
- const Integration::StencilBufferAvailable stencilBufferAvailable = static_cast< Integration::StencilBufferAvailable >( mEnvironmentOptions->StencilBufferRequired() );
+ mGraphics = &( graphicsFactory.Create() );
+ mGraphics->Initialize( mEnvironmentOptions );
- mEglFactory = new EglFactory( mEnvironmentOptions->GetMultiSamplingLevel(), depthBufferAvailable, stencilBufferAvailable );
+ auto eglGraphics = static_cast<EglGraphics *>( mGraphics ); // This interface is temporary until Core has been updated to match
- EglSyncImplementation* eglSyncImpl = mEglFactory->GetSyncImplementation();
+ GlImplementation& mGLES = eglGraphics->GetGlesInterface();
+ EglSyncImplementation& eglSyncImpl = eglGraphics->GetSyncImplementation();
mCore = Integration::Core::New( *this,
*mPlatformAbstraction,
- *mGLES,
- *eglSyncImpl,
+ mGLES,
+ eglSyncImpl,
*mGestureManager,
dataRetentionPolicy ,
( 0u != mEnvironmentOptions->GetRenderToFboInterval() ) ? Integration::RenderToFrameBuffer::TRUE : Integration::RenderToFrameBuffer::FALSE,
- depthBufferAvailable,
- stencilBufferAvailable );
+ mGraphics->GetDepthBufferRequired(),
+ mGraphics->GetStencilBufferRequired() );
const unsigned int timeInterval = mEnvironmentOptions->GetObjectProfilerInterval();
if( 0u < timeInterval )
mVSyncMonitor = new VSyncMonitor;
+ if( defaultWindow.surface )
+ {
+ mDisplayConnection = Dali::DisplayConnection::New( *mGraphics, defaultWindow.surface->GetSurfaceType() );
+ }
+ else
+ {
+ mDisplayConnection = Dali::DisplayConnection::New( *mGraphics );
+ }
+
mThreadController = new ThreadController( *this, *mEnvironmentOptions );
// Should be called after Core creation
delete mObjectProfiler;
delete mCore;
- delete mEglFactory;
- delete mGLES;
+
delete mGestureManager;
+ delete mDisplayConnection;
delete mPlatformAbstraction;
delete mCallbackManager;
delete mPerformanceInterface;
+ mGraphics->Destroy();
+
// uninstall it on this thread (main actor thread)
Dali::Integration::Log::UninstallLogFunction();
void Adaptor::Start()
{
- // it doesn't support restart after stop at this moment
- // to support restarting, need more testing
+ // It doesn't support restart after stop at this moment to support restarting, need more testing
if( READY != mState )
{
return;
// Start the callback manager
mCallbackManager->Start();
- // create event handler
- mEventHandler = new EventHandler( mSurface, *this, *mGestureManager, *this, mDragAndDropDetector );
+ WindowPane defaultWindow = mWindowFrame.front();
+
+ // Create event handler
+ mEventHandler = new EventHandler( defaultWindow.surface, *this, *mGestureManager, *this, mDragAndDropDetector );
if( mDeferredRotationObserver != NULL )
{
unsigned int dpiHor, dpiVer;
dpiHor = dpiVer = 0;
- mSurface->GetDpi( dpiHor, dpiVer );
+
+ defaultWindow.surface->GetDpi( dpiHor, dpiVer );
// tell core about the DPI value
mCore->SetDpi(dpiHor, dpiVer);
fontClient.SetDpi( dpiHor, dpiVer );
// Tell the core the size of the surface just before we start the render-thread
- PositionSize size = mSurface->GetPositionSize();
+ PositionSize size = defaultWindow.surface->GetPositionSize();
+
mCore->SurfaceResized( size.width, size.height );
// Initialize the thread controller
(*iter)->OnResume();
}
- // trigger processing of events queued up while paused
+ // Trigger processing of events queued up while paused
mCore->ProcessEvents();
// Do at end to ensure our first update/render after resumption includes the processed messages as well
mThreadController->Stop();
+ // Clear out all the handles to Windows
+ mWindowFrame.clear();
+
// Delete the TTS player
for(int i =0; i < Dali::TtsPlayer::MODE_NUM; i++)
{
mEventHandler->FeedKeyEvent( keyEvent );
}
-void Adaptor::ReplaceSurface( Any nativeWindow, RenderSurface& surface )
+void Adaptor::ReplaceSurface( Any nativeWindow, RenderSurface& newSurface )
{
- PositionSize positionSize = surface.GetPositionSize();
+ PositionSize positionSize = newSurface.GetPositionSize();
- // let the core know the surface size has changed
+ // Let the core know the surface size has changed
mCore->SurfaceResized( positionSize.width, positionSize.height );
mResizedSignal.Emit( mAdaptor );
- mNativeWindow = nativeWindow;
- mSurface = &surface;
+ WindowPane newDefaultWindow;
+ newDefaultWindow.nativeWindow = nativeWindow;
+ newDefaultWindow.surface = &newSurface;
+
+ // Must delete the old Window first before replacing it with the new one
+ WindowPane oldDefaultWindow = mWindowFrame.front();
+ oldDefaultWindow.surface->DestroySurface();
- // flush the event queue to give the update-render thread chance
+ // Update WindowFrame
+ std::vector<WindowPane>::iterator iter = mWindowFrame.begin();
+ iter = mWindowFrame.insert( iter, newDefaultWindow );
+
+ // Flush the event queue to give the update-render thread chance
// to start processing messages for new camera setup etc as soon as possible
ProcessCoreEvents();
- // this method blocks until the render thread has completed the replace.
- mThreadController->ReplaceSurface(mSurface);
+ // This method blocks until the render thread has completed the replace.
+ mThreadController->ReplaceSurface( newDefaultWindow.surface );
}
RenderSurface& Adaptor::GetSurface() const
{
- return *mSurface;
+ WindowPane defaultWindow = mWindowFrame.front();
+ return *(defaultWindow.surface);
}
void Adaptor::ReleaseSurfaceLock()
{
- mSurface->ReleaseLock();
+ WindowPane defaultWindow = mWindowFrame.front();
+ defaultWindow.surface->ReleaseLock();
}
Dali::TtsPlayer Adaptor::GetTtsPlayer(Dali::TtsPlayer::Mode mode)
mThreadController->SetPreRenderCallback( callback );
}
+bool Adaptor::AddWindow( Dali::Window* childWindow, const std::string& childWindowName, const std::string& childWindowClassName, const bool& childWindowMode )
+{
+ // This is any Window that is not the main (default) one
+ WindowPane additionalWindow;
+ additionalWindow.instance = childWindow;
+ additionalWindow.window_name = childWindowName;
+ additionalWindow.class_name = childWindowClassName;
+ additionalWindow.window_mode = childWindowMode;
+
+ // Add the new Window to the Frame - the order is not important
+ mWindowFrame.push_back( additionalWindow );
+
+ Window& windowImpl = Dali::GetImplementation( *childWindow );
+ windowImpl.SetAdaptor( Get() );
+
+ return true;
+}
+
+bool Adaptor::RemoveWindow( Dali::Window* childWindow )
+{
+ for ( WindowFrames::iterator iter = mWindowFrame.begin(); iter != mWindowFrame.end(); ++iter )
+ {
+ if( iter->instance == childWindow )
+ {
+ mWindowFrame.erase( iter );
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool Adaptor::RemoveWindow( std::string childWindowName )
+{
+ for ( WindowFrames::iterator iter = mWindowFrame.begin(); iter != mWindowFrame.end(); ++iter )
+ {
+ if( iter->window_name == childWindowName )
+ {
+ mWindowFrame.erase( iter );
+ return true;
+ }
+ }
+
+ return false;
+}
+
Dali::Adaptor& Adaptor::Get()
{
DALI_ASSERT_ALWAYS( IsAvailable() && "Adaptor not instantiated" );
mVSyncMonitor->SetUseHardwareVSync( useHardware );
}
-EglFactory& Adaptor::GetEGLFactory() const
+Dali::DisplayConnection& Adaptor::GetDisplayConnectionInterface()
{
- DALI_ASSERT_DEBUG( mEglFactory && "EGL Factory not created" );
- return *mEglFactory;
+ DALI_ASSERT_DEBUG( mDisplayConnection && "Display connection not created" );
+ return *mDisplayConnection;
}
-EglFactoryInterface& Adaptor::GetEGLFactoryInterface() const
+GraphicsInterface& Adaptor::GetGraphicsInterface()
{
- return *mEglFactory;
-}
-
-Integration::GlAbstraction& Adaptor::GetGlAbstraction() const
-{
- DALI_ASSERT_DEBUG( mGLES && "GLImplementation not created" );
- return *mGLES;
+ DALI_ASSERT_DEBUG( mGraphics && "Graphics interface not created" );
+ return *mGraphics;
}
Dali::Integration::PlatformAbstraction& Adaptor::GetPlatformAbstractionInterface()
return *mPlatformAbstraction;
}
-Dali::Integration::GlAbstraction& Adaptor::GetGlesInterface()
-{
- return *mGLES;
-}
-
TriggerEventInterface& Adaptor::GetProcessCoreEventsTrigger()
{
return *mNotificationTrigger;
RenderSurface* Adaptor::GetRenderSurfaceInterface()
{
- return mSurface;
+ if( !mWindowFrame.empty())
+ {
+ WindowPane defaultWindow = mWindowFrame.front();
+ return defaultWindow.surface;
+ }
+ else
+ {
+ return nullptr;
+ }
}
VSyncMonitorInterface* Adaptor::GetVSyncMonitorInterface()
Any Adaptor::GetNativeWindowHandle()
{
- return mNativeWindow;
+ WindowPane defaultWindow = mWindowFrame.front();
+ return defaultWindow.nativeWindow;
}
Any Adaptor::GetGraphicsDisplay()
{
Any display;
- if( mEglFactory )
+ if (mGraphics)
{
- EglInterface* egl = mEglFactory->GetImplementation();
- if( egl )
- {
- auto eglImpl = static_cast<EglImplementation*>(egl);
- display = eglImpl->GetDisplay();
- }
+ auto eglGraphics = static_cast<EglGraphics *>( mGraphics ); // This interface is temporary until Core has been updated to match
+
+ EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
+ display = eglImpl.GetDisplay();
}
+
return display;
}
void Adaptor::SurfaceResizePrepare( SurfaceSize surfaceSize )
{
- // let the core know the surface size has changed
+ // Let the core know the surface size has changed
mCore->SurfaceResized( surfaceSize.GetWidth(), surfaceSize.GetHeight() );
mResizedSignal.Emit( mAdaptor );
void Adaptor::SurfaceResizeComplete( SurfaceSize surfaceSize )
{
- // flush the event queue to give the update-render thread chance
+ // Flush the event queue to give the update-render thread chance
// to start processing messages for new camera setup etc as soon as possible
ProcessCoreEvents();
// Start thread controller after the scene has been created
mThreadController->Start();
- // process after surface is created (registering to remote surface provider if required)
+ // Process after surface is created (registering to remote surface provider if required)
SurfaceInitialized();
mState = RUNNING;
void Adaptor::IndicatorSizeChanged(int height)
{
- // let the core know the indicator height is changed
+ // Let the core know the indicator height is changed
mCore->SetTopMargin(height);
}
mLanguageChangedSignal(),
mAdaptor( adaptor ),
mState( READY ),
- mCore( NULL ),
- mThreadController( NULL ),
- mVSyncMonitor( NULL ),
- mGLES( NULL ),
- mGlSync( NULL ),
- mEglFactory( NULL ),
- mNativeWindow( nativeWindow ),
- mSurface( surface ),
- mPlatformAbstraction( NULL ),
- mEventHandler( NULL ),
- mCallbackManager( NULL ),
+ mCore( nullptr ),
+ mThreadController( nullptr ),
+ mVSyncMonitor( nullptr ),
+ mDisplayConnection( nullptr ),
+ mPlatformAbstraction( nullptr ),
+ mEventHandler( nullptr ),
+ mCallbackManager( nullptr ),
mNotificationOnIdleInstalled( false ),
- mNotificationTrigger( NULL ),
- mGestureManager( NULL ),
+ mNotificationTrigger( nullptr ),
+ mGestureManager( nullptr ),
mDaliFeedbackPlugin(),
- mFeedbackController( NULL ),
+ mFeedbackController( nullptr ),
mTtsPlayers(),
mObservers(),
mDragAndDropDetector(),
- mDeferredRotationObserver( NULL ),
+ mDeferredRotationObserver( nullptr ),
mEnvironmentOptions( environmentOptions ? environmentOptions : new EnvironmentOptions /* Create the options if not provided */),
- mPerformanceInterface( NULL ),
+ mPerformanceInterface( nullptr ),
mKernelTracer(),
mSystemTracer(),
mTriggerEventFactory(),
- mObjectProfiler( NULL ),
+ mObjectProfiler( nullptr ),
mSocketFactory(),
mEnvironmentOptionsOwned( environmentOptions ? false : true /* If not provided then we own the object */ ),
mUseRemoteSurface( false )
{
DALI_ASSERT_ALWAYS( !IsAvailable() && "Cannot create more than one Adaptor per thread" );
+
+ WindowPane defaultWindow;
+ defaultWindow.nativeWindow = nativeWindow;
+ defaultWindow.surface = surface;
+
+ std::vector<WindowPane>::iterator iter = mWindowFrame.begin();
+ iter = mWindowFrame.insert( iter, defaultWindow );
+
gThreadLocalAdaptor = this;
}
void Adaptor::SetViewMode( ViewMode viewMode )
{
- mSurface->SetViewMode( viewMode );
+ WindowPane defaultWindow = mWindowFrame.front();
+ defaultWindow.surface->SetViewMode( viewMode );
+
mCore->SetViewMode( viewMode );
}
-#ifndef __DALI_INTERNAL_ADAPTOR_IMPL_H__
-#define __DALI_INTERNAL_ADAPTOR_IMPL_H__
+#ifndef DALI_INTERNAL_ADAPTOR_IMPL_H
+#define DALI_INTERNAL_ADAPTOR_IMPL_H
/*
* Copyright (c) 2018 Samsung Electronics Co., Ltd.
#include <dali/public-api/adaptor-framework/tts-player.h>
#include <dali/devel-api/adaptor-framework/clipboard.h>
+#include <dali/internal/graphics/common/graphics-interface.h>
+
#include <dali/internal/legacy/common/tizen-platform-abstraction.h>
#include <dali/internal/adaptor/common/adaptor-internal-services.h>
#include <dali/internal/system/common/environment-options.h>
#include <dali/integration-api/trigger-event-factory.h>
#include <dali/internal/network/common/socket-factory.h>
+
namespace Dali
{
namespace Adaptor
{
+class DisplayConnection;
+class GraphicsFactory;
class EventHandler;
-class EglFactory;
class GestureManager;
class GlImplementation;
class GlSyncImplementation;
* @param[in] configuration The context loss configuration ( to choose resource discard policy )
* @param[in] environmentOptions A pointer to the environment options. If NULL then one is created.
*/
- static Dali::Adaptor* New( Dali::Window window, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions );
+ static Dali::Adaptor* New( Dali::Window window,
+ Dali::Configuration::ContextLoss configuration,
+ EnvironmentOptions* environmentOptions );
+
+ /**
+ * Creates a New Adaptor
+ * @param[in] graphicsFactory A factory that creates the graphics interface
+ * @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] configuration The context loss configuration ( to choose resource discard policy )
+ * @param[in] environmentOptions A pointer to the environment options. If NULL then one is created.
+ */
+ static Dali::Adaptor* New( GraphicsFactory& graphicsFactory,
+ Any nativeWindow,
+ RenderSurface* surface,
+ Dali::Configuration::ContextLoss configuration,
+ EnvironmentOptions* environmentOptions );
+
+ /**
+ * Creates a New Adaptor
+ * @param[in] graphicsFactory A factory that creates the graphics interface
+ * @param[in] nativeWindow native window handle
+ * @param[in] configuration The context loss configuration ( to choose resource discard policy )
+ * @param[in] environmentOptions A pointer to the environment options. If NULL then one is created.
+ */
+ static Dali::Adaptor* New( GraphicsFactory& graphicsFactory,
+ Dali::Window window,
+ Dali::Configuration::ContextLoss configuration,
+ EnvironmentOptions* environmentOptions );
/**
* 2-step initialisation, this should be called after creating an adaptor instance.
+ * @param[in] graphicsFactory A factory that creates the graphics interface
+ * @param[in] configuration The context loss configuration ( to choose resource discard policy )
*/
- void Initialize(Dali::Configuration::ContextLoss configuration);
+ void Initialize( GraphicsFactory& graphicsFactory, Dali::Configuration::ContextLoss configuration );
/**
* Virtual destructor.
virtual bool AddIdle( CallbackBase* callback, bool hasReturnValue, bool forceAdd );
/**
+ * Adds a new Window instance to the Adaptor
+ * @param[in] childWindow The child window instance
+ * @param[in] childWindowName The child window title/name
+ * @param[in] childWindowClassName The class name that the child window belongs to
+ * @param[in] childWindowMode The mode of the child window
+ */
+ virtual bool AddWindow( Dali::Window* childWindow,
+ const std::string& childWindowName,
+ const std::string& childWindowClassName,
+ const bool& childWindowMode );
+
+ /**
+ * Removes an existing Window instance from the Adaptor
+ * @param[in] window The Window instance
+ */
+ virtual bool RemoveWindow( Dali::Window* childWindow );
+
+ /**
+ * Removes an existing Window instance from the Adaptor
+ * @param[in] windowName The Window name
+ * @note If two Windows have the same name, the first one that matches will be removed
+ */
+ virtual bool RemoveWindow( std::string childWindowName );
+
+ /**
* @copydoc Dali::Adaptor::RemoveIdle()
*/
virtual void RemoveIdle( CallbackBase* callback );
void SetUseHardwareVSync(bool useHardware);
/**
- * @return reference to EglFactory class
- */
- EglFactory& GetEGLFactory() const;
-
- /**
- * Return GlAbstraction.
- * @return the GlAbstraction.
- */
- Integration::GlAbstraction& GetGlAbstraction() const;
-
- /**
* Return the PlatformAbstraction.
* @return The PlatformAbstraction.
*/
void SetRotationObserver( RotationObserver* observer );
/**
- * Destroy the TtsPlayer of sepcific mode.
+ * Destroy the TtsPlayer of specific mode.
* @param[in] mode The mode of TtsPlayer to destroy
*/
void DestroyTtsPlayer(Dali::TtsPlayer::Mode mode);
Any GetGraphicsDisplay();
/**
- * Sets use remote surface for eglSurface output
+ * Sets use remote surface for Surface output
* @param[in] useRemoteSurface True if the remote surface is used
*/
void SetUseRemoteSurface(bool useRemoteSurface);
virtual Dali::Integration::PlatformAbstraction& GetPlatformAbstractionInterface();
/**
- * @copydoc Dali::Internal::Adaptor::AdaptorInternalServices::GetGlesInterface()
+ * @copydoc Dali::Internal::Adaptor::AdaptorInternalServices::GetDisplayConnectionInterface()
*/
- virtual Dali::Integration::GlAbstraction& GetGlesInterface();
+ virtual Dali::DisplayConnection& GetDisplayConnectionInterface();
/**
- * @copydoc Dali::Internal::Adaptor::AdaptorInternalServices::GetEGLFactoryInterface()
- */
- virtual EglFactoryInterface& GetEGLFactoryInterface() const;
+ * @copydoc Dali::Internal::Adaptor::AdaptorInternalServices::GetGraphicsInterface()
+ */
+ virtual GraphicsInterface& GetGraphicsInterface();
/**
* @copydoc Dali::Internal::Adaptor::AdaptorInternalServices::GetTriggerEventInterface()
private:
// Undefined
- Adaptor(const Adaptor&);
- Adaptor& operator=(Adaptor&);
+ Adaptor(const Adaptor&) = delete;
+ Adaptor& operator=(Adaptor&) = delete;
private:
STOPPED, ///< Adaptor has been stopped.
};
+ // A structure to encapsulate each Window instance for the Adaptor to track them
+ typedef struct WindowPane
+ {
+ Dali::Window* instance; ///< Window object
+ std::string window_name; ///< Name (title)_of the window
+ std::string class_name; ///< Class name that the window belongs to
+ bool window_mode; ///< Display mode of the window
+ Any nativeWindow; ///< window identifier
+ RenderSurface* surface; ///< The surface the Window is bound to
+ } WindowPane;
+
+ typedef std::vector<WindowPane> WindowFrames;
+
typedef std::vector<LifeCycleObserver*> ObserverContainer;
private: // Data
Dali::Integration::Core* mCore; ///< Dali Core
ThreadController* mThreadController; ///< Controls the threads
VSyncMonitor* mVSyncMonitor; ///< Monitors VSync events
- GlImplementation* mGLES; ///< GL implementation
- GlSyncImplementation* mGlSync; ///< GL Sync implementation
- EglFactory* mEglFactory; ///< EGL Factory
- Any mNativeWindow; ///< window identifier
- RenderSurface* mSurface; ///< Current surface
+ GraphicsInterface* mGraphics; ///< Graphics interface
+ Dali::DisplayConnection* mDisplayConnection; ///< Display connection
+ WindowFrames mWindowFrame; ///< A container of all the Windows that are currently created
+
TizenPlatform::TizenPlatformAbstraction* mPlatformAbstraction; ///< Platform abstraction
EventHandler* mEventHandler; ///< event handler
SocketFactory mSocketFactory; ///< Socket factory
const bool mEnvironmentOptionsOwned:1; ///< Whether we own the EnvironmentOptions (and thus, need to delete it)
bool mUseRemoteSurface; ///< whether the remoteSurface is used or not
+
public:
- inline static Adaptor& GetImplementation(Dali::Adaptor& adaptor) {return *adaptor.mImpl;}
+ inline static Adaptor& GetImplementation(Dali::Adaptor& adaptor) { return *adaptor.mImpl; }
};
} // namespace Internal
} // namespace Dali
-#endif // __DALI_INTERNAL_ADAPTOR_IMPL_H__
+#endif // DALI_INTERNAL_ADAPTOR_IMPL_H
-#ifndef __DALI_INTERNAL_ADAPTOR_INTERNAL_SERVICES_H__
-#define __DALI_INTERNAL_ADAPTOR_INTERNAL_SERVICES_H__
+#ifndef DALI_INTERNAL_ADAPTOR_INTERNAL_SERVICES_H
+#define DALI_INTERNAL_ADAPTOR_INTERNAL_SERVICES_H
/*
* Copyright (c) 2014 Samsung Electronics Co., Ltd.
// INTERNAL INCLUDES
#include <dali/integration-api/trigger-event-interface.h>
#include <dali/integration-api/trigger-event-factory-interface.h>
+#include <dali/internal/window-system/common/display-connection.h>
+#include <dali/internal/graphics/common/graphics-interface.h>
#include <dali/internal/graphics/gles20/egl-factory-interface.h>
#include <dali/internal/network/common/socket-factory-interface.h>
#include <dali/internal/system/common/performance-interface.h>
/**
* @return platform abstraction
*/
- virtual Dali::Integration::PlatformAbstraction& GetPlatformAbstractionInterface() = 0;
+ virtual Dali::Integration::PlatformAbstraction& GetPlatformAbstractionInterface() = 0;
/**
- * @return gles abstraction
+ * Used to access the Display Connection interface from the Render thread
+ * @return the Display Connection interface
*/
- virtual Dali::Integration::GlAbstraction& GetGlesInterface() = 0;
+ virtual Dali::DisplayConnection& GetDisplayConnectionInterface() = 0;
/**
- * @return egl factory
+ * Used to access the abstracted graphics interface
+ * This also contains the depth and stencil buffers
+ * @return the graphics interface
*/
- virtual EglFactoryInterface& GetEGLFactoryInterface() const = 0;
+ virtual GraphicsInterface& GetGraphicsInterface() = 0;
/**
* Used by update-thread to notify core (main-thread) it has messages to process
* @return trigger event ProcessCoreEvents
*/
- virtual TriggerEventInterface& GetProcessCoreEventsTrigger() = 0;
+ virtual TriggerEventInterface& GetProcessCoreEventsTrigger() = 0;
/**
* @return trigger event factory interface
/**
* @return render surface
*/
- virtual RenderSurface* GetRenderSurfaceInterface() = 0;
+ virtual RenderSurface* GetRenderSurfaceInterface() = 0;
/**
* @return vsync monitor interface
*/
- virtual VSyncMonitorInterface* GetVSyncMonitorInterface() = 0;
+ virtual VSyncMonitorInterface* GetVSyncMonitorInterface() = 0;
/**
* @return performance interface
*/
- virtual PerformanceInterface* GetPerformanceInterface() = 0;
+ virtual PerformanceInterface* GetPerformanceInterface() = 0;
/**
* @return interface for logging to the kernel ( e.g. using ftrace )
*/
- virtual TraceInterface& GetKernelTraceInterface() = 0;
+ virtual TraceInterface& GetKernelTraceInterface() = 0;
/**
* @return system trace interface, e.g. for using Tizen Trace (ttrace) or Android Trace (atrace)
*/
- virtual TraceInterface& GetSystemTraceInterface() = 0;
+ virtual TraceInterface& GetSystemTraceInterface() = 0;
protected:
};
// Undefined copy constructor.
- AdaptorInternalServices( const AdaptorInternalServices& );
+ AdaptorInternalServices( const AdaptorInternalServices& ) = delete;
// Undefined assignment operator.
- AdaptorInternalServices& operator=( const AdaptorInternalServices& );
+ AdaptorInternalServices& operator=( const AdaptorInternalServices& ) = delete;
};
} // namespace Internal
} // namespace Dali
-#endif // __DALI_INTERNAL_ADAPTOR_INTERNAL_SERVICES_H__
+#endif // DALI_INTERNAL_ADAPTOR_INTERNAL_SERVICES_H
// INTERNAL INCLUDES
#include <dali/devel-api/adaptor-framework/style-monitor.h>
#include <dali/internal/system/common/command-line-options.h>
-#include <dali/internal/adaptor/common/adaptor-impl.h>
#include <dali/internal/adaptor/common/framework.h>
#include <dali/internal/system/common/singleton-service-impl.h>
#include <dali/internal/adaptor/common/lifecycle-controller-impl.h>
mRegionChangedSignal(),
mBatteryLowSignal(),
mMemoryLowSignal(),
- mEventLoop( NULL ),
- mFramework( NULL ),
+ mEventLoop( nullptr ),
+ mFramework( nullptr ),
mContextLossConfiguration( Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS ),
- mCommandLineOptions( NULL ),
+ mCommandLineOptions( nullptr ),
mSingletonService( SingletonService::New() ),
- mAdaptor( NULL ),
- mWindow(),
- mWindowMode( windowMode ),
- mName(),
+ mAdaptorBuilder( nullptr ),
+ mAdaptor( nullptr ),
+ mMainWindow(),
+ mMainWindowMode( windowMode ),
+ mMainWindowName(),
mStylesheet( stylesheet ),
mEnvironmentOptions(),
mWindowPositionSize( positionSize ),
mSlotDelegate( this )
{
// Get mName from environment options
- mName = mEnvironmentOptions.GetWindowName();
- if( mName.empty() && argc && ( *argc > 0 ) )
+ mMainWindowName = mEnvironmentOptions.GetWindowName();
+ if( mMainWindowName.empty() && argc && ( *argc > 0 ) )
{
// Set mName from command-line args if environment option not set
- mName = (*argv)[0];
+ mMainWindowName = (*argv)[0];
}
mCommandLineOptions = new CommandLineOptions(argc, argv);
{
mSingletonService.UnregisterAll();
- mWindow.Reset();
+ mMainWindow.Reset();
delete mAdaptor;
+ delete mAdaptorBuilder;
delete mCommandLineOptions;
delete mFramework;
}
}
const std::string& windowClassName = mEnvironmentOptions.GetWindowClassName();
- mWindow = Dali::Window::New( mWindowPositionSize, mName, windowClassName, mWindowMode == Dali::Application::TRANSPARENT );
+ mMainWindow = Dali::Window::New( mWindowPositionSize, mMainWindowName, windowClassName, mMainWindowMode == Dali::Application::TRANSPARENT );
int indicatorVisibleMode = mEnvironmentOptions.GetIndicatorVisibleMode();
if( indicatorVisibleMode >= Dali::Window::INVISIBLE && indicatorVisibleMode <= Dali::Window::AUTO )
{
- GetImplementation( mWindow ).SetIndicatorVisibleMode( static_cast< Dali::Window::IndicatorVisibleMode >( indicatorVisibleMode ) );
+ GetImplementation( mMainWindow ).SetIndicatorVisibleMode( static_cast< Dali::Window::IndicatorVisibleMode >( indicatorVisibleMode ) );
}
// Quit the application when the window is closed
- GetImplementation( mWindow ).DeleteRequestSignal().Connect( mSlotDelegate, &Application::Quit );
+ GetImplementation( mMainWindow ).DeleteRequestSignal().Connect( mSlotDelegate, &Application::Quit );
}
void Application::CreateAdaptor()
{
- DALI_ASSERT_ALWAYS( mWindow && "Window required to create adaptor" );
+ DALI_ASSERT_ALWAYS( mMainWindow && "Window required to create adaptor" );
- mAdaptor = Dali::Internal::Adaptor::Adaptor::New( mWindow, mContextLossConfiguration, &mEnvironmentOptions );
+ auto graphicsFactory = mAdaptorBuilder->GetGraphicsFactory();
+
+ mAdaptor = Dali::Internal::Adaptor::Adaptor::New( graphicsFactory, mMainWindow, mContextLossConfiguration, &mEnvironmentOptions );
mAdaptor->ResizedSignal().Connect( mSlotDelegate, &Application::OnResize );
Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).SetUseRemoteSurface( mUseRemoteSurface );
}
+void Application::CreateAdaptorBuilder()
+{
+ mAdaptorBuilder = new AdaptorBuilder();
+}
+
void Application::MainLoop(Dali::Configuration::ContextLoss configuration)
{
mContextLossConfiguration = configuration;
void Application::Lower()
{
// Lower the application without quitting it.
- mWindow.Lower();
+ mMainWindow.Lower();
}
void Application::Quit()
void Application::DoInit()
{
+ CreateAdaptorBuilder();
+
// If an application was pre-initialized, a window was made in advance
if( mLaunchpadState == Launchpad::NONE )
{
mAdaptor->Stop();
}
- mWindow.Reset();
+ mMainWindow.Reset(); // This only resets (clears) the default Window
}
void Application::DoPause()
void Application::OnTerminate()
{
- // we've been told to quit by AppCore, ecore_x_destroy has been called, need to quit synchronously
+ // We've been told to quit by AppCore, ecore_x_destroy has been called, need to quit synchronously
// delete the window as ecore_x has been destroyed by AppCore
Dali::Application application(this);
Dali::Window Application::GetWindow()
{
- return mWindow;
+ return mMainWindow;
}
// Stereoscopy
return Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).GetStereoBase();
}
-
void Application::ReplaceWindow( const PositionSize& positionSize, const std::string& name )
{
- Dali::Window newWindow = Dali::Window::New( positionSize, name, mWindowMode == Dali::Application::TRANSPARENT );
+ Dali::Window newWindow = Dali::Window::New( positionSize, name, mMainWindowMode == Dali::Application::TRANSPARENT );
Window& windowImpl = GetImplementation(newWindow);
windowImpl.SetAdaptor(*mAdaptor);
Any nativeWindow = newWindow.GetNativeHandle();
Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).ReplaceSurface(nativeWindow, *renderSurface);
- mWindow = newWindow;
+ mMainWindow = newWindow;
mWindowPositionSize = positionSize;
}
mStylesheet = stylesheet;
}
-
ApplicationPtr Application::GetPreInitializedApplication()
{
return gPreInitializedApplication;
-#ifndef __DALI_INTERNAL_APPLICATION_H__
-#define __DALI_INTERNAL_APPLICATION_H__
+#ifndef DALI_INTERNAL_APPLICATION_H
+#define DALI_INTERNAL_APPLICATION_H
/*
* Copyright (c) 2018 Samsung Electronics Co., Ltd.
#include <dali/internal/adaptor/common/framework.h>
#include <dali/internal/window-system/common/window-impl.h>
#include <dali/internal/system/common/environment-options.h>
+#include <dali/internal/adaptor/common/adaptor-builder-impl.h>
namespace Dali
{
void CreateAdaptor();
/**
+ * Creates the adaptor builder
+ */
+ void CreateAdaptorBuilder();
+
+ /**
* Quits from the main loop
*/
void QuitFromMainLoop();
Dali::Configuration::ContextLoss mContextLossConfiguration;
CommandLineOptions* mCommandLineOptions;
- Dali::SingletonService mSingletonService;
- Dali::Adaptor* mAdaptor;
- Dali::Window mWindow;
- Dali::Application::WINDOW_MODE mWindowMode;
- std::string mName;
- std::string mStylesheet;
- EnvironmentOptions mEnvironmentOptions;
- PositionSize mWindowPositionSize;
- Launchpad::State mLaunchpadState;
- bool mUseRemoteSurface;
+ Dali::SingletonService mSingletonService;
+ Dali::Internal::Adaptor::AdaptorBuilder* mAdaptorBuilder; ///< The adaptor builder
+ Dali::Adaptor* mAdaptor;
+
+ // The Main Window is that window created by the Application during initial startup
+ // (previously this was the only window)
+ Dali::Window mMainWindow; ///< Main Window instance
+ Dali::Application::WINDOW_MODE mMainWindowMode; ///< Window mode of the main window
+ std::string mMainWindowName; ///< Name of the main window as obtained from environment options
+
+ std::string mStylesheet;
+ EnvironmentOptions mEnvironmentOptions;
+ PositionSize mWindowPositionSize;
+ Launchpad::State mLaunchpadState;
+ bool mUseRemoteSurface;
SlotDelegate< Application > mSlotDelegate;
inline const Application& GetImplementation(const Dali::Application& application)
{
- DALI_ASSERT_ALWAYS(application && "Timre handle is empty");
+ DALI_ASSERT_ALWAYS(application && "application handle is empty");
const BaseObject& handle = application.GetBaseObject();
} // namespace Dali
-#endif // __DALI_INTERNAL_APPLICATION_H__
+#endif // DALI_INTERNAL_APPLICATION_H
CombinedUpdateRenderController::CombinedUpdateRenderController( AdaptorInternalServices& adaptorInterfaces, const EnvironmentOptions& environmentOptions )
: mFpsTracker( environmentOptions ),
mUpdateStatusLogger( environmentOptions ),
- mRenderHelper( adaptorInterfaces ),
mEventThreadSemaphore(),
mUpdateRenderThreadWaitCondition(),
mAdaptorInterfaces( adaptorInterfaces ),
int error = pthread_create( mUpdateRenderThread, NULL, InternalUpdateRenderThreadEntryFunc, this );
DALI_ASSERT_ALWAYS( !error && "Return code from pthread_create() when creating UpdateRenderThread" );
- // The Update/Render thread will now run and initialise EGL etc. and will then wait for Start to be called
+ // The Update/Render thread will now run and initialise the graphics interface etc. and will then wait for Start to be called
// When this function returns, the application initialisation on the event thread should occur
}
sem_wait( &mEventThreadSemaphore );
}
- mRenderHelper.Start();
+ RenderSurface* currentSurface = mAdaptorInterfaces.GetRenderSurfaceInterface();
+ if( currentSurface )
+ {
+ currentSurface->StartRender();
+ }
mRunning = TRUE;
LOG_EVENT_TRACE;
// Stop Rendering and the Update/Render Thread
- mRenderHelper.Stop();
+ RenderSurface* currentSurface = mAdaptorInterfaces.GetRenderSurfaceInterface();
+ if( currentSurface )
+ {
+ currentSurface->StopRender();
+ }
StopUpdateRenderThread();
LOG_UPDATE_RENDER( "THREAD CREATED" );
- mRenderHelper.InitializeEgl();
+ RenderSurface* currentSurface = mAdaptorInterfaces.GetRenderSurfaceInterface();
+ if( currentSurface )
+ {
+ currentSurface->InitializeGraphics( mAdaptorInterfaces.GetGraphicsInterface(), mAdaptorInterfaces.GetDisplayConnectionInterface() );
+ }
- // tell core it has a context
+ // Tell core it has a context
mCore.ContextCreated();
NotifyThreadInitialised();
if( DALI_UNLIKELY( newSurface ) )
{
LOG_UPDATE_RENDER_TRACE_FMT( "Replacing Surface" );
- mRenderHelper.ReplaceSurface( newSurface );
+
+ // This is designed for replacing pixmap surfaces, but should work for window as well
+ // we need to delete the surface and renderable (pixmap / window)
+ // Then create a new pixmap/window and new surface
+ // If the new surface has a different display connection, then the context will be lost
+
+ mAdaptorInterfaces.GetDisplayConnectionInterface().Initialize();
+ newSurface->ReplaceGraphicsSurface();
SurfaceReplaced();
}
bool surfaceResized = ShouldSurfaceBeResized();
if( DALI_UNLIKELY( surfaceResized ) )
{
- // RenderHelper::ResizeSurface() should be called right after a viewport is changed.
if( updateStatus.SurfaceRectChanged() )
{
LOG_UPDATE_RENDER_TRACE_FMT( "Resizing Surface" );
- mRenderHelper.ResizeSurface();
SurfaceResized();
}
}
// RENDER
//////////////////////////////
- mRenderHelper.ConsumeEvents();
+ mAdaptorInterfaces.GetDisplayConnectionInterface().ConsumeEvents();
+
if( mPreRenderCallback != NULL )
{
bool keepCallback = CallbackBase::ExecuteReturn<bool>(*mPreRenderCallback);
mPreRenderCallback = NULL;
}
}
- mRenderHelper.PreRender();
+
+ RenderSurface* currentSurface = mAdaptorInterfaces.GetRenderSurfaceInterface();
+ if( currentSurface )
+ {
+ currentSurface->PreRender( mSurfaceResized );
+ }
Integration::RenderStatus renderStatus;
if( renderStatus.NeedsPostRender() )
{
- mRenderHelper.PostRender( isRenderingToFbo );
+ if( currentSurface )
+ {
+ currentSurface->PostRender( isRenderingToFbo, ( mNewSurface != NULL ), mSurfaceResized );
+ }
}
// Trigger event thread to request Update/Render thread to sleep if update not required
- if( ( Integration::KeepUpdating::NOT_REQUESTED == keepUpdatingStatus ) &&
- ! renderStatus.NeedsUpdate() )
+ if( ( Integration::KeepUpdating::NOT_REQUESTED == keepUpdatingStatus ) && !renderStatus.NeedsUpdate() )
{
mSleepTrigger->Trigger();
updateRequired = false;
// Inform core of context destruction & shutdown EGL
mCore.ContextDestroyed();
- mRenderHelper.ShutdownEgl();
+ if( currentSurface )
+ {
+ currentSurface->DestroySurface();
+ currentSurface = nullptr;
+ }
LOG_UPDATE_RENDER( "THREAD DESTROYED" );
-#ifndef __DALI_INTERNAL_COMBINED_UPDATE_RENDER_CONTROLLER_H__
-#define __DALI_INTERNAL_COMBINED_UPDATE_RENDER_CONTROLLER_H__
+#ifndef DALI_INTERNAL_COMBINED_UPDATE_RENDER_CONTROLLER_H
+#define DALI_INTERNAL_COMBINED_UPDATE_RENDER_CONTROLLER_H
/*
* Copyright (c) 2018 Samsung Electronics Co., Ltd.
#include <dali/integration-api/thread-synchronization-interface.h>
#include <dali/internal/system/common/performance-interface.h>
#include <dali/internal/system/common/fps-tracker.h>
-#include <dali/internal/graphics/common/render-helper.h>
#include <dali/internal/adaptor/common/thread-controller-interface.h>
#include <dali/internal/system/common/update-status-logger.h>
+#include <dali/internal/window-system/common/display-connection.h>
+
namespace Dali
{
FpsTracker mFpsTracker; ///< Object that tracks the FPS
UpdateStatusLogger mUpdateStatusLogger; ///< Object that logs the update-status as required.
- RenderHelper mRenderHelper; ///< Helper class for EGL, pre & post rendering
-
sem_t mEventThreadSemaphore; ///< Used by the event thread to ensure all threads have been initialised, and when replacing the surface.
ConditionalWait mUpdateRenderThreadWaitCondition; ///< The wait condition for the update-render-thread.
volatile unsigned int mPostRendering; ///< Whether post-rendering is taking place (set by the event & render threads, read by the render-thread).
volatile unsigned int mSurfaceResized; ///< Will be set to resize the surface (set by the event-thread, read & cleared by the update-render thread).
- volatile unsigned int mForceClear; ///< Will be set to clear forcely
+ volatile unsigned int mForceClear; ///< Will be set to clear forcibly
};
} // namespace Adaptor
} // namespace Dali
-#endif // __DALI_INTERNAL_COMBINED_UPDATE_RENDER_CONTROLLER_H__
+#endif // DALI_INTERNAL_COMBINED_UPDATE_RENDER_CONTROLLER_H
${adaptor_adaptor_dir}/common/lifecycle-controller-impl.cpp \
${adaptor_adaptor_dir}/common/adaptor-impl.cpp \
${adaptor_adaptor_dir}/common/adaptor.cpp \
+ ${adaptor_adaptor_dir}/common/adaptor-builder-impl.cpp \
${adaptor_adaptor_dir}/common/application-impl.cpp \
${adaptor_adaptor_dir}/common/combined-update-render-controller.cpp
// Use strdup() in app_get_id(), so need to free memory
if( appId )
{
+ WindowPane defaultWindow = mWindowFrame.front();
#ifdef ECORE_WAYLAND2
- Ecore_Wl2_Window* ecoreWlWindow = AnyCast< Ecore_Wl2_Window* >( mNativeWindow );
+ Ecore_Wl2_Window* ecoreWlWindow = AnyCast< Ecore_Wl2_Window* >( defaultWindow.nativeWindow );
screen_connector_provider_remote_enable( appId, ecore_wl2_window_surface_get( ecoreWlWindow ) );
#else
- Ecore_Wl_Window* ecoreWlWindow = AnyCast< Ecore_Wl_Window* >( mNativeWindow );
+ Ecore_Wl_Window* ecoreWlWindow = AnyCast< Ecore_Wl_Window* >( defaultWindow.nativeWindow );
screen_connector_provider_remote_enable( appId, ecore_wl_window_surface_get( ecoreWlWindow ) );
#endif
free( appId );
--- /dev/null
+#ifndef DALI_INTERNAL_BASE_GRAPHICS_FACTORY_INTERFACE_H
+#define DALI_INTERNAL_BASE_GRAPHICS_FACTORY_INTERFACE_H
+
+/*
+ * Copyright (c) 2018 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/environment-options.h>
+#include <dali/internal/graphics/common/graphics-interface.h>
+
+namespace Dali
+{
+class GraphicsInterface;
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+/**
+ * Factory interface for creating Graphics Factory implementation
+ */
+class GraphicsFactoryInterface
+{
+public:
+ /**
+ * Create a Graphics interface implementation
+ * @return An implementation of the Graphics interface
+ */
+ virtual GraphicsInterface& Create() = 0;
+
+ /**
+ * Destroy the Graphics Factory implementation
+ */
+ virtual void Destroy() = 0;
+
+protected:
+ /**
+ * Virtual protected destructor - no deletion through this interface
+ */
+ virtual ~GraphicsFactoryInterface() {};
+};
+
+} // Adaptor
+
+} // Internal
+
+} // Dali
+
+#endif // DALI_INTERNAL_BASE_GRAPHICS_FACTORY_INTERFACE_H
--- /dev/null
+#ifndef DALI_INTERNAL_BASE_GRAPHICS_INTERFACE_H
+#define DALI_INTERNAL_BASE_GRAPHICS_INTERFACE_H
+
+/*
+ * Copyright (c) 2018 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/environment-options.h>
+#include <dali/integration-api/core-enumerations.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+/**
+ * Factory interface for creating Graphics Factory implementation
+ */
+class GraphicsInterface
+{
+public:
+
+ /**
+ * Constructor
+ */
+ GraphicsInterface()
+: mDepthBufferRequired( Integration::DepthBufferAvailable::FALSE ),
+ mStencilBufferRequired( Integration::StencilBufferAvailable::FALSE )
+ {
+ };
+
+ /**
+ * Initialize the graphics interface
+ * @param[in] environmentOptions The environment options.
+ */
+ virtual void Initialize( EnvironmentOptions* environmentOptions ) = 0;
+
+ /**
+ * Destroy the Graphics Factory implementation
+ */
+ virtual void Destroy() = 0;
+
+ /**
+ * Get whether the depth buffer is required
+ * @return TRUE if the depth buffer is required
+ */
+ Integration::DepthBufferAvailable& GetDepthBufferRequired()
+ {
+ return mDepthBufferRequired;
+ };
+
+ /**
+ * Get whether the stencil buffer is required
+ * @return TRUE if the stencil buffer is required
+ */
+ Integration::StencilBufferAvailable GetStencilBufferRequired()
+ {
+ return mStencilBufferRequired;
+ };
+
+protected:
+ /**
+ * Virtual protected destructor - no deletion through this interface
+ */
+ virtual ~GraphicsInterface() {};
+
+
+protected:
+
+ Integration::DepthBufferAvailable mDepthBufferRequired; ///< Whether the depth buffer is required
+ Integration::StencilBufferAvailable mStencilBufferRequired; ///< Whether the stencil buffer is required
+};
+
+} // Adaptor
+
+} // Internal
+
+} // Dali
+
+#endif // DALI_INTERNAL_BASE_GRAPHICS_INTERFACE_H
+++ /dev/null
-/*
- * Copyright (c) 2017 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 <dali/internal/graphics/common/render-helper.h>
-
-// EXTERNAL INCLUDES
-#include <dali/integration-api/debug.h>
-
-// INTERNAL INCLUDES
-#include <dali/internal/adaptor/common/adaptor-internal-services.h>
-#include <dali/internal/window-system/common/display-connection.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-RenderHelper::RenderHelper( AdaptorInternalServices& adaptorInterfaces )
-: mGLES( adaptorInterfaces.GetGlesInterface() ),
- mEglFactory( &adaptorInterfaces.GetEGLFactoryInterface()),
- mEGL( NULL ),
- mSurfaceReplaced( false ),
- mSurfaceResized( false )
-{
- // set the initial values before render thread starts
- mSurface = adaptorInterfaces.GetRenderSurfaceInterface();
-
- if( mSurface )
- {
- mDisplayConnection = Dali::DisplayConnection::New( mSurface->GetSurfaceType() );
- }
- else
- {
- mDisplayConnection = Dali::DisplayConnection::New();
- }
-}
-
-RenderHelper::~RenderHelper()
-{
- if (mDisplayConnection)
- {
- delete mDisplayConnection;
- mDisplayConnection = NULL;
- }
-
- mEglFactory->Destroy();
-}
-
-void RenderHelper::Start()
-{
- if( mSurface )
- {
- mSurface->StartRender();
- }
-}
-
-void RenderHelper::Stop()
-{
- if( mSurface )
- {
- // Tell surface we have stopped rendering
- mSurface->StopRender();
- }
-}
-
-void RenderHelper::ConsumeEvents()
-{
- mDisplayConnection->ConsumeEvents();
-}
-
-void RenderHelper::InitializeEgl()
-{
- mEGL = mEglFactory->Create();
-
- 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);
-
- // Make it current
- mEGL->MakeContextCurrent();
-}
-
-void RenderHelper::ReplaceSurface( RenderSurface* newSurface )
-{
- if( mSurface )
- {
- mSurface->DestroyEglSurface(*mEGL);
- }
-
- // This is designed for replacing pixmap surfaces, but should work for window as well
- // 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");
-
- mDisplayConnection->InitializeEgl(*mEGL);
-
- newSurface->ReplaceEGLSurface(*mEGL);
-
- // use the new surface from now on
- mSurface = newSurface;
- mSurfaceReplaced = true;
-}
-
-void RenderHelper::ResizeSurface()
-{
- mSurfaceResized = true;
-}
-
-void RenderHelper::ShutdownEgl()
-{
- if( mSurface )
- {
- // give a chance to destroy the OpenGL surface that created externally
- mSurface->DestroyEglSurface( *mEGL );
-
- mSurface = NULL;
- }
-
- // delete the GL context / egl surface
- mEGL->TerminateGles();
-}
-
-bool RenderHelper::PreRender()
-{
- if( mSurface )
- {
- mSurface->PreRender( *mEGL, mGLES, mSurfaceResized );
- }
- mGLES.PreRender();
- return true;
-}
-
-void RenderHelper::PostRender( bool renderToFbo )
-{
- // Inform the gl implementation that rendering has finished before informing the surface
- mGLES.PostRender();
-
- if( renderToFbo )
- {
- mGLES.Flush();
- mGLES.Finish();
- }
- else
- {
- if( mSurface )
- {
- // Inform the surface that rendering this frame has finished.
- mSurface->PostRender( *mEGL, mGLES, mDisplayConnection, mSurfaceReplaced, mSurfaceResized );
- }
- }
- mSurfaceReplaced = false;
- mSurfaceResized = false;
-}
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-} // namespace Dali
+++ /dev/null
-#ifndef DALI_INTERNAL_RENDER_HELPER_H
-#define DALI_INTERNAL_RENDER_HELPER_H
-
-/*
- * Copyright (c) 2017 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.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/integration-api/egl-interface.h>
-#include <dali/integration-api/render-surface.h>
-
-namespace Dali
-{
-
-class RenderSurface;
-class DisplayConnection;
-
-namespace Integration
-{
-class GlAbstraction;
-}
-
-namespace Internal
-{
-namespace Adaptor
-{
-
-class AdaptorInternalServices;
-class EglFactoryInterface;
-
-/**
- * Helper class for EGL, surface, pre & post rendering
- */
-class RenderHelper
-{
-public:
-
- /**
- * Create a RenderHelper.
- * @param[in] adaptorInterfaces base adaptor interface
- */
- RenderHelper( AdaptorInternalServices& adaptorInterfaces );
-
- /**
- * Non-virtual Destructor
- */
- ~RenderHelper();
-
- /////////////////////////////////////////////////////////////////////////////////////////////////
- // Called on the Event Thread
- /////////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Sets up all render related objects to start rendering.
- */
- void Start();
-
- /**
- * Sets up all render related objects to stop rendering.
- */
- void Stop();
-
- /////////////////////////////////////////////////////////////////////////////////////////////////
- // Called on the Rendering Thread
- /////////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Consumes any pending events to avoid memory leaks
- *
- * @note Called from rendering thread
- */
- void ConsumeEvents();
-
- /**
- * Initializes EGL.
- *
- * @note Called from rendering thread
- */
- void InitializeEgl();
-
- /**
- * Replaces the rendering surface
- *
- * Used for replacing pixmaps due to resizing
- * @param newSurface to use
- *
- * @note Called from render thread
- */
- void ReplaceSurface( RenderSurface* newSurface );
-
- /**
- * Resize the rendering surface.
- *
- * @note Called from render thread
- */
- void ResizeSurface();
-
- /**
- * Shuts down EGL.
- *
- * @note Called from render thread
- */
- void ShutdownEgl();
-
- /**
- * Called before core renders the scene
- *
- * @return true if successful and Core::Render should be called.
- *
- * @note Called from render thread
- */
- bool PreRender();
-
- /**
- * Called after core has rendered the scene
- *
- * @note Called from render thread
- *
- * @param[in] renderToFbo Whether to render to a Frame Buffer Object.
- */
- void PostRender( bool renderToFbo );
-
-private:
-
- // Undefined
- RenderHelper( const RenderHelper& RenderHelper );
-
- // Undefined
- RenderHelper& operator=( const RenderHelper& RenderHelper );
-
-private: // Data
-
- Integration::GlAbstraction& mGLES; ///< GL abstraction reference
- EglFactoryInterface* mEglFactory; ///< Factory class to create EGL implementation
- EglInterface* mEGL; ///< Interface to EGL implementation
- RenderSurface* mSurface; ///< Current surface
- Dali::DisplayConnection* mDisplayConnection; ///< Display connection
- bool mSurfaceReplaced; ///< True when new surface has been initialized.
- bool mSurfaceResized; ///< True when the surface is resized.
-};
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-} // namespace Dali
-
-#endif // DALI_INTERNAL_RENDER_HELPER_H
-# module: graphics, backend: common
-adaptor_graphics_common_src_files=\
- ${adaptor_graphics_dir}/common/render-helper.cpp
-
# module: graphics, backend: gles20
adaptor_graphics_gles20_src_files=\
${adaptor_graphics_dir}/gles20/egl-debug.cpp \
- ${adaptor_graphics_dir}/gles20/egl-factory.cpp \
${adaptor_graphics_dir}/gles20/egl-implementation.cpp \
${adaptor_graphics_dir}/gles20/egl-sync-implementation.cpp \
${adaptor_graphics_dir}/gles20/gl-extensions.cpp \
- ${adaptor_graphics_dir}/gles20/gl-proxy-implementation.cpp
+ ${adaptor_graphics_dir}/gles20/gl-proxy-implementation.cpp \
+ ${adaptor_graphics_dir}/gles20/egl-graphics-factory.cpp \
+ ${adaptor_graphics_dir}/gles20/egl-graphics.cpp
# module: graphics, backend: tizen
adaptor_graphics_tizen_src_files=\
-#ifndef __DALI_INTERNAL_BASE_EGL_FACTORY_INTERFACE_H__
-#define __DALI_INTERNAL_BASE_EGL_FACTORY_INTERFACE_H__
+#ifndef DALI_INTERNAL_BASE_EGL_FACTORY_INTERFACE_H
+#define DALI_INTERNAL_BASE_EGL_FACTORY_INTERFACE_H
/*
* Copyright (c) 2014 Samsung Electronics Co., Ltd.
} // Internal
} // Dali
-#endif // __DALI_INTERNAL_BASE_EGL_FACTORY_INTERFACE_H__
+#endif // DALI_INTERNAL_BASE_EGL_FACTORY_INTERFACE_H
+++ /dev/null
-/*
- * Copyright (c) 2017 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 <dali/internal/graphics/gles20/egl-factory.h>
-
-// INTERNAL INCLUDES
-#include <dali/internal/graphics/gles20/egl-implementation.h>
-#include <dali/internal/graphics/common/egl-image-extensions.h>
-#include <dali/internal/graphics/gles20/egl-sync-implementation.h>
-
-namespace Dali
-{
-namespace Internal
-{
-namespace Adaptor
-{
-
-EglFactory::EglFactory( int multiSamplingLevel,
- Integration::DepthBufferAvailable depthBufferRequired,
- Integration::StencilBufferAvailable stencilBufferRequired )
-: mEglImplementation(NULL),
- mEglImageExtensions(NULL),
- mEglSync(new EglSyncImplementation), // Created early, as needed by Core constructor
- mMultiSamplingLevel( multiSamplingLevel ),
- mDepthBufferRequired( depthBufferRequired ),
- mStencilBufferRequired( stencilBufferRequired )
-{
-}
-
-EglFactory::~EglFactory()
-{
- // Ensure the EGL implementation is destroyed
- delete mEglImageExtensions;
- delete mEglImplementation;
- delete mEglSync;
-}
-
-EglInterface* EglFactory::Create()
-{
- // Created by RenderThread (After Core construction)
- mEglImplementation = new EglImplementation( mMultiSamplingLevel, mDepthBufferRequired, mStencilBufferRequired );
- mEglImageExtensions = new EglImageExtensions( mEglImplementation );
-
- mEglSync->Initialize(mEglImplementation); // The sync impl needs the EglDisplay
- return mEglImplementation;
-}
-
-void EglFactory::Destroy()
-{
- delete mEglImageExtensions;
- mEglImageExtensions = NULL;
- delete mEglImplementation;
- mEglImplementation = NULL;
-}
-
-EglInterface* EglFactory::GetImplementation()
-{
- return mEglImplementation;
-}
-
-EglImageExtensions* EglFactory::GetImageExtensions()
-{
- return mEglImageExtensions;
-}
-
-EglSyncImplementation* EglFactory::GetSyncImplementation()
-{
- return mEglSync;
-}
-
-} // Adaptor
-} // Internal
-} // Dali
+++ /dev/null
-#ifndef DALI_INTERNAL_ADAPTOR_EGL_FACTORY_IMPL_H
-#define DALI_INTERNAL_ADAPTOR_EGL_FACTORY_IMPL_H
-
-/*
- * Copyright (c) 2017 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 <dali/integration-api/core-enumerations.h>
-
-// INTERNAL INCLUDES
-#include <dali/internal/graphics/gles20/egl-factory-interface.h>
-
-namespace Dali
-{
-namespace Internal
-{
-namespace Adaptor
-{
-class EglImplementation;
-class EglImageExtensions;
-class EglSyncImplementation;
-
-class EglFactory : public EglFactoryInterface
-{
-public:
-
- /**
- * Constructor
- * @param[in] multiSamplingLevel The Multi-sampling level required
- * @param[in] depthBufferRequired Whether the depth buffer is required
- * @param[in] stencilBufferRequired Whether the stencil buffer is required
- */
- EglFactory( int multiSamplingLevel,
- Integration::DepthBufferAvailable depthBufferRequired,
- Integration::StencilBufferAvailable stencilBufferRequired );
-
- /**
- * Destructor
- */
- virtual ~EglFactory();
-
- /**
- * Create an EGL Implementation
- * @return[in] An implementation
- */
- EglInterface* Create();
-
- /**
- * Destroy the EGL Implementation
- */
- void Destroy();
-
- /**
- * Get an implementation if one has been created.
- * @return An implementation, or NULL if one has not yet been created.
- */
- EglInterface* GetImplementation();
-
- /**
- * Get the image extension
- */
- EglImageExtensions* GetImageExtensions();
-
- /**
- * Get the fence sync implementation
- * @return An implementation of fence sync
- */
- EglSyncImplementation* GetSyncImplementation();
-
-private:
- /** Undefined */
- EglFactory(const EglFactory& rhs);
- EglFactory& operator=(const EglFactory& rhs);
-
-private:
- EglImplementation* mEglImplementation;
- EglImageExtensions* mEglImageExtensions;
- EglSyncImplementation* mEglSync;
-
- int mMultiSamplingLevel;
- Integration::DepthBufferAvailable mDepthBufferRequired;
- Integration::StencilBufferAvailable mStencilBufferRequired;
-};
-
-} // namespace Adaptor
-} // namespace Internal
-} // namespace Dali
-
-#endif // DALI_INTERNAL_ADAPTOR_EGL_FACTORY_IMPL_H
--- /dev/null
+/*
+ * Copyright (c) 2018 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 <dali/internal/graphics/gles20/egl-graphics-factory.h>
+#include <dali/internal/graphics/gles20/egl-graphics.h>
+
+// INTERNAL INCLUDES
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+
+GraphicsFactory::GraphicsFactory()
+{
+}
+
+GraphicsFactory::~GraphicsFactory()
+{
+ /* Deleted by Adaptor destructor */
+}
+
+GraphicsInterface& GraphicsFactory::Create()
+{
+ GraphicsInterface* eglGraphicsInterface = new EglGraphics;
+ return *eglGraphicsInterface;
+}
+
+void GraphicsFactory::Destroy()
+{
+ /* Deleted by EglGraphics */
+}
+
+} // Adaptor
+} // Internal
+} // Dali
--- /dev/null
+#ifndef DALI_INTERNAL_GRAPHICS_FACTORY_H
+#define DALI_INTERNAL_GRAPHICS_FACTORY_H
+
+/*
+ * Copyright (c) 2018 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 <dali/internal/graphics/common/graphics-factory-interface.h>
+
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+class GraphicsFactory : public GraphicsFactoryInterface
+{
+public:
+
+ /**
+ * Constructor
+ */
+ GraphicsFactory();
+
+ /**
+ * Destructor
+ */
+ virtual ~GraphicsFactory();
+
+ /**
+ * @copydoc Dali::Internal::Adaptor::GraphicsFactoryInterface::Create()
+ */
+ GraphicsInterface& Create() override;
+
+ /**
+ * @copydoc Dali::Internal::Adaptor::GraphicsFactoryInterface::Destroy()
+ */
+ void Destroy();
+};
+
+} // Adaptor
+
+} // Internal
+
+} // Dali
+
+#endif // DALI_INTERNAL_GRAPHICS_FACTORY_H
--- /dev/null
+/*
+ * Copyright (c) 2018 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 <dali/internal/graphics/gles20/egl-graphics.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/window-system/common/display-utils.h> // For Utils::MakeUnique
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+
+EglGraphics::EglGraphics( )
+: mMultiSamplingLevel( 0 )
+{
+}
+
+EglGraphics::~EglGraphics()
+{
+}
+
+
+void EglGraphics::Initialize( EnvironmentOptions* environmentOptions )
+{
+ if( environmentOptions->GetGlesCallTime() > 0 )
+ {
+ mGLES = Utils::MakeUnique< GlProxyImplementation >( *environmentOptions );
+ }
+ else
+ {
+ mGLES.reset ( new GlImplementation() );
+ }
+
+ mDepthBufferRequired = static_cast< Integration::DepthBufferAvailable >( environmentOptions->DepthBufferRequired() );
+ mStencilBufferRequired = static_cast< Integration::StencilBufferAvailable >( environmentOptions->StencilBufferRequired() );
+
+ mMultiSamplingLevel = environmentOptions->GetMultiSamplingLevel();
+
+ mEglSync = Utils::MakeUnique< EglSyncImplementation >();
+}
+
+EglInterface* EglGraphics::Create()
+{
+ mEglImplementation = Utils::MakeUnique< EglImplementation >( mMultiSamplingLevel, mDepthBufferRequired, mStencilBufferRequired );
+ mEglImageExtensions = Utils::MakeUnique< EglImageExtensions >( mEglImplementation.get() );
+
+ mEglSync->Initialize( mEglImplementation.get() ); // The sync impl needs the EglDisplay
+
+ return mEglImplementation.get();
+}
+
+void EglGraphics::Destroy()
+{
+}
+
+//Dali::Integration::GlAbstraction& EglGraphics::GetGlesInterface()
+GlImplementation& EglGraphics::GetGlesInterface()
+{
+ return *mGLES;
+}
+
+Integration::GlAbstraction& EglGraphics::GetGlAbstraction() const
+{
+ DALI_ASSERT_DEBUG( mGLES && "GLImplementation not created" );
+ return *mGLES;
+}
+
+EglImplementation& EglGraphics::GetEglImplementation() const
+{
+ DALI_ASSERT_DEBUG( mEglImplementation && "EGLImplementation not created" );
+ return *mEglImplementation;
+}
+
+EglInterface& EglGraphics::GetEglInterface() const
+{
+ DALI_ASSERT_DEBUG( mEglImplementation && "EGLImplementation not created" );
+ EglInterface* eglInterface = mEglImplementation.get();
+ return *eglInterface;
+}
+
+EglSyncImplementation& EglGraphics::GetSyncImplementation()
+{
+ DALI_ASSERT_DEBUG( mEglSync && "EglSyncImplementation not created" );
+ return *mEglSync;
+}
+
+EglImageExtensions* EglGraphics::GetImageExtensions()
+{
+ DALI_ASSERT_DEBUG( mEglImageExtensions && "EglImageExtensions not created" );
+ return mEglImageExtensions.get();
+}
+
+} // Adaptor
+} // Internal
+} // Dali
--- /dev/null
+#ifndef DALI_INTERNAL_BASE_GRAPHICS_IMPLEMENTATION_H
+#define DALI_INTERNAL_BASE_GRAPHICS_IMPLEMENTATION_H
+
+/*
+ * Copyright (c) 2018 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
+
+// INTERNAL INCLUDES
+#include <dali/internal/graphics/common/graphics-interface.h>
+#include <dali/internal/graphics/gles20/gl-proxy-implementation.h>
+#include <dali/internal/graphics/gles20/gl-implementation.h>
+#include <dali/integration-api/egl-interface.h>
+
+#include <dali/internal/graphics/gles20/egl-implementation.h>
+#include <dali/internal/graphics/common/egl-image-extensions.h>
+#include <dali/internal/graphics/gles20/egl-sync-implementation.h>
+
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+class EglGraphics : public GraphicsInterface
+{
+public:
+
+ /**
+ * Constructor
+ */
+ EglGraphics();
+
+ /**
+ * Destructor
+ */
+ virtual ~EglGraphics();
+
+ /**
+ * @copydoc Dali::Internal::Adaptor::GraphicsInterface::Initialize()
+ */
+ void Initialize( EnvironmentOptions* environmentOptions ) override;
+
+ /**
+ * Creates the graphics interface for EGL
+ * @return The graphics interface for EGL
+ */
+ EglInterface* Create();
+
+ /**
+ * Gets the GL abstraction
+ * @return The GL abstraction
+ */
+ Integration::GlAbstraction& GetGlAbstraction() const;
+
+ /**
+ * Gets the implementation of EGL
+ * @return The implementation of EGL
+ */
+ EglImplementation& GetEglImplementation() const;
+
+ /**
+ * Gets the graphics interface for EGL
+ * @return The graphics interface for EGL
+ */
+ EglInterface& GetEglInterface() const;
+
+ /**
+ * @copydoc Dali::Integration::GlAbstraction& GetGlesInterface()
+ */
+ GlImplementation& GetGlesInterface();
+
+ /**
+ * Gets the implementation of GlSyncAbstraction for EGL.
+ * @return The implementation of GlSyncAbstraction for EGL.
+ */
+ EglSyncImplementation& GetSyncImplementation();
+
+ /**
+ * @copydoc Dali::Internal::Adaptor::GraphicsInterface::GetDepthBufferRequired()
+ */
+ Integration::DepthBufferAvailable& GetDepthBufferRequired();
+
+ /**
+ * @copydoc Dali::Internal::Adaptor::GraphicsInterface::GetStencilBufferRequired()
+ */
+ Integration::StencilBufferAvailable GetStencilBufferRequired();
+
+ /**
+ * Gets the EGL image extension
+ * @return The EGL image extension
+ */
+ EglImageExtensions* GetImageExtensions();
+
+ /**
+ * @copydoc Dali::Internal::Adaptor::GraphicsInterface::Destroy()
+ */
+ void Destroy() override;
+
+private:
+ // Eliminate copy and assigned operations
+ EglGraphics(const EglGraphics& rhs) = delete;
+ EglGraphics& operator=(const EglGraphics& rhs) = delete;
+
+
+private:
+ std::unique_ptr< GlImplementation > mGLES; ///< GL implementation
+ std::unique_ptr< EglImplementation > mEglImplementation; ///< EGL implementation
+ std::unique_ptr< EglImageExtensions > mEglImageExtensions; ///< EGL image extension
+ std::unique_ptr< EglSyncImplementation > mEglSync; ///< GlSyncAbstraction implementation for EGL
+
+ int mMultiSamplingLevel; ///< The multiple sampling level
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // __DALI_INTERNAL_BASE_GRAPHICS_IMPLEMENTATION_H__
// INTERNAL HEADERS
#include <dali/internal/graphics/gles20/gl-implementation.h>
+#include <dali/internal/graphics/gles20/egl-graphics.h>
namespace Dali
{
{
NativeBitmapBuffer::NativeBitmapBuffer( Adaptor* adaptor, unsigned int width, unsigned int height, Pixel::Format pFormat )
-: mWidth(width),
+: mGlAbstraction( nullptr),
+ mWidth(width),
mHeight(height),
mPixelFormat(pFormat),
mLastReadBuffer(NULL)
{
DALI_ASSERT_ALWAYS( adaptor );
mBuffer = new Integration::LocklessBuffer( width * height * Pixel::GetBytesPerPixel(pFormat) );
- mGlAbstraction = &(adaptor->GetGlAbstraction());
+
+ GraphicsInterface* graphics = &(adaptor->GetGraphicsInterface());
+ auto eglGraphics = static_cast<EglGraphics *>(graphics);
+ mGlAbstraction = &(eglGraphics->GetGlAbstraction());
}
NativeBitmapBuffer::~NativeBitmapBuffer()
// INTERNAL HEADERS
#include <dali/internal/adaptor/common/adaptor-impl.h>
+#include <dali/internal/graphics/common/graphics-interface.h>
namespace Dali
{
// INTERNAL INCLUDES
#include <dali/internal/graphics/common/egl-image-extensions.h>
-#include <dali/internal/graphics/gles20/egl-factory.h>
+#include <dali/internal/graphics/gles20/egl-graphics.h>
#include <dali/internal/adaptor/common/adaptor-impl.h>
#include <dali/integration-api/render-surface.h>
// Allow this to be encoded and saved:
#include <dali/devel-api/adaptor-framework/bitmap-saver.h>
+
namespace Dali
{
mSetSource( false )
{
DALI_ASSERT_ALWAYS( Adaptor::IsAvailable() );
- EglFactory& eglFactory = Adaptor::GetImplementation( Adaptor::Get() ).GetEGLFactory();
- mEglImageExtensions = eglFactory.GetImageExtensions();
+
+ GraphicsInterface* graphics = &( Adaptor::GetImplementation( Adaptor::Get() ).GetGraphicsInterface() );
+ auto eglGraphics = static_cast<EglGraphics *>(graphics);
+
+ mEglImageExtensions = eglGraphics->GetImageExtensions();
+
DALI_ASSERT_DEBUG( mEglImageExtensions );
mTbmSurface = GetSurfaceFromAny( nativeImageSource );
// INTERNAL INCLUDES
#include <dali/internal/graphics/common/egl-image-extensions.h>
-#include <dali/internal/graphics/gles20/egl-factory.h>
+#include <dali/internal/graphics/gles20/egl-graphics.h>
#include <dali/internal/adaptor/common/adaptor-impl.h>
namespace Dali
mBlendingRequired( false )
{
DALI_ASSERT_ALWAYS( Adaptor::IsAvailable() );
- EglFactory& eglFactory = Adaptor::GetImplementation( Adaptor::Get() ).GetEGLFactory();
- mEglImageExtensions = eglFactory.GetImageExtensions();
+
+ GraphicsInterface* graphics = &( Adaptor::GetImplementation( Adaptor::Get() ).GetGraphicsInterface() );
+ auto eglGraphics = static_cast<EglGraphics *>(graphics);
+
+ mEglImageExtensions = eglGraphics->GetImageExtensions();
+
DALI_ASSERT_DEBUG( mEglImageExtensions );
mTbmQueue = GetSurfaceFromAny( nativeImageSourceQueue );
// INTERNAL INCLUDES
#include <dali/internal/graphics/common/egl-image-extensions.h>
-#include <dali/internal/graphics/gles20/egl-factory.h>
+#include <dali/internal/graphics/gles20/egl-graphics.h>
#include <dali/internal/adaptor/common/adaptor-impl.h>
#include <dali/devel-api/adaptor-framework/bitmap-saver.h>
#include <dali/integration-api/render-surface.h>
+
namespace Dali
{
mEglImageExtensions( NULL )
{
DALI_ASSERT_ALWAYS( Adaptor::IsAvailable() );
- EglFactory& eglFactory = Adaptor::GetImplementation( Adaptor::Get() ).GetEGLFactory();
- mEglImageExtensions = eglFactory.GetImageExtensions();
+
+ GraphicsInterface* graphics = &( Adaptor::GetImplementation( Adaptor::Get() ).GetGraphicsInterface() );
+ auto eglGraphics = static_cast<EglGraphics *>(graphics);
+
+ mEglImageExtensions = eglGraphics->GetImageExtensions();
+
DALI_ASSERT_DEBUG( mEglImageExtensions );
// assign the pixmap
XImageJanitor xImageJanitor( XGetImage( displayConnection,
mPixmap,
0, 0, // x,y of subregion to extract.
- width, height, // of suregion to extract.
+ width, height, // of subregion to extract.
0xFFFFFFFF,
ZPixmap ) );
XImage* const pXImage = xImageJanitor.mXImage;
#include <Ecore_X.h>
// INTERNAL INCLUDES
+#include <dali/internal/graphics/common/graphics-interface.h>
+
#include <dali/public-api/adaptor-framework/native-image-source.h>
#include <dali/internal/imaging/common/native-image-source-impl.h>
*/
#include <dali/public-api/signals/callback.h>
+// INTERNAL INCLUDES
+#include <dali/internal/window-system/common/display-connection.h>
+
namespace Dali
{
private:
// Undefined copy constructor.
- ThreadController( const ThreadController& );
+ ThreadController( const ThreadController& ) = delete;
// Undefined assignment operator.
- ThreadController& operator=( const ThreadController& );
+ ThreadController& operator=( const ThreadController& ) = delete;
private:
#include <dali/public-api/object/base-object.h>
#include <dali/internal/graphics/gles20/egl-implementation.h>
-#include <memory>
namespace Dali
{
virtual void ConsumeEvents() = 0;
/**
- * @copydoc Dali::DisplayConnection::InitializeEgl
+ * @copydoc Dali::DisplayConnection::InitializeGraphics
*/
- virtual bool InitializeEgl(EglInterface& egl) = 0;
+ virtual bool InitializeGraphics() = 0;
+ /**
+ * Sets the render surface type
+ * @param[in] type The render surface type
+ */
virtual void SetSurfaceType( RenderSurface::Type type ) = 0;
+ /**
+ * Sets the graphics interface
+ * @param[in] graphics The graphics interface
+ */
+ virtual void SetGraphicsInterface( GraphicsInterface& graphics ) = 0;
+
public:
/**
// CLASS HEADER
#include <dali/internal/window-system/common/display-connection.h>
#include <dali/internal/window-system/common/display-connection-factory.h>
-// EXTERNAL INCLUDES
// INTERNAL INCLUDES
#include <dali/internal/window-system/common/display-connection-impl.h>
#include <dali/internal/window-system/common/display-connection-factory.h>
-#include <dali/integration-api/egl-interface.h>
+
namespace Dali
{
-DisplayConnection* DisplayConnection::New()
+DisplayConnection* DisplayConnection::New( Dali::Internal::Adaptor::GraphicsInterface& graphics )
{
auto factory = Dali::Internal::Adaptor::GetDisplayConnectionFactory();
auto displayConnection = factory->CreateDisplayConnection();
Internal::Adaptor::DisplayConnection* internal( displayConnection.release() );
+ internal->SetGraphicsInterface( graphics );
return new DisplayConnection(internal);
}
-DisplayConnection* DisplayConnection::New( RenderSurface::Type type )
+DisplayConnection* DisplayConnection::New( Dali::Internal::Adaptor::GraphicsInterface& graphics, RenderSurface::Type type )
{
auto factory = Dali::Internal::Adaptor::GetDisplayConnectionFactory();
auto displayConnection = factory->CreateDisplayConnection();
Internal::Adaptor::DisplayConnection* internal( displayConnection.release() );
+ internal->SetGraphicsInterface( graphics );
internal->SetSurfaceType( type );
return new DisplayConnection(internal);
mImpl->ConsumeEvents();
}
-bool DisplayConnection::InitializeEgl(EglInterface& egl)
+bool DisplayConnection::Initialize()
{
- return mImpl->InitializeEgl(egl);
+ return mImpl->InitializeGraphics();
}
}
// INTERNAL INCLUDES
#include <dali/integration-api/render-surface.h>
+#include <dali/internal/graphics/common/graphics-interface.h>
-#include <memory>
namespace Dali
{
-
-class EglInterface;
-
namespace Internal
{
namespace Adaptor
/**
* @brief Create an initialized DisplayConnection.
*
+ * @param[in] graphics The abstracted graphics interface
* @return A handle to a newly allocated DisplayConnection resource.
*/
- static DisplayConnection* New();
+ static DisplayConnection* New( Dali::Internal::Adaptor::GraphicsInterface& graphics );
/**
* @brief Create an initialized DisplayConnection.
* Native surface will need this instead of DisplayConnection::New()
*
+ * @param[in] graphics The abstracted graphics interface
* @param[in] type Render surface type
* @return A handle to a newly allocated DisplayConnection resource.
*/
- static DisplayConnection* New( RenderSurface::Type type );
+ static DisplayConnection* New( Dali::Internal::Adaptor::GraphicsInterface& graphics, RenderSurface::Type type );
/**
* @brief Create a DisplayConnection handle; this can be initialised with DisplayConnection::New().
void ConsumeEvents();
/**
- * @brief Initialize EGL display
- *
- * @param egl implementation to use for the creation
+ * @brief Initialize the display
*/
- bool InitializeEgl(EglInterface& egl);
+ bool Initialize();
public:
#include <dali/internal/window-system/common/window-base.h>
#include <dali/internal/window-system/common/window-factory.h>
#include <dali/internal/window-system/common/window-system.h>
+#include <dali/internal/graphics/gles20/egl-graphics.h>
+
namespace Dali
{
void WindowRenderSurface::Initialize( Any surface )
{
- // if width or height are zero, go full screen.
- if ( (mPositionSize.width == 0) || (mPositionSize.height == 0) )
- {
- // Default window size == screen size
- mPositionSize.x = 0;
- mPositionSize.y = 0;
+ // If width or height are zero, go full screen.
+ if ( (mPositionSize.width == 0) || (mPositionSize.height == 0) )
+ {
+ // Default window size == screen size
+ mPositionSize.x = 0;
+ mPositionSize.y = 0;
- WindowSystem::GetScreenSize( mPositionSize.width, mPositionSize.height );
- }
+ WindowSystem::GetScreenSize( mPositionSize.width, mPositionSize.height );
+ }
// Create a window base
auto windowFactory = Dali::Internal::Adaptor::GetWindowFactory();
mWindowBase->GetDpi( dpiHorizontal, dpiVertical );
}
-void WindowRenderSurface::InitializeEgl( EglInterface& eglIf )
+void WindowRenderSurface::InitializeGraphics( GraphicsInterface& graphics, Dali::DisplayConnection& displayConnection )
{
- DALI_LOG_TRACE_METHOD( gWindowRenderSurfaceLogFilter );
+ mGraphics = &graphics;
+
+ auto eglGraphics = static_cast<EglGraphics *>(mGraphics);
+
+ EglInterface* mEGL = eglGraphics->Create();
- Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( eglIf );
+ // Initialize EGL & OpenGL
+ displayConnection.Initialize();
+ Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>(*mEGL);
eglImpl.ChooseConfig(true, mColorDepth);
+
+ // Create the OpenGL context
+ mEGL->CreateContext();
+
+ // Create the OpenGL surface
+ CreateSurface();
+
+ // Make it current
+ mEGL->MakeContextCurrent();
}
-void WindowRenderSurface::CreateEglSurface( EglInterface& eglIf )
+void WindowRenderSurface::CreateSurface()
{
DALI_LOG_TRACE_METHOD( gWindowRenderSurfaceLogFilter );
height = mPositionSize.width;
}
- // create the EGL window
+ // Create the EGL window
EGLNativeWindowType window = mWindowBase->CreateEglWindow( width, height );
- Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( eglIf );
+ auto eglGraphics = static_cast<EglGraphics *>(mGraphics);
+
+ Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
eglImpl.CreateSurfaceWindow( window, mColorDepth );
// Check rotation capability
mRotationSupported = mWindowBase->IsEglWindowRotationSupported();
- DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::CreateEglSurface: w = %d h = %d angle = %d screen rotation = %d\n", mPositionSize.width, mPositionSize.height, mRotationAngle, mScreenRotationAngle );
+ DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::CreateSurface: w = %d h = %d angle = %d screen rotation = %d\n", mPositionSize.width, mPositionSize.height, mRotationAngle, mScreenRotationAngle );
}
-void WindowRenderSurface::DestroyEglSurface( EglInterface& eglIf )
+void WindowRenderSurface::DestroySurface()
{
DALI_LOG_TRACE_METHOD( gWindowRenderSurfaceLogFilter );
- Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( eglIf );
+ auto eglGraphics = static_cast<EglGraphics *>(mGraphics);
+
+ Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
eglImpl.DestroySurface();
mWindowBase->DestroyEglWindow();
}
-bool WindowRenderSurface::ReplaceEGLSurface( EglInterface& egl )
+bool WindowRenderSurface::ReplaceGraphicsSurface()
{
DALI_LOG_TRACE_METHOD( gWindowRenderSurfaceLogFilter );
height = mPositionSize.width;
}
- // create the EGL window
+ // Create the EGL window
EGLNativeWindowType window = mWindowBase->CreateEglWindow( width, height );
// Set screen rotation
mScreenRotationFinished = false;
- Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
+ auto eglGraphics = static_cast<EglGraphics *>(mGraphics);
+
+ Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
return eglImpl.ReplaceSurfaceWindow( window );
}
bool needToMove = false;
bool needToResize = false;
- // check moving
+ // Check moving
if( (fabs(positionSize.x - mPositionSize.x) > MINIMUM_DIMENSION_CHANGE) ||
(fabs(positionSize.y - mPositionSize.y) > MINIMUM_DIMENSION_CHANGE) )
{
needToMove = true;
}
- // check resizing
+ // Check resizing
if( (fabs(positionSize.width - mPositionSize.width) > MINIMUM_DIMENSION_CHANGE) ||
(fabs(positionSize.height - mPositionSize.height) > MINIMUM_DIMENSION_CHANGE) )
{
{
}
-bool WindowRenderSurface::PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, bool resizingSurface )
+bool WindowRenderSurface::PreRender( bool resizingSurface )
{
if( resizingSurface )
{
}
}
+ auto eglGraphics = static_cast<EglGraphics *>(mGraphics);
+ auto mGLES = eglGraphics->GetGlesInterface();
+ mGLES.PreRender();
+
return true;
}
-void WindowRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, Dali::DisplayConnection* displayConnection, bool replacingSurface, bool resizingSurface )
+void WindowRenderSurface::PostRender( bool renderToFbo, bool replacingSurface, bool resizingSurface )
{
- if( resizingSurface )
+ // Inform the gl implementation that rendering has finished before informing the surface
+ auto eglGraphics = static_cast<EglGraphics *>(mGraphics);
+ auto mGLES = eglGraphics->GetGlesInterface();
+ mGLES.PostRender();
+
+ if( renderToFbo )
{
- if( !mRotationFinished )
+ mGLES.Flush();
+ mGLES.Finish();
+ }
+ else
+ {
+ if( resizingSurface )
{
- DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::PostRender: Trigger rotation event\n" );
+ if( !mRotationFinished )
+ {
+ DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::PostRender: Trigger rotation event\n" );
- mRotationTrigger->Trigger();
+ mRotationTrigger->Trigger();
- if( mThreadSynchronization )
- {
- // Wait until the event-thread complete the rotation event processing
- mThreadSynchronization->PostRenderWaitForCompletion();
+ if( mThreadSynchronization )
+ {
+ // Wait until the event-thread complete the rotation event processing
+ mThreadSynchronization->PostRenderWaitForCompletion();
+ }
}
}
}
- Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
+ Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
eglImpl.SwapBuffers();
if( mRenderNotification )
// INTERNAL INCLUDES
#include <dali/integration-api/render-surface.h>
#include <dali/integration-api/egl-interface.h>
+#include <dali/internal/graphics/common/graphics-interface.h>
// EXTERNAL INCLUDES
#include <dali/public-api/signals/connection-tracker.h>
#include <dali/public-api/signals/dali-signal.h>
-#include <memory>
+
namespace Dali
{
virtual PositionSize GetPositionSize() const override;
/**
- * @copydoc Dali::RenderSurface::GetDpi()
*/
virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) override;
/**
- * @copydoc Dali::RenderSurface::InitializeEgl()
+ * @copydoc Dali::RenderSurface::InitializeGraphics()
*/
- virtual void InitializeEgl( EglInterface& egl ) override;
+ virtual void InitializeGraphics( GraphicsInterface& graphics, Dali::DisplayConnection& displayConnection ) override;
/**
- * @copydoc Dali::RenderSurface::CreateEglSurface()
+ * @copydoc Dali::RenderSurface::CreateSurface()
*/
- virtual void CreateEglSurface( EglInterface& egl ) override;
+ virtual void CreateSurface() override;
/**
- * @copydoc Dali::RenderSurface::DestroyEglSurface()
+ * @copydoc Dali::RenderSurface::DestroySurface()
*/
- virtual void DestroyEglSurface( EglInterface& egl ) override;
+ virtual void DestroySurface() override;
/**
- * @copydoc Dali::RenderSurface::ReplaceEGLSurface()
+ * @copydoc Dali::RenderSurface::ReplaceGraphicsSurface()
*/
- virtual bool ReplaceEGLSurface( EglInterface& egl ) override;
+ virtual bool ReplaceGraphicsSurface() override;
/**
* @copydoc Dali::RenderSurface::MoveResize()
/**
* @copydoc Dali::RenderSurface::PreRender()
*/
- virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, bool resizingSurface ) override;
+ virtual bool PreRender( bool resizingSurface ) override;
/**
* @copydoc Dali::RenderSurface::PostRender()
*/
- virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, Dali::DisplayConnection* displayConnection, bool replacingSurface, bool resizingSurface ) override;
+ virtual void PostRender( bool renderToFbo, bool replacingSurface, bool resizingSurface );
/**
* @copydoc Dali::RenderSurface::StopRender()
ThreadSynchronizationInterface* mThreadSynchronization;
TriggerEventInterface* mRenderNotification; ///< Render notification trigger
TriggerEventInterface* mRotationTrigger;
+ GraphicsInterface* mGraphics; ///< Graphics interface
ColorDepth mColorDepth; ///< Color depth of surface (32 bit or 24 bit)
OutputSignalType mOutputTransformedSignal;
int mRotationAngle;
// CLASS HEADER
#include <dali/internal/window-system/tizen-wayland/display-connection-impl-ecore-wl.h>
+#include <dali/internal/graphics/gles20/egl-graphics.h>
// EXTERNAL_HEADERS
#include <dali/integration-api/debug.h>
DisplayConnectionEcoreWl::DisplayConnectionEcoreWl()
: mDisplay( NULL ),
- mSurfaceType( RenderSurface::WINDOW_RENDER_SURFACE )
+ mSurfaceType( RenderSurface::WINDOW_RENDER_SURFACE ),
+ mGraphics( nullptr )
{
}
{
}
-bool DisplayConnectionEcoreWl::InitializeEgl(EglInterface& egl)
+bool DisplayConnectionEcoreWl::InitializeGraphics()
{
- EglImplementation& eglImpl = static_cast<EglImplementation&>(egl);
+ auto eglGraphics = static_cast<EglGraphics *>(mGraphics);
+ EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
if( !eglImpl.InitializeGles( mDisplay ) )
{
}
}
+void DisplayConnectionEcoreWl::SetGraphicsInterface( GraphicsInterface& graphics )
+{
+ mGraphics = &graphics;
+}
+
EGLNativeDisplayType DisplayConnectionEcoreWl::GetNativeDisplay()
{
return EGLNativeDisplayType();
void ConsumeEvents();
/**
- * @copydoc Dali::DisplayConnection::InitializeEgl
+ * @copydoc Dali::DisplayConnection::InitializeGraphics
*/
- bool InitializeEgl(EglInterface& egl);
+ bool InitializeGraphics();
/**
- * @brief Sets surface type
+ * @brief Sets the surface type
+ * @param[in] type The surface type
*/
void SetSurfaceType( RenderSurface::Type type );
+ /**
+ * @brief Sets the graphics interface
+ * @param[in] graphics The graphics interface
+ */
+ void SetGraphicsInterface( GraphicsInterface& graphics );
+
public:
/**
private:
EGLNativeDisplayType mDisplay; ///< Wayland-display for rendering
- RenderSurface::Type mSurfaceType;
+ RenderSurface::Type mSurfaceType; ///< The surface type
+ GraphicsInterface* mGraphics; ///< The graphics interface
};
} // namespace Adaptor
// INTERNAL INCLUDES
#include <dali/internal/system/common/trigger-event.h>
#include <dali/internal/graphics/gles20/egl-implementation.h>
+#include <dali/internal/graphics/gles20/egl-graphics.h>
#include <dali/internal/window-system/common/display-connection.h>
#include <dali/internal/window-system/common/window-system.h>
#include <dali/integration-api/thread-synchronization-interface.h>
dpiVertical = int( yres + 0.5f );
}
-void NativeRenderSurfaceEcoreWl::InitializeEgl( EglInterface& egl )
+void NativeRenderSurfaceEcoreWl::InitializeGraphics( Internal::Adaptor::GraphicsInterface& graphics, DisplayConnection& displayConnection )
{
DALI_LOG_TRACE_METHOD( gNativeSurfaceLogFilter );
unsetenv( "EGL_PLATFORM" );
- Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
+ mGraphics = &graphics;
- eglImpl.ChooseConfig( true, mColorDepth );
+ auto eglGraphics = static_cast<Internal::Adaptor::EglGraphics *>(mGraphics);
+
+ EglInterface* mEGL = eglGraphics->Create();
+
+ // Initialize EGL & OpenGL
+ displayConnection.Initialize();
+
+ Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>(*mEGL);
+ eglImpl.ChooseConfig(true, mColorDepth);
+
+ // Create the OpenGL context
+ mEGL->CreateContext();
+
+ // Create the OpenGL surface
+ CreateSurface();
+
+ // Make it current
+ mEGL->MakeContextCurrent();
}
-void NativeRenderSurfaceEcoreWl::CreateEglSurface( EglInterface& egl )
+void NativeRenderSurfaceEcoreWl::CreateSurface()
{
DALI_LOG_TRACE_METHOD( gNativeSurfaceLogFilter );
- Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
+ auto eglGraphics = static_cast<Internal::Adaptor::EglGraphics *>(mGraphics);
+ Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
eglImpl.CreateSurfaceWindow( reinterpret_cast< EGLNativeWindowType >( mTbmQueue ), mColorDepth );
}
-void NativeRenderSurfaceEcoreWl::DestroyEglSurface( EglInterface& egl )
+void NativeRenderSurfaceEcoreWl::DestroySurface()
{
DALI_LOG_TRACE_METHOD( gNativeSurfaceLogFilter );
- Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
+ auto eglGraphics = static_cast<Internal::Adaptor::EglGraphics *>(mGraphics);
+ Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
+
eglImpl.DestroySurface();
}
-bool NativeRenderSurfaceEcoreWl::ReplaceEGLSurface( EglInterface& egl )
+bool NativeRenderSurfaceEcoreWl::ReplaceGraphicsSurface()
{
DALI_LOG_TRACE_METHOD( gNativeSurfaceLogFilter );
return false;
}
- Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
+ auto eglGraphics = static_cast<Internal::Adaptor::EglGraphics *>(mGraphics);
+ Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
return eglImpl.ReplaceSurfaceWindow( reinterpret_cast< EGLNativeWindowType >( mTbmQueue ) );
}
{
}
-bool NativeRenderSurfaceEcoreWl::PreRender( EglInterface&, Integration::GlAbstraction&, bool )
+bool NativeRenderSurfaceEcoreWl::PreRender( bool )
{
// nothing to do for pixmaps
return true;
}
-void NativeRenderSurfaceEcoreWl::PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface, bool resizingSurface )
+void NativeRenderSurfaceEcoreWl::PostRender( bool renderToFbo, bool replacingSurface, bool resizingSurface )
{
- Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
+ auto eglGraphics = static_cast<Internal::Adaptor::EglGraphics *>(mGraphics);
+ Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
+
eglImpl.SwapBuffers();
if( mThreadSynchronization )
{
if( tbm_surface_queue_acquire( mTbmQueue, &mConsumeSurface ) != TBM_SURFACE_QUEUE_ERROR_NONE )
{
- DALI_LOG_ERROR( "Failed to aquire a tbm_surface\n" );
+ DALI_LOG_ERROR( "Failed to acquire a tbm_surface\n" );
return;
}
}
// INTERNAL INCLUDES
#include <dali/public-api/dali-adaptor-common.h>
#include <dali/integration-api/native-render-surface.h>
+#include <dali/internal/graphics/common/graphics-interface.h>
namespace Dali
{
+class DisplayConnection;
+
/**
* Ecore Wayland Native implementation of render surface.
*/
virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) override;
/**
- * @copydoc Dali::RenderSurface::InitializeEgl()
+ * @copydoc Dali::RenderSurface::InitializeGraphics()
*/
- virtual void InitializeEgl( EglInterface& egl ) override;
+ virtual void InitializeGraphics( Internal::Adaptor::GraphicsInterface& graphics, DisplayConnection& displayConnection ) override;
/**
- * @copydoc Dali::RenderSurface::CreateEglSurface()
+ * @copydoc Dali::RenderSurface::CreateSurface()
*/
- virtual void CreateEglSurface( EglInterface& egl ) override;
+ virtual void CreateSurface() override;
/**
- * @copydoc Dali::RenderSurface::DestroyEglSurface()
+ * @copydoc Dali::RenderSurface::DestroySurface()
*/
- virtual void DestroyEglSurface( EglInterface& egl ) override;
+ virtual void DestroySurface() override;
/**
- * @copydoc Dali::RenderSurface::ReplaceEGLSurface()
+ * @copydoc Dali::RenderSurface::ReplaceGraphicsSurface()
*/
- virtual bool ReplaceEGLSurface( EglInterface& egl ) override;
+ virtual bool ReplaceGraphicsSurface() override;
/**
* @copydoc Dali::RenderSurface::MoveResize()
/**
* @copydoc Dali::RenderSurface::PreRender()
*/
- virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, bool resizingSurface ) override;
+ virtual bool PreRender( bool resizingSurface ) override;
/**
* @copydoc Dali::RenderSurface::PostRender()
*/
- virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface, bool resizingSurface ) override;
+ virtual void PostRender( bool renderToFbo, bool replacingSurface, bool resizingSurface );
/**
* @copydoc Dali::RenderSurface::StopRender()
private: // Data
- PositionSize mPosition;
- TriggerEventInterface* mRenderNotification;
- ColorDepth mColorDepth;
- tbm_format mTbmFormat;
- bool mOwnSurface;
- bool mDrawableCompleted;
-
- tbm_surface_queue_h mTbmQueue;
- tbm_surface_h mConsumeSurface;
- ThreadSynchronizationInterface* mThreadSynchronization; ///< A pointer to the thread-synchronization
- ConditionalWait mTbmSurfaceCondition;
+ PositionSize mPosition;
+ TriggerEventInterface* mRenderNotification;
+ Internal::Adaptor::GraphicsInterface* mGraphics; ///< The graphics interface
+ ColorDepth mColorDepth;
+ tbm_format mTbmFormat;
+ bool mOwnSurface;
+ bool mDrawableCompleted;
+
+ tbm_surface_queue_h mTbmQueue;
+ tbm_surface_h mConsumeSurface;
+ ThreadSynchronizationInterface* mThreadSynchronization; ///< A pointer to the thread-synchronization
+ ConditionalWait mTbmSurfaceCondition;
};
// INTERNAL HEADERS
#include <dali/internal/window-system/ubuntu-x11/pixmap-render-surface-ecore-x.h>
+#include <dali/internal/graphics/gles20/egl-graphics.h>
namespace Dali
{
}
DisplayConnectionX11::DisplayConnectionX11()
-: mDisplay(NULL)
+: mGraphics( nullptr ),
+ mDisplay( nullptr )
{
}
while (events > 0);
}
-bool DisplayConnectionX11::InitializeEgl(EglInterface& egl)
+bool DisplayConnectionX11::InitializeGraphics()
{
- EglImplementation& eglImpl = static_cast<EglImplementation&>(egl);
+ auto eglGraphics = static_cast<EglGraphics *>(mGraphics);
+ EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
if (!eglImpl.InitializeGles(reinterpret_cast<EGLNativeDisplayType>(mDisplay)))
{
}
}
+void DisplayConnectionX11::SetGraphicsInterface( GraphicsInterface& graphics )
+{
+ mGraphics = &graphics;
+}
+
} // namespace Adaptor
} // namespace Internal
void ConsumeEvents();
/**
- * @copydoc Dali::DisplayConnection::InitializeEgl
+ * @copydoc Dali::DisplayConnection::InitializeGraphics
*/
- bool InitializeEgl(EglInterface& egl);
+ bool InitializeGraphics();
+ /**
+ * @copydoc Dali::Internal::Adaptor::DisplayConnection::SetSurfaceType
+ */
void SetSurfaceType( RenderSurface::Type type );
+ /**
+ * @copydoc Dali::Internal::Adaptor::DisplayConnection::SetGraphicsInterface
+ */
+ void SetGraphicsInterface( GraphicsInterface& graphics );
+
public:
/**
private:
+ GraphicsInterface* mGraphics; ///< The graphics interface
+
public:
XDisplay* mDisplay; ///< X-display for rendering
#include <dali/integration-api/thread-synchronization-interface.h>
#include <dali/internal/system/common/trigger-event.h>
#include <dali/internal/window-system/common/display-connection.h>
+#include <dali/internal/graphics/gles20/egl-graphics.h>
+
namespace Dali
{
dpiVertical = int( yres + 0.5f );
}
-void PixmapRenderSurfaceEcoreX::InitializeEgl( EglInterface& egl )
+void PixmapRenderSurfaceEcoreX::InitializeGraphics( GraphicsInterface& graphics, Dali::DisplayConnection& displayConnection )
{
- DALI_LOG_TRACE_METHOD( gPixmapRenderSurfaceLogFilter );
-
- Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
+ mGraphics = &graphics;
+ mDisplayConnection = &displayConnection;
+ auto eglGraphics = static_cast<EglGraphics *>(mGraphics);
+ Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
eglImpl.ChooseConfig(false, mColorDepth);
}
-void PixmapRenderSurfaceEcoreX::CreateEglSurface( EglInterface& egl )
+void PixmapRenderSurfaceEcoreX::CreateSurface()
{
DALI_LOG_TRACE_METHOD( gPixmapRenderSurfaceLogFilter );
- Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
+ auto eglGraphics = static_cast<EglGraphics *>(mGraphics);
+ Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
for (int i = 0; i < BUFFER_COUNT; ++i)
{
}
}
-void PixmapRenderSurfaceEcoreX::DestroyEglSurface( EglInterface& egl )
+void PixmapRenderSurfaceEcoreX::DestroySurface()
{
DALI_LOG_TRACE_METHOD( gPixmapRenderSurfaceLogFilter );
- Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
+ auto eglGraphics = static_cast<EglGraphics *>(mGraphics);
+
+ Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
for (int i = 0; i < BUFFER_COUNT; ++i)
{
}
}
-bool PixmapRenderSurfaceEcoreX::ReplaceEGLSurface( EglInterface& egl )
+bool PixmapRenderSurfaceEcoreX::ReplaceGraphicsSurface()
{
DALI_LOG_TRACE_METHOD( gPixmapRenderSurfaceLogFilter );
bool contextLost = false;
- Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
+ auto eglGraphics = static_cast<EglGraphics *>(mGraphics);
+
+ Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
for (int i = 0; i < BUFFER_COUNT; ++i)
{
{
}
-bool PixmapRenderSurfaceEcoreX::PreRender( EglInterface& egl, Integration::GlAbstraction&, bool )
+bool PixmapRenderSurfaceEcoreX::PreRender( bool )
{
// Nothing to do for pixmaps
return true;
}
-void PixmapRenderSurfaceEcoreX::PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, Dali::DisplayConnection* displayConnection, bool replacingSurface, bool resizingSurface )
+void PixmapRenderSurfaceEcoreX::PostRender( bool renderToFbo, bool replacingSurface, bool resizingSurface )
{
+ auto eglGraphics = static_cast<EglGraphics *>(mGraphics);
+
// flush gl instruction queue
+ Integration::GlAbstraction& glAbstraction = eglGraphics->GetGlAbstraction();
glAbstraction.Flush();
if( mThreadSynchronization )
ConditionalWait::ScopedLock lock( mPixmapCondition );
mConsumeBufferIndex = __sync_fetch_and_xor( &mProduceBufferIndex, 1 ); // Swap buffer indexes.
- Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
+ Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
// 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>( mX11Pixmaps[mProduceBufferIndex] );
rect.width = mPosition.width;
rect.height = mPosition.height;
- XDisplay* display = AnyCast<XDisplay*>(displayConnection->GetDisplay());
+ XDisplay* display = AnyCast<XDisplay*>(mDisplayConnection->GetDisplay());
// make a fixes region as updated area
region = XFixesCreateRegion( display, &rect, 1 );
-#ifndef __DALI_ECORE_X_PIXMAP_RENDER_SURFACE_H__
-#define __DALI_ECORE_X_PIXMAP_RENDER_SURFACE_H__
+#ifndef DALI_ECORE_X_PIXMAP_RENDER_SURFACE_H
+#define DALI_ECORE_X_PIXMAP_RENDER_SURFACE_H
/*
* Copyright (c) 2018 Samsung Electronics Co., Ltd.
#include <dali/internal/window-system/common/pixmap-render-surface.h>
#include <dali/internal/window-system/ubuntu-x11/ecore-x-types.h>
#include <dali/public-api/dali-adaptor-common.h>
+#include <dali/internal/graphics/common/graphics-interface.h>
// EXTERNAL INCLUDES
#include <dali/devel-api/threading/conditional-wait.h>
#include <Ecore_X.h>
+
namespace Dali
{
namespace Internal
virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) override;
/**
- * @copydoc Dali::RenderSurface::InitializeEgl()
+ * @copydoc Dali::RenderSurface::InitializeGraphics()
*/
- virtual void InitializeEgl( EglInterface& egl ) override;
+ virtual void InitializeGraphics( GraphicsInterface& graphics, Dali::DisplayConnection& displayConnection ) override;
/**
- * @copydoc Dali::RenderSurface::CreateEglSurface()
+ * @copydoc Dali::RenderSurface::CreateSurface()
*/
- virtual void CreateEglSurface( EglInterface& egl ) override;
+ virtual void CreateSurface() override;
/**
- * @copydoc Dali::RenderSurface::DestroyEglSurface()
+ * @copydoc Dali::RenderSurface::DestroySurface()
*/
- virtual void DestroyEglSurface( EglInterface& egl ) override;
+ virtual void DestroySurface() override;
/**
- * @copydoc Dali::RenderSurface::ReplaceEGLSurface()
+ * @copydoc Dali::RenderSurface::ReplaceGraphicsSurface()
*/
- virtual bool ReplaceEGLSurface( EglInterface& egl ) override;
+ virtual bool ReplaceGraphicsSurface() override;
/**
* @copydoc Dali::RenderSurface::MoveResize()
/**
* @copydoc Dali::RenderSurface::PreRender()
*/
- virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, bool resizingSurface ) override;
+ virtual bool PreRender( bool resizingSurface ) override;
/**
* @copydoc Dali::RenderSurface::PostRender()
*/
- virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface, bool resizingSurface );
+ virtual void PostRender( bool renderToFbo, bool replacingSurface, bool resizingSurface ) override;
/**
* @copydoc Dali::RenderSurface::StopRender()
private: // Data
static const int BUFFER_COUNT = 2;
-
+ GraphicsInterface* mGraphics; ///< Graphics interface
+ Dali::DisplayConnection* mDisplayConnection; ///< Display connection
PositionSize mPosition; ///< Position
TriggerEventInterface* mRenderNotification; ///< Render notification trigger
ColorDepth mColorDepth; ///< Color depth of surface (32 bit or 24 bit)
} // namespace Dali
-#endif // __DALI_ECORE_X_PIXMAP_RENDER_SURFACE_H__
+#endif // DALI_ECORE_X_PIXMAP_RENDER_SURFACE_H
-#ifndef __DALI_APPLICATION_H__
-#define __DALI_APPLICATION_H__
+#ifndef DALI_APPLICATION_H
+#define DALI_APPLICATION_H
/*
* Copyright (c) 2018 Samsung Electronics Co., Ltd.
*/
// EXTERNAL INCLUDES
-#include <string>
#include <dali/public-api/common/view-mode.h>
#include <dali/public-api/object/base-handle.h>
#include <dali/public-api/signals/callback.h>
*/
} // namespace Dali
-#endif // __DALI_APPLICATION_H__
+#endif // DALI_APPLICATION_H