253 RHeap* threadHeap = CVghwUtils::SwitchToVghwHeap(); |
253 RHeap* threadHeap = CVghwUtils::SwitchToVghwHeap(); |
254 |
254 |
255 surfaceInfo = new TSurfaceInfo(); |
255 surfaceInfo = new TSurfaceInfo(); |
256 if (surfaceInfo) |
256 if (surfaceInfo) |
257 { |
257 { |
|
258 surfaceInfo->iNativeWindow = (RWindow*)aNativeWindow; |
258 surfaceInfo->iConfigId = aConfig; |
259 surfaceInfo->iConfigId = aConfig; |
259 surfaceInfo->iSurfaceManager.Open(); |
260 surfaceInfo->iSurfaceManager.Open(); |
260 surfaceInfo->iSurfaceManager.CreateSurface(buf, surfaceId); |
261 surfaceInfo->iSurfaceManager.CreateSurface(buf, surfaceId); |
261 (*pDispInfo)->iSurfaceMap.Insert(surfaceId, surfaceInfo); |
262 (*pDispInfo)->iSurfaceMap.Insert(surfaceId, surfaceInfo); |
262 (void) surfaceInfo->iSurfaceManager.MapSurface(surfaceId, surfaceInfo->iChunk); |
263 (void) surfaceInfo->iSurfaceManager.MapSurface(surfaceId, surfaceInfo->iChunk); |
997 * surfaceupdatesession.notifywhenavailable |
998 * surfaceupdatesession.notifywhenavailable |
998 * .whendisplayed() (alternative choice from above) |
999 * .whendisplayed() (alternative choice from above) |
999 * surfaceupdatesession.submitupdated() |
1000 * surfaceupdatesession.submitupdated() |
1000 * user:waitforrequestl |
1001 * user:waitforrequestl |
1001 */ |
1002 */ |
1002 EglInternalFunction_SwapWindowSurface(aThreadState, aDisplay, aSurface); |
1003 |
1003 |
1004 RHeap* threadHeap = CVghwUtils::SwitchToVghwHeap(); |
1004 // ToDo when all surfaces are recorded in client validate BEFORE sending cmd to host |
|
1005 TSurfaceInfo* surfaceInfo = EglInternalFunction_GetPlatformSurface( aDisplay, aSurface ); |
1005 TSurfaceInfo* surfaceInfo = EglInternalFunction_GetPlatformSurface( aDisplay, aSurface ); |
1006 EGL_CHECK_ERROR( surfaceInfo, EGL_BAD_SURFACE, EGL_FALSE ); |
1006 RemoteFunctionCallData rfcdata; |
1007 |
1007 EglRFC eglApiData( rfcdata ); |
1008 //Check if surface size has changed |
1008 eglApiData.Init(EglRFC::EeglSwapBuffers); |
1009 TSize size = surfaceInfo->iNativeWindow->Size(); |
1009 TSize size = surfaceInfo->iNativeWindow->Size(); |
1010 |
1010 |
|
1011 eglApiData.AppendEGLDisplay(aDisplay); |
|
1012 eglApiData.AppendEGLSurface(surfaceInfo->iHostSurfaceId); |
|
1013 eglApiData.AppendEGLint(size.iWidth); |
|
1014 eglApiData.AppendEGLint(size.iHeight); |
|
1015 |
|
1016 EGLBoolean result = aThreadState.ExecEglBooleanCmd(eglApiData); |
|
1017 TRequestStatus status; |
|
1018 TTimeStamp timestampLocalToThread; |
|
1019 surfaceInfo->iSurfaceUpdateSession.NotifyWhenDisplayed(status, timestampLocalToThread); |
|
1020 surfaceInfo->iSurfaceUpdateSession.SubmitUpdate(surfaceInfo->iNativeWindow->ScreenNumber(),surfaceInfo->iSurfaceId, surfaceInfo->iFrontBuffer); |
|
1021 User::WaitForRequest(status); |
|
1022 |
|
1023 if (surfaceInfo->iFrontBuffer == 0) |
|
1024 { |
|
1025 surfaceInfo->iFrontBuffer = 1; |
|
1026 } |
|
1027 else |
|
1028 { |
|
1029 surfaceInfo->iFrontBuffer = 0; |
|
1030 } |
|
1031 |
1011 if (size != surfaceInfo->iSize) |
1032 if (size != surfaceInfo->iSize) |
1012 { |
1033 { |
1013 EGL_TRACE("CGuestEGL::eglSwapBuffers Surface Resized size=%d,%d, surfaceInfo->iSize=%d,%d", |
1034 EGL_TRACE("CGuestEGL::eglSwapBuffers Surface Resized size=%d,%d, surfaceInfo->iSize=%d,%d", |
1014 size.iHeight, size.iWidth, surfaceInfo->iSize.iHeight, surfaceInfo->iSize.iWidth); |
1035 size.iHeight, size.iWidth, surfaceInfo->iSize.iHeight, surfaceInfo->iSize.iWidth); |
1015 return EglInternalFunction_SurfaceResized(aThreadState, *surfaceInfo, aDisplay, aSurface); |
1036 |
1016 } |
1037 CVghwUtils::SwitchFromVghwHeap(threadHeap); |
1017 return EGL_TRUE; |
1038 return EglInternalFunction_SurfaceResized(aThreadState, *surfaceInfo, aDisplay, aSurface); // TODO handling of resize |
|
1039 } |
|
1040 |
|
1041 CVghwUtils::SwitchFromVghwHeap(threadHeap); |
|
1042 |
|
1043 return result; |
1018 } |
1044 } |
1019 |
1045 |
1020 EGLBoolean CGuestEGL::eglMakeCurrent(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLSurface aDraw, EGLSurface aRead, EGLContext aContext) |
1046 EGLBoolean CGuestEGL::eglMakeCurrent(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLSurface aDraw, EGLSurface aRead, EGLContext aContext) |
1021 { |
1047 { |
1022 if (aContext == EGL_NO_CONTEXT) |
1048 if (aContext == EGL_NO_CONTEXT) |
1189 aSurfaceInfo.iBuffer0 = aSurfaceInfo.iChunk.Base() + offsetToFirstBuffer; |
1215 aSurfaceInfo.iBuffer0 = aSurfaceInfo.iChunk.Base() + offsetToFirstBuffer; |
1190 aSurfaceInfo.iBuffer1 = aSurfaceInfo.iChunk.Base() + offsetToSecondBuffer; |
1216 aSurfaceInfo.iBuffer1 = aSurfaceInfo.iChunk.Base() + offsetToSecondBuffer; |
1191 |
1217 |
1192 aSurfaceInfo.iBuffer0Index = (chunkHWBase + offsetToFirstBuffer) - frameBufferBaseAddress; |
1218 aSurfaceInfo.iBuffer0Index = (chunkHWBase + offsetToFirstBuffer) - frameBufferBaseAddress; |
1193 aSurfaceInfo.iBuffer1Index = (chunkHWBase + offsetToSecondBuffer) - frameBufferBaseAddress; |
1219 aSurfaceInfo.iBuffer1Index = (chunkHWBase + offsetToSecondBuffer) - frameBufferBaseAddress; |
|
1220 |
|
1221 aSurfaceInfo.iFrontBuffer = 0; // Assume host peer also starts rendering buffer 0 as its front buffer |
1194 EGL_TRACE("CGuestEGL::EglInternalFunction_CreateSurface %u %x %x %x %x",chunkHWBase, offsetToFirstBuffer, offsetToSecondBuffer, |
1222 EGL_TRACE("CGuestEGL::EglInternalFunction_CreateSurface %u %x %x %x %x",chunkHWBase, offsetToFirstBuffer, offsetToSecondBuffer, |
1195 aSurfaceInfo.iBuffer0Index, |
1223 aSurfaceInfo.iBuffer0Index, |
1196 aSurfaceInfo.iBuffer1Index); |
1224 aSurfaceInfo.iBuffer1Index); |
1197 |
1225 |
1198 if ( !EglInternalFunction_CallSetSurfaceParams(aThreadState, aDisplay, aSurface, aSurfaceInfo) ) |
1226 if ( !EglInternalFunction_CallSetSurfaceParams(aThreadState, aDisplay, aSurface, aSurfaceInfo) ) |