[4.0] Support surface rotation 72/193372/3
authorHeeyong Song <heeyong.song@samsung.com>
Tue, 20 Nov 2018 02:41:47 +0000 (11:41 +0900)
committerWonsik Jung <sidein@samsung.com>
Tue, 4 Jun 2019 09:18:10 +0000 (18:18 +0900)
Change-Id: I8f0a2a322f4f4165ded5d2945c3adc70d5a191d3

17 files changed:
adaptors/common/adaptor-impl.cpp
adaptors/common/adaptor-impl.h
adaptors/devel-api/adaptor-framework/render-surface.h
adaptors/ecore/wayland/render-surface-ecore-wl.cpp
adaptors/ecore/wayland/window-impl-ecore-wl.cpp
adaptors/ecore/wayland/window-render-surface-ecore-wl.cpp
adaptors/ecore/wayland/window-render-surface.h
adaptors/integration-api/wayland/ecore-wl-render-surface.h
adaptors/integration-api/wayland/native-render-surface.h
adaptors/integration-api/x11/ecore-x-render-surface.h
adaptors/tizen/native-render-surface-tizen.cpp
adaptors/wayland/render-surface/render-surface-wl.cpp
adaptors/wayland/render-surface/render-surface-wl.h
adaptors/wayland/window-impl-wl.cpp
adaptors/x11/ecore-x-render-surface.cpp
adaptors/x11/window-impl-x.cpp
automated-tests/src/dali-adaptor/dali-test-suite-utils/test-application.cpp

index f4a7e91..0e47b04 100755 (executable)
@@ -312,7 +312,15 @@ void Adaptor::Start()
 
   // Tell the core the size of the surface just before we start the render-thread
   PositionSize size = mSurface->GetPositionSize();
-  mCore->SurfaceResized( size.width, size.height );
+  int orientation = mSurface->GetOrientation();
+  bool forceUpdate = false;
+  if( mSurface->IsPreRotationSupported() )
+  {
+    orientation = 0;
+    forceUpdate = true;
+  }
+
+  mCore->SurfaceResized( size.width, size.height, orientation, forceUpdate );
 
   // Initialize the thread controller
   mThreadController->Initialize();
@@ -448,9 +456,17 @@ void Adaptor::FeedKeyEvent( KeyEvent& keyEvent )
 void Adaptor::ReplaceSurface( Any nativeWindow, RenderSurface& surface )
 {
   PositionSize positionSize = surface.GetPositionSize();
+  int orientation = mSurface->GetOrientation();
+  bool forceUpdate = false;
+
+  if( mSurface->IsPreRotationSupported() )
+  {
+    orientation = 0;
+    forceUpdate = true;
+  }
 
   // let the core know the surface size has changed
-  mCore->SurfaceResized( positionSize.width, positionSize.height );
+  mCore->SurfaceResized( positionSize.width, positionSize.height, orientation, forceUpdate );
 
   mResizedSignal.Emit( mAdaptor );
 
@@ -777,18 +793,10 @@ void Adaptor::OnDamaged( const DamageArea& area )
   RequestUpdate( false );
 }
 
-void Adaptor::SurfaceResizePrepare( SurfaceSize surfaceSize, int orientation )
+void Adaptor::SurfaceResizePrepare( SurfaceSize surfaceSize, int orientation, bool forceUpdate )
 {
   // let the core know the surface size and orientation has changed
-  mCore->SurfaceResized( surfaceSize.GetWidth(), surfaceSize.GetHeight(), orientation );
-
-  mResizedSignal.Emit( mAdaptor );
-}
-
-void Adaptor::SurfaceResizePrepare( SurfaceSize surfaceSize )
-{
-  // let the core know the surface size has changed
-  mCore->SurfaceResized( surfaceSize.GetWidth(), surfaceSize.GetHeight() );
+  mCore->SurfaceResized( surfaceSize.GetWidth(), surfaceSize.GetHeight(), orientation, forceUpdate );
 
   mResizedSignal.Emit( mAdaptor );
 }
