From: Hermet Park Date: Wed, 14 Apr 2021 02:50:09 +0000 (+0900) Subject: ** Temporary patch for diagnosing some hideous bugs in Tizen ** X-Git-Tag: accepted/tizen/unified/20210415.000533^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9996be4c047b5b3b9ced9fabe3c4b888ed795cff;p=platform%2Fcore%2Fgraphics%2Ftizenvg.git ** Temporary patch for diagnosing some hideous bugs in Tizen ** This patch puts some prints for analizing a crash issue, it must be reverted after fixing it. Change-Id: Iac2db25da27aa85dcfef19d05ced887d821584de --- diff --git a/packaging/thorvg.spec b/packaging/thorvg.spec index e0657bc..b24fec5 100644 --- a/packaging/thorvg.spec +++ b/packaging/thorvg.spec @@ -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 diff --git a/src/lib/tvgCanvas.cpp b/src/lib/tvgCanvas.cpp index 309e205..f886c74 100644 --- a/src/lib/tvgCanvas.cpp +++ b/src/lib/tvgCanvas.cpp @@ -51,24 +51,32 @@ Result Canvas::push(unique_ptr 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; diff --git a/src/lib/tvgCanvasImpl.h b/src/lib/tvgCanvasImpl.h index 2772a23..b5c22c8 100644 --- a/src/lib/tvgCanvasImpl.h +++ b/src/lib/tvgCanvasImpl.h @@ -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; } }; diff --git a/src/lib/tvgCommon.h b/src/lib/tvgCommon.h index f5d4a6d..8fcb681 100644 --- a/src/lib/tvgCommon.h +++ b/src/lib/tvgCommon.h @@ -22,6 +22,7 @@ #ifndef _TVG_COMMON_H_ #define _TVG_COMMON_H_ +#include #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_ diff --git a/src/lib/tvgInitializer.cpp b/src/lib/tvgInitializer.cpp index c91e13e..e144fb6 100644 --- a/src/lib/tvgInitializer.cpp +++ b/src/lib/tvgInitializer.cpp @@ -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(engine) & static_cast(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(engine) & static_cast(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 +} diff --git a/src/lib/tvgPaint.cpp b/src/lib/tvgPaint.cpp index aca756f..5e20587 100644 --- a/src/lib/tvgPaint.cpp +++ b/src/lib/tvgPaint.cpp @@ -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 +} diff --git a/src/lib/tvgSceneImpl.h b/src/lib/tvgSceneImpl.h index 40f1e58..1ea5447 100644 --- a/src/lib/tvgSceneImpl.h +++ b/src/lib/tvgSceneImpl.h @@ -58,22 +58,31 @@ struct Scene::Impl void* update(RenderMethod &renderer, const RenderTransform* transform, uint32_t opacity, Array& 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(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(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; } diff --git a/src/lib/tvgTaskScheduler.cpp b/src/lib/tvgTaskScheduler.cpp index 63ac4de..97eb16b 100644 --- a/src/lib/tvgTaskScheduler.cpp +++ b/src/lib/tvgTaskScheduler.cpp @@ -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 +} diff --git a/src/loaders/svg/tvgSvgLoader.cpp b/src/loaders/svg/tvgSvgLoader.cpp index f359855..af0cc33 100644 --- a/src/loaders/svg/tvgSvgLoader.cpp +++ b/src/loaders/svg/tvgSvgLoader.cpp @@ -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; } diff --git a/src/loaders/svg/tvgSvgSceneBuilder.cpp b/src/loaders/svg/tvgSvgSceneBuilder.cpp index b2be859..a5ddb75 100644 --- a/src/loaders/svg/tvgSvgSceneBuilder.cpp +++ b/src/loaders/svg/tvgSvgSceneBuilder.cpp @@ -402,6 +402,8 @@ unique_ptr 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 svgSceneBuild(SvgNode* node) } else { root = move(docNode); } + +dlog_print(DLOG_ERROR, LOG_TAG, "svgSceneBuild() - end"); + return root; } diff --git a/src/meson.build b/src/meson.build index 7e19d03..d386e13 100644 --- a/src/meson.build +++ b/src/meson.build @@ -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',