|
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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // SurfaceStream.h |
|
15 // CSurfaceStream declaration |
|
16 |
|
17 #ifndef SURFACESTREAM_H |
|
18 #define SURFACESTREAM_H |
|
19 |
|
20 // INCLUDES |
|
21 #include <e32base.h> |
|
22 #include <e32def.h> |
|
23 #include <e32debug.h> |
|
24 #include <graphics/surface.h> |
|
25 #include <pixelformats.h> |
|
26 #include <graphics/surfacemanager.h> |
|
27 #include "symbianstream.h" |
|
28 |
|
29 #if defined(ENABLE_NF_LOGGING) |
|
30 #define NFLOG(X) RDebug::Printf X |
|
31 #else |
|
32 #define NFLOG(X) |
|
33 #endif |
|
34 |
|
35 // CLASS DECLARATION |
|
36 |
|
37 // Each surface buffer has its corresponding TBufferInfo to hold reference count and memory offset |
|
38 struct TBufferInfo |
|
39 { |
|
40 TInt iRefCount; |
|
41 TInt iOffset; |
|
42 }; |
|
43 |
|
44 // Notification data |
|
45 struct TNotificationBase |
|
46 { |
|
47 TRequestStatus* iStatus; |
|
48 TThreadId iThreadId; |
|
49 TInt iBufferNumber; |
|
50 TInt iSerialNumber; |
|
51 TInt iGlobalIndex; |
|
52 }; |
|
53 |
|
54 struct TNotificationDisplayed: public TNotificationBase |
|
55 { |
|
56 TUint32* iTimeStamp; |
|
57 }; |
|
58 |
|
59 struct TNotificationDisplayedX: public TNotificationBase |
|
60 { |
|
61 TInt iCount; |
|
62 }; |
|
63 |
|
64 struct TNotificationAvailable: public TNotificationBase |
|
65 { |
|
66 TRequestStatus* iNewStatus; |
|
67 TThreadId iNewThreadId; |
|
68 TInt iNewBufferNumber; |
|
69 TInt iNewGlobalIndex; |
|
70 }; |
|
71 |
|
72 |
|
73 class COpenWfcStreamMap; |
|
74 /** |
|
75 * CSurfaceStream |
|
76 * internal |
|
77 */ |
|
78 NONSHARABLE_CLASS( CSurfaceStream ) : public CBase |
|
79 { |
|
80 struct TNewGlobalNotifications; |
|
81 |
|
82 private: |
|
83 class Guard |
|
84 { |
|
85 public: |
|
86 Guard(RFastLock& aLock); |
|
87 ~Guard(); |
|
88 private: |
|
89 RFastLock& iLock; |
|
90 RHeap* iHeap; |
|
91 }; |
|
92 |
|
93 struct ContentUpdatedParams |
|
94 { |
|
95 ContentUpdatedParams(TInt aBuffer, |
|
96 TRequestStatus* aStatusDisplayed, TUint32* aTimeStamp, |
|
97 TRequestStatus* aStatusDispXTimes, TInt* aDisplayedXTimes, |
|
98 TRequestStatus* aStatusConsumed, const TRegion* aRegion, |
|
99 TBool aImmediateAvailable, |
|
100 TInt32 aImmediateVisibility, const TNewGlobalNotifications& aGlobalNotifications); |
|
101 TInt iBuffer; |
|
102 TRequestStatus* iStatusDisplayed; |
|
103 TUint32* iTimeStamp; |
|
104 TRequestStatus* iStatusDispXTimes; |
|
105 TInt* iDisplayedXTimes; |
|
106 TRequestStatus* iStatusConsumed; |
|
107 const TRegion* iRegion; |
|
108 TBool iImmediateAvailable; |
|
109 TInt32 iImmediateVisibility; |
|
110 const TNewGlobalNotifications& iGlobalNotifications; |
|
111 }; |
|
112 |
|
113 public: |
|
114 enum CallBackOperations |
|
115 { |
|
116 EDefaultOperation, |
|
117 ECheckVisibleOperation |
|
118 }; |
|
119 public: |
|
120 // Constructors and destructor |
|
121 |
|
122 /** |
|
123 * Destructor. |
|
124 */ |
|
125 ~CSurfaceStream(); |
|
126 |
|
127 /** |
|
128 * Two-phased constructor. |
|
129 */ |
|
130 static CSurfaceStream* NewL(const TSurfaceId& aId); |
|
131 |
|
132 /** |
|
133 * Two-phased constructor. |
|
134 */ |
|
135 static CSurfaceStream* NewLC(const TSurfaceId& aId); |
|
136 |
|
137 /** |
|
138 Helper to resolve handle to stream object |
|
139 **/ |
|
140 static CSurfaceStream* FromHandle(SymbianStreamType aNativeStreamHandle); |
|
141 |
|
142 /** |
|
143 * A helper function that returns the bytes per pixel for a given pixel format UID |
|
144 * @param aPixelFormat Pixel format UID to convert |
|
145 * @return Positive: bytes per pixel; negative is pixels per byte; 0 is error |
|
146 */ |
|
147 |
|
148 static TInt BytesPerPixel(TUidPixelFormat aPixelFormat); |
|
149 /** |
|
150 Helper to resolve handle to stream object |
|
151 **/ |
|
152 SymbianStreamType ToHandle(); |
|
153 |
|
154 public: |
|
155 //Internal helpers |
|
156 /** Returns internal surface ID. |
|
157 * |
|
158 * @return surface id asociated with this stream |
|
159 **/ |
|
160 const TSurfaceId& SurfaceId()const; |
|
161 |
|
162 public: |
|
163 //OpenWF-C SI/CT/MIG API implementation |
|
164 |
|
165 /** |
|
166 * Increase stream's reference count by one. |
|
167 * |
|
168 */ |
|
169 void |
|
170 AddReference(); |
|
171 |
|
172 /** |
|
173 * Decrease stream's reference count by one and destroy |
|
174 * the stream, if the reference count goes to zero. |
|
175 * |
|
176 * All acquired read & write buffers must be released |
|
177 * before calling WFC_Native_Destroy. |
|
178 * |
|
179 */ |
|
180 void |
|
181 ReleaseReference(); |
|
182 |
|
183 /** |
|
184 * internal |
|
185 * |
|
186 * @return flag if reference count is now zero. |
|
187 * |
|
188 */ |
|
189 TBool |
|
190 RemainingReference(); |
|
191 |
|
192 /** |
|
193 * internal |
|
194 * |
|
195 * Sets flipped state. |
|
196 * |
|
197 */ |
|
198 void |
|
199 SetFlipState(TBool aFlip); |
|
200 |
|
201 /** |
|
202 * Get stream "frame header". Can be used to query |
|
203 * all or some of the frame properties. |
|
204 * |
|
205 * @param width Pointer to location where width parameter should be saved |
|
206 * @param height Pointer to location where height parameter should be saved |
|
207 * @param stride Pointer to location where stride (row size in bytes) |
|
208 * parameter should be saved |
|
209 * @param pixelSize Pointer to location where pizelSize (pixel size in bytes) |
|
210 * parameter should be saved |
|
211 |
|
212 * Passing a NULL pointer implies that particular |
|
213 * value is of no interest to caller. E.g. |
|
214 * GetHeader(stream, &w, &h, NULL, NULL, NULL); |
|
215 * would only fetch width & height parameters. |
|
216 */ |
|
217 void |
|
218 GetHeader(khronos_int32_t* width, |
|
219 khronos_int32_t* height, |
|
220 khronos_int32_t* stride, |
|
221 SymOwfPixelFormat* format, |
|
222 khronos_int32_t* pixelSize); |
|
223 |
|
224 /** |
|
225 * Acquires read buffer for stream. For > 1 buffer |
|
226 * streams this function doesn't block, but simply returns |
|
227 * WFC_INVALID_HANDLE if no buffer is available for reading. |
|
228 * For 1 buffer stream the caller is blocked until the buffer |
|
229 * is ready for reading (the reader has committed the buffer, |
|
230 * that is.) |
|
231 * |
|
232 * |
|
233 * @return WFC_INVALID_HANDLE if no buffer is available or |
|
234 * handle to last committed buffer. |
|
235 * |
|
236 * An example sequence for 3 buffer stream where |
|
237 * producer produces frames approx. after every ~5th time unit. |
|
238 * Consumer consumes buffers at constant rate of 1buf/time unit. |
|
239 * Pframe is the number/handle of buffer that is being written by |
|
240 * the producer (let's assume that it takes 2 time units |
|
241 * for producer to produce a frame/buffer.) Cframe is the number/ |
|
242 * handle of the buffer the consumer receives from AcquireReadBuffer(). |
|
243 * "i" stands for WFC_INVALID_HANDLE: |
|
244 * |
|
245 * Time: 0 5 10 15 20 25 |
|
246 * Pframe: 0 1 2 0 1 ... |
|
247 * Cframe: ii00000111112222200000111... |
|
248 */ |
|
249 SymbianStreamBuffer |
|
250 AcquireReadBuffer(); |
|
251 |
|
252 /** |
|
253 * Releases read buffer. |
|
254 * |
|
255 * When read buffer is released, it is marked as clean to |
|
256 * be written again, unless it is the only committed buffer |
|
257 * in which case it is recycled so that the same buffer |
|
258 * can be read again (as long as no new buffers are committed |
|
259 * by the producer) |
|
260 * |
|
261 * @param buf Buffer handle. Must be valid read buffer handle for |
|
262 * given stream. |
|
263 * @return KErrNone if succeessful or KErrBadHandle if buf is not a currently |
|
264 * open write buffer on this stream; |
|
265 */ |
|
266 TInt |
|
267 ReleaseReadBuffer(SymbianStreamBuffer buf); |
|
268 |
|
269 /** |
|
270 * Acquires write buffer for stream. |
|
271 * |
|
272 * Returns handle to a buffer that can be used to write |
|
273 * data into stream. If no clean buffer is available, |
|
274 * invalid handle is returned. |
|
275 * |
|
276 * |
|
277 * @return Handle to a writable buffer |
|
278 */ |
|
279 SymbianStreamBuffer |
|
280 AcquireWriteBuffer(); |
|
281 |
|
282 /** |
|
283 * Releases write buffer to stream. |
|
284 * Released buffer is made new front buffer, i.e., producer is expected |
|
285 * to release buffer is the same order they were acquired. |
|
286 * |
|
287 * @param buf Buffer handle. Must be valid write buffer handle |
|
288 * for given stream. |
|
289 */ |
|
290 void |
|
291 ReleaseWriteBuffer(SymbianStreamBuffer buf); |
|
292 |
|
293 /** |
|
294 * Add event observer for stream. Observers are served in |
|
295 * first-come-first-serve fashion. That is, newest observer |
|
296 * is always placed at the end of the chain. If the observer |
|
297 * is already in the chain, it's popped out and moved to |
|
298 * the end of the chain. |
|
299 * |
|
300 * @param observer Observer (callback function) who should |
|
301 * be notified when something interesting happens in the stream. |
|
302 * @param data Additional data to pass to callback function |
|
303 * |
|
304 * @return 0 if successful, -1 if stream handle is invalid, -2 if |
|
305 * OOM situation occurs. |
|
306 */ |
|
307 int AddObserver(SymOwfStreamCallback observer, |
|
308 void* data,MultipleSymbianStreamEventBits aEvents); |
|
309 |
|
310 /** |
|
311 * Remove stream event observer. Observer is removed from |
|
312 * the stream's event nofitication chain and won't receive |
|
313 * any events from the stream afterwards. |
|
314 * |
|
315 * @param observer Observer (callback function) |
|
316 * |
|
317 * @param 0 if successful, -1 otherwise |
|
318 */ |
|
319 int RemoveObserver(SymOwfStreamCallback observer, |
|
320 void* aData,MultipleSymbianStreamEventBits aEvents); |
|
321 |
|
322 /** |
|
323 * Returns pointer to pixel buffer. |
|
324 * |
|
325 * @param buffer Handle of buffer |
|
326 */ |
|
327 void* |
|
328 GetBufferPtrL(SymbianStreamBuffer buffer); |
|
329 |
|
330 /** |
|
331 * Undocumented protection flag |
|
332 * |
|
333 * @param flag enable disable protection |
|
334 */ |
|
335 void |
|
336 SetProtectionFlag(TBool flag); |
|
337 |
|
338 TInt BufferHandleToIndex(SymbianStreamBuffer aBuff); |
|
339 |
|
340 /** |
|
341 * Add event observer for stream. Observers are served in |
|
342 * first-come-first-serve fashion. That is, newest observer |
|
343 * is always placed at the end of the chain. |
|
344 * |
|
345 * @param observer Observer (callback function) who should |
|
346 * be notified when something interesting happens in the stream. |
|
347 * @aEvent The event corresponding to the observer |
|
348 * @aScreenNumber The context identifier (screen number) |
|
349 * @param data Additional data to pass to callback function |
|
350 * |
|
351 * @return KErrNone if successful |
|
352 * KErrArgument if un unknown event is registered |
|
353 * KErrOverflow if the observer was already registered |
|
354 * An other system wide error if container couldn't be appended |
|
355 * OOM situation occurs. |
|
356 */ |
|
357 int AddObserver(SymbianStreamCallback aObserver, |
|
358 TInt32 aEvent, |
|
359 TInt32 aScreenNumber, |
|
360 void* aData); |
|
361 |
|
362 /** |
|
363 * Remove stream event observer. Observer is removed from |
|
364 * the stream's event nofitication chain and won't receive |
|
365 * any events from the stream afterwards. |
|
366 * |
|
367 * @param aObserver The callback function |
|
368 * @param aEvent The event id corresponding to the observer |
|
369 * @param aScreenNumber The screen number |
|
370 * @param aData Data must uniquely identify the observer |
|
371 * |
|
372 * @param KErrNone if successful, -1 otherwise |
|
373 * KErrArgument if un unknown event passed as parameter |
|
374 * KErrNotFount if the event is not found |
|
375 */ |
|
376 int RemoveObserver(TInt32 aEvents, void* aData); |
|
377 |
|
378 /*! |
|
379 * Notifies the observers not associated with a context. |
|
380 * The aim is to support legacy SI behavior. |
|
381 * |
|
382 * @param aEvent Observer identifier |
|
383 * |
|
384 */ |
|
385 int NotifyObservers(TInt32 aEvent); |
|
386 |
|
387 /** |
|
388 * Implements surface content notifications. |
|
389 * |
|
390 * When the contents of a surface change, this function gets called |
|
391 * MCompositionSurfaceUpdate implementation. |
|
392 * |
|
393 * @param aSurface The surface that has been updated. |
|
394 * @param aBuffer The buffer of the surface to be used in |
|
395 * composition. Integer starting from 0. |
|
396 * @param aRegion The sub-area that has the updates. If NULL, the |
|
397 * whole surface is considered changed. |
|
398 * @param aStatusConsumed A request status object or NULL. If not NULL, then the |
|
399 * request status is completed once the backend |
|
400 * does not anymore need the contents of the |
|
401 * surface to render the update. This may happen |
|
402 * before actually displaying the finished frame. |
|
403 * @param aStatusDisplayed This is signaled after the composited frame |
|
404 * is posted the to display for the first time after |
|
405 * the update. After this the value in |
|
406 * aTimeStamp is valid, if the value in the |
|
407 * status object is KErrNone. Can be NULL, if |
|
408 * no signal is desired. |
|
409 * @param aTimeStamp Value of the User::FastCounter() right after the |
|
410 * display refresh that signaled aStatusDisplayed. |
|
411 * @param aStatusDispXTimes This is signaled when the surface has been on |
|
412 * the screen for aDisplayedXTimes refreshes, |
|
413 * including the update that signaled aStatusDisplayed. |
|
414 * Can be NULL, if no signal is wanted. |
|
415 * @param aDisplayedXTimes The number of refreshes after which aStatusDispXTimes |
|
416 * is signaled or NULL. If values is provided, it must be |
|
417 * >= 1. |
|
418 * @param aScreenNumber Uniquelly identifies the context (composer) |
|
419 */ |
|
420 void SetNewNotifications(TInt aBuffer, |
|
421 TRequestStatus* aStatusDisplayed, TUint32* aTimeStamp, |
|
422 TRequestStatus* aStatusDispXTimes, TInt* aDisplayedXTimes, |
|
423 TRequestStatus* aStatusConsumed, const TRegion* aRegion, |
|
424 TInt32 aScreenNumber); |
|
425 |
|
426 /** |
|
427 * Implements surface content notifications. |
|
428 * |
|
429 * When the contents of a surface change, this function gets called |
|
430 * MCompositionSurfaceUpdate implementation. |
|
431 * |
|
432 * @param aSurface The surface that has been updated. |
|
433 * @param aBuffer The buffer of the surface to be used in |
|
434 * composition. Integer starting from 0. |
|
435 * @param aRegion The sub-area that has the updates. If NULL, the |
|
436 * whole surface is considered changed. |
|
437 * @param aStatusConsumed A request status object or NULL. If not NULL, then the |
|
438 * request status is completed once the backend |
|
439 * does not anymore need the contents of the |
|
440 * surface to render the update. This may happen |
|
441 * before actually displaying the finished frame. |
|
442 * @param aStatusDisplayed This is signaled after the composited frame |
|
443 * is posted the to display for the first time after |
|
444 * the update. After this the value in |
|
445 * aTimeStamp is valid, if the value in the |
|
446 * status object is KErrNone. Can be NULL, if |
|
447 * no signal is desired. |
|
448 * @param aTimeStamp Value of the User::FastCounter() right after the |
|
449 * display refresh that signaled aStatusDisplayed. |
|
450 * @param aStatusDispXTimes This is signaled when the surface has been on |
|
451 * the screen for aDisplayedXTimes refreshes, |
|
452 * including the update that signaled aStatusDisplayed. |
|
453 * Can be NULL, if no signal is wanted. |
|
454 * @param aDisplayedXTimes The number of refreshes after which aStatusDispXTimes |
|
455 * is signaled or NULL. If values is provided, it must be |
|
456 * >= 1. |
|
457 * @param aScreenNumber Uniquelly identifies the context (composer) |
|
458 */ |
|
459 void SetAllNotifications(TInt aBuffer, |
|
460 TRequestStatus* aStatusDisplayed, TUint32* aTimeStamp, |
|
461 TRequestStatus* aStatusDispXTimes, TInt* aDisplayedXTimes, |
|
462 TRequestStatus* aStatusConsumed, const TRegion* aRegion); |
|
463 |
|
464 /** |
|
465 * Process the notifications by accessing the information stored in the observer container. |
|
466 * |
|
467 * This method is expected to be called from the observer context every time composer has finished processing |
|
468 * a stream and the rigger condition is met. |
|
469 * |
|
470 * @param aEvent Events map to identify the observer to be processed. |
|
471 * @param aScreenNumber Screen ID used to identify the target composer that invokes the method |
|
472 * @param aOperation The Operation expected to be executed |
|
473 * @param aSerialNumber A number used to identify the composition operation |
|
474 * @param aReturnMask Parameter to be retrieved by composer, representing the event to be processed |
|
475 * when composed next time. A new composition is automatically triggered. |
|
476 * |
|
477 */ |
|
478 void ProcessNotifications(TInt32 aEvent, TInt32 aScreenNumber, TInt32 aOperation, TInt32 aSerialNumber, TInt32* aReturnMask); |
|
479 |
|
480 /** |
|
481 * A function that checks the validity of the new buffer provided by SUS |
|
482 * |
|
483 * |
|
484 * When the contents of a surface change, this function gets called by the MCompositionSurfaceUpdate implementation. |
|
485 * If the buffer is invalid all request statuses will be completed with KErrArgument |
|
486 * |
|
487 * @param aBuffer The buffer of the surface to be used in |
|
488 * composition. Integer starting from 0. |
|
489 * @param aStatusConsumed A request status object or NULL. |
|
490 * @param aStatusDisplayed A request status object or NULL. |
|
491 * @param aStatusDispXTimes A request status object or NULL. |
|
492 * |
|
493 * @return KErrNone if successful |
|
494 * KErrArgument if aBuffer parameter is invalid |
|
495 * |
|
496 */ |
|
497 TInt CheckBufferNumber(TInt aBuffer, |
|
498 TRequestStatus* aStatusDisplayed, |
|
499 TRequestStatus* aStatusDispXTimes, |
|
500 TRequestStatus* aStatusConsumed); |
|
501 |
|
502 private: |
|
503 /** |
|
504 * Notifies the composer that the content has been updated. |
|
505 * |
|
506 * |
|
507 * @param aScreenNumber Screen ID used to identify the target composer |
|
508 * @param aOp The Operation expected the callback to execute |
|
509 * @param aParam Parameter containing aaditional information to push/pop from targetet composer |
|
510 * |
|
511 */ |
|
512 TBool NotifyComposerContext(TInt32 aScreenNumber, TInt aOp, SYMOWF_CONTENT_UPDATED_PARAM* aParam); |
|
513 |
|
514 /** |
|
515 * Notifies the composer that the content is in process to be updated. The composer will have to not access |
|
516 * observer related information |
|
517 * |
|
518 * |
|
519 * Note that while calling the callback the context update mutex is acquired. |
|
520 * |
|
521 * @param aScreenNumber Screen ID used to identify the target composer |
|
522 * @param aBufferNum The buffer number to be updated |
|
523 * @param aUpdatedFlags The events that triggers this function call |
|
524 * @param aRegion The sub-area that has the updates. If NULL, the whole surface is considered changed. |
|
525 */ |
|
526 TBool StartUpdateNotifications(TInt aScreenNumber, SYMOWF_CONTENT_UPDATED_PARAM& param); |
|
527 |
|
528 /** |
|
529 * Notifies the composer that process of updating the content has finisshed |
|
530 * |
|
531 * The composer releases the content mutex and triggers a new composition |
|
532 * |
|
533 * @param aScreenNumber Screen ID used to identify the target composer |
|
534 * @param aBufferNum The buffer number to be updated |
|
535 * @param aUpdatedFlags The events that triggers this function call |
|
536 * @param aRegion The sub-area that has the updates. If NULL, the whole surface is considered changed. |
|
537 */ |
|
538 TBool EndUpdateNotifications(TInt aScreenNum, |
|
539 TInt aBufferNum, |
|
540 TInt32 aUpdatedFlags, |
|
541 const TRegion* aRegion); |
|
542 |
|
543 /** |
|
544 * Notifies the composer that content has been updated |
|
545 * |
|
546 * It is used to support old SI behaviour. The content update mutex is acuired |
|
547 * and released while a new composition is triggered |
|
548 * |
|
549 * @param aScreenNumber Screen ID used to identify the target composer |
|
550 * @param aBufferNum The buffer number to be updated |
|
551 * @param aUpdatedFlags The events that triggers this function call |
|
552 * @param aRegion The sub-area that has the updates. If NULL, the whole surface is considered changed. |
|
553 */ |
|
554 TBool UpdateNotifications(TInt aScreenNum, |
|
555 TInt aBufferNum, |
|
556 TInt32 aUpdatedFlags, |
|
557 const TRegion* aRegion); |
|
558 |
|
559 /** |
|
560 * Processes the available observer |
|
561 * |
|
562 * @param aEvent Events map to identify the operation to be executed. |
|
563 * @param aSerialNumber A number used to identify the composition operation |
|
564 * @param ContentUpdatedParams Packs the information used when a new request from SUS has to be processed |
|
565 * @param aCallBackData The observer data stored in the container of observers |
|
566 * @param aReturnMask Parameter to be retrieved by composer, representing the event to be processed |
|
567 */ |
|
568 void Available(TInt32 aEvent, TInt32 aSerialNumber, ContentUpdatedParams* aParams, void* aCallBackData, TInt32* aReturnMask); |
|
569 /** |
|
570 * Processes the available observer |
|
571 * |
|
572 * @param aEvent Events map to identify the operation to be executed. |
|
573 * @param aSerialNumber A number used to identify the composition operation |
|
574 * @param ContentUpdatedParams Packs the information used when a new request from SUS has to be processed |
|
575 * @param aCallBackData The observer data stored in the container of observers |
|
576 * @param aReturnMask Parameter to be retrieved by composer, representing the event to be processed |
|
577 */ |
|
578 void Displayed(TInt32 aEvent, TInt32 aSerialNumber, ContentUpdatedParams* aParams, void* aCallBackData, TInt32* aReturnMask); |
|
579 /** |
|
580 * Processes the available observer |
|
581 * |
|
582 * @param aEvent Events map to identify the operation to be executed. |
|
583 * @param aSerialNumber A number used to identify the composition operation |
|
584 * @param ContentUpdatedParams Packs the information used when a new request from SUS has to be processed |
|
585 * @param aCallBackData The observer data stored in the container of observers |
|
586 * @param aReturnMask Parameter to be retrieved by composer, representing the event to be processed |
|
587 */ |
|
588 void DisplayedXTimes(TInt32 aEvent, TInt32 aSerialNumber, ContentUpdatedParams* aParams, void* aCallBackData, TInt32* aReturnMask); |
|
589 /** |
|
590 * Function used to reset observer data fields |
|
591 * |
|
592 * @param aEvent Event identifier for whis the operation is to be executed. |
|
593 * @param aCallBackData The observer data stored in the container of observers |
|
594 */ |
|
595 void ResetCallBackData(void* aCallBackData, TInt32 aEvent); |
|
596 /** |
|
597 * Cancels all active notifications by completeting the associated requests |
|
598 */ |
|
599 void CancelNotifications(); |
|
600 |
|
601 void SetNotifications(TInt aBuffer, |
|
602 TRequestStatus* aStatusDisplayed, TUint32* aTimeStamp, |
|
603 TRequestStatus* aStatusDispXTimes, TInt* aDisplayedXTimes, |
|
604 TRequestStatus* aStatusConsumed, const TRegion* aRegion, |
|
605 TInt32 aScreenNumber, const TNewGlobalNotifications& aGlobalNotifications); |
|
606 |
|
607 void RequestComplete(TThreadId& aThreadId, TRequestStatus*& aRequestStatus, TInt& aGlobalIndexArray, TInt aStatus); |
|
608 /** |
|
609 * Constructor for performing 1st stage construction |
|
610 */ |
|
611 CSurfaceStream(); |
|
612 |
|
613 /** |
|
614 * Symbian's default constructor for performing 2nd stage construction |
|
615 */ |
|
616 void ConstructL(const TSurfaceId& aId); |
|
617 |
|
618 TInt AddNewGlobalNotification(TRequestStatus* aStatusDisplayed, TInt aAssociatedScreens); |
|
619 void SetReadBufferIndex(TInt aIndex); |
|
620 TInt GetReadBufferIndex(); |
|
621 TInt GetWriteBufferIndex(); |
|
622 TInt Stride(TInt aWidth, TUidPixelFormat aPixelFormat); |
|
623 static SymbianStreamBuffer IndexToReadHandle(TInt aIndex); |
|
624 static SymbianStreamBuffer IndexToWriteHandle(TInt aIndex); |
|
625 |
|
626 static COpenWfcStreamMap& GetSingletonL(); |
|
627 |
|
628 void SurfaceInfoL(const TSurfaceId& aSurface, RSurfaceManager::TInfoBuf& aInfo); |
|
629 private: |
|
630 enum FlippedTarget |
|
631 { |
|
632 EFlipNotSet, |
|
633 EFlippedTargetNormal, |
|
634 EFlippedTargetFlipped |
|
635 }; |
|
636 |
|
637 private: |
|
638 // Each surface buffer has its corresponding TBufferInfo to hold reference count and memory offset |
|
639 struct TBufferInfo |
|
640 { |
|
641 TInt iRefCount; |
|
642 TInt iOffset; |
|
643 }; |
|
644 |
|
645 private: |
|
646 struct TCallBackEntry; |
|
647 struct TGlobalNotification; |
|
648 TSurfaceId iSurfaceId; //< Surface ID associated with stream. |
|
649 TSurfaceId iStreamProxySurfaceId; //< Surface ID generated to represent stream |
|
650 TInt iRefCount; |
|
651 RFastLock iRefCountMutex; |
|
652 TInt iReadBuffer; |
|
653 RChunk iBufferChunk; |
|
654 TBufferInfo* iBufferInfo; //< Array of buffer info |
|
655 RSurfaceManager::TSurfaceInfoV01 iInfo; |
|
656 static const TInt BUFFER_READ_HANDLE_BASE = 0x100; |
|
657 static const TInt BUFFER_WRITE_HANDLE_BASE = 0x200; |
|
658 static const TInt BUFFER_WRITE_UPDATE_OVERWRITE = -1; |
|
659 TInt iAcquiredWriteBuffer; |
|
660 TAny* iCallBackHighestPriority; |
|
661 RArray<TCallBackEntry> iCallBacks; |
|
662 RFastLock iCallBacksMutex; |
|
663 TBool iProtected; |
|
664 RArray<TGlobalNotification> iGlobalNotifications; |
|
665 TInt iNumberOfScreenAttachedAvailableNotif; |
|
666 TInt iNumberOfScreenAttachedDisplayedNotif; |
|
667 TInt iNumberOfScreenAttachedDisplayedXNotif; |
|
668 FlippedTarget iFlipState; |
|
669 FlippedTarget iNewFlip; |
|
670 }; |
|
671 |
|
672 #endif // SURFACESTREAM_H |