Update contrib.
1 // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef OPENWFCJOBMANAGER_H_
17 #define OPENWFCJOBMANAGER_H_
24 #include <graphics/eglsynchelper.h>
27 class COpenWfcWrapper;
28 class COpenWfcMonitorThread;
31 #if defined(ENABLE_JQ_LOGGING)
32 #define JQLOG(X) RDebug::Printf X
38 * Controls the OpenWF composition
40 class COpenWfcJobManger : public CBase
46 EOpenWfcInvalidJobId = 0,
48 EOpenWfcPauseCompositionJobId,
49 EOpenWfcResumeCompositionJobId,
53 * Stores the parameters associated with a composition
55 struct TComposeRequestDetails
57 TComposeRequestDetails();
58 void Set(TRequestStatus* aCommitRequest, TThreadId aCallingThread);
60 TRequestStatus* iCommitRequest;
61 TThreadId iCallingThread;
66 * Auxilliary class to insure the release of a lock
79 * Two-phased constructor.
81 static COpenWfcJobManger* NewL(COpenWfcWrapper& aOpenWfcWrapper,
87 * Two-phased constructor.
89 static COpenWfcJobManger* NewLC(COpenWfcWrapper& aOpenWfcWrapper,
96 virtual ~COpenWfcJobManger();
99 * Request to compose the specified scene
101 * @param aCompleted The notification to be returned when the composition completes
102 * @param aUpdatePolicy Update policy to be used
103 * @param the Pointer to the first element from the element list containing the scene to be used by the next commit
106 void ComposeRequest(TRequestStatus* aCompleted);
109 * Request to pause the composition
111 void CompositionPauseRequest();
113 * Request to resume the composition
115 void CompositionResumeRequest();
118 * Appends to the compose details list the first detail object from the compose detail list
120 * @return NULL if the compose detail pool is empty or a pointer to the appended detail object
122 TComposeRequestDetails* AppendDetailsFromPool();
125 * Executes an outstanding command, if any.
132 * Executes a compose request.
133 * Intended to be invoked by a job
135 * @param Reference to the invoking job
140 * Executes a pause composition request
141 * Intended to be invoked by a job
143 * @param Reference to the invoking job
145 void DoPauseCompositionJob();
148 * Executes a resume composition request.
149 * Intended to be invoked by a job
151 * @param Reference to the invoking job
153 void DoResumeCompositionJob();
156 * Private constructor
158 COpenWfcJobManger(COpenWfcWrapper& aOpenWfcWrapper,
164 * Symbian constructor used with the two stage construction pattern
169 * Implements a fence operation
174 * Waits until the sync is signalled
179 * Activates the composition on the current context
184 * Deactivates the composition on the current context
189 * Execute a composition on the current context
194 * Execute a commit on the current context
199 * Completes all the outstanding requests stored locally
201 void CompleteComposeRequests(TInt aResult);
204 * Completes all the outstanding pause/resumerequests requests
206 void CompletePauseResumeRequest(TInt aResult);
210 TDblQue<TComposeRequestDetails> iComposeDetailsPool;
211 TDblQueIter<TComposeRequestDetails> iComposeDetailsPoolIter;
212 TDblQue<TComposeRequestDetails> iComposeDetailsList;
213 TDblQueIter<TComposeRequestDetails> iComposeDetailsListIter;
216 COpenWfcWrapper& iOpenWfcWrapper;
219 volatile TBool iCompositionPaused;
220 volatile TBool iPausedComposePending;
221 COpenWfcMonitorThread* iThreadManager;
224 EGLDisplay iEglDisplay;
225 TRequestStatus iPauseResumeRequestStatus;
226 TThreadId iPauseResumeThread;
227 EOpenWfcJobId iOutstandingJob;
228 static const TInt KComposeDetailsPoolSize = 16;
231 inline void COpenWfcJobManger::Fence()
233 wfcFence(iDevice, iContext, iEglDisplay, iSync);
236 inline void COpenWfcJobManger::WaitForSync()
238 EGLTimeKHR timeout = (EGLTimeKHR) EGL_FOREVER_KHR;
239 eglClientWaitSyncKHR(iEglDisplay, iSync, 0, timeout);
242 inline void COpenWfcJobManger::Activate()
244 wfcActivate(iDevice, iContext);
247 inline void COpenWfcJobManger::Deactivate()
249 wfcDeactivate(iDevice, iContext);
252 inline void COpenWfcJobManger::Compose()
254 wfcCompose(iDevice, iContext, WFC_TRUE);
257 inline void COpenWfcJobManger::Commit()
259 wfcCommit(iDevice, iContext, WFC_TRUE);
262 #endif /* OPENWFCJOBMANAGER_H_ */