index 045272b..a2cf089 100755 (executable)
@@ -341,12 +341,7 @@ public:
   /**
    * Informs core the surface size and orientation has changed
    */
-  void SurfaceResizePrepare( SurfaceSize surfaceSize, int orientation );
-
-  /**
-   * Informs core the surface size has changed
-   */
-  void SurfaceResizePrepare( SurfaceSize surfaceSize );
+  void SurfaceResizePrepare( SurfaceSize surfaceSize, int orientation, bool forceUpdate );
 
   /**
    * Informs ThreadController the surface size has changed
index 9739770..7e9554f 100644 (file)
@@ -88,6 +88,18 @@ public:
   virtual PositionSize GetPositionSize() const = 0;
 
   /**
+   * @brief Return the orientation of the surface.
+   * @return The orientation
+   */
+  virtual int GetOrientation() const = 0;
+
+  /**
+   * Query wheter PreRotation is supported or not.
+   * @return true if the PreRotation is supported.
+   */
+  virtual bool IsPreRotationSupported() const = 0;
+
+  /**
    * Initialize EGL, RenderSurface should create egl display and initialize
    * @param egl implementation to use for the creation
    */
index 2db6f23..a13aae5 100644 (file)
@@ -109,6 +109,16 @@ PositionSize EcoreWlRenderSurface::GetPositionSize() const
   return mPositionSize;
 }
 
+int EcoreWlRenderSurface::GetOrientation() const
+{
+  return 0;
+}
+
+bool EcoreWlRenderSurface::IsPreRotationSupported() const
+{
+  return false;
+}
+
 void EcoreWlRenderSurface::MoveResize( Dali::PositionSize positionSize )
 {
   // nothing to do in base class
index 8437a6b..3eb89ee 100755 (executable)
@@ -222,16 +222,27 @@ struct Window::EventHandler
 
     if ( handler && handler->mWindow && transformEvent->output == ecore_wl_window_output_find( handler->mEcoreWindow ) )
     {
-      DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window (%p) EcoreEventOutputTransform\n", handler->mEcoreWindow );
-
       ECore::WindowRenderSurface* wlSurface( dynamic_cast< ECore::WindowRenderSurface * >( handler->mWindow->mSurface ) );
       if( wlSurface )
       {
-        int orientation = wlSurface->OutputTransformed();
+        wlSurface->OutputTransformed();
+
+        bool forceUpdate = false;
+        int orientation = wlSurface->GetOrientation();
+
+        // If PreRotation is supported, don't work client rotation by core.
+        // Client rotation means both window resize and camera rotation.
+        if( wlSurface->IsPreRotationSupported() )
+        {
+          forceUpdate = true;
+          orientation = 0;
+        }
 
         PositionSize positionSize = wlSurface->GetPositionSize();
-        handler->mWindow->mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( positionSize.width, positionSize.height ), orientation );
+        handler->mWindow->mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( positionSize.width, positionSize.height ), orientation, forceUpdate );
         handler->mWindow->mAdaptor->SurfaceResizeComplete( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
+
+        DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window (%p) EcoreEventOutputTransform [%d, %d]\n", handler->mEcoreWindow, positionSize.width, positionSize.height );
       }
     }
 
