remove deadlock from pixmap render surface, mutex lock is being held while waiting...
[platform/core/uifw/dali-adaptor.git] / adaptors / wayland / window-render-surface-wl.cpp
index a9c0505..f2d83ba 100644 (file)
 // INTERNAL INCLUDES
 #include <ecore-wl-types.h>
 #include <trigger-event.h>
+#include <gl/egl-implementation.h>
+#include <base/display-connection.h>
 
 namespace Dali
 {
 
-namespace Internal
-{
-
-namespace Adaptor
-{
-
 #if defined(DEBUG_ENABLED)
 extern Debug::Filter* gRenderSurfaceLogFilter;
 #endif
@@ -51,10 +47,9 @@ const int MINIMUM_DIMENSION_CHANGE( 1 ); ///< Minimum change for window to be co
 
 WindowRenderSurface::WindowRenderSurface( Dali::PositionSize positionSize,
                                           Any surface,
-                                          Any display,
                                           const std::string& name,
                                           bool isTransparent)
-: RenderSurface( Dali::RenderSurface::WINDOW, positionSize, surface, display, name, isTransparent ),
+: EcoreWlRenderSurface( positionSize, surface, name, isTransparent ),
   mNeedToApproveDeiconify(false)
 {
   DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "Creating Window\n" );
@@ -75,11 +70,6 @@ Ecore_Wl_Window* WindowRenderSurface::GetDrawable()
   return mWlWindow;
 }
 
-Dali::RenderSurface::SurfaceType WindowRenderSurface::GetType()
-{
-  return Dali::RenderSurface::WINDOW;
-}
-
 Any WindowRenderSurface::GetSurface()
 {
   // already an e-core type
@@ -100,8 +90,7 @@ void WindowRenderSurface::InitializeEgl( EglInterface& eglIf )
 {
   DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
 
-  EglImplementation& eglImpl = static_cast<EglImplementation&>( eglIf );
-  eglImpl.InitializeGles( reinterpret_cast< EGLNativeDisplayType >( mMainDisplay ) );
+  Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( eglIf );
 
   eglImpl.ChooseConfig(true, mColorDepth);
 }
@@ -110,7 +99,7 @@ void WindowRenderSurface::CreateEglSurface( EglInterface& eglIf )
 {
   DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
 
-  EglImplementation& eglImpl = static_cast<EglImplementation&>( eglIf );
+  Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( eglIf );
 
   // create the EGL surface
   ecore_wl_window_surface_create(mWlWindow);
@@ -122,23 +111,21 @@ void WindowRenderSurface::DestroyEglSurface( EglInterface& eglIf )
 {
   DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
 
-  EglImplementation& eglImpl = static_cast<EglImplementation&>( eglIf );
+  Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( eglIf );
   eglImpl.DestroySurface();
   wl_egl_window_destroy(mEglWindow);
   mEglWindow = NULL;
 }
 
-bool WindowRenderSurface::ReplaceEGLSurface( EglInterface& eglIf )
+bool WindowRenderSurface::ReplaceEGLSurface( EglInterface& egl )
 {
   DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
 
-  EglImplementation& egl = static_cast<EglImplementation&>( eglIf );
-  egl.InitializeGles( reinterpret_cast< EGLNativeDisplayType >( mMainDisplay ) );
-
   wl_egl_window_destroy(mEglWindow);
   mEglWindow = wl_egl_window_create(ecore_wl_window_surface_get(mWlWindow), mPosition.width, mPosition.height);
-  return egl.ReplaceSurfaceWindow( (EGLNativeWindowType)mEglWindow, // reinterpret_cast does not compile
-                                   reinterpret_cast< EGLNativeDisplayType >( mMainDisplay ) );
+
+  Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
+  return eglImpl.ReplaceSurfaceWindow( (EGLNativeWindowType)mEglWindow ); // reinterpret_cast does not compile
 }
 
 void WindowRenderSurface::MoveResize( Dali::PositionSize positionSize )
@@ -188,9 +175,9 @@ bool WindowRenderSurface::PreRender( EglInterface&, Integration::GlAbstraction&
   return true;
 }
 
-void WindowRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, unsigned int, bool )
+void WindowRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, unsigned int deltaTime, bool replacingSurface )
 {
-  EglImplementation& eglImpl = static_cast<EglImplementation&>( egl );
+  Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
   eglImpl.SwapBuffers();
 
   // When the window is deiconified, it approves the deiconify operation to window manager after rendering
@@ -199,6 +186,8 @@ void WindowRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstract
     // SwapBuffer is desychronized. So make sure to sychronize when window is deiconified.
     glAbstraction.Finish();
 
+    //FIXME
+
     mNeedToApproveDeiconify = false;
   }
 }
@@ -209,6 +198,7 @@ void WindowRenderSurface::StopRender()
 
 void WindowRenderSurface::SetViewMode( ViewMode viewMode )
 {
+  //FIXME
 }
 
 void WindowRenderSurface::CreateWlRenderable()
@@ -229,6 +219,8 @@ void WindowRenderSurface::CreateWlRenderable()
   {
       DALI_ASSERT_ALWAYS(0 && "Failed to create X window");
   }
+
+  //FIXME
 }
 
 void WindowRenderSurface::UseExistingRenderable( unsigned int surfaceId )
@@ -243,8 +235,4 @@ void WindowRenderSurface::ReleaseLock()
 
 } // namespace ECore
 
-} // namespace Adaptor
-
-} // namespace Internal
-
 } // namespace Dali