[Tizen] Allow to ignore Vsync rendering by environment 45/305145/2
authorEunki, Hong <eunkiki.hong@samsung.com>
Mon, 29 Jan 2024 08:02:53 +0000 (17:02 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Tue, 30 Jan 2024 09:56:22 +0000 (18:56 +0900)
Let we allow to ignore vsync waiting if user don't want, by environment.

Change-Id: I22d15594a145c32e633816f5f2c7560bd47d7934
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
dali/internal/adaptor/common/combined-update-render-controller.cpp
dali/internal/adaptor/common/combined-update-render-controller.h
dali/internal/system/common/environment-options.cpp
dali/internal/system/common/environment-options.h
dali/internal/system/common/environment-variables.h

index 1a67112ea8e8c44379021011245d829266829395..91c5263c561aa8f2e741fb11d35e68703189c168 100644 (file)
@@ -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);
 }
 
@@ -929,7 +932,7 @@ 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.
index 8c7bea31a6f7fa33787a6368e8a0c07712a808e1..35505fed2eb860e6244d0a7cee5d9bb85d111346 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_COMBINED_UPDATE_RENDER_CONTROLLER_H
 
 /*
- * 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.
@@ -376,6 +376,7 @@ private:
 
   uint32_t mUpdateRequestCount; ///< Count of update-requests we have received to ensure we do not go to sleep too early.
   uint32_t mRunning;            ///< Read and set on the event-thread only to state whether we are running.
+  uint32_t mVsyncRender;        ///< Whether vsync render required or not.
   int32_t  mThreadId;           ///< UpdateRender thread id
 
   ThreadMode mThreadMode; ///< Whether the thread runs continuously or runs when it is requested.
index d1b082928163ada586b46284219720264910bd6c..932336e999f606e800041cc470d91101fbad2df7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 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.
@@ -41,6 +41,7 @@ const int          DEFAULT_MULTI_SAMPLING_LEVEL            = -1;
 const bool         DEFAULT_DEPTH_BUFFER_REQUIRED_SETTING   = true;
 const bool         DEFAULT_STENCIL_BUFFER_REQUIRED_SETTING = true;
 const bool         DEFAULT_PARTIAL_UPDATE_REQUIRED_SETTING = true;
+const bool         DEFAULT_VSYNC_RENDER_REQUIRED_SETTING   = true;
 
 unsigned int GetEnvironmentVariable(const char* variable, unsigned int defaultValue)
 {
@@ -246,7 +247,8 @@ EnvironmentOptions::EnvironmentOptions()
   mGlesCallAccumulate(false),
   mDepthBufferRequired(DEFAULT_DEPTH_BUFFER_REQUIRED_SETTING),
   mStencilBufferRequired(DEFAULT_STENCIL_BUFFER_REQUIRED_SETTING),
-  mPartialUpdateRequired(DEFAULT_PARTIAL_UPDATE_REQUIRED_SETTING)
+  mPartialUpdateRequired(DEFAULT_PARTIAL_UPDATE_REQUIRED_SETTING),
+  mVsyncRenderRequired(DEFAULT_VSYNC_RENDER_REQUIRED_SETTING)
 {
   ParseEnvironmentOptions();
 }
@@ -520,6 +522,11 @@ bool EnvironmentOptions::PartialUpdateRequired() const
   return mPartialUpdateRequired;
 }
 
+bool EnvironmentOptions::VsyncRenderRequired() const
+{
+  return mVsyncRenderRequired;
+}
+
 void EnvironmentOptions::ParseEnvironmentOptions()
 {
   // get logging options
@@ -612,6 +619,8 @@ void EnvironmentOptions::ParseEnvironmentOptions()
   SetFromEnvironmentVariable<int>(DALI_ENV_DISABLE_STENCIL_BUFFER, DisableIfNonZero(mStencilBufferRequired));
 
   SetFromEnvironmentVariable<int>(DALI_ENV_DISABLE_PARTIAL_UPDATE, DisableIfNonZero(mPartialUpdateRequired));
+
+  SetFromEnvironmentVariable<int>(DALI_ENV_DISABLE_VSYNC_RENDER, DisableIfNonZero(mVsyncRenderRequired));
 }
 
 } // namespace Adaptor
index d6bf0cec800b906c5a259c0679bd4b1993ffe96c..61f9607df2dc2031647052fa5a63fba7695b309f 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_ADAPTOR_ENVIRONMENT_OPTIONS_H
 
 /*
- * 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.
@@ -331,6 +331,11 @@ public:
    */
   bool PartialUpdateRequired() const;
 
+  /**
+   * @return Whether the vsync render is required.
+   */
+  bool VsyncRenderRequired() const;
+
   /// Deleted copy constructor.
   EnvironmentOptions(const EnvironmentOptions&) = delete;
 
@@ -404,6 +409,7 @@ private: // Data
   bool mDepthBufferRequired;   ///< Whether the depth buffer is required
   bool mStencilBufferRequired; ///< Whether the stencil buffer is required
   bool mPartialUpdateRequired; ///< Whether the partial update is required
+  bool mVsyncRenderRequired;   ///< Whether the vsync render is required
 
   std::unique_ptr<TraceManager> mTraceManager; ///< TraceManager
 };
index 42a469914c7f7a16ed15ab799c480125532dc51d..63ea73f7d44dd060a0f2090e1f0bff9355fbc126 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_ADAPTOR_ENVIRONMENT_VARIABLES_H
 
 /*
- * 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.
@@ -149,6 +149,8 @@ namespace Adaptor
 
 #define DALI_ENV_ENABLE_UI_THREAD "DALI_ENABLE_UI_THREAD"
 
+#define DALI_ENV_DISABLE_VSYNC_RENDER "DALI_DISABLE_VSYNC_RENDER"
+
 // Debug relative environments
 #define DALI_ENV_CURLOPT_VERBOSE_MODE "DALI_CURLOPT_VERBOSE_MODE"