@@ -246,16 +257,27 @@ struct Window::EventHandler
 
     if ( handler && handler->mWindow && ignoreTransformEvent->win == handler->mEcoreWindow )
     {
-      DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window (%p) EcoreEventIgnoreOutputTransform\n", handler->mEcoreWindow );
-
       ECore::WindowRenderSurface* wlSurface( dynamic_cast< ECore::WindowRenderSurface * >( handler->mWindow->mSurface ) );
       if( wlSurface )
       {
-        int orientation = wlSurface->OutputTransformed();
+        wlSurface->OutputTransformed();
+
+        bool forceUpdate = false;
+        int orientation = wlSurface->GetOrientation();
+
+        // If PreRotation is supported, don't work client rotation by core.
+        // Client rotation means both window resize and camera rotation.
+        if( wlSurface->IsPreRotationSupported() )
+        {
+          forceUpdate = true;
+          orientation = 0;
+        }
 
         PositionSize positionSize = wlSurface->GetPositionSize();
-        handler->mWindow->mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( positionSize.width, positionSize.height ), orientation );
+        handler->mWindow->mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( positionSize.width, positionSize.height ), orientation, forceUpdate );
         handler->mWindow->mAdaptor->SurfaceResizeComplete( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
+
+        DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window (%p) EcoreEventIgnoreOutputTransform [%d, %d]\n", handler->mEcoreWindow, positionSize.width, positionSize.height );
       }
     }
 
@@ -968,13 +990,25 @@ bool Window::IsVisible() const
 
 void Window::RotationDone( int orientation, int width, int height )
 {
+  bool forceUpdate = false;
   ECore::WindowRenderSurface* wlSurface( dynamic_cast< ECore::WindowRenderSurface * >( mSurface ) );
   if( wlSurface )
   {
     wlSurface->RequestRotation( orientation, width, height );
+
+    // Update orientation
+    orientation = wlSurface->GetOrientation();
+
+    // If PreRotation is supported, don't work client rotation by core.
+    // Client rotation means both window resize and camera rotation.
+    if( wlSurface->IsPreRotationSupported() )
+    {
+      forceUpdate = true;
+      orientation = 0;
+    }
   }
 
-  mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( width, height ) );
+  mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( width, height ), orientation, forceUpdate );
 
   // Emit signal
   mResizedSignal.Emit( Dali::Window::WindowSize( width, height ) );
@@ -1516,7 +1550,22 @@ void Window::SetSize( Dali::Window::WindowSize size )
 
     mSurface->MoveResize( positionSize );
 
-    mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
+    int orientation = 0;
+    bool forceUpdate = false;
+    ECore::WindowRenderSurface* wlSurface( dynamic_cast< ECore::WindowRenderSurface * >( mSurface ) );
+    if( wlSurface )
+    {
+      orientation = wlSurface->GetOrientation();
+      // If PreRotation is supported, don't work client rotation by core.
+      // Client rotation means both window resize and camera rotation.
+      if( wlSurface->IsPreRotationSupported() )
+      {
+        forceUpdate = true;
+        orientation = 0;
+      }
+    }
+
+    mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( positionSize.width, positionSize.height ), orientation, forceUpdate );
 
     // Emit signal
     mResizedSignal.Emit( Dali::Window::WindowSize( positionSize.width, positionSize.height ) );
index 95cfb08..7e330f7 100755 (executable)
@@ -128,7 +128,7 @@ void WindowRenderSurface::RequestRotation( int angle, int width, int height )
   DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::Rotate: angle = %d screen rotation = %d\n", mRotationAngle, mScreenRotationAngle );
 }
 
-int WindowRenderSurface::OutputTransformed()
+void WindowRenderSurface::OutputTransformed()
 {
   int transform;
 
@@ -138,9 +138,10 @@ int WindowRenderSurface::OutputTransformed()
     mScreenRotationAngle = transform * 90;
     mScreenRotationFinished = false;
     mResizeFinished = false;
+    DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::OutputTransformed: called!\n" );
   }
+
   DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::OutputTransformed: angle = %d screen rotation = %d\n", mRotationAngle, mScreenRotationAngle );
-  return  (mRotationAngle + mScreenRotationAngle) % 360;
 }
 
 void WindowRenderSurface::SetTransparency( bool transparent )
@@ -148,6 +149,16 @@ void WindowRenderSurface::SetTransparency( bool transparent )
   ecore_wl_window_alpha_set( mWlWindow, transparent );
 }
 
