[Tizen] Do not skip rendering if update required keep rendering
[platform/core/uifw/dali-adaptor.git] / dali / internal / adaptor / common / combined-update-render-controller.cpp
index b9598cc..712992d 100644 (file)
@@ -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.
@@ -117,6 +117,7 @@ CombinedUpdateRenderController::CombinedUpdateRenderController(AdaptorInternalSe
   mDefaultHalfFrameNanoseconds(0u),
   mUpdateRequestCount(0u),
   mRunning(FALSE),
+  mVsyncRender(TRUE),
   mThreadId(0),
   mThreadMode(threadMode),
   mUpdateRenderRunCount(0),
@@ -145,6 +146,8 @@ CombinedUpdateRenderController::CombinedUpdateRenderController(AdaptorInternalSe
     currentSurface->SetThreadSynchronization(*this);
   }
 
+  mVsyncRender = environmentOptions.VsyncRenderRequired();
+
   mSleepTrigger = TriggerEventFactory::CreateTriggerEvent(MakeCallback(this, &CombinedUpdateRenderController::ProcessSleepRequest), TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER);
 }
 
@@ -623,7 +626,7 @@ void CombinedUpdateRenderController::UpdateRenderThread()
   while(UpdateRenderReady(useElapsedTime, updateRequired, timeToSleepUntil))
   {
     LOG_UPDATE_RENDER_TRACE;
-    TRACE_UPDATE_RENDER_SCOPE("DALI_UPDATE_RENDER");
+    TRACE_UPDATE_RENDER_BEGIN("DALI_UPDATE_RENDER");
 
     // For thread safe
     bool                          uploadOnly     = mUploadWithoutRendering;
@@ -733,6 +736,12 @@ void CombinedUpdateRenderController::UpdateRenderThread()
       mNotificationTrigger.Trigger();
       LOG_UPDATE_RENDER("Notification Triggered");
     }
+  
+    if(uploadOnly && (keepUpdatingStatus & Dali::Integration::KeepUpdating::STAGE_KEEP_RENDERING))
+    {
+      // Render forcely if there exist some keep rendering required.
+      uploadOnly = false;
+    }
 
     // Optional logging of update/render status
     mUpdateStatusLogger.Log(keepUpdatingStatus);
@@ -827,6 +836,10 @@ void CombinedUpdateRenderController::UpdateRenderThread()
         }
       }
     }
+    else
+    {
+      DALI_LOG_RELEASE_INFO("DALI Rendering skip (upload only)\n");
+    }
 
     TRACE_UPDATE_RENDER_BEGIN("DALI_POST_RENDER");
     if(!uploadOnly)
@@ -909,8 +922,10 @@ void CombinedUpdateRenderController::UpdateRenderThread()
       }
     }
 
+    TRACE_UPDATE_RENDER_END("DALI_UPDATE_RENDER");
+
     // Render to FBO is intended to measure fps above 60 so sleep is not wanted.
-    if(0u == renderToFboInterval)
+    if(mVsyncRender && 0u == renderToFboInterval)
     {
       TRACE_UPDATE_RENDER_SCOPE("DALI_UPDATE_RENDER_SLEEP");
       // Sleep until at least the the default frame duration has elapsed. This will return immediately if the specified end-time has already passed.