# HG changeset patch # User Faisal Memon # Date 1285260162 -3600 # Node ID c8311e991ee371938ccb6ffd73fa9fb0c6574259 # Parent 2688aad49bab455ceddf32d1427298a741aa13b2 interim checkin, no compilation check done so don't sync to this changeset diff -r 2688aad49bab -r c8311e991ee3 guestrendering/guestegl/inc/guestegl.h --- a/guestrendering/guestegl/inc/guestegl.h Thu Sep 23 13:18:28 2010 +0100 +++ b/guestrendering/guestegl/inc/guestegl.h Thu Sep 23 17:42:42 2010 +0100 @@ -52,12 +52,14 @@ EGLSurface iHostSurfaceId; // Note: most member data is only used by Window surfaces TSurfaceId iSurfaceId; /* get chunk + * serialization.eglCreateWindowSurface(..) + * eglinternalfunctioncreatesurface(chunk, width, height, ..) + * egl.... setwindowsurfacebuffers(...) + * surfaceupdatesession.connect() + * wnd.setbackgroundsurface() + */ + EGL_TRACE( "CGuestEGL::eglCreateWindowSurface"); + EGL_TRACE_ATTRIB_LIST(aAttribList); + + RWindow* window; + window = (RWindow*) aNativeWindow; + TSize size = window->Size(); + + EGLSurface newSurfaceId = EGL_NO_SURFACE; + TSurfaceInfo* surfaceInfo = NULL; + EGLint error = EGL_BAD_DISPLAY; + TSurfaceId surfaceId; + + RSurfaceManager::TSurfaceCreationAttributesBuf buf; + RSurfaceManager::TSurfaceCreationAttributes& attributes = buf(); + + attributes.iSize = size; + attributes.iBuffers = 2; // REQUIREMENT because host side assumes exactly two buffers + attributes.iPixelFormat = EUidPixelFormatARGB_8888; // this is a guess; either query or hardcode to match syborg + attributes.iStride = 4 * size.iWidth; // Number of bytes between start of one line and start of next + attributes.iOffsetToFirstBuffer = 0; + attributes.iAlignment = EPageAligned; // alignment, 1,2,4,8,16,32,64 byte aligned or EPageAligned + attributes.iHintCount=0; + attributes.iSurfaceHints = NULL; + attributes.iOffsetBetweenBuffers = 0; + attributes.iContiguous = ETrue; + attributes.iCacheAttrib = RSurfaceManager::ENotCached; // Cache attributes + + iDisplayMapLock.WriteLock(); + CEglDisplayInfo** pDispInfo; + pDispInfo = iDisplayMap.Find(aDisplay); + + if (pDispInfo && *pDispInfo) + { + RHeap* threadHeap = CVghwUtils::SwitchToVghwHeap(); + + surfaceInfo = new TSurfaceInfo(); + if (surfaceInfo) + { + surfaceInfo->iConfigId = aConfig; + surfaceInfo->iSurfaceManager.Open(); + surfaceInfo->iSurfaceManager.CreateSurface(buf, surfaceId); + (*pDispInfo)->iSurfaceMap.Insert(surfaceId, surfaceInfo); + (void) surfaceInfo->iSurfaceManager.MapSurface(surfaceId, surfaceInfo->iChunk); + RemoteFunctionCallData rfcdata; + EglRFC eglApiData( rfcdata ); + eglApiData.Init( EglRFC::EeglCreateWindowSurface); + eglApiData.AppendEGLDisplay(aDisplay); + eglApiData.AppendEGLConfig(aConfig); + eglApiData.AppendEGLNativeWindowType(aNativeWindow); + eglApiData.AppendEGLintVector(aAttribList, TAttribUtils::AttribListLength(aAttribList) ); + eglApiData.AppendEGLint(size.iWidth); + eglApiData.AppendEGLint(size.iHeight); + eglApiData.AppendEGLint(1000); // horizontalPitch arbitrary + eglApiData.AppendEGLint(1000); // verticalPitch arbitrary + surfaceInfo->iHostSurfaceId = aThreadState.ExecEglSurfaceCmd(eglApiData); // todo check if is valid + EglInternalFunction_CreateSurface(aThreadState, aDisplay, surfaceInfo->iHostSurfaceId, aConfig, window, *surfaceInfo); + surfaceInfo->iSurfaceUpdateSession.Connect(); + TSurfaceConfiguration surfaceConfig; + surfaceConfig.SetSurfaceId(surfaceId); + window->SetBackgroundSurface(surfaceConfig, ETrue); + } + CVghwUtils::SwitchFromVghwHeap(threadHeap); + } + + iDisplayMapLock.Unlock(); + + aThreadState.SetEglError(EGL_SUCCESS); + + return surfaceInfo->iHostSurfaceId; + + // FAISALMEMON END OF NEW + } + const char* CGuestEGL::eglQueryString(EGLDisplay aDisplay, EGLint aName) { return NULL; // stub code @@ -902,6 +990,15 @@ EGLBoolean CGuestEGL::eglSwapBuffers(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLSurface aSurface) { + /** + * PSEUDO CODE + * serialization.eglSwapBuffers + * (maybe finish currently bound api) + * surfaceupdatesession.notifywhenavailable + * .whendisplayed() (alternative choice from above) + * surfaceupdatesession.submitupdated() + * user:waitforrequestl + */ EglInternalFunction_SwapWindowSurface(aThreadState, aDisplay, aSurface); // ToDo when all surfaces are recorded in client validate BEFORE sending cmd to host @@ -1080,7 +1177,7 @@ // FAISALMEMON END OF STUB CODE TUint32 chunkHWBase = 0; - (void)CVghwUtils::MapToHWAddress(aSurfaceInfo.iChunk->Handle(), chunkHWBase); + (void)CVghwUtils::MapToHWAddress(aSurfaceInfo.iChunk.Handle(), chunkHWBase); // FAISALMEMON write code to handle errors in the above function EGL_TRACE("CGuestEGL::EglInternalFunction_CreateSurface AFTER VGHWUtils::MapToHWAddress"); @@ -1089,8 +1186,8 @@ EGL_TRACE("CPlatsimEGL::egliCreateSurface AFTER VGHWUtils::MapToHWAddress"); /* Store the pointer to the pixel data */ - aSurfaceInfo.iBuffer0 = aSurfaceInfo.iChunk->Base() + offsetToFirstBuffer; - aSurfaceInfo.iBuffer1 = aSurfaceInfo.iChunk->Base() + offsetToSecondBuffer; + aSurfaceInfo.iBuffer0 = aSurfaceInfo.iChunk.Base() + offsetToFirstBuffer; + aSurfaceInfo.iBuffer1 = aSurfaceInfo.iChunk.Base() + offsetToSecondBuffer; aSurfaceInfo.iBuffer0Index = (chunkHWBase + offsetToFirstBuffer) - frameBufferBaseAddress; aSurfaceInfo.iBuffer1Index = (chunkHWBase + offsetToSecondBuffer) - frameBufferBaseAddress;