2 * Copyright (c) 2015 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>
36 RenderTracker::RenderTracker()
37 : mGlSyncAbstraction( NULL ),
41 TRACKER_LOG(Debug::Verbose);
44 RenderTracker::~RenderTracker()
46 TRACKER_LOG(Debug::Verbose);
49 mGlSyncAbstraction->DestroySyncObject( mSyncObject );
54 void RenderTracker::CreateSyncObject( Integration::GlSyncAbstraction& glSyncAbstraction )
56 mGlSyncAbstraction = &glSyncAbstraction;
57 TRACKER_LOG(Debug::General);
59 // Destroy any previous sync object
62 mGlSyncAbstraction->DestroySyncObject( mSyncObject );
66 mSyncObject = mGlSyncAbstraction->CreateSyncObject();
69 void RenderTracker::PollSyncObject()
71 if( mSyncObject && mSyncObject->IsSynced() )
74 mGlSyncAbstraction->DestroySyncObject( mSyncObject );
77 TRACKER_LOG_FMT(Debug::General, " Synced\n");
80 TRACKER_LOG_FMT(Debug::General, " Not Synced\n");
83 bool RenderTracker::IsSynced()
86 bool ret = mSyncTrigger.compare_exchange_strong( flag, 0 );
88 TRACKER_LOG_FMT( Debug::General, " = %s\n", true == ret ? "T" : "F" );
92 void RenderTracker::ResetSyncFlag()
94 TRACKER_LOG(Debug::General);
96 mSyncTrigger.compare_exchange_strong( flag, 0 );
99 void RenderTracker::SetSyncFlag()
102 mSyncTrigger.compare_exchange_strong( flag, 0xFF );