+int WindowRenderSurface::GetOrientation() const
+{
+  return (mRotationAngle + mScreenRotationAngle) % 360;
+}
+
+bool WindowRenderSurface::IsPreRotationSupported() const
+{
+  return mRotationSupported;
+}
+
 void WindowRenderSurface::InitializeEgl( EglInterface& eglIf )
 {
   DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
@@ -460,6 +471,8 @@ void WindowRenderSurface::CreateWlRenderable()
 
     mScreenRotationAngle = transform * 90;
     mScreenRotationFinished = false;
+
+    DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::CreateWlRenderable: screen rotation = %d\n", mScreenRotationAngle );
   }
 }
 
index 90eadeb..db8143e 100755 (executable)
@@ -89,7 +89,7 @@ public: // API
   /**
    * Notify output is transformed.
    */
-  int OutputTransformed();
+  void OutputTransformed();
 
   /**
    * @brief Sets whether the surface is transparent or not.
@@ -101,6 +101,16 @@ public: // API
 public: // from Dali::RenderSurface
 
   /**
+   * @copydoc Dali::RenderSurface::GetOrientation()
+   */
+  virtual int GetOrientation() const;
+
+  /**
+   * @copydoc Dali::RenderSurface::IsPreRotationSupported()
+   */
+  virtual bool IsPreRotationSupported() const;
+
+  /**
    * @copydoc Dali::RenderSurface::InitializeEgl()
    */
   virtual void InitializeEgl( EglInterface& egl );
index e207082..dcfb48a 100644 (file)
@@ -97,6 +97,16 @@ public: // from Dali::RenderSurface
   virtual PositionSize GetPositionSize() const;
 
   /**
+   * @copydoc Dali::RenderSurface::GetOrientation()
+   */
+  virtual int GetOrientation() const;
+
+  /**
+   * @copydoc Dali::RenderSurface::IsPreRotationSupported()
+   */
+  virtual bool IsPreRotationSupported() const;
+
+  /**
    * @copydoc Dali::RenderSurface::InitializeEgl()
    */
   virtual void InitializeEgl( EglInterface& egl ) = 0;
index 11e01e1..0204fe5 100644 (file)
@@ -93,6 +93,16 @@ public: // from Dali::RenderSurface
   virtual PositionSize GetPositionSize() const;
 
   /**
+   * @copydoc Dali::RenderSurface::GetOrientation()
+   */
+  virtual int GetOrientation() const;
+
+  /**
+   * @copydoc Dali::RenderSurface::IsPreRotationSupported()
+   */
+  virtual bool IsPreRotationSupported() const;
+
+  /**
    * @copydoc Dali::RenderSurface::InitializeEgl()
    */
   virtual void InitializeEgl( EglInterface& egl );
index 8b1a0bf..db2be4e 100644 (file)
@@ -105,6 +105,16 @@ public: // from Dali::RenderSurface
   virtual PositionSize GetPositionSize() const;
 
   /**
+   * @copydoc Dali::RenderSurface::GetOrientation()
+   */
+  virtual int GetOrientation() const;
+
+  /**
+   * @copydoc Dali::RenderSurface::IsPreRotationSupported()
+   */
+  virtual bool IsPreRotationSupported() const;
+
+  /**
    * @copydoc Dali::RenderSurface::InitializeEgl()
    */
   virtual void InitializeEgl( EglInterface& egl ) = 0;
index cc6e288..444c696 100644 (file)
@@ -223,6 +223,16 @@ PositionSize NativeRenderSurface::GetPositionSize() const
   return mImpl->mPosition;
 }
 
+int NativeRenderSurface::GetOrientation() const
+{
+  return 0;
+}
+
+bool NativeRenderSurface::IsPreRotationSupported() const
+{
+  return false;
+}
+
 void NativeRenderSurface::MoveResize( Dali::PositionSize positionSize )
 {
 }
