Allow to ignore Vsync rendering by environment 44/305144/3
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 02:54:38 +0000 (11:54 +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 48b7f25..2530a70 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);
 }
 
@@ -912,7 +915,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 8c7bea3..35505fe 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 d1b0829..932336e 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 d6bf0ce..61f9607 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 42a4699..63ea73f 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"