** Temporary patch for diagnosing some hideous bugs in Tizen ** 47/256847/3 accepted/tizen/unified/20210415.000533 submit/tizen/20210414.041043
authorHermet Park <chuneon.park@samsung.com>
Wed, 14 Apr 2021 02:50:09 +0000 (11:50 +0900)
committerHermet Park <chuneon.park@samsung.com>
Wed, 14 Apr 2021 03:04:16 +0000 (12:04 +0900)
This patch puts some prints for analizing a crash issue,
it must be reverted after fixing it.

Change-Id: Iac2db25da27aa85dcfef19d05ced887d821584de

packaging/thorvg.spec
src/lib/tvgCanvas.cpp
src/lib/tvgCanvasImpl.h
src/lib/tvgCommon.h
src/lib/tvgInitializer.cpp
src/lib/tvgPaint.cpp
src/lib/tvgSceneImpl.h
src/lib/tvgTaskScheduler.cpp
src/loaders/svg/tvgSvgLoader.cpp
src/loaders/svg/tvgSvgSceneBuilder.cpp
src/meson.build

index e0657bc..b24fec5 100644 (file)
@@ -9,6 +9,8 @@ Source0:    %{name}-%{version}.tar.gz
 
 BuildRequires:  pkgconfig
 BuildRequires:  pkgconfig(glesv2)
+BuildRequires:  pkgconfig(dlog)
+
 BuildRequires:  meson
 BuildRequires:  ninja
 Requires(post): /sbin/ldconfig
index 309e205..f886c74 100644 (file)
@@ -51,24 +51,32 @@ Result Canvas::push(unique_ptr<Paint> paint) noexcept
 
 Result Canvas::clear(bool free) noexcept
 {
+dlog_print(DLOG_ERROR, LOG_TAG, "Canvas(%p) Clear", this);
+
     return pImpl->clear(free);
 }
 
 
 Result Canvas::draw() noexcept
 {
+dlog_print(DLOG_ERROR, LOG_TAG, "Canvas(%p) Draw", this);
+
     return pImpl->draw();
 }
 
 
 Result Canvas::update(Paint* paint) noexcept
 {
+dlog_print(DLOG_ERROR, LOG_TAG, "Canvas(%p) Update", this);
+
     return pImpl->update(paint, false);
 }
 
 
 Result Canvas::sync() noexcept
 {
+dlog_print(DLOG_ERROR, LOG_TAG, "Canvas(%p) Sync", this);
+
     if (pImpl->renderer->sync()) return Result::Success;
 
     return Result::InsufficientCondition;
index 2772a23..b5c22c8 100644 (file)
@@ -86,9 +86,11 @@ struct Canvas::Impl
 
         //Update single paint node
         if (paint) {
+            dlog_print(DLOG_ERROR, LOG_TAG, "Canvas(%p) update a paint(%p)", this, paint);
             paint->pImpl->update(*renderer, nullptr, 255, clips, flag);
         //Update all retained paint nodes
         } else {
+            dlog_print(DLOG_ERROR, LOG_TAG, "Canvas(%p) update paints count(%d)", this, paints.count);
             for (auto paint = paints.data; paint < (paints.data + paints.count); ++paint) {
                 (*paint)->pImpl->update(*renderer, nullptr, 255, clips, flag);
             }
@@ -96,6 +98,8 @@ struct Canvas::Impl
 
         refresh = false;
 
+        dlog_print(DLOG_ERROR, LOG_TAG, "Canvas(%p) update finished", this);
+
         return Result::Success;
     }
 
@@ -103,12 +107,16 @@ struct Canvas::Impl
     {
         if (!renderer || !renderer->preRender()) return Result::InsufficientCondition;
 
+        dlog_print(DLOG_ERROR, LOG_TAG, "Canvas(%p) draw paints count(%d)", this, paints.count);
+
         for (auto paint = paints.data; paint < (paints.data + paints.count); ++paint) {
             if (!(*paint)->pImpl->render(*renderer)) return Result::InsufficientCondition;
         }
 
         if (!renderer->postRender()) return Result::InsufficientCondition;
 
+        dlog_print(DLOG_ERROR, LOG_TAG, "Canvas(%p) draw finished", this);
+
         return Result::Success;
     }
 };