index 801a3bb..6fe81f3 100644 (file)
@@ -78,6 +78,16 @@ PositionSize RenderSurface::GetPositionSize() const
   return mWindow.mPosition;
 }
 
+int RenderSurface::GetOrientation() const
+{
+  return 0;
+}
+
+bool RenderSurface::IsPreRotationSupported() const
+{
+  return false;
+}
+
 void RenderSurface::InitializeEgl( EglInterface& egl )
 {
   Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
index 725c133..9a3c9e4 100644 (file)
@@ -102,6 +102,16 @@ public: // from Dali::RenderSurface
   virtual PositionSize GetPositionSize() const;
 
   /**
+   * @copydoc Dali::RenderSurface::GetOrientation()
+   */
+  virtual int GetOrientation() const;
+
+  /**
+   * @copydoc Dali::RenderSurface::IsPreRotationSupported()
+   */
+  virtual bool IsPreRotationSupported() const;
+
+  /**
    * @copydoc Dali::RenderSurface::InitializeEgl()
    */
   virtual void InitializeEgl( EglInterface& egl );
index d507f04..9bb53c0 100644 (file)
@@ -424,7 +424,7 @@ void Window::SetSize( Dali::Window::WindowSize size )
 
     mSurface->MoveResize( positionSize );
 
-    mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
+    mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( positionSize.width, positionSize.height ), 0, false );
 
     // Emit signal
     mResizedSignal.Emit( Dali::Window::WindowSize( positionSize.width, positionSize.height ) );
index df81aca..93a254b 100644 (file)
@@ -99,6 +99,16 @@ PositionSize EcoreXRenderSurface::GetPositionSize() const
   return mPosition;
 }
 
+int EcoreXRenderSurface::GetOrientation() const
+{
+  return 0;
+}
+
+bool EcoreXRenderSurface::IsPreRotationSupported() const
+{
+  return false;
+}
+
 void EcoreXRenderSurface::MoveResize( Dali::PositionSize positionSize )
 {
   // nothing to do in base class
index 0af5d48..fb21f1b 100644 (file)
@@ -810,7 +810,7 @@ void Window::RotationDone( int orientation, int width, int height )
                                      ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
                                      ECORE_X_ATOM_CARDINAL, 32, &angles, 2 );
 
-    mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( width, height ) );
+    mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( width, height ), 0, false );
 
     // Emit signal
     mResizedSignal.Emit( Dali::Window::WindowSize( width, height ) );
@@ -925,7 +925,7 @@ void Window::SetSize( Dali::Window::WindowSize size )
 
     mSurface->MoveResize( positionSize );
 
-    mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
+    mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( positionSize.width, positionSize.height ), 0, false );
 
     // Emit signal
     mResizedSignal.Emit( Dali::Window::WindowSize( positionSize.width, positionSize.height ) );
index a247f7d..13f4415 100644 (file)
@@ -73,7 +73,7 @@ void TestApplication::Initialize()
                                         Integration::StencilBufferAvailable::TRUE );
 
   mCore->ContextCreated();
-  mCore->SurfaceResized( mSurfaceWidth, mSurfaceHeight );
+  mCore->SurfaceResized( mSurfaceWidth, mSurfaceHeight, 0, false );
   mCore->SetDpi( mDpi.x, mDpi.y );
 
   Dali::Integration::Log::LogFunction logFunction(&TestApplication::LogMessage);
@@ -153,7 +153,7 @@ void TestApplication::SetSurfaceWidth( unsigned int width, unsigned height )
   mSurfaceWidth = width;
   mSurfaceHeight = height;
 
-  mCore->SurfaceResized( mSurfaceWidth, mSurfaceHeight );
+  mCore->SurfaceResized( mSurfaceWidth, mSurfaceHeight, 0, false );
 }
 
 void TestApplication::SetTopMargin( unsigned int margin )