222 |
222 |
223 RWindow* window; |
223 RWindow* window; |
224 window = (RWindow*) aNativeWindow; |
224 window = (RWindow*) aNativeWindow; |
225 TSize size = window->Size(); |
225 TSize size = window->Size(); |
226 |
226 |
227 EGLSurface newSurfaceId = EGL_NO_SURFACE; |
|
228 TSurfaceInfo* surfaceInfo = NULL; |
227 TSurfaceInfo* surfaceInfo = NULL; |
229 EGLint error = EGL_BAD_DISPLAY; |
|
230 TSurfaceId surfaceId; |
228 TSurfaceId surfaceId; |
231 |
229 |
232 RSurfaceManager::TSurfaceCreationAttributesBuf buf; |
230 RSurfaceManager::TSurfaceCreationAttributesBuf buf; |
233 RSurfaceManager::TSurfaceCreationAttributes& attributes = buf(); |
231 RSurfaceManager::TSurfaceCreationAttributes& attributes = buf(); |
234 |
232 |
235 attributes.iSize = size; |
233 attributes.iSize = size; |
236 attributes.iBuffers = 2; // REQUIREMENT because host side assumes exactly two buffers |
234 attributes.iBuffers = 2; // REQUIREMENT because host side assumes exactly two buffers |
237 attributes.iPixelFormat = EUidPixelFormatARGB_8888; // this is a guess; either query or hardcode to match syborg |
235 attributes.iPixelFormat = EUidPixelFormatARGB_8888; // this is a guess; either query or hardcode to match syborg |
238 attributes.iStride = 4 * size.iWidth; // Number of bytes between start of one line and start of next |
236 attributes.iStride = 4 * size.iWidth; // Number of bytes between start of one line and start of next |
239 attributes.iOffsetToFirstBuffer = 0; |
237 attributes.iOffsetToFirstBuffer = 0; |
240 attributes.iAlignment = EPageAligned; // alignment, 1,2,4,8,16,32,64 byte aligned or EPageAligned |
238 attributes.iAlignment = RSurfaceManager::EPageAligned; // alignment, 1,2,4,8,16,32,64 byte aligned or EPageAligned |
241 attributes.iHintCount=0; |
239 attributes.iHintCount=0; |
242 attributes.iSurfaceHints = NULL; |
240 attributes.iSurfaceHints = NULL; |
243 attributes.iOffsetBetweenBuffers = 0; |
241 attributes.iOffsetBetweenBuffers = 0; |
244 attributes.iContiguous = ETrue; |
242 attributes.iContiguous = ETrue; |
245 attributes.iCacheAttrib = RSurfaceManager::ENotCached; // Cache attributes |
243 attributes.iCacheAttrib = RSurfaceManager::ENotCached; // Cache attributes |
257 { |
255 { |
258 surfaceInfo->iNativeWindow = (RWindow*)aNativeWindow; |
256 surfaceInfo->iNativeWindow = (RWindow*)aNativeWindow; |
259 surfaceInfo->iConfigId = aConfig; |
257 surfaceInfo->iConfigId = aConfig; |
260 surfaceInfo->iSurfaceManager.Open(); |
258 surfaceInfo->iSurfaceManager.Open(); |
261 surfaceInfo->iSurfaceManager.CreateSurface(buf, surfaceId); |
259 surfaceInfo->iSurfaceManager.CreateSurface(buf, surfaceId); |
262 (*pDispInfo)->iSurfaceMap.Insert(surfaceId, surfaceInfo); |
|
263 (void) surfaceInfo->iSurfaceManager.MapSurface(surfaceId, surfaceInfo->iChunk); |
260 (void) surfaceInfo->iSurfaceManager.MapSurface(surfaceId, surfaceInfo->iChunk); |
264 RemoteFunctionCallData rfcdata; |
261 RemoteFunctionCallData rfcdata; |
265 EglRFC eglApiData( rfcdata ); |
262 EglRFC eglApiData( rfcdata ); |
266 eglApiData.Init( EglRFC::EeglCreateWindowSurface); |
263 eglApiData.Init( EglRFC::EeglCreateWindowSurface); |
267 eglApiData.AppendEGLDisplay(aDisplay); |
264 eglApiData.AppendEGLDisplay(aDisplay); |
271 eglApiData.AppendEGLint(size.iWidth); |
268 eglApiData.AppendEGLint(size.iWidth); |
272 eglApiData.AppendEGLint(size.iHeight); |
269 eglApiData.AppendEGLint(size.iHeight); |
273 eglApiData.AppendEGLint(1000); // horizontalPitch arbitrary |
270 eglApiData.AppendEGLint(1000); // horizontalPitch arbitrary |
274 eglApiData.AppendEGLint(1000); // verticalPitch arbitrary |
271 eglApiData.AppendEGLint(1000); // verticalPitch arbitrary |
275 surfaceInfo->iHostSurfaceId = aThreadState.ExecEglSurfaceCmd(eglApiData); // todo check if is valid |
272 surfaceInfo->iHostSurfaceId = aThreadState.ExecEglSurfaceCmd(eglApiData); // todo check if is valid |
|
273 (*pDispInfo)->iSurfaceMap.Insert(surfaceInfo->iHostSurfaceId, surfaceInfo); |
276 EglInternalFunction_CreateSurface(aThreadState, aDisplay, surfaceInfo->iHostSurfaceId, aConfig, window, *surfaceInfo); |
274 EglInternalFunction_CreateSurface(aThreadState, aDisplay, surfaceInfo->iHostSurfaceId, aConfig, window, *surfaceInfo); |
277 surfaceInfo->iSurfaceUpdateSession.Connect(); |
275 surfaceInfo->iSurfaceUpdateSession.Connect(); |
278 TSurfaceConfiguration surfaceConfig; |
276 TSurfaceConfiguration surfaceConfig; |
279 surfaceConfig.SetSurfaceId(surfaceId); |
277 surfaceConfig.SetSurfaceId(surfaceId); |
280 window->SetBackgroundSurface(surfaceConfig, ETrue); |
278 window->SetBackgroundSurface(surfaceConfig, ETrue); |