2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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.
19 #include <dali/internal/render/common/render-tracker.h>
22 #include <dali/integration-api/gl-sync-abstraction.h>
23 #include <dali/internal/render/common/render-tracker-debug.h>
35 RenderTracker::RenderTracker(Integration::GlSyncAbstraction& glSyncAbstraction)
36 : mGlSyncAbstraction(glSyncAbstraction),
40 TRACKER_LOG(Debug::Verbose);
43 RenderTracker::~RenderTracker()
45 TRACKER_LOG(Debug::Verbose);
48 mGlSyncAbstraction.DestroySyncObject( mSyncObject );
53 void RenderTracker::CreateSyncObject()
55 TRACKER_LOG(Debug::General);
57 // Destroy any previous sync object
60 mGlSyncAbstraction.DestroySyncObject( mSyncObject );
64 mSyncObject = mGlSyncAbstraction.CreateSyncObject( );
67 void RenderTracker::PollSyncObject()
69 if( mSyncObject && mSyncObject->IsSynced() )
72 mGlSyncAbstraction.DestroySyncObject( mSyncObject );
75 TRACKER_LOG_FMT(Debug::General, " Synced\n");
78 TRACKER_LOG_FMT(Debug::General, " Not Synced\n");
81 bool RenderTracker::IsSynced()
83 int x = __sync_val_compare_and_swap(&mSyncTrigger, 0xFF, 0x0);
85 TRACKER_LOG_FMT(Debug::General, " = %s\n", x!=0?"T":"F");
89 void RenderTracker::ResetSyncFlag()
91 TRACKER_LOG(Debug::General);
92 (void)__sync_lock_test_and_set(&mSyncTrigger, 0x0);
95 void RenderTracker::SetSyncFlag()
97 (void)__sync_lock_test_and_set(&mSyncTrigger, 0xFF);