Update contrib.
1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
21 #include "egltest_image.h"
23 #include <iniparser.h>
24 #include <test/tefunit.h> // for ASSERT macros
26 #include <test/egltestcommonconversion.h>
27 #include <test/egltestcommoninisettings.h>
28 #include <test/egltestcommonsgimageinfo.h>
32 @SYMTestCaseID GRAPHICS-EGL-0107
38 @SYMREQ See SGL.GT0386.401 document
41 Tests the use of an EglImageKHR object with OpenVG, using the “EGL_IMAGE_PRESERVED” attribute.
42 This means we can draw to the source RSgImage as soon as it is created.
45 This test will check for the “VG_KHR_EGL_image” extension, if it is not supported on this platform then the test will return immediately without failure.
46 Create a reference Bitmap
47 Create and fully construct an RSgImage object having the same content as the reference bitmap
48 • Set the iUsage bit to ESgUsageBitOpenVgImage
49 Pass the RSgImage object into eglCreateImageKHR() with
50 • The target parameter set to EGL_NATIVE_PIXMAP_KHR
51 • Use the current display and EGL_NO_CONTEXT
52 • Use the “EGL_IMAGE_PRESERVED” attribute
53 Check that eglCreateImageKHR() does NOT return EGL_NO_IMAGE_KHR
54 Create and make current and EGL context bound to OVG APIs and linked to a pixmap surface.
55 • Set the iUsage bit of the underlying RSgImage to ESgUsageBitOpenVgSurface
56 Use vgCreateEGLImageTargetKHR() to construct a VGImage object from the EGLImage.
58 Use OpenVG to copy the VGImage created from the EGLImage to the new pixmap surface currently linked to the context.
59 Call eglWaitClient() to finish the above drawing instructions synchronously.
60 Destroy the original image data
61 • Pass the VGImage into vgDestroyImage()
62 • Pass the EGLImage into eglDestroyImageKHR()
64 Check that the pixmap contains expected pixel values.
66 Check for memory and handle leaks
68 @SYMTestExpectedResults
69 eglCreateImageKHR() does NOT return EGL_NO_IMAGE_KHR
70 After each call to an OpenVG method, check that vgGetError() returns VG_NO_ERROR
71 The pixmap contains expected pixel values after the original image data has been destroyed
72 No memory or handle leaks
74 TVerdict CEglTest_EGL_Image_RSgImage_UseOpenVG_PersistImageData::doTestStepL()
76 SetTestStepID(_L("GRAPHICS-EGL-0107"));
77 INFO_PRINTF1(_L("CEglTest_EGL_Image_RSgImage_UseOpenVG::doTestStepL"));
79 TBool ret = CheckForExtensionL(KEGL_RSgimage | KEGL_KHR_image_base | KEGL_KHR_image_pixmap | KVG_KHR_EGL_image);
82 // The extension is not supported
84 CloseTMSGraphicsStep();
85 return TestStepResult();
88 // This test is performed for default pixel format
89 PrintUsedPixelConfiguration();
91 // Create display object
94 iEglSess->InitializeL();
95 iEglSess->OpenSgDriverL();
97 // Create RSgImage's attributes.
98 //This image will become a VGImage. It will be Cleared via vgClear
99 TSgImageInfoTest imageInfo = TSgImageInfoTest(iSourceFormat, KPixmapSize);
100 #ifdef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
101 imageInfo.iUsage = ESgUsageBitOpenVgImage | ESgUsageBitOpenVgSurface;
103 imageInfo.iUsage = ESgUsageOpenVgImage | ESgUsageOpenVgTarget;
105 INFO_PRINTF1(_L("Creating an RSgImage"));
107 CleanupClosePushL(sgImage);
108 ret = sgImage.Create(imageInfo, NULL, NULL);
109 ASSERT_EQUALS(ret, KErrNone);
111 INFO_PRINTF1(_L("Calling eglBindAPI(EGL_OPENVG_API)"));
112 ASSERT_EGL_TRUE(eglBindAPI(EGL_OPENVG_API));
114 EGLint numConfigsWithPre = 0;
115 EGLConfig configWithPre;
116 const EGLint KAttribImagePre[] = { EGL_MATCH_NATIVE_PIXMAP, reinterpret_cast<EGLint>(&sgImage),
117 EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT,
118 EGL_SURFACE_TYPE, EGL_PIXMAP_BIT | EGL_VG_ALPHA_FORMAT_PRE_BIT,
120 ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KAttribImagePre, &configWithPre, 1, &numConfigsWithPre));
122 // Create a pixmap surface from the native image
123 INFO_PRINTF1(_L("Calling eglCreatePixmapSurface"));
124 EGLSurface surface = eglCreatePixmapSurface(iDisplay, configWithPre, &sgImage, KPixmapAttribsVgAlphaFormatPre );
125 ASSERT_EGL_TRUE(surface != EGL_NO_SURFACE);
127 // Create a context for drawing to/reading from the pixmap surface and make it current
128 INFO_PRINTF1(_L("Calling eglCreateContext"));
129 EGLContext context = eglCreateContext(iDisplay, configWithPre, EGL_NO_CONTEXT, NULL);
130 ASSERT_EGL_TRUE(context != EGL_NO_CONTEXT);
132 INFO_PRINTF1(_L("Calling eglMakeCurrent"));
133 ASSERT_EGL_TRUE(eglMakeCurrent(iDisplay, surface, surface, context));
135 //Drawing to the current surface (and hence to the RSgImage) to test that the contents are preserved
136 //create a reference bitmap to use the values (we use index=1)
137 TDisplayMode bitmapMode = EglTestConversion::PixelFormatToDisplayMode(iSourceFormat);
138 CFbsBitmap* bitmap = iEglSess->CreateReferenceBitmapL(bitmapMode, KPixmapSize, 1);
139 CleanupStack::PushL(bitmap);
140 // Mind the fact that CFbsBitmap and VGImages use different coordinates origin!
141 TSize bitmapSize = bitmap->SizeInPixels();
142 TUint8* address = reinterpret_cast<TUint8*>(bitmap->DataAddress());
143 TInt stride = bitmap->DataStride();
144 address += (bitmapSize.iHeight - 1) * stride;
145 vgWritePixels(address, -stride, KDefaultSurfaceFormat,0,0, bitmapSize.iWidth, bitmapSize.iHeight);
146 ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
147 eglWaitClient(); // wait for writing to finish
148 ASSERT_EGL_TRUE(eglDestroySurface(iDisplay, surface)); //Destroying Surface handle
150 INFO_PRINTF1(_L("Create a EGLImage out of the SgImage"));
151 EGLImageKHR imageKHR = iEglSess->eglCreateImageKhrL(iDisplay,EGL_NO_CONTEXT,EGL_NATIVE_PIXMAP_KHR,&sgImage,KEglImageAttribsPreservedTrue);
152 ASSERT_EGL_TRUE(imageKHR != EGL_NO_IMAGE_KHR);
154 INFO_PRINTF1(_L("Create a VGImage out of the EGLImage"));
155 VGImage vgImageTarget = iEglSess->vgCreateImageTargetKHR((VGeglImageKHR)imageKHR);
156 ASSERT_VG_TRUE(vgImageTarget != VG_INVALID_HANDLE);
158 //Create an OffScreen Pixmap to be used as an OpenVg target using the same config of the previous RSgImage
160 imageInfo.iSizeInPixels = KPixmapSize;
161 #ifdef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
162 imageInfo.iUsage = ESgUsageBitOpenVgSurface;
164 imageInfo.iUsage = ESgUsageOpenVgTarget;
166 RSgImage sgImageTarget;
167 CleanupClosePushL(sgImageTarget);
168 ret = sgImageTarget.Create(imageInfo, NULL, NULL);
169 ASSERT_EQUALS(ret, KErrNone);
171 surface = eglCreatePixmapSurface(iDisplay, configWithPre, &sgImageTarget, KPixmapAttribsVgAlphaFormatPre);
172 ASSERT_EGL_TRUE(surface != EGL_NO_SURFACE);
174 INFO_PRINTF1(_L("Calling eglMakeCurrent"));
175 ASSERT_EGL_TRUE(eglMakeCurrent(iDisplay, surface, surface, context));
177 //Copy the source VGImage to the surface
178 vgSetPixels(0, 0, vgImageTarget, 0, 0, KPixmapSize.iWidth, KPixmapSize.iHeight);
179 ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
182 vgDestroyImage(vgImageTarget); //Destroying VGImage handle
183 ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
184 ASSERT_EGL_TRUE(iEglSess->DestroyEGLImage(iDisplay, imageKHR)); //Destroying EGLImage handle
185 sgImage.Close(); //Destroying SgImage and so the actual data
187 // we can now compare the VgImage to the one we would expect for this particular process
188 iEglSess->CheckVgDrawingL(iSurfaceFormat, bitmap);
190 ASSERT_EGL_TRUE(eglDestroyContext(iDisplay, context)); //Closing eglContext
191 ASSERT_EGL_TRUE(eglDestroySurface(iDisplay,surface)); //Destroying Target Surface handle
192 sgImageTarget.Close(); //Destroying 2nd RSgImage handle
195 CleanupStack::PopAndDestroy(3,&sgImage); // sgImage, bitmap, sgImageTarget
198 CloseTMSGraphicsStep();
199 return TestStepResult();
203 @SYMTestCaseID GRAPHICS-EGL-0108
209 @SYMREQ See SGL.GT0386.401 document
212 Ensure that if there are more than one EGLImage and some of them are destroyed,
213 the other images remain workable
216 Create a reference Bitmap
217 Create and fully construct 4 RSgImage objects having the same content as the reference bitmap
218 • Set the iUsage bit to ESgUsageBitOpenVgImage
219 Pass the 4 RSgImage objects into eglCreateImageKHR() with
220 • The target parameter set to EGL_NATIVE_PIXMAP_KHR
221 • Use the current display and EGL_NO_CONTEXT
222 • Use a NULL attr_list
223 Check that those calls to eglCreateImageKHR() do NOT return EGL_NO_IMAGE_KHR
224 Create and make current and EGL context bound to OVG APIs and linked to a pixmap surface.
225 • Set the iUsage bit of the underlying RSgImage to ESgUsageBitOpenVgSurface
226 Use vgCreateEGLImageTargetKHR() to construct VGImage objects from the just created EGLImages.
228 Destroy all the RSgImages.
229 Pass the 2nd and the 3rd EGLImeges to eglDestroyImageKHR().
230 Call vgDestroyImage on the 2nd VGImage too.
231 Use OpenVG to draw the VGImage created from the 4th EGLImage to the new pixmap surface currently linked to the context.
232 Call eglWaitClient() to finish the above drawing instructions synchronously.
233 Check that the pixmap contains expected pixel values.
234 Clear the destination surface to the default background color
235 Use OpenVG to draw the VGImage created from the 3rd EGLImage to the new pixmap surface currently linked to the context.
236 Call eglWaitClient() to finish the above drawing instructions synchronously.
237 Check that the pixmap contains expected pixel values.
238 Clear the destination surface to the default background color
239 Destroy and restore the 4th VGImage and copy it to the pixmap surface.
240 Call eglWaitClient() to finish the above drawing instructions synchronously.
241 Check that the pixmap contains expected pixel values.
242 Pass all the VGImages left into vgDestroyImage()
243 Pass the EGLImage left into eglDestroyImageKHR()
245 Check for memory and handle leaks
247 @SYMTestExpectedResults
248 Pixmap surface has the expected contents
249 No memory or handle leaks
252 TVerdict CEglTest_EGL_Image_Consistent_Linked_List::doTestStepL()
254 SetTestStepID(_L("GRAPHICS-EGL-0108"));
255 INFO_PRINTF1(_L("CEglTest_EGL_Image_Consistent_Linked_List::doTestStepL"));
257 TBool ret = CheckForExtensionL(KEGL_RSgimage | KEGL_KHR_image_base | KEGL_KHR_image_pixmap | KVG_KHR_EGL_image);
260 // The extension is not supported
262 CloseTMSGraphicsStep();
263 return TestStepResult();
266 // This test is performed for default pixel format
267 PrintUsedPixelConfiguration();
269 // Create display object
272 iEglSess->InitializeL();
273 iEglSess->OpenSgDriverL();
275 // Create a reference bitmap which we use to init the SgImage (we use index=6)
276 TDisplayMode bitmapMode = EglTestConversion::PixelFormatToDisplayMode(iSourceFormat);
277 CFbsBitmap* bitmap = iEglSess->CreateReferenceBitmapL(bitmapMode, KPixmapSize, 6);
278 CleanupStack::PushL(bitmap);
280 INFO_PRINTF1(_L("Creating 4 RSgImages"));
281 TSgImageInfoOpenVgImage imageInfo = TSgImageInfoOpenVgImage(iSourceFormat, KPixmapSize);
283 CleanupClosePushL(sgImage1);
284 ASSERT_EQUALS(sgImage1.Create(imageInfo, bitmap->DataAddress(), bitmap->DataStride()), KErrNone);
286 CleanupClosePushL(sgImage2);
287 ASSERT_EQUALS(sgImage2.Create(imageInfo, bitmap->DataAddress(), bitmap->DataStride()), KErrNone);
289 CleanupClosePushL(sgImage3);
290 ASSERT_EQUALS(sgImage3.Create(imageInfo, bitmap->DataAddress(), bitmap->DataStride()), KErrNone);
292 CleanupClosePushL(sgImage4);
293 ASSERT_EQUALS(sgImage4.Create(imageInfo, bitmap->DataAddress(), bitmap->DataStride()), KErrNone);
295 INFO_PRINTF1(_L("Creating 4 EGLImages"));
296 EGLImageKHR imageKHR1 = iEglSess->eglCreateImageKhrL(iDisplay, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, &sgImage1, KEglImageAttribsPreservedTrue);
297 ASSERT_EGL_TRUE(imageKHR1 != EGL_NO_IMAGE_KHR);
298 EGLImageKHR imageKHR2 = iEglSess->eglCreateImageKhrL(iDisplay, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, &sgImage2, KEglImageAttribsPreservedTrue);
299 ASSERT_EGL_TRUE(imageKHR2 != EGL_NO_IMAGE_KHR);
300 EGLImageKHR imageKHR3 = iEglSess->eglCreateImageKhrL(iDisplay, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, &sgImage3, KEglImageAttribsPreservedTrue);
301 ASSERT_EGL_TRUE(imageKHR3 != EGL_NO_IMAGE_KHR);
302 EGLImageKHR imageKHR4 = iEglSess->eglCreateImageKhrL(iDisplay, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, &sgImage4, KEglImageAttribsPreservedTrue);
303 ASSERT_EGL_TRUE(imageKHR4 != EGL_NO_IMAGE_KHR);
305 //Create a Surface and Link it to a Context bound to OpenVG
306 TUidPixelFormat pixelFormat = EglTestConversion::VgFormatToSgPixelFormat(iSurfaceFormat);
307 TSgImageInfoOpenVgTarget imageInfo2 = TSgImageInfoOpenVgTarget(pixelFormat, KPixmapSize);
308 iEglSess->CreatePixmapSurfaceAndMakeCurrentAndMatchL(imageInfo2, CTestEglSession::EResourceCloseSgImageEarly);
310 INFO_PRINTF1(_L("Creating 4 VGImages from the four EGLImages"));
311 VGImage vgImage1 = iEglSess->vgCreateImageTargetKHR((VGeglImageKHR)imageKHR1);
312 ASSERT_VG_TRUE(vgImage1 != VG_INVALID_HANDLE);
313 VGImage vgImage2 = iEglSess->vgCreateImageTargetKHR((VGeglImageKHR)imageKHR2);
314 ASSERT_VG_TRUE(vgImage2 != VG_INVALID_HANDLE);
315 VGImage vgImage3 = iEglSess->vgCreateImageTargetKHR((VGeglImageKHR)imageKHR3);
316 ASSERT_VG_TRUE(vgImage3 != VG_INVALID_HANDLE);
317 VGImage vgImage4 = iEglSess->vgCreateImageTargetKHR((VGeglImageKHR)imageKHR4);
318 ASSERT_VG_TRUE(vgImage4 != VG_INVALID_HANDLE);
320 INFO_PRINTF1(_L("Destroying all RSgImage, the 2nd and the 3rd EGLImage, the 2nd VGImage"));
321 CleanupStack::PopAndDestroy(4, &sgImage1); // closes the 4 RSgImages
322 ASSERT_EGL_TRUE(iEglSess->DestroyEGLImage(iDisplay, imageKHR2)); //Destroying 2nd EGLImage handle
323 ASSERT_EGL_TRUE(iEglSess->DestroyEGLImage(iDisplay, imageKHR3)); //Destroying 3rd EGLImage handle
324 vgDestroyImage(vgImage2); //Destroying 2nd VGImage handle
325 ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
327 //Copy the source VGImage to the surface
328 INFO_PRINTF1(_L("Drawing the 4th VGImage content to the surface"));
329 vgSetPixels(0, 0, vgImage4, 0, 0, KPixmapSize.iWidth, KPixmapSize.iHeight);
330 ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
332 iEglSess->CheckVgDrawingL(iSurfaceFormat, bitmap);
333 INFO_PRINTF1(_L("Content is as expected"));
335 INFO_PRINTF1(_L("Clear the surface and draw the 3rd VGImage content to the surface"));
336 VGfloat bgColor[] = {0.25, 0.50, 0.75, 1.0}; // random opaque colour
337 vgSetfv(VG_CLEAR_COLOR, 4, bgColor);
338 vgClear(0, 0, KPixmapSize.iWidth, KPixmapSize.iHeight);
339 ASSERT_EGL_TRUE(vgGetError() == VG_NO_ERROR);
340 vgSetPixels(0, 0, vgImage3, 0, 0, KPixmapSize.iWidth, KPixmapSize.iHeight);
341 ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
343 iEglSess->CheckVgDrawingL(iSurfaceFormat, bitmap);
344 INFO_PRINTF1(_L("Content is as expected"));
346 INFO_PRINTF1(_L("Clear the surface, destroy the 4th VGImage and, after having it set up again, copy its content to the surface"));
347 vgSetfv(VG_CLEAR_COLOR, 4, bgColor);
348 vgClear(0, 0, KPixmapSize.iWidth, KPixmapSize.iHeight);
349 ASSERT_EGL_TRUE(vgGetError() == VG_NO_ERROR);
350 vgDestroyImage(vgImage4); //Destroying 4th VGImage handle
351 ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
352 vgImage4 = VG_INVALID_HANDLE;
353 vgImage4 = iEglSess->vgCreateImageTargetKHR((VGeglImageKHR)imageKHR4); //Creating 4th image again
354 ASSERT_VG_TRUE(vgImage4 != VG_INVALID_HANDLE);
355 vgSetPixels(0, 0, vgImage4, 0, 0, KPixmapSize.iWidth, KPixmapSize.iHeight);
356 ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
358 iEglSess->CheckVgDrawingL(iSurfaceFormat, bitmap);
359 INFO_PRINTF1(_L("Content is as expected"));
361 INFO_PRINTF1(_L("Destroying remaining images"));
362 vgDestroyImage(vgImage1); //Destroying 1st VGImage handle
363 ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
364 vgDestroyImage(vgImage3); //Destroying 3rd VGImage handle
365 ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
366 vgDestroyImage(vgImage4); //Destroying 4th VGImage handle
367 ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
368 ASSERT_EGL_TRUE(iEglSess->DestroyEGLImage(iDisplay, imageKHR1)); //Destroying 1st EGLImage handle
369 ASSERT_EGL_TRUE(iEglSess->DestroyEGLImage(iDisplay, imageKHR4)); //Destroying 4th EGLImage handle
372 CleanupStack::PopAndDestroy(bitmap);
375 CloseTMSGraphicsStep();
376 return TestStepResult();
380 @SYMTestCaseID GRAPHICS-EGL-0112
386 @SYMREQ See SGL.GT0386.401 document
389 Ensure that the EGL implementation holds a handle to the SgDriver.
390 In this way all the resource may be used even though a call to SgDriver::Close() has been made.
393 Create a RSgImage with the same content as the reference bitmap.
394 Create a EGLImage from the RSgImage.
396 Create a pbuffer surface, a context and make them current.
397 Create a VGImage from the eglImage.
398 Copy the VGImage to the surface.
400 Release all resources.
402 @SYMTestExpectedResults
403 If creation of pbuffer fails, silently terminate the test without failing, as it is not mandatory to support
405 The surface contains the expected contents.
406 No memory or handle leaks.
408 TVerdict CEglTest_EGL_Image_SgDriverHandle::doTestStepL()
410 SetTestStepID(_L("GRAPHICS-EGL-0112"));
411 INFO_PRINTF1(_L("CEglTest_EGL_Image_SgDriverHandle::doTestStepL"));
413 TBool ret = CheckForExtensionL(KEGL_RSgimage | KEGL_KHR_image_base | KEGL_KHR_image_pixmap | KVG_KHR_EGL_image);
416 // The extension is not supported
418 CloseTMSGraphicsStep();
419 return TestStepResult();
422 // This test is performed for default pixel format
423 PrintUsedPixelConfiguration();
425 // Create display object
428 iEglSess->InitializeL();
429 iEglSess->OpenSgDriverL();
432 CleanupClosePushL(sgImage);
434 // Create a reference bitmap which we use to init the SgImage (we use index=6)
435 TDisplayMode bitmapMode = EglTestConversion::PixelFormatToDisplayMode(iSourceFormat);
436 CFbsBitmap* bitmap = iEglSess->CreateReferenceBitmapL(bitmapMode, KPixmapSize, 6);
437 CleanupStack::PushL(bitmap);
439 INFO_PRINTF1(_L("Creating 1 RSgImage"));
440 TSgImageInfoOpenVgImage imageInfo = TSgImageInfoOpenVgImage(iSourceFormat, KPixmapSize);
441 ASSERT_EQUALS(sgImage.Create(imageInfo, bitmap->DataAddress(), bitmap->DataStride()), KErrNone);
442 CleanupStack::PopAndDestroy(bitmap);
444 INFO_PRINTF1(_L("Creating 1 EGLImage from the RSgImage"));
445 EGLImageKHR imageKHR = iEglSess->eglCreateImageKhrL(iDisplay, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, &sgImage, KEglImageAttribsPreservedTrue);
446 ASSERT_EGL_TRUE(imageKHR != EGL_NO_IMAGE_KHR);
448 //close SgImage before closing the SgDriver
449 CleanupStack::PopAndDestroy(&sgImage);
451 INFO_PRINTF1(_L("Closing the SgDriver now should cause no difference"));
452 iEglSess->CloseSgDriver();
454 // If create pbuffer surface fails, don't fail if there's no matching config (but fail in any other situation):
455 // Support for a pbuffer surface is not mandated for any pixel format
456 // We should not enforce it in the tests
457 // Silently terminate the test without failing.
458 TEglTestConfig pbufferFormat = EglTestConversion::VgFormatToPBufferSurfaceFormat(iSurfaceFormat);
459 EGLConfig currentConfig = 0;
460 TRAPD(res, currentConfig = iEglSess->GetConfigExactMatchL( pbufferFormat ));
461 if(res == KTestNoMatchingConfig)
463 WARN_PRINTF2(_L("Can't create pbuffer, format %d. Terminating the test without failing"), pbufferFormat);
464 ASSERT_EGL_TRUE(iEglSess->DestroyEGLImage(iDisplay, imageKHR));
467 CloseTMSGraphicsStep();
468 return TestStepResult();
470 User::LeaveIfError(res); // leave here if any other error was raised other than the one above.
471 iEglSess->CreatePbufferSurfaceAndMakeCurrentL(currentConfig, KPixmapSizeBigger, EGL_OPENVG_API);
473 INFO_PRINTF1(_L("Creating 1 VGImage from the EGLImage"));
474 VGImage vgImage = iEglSess->vgCreateImageTargetKHR((VGeglImageKHR)imageKHR);
475 ASSERT_VG_TRUE(vgImage != VG_INVALID_HANDLE);
477 INFO_PRINTF1(_L("Copying the VGImage to the surface"));
478 vgSetPixels(0, 0, vgImage, 0, 0, KPixmapSize.iWidth, KPixmapSize.iHeight);
479 ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
482 // Re-create a reference bitmap which we use to init the SgImage (we use index=6)
483 CFbsBitmap* refBitmap = iEglSess->CreateReferenceBitmapL(bitmapMode, KPixmapSize, 6);
484 CleanupStack::PushL(refBitmap);
485 iEglSess->CheckVgDrawingL(iSurfaceFormat, refBitmap);
486 CleanupStack::PopAndDestroy(refBitmap);
487 INFO_PRINTF1(_L("Content is as expected"));
489 // destroy eglimage and vgimage
490 vgDestroyImage(vgImage);
491 ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
492 ASSERT_EGL_TRUE(iEglSess->DestroyEGLImage(iDisplay, imageKHR));
497 CloseTMSGraphicsStep();
498 return TestStepResult();