Revert "Fix thread contention issues in messages and pan gestures." 10/49210/2
authorKimmo Hoikka <kimmo.hoikka@samsung.com>
Thu, 8 Oct 2015 12:26:52 +0000 (05:26 -0700)
committerKimmo Hoikka <kimmo.hoikka@samsung.com>
Thu, 8 Oct 2015 12:49:55 +0000 (05:49 -0700)
This reverts commit 8be6860f402e22fa57088a25993e8340a85e812d.

Change-Id: I85d4f5ed09fff79fd790222ff41f80cb6952ea94

dali/internal/common/message-buffer.cpp
dali/internal/common/message-buffer.h
dali/internal/render/common/render-manager.cpp
dali/internal/render/common/render-manager.h
dali/internal/render/queue/render-queue.cpp
dali/internal/render/queue/render-queue.h
dali/internal/update/gestures/scene-graph-pan-gesture.cpp
dali/internal/update/gestures/scene-graph-pan-gesture.h

index 22822aa..869bcfc 100644 (file)
@@ -64,7 +64,6 @@ MessageBuffer::~MessageBuffer()
 
 unsigned int* MessageBuffer::ReserveMessageSlot( std::size_t size )
 {
-  Dali::Mutex::ScopedLock lock(mMutex);
   DALI_ASSERT_DEBUG( 0 != size );
 
   // Number of aligned words required to handle a message of size in bytes
index d731b9d..8e1a17a 100644 (file)
@@ -21,9 +21,6 @@
 // EXTERNAL INCLUDES
 #include <cstddef>
 
-// INTERNAL INCLUDES
-#include <dali/devel-api/common/mutex.h>
-
 namespace Dali
 {
 
@@ -146,7 +143,6 @@ private:
 
   std::size_t mCapacity; ///< The memory allocated with respect to sizeof(WordType)
   std::size_t mSize;     ///< The memory reserved for messages with respect to sizeof(WordType)
-  Dali::Mutex mMutex;    ///< Mutex to ensure correct access locking
 };
 
 } // namespace Internal
index 2c8d7b2..fcaf135 100644 (file)
@@ -148,7 +148,7 @@ struct RenderManager::Impl
 
   Vector4                       backgroundColor;          ///< The glClear color used at the beginning of each frame.
 
-  volatile float                frameTime;                ///< The elapsed time since the previous frame
+  float                         frameTime;                ///< The elapsed time since the previous frame
   float                         lastFrameTime;            ///< Last frame delta.
 
   unsigned int                  frameCount;               ///< The current frame count
@@ -247,7 +247,6 @@ void RenderManager::SetBackgroundColor( const Vector4& color )
 
 void RenderManager::SetFrameDeltaTime( float deltaTime )
 {
-  Dali::Mutex::ScopedLock lock( mMutex );
   mImpl->frameTime = deltaTime;
 }
 
@@ -445,7 +444,8 @@ bool RenderManager::Render( Integration::RenderStatus& status )
 
   PERF_MONITOR_END(PerformanceMonitor::DRAW_NODES);
 
-  SetLastFrameTime();
+  // Update the frame time
+  mImpl->lastFrameTime = mImpl->frameTime;
 
   // check if anything has been posted to the update thread
   bool updateRequired = !mImpl->resourcePostProcessQueue[ mImpl->renderBufferIndex ].empty();
@@ -471,12 +471,6 @@ bool RenderManager::Render( Integration::RenderStatus& status )
   return updateRequired;
 }
 
-void RenderManager::SetLastFrameTime()
-{
-  Dali::Mutex::ScopedLock lock(mMutex);
-  mImpl->lastFrameTime = mImpl->frameTime;
-}
-
 void RenderManager::DoRender( RenderInstruction& instruction, Shader& defaultShader, float elapsedTime )
 {
   Rect<int> viewportRect;
index 150e401..04aecdc 100644 (file)
@@ -19,7 +19,6 @@
  */
 
 // INTERNAL INCLUDES
-#include <dali/devel-api/common/mutex.h>
 #include <dali/public-api/math/rect.h>
 #include <dali/internal/common/shader-saver.h>
 #include <dali/internal/render/common/post-process-resource-dispatcher.h>
@@ -245,14 +244,10 @@ private:
   // Undefined
   RenderManager& operator=( const RenderManager& rhs );
 
-  // Set the last frame time while locking access
-  void SetLastFrameTime();
-
 private:
 
   struct Impl;
   Impl* mImpl;
-  Dali::Mutex mMutex;
 
 };
 
