From 1059a9c1390d3f102ceb655d2c6854517f11dbcf Mon Sep 17 00:00:00 2001 From: "Eunki, Hong" Date: Thu, 2 May 2024 15:58:19 +0900 Subject: [PATCH] Print logs if dali skip rendering Change-Id: I9ddca01a172b742c60b4d01c3d997306b0710d5f Signed-off-by: Eunki, Hong --- automated-tests/src/dali/utc-Dali-Scene.cpp | 114 +++++++++++++++++- .../internal/render/common/render-manager.cpp | 12 +- 2 files changed, 122 insertions(+), 4 deletions(-) diff --git a/automated-tests/src/dali/utc-Dali-Scene.cpp b/automated-tests/src/dali/utc-Dali-Scene.cpp index d98c8695a..996146119 100644 --- a/automated-tests/src/dali/utc-Dali-Scene.cpp +++ b/automated-tests/src/dali/utc-Dali-Scene.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * Copyright (c) 2024 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -3078,8 +3078,8 @@ int UtcDaliSceneGetNativeId(void) { TestApplication application; // Initializes - Dali::Integration::Scene scene = application.GetScene(); - int32_t nativeId = scene.GetNativeId(); + Dali::Integration::Scene scene = application.GetScene(); + int32_t nativeId = scene.GetNativeId(); DALI_TEST_EQUALS(nativeId, 0, TEST_LOCATION); // Test that setting native id @@ -3088,3 +3088,111 @@ int UtcDaliSceneGetNativeId(void) DALI_TEST_EQUALS(nativeId, 1, TEST_LOCATION); END_TEST; } + +int UtcDaliSceneRemoveSceneObjectAndRender01(void) +{ + tet_infoline("Test that removing a scene object and rendering does not crash"); + + TestApplication application( + TestApplication::DEFAULT_SURFACE_WIDTH, + TestApplication::DEFAULT_SURFACE_HEIGHT, + TestApplication::DEFAULT_HORIZONTAL_DPI, + TestApplication::DEFAULT_VERTICAL_DPI, + true, + true); + + auto defaultScene = application.GetScene(); + DALI_TEST_CHECK(defaultScene); + + Actor actor1 = CreateRenderableActor(); + actor1.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS); + actor1.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f)); + defaultScene.Add(actor1); + + // Create a Scene + Dali::Integration::Scene scene = Dali::Integration::Scene::New(Size(480.0f, 800.0f)); + DALI_TEST_CHECK(scene); + + application.AddScene(scene); + + Actor actor2 = CreateRenderableActor(); + actor2.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS); + actor2.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f)); + scene.Add(actor2); + + // Render and notify. + application.SendNotification(); + application.Render(0); + + scene.RemoveSceneObject(); // Scene's scene graph lifecycle is NOT managed by scene handle + + // Partial Render and notify. + application.SendNotification(); + application.RenderWithPartialUpdate(0, TEST_LOCATION); + + // Render and notify. + application.SendNotification(); + application.Render(0); + + scene.Discard(); + scene.Reset(); + + application.SendNotification(); + application.Render(0); + + END_TEST; +} + +int UtcDaliSceneRemoveSceneObjectAndRender02(void) +{ + tet_infoline("Same UTC with UtcDaliSceneRemoveSceneObjectAndRender01, but let we make application doesn't use PartialUpdate"); + + TestApplication application( + TestApplication::DEFAULT_SURFACE_WIDTH, + TestApplication::DEFAULT_SURFACE_HEIGHT, + TestApplication::DEFAULT_HORIZONTAL_DPI, + TestApplication::DEFAULT_VERTICAL_DPI, + true, + false); + + auto defaultScene = application.GetScene(); + DALI_TEST_CHECK(defaultScene); + + Actor actor1 = CreateRenderableActor(); + actor1.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS); + actor1.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f)); + defaultScene.Add(actor1); + + // Create a Scene + Dali::Integration::Scene scene = Dali::Integration::Scene::New(Size(480.0f, 800.0f)); + DALI_TEST_CHECK(scene); + + application.AddScene(scene); + + Actor actor2 = CreateRenderableActor(); + actor2.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS); + actor2.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f)); + scene.Add(actor2); + + // Render and notify. + application.SendNotification(); + application.Render(0); + + scene.RemoveSceneObject(); // Scene's scene graph lifecycle is NOT managed by scene handle + + // Partial Render and notify. + application.SendNotification(); + application.RenderWithPartialUpdate(0, TEST_LOCATION); + + // Render and notify. + application.SendNotification(); + application.Render(0); + + scene.Discard(); + scene.Reset(); + + application.SendNotification(); + application.Render(0); + + END_TEST; +} \ No newline at end of file diff --git a/dali/internal/render/common/render-manager.cpp b/dali/internal/render/common/render-manager.cpp index 1747bcc33..a74754a71 100644 --- a/dali/internal/render/common/render-manager.cpp +++ b/dali/internal/render/common/render-manager.cpp @@ -538,6 +538,14 @@ void RenderManager::PreRender(Integration::Scene& scene, std::vector>& if(!sceneObject || sceneObject->IsRenderingSkipped()) { // We don't need to calculate dirty rects + if(!sceneObject) + { + DALI_LOG_ERROR("Scene was empty handle. Skip pre-rendering\n"); + } + else + { + DALI_LOG_RELEASE_INFO("RenderingSkipped was set true. Skip pre-rendering\n"); + } return; } @@ -782,6 +790,7 @@ void RenderManager::RenderScene(Integration::RenderStatus& status, Integration:: SceneGraph::Scene* sceneObject = GetImplementation(scene).GetSceneObject(); if(!sceneObject) { + DALI_LOG_ERROR("Scene was empty handle. Skip rendering\n"); return; } @@ -793,7 +802,7 @@ void RenderManager::RenderScene(Integration::RenderStatus& status, Integration:: { if(mImpl->partialUpdateAvailable == Integration::PartialUpdateAvailable::TRUE && !renderToFbo && clippingRect.IsEmpty()) { - // ClippingRect is empty. Skip rendering + DALI_LOG_DEBUG_INFO("ClippingRect was empty. Skip rendering\n"); return; } @@ -806,6 +815,7 @@ void RenderManager::RenderScene(Integration::RenderStatus& status, Integration:: SceneGraph::Scene* sceneObject = sceneInternal.GetSceneObject(); if(!sceneObject) { + DALI_LOG_ERROR("Scene was empty handle. Skip rendering\n"); return; } -- 2.34.1