os/graphics/graphicscomposition/openwfc_ri_displayupdater/src/openwfc_ri_displayupdater.cpp
Update contrib.
1 // Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and/or associated documentation files (the
5 // "Materials"), to deal in the Materials without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Materials, and to
8 // permit persons to whom the Materials are furnished to do so, subject to
9 // the following conditions:
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Materials.
14 // THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20 // MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
23 // Display Adaptation Interface Implementation for Display Updater
27 #include "openwfc_ri_displayupdater.h"
31 #if defined(ENABLE_LOGGING)
32 #define LOG(X) RDebug::Printf X
37 // #define LOG_DISPLAY_PROPERTIES
39 const TUint32 KDefaultScreenNumber = 0;
42 void Panic(TInt aPanic)
44 _LIT(KPanic, "DA-DU");
45 User::Panic(KPanic, aPanic);
49 EXPORT_C COpenWFC_RI_Display* COpenWFC_RI_Display::NewL(TUint aScreen)
51 return COpenWFC_RI_DisplayUpdater::NewL(aScreen);
54 EXPORT_C TUint32 COpenWFC_RI_Display::DefaultScreenNumber()
56 return KDefaultScreenNumber;
59 COpenWFC_RI_DisplayUpdater::COpenWFC_RI_DisplayUpdater(TUint aScreen):
60 iScreenNumber(aScreen),
61 iDisplayUpdater(NULL),
62 iCurrentSceneStream(SYMBIAN_INVALID_HANDLE),
63 iCurrentReadBuffer(SYMBIAN_INVALID_HANDLE),
64 iNextSceneStream(SYMBIAN_INVALID_HANDLE),
65 iNextReadBuffer(SYMBIAN_INVALID_HANDLE)
69 COpenWFC_RI_DisplayUpdater* COpenWFC_RI_DisplayUpdater::NewL(TUint aScreen)
71 LOG((" +++ COpenWFC_RI_DisplayUpdater::NewL(%d)", aScreen));
72 COpenWFC_RI_DisplayUpdater* screenContext = new(ELeave) COpenWFC_RI_DisplayUpdater(aScreen);
73 CleanupStack::PushL(screenContext);
74 screenContext->ConstructL();
75 CleanupStack::Pop(screenContext);
76 LOG((" --- COpenWFC_RI_DisplayUpdater::NewL(%d) : 0x%X", aScreen, screenContext));
80 COpenWFC_RI_DisplayUpdater::~COpenWFC_RI_DisplayUpdater()
82 LOG((" +++ COpenWFC_RI_DisplayUpdater::~COpenWFC_RI_DisplayUpdater(%d)", iScreenNumber));
85 TDisplayViewSettings viewSettings; // DEFAULT
86 TBufferInfo bufferInfo; // DEFAULT
89 // Set to default view to release layer
90 err = iDisplayUpdater->SetView(KTopMostLayer, viewSettings, bufferInfo);
93 LOG((" !!! COpenWFC_RI_DisplayUpdater::~COpenWFC_RI_DisplayUpdater()ERROR: Display update set view failed %d", err));
96 TRequestStatus completedWhenReady = KRequestPending;
97 LOG(("\n +++ COpenWFC_RI_DisplayUpdater::~COpenWFC_RI_DisplayUpdater() FLUSHING *******\n"));
98 iDisplayUpdater->Flush(completedWhenReady);
99 LOG(("\n +++ COpenWFC_RI_DisplayUpdater::~COpenWFC_RI_DisplayUpdater() AFTER FLUSHING ******* 2\n"));
100 User::WaitForRequest(completedWhenReady);
101 LOG(("\n +++ COpenWFC_RI_DisplayUpdater::~COpenWFC_RI_DisplayUpdater() FLUSHING:REQUEST COMPLETED %d*******\n", completedWhenReady.Int()));
103 if (iCurrentSceneStream != SYMBIAN_INVALID_HANDLE && iCurrentReadBuffer != SYMBIAN_INVALID_HANDLE)
105 SymbianStreamReleaseReadBuffer(iCurrentSceneStream, iCurrentReadBuffer);
107 if (iNextSceneStream != SYMBIAN_INVALID_HANDLE && iNextReadBuffer != SYMBIAN_INVALID_HANDLE)
109 SymbianStreamReleaseReadBuffer(iNextSceneStream, iNextReadBuffer);
112 delete iDisplayUpdater;
113 iSurfaceManager.Close();
114 LOG((" --- COpenWFC_RI_DisplayUpdater::~COpenWFC_RI_DisplayUpdater() completed"));
117 void COpenWFC_RI_DisplayUpdater::ConstructL()
119 LOG((" +++ COpenWFC_RI_DisplayUpdater::ConstructL"));
120 User::LeaveIfError(iSurfaceManager.Open());
121 iDisplayUpdater = CDisplayUpdater::NewL(iScreenNumber);
122 iScreenInfo.iDefaultRotation = EScreenRotate0;
123 iDefaultRotation = ERotate0Deg;
124 iCurrentRotation = ERotate0Deg;
126 iScreenInfo.iCurrentRotation = EScreenRotate0;
127 iNewRotation = iScreenInfo.iCurrentRotation;
129 TDisplayDrvInfo displayInfo;
130 iDisplayUpdater->GetDisplayProperties(displayInfo);
132 #if defined(LOG_DISPLAY_PROPERTIES)
133 LOG((" ??? Display resolution (%d,%d)", displayInfo.iPanelResolution.iWidth, displayInfo.iPanelResolution.iHeight));
134 LOG((" ??? Display twips (%d,%d)", displayInfo.iPanelTwips.iWidth, displayInfo.iPanelTwips.iHeight));
135 LOG((" ??? Display refresh rate %dHz", displayInfo.iPanelRefreshRateHz));
136 LOG((" ??? Display %d internal composition buffers", (TInt)displayInfo.iNumberOfBuffers));
137 LOG((" ??? Display pixel formats: 0x%08.8X", (TInt)displayInfo.iSupportedFormats));
138 LOG((" ??? Display pixel aspect ratio %d/%d", (TInt)displayInfo.iPixelAspectRNumerator, (TInt)displayInfo.iPixelAspectRDenominator));
139 LOG((" ??? Display supported per-layer rotations: 0x%08.8X", (TInt)displayInfo.iSupportedPerLayerRotations));
140 LOG((" ??? Display rotation works with: 0x%08.8X", (TInt)displayInfo.iRotationWorksWithTheseFeatures));
141 LOG((" ??? Display scaling works with: 0x%08.8X", (TInt)displayInfo.iScalingWorksWithTheseFeatures));
142 LOG((" ??? Display minimum scaling: 100/%d", (TInt)displayInfo.iScalingMinDenominator));
143 LOG((" ??? Display maximum scaling: %d/100", (TInt)displayInfo.iScalingMaxNumerator));
144 LOG((" ??? Display maximum overlays: %d", (TInt)displayInfo.iNumberOfOverlays));
145 LOG((" ??? Display colour space: 0x%08.8X", (TInt)displayInfo.iDestinationColorSpace));
146 LOG((" ??? Display colour coords: (%d,%d)R (%d,%d)G (%d,%d)B (%d,%d)W",
147 displayInfo.iDestinationColorCoordinates.iRed.iX, displayInfo.iDestinationColorCoordinates.iRed.iY,
148 displayInfo.iDestinationColorCoordinates.iGreen.iX, displayInfo.iDestinationColorCoordinates.iGreen.iY,
149 displayInfo.iDestinationColorCoordinates.iBlue.iX, displayInfo.iDestinationColorCoordinates.iBlue.iY,
150 displayInfo.iDestinationColorCoordinates.iWhite.iX, displayInfo.iDestinationColorCoordinates.iWhite.iY));
151 LOG((" ??? Display direct buffer display: %d", (TInt)displayInfo.iGivenBufferWorksAsFrameBuffer));
152 LOG((" ??? Display variable resolution: %d", (TInt)displayInfo.iVariableResolution));
153 LOG((" ??? Display draw overscan: %d", (TInt)displayInfo.iOverscanToBeDrawn));
154 LOG((" ??? Display is on: %d", (TInt)displayInfo.iDisplayOn));
157 TInt supportedFormats = displayInfo.iSupportedFormats;
158 /* Note that in theory other formats could be supported for composition
159 * (eg EPixelFormatARgb8888Le | EPixelFormatARgb8888LeP )
160 * So long as the background colour is opaque then the final compiosed image should end up opaque,
161 * so compatible with alpha modes.
162 * However, it would give problems for fastpathing, where alpha byte should be ignored,
163 * probably fastpath would need to be disabled.
164 * At present we only care about PlatSim,
165 * and it is unlikely that any platform will NOT support xrgb32,
166 * so it is better to assert the capabilities match than think about this hypothetical case too hard.
168 if (supportedFormats & (EPixelFormatXRgb8888Le ))
170 iScreenInfo.iPixelFormat = EUidPixelFormatXRGB_8888;
171 iScreenInfo.iBytesPerPixel = 4;
175 LOG((" !!! COpenWFC_RI_DisplayUpdater::ConstructL() unsupported pixel formats 0x%08.8x", supportedFormats));
176 User::Leave(KErrNotSupported);
179 iScreenInfo.iPixelFormat = EUidPixelFormatXRGB_8888;
180 if (displayInfo.iRotationWorksWithTheseFeatures & EFeatureExternalBuf)
182 iScreenInfo.iSupportedRotations = displayInfo.iSupportedPerLayerRotations & 0x0f;
186 LOG((" +++ COpenWFC_RI_DisplayUpdater::ConstructL() fixed output rotation"));
187 iScreenInfo.iSupportedRotations = (TInt32)ERotate0Deg;
190 iScreenInfo.iNormalWidth = displayInfo.iPanelResolution.iWidth;
191 iScreenInfo.iNormalHeight = displayInfo.iPanelResolution.iHeight;
192 iScreenInfo.iFlippedWidth = iScreenInfo.iNormalHeight;
193 iScreenInfo.iFlippedHeight = iScreenInfo.iNormalWidth;
195 iScreenInfo.iNormalStride = iScreenInfo.iBytesPerPixel * iScreenInfo.iNormalWidth;
196 iScreenInfo.iFlippedStride = iScreenInfo.iBytesPerPixel * iScreenInfo.iFlippedWidth;
197 LOG((" --- COpenWFC_RI_DisplayUpdater::ConstructL"));
200 TInt COpenWFC_RI_Display::GetAttributeSize(TUint aAttributeId)
202 LOG((" +++ COpenWFC_RI_DisplayUpdater::GetAttributeSize(%d)", aAttributeId));
203 switch (aAttributeId)
205 case EScreenAttributeImplementationVersion:
206 case EScreenAttributePixelFormat:
207 case EScreenAttributeBytesPerPixel:
208 case EScreenAttributeSupportedRotation:
209 case EScreenAttributeNormalWidth:
210 case EScreenAttributeNormalHeight:
211 case EScreenAttributeNormalStride:
212 case EScreenAttributeFlippedWidth:
213 case EScreenAttributeFlippedHeight:
214 case EScreenAttributeFlippedStride:
215 case EScreenAttributeDefaultRotation:
216 case EScreenAttributeCurrentRotation:
217 LOG((" --- COpenWFC_RI_DisplayUpdater::GetAttributeSize(%d) = 4", aAttributeId));
218 return sizeof(TUint32);
220 case EScreenAttributeScreenGeometry:
221 LOG((" --- COpenWFC_RI_DisplayUpdater::GetAttributeSize(%d) = %d", aAttributeId, sizeof(TScreenGeometryAttribute)));
222 return sizeof(TScreenGeometryAttribute);
225 LOG((" !!! COpenWFC_RI_DisplayUpdater::GetAttributeSize(%d) UNKNOWN", aAttributeId));
230 TInt COpenWFC_RI_DisplayUpdater::GetAttribute(TInt aAttributeId, TAny* aAttribute, TInt aAttributeSize)
232 LOG((" +++ COpenWFC_RI_DisplayUpdater::GetAttribute(%d, 0x%X, %d)", aAttributeId, aAttribute, aAttributeSize));
233 TInt parameterSize = GetAttributeSize(aAttributeId);
235 if (aAttribute == NULL)
237 LOG((" !!! COpenWFC_RI_DisplayUpdater::GetAttribute() aAttribute NULL ptr"));
241 if (parameterSize == 0)
243 LOG((" !!! COpenWFC_RI_DisplayUpdater::GetAttribute() Not Supported parameter aAttributeId"));
244 return KErrNotSupported;
247 if (aAttributeSize != parameterSize)
249 LOG((" !!! COpenWFC_RI_DisplayUpdater::GetAttribute() aAttributeSize wrong size"));
253 switch (aAttributeId)
255 case EScreenAttributeImplementationVersion:
256 *((TUint32*)aAttribute) = KImplementationVersion;
258 case EScreenAttributePixelFormat:
259 *((TUint32*)aAttribute) = iScreenInfo.iPixelFormat;
261 case EScreenAttributeBytesPerPixel:
262 *((TUint32*)aAttribute) = iScreenInfo.iBytesPerPixel;
264 case EScreenAttributeSupportedRotation:
265 *((TUint32*)aAttribute) = iScreenInfo.iSupportedRotations;
267 case EScreenAttributeNormalWidth:
268 *((TUint32*)aAttribute) = iScreenInfo.iNormalWidth;
270 case EScreenAttributeNormalHeight:
271 *((TUint32*)aAttribute) = iScreenInfo.iNormalHeight;
273 case EScreenAttributeNormalStride:
274 *((TUint32*)aAttribute) = iScreenInfo.iNormalStride;
276 case EScreenAttributeFlippedWidth:
277 *((TUint32*)aAttribute) = iScreenInfo.iFlippedWidth;
279 case EScreenAttributeFlippedHeight:
280 *((TUint32*)aAttribute) = iScreenInfo.iFlippedHeight;
282 case EScreenAttributeFlippedStride:
283 *((TUint32*)aAttribute) = iScreenInfo.iFlippedStride;
285 case EScreenAttributeDefaultRotation:
286 *((TUint32*)aAttribute) = iScreenInfo.iDefaultRotation;
288 case EScreenAttributeCurrentRotation:
289 *((TUint32*)aAttribute) = iScreenInfo.iCurrentRotation;
291 case EScreenAttributeScreenGeometry:
292 *((TScreenGeometryAttribute*)aAttribute) = iScreenInfo;
295 LOG((" !!! COpenWFC_RI_DisplayUpdater::GetAttribute() attribute unrecognised"));
296 return KErrNotSupported;
299 LOG((" --- COpenWFC_RI_DisplayUpdater::GetAttribute() = %d", *((TUint32*)aAttribute)));
304 TInt COpenWFC_RI_DisplayUpdater::SetAttribute(TInt aAttributeId, TAny* aAttribute, TInt aAttributeSize)
306 LOG((" +++ COpenWFC_RI_DisplayUpdater::SetAttribute(%d, 0x%X, %d)", aAttributeId, aAttribute, aAttributeSize));
307 // the only parameter we can modify is the current rotation
308 TInt parameterSize = GetAttributeSize(aAttributeId);
310 if (aAttributeSize != parameterSize || aAttribute == NULL)
312 LOG((" !!! COpenWFC_RI_DisplayUpdater::SetAttribute() Invalid parameter"));
316 switch (aAttributeId)
318 case EScreenAttributeCurrentRotation:
319 iNewRotation = static_cast<TScreenRotation>(*((TUint32*)aAttribute));
320 LOG((" +++ COpenWFC_RI_DisplayUpdater::SetAttribute(CurrentRotation, %d)", (TInt)iNewRotation));
323 LOG((" !!! COpenWFC_RI_DisplayUpdater::SetAttribute() Invalid attribute"));
324 return KErrNotSupported;
326 LOG((" --- COpenWFC_RI_DisplayUpdater::SetAttribute()"));
331 TInt COpenWFC_RI_DisplayUpdater::CommitAttribute()
333 LOG((" +++ COpenWFC_RI_DisplayUpdater::CommitAttribute"));
334 // Hardware rotation is not demonstrated on PlatSim
335 __ASSERT_DEBUG(iScreenInfo.iCurrentRotation == iNewRotation, Panic(__LINE__));
339 TInt COpenWFC_RI_DisplayUpdater::SetLayerSurface(TInt aLayer, SymbianStreamType aStream, TInt* aNonTrivialAttribs)
341 // display channel interface can be seen as mono-layered
344 LOG((" !!! COpenWFC_RI_DisplayUpdater::SetLayerSurface : non-zero layer not supported"));
348 if (aNonTrivialAttribs && *aNonTrivialAttribs)
350 LOG((" !!! COpenWFC_RI_DisplayUpdater::SetLayerSurface : Non-trivial attributes not accepted."));
351 return KErrNotSupported;
354 if (aStream!=iNextSceneStream)
355 { //If, in future non-trivial attributes are supported then this condition is inadequate
356 SymbianStreamBuffer nextReadBuffer=NULL;
357 //Scene stream has changed - re-validate and set up for new info
358 TInt err=SymbianStreamAcquireReadBuffer(aStream,&nextReadBuffer);
361 LOG((" !!! COpenWFC_RI_DisplayUpdater::SetLayerSurface : Falied to access stream properties"));
364 const TSurfaceId* surfaceId;
365 khronos_int32_t index;
366 err= SymbianStreamGetBufferId(aStream,nextReadBuffer,&index,&surfaceId);
369 LOG((" !!! COpenWFC_RI_DisplayUpdater::SetLayerSurface : Falied to access stream properties"));
370 SymbianStreamReleaseReadBuffer(aStream, nextReadBuffer);
373 RSurfaceManager::TInfoBuf surfaceInfo;
374 iSurfaceManager.SurfaceInfo(*surfaceId,surfaceInfo);
375 TBool acceptable=ETrue;
376 if (!surfaceInfo().iContiguous)
379 LOG((" !!! COpenWFC_RI_DisplayUpdater::SetLayerSurface : Stream 0x%08x iContiguous not accepted ",aStream));
381 khronos_int32_t format=surfaceInfo().iPixelFormat;
382 if (format!=EUidPixelFormatARGB_8888 && format!=EUidPixelFormatARGB_8888_PRE && format!=EUidPixelFormatXRGB_8888)
385 LOG((" !!! COpenWFC_RI_DisplayUpdater::SetLayerSurface : Stream 0x%08x iPixelFormat 0x%08x not accepted ",aStream,surfaceInfo().iPixelFormat));
390 LOG((" !!! COpenWFC_RI_DisplayUpdater::SetLayerSurface : Stream 0x%08x properties not accepted ",aStream));
391 SymbianStreamReleaseReadBuffer(aStream, nextReadBuffer);
392 return KErrNotSupported;
395 //Note that if we early-return before this point the previous top stream should still be locked for use.
397 LOG((" !!! COpenWFC_RI_DisplayUpdater::SetLayerSurface : Stream changed 0x%08x --> 0x%08x ",iNextSceneStream,aStream));
398 if (iNextSceneStream != SYMBIAN_INVALID_HANDLE && iNextReadBuffer != SYMBIAN_INVALID_HANDLE)
400 LOG((" !!! COpenWFC_RI_DisplayUpdater::SetLayerSurface : double-call to SetLayerSurface. First discarded."));
401 SymbianStreamReleaseReadBuffer(iNextSceneStream, iNextReadBuffer);
403 iNextReadBuffer=nextReadBuffer;
404 iNextSceneStream=aStream;
408 LOG((" !!! COpenWFC_RI_DisplayUpdater::SetLayerSurface : Stream still 0x%08x",aStream));
413 TInt COpenWFC_RI_DisplayUpdater::SetTopLayerSurface(SymbianStreamType aStream, TInt* aNonTrivialAttribs)
415 return SetLayerSurface(KTopMostLayer, aStream, aNonTrivialAttribs);
418 TInt COpenWFC_RI_DisplayUpdater::UpdateDisplay()
422 SymbianStreamBuffer readBuffer = iNextReadBuffer;
423 iNextReadBuffer = SYMBIAN_INVALID_HANDLE;
424 if (!iNextSceneStream)
426 LOG((" !!! COpenWFC_RI_DisplayUpdater::UpdateDisplay() ASSERT: No top layer has been set!"));
429 if (readBuffer == SYMBIAN_INVALID_HANDLE)
431 if ((err = SymbianStreamAcquireReadBuffer(iNextSceneStream, &readBuffer)) != KErrNone)
432 { //AcquireReadBuffer "Can't fail" in theory, but just incase....
433 LOG((" !!! COpenWFC_RI_DisplayUpdater::UpdateDisplay() Acquire failed: %d", err));
437 TBufferInfo bufferInfo;
438 khronos_int32_t width, height, stride;
439 SymbianStreamGetHeader(iNextSceneStream, &width, &height, &stride, NULL, NULL);
440 bufferInfo.iBufferWidth = (TInt16)width;
441 bufferInfo.iBufferHeight = (TInt16)height;
442 bufferInfo.iStride = (TInt16)stride;
443 bufferInfo.iBufferFormat = EPixelFormatXRgb8888Le;
444 bufferInfo.iLinearAddress = 0;
445 err = SymbianStreamGetBufferPointer(iNextSceneStream, readBuffer,&bufferInfo.iLinearAddress);
448 err = SymbianStreamGetChunkHandle(iNextSceneStream, &bufferInfo.iBufferRChunkHandle);
453 LOG((" !!! COpenWFC_RI_DisplayUpdater::UpdateDisplay() error %d getting stream data", err));
454 SymbianStreamReleaseReadBuffer(iNextSceneStream, readBuffer);
459 displayRect.SetRect(TPoint(0, 0), TSize(bufferInfo.iBufferWidth, bufferInfo.iBufferHeight ));
461 TDisplayViewSettings viewSettings; // Default
462 viewSettings.iSourceScissor = displayRect;
463 viewSettings.iDestinationScaledRect = displayRect;
464 viewSettings.iLayerRotation = ERotate0Deg;
465 viewSettings.iUsageHint = EPurposeUi;
466 viewSettings.iTearingFree = ETrue;
468 LOG((" $$$*** bufferInfo.iBufferWidth %d", bufferInfo.iBufferWidth));
469 LOG((" $$$*** bufferInfo.iBufferHeight %d", bufferInfo.iBufferHeight));
470 LOG((" $$$*** bufferInfo.iStride %d", bufferInfo.iStride));
471 LOG((" $$$*** bufferInfo.iBufferFormat %d", bufferInfo.iBufferFormat));
472 LOG((" $$$*** bufferInfo.iLinearAddress %08x", bufferInfo.iLinearAddress));
473 LOG((" $$$*** bufferInfo.iBufferRChunkHandle %d", bufferInfo.iBufferRChunkHandle));
475 LOG((" $$$*** viewSettings iSourceScissor width %d", viewSettings.iSourceScissor.Width()));
476 LOG((" $$$*** viewSettings iSourceScissor height %d", viewSettings.iSourceScissor.Height()));
477 LOG((" $$$*** viewSettings iDestinationScaledRect width %d", viewSettings.iDestinationScaledRect.Width()));
478 LOG((" $$$*** viewSettings iDestinationScaledRect height %d", viewSettings.iDestinationScaledRect.Height()));
479 LOG((" $$$*** viewSettings iLayerRotation %d", viewSettings.iLayerRotation));
480 LOG((" $$$*** viewSettings iUsageHint %d", viewSettings.iUsageHint));
481 LOG((" $$$*** viewSettings iTearingFree %d", viewSettings.iTearingFree));
483 TRequestStatus completedWhenReady = KRequestPending;
484 viewSettings.iLayerRotation = iCurrentRotation;
486 err = iDisplayUpdater->SetView(KTopMostLayer, viewSettings, bufferInfo);
490 LOG((" !!! COpenWFC_RI_DisplayUpdater::UpdateDisplay()ERROR: Display update set view failed %d", err));
494 err = iDisplayUpdater->SetBuffer(KTopMostLayer, displayRect, bufferInfo );
497 LOG((" !!! COpenWFC_RI_DisplayUpdater::UpdateDisplay()ERROR: Display Update set buffer failed %d", err));
501 ////////////////////////////////////////////////////////////////////////////////////////////
502 iDisplayUpdater->Flush(completedWhenReady);
504 /* The TRequestStatus& aCompletedWhenReady parameter is signalled
505 * either when the buffer has been copied,
506 * or it is streaming the first pixel to the display
507 * In either case this indicates that the previous buffer is no longer required.
508 * By waiting here we guarantee that the previous iCurrentReadBuffer is no longer required,
509 * but here are more intelligent ways to wait, I am sure!
511 User::WaitForRequest(completedWhenReady);
512 if (iCurrentReadBuffer != SYMBIAN_INVALID_HANDLE)
514 // Release the previous update's read buffer.
515 /* This ensures that a lock is held on the displayed buffer until the next commit/compose
516 * This is correct behaviour for streaming direct to the display, but is actually not
517 * necessary if the display makes its own copy.
518 * However, PlatSim currently supports only the latter, and we think the former is important,
519 * so this implementation allows us to validate that the behaviour is correct in direct streaming.
521 SymbianStreamReleaseReadBuffer(iCurrentSceneStream, iCurrentReadBuffer);
523 iCurrentReadBuffer = readBuffer;
524 iCurrentSceneStream = iNextSceneStream;