Fix a bug when using tbm_dummy_display_create 20/261920/4
authorDaekwang Ryu <dkdk.ryu@samsung.com>
Thu, 30 Jun 2022 06:12:43 +0000 (15:12 +0900)
committerDaekwang Ryu <dkdk.ryu@samsung.com>
Thu, 30 Jun 2022 06:28:56 +0000 (15:28 +0900)
We have to init tbm_bugmgr.

Change-Id: If476e1122f8e9739723fa08a20ccd60a7ed346cf

dali/internal/window-system/tizen-wayland/display-connection-impl-ecore-wl.cpp
dali/internal/window-system/tizen-wayland/display-connection-impl-ecore-wl.h

index 3c2e234..136f20a 100644 (file)
@@ -45,7 +45,8 @@ DisplayConnection* DisplayConnectionEcoreWl::New()
 DisplayConnectionEcoreWl::DisplayConnectionEcoreWl()
 : mDisplay(NULL),
   mSurfaceType(RenderSurfaceInterface::WINDOW_RENDER_SURFACE),
-  mGraphics(nullptr)
+  mGraphics(nullptr),
+  mBufMgr(nullptr)
 {
 }
 
@@ -106,6 +107,12 @@ void DisplayConnectionEcoreWl::SetGraphicsInterface(GraphicsInterface& graphics)
 
 EGLNativeDisplayType DisplayConnectionEcoreWl::GetNativeDisplay()
 {
+  mBufMgr = tbm_bufmgr_init(-1);  // -1 is meaningless. The parameter in this function is deprecated.
+  if(mBufMgr == nullptr)
+  {
+    DALI_LOG_ERROR("Fail to init tbm buf mgr\n");
+    return nullptr;
+  }
   return reinterpret_cast<EGLNativeDisplayType>(tbm_dummy_display_create());
 }
 
@@ -115,6 +122,11 @@ void DisplayConnectionEcoreWl::ReleaseNativeDisplay()
   {
     tbm_dummy_display_destroy(reinterpret_cast<tbm_dummy_display*>(mDisplay));
   }
+
+  if(mBufMgr != nullptr)
+  {
+    tbm_bufmgr_deinit(mBufMgr);
+  }
 }
 
 } // namespace Adaptor
index 191a9ee..06a3dad 100644 (file)
@@ -18,6 +18,9 @@
  *
  */
 
+// EXTERNAL INCLUDES
+#include <tbm_bufmgr.h>
+
 // INTERNAL INCLUDES
 #include <dali/internal/window-system/common/display-connection-impl.h>
 
@@ -102,6 +105,7 @@ private:
   EGLNativeDisplayType               mDisplay;     ///< Wayland-display for rendering
   Dali::RenderSurfaceInterface::Type mSurfaceType; ///< The surface type
   GraphicsInterface*                 mGraphics;    ///< The graphics interface
+  tbm_bufmgr                         mBufMgr;      ///< For creating tbm_dummy_display
 };
 
 } // namespace Adaptor