2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 #include <dali/internal/render/common/render-tracker.h>
21 #include <dali/integration-api/gl-sync-abstraction.h>
22 #include <dali/internal/render/common/render-tracker-debug.h>
34 RenderTracker::RenderTracker(Integration::GlSyncAbstraction& glSyncAbstraction)
35 : mGlSyncAbstraction(glSyncAbstraction),
39 TRACKER_LOG(Debug::Verbose);
42 RenderTracker::~RenderTracker()
44 TRACKER_LOG(Debug::Verbose);
47 mGlSyncAbstraction.DestroySyncObject( mSyncObject );
52 void RenderTracker::CreateSyncObject()
54 TRACKER_LOG(Debug::General);
56 // Destroy any previous sync object
59 mGlSyncAbstraction.DestroySyncObject( mSyncObject );
63 mSyncObject = mGlSyncAbstraction.CreateSyncObject( );
66 void RenderTracker::PollSyncObject()
68 if( mSyncObject && mSyncObject->IsSynced() )
71 mGlSyncAbstraction.DestroySyncObject( mSyncObject );
74 TRACKER_LOG_FMT(Debug::General, " Synced\n");
77 TRACKER_LOG_FMT(Debug::General, " Not Synced\n");
80 bool RenderTracker::IsSynced()
82 int x = __sync_val_compare_and_swap(&mSyncTrigger, 0xFF, 0x0);
84 TRACKER_LOG_FMT(Debug::General, " = %s\n", x!=0?"T":"F");
88 void RenderTracker::ResetSyncFlag()
90 TRACKER_LOG(Debug::General);
91 (void)__sync_lock_test_and_set(&mSyncTrigger, 0x0);
94 void RenderTracker::SetSyncFlag()
96 (void)__sync_lock_test_and_set(&mSyncTrigger, 0xFF);