index 6c137e9..0eda995 100644 (file)
@@ -42,14 +42,12 @@ RenderQueue::RenderQueue()
 : container0( NULL ),
   container1( NULL )
 {
-  Dali::Mutex::ScopedLock lock(mMutex);
   container0 = new MessageBuffer( INITIAL_BUFFER_SIZE );
   container1 = new MessageBuffer( INITIAL_BUFFER_SIZE );
 }
 
 RenderQueue::~RenderQueue()
 {
-  Dali::Mutex::ScopedLock lock(mMutex);
   if( container0 )
   {
     for( MessageBuffer::Iterator iter = container0->Begin(); iter.IsValid(); iter.Next() )
@@ -79,7 +77,6 @@ RenderQueue::~RenderQueue()
 
 unsigned int* RenderQueue::ReserveMessageSlot( BufferIndex updateBufferIndex, std::size_t size )
 {
-  Dali::Mutex::ScopedLock lock(mMutex);
   MessageBuffer* container = GetCurrentContainer( updateBufferIndex );
 
   return container->ReserveMessageSlot( size );
@@ -87,7 +84,6 @@ unsigned int* RenderQueue::ReserveMessageSlot( BufferIndex updateBufferIndex, st
 
 void RenderQueue::ProcessMessages( BufferIndex bufferIndex )
 {
-  Dali::Mutex::ScopedLock lock(mMutex);
   MessageBuffer* container = GetCurrentContainer( bufferIndex );
 
   for( MessageBuffer::Iterator iter = container->Begin(); iter.IsValid(); iter.Next() )
index cdf458f..246f67f 100644 (file)
@@ -19,7 +19,6 @@
  */
 
 // INTERNAL INCLUDES
-#include <dali/devel-api/common/mutex.h>
 #include <dali/internal/common/buffer-index.h>
 #include <dali/internal/common/message-buffer.h>
 
@@ -92,7 +91,6 @@ private:
 
 private:
 
-  Dali::Mutex mMutex;        ///< Mutex to ensure access locking
   MessageBuffer* container0; ///< Messages are queued here when the update buffer index == 0
   MessageBuffer* container1; ///< Messages are queued here when the update buffer index == 1
 };
index 31e10b7..d8a119a 100644 (file)
@@ -62,7 +62,6 @@ PanGesture::~PanGesture()
 
 void PanGesture::AddGesture( const Dali::PanGesture& gesture )
 {
-  Dali::Mutex::ScopedLock lock( mMutex );
   mGestures[ mWritePosition ] = gesture;
 
   // Update our write position.
@@ -299,7 +298,6 @@ bool PanGesture::ReadGestures( FrameGestureInfo& info, unsigned int currentTimes
 bool PanGesture::ReadAndResampleGestures( FrameGestureInfo& info, unsigned int currentTimestamp )
 {
   PanInfo lastReadGesture;
-  Dali::Mutex::ScopedLock lock( mMutex );
   while( mReadPosition != mWritePosition )
   {
     // Copy the gesture first
index bb322d9..5758a4a 100644 (file)
@@ -19,7 +19,6 @@
  */
 
 // INTERNAL INCLUDES
-#include <dali/devel-api/common/mutex.h>
 #include <dali/public-api/common/vector-wrapper.h>
 #include <dali/public-api/events/pan-gesture.h>
 #include <dali/internal/update/common/property-owner.h>
@@ -393,7 +392,7 @@ private:
   PanInfo mLastGesture;                       ///< The last gesture. (last update frame).
   PanInfo mTargetGesture;                     ///< The most recent input gesture, if the current used gesture does not match.
   PanInfo mLastUnmodifiedGesture;             ///< The last gesture before any processing was done on it.
-  volatile unsigned int mWritePosition;       ///< The next PanInfo buffer to write to. (starts at 0).
+  unsigned int mWritePosition;                ///< The next PanInfo buffer to write to. (starts at 0).
   unsigned int mReadPosition;                 ///< The next PanInfo buffer to read. (starts at 0).
   bool mNotAtTarget;                          ///< Keeps track of if the last gesture used was the most recent received.
   bool mInGesture;                            ///< True if the gesture is currently being handled i.e. between Started <-> Finished/Cancelled.
@@ -407,7 +406,6 @@ private:
   SmoothingMode mSmoothingMode;               ///< The pan gesture prediction mode
   float         mSmoothingAmount;             ///< How much smoothing to apply [0.0f,1.0f]
   PanGestureProfiling* mProfiling;            ///< NULL unless pan-gesture profiling information is required.
-  Dali::Mutex mMutex;                         ///< Mutex to lock access.
 };
 
 } // namespace SceneGraph