[Tizen] Fix i586 build error 42/135342/1 accepted/tizen/unified/20170630.083244 submit/tizen/20170622.035441
authorHeeyong Song <heeyong.song@samsung.com>
Thu, 22 Jun 2017 03:45:09 +0000 (12:45 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Thu, 22 Jun 2017 03:45:09 +0000 (12:45 +0900)
Change-Id: Ib7d41ef42d82c4ff0b61ed35083209f8d7a1c926

adaptors/ecore/wayland/window-render-surface-ecore-wl.cpp
adaptors/ecore/wayland/window-render-surface.h

index 17c5515..40858ed 100644 (file)
@@ -19,6 +19,7 @@
 #include <window-render-surface.h>
 
 // EXTERNAL INCLUDES
+#include <dlfcn.h>
 #include <dali/integration-api/gl-abstraction.h>
 #include <dali/integration-api/debug.h>
 #include <dali/integration-api/gl-defines.h>
@@ -44,6 +45,7 @@ namespace
 {
 
 const int MINIMUM_DIMENSION_CHANGE( 1 ); ///< Minimum change for window to be considered to have moved
+const char* WAYLAND_EGL_SO( "libwayland-egl.so" );
 
 } // unnamed namespace
 
@@ -52,6 +54,9 @@ WindowRenderSurface::WindowRenderSurface( Dali::PositionSize positionSize,
                                           const std::string& name,
                                           bool isTransparent)
 : EcoreWlRenderSurface( positionSize, surface, name, isTransparent ),
+  mEglWinGetCapabilitiesPtr( NULL ),
+  mEglWinSetRotationPtr( NULL ),
+  mLibHandle( NULL ),
   mWlWindow( NULL ),
   mEglWindow( NULL ),
   mThreadSynchronization( NULL ),
@@ -80,6 +85,11 @@ WindowRenderSurface::~WindowRenderSurface()
   {
     delete mRotationTrigger;
   }
+
+  if( mLibHandle != NULL )
+  {
+    dlclose( mLibHandle );
+  }
 }
 
 Ecore_Wl_Window* WindowRenderSurface::GetDrawable()
@@ -159,7 +169,10 @@ void WindowRenderSurface::RequestRotation( Dali::Window::WindowOrientation orien
 
   ecore_wl_window_rotation_set( mWlWindow, angle );
 
-  wl_egl_window_set_rotation( mEglWindow, rotation );
+  if( mEglWinSetRotationPtr )
+  {
+    mEglWinSetRotationPtr( mEglWindow, rotation );
+  }
 }
 
 void WindowRenderSurface::InitializeEgl( EglInterface& eglIf )
@@ -194,11 +207,40 @@ void WindowRenderSurface::CreateEglSurface( EglInterface& eglIf )
   eglImpl.CreateSurfaceWindow( windowType, mColorDepth );
 
   // Check capability
-  wl_egl_window_capability capability = static_cast< wl_egl_window_capability >( wl_egl_window_get_capabilities( mEglWindow ) );
-  if( capability == WL_EGL_WINDOW_CAPABILITY_ROTATION_SUPPORTED )
+  if( !mLibHandle )
   {
-    DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::CreateEglSurface: capability = %d\n", capability );
-    mRotationSupported = true;
+    mLibHandle = dlopen( WAYLAND_EGL_SO, RTLD_LAZY );
+
+    char* error = dlerror();
+    if( mLibHandle == NULL || error != NULL )
+    {
+      DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::CreateEglSurface: dlopen error: %s\n", error );
+      return;
+    }
+
+    mEglWinGetCapabilitiesPtr = reinterpret_cast< EglWinGetCapabilitiesFunction >( dlsym( mLibHandle, "wl_egl_window_get_capabilities" ) );
+    if( !mEglWinGetCapabilitiesPtr )
+    {
+      DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::CreateEglSurface: Can't load wl_egl_window_get_capabilities\n" );
+      return;
+    }
+
+    mEglWinSetRotationPtr = reinterpret_cast< EglWinSetRotationFunction >( dlsym( mLibHandle, "wl_egl_window_set_rotation" ) );
+    if( !mEglWinSetRotationPtr )
+    {
+      DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::CreateEglSurface: Can't load wl_egl_window_set_rotation\n" );
+      return;
+    }
+  }
+
+  if( mEglWinGetCapabilitiesPtr )
+  {
+    wl_egl_window_capability capability = static_cast< wl_egl_window_capability >( mEglWinGetCapabilitiesPtr( mEglWindow ) );
+    if( capability == WL_EGL_WINDOW_CAPABILITY_ROTATION_SUPPORTED )
+    {
+      DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::CreateEglSurface: capability = %d\n", capability );
+      mRotationSupported = true;
+    }
   }
 }
 
index 40a0d2a..19d7c7a 100644 (file)
@@ -170,7 +170,14 @@ private:
 
 private: // Data
 
-  Ecore_Wl_Window*                mWlWindow; ///< Wayland-Window
+  typedef int (*EglWinGetCapabilitiesFunction)( wl_egl_window* eglWindow );
+  typedef int (*EglWinSetRotationFunction)( wl_egl_window* eglWindow, int rotation );
+
+  EglWinGetCapabilitiesFunction  mEglWinGetCapabilitiesPtr;
+  EglWinSetRotationFunction      mEglWinSetRotationPtr;
+
+  void*                           mLibHandle; ///< Handle for the loaded library
+  Ecore_Wl_Window*                mWlWindow;  ///< Wayland-Window
   wl_egl_window*                  mEglWindow;
   ThreadSynchronizationInterface* mThreadSynchronization;
   TriggerEventInterface*          mRotationTrigger;