# HG changeset patch # User Faisal Memon # Date 1285331367 -3600 # Node ID 36992771cbb18c9f3c5965eef167b8f5201679bd # Parent 2865e884ac3b0f9055aa6ebff2e16e6323b5f4ec# Parent 1a4430846fcf2528c775e90eca1ca35bbb77ba4a catchup with head diff -r 1a4430846fcf -r 36992771cbb1 guestrendering/guestegl/inc/guestegl.h --- a/guestrendering/guestegl/inc/guestegl.h Fri Sep 24 12:02:56 2010 +0100 +++ b/guestrendering/guestegl/inc/guestegl.h Fri Sep 24 13:29:27 2010 +0100 @@ -16,6 +16,7 @@ #ifndef __GUEST__EGL_H #define __GUEST__EGL_H +#include // CLASS DECLARATION typedef enum @@ -52,13 +53,15 @@ EGLSurface iHostSurfaceId; // Note: most member data is only used by Window surfaces TSurfaceId iSurfaceId; /* iBuffer0, 1 -> iBuffer1 should be display RWindow* iNativeWindow; EGLint iRedBits; EGLint iGreenBits; diff -r 1a4430846fcf -r 36992771cbb1 guestrendering/guestegl/src/guestegl.cpp --- a/guestrendering/guestegl/src/guestegl.cpp Fri Sep 24 12:02:56 2010 +0100 +++ b/guestrendering/guestegl/src/guestegl.cpp Fri Sep 24 13:29:27 2010 +0100 @@ -199,10 +199,97 @@ } } -EGLSurface CGuestEGL::eglCreateWindowSurface(TEglThreadState&, int, int, void*, const int*) +EGLSurface CGuestEGL::eglCreateWindowSurface(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLConfig aConfig, + EGLNativeWindowType aNativeWindow, const EGLint *aAttribList) { - return 0; // stub code + + // FAISALMEMON NEW + /** + * pseudo code: + * + * surfacemamanger. + * open() + * createsurface(2 buffers, width, height, pixel format,...) + * map surface -> 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(); + + TSurfaceInfo* surfaceInfo = NULL; + 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 = RSurfaceManager::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->iNativeWindow = (RWindow*)aNativeWindow; + surfaceInfo->iConfigId = aConfig; + surfaceInfo->iSurfaceManager.Open(); + surfaceInfo->iSurfaceManager.CreateSurface(buf, surfaceId); + (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 + (*pDispInfo)->iSurfaceMap.Insert(surfaceInfo->iHostSurfaceId, surfaceInfo); + 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,22 +989,56 @@ EGLBoolean CGuestEGL::eglSwapBuffers(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLSurface aSurface) { - EglInternalFunction_SwapWindowSurface(aThreadState, aDisplay, aSurface); - - // ToDo when all surfaces are recorded in client validate BEFORE sending cmd to host + /** + * PSEUDO CODE + * serialization.eglSwapBuffers + * (maybe finish currently bound api) + * surfaceupdatesession.notifywhenavailable + * .whendisplayed() (alternative choice from above) + * surfaceupdatesession.submitupdated() + * user:waitforrequestl + */ + + RHeap* threadHeap = CVghwUtils::SwitchToVghwHeap(); TSurfaceInfo* surfaceInfo = EglInternalFunction_GetPlatformSurface( aDisplay, aSurface ); - EGL_CHECK_ERROR( surfaceInfo, EGL_BAD_SURFACE, EGL_FALSE ); + RemoteFunctionCallData rfcdata; + EglRFC eglApiData( rfcdata ); + eglApiData.Init(EglRFC::EeglSwapBuffers); + TSize size = surfaceInfo->iNativeWindow->Size(); + + eglApiData.AppendEGLDisplay(aDisplay); + eglApiData.AppendEGLSurface(surfaceInfo->iHostSurfaceId); + eglApiData.AppendEGLint(size.iWidth); + eglApiData.AppendEGLint(size.iHeight); - //Check if surface size has changed - TSize size = surfaceInfo->iNativeWindow->Size(); - + EGLBoolean result = aThreadState.ExecEglBooleanCmd(eglApiData); + TRequestStatus status; + TTimeStamp timestampLocalToThread; + surfaceInfo->iSurfaceUpdateSession.NotifyWhenDisplayed(status, timestampLocalToThread); + surfaceInfo->iSurfaceUpdateSession.SubmitUpdate(surfaceInfo->iNativeWindow->ScreenNumber(),surfaceInfo->iSurfaceId, surfaceInfo->iFrontBuffer); + User::WaitForRequest(status); + + if (surfaceInfo->iFrontBuffer == 0) + { + surfaceInfo->iFrontBuffer = 1; + } + else + { + surfaceInfo->iFrontBuffer = 0; + } + if (size != surfaceInfo->iSize) { EGL_TRACE("CGuestEGL::eglSwapBuffers Surface Resized size=%d,%d, surfaceInfo->iSize=%d,%d", size.iHeight, size.iWidth, surfaceInfo->iSize.iHeight, surfaceInfo->iSize.iWidth); - return EglInternalFunction_SurfaceResized(aThreadState, *surfaceInfo, aDisplay, aSurface); + + CVghwUtils::SwitchFromVghwHeap(threadHeap); + return EglInternalFunction_SurfaceResized(aThreadState, *surfaceInfo, aDisplay, aSurface); // TODO handling of resize } - return EGL_TRUE; + + CVghwUtils::SwitchFromVghwHeap(threadHeap); + + return result; } EGLBoolean CGuestEGL::eglMakeCurrent(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLSurface aDraw, EGLSurface aRead, EGLContext aContext) @@ -1080,20 +1201,22 @@ // 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"); TUint32 surfaceBufferBaseAddress(0); (void)CVghwUtils::GetSurfaceBufferBaseAddress(surfaceBufferBaseAddress); - EGL_TRACE("CGuestEGL::egliCreateSurface AFTER VGHWUtils::MapToHWAddress"); + 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) - surfaceBufferBaseAddress; aSurfaceInfo.iBuffer1Index = (chunkHWBase + offsetToSecondBuffer) - surfaceBufferBaseAddress; + + aSurfaceInfo.iFrontBuffer = 0; // Assume host peer also starts rendering buffer 0 as its front buffer EGL_TRACE("CGuestEGL::EglInternalFunction_CreateSurface %u %x %x %x %x",chunkHWBase, offsetToFirstBuffer, offsetToSecondBuffer, aSurfaceInfo.iBuffer0Index, aSurfaceInfo.iBuffer1Index); diff -r 1a4430846fcf -r 36992771cbb1 guestrendering/guestopenvg/rom/guestopenvg.iby --- a/guestrendering/guestopenvg/rom/guestopenvg.iby Fri Sep 24 12:02:56 2010 +0100 +++ b/guestrendering/guestopenvg/rom/guestopenvg.iby Fri Sep 24 13:29:27 2010 +0100 @@ -18,6 +18,5 @@ file=ABI_DIR\BUILD_DIR\guestopenvg.dll sys\bin\libopenvg.dll file=ABI_DIR\BUILD_DIR\guestopenvgu.dll sys\bin\libopenvgu.dll -file=ABI_DIR\BUILD_DIR\vghwutils.dll sys\bin\vghwutils.dll file=ABI_DIR\BUILD_DIR\vghwserialiser.dll sys\bin\vghwserialiser.dll #endif diff -r 1a4430846fcf -r 36992771cbb1 guestrendering/guestvideodriver/ldd/group/virtualvideohwdevice.mmp --- a/guestrendering/guestvideodriver/ldd/group/virtualvideohwdevice.mmp Fri Sep 24 12:02:56 2010 +0100 +++ b/guestrendering/guestvideodriver/ldd/group/virtualvideohwdevice.mmp Fri Sep 24 13:29:27 2010 +0100 @@ -33,8 +33,11 @@ USERINCLUDE ../inc USERINCLUDE ../../commoninc -#include <../../../../../../adaptation/qemu/baseport/syborg/variant.mmh> -USERINCLUDE ../../../../../../adaptation/qemu/baseport/syborg/specific +// NOTE the old name was "adaptation". The new layer name is "adapt". +// If your repository is off ...adaptation, re-sync it from its new home +// for example http://developer.symbian.org/oss/FCL/sf/adapt/qemu +#include <../../../../../../adapt/qemu/baseport/syborg/variant.mmh> +USERINCLUDE ../../../../../../adapt/qemu/baseport/syborg/specific SYSTEMINCLUDE /epoc32/include/drivers diff -r 1a4430846fcf -r 36992771cbb1 guestrendering/vghwutils/eabi/vghwutilsu.def --- a/guestrendering/vghwutils/eabi/vghwutilsu.def Fri Sep 24 12:02:56 2010 +0100 +++ b/guestrendering/vghwutils/eabi/vghwutilsu.def Fri Sep 24 13:29:27 2010 +0100 @@ -1,36 +1,32 @@ -EXPORTS - _Z9VghwPanic10TVghwPanicPcS0_S0_i @ 1 NONAME - _ZN10CVghwUtils14MapToHWAddressEiRm @ 2 NONAME - _ZN10CVghwUtils20DriverExecuteCommandER22RemoteFunctionCallData @ 3 NONAME - _ZN10CVghwUtils11InitStaticsEv @ 4 NONAME - _ZN10CVghwUtils5AllocEi @ 5 NONAME - _ZN10CVghwUtils4FreeEPv @ 6 NONAME - _ZN10CVghwUtils7GetHeapEv @ 7 NONAME - _ZN10CVghwUtils16SwitchToVghwHeapEv @ 8 NONAME - _ZN10CVghwUtils18SwitchFromVghwHeapEP5RHeap @ 9 NONAME - Reserved10 @ 10 NONAME ABSENT - Reserved11 @ 11 NONAME ABSENT - _ZN10CVghwUtils17CreateThreadStateEv @ 12 NONAME - _ZN10CVghwUtils18ReleaseThreadStateEv @ 13 NONAME - _ZN10CVghwUtils14EglThreadStateEv @ 14 NONAME - _ZN10CVghwUtils9VgContextEv @ 15 NONAME - _ZN10CVghwUtils11GlesContextEv @ 16 NONAME - _ZN15TEglThreadState8EglErrorEv @ 17 NONAME - _ZN15TEglThreadState17ExecEglBooleanCmdER6EglRFC @ 18 NONAME - _ZN15TEglThreadState17ExecEglContextCmdER6EglRFC @ 19 NONAME - _ZN15TEglThreadState17ExecEglSurfaceCmdER6EglRFC @ 20 NONAME - _ZN10CVghwUtils16EglManagementApiEv @ 21 NONAME - _ZN10CVghwUtils15EglGetSgHandlesEyPy @ 22 NONAME - _ZN10CVghwUtils14DestroyStaticsEv @ 23 NONAME - _ZN10CVghwUtils19SetEglManagementApiEP17MEglManagementApi @ 24 NONAME - _ZN10CVghwUtils14SetVgApiForEglEP12MVgApiForEgl @ 25 NONAME - _ZN10CVghwUtils18SetGles11ApiForEglEP16MGles11ApiForEgl @ 26 NONAME - _ZN10CVghwUtils17SetGles2ApiForEglEP15MGles2ApiForEgl @ 27 NONAME - _ZN10CVghwUtils11VgApiForEglEv @ 28 NONAME - _ZN10CVghwUtils15Gles11ApiForEglEv @ 29 NONAME - _ZN10CVghwUtils14Gles2ApiForEglEv @ 30 NONAME - _ZN10CVghwUtils27GetSurfaceBufferBaseAddressERm @ 31 NONAME - - - - +EXPORTS + _Z9VghwPanic10TVghwPanicPcS0_S0_i @ 1 NONAME + _ZN10CVghwUtils14MapToHWAddressEiRm @ 2 NONAME + _ZN10CVghwUtils20DriverExecuteCommandER22RemoteFunctionCallData @ 3 NONAME + _ZN10CVghwUtils11InitStaticsEv @ 4 NONAME + _ZN10CVghwUtils5AllocEi @ 5 NONAME + _ZN10CVghwUtils4FreeEPv @ 6 NONAME + _ZN10CVghwUtils7GetHeapEv @ 7 NONAME + _ZN10CVghwUtils16SwitchToVghwHeapEv @ 8 NONAME + _ZN10CVghwUtils18SwitchFromVghwHeapEP5RHeap @ 9 NONAME + Reserved10 @ 10 NONAME ABSENT + Reserved11 @ 11 NONAME ABSENT + _ZN10CVghwUtils17CreateThreadStateEv @ 12 NONAME + _ZN10CVghwUtils18ReleaseThreadStateEv @ 13 NONAME + _ZN10CVghwUtils14EglThreadStateEv @ 14 NONAME + _ZN10CVghwUtils9VgContextEv @ 15 NONAME + _ZN10CVghwUtils11GlesContextEv @ 16 NONAME + _ZN15TEglThreadState8EglErrorEv @ 17 NONAME + _ZN15TEglThreadState17ExecEglBooleanCmdER6EglRFC @ 18 NONAME + _ZN15TEglThreadState17ExecEglContextCmdER6EglRFC @ 19 NONAME + _ZN15TEglThreadState17ExecEglSurfaceCmdER6EglRFC @ 20 NONAME + _ZN10CVghwUtils16EglManagementApiEv @ 21 NONAME + _ZN10CVghwUtils15EglGetSgHandlesEyPy @ 22 NONAME + _ZN10CVghwUtils14DestroyStaticsEv @ 23 NONAME + _ZN10CVghwUtils19SetEglManagementApiEP17MEglManagementApi @ 24 NONAME + _ZN10CVghwUtils14SetVgApiForEglEP12MVgApiForEgl @ 25 NONAME + _ZN10CVghwUtils18SetGles11ApiForEglEP16MGles11ApiForEgl @ 26 NONAME + _ZN10CVghwUtils17SetGles2ApiForEglEP15MGles2ApiForEgl @ 27 NONAME + _ZN10CVghwUtils11VgApiForEglEv @ 28 NONAME + _ZN10CVghwUtils15Gles11ApiForEglEv @ 29 NONAME + _ZN10CVghwUtils14Gles2ApiForEglEv @ 30 NONAME + _ZN10CVghwUtils27GetSurfaceBufferBaseAddressERm @ 31 NONAME diff -r 1a4430846fcf -r 36992771cbb1 guestrendering/vghwutils/rom/vghwutils.iby --- a/guestrendering/vghwutils/rom/vghwutils.iby Fri Sep 24 12:02:56 2010 +0100 +++ b/guestrendering/vghwutils/rom/vghwutils.iby Fri Sep 24 13:29:27 2010 +0100 @@ -13,13 +13,13 @@ // Description: -#ifndef PLATSIMVGHWUTILS_IBY -#define PLATSIMVGHWUTILS_IBY +#ifndef GUESTRENDERING_VGHWUTILS_IBY +#define GUESTRENDERING_VGHWUTILS_IBY file=ABI_DIR\BUILD_DIR\vghwutils.dll \sys\bin\vghwutils.dll -#endif // PLATSIMVGHWUTILS_IBY +#endif // GUESTRENDERING_VGHWUTILS_IBY // End of File