index f5d4a6d..8fcb681 100644 (file)
@@ -22,6 +22,7 @@
 #ifndef _TVG_COMMON_H_
 #define _TVG_COMMON_H_
 
+#include <dlog.h>
 #include "config.h"
 #include "thorvg.h"
 
@@ -31,6 +32,8 @@ using namespace tvg;
 #define FILL_ID_LINEAR 0
 #define FILL_ID_RADIAL 1
 
+#define LOG_TAG "thorvg"
+
 #define TVG_UNUSED __attribute__ ((__unused__))
 
 #endif //_TVG_COMMON_H_
index c91e13e..e144fb6 100644 (file)
@@ -45,6 +45,8 @@ Result Initializer::init(CanvasEngine engine, uint32_t threads) noexcept
 {
     auto nonSupport = true;
 
+dlog_print(DLOG_ERROR, LOG_TAG, "Inititlized!");
+
     if (static_cast<uint32_t>(engine) & static_cast<uint32_t>(CanvasEngine::Sw)) {
         #ifdef THORVG_SW_RASTER_SUPPORT
             if (!SwRenderer::init(threads)) return Result::InsufficientCondition;
@@ -65,12 +67,17 @@ Result Initializer::init(CanvasEngine engine, uint32_t threads) noexcept
 
     TaskScheduler::init(threads);
 
+dlog_print(DLOG_ERROR, LOG_TAG, "Inititlized! - Success");
+
     return Result::Success;
 }
 
 
 Result Initializer::term(CanvasEngine engine) noexcept
 {
+
+dlog_print(DLOG_ERROR, LOG_TAG, "Terminiated!");
+
     auto nonSupport = true;
 
     if (static_cast<uint32_t>(engine) & static_cast<uint32_t>(CanvasEngine::Sw)) {
@@ -93,5 +100,7 @@ Result Initializer::term(CanvasEngine engine) noexcept
 
     if (!LoaderMgr::term()) return Result::Unknown;
 
+dlog_print(DLOG_ERROR, LOG_TAG, "Terminiated! - Success");
+
     return Result::Success;
-}
\ No newline at end of file
+}
index aca756f..5e20587 100644 (file)
@@ -164,6 +164,8 @@ bool Paint::Impl::render(RenderMethod& renderer)
 {
     Compositor* cmp = nullptr;
 
+dlog_print(DLOG_ERROR, LOG_TAG, "render paint (%p) type(%d)", this, (int) this->type);
+
     /* Note: only ClipPath is processed in update() step.
         Create a composition image. */
     if (cmpTarget && cmpMethod != CompositeMethod::ClipPath) {
@@ -194,6 +196,8 @@ void* Paint::Impl::update(RenderMethod& renderer, const RenderTransform* pTransf
         }
     }
 
+dlog_print(DLOG_ERROR, LOG_TAG, "update paint (%p) type(%d)", this, (int) this->type);
+
     /* 1. Composition Pre Processing */
     void *cmpData = nullptr;
     RenderRegion viewport;
@@ -316,4 +320,4 @@ Result Paint::opacity(uint8_t o) noexcept
 uint8_t Paint::opacity() const noexcept
 {
     return pImpl->opacity;
-}
\ No newline at end of file
+}
index 40f1e58..1ea5447 100644 (file)
@@ -58,22 +58,31 @@ struct Scene::Impl
 
     void* update(RenderMethod &renderer, const RenderTransform* transform, uint32_t opacity, Array<RenderData>& clips, RenderUpdateFlag flag)
     {
+dlog_print(DLOG_ERROR, LOG_TAG, "====> Update Scene(%p), paints count(%d)", this, paints.count);
+
         /* Overriding opacity value. If this scene is half-translucent,
            It must do intermeidate composition with that opacity value. */
         this->opacity = static_cast<uint8_t>(opacity);
         if (needComposition(opacity)) opacity = 255;
 
+
         for (auto paint = paints.data; paint < (paints.data + paints.count); ++paint) {
             (*paint)->pImpl->update(renderer, transform, opacity, clips, static_cast<uint32_t>(flag));
         }
 
         /* FXIME: it requires to return list of children engine data
            This is necessary for scene composition */
+
+dlog_print(DLOG_ERROR, LOG_TAG, "<==== Update Scene(%p), paints count(%d)", this, paints.count);
+
         return nullptr;
     }
 
     bool render(RenderMethod& renderer)
     {
+
+dlog_print(DLOG_ERROR, LOG_TAG, "====> Render Scene(%p), paints count(%d)", this, paints.count);
+
         Compositor* cmp = nullptr;
 
         if (needComposition(opacity)) {
@@ -87,6 +96,8 @@ struct Scene::Impl
 
         if (cmp) renderer.endComposite(cmp);
 
+dlog_print(DLOG_ERROR, LOG_TAG, "<==== Render Scene(%p), paints count(%d)", this, paints.count);
+
         return true;
     }
 
index 63ac4de..97eb16b 100644 (file)
@@ -167,6 +167,9 @@ static TaskSchedulerImpl* inst = nullptr;
 void TaskScheduler::init(unsigned threads)
 {
     if (inst) return;
+
+dlog_print(DLOG_ERROR, LOG_TAG, "Init TaskScheduler threads = %d", threads);
+
     inst = new TaskSchedulerImpl(threads);
 }
 
@@ -189,4 +192,4 @@ unsigned TaskScheduler::threads()
 {
     if (inst) return inst->threadCnt;
     return 0;
-}
\ No newline at end of file
+}
index f359855..af0cc33 100644 (file)
@@ -595,6 +595,8 @@ static Matrix* _parseTransformationMatrix(const char* value)
     char* str = (char*)value;
     char* end = str + strlen(str);
 
+ dlog_print(DLOG_ERROR, LOG_TAG, "_parseTransformationMatrix() - begin");
+
     while (str < end) {
         auto state = MatrixState::Unknown;
 
@@ -658,9 +660,15 @@ static Matrix* _parseTransformationMatrix(const char* value)
             _matrixCompose(matrix, &tmp, matrix);
         }
     }
+
+dlog_print(DLOG_ERROR, LOG_TAG, "_parseTransformationMatrix() - end");
+
     return matrix;
 error:
     if (matrix) free(matrix);
+
+dlog_print(DLOG_ERROR, LOG_TAG, "_parseTransformationMatrix() - error");
+
     return nullptr;
 }
 
@@ -2644,6 +2652,8 @@ bool SvgLoader::open(const string& path)
         this->size = filePath.size();
     }
 
+    dlog_print(DLOG_ERROR, LOG_TAG, "SvgLoader open(%p) - %s", this, path.c_str());
+
     return header();
 }
 
@@ -2652,8 +2662,12 @@ bool SvgLoader::read()
 {
     if (!content || size == 0) return false;
 
+    dlog_print(DLOG_ERROR, LOG_TAG, "SvgLoader read(%p) - before", this);
+
     TaskScheduler::request(this);
 
+    dlog_print(DLOG_ERROR, LOG_TAG, "SvgLoader read(%p) - after", this);
+
     return true;
 }
 
index b2be859..a5ddb75 100644 (file)
@@ -402,6 +402,8 @@ unique_ptr<Scene> svgSceneBuild(SvgNode* node)
 {
     if (!node || (node->type != SvgNodeType::Doc)) return nullptr;
 
+dlog_print(DLOG_ERROR, LOG_TAG, "svgSceneBuild() node(%p) - begin", node);
+
     auto vx = node->node.doc.vx;
     auto vy = node->node.doc.vy;
     auto vw = node->node.doc.vw;
@@ -427,5 +429,8 @@ unique_ptr<Scene> svgSceneBuild(SvgNode* node)
     } else {
         root = move(docNode);
     }
+
+dlog_print(DLOG_ERROR, LOG_TAG, "svgSceneBuild() - end");
+
     return root;
 }
index 7e19d03..d386e13 100644 (file)
@@ -17,7 +17,8 @@ subdir('loaders')
 subdir('bindings')
 
 thread_dep = meson.get_compiler('cpp').find_library('pthread')
-thorvg_lib_dep = [common_dep, loader_dep, binding_dep, thread_dep]
+dlog_dep = dependency('dlog', required: false)
+thorvg_lib_dep = [common_dep, loader_dep, binding_dep, thread_dep, dlog_dep]
 
 thorvg_lib = library(
        'thorvg',