sl@0
|
1 |
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
/**
|
sl@0
|
17 |
@file
|
sl@0
|
18 |
@test
|
sl@0
|
19 |
*/
|
sl@0
|
20 |
|
sl@0
|
21 |
#include <test/tefunit.h> // for ASSERT macros
|
sl@0
|
22 |
#include "egltest_sibling.h"
|
sl@0
|
23 |
|
sl@0
|
24 |
#include <test/egltestcommonconversion.h>
|
sl@0
|
25 |
#include <test/egltestcommonsgimageinfo.h>
|
sl@0
|
26 |
|
sl@0
|
27 |
/**
|
sl@0
|
28 |
@SYMTestCaseID GRAPHICS-EGL-0135
|
sl@0
|
29 |
|
sl@0
|
30 |
@SYMTestPriority 1
|
sl@0
|
31 |
|
sl@0
|
32 |
@SYMPREQ 39
|
sl@0
|
33 |
|
sl@0
|
34 |
@SYMREQ See SGL.GT0386.401 document
|
sl@0
|
35 |
|
sl@0
|
36 |
@SYMTestCaseDesc
|
sl@0
|
37 |
Calling CreatePBufferFromClient with VGImage which is a EGLImage sibilind has to fail.
|
sl@0
|
38 |
On the contrary if the VGImage comes from a vgCreateImage() call it has to succeed
|
sl@0
|
39 |
|
sl@0
|
40 |
@SYMTestActions
|
sl@0
|
41 |
Create and fully construct an RSgImage object
|
sl@0
|
42 |
Pass the RSgImage object into eglCreateImageKHR() with
|
sl@0
|
43 |
• The target parameter set to EGL_NATIVE_PIXMAP_KHR
|
sl@0
|
44 |
• Use the current display and EGL_NO_CONTEXT
|
sl@0
|
45 |
• Use a NULL attr_list
|
sl@0
|
46 |
Check that eglCreateImageKHR() does NOT return EGL_NO_IMAGE_KHR
|
sl@0
|
47 |
Use vgCreateEGLImageTargetKHR() to construct a VGImage object from the EGLImage.
|
sl@0
|
48 |
• Check for errors
|
sl@0
|
49 |
Call eglCreatePBufferFromClient passing this VGImage as argument and EGL OPENVG IMAGE as bufftype and a NULL attribute list
|
sl@0
|
50 |
Check that we get EGL NO SURFACE and an EGL BAD ACCESS error is generated.
|
sl@0
|
51 |
Destroy the image data
|
sl@0
|
52 |
• Pass the EGLImage into eglDestroyImageKHR()
|
sl@0
|
53 |
• Close RSgImage
|
sl@0
|
54 |
Create a VGImage by calling vgCreateImage().
|
sl@0
|
55 |
Pass this VGImage to eglCreatePBufferFromClient, this call is expected to succeed.
|
sl@0
|
56 |
Pass the VGImage to vgDestroyImage()
|
sl@0
|
57 |
Check for memory and handle leaks
|
sl@0
|
58 |
|
sl@0
|
59 |
@SYMTestExpectedResults
|
sl@0
|
60 |
vgCreatePBufferFromClient () returns EGL NO SURFACE
|
sl@0
|
61 |
• EGL BAD ACCESS error is generated in the first case
|
sl@0
|
62 |
• No error is raised in the second case..
|
sl@0
|
63 |
No memory or handle leaks.
|
sl@0
|
64 |
*/
|
sl@0
|
65 |
TVerdict CEglTest_EGL_Image_CreatePBufferFromClient_With_Sibling_VGImage::doTestStepL()
|
sl@0
|
66 |
{
|
sl@0
|
67 |
SetTestStepID(_L("GRAPHICS-EGL-0135"));
|
sl@0
|
68 |
INFO_PRINTF1(_L("CEglTest_CreatePBufferFromClient_With_Sibling_VGImage::doTestStepL"));
|
sl@0
|
69 |
|
sl@0
|
70 |
TBool ret = CheckForExtensionL(KEGL_RSgimage | KEGL_KHR_image_base | KEGL_KHR_image_pixmap | KVG_KHR_EGL_image);
|
sl@0
|
71 |
if(!ret)
|
sl@0
|
72 |
{
|
sl@0
|
73 |
// The extension is not supported
|
sl@0
|
74 |
RecordTestResultL();
|
sl@0
|
75 |
CloseTMSGraphicsStep();
|
sl@0
|
76 |
return TestStepResult();
|
sl@0
|
77 |
}
|
sl@0
|
78 |
|
sl@0
|
79 |
// This test is performed for default pixel format
|
sl@0
|
80 |
PrintUsedPixelConfiguration();
|
sl@0
|
81 |
|
sl@0
|
82 |
// Create display object
|
sl@0
|
83 |
GetDisplayL();
|
sl@0
|
84 |
CreateEglSessionL();
|
sl@0
|
85 |
iEglSess->InitializeL();
|
sl@0
|
86 |
iEglSess->OpenSgDriverL();
|
sl@0
|
87 |
|
sl@0
|
88 |
RSgImage sgImage;
|
sl@0
|
89 |
CleanupClosePushL(sgImage);
|
sl@0
|
90 |
|
sl@0
|
91 |
// Create a reference bitmap which we use to init the SgImage (we use index=8)
|
sl@0
|
92 |
TDisplayMode bitmapMode = EglTestConversion::PixelFormatToDisplayMode(iSourceFormat);
|
sl@0
|
93 |
CFbsBitmap* bitmap = iEglSess->CreateReferenceBitmapL(bitmapMode, KPixmapSize, 8);
|
sl@0
|
94 |
CleanupStack::PushL(bitmap);
|
sl@0
|
95 |
|
sl@0
|
96 |
INFO_PRINTF1(_L("Creating one RSgImage"));
|
sl@0
|
97 |
TSgImageInfoOpenVgImage imageInfo = TSgImageInfoOpenVgImage(iSourceFormat, KPixmapSize);
|
sl@0
|
98 |
ASSERT_EQUALS(sgImage.Create(imageInfo, bitmap->DataAddress(), bitmap->DataStride()), KErrNone);
|
sl@0
|
99 |
CleanupStack::PopAndDestroy(bitmap);
|
sl@0
|
100 |
|
sl@0
|
101 |
INFO_PRINTF1(_L("Creating one EGLImage from it"));
|
sl@0
|
102 |
EGLImageKHR imageKHR = iEglSess->eglCreateImageKhrL(iDisplay, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, &sgImage, KEglImageAttribsPreservedTrue);
|
sl@0
|
103 |
ASSERT_EGL_TRUE(imageKHR != EGL_NO_IMAGE_KHR);
|
sl@0
|
104 |
CleanupStack::PopAndDestroy(&sgImage);
|
sl@0
|
105 |
|
sl@0
|
106 |
//Create a Surface and Link it to a Context bound to OpenVG
|
sl@0
|
107 |
TUidPixelFormat pixelFormat = EglTestConversion::VgFormatToSgPixelFormat(iSurfaceFormat);
|
sl@0
|
108 |
TSgImageInfoOpenVgTarget imageInfo2 = TSgImageInfoOpenVgTarget(pixelFormat, KPixmapSize);
|
sl@0
|
109 |
iEglSess->CreatePixmapSurfaceAndMakeCurrentAndMatchL(imageInfo2, CTestEglSession::EResourceCloseSgImageEarly);
|
sl@0
|
110 |
|
sl@0
|
111 |
INFO_PRINTF1(_L("Creating one VGImage from it"));
|
sl@0
|
112 |
VGImage vgImage = iEglSess->vgCreateImageTargetKHR((VGeglImageKHR)imageKHR);
|
sl@0
|
113 |
ASSERT_VG_TRUE(vgImage != VG_INVALID_HANDLE);
|
sl@0
|
114 |
|
sl@0
|
115 |
INFO_PRINTF1(_L("Attempt to Create a PBuffer linked to this VGImage"));
|
sl@0
|
116 |
TEglTestConfig pbufferFormat = EglTestConversion::VgFormatToPBufferSurfaceFormat(iSurfaceFormat);
|
sl@0
|
117 |
EGLConfig currentPbufferConfig = 0;
|
sl@0
|
118 |
TRAPD(res, currentPbufferConfig=iEglSess->GetConfigExactMatchL(pbufferFormat));
|
sl@0
|
119 |
if(res == KTestNoMatchingConfig)
|
sl@0
|
120 |
{
|
sl@0
|
121 |
WARN_PRINTF2(_L("Can't create pbuffer, format %d. Terminating the test without failing"), pbufferFormat);
|
sl@0
|
122 |
// destroy eglimage and vgimage
|
sl@0
|
123 |
vgDestroyImage(vgImage);
|
sl@0
|
124 |
ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
|
sl@0
|
125 |
ASSERT_EGL_TRUE(iEglSess->DestroyEGLImage(iDisplay, imageKHR));
|
sl@0
|
126 |
CleanAll();
|
sl@0
|
127 |
RecordTestResultL();
|
sl@0
|
128 |
CloseTMSGraphicsStep();
|
sl@0
|
129 |
return TestStepResult();
|
sl@0
|
130 |
}
|
sl@0
|
131 |
User::LeaveIfError(res); // leave here if any other error was raised other than the one above.
|
sl@0
|
132 |
EGLSurface surface = eglCreatePbufferFromClientBuffer(iDisplay,EGL_OPENVG_IMAGE,vgImage,currentPbufferConfig,NULL);
|
sl@0
|
133 |
ASSERT_EGL_TRUE(surface == EGL_NO_SURFACE);
|
sl@0
|
134 |
ASSERT_EGL_ERROR(EGL_BAD_ACCESS);
|
sl@0
|
135 |
|
sl@0
|
136 |
// destroy eglimage and vgimage
|
sl@0
|
137 |
vgDestroyImage(vgImage);
|
sl@0
|
138 |
ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
|
sl@0
|
139 |
ASSERT_EGL_TRUE(iEglSess->DestroyEGLImage(iDisplay, imageKHR));
|
sl@0
|
140 |
|
sl@0
|
141 |
//Positive test
|
sl@0
|
142 |
INFO_PRINTF1(_L("Attempt to Create a PBuffer linked to a VGImage obtained from vgCreateImage"));
|
sl@0
|
143 |
VGImage vgImage2 = vgCreateImage(KDefaultSurfaceFormat,KPixmapSize.iWidth,KPixmapSize.iHeight,VG_IMAGE_QUALITY_BETTER);
|
sl@0
|
144 |
ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
|
sl@0
|
145 |
surface = eglCreatePbufferFromClientBuffer(iDisplay,EGL_OPENVG_IMAGE,vgImage2,currentPbufferConfig,NULL);
|
sl@0
|
146 |
ASSERT_EGL_TRUE(surface != EGL_NO_SURFACE);
|
sl@0
|
147 |
ASSERT_EGL_ERROR(EGL_SUCCESS);
|
sl@0
|
148 |
ASSERT_EGL_TRUE(eglDestroySurface(iDisplay,surface));
|
sl@0
|
149 |
|
sl@0
|
150 |
//cleanup
|
sl@0
|
151 |
vgDestroyImage(vgImage2);
|
sl@0
|
152 |
ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
|
sl@0
|
153 |
CleanAll();
|
sl@0
|
154 |
|
sl@0
|
155 |
RecordTestResultL();
|
sl@0
|
156 |
CloseTMSGraphicsStep();
|
sl@0
|
157 |
return TestStepResult();
|
sl@0
|
158 |
}
|
sl@0
|
159 |
|
sl@0
|
160 |
/**
|
sl@0
|
161 |
@SYMTestCaseID GRAPHICS-EGL-0136
|
sl@0
|
162 |
|
sl@0
|
163 |
@SYMTestPriority 1
|
sl@0
|
164 |
|
sl@0
|
165 |
@SYMPREQ 39
|
sl@0
|
166 |
|
sl@0
|
167 |
@SYMREQ See SGL.GT0386.401 document
|
sl@0
|
168 |
|
sl@0
|
169 |
@SYMTestCaseDesc
|
sl@0
|
170 |
Attempt to create an EGLImage out of a valid RSgImage that is already linked to another EGLImage has to fail.
|
sl@0
|
171 |
Destroy the EGLImage, then re-create an EGLImage from the same RSgImage, and this attempt is expected to succeed.
|
sl@0
|
172 |
|
sl@0
|
173 |
@SYMTestActions
|
sl@0
|
174 |
Create a reference Bitmap
|
sl@0
|
175 |
Create and fully construct an RSgImage object having the same content as the reference bitmap
|
sl@0
|
176 |
• Set the iUsage bit to ESgUsageBitOpenVgImage
|
sl@0
|
177 |
Pass the RSgImage object into eglCreateImageKHR() with
|
sl@0
|
178 |
• The target parameter set to EGL_NATIVE_PIXMAP_KHR
|
sl@0
|
179 |
• Use the current display and EGL_NO_CONTEXT
|
sl@0
|
180 |
• Use a NULL attr_list
|
sl@0
|
181 |
Check that eglCreateImageKHR() does NOT return EGL_NO_IMAGE_KHR
|
sl@0
|
182 |
Pass again the same RSgImage object into eglCreateImageKHR() with
|
sl@0
|
183 |
• The target parameter set to EGL_NATIVE_PIXMAP_KHR
|
sl@0
|
184 |
• Use the current display and EGL_NO_CONTEXT
|
sl@0
|
185 |
• Use a NULL attr_list
|
sl@0
|
186 |
Check that eglCreateImageKHR() returns EGL_NO_IMAGE_KHR and the error generated is EGL_BAD_ACCESS
|
sl@0
|
187 |
Pass the EGLImage into eglDestroyImageKHR()
|
sl@0
|
188 |
Pass again the same RSgImage object into eglCreateImageKHR() with
|
sl@0
|
189 |
• The target parameter set to EGL_NATIVE_PIXMAP_KHR
|
sl@0
|
190 |
• Use the current display and EGL_NO_CONTEXT
|
sl@0
|
191 |
• Use a NULL attr_list
|
sl@0
|
192 |
Check that eglCreateImageKHR() does NOT return EGL_NO_IMAGE_KHR
|
sl@0
|
193 |
Destroy the image data
|
sl@0
|
194 |
• Pass the EGLImage into eglDestroyImageKHR()
|
sl@0
|
195 |
• Close RSgImage
|
sl@0
|
196 |
Check for memory and handle leaks
|
sl@0
|
197 |
|
sl@0
|
198 |
@SYMTestExpectedResults
|
sl@0
|
199 |
eglCreateImageKHR() returns EGL_NO_IMAGE_KHR (and an EGL_BAD_ACCESS error is generated) when the first EGLImage
|
sl@0
|
200 |
has not yet been destroyed. Once it is destroyed, creating aother EGLImage succeeds.
|
sl@0
|
201 |
No memory or handle leaks
|
sl@0
|
202 |
*/
|
sl@0
|
203 |
TVerdict CEglTest_EGL_Image_Sibling_Basic::doTestStepL()
|
sl@0
|
204 |
{
|
sl@0
|
205 |
SetTestStepID(_L("GRAPHICS-EGL-0136"));
|
sl@0
|
206 |
INFO_PRINTF1(_L("CEglTest_EGL_Image_Sibling_Basic::doTestStepL"));
|
sl@0
|
207 |
|
sl@0
|
208 |
TBool ret = CheckForExtensionL(KEGL_RSgimage | KEGL_KHR_image_base | KEGL_KHR_image_pixmap | KVG_KHR_EGL_image);
|
sl@0
|
209 |
if(!ret)
|
sl@0
|
210 |
{
|
sl@0
|
211 |
// The extension is not supported
|
sl@0
|
212 |
RecordTestResultL();
|
sl@0
|
213 |
CloseTMSGraphicsStep();
|
sl@0
|
214 |
return TestStepResult();
|
sl@0
|
215 |
}
|
sl@0
|
216 |
|
sl@0
|
217 |
// This test is performed for default pixel format
|
sl@0
|
218 |
PrintUsedPixelConfiguration();
|
sl@0
|
219 |
|
sl@0
|
220 |
// Create display object
|
sl@0
|
221 |
GetDisplayL();
|
sl@0
|
222 |
CreateEglSessionL();
|
sl@0
|
223 |
iEglSess->InitializeL();
|
sl@0
|
224 |
iEglSess->OpenSgDriverL();
|
sl@0
|
225 |
|
sl@0
|
226 |
INFO_PRINTF1(_L("Creating one RSgImage"));
|
sl@0
|
227 |
TSgImageInfoOpenVgImage imageInfo = TSgImageInfoOpenVgImage(iSourceFormat, KPixmapSize);
|
sl@0
|
228 |
#ifndef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
|
sl@0
|
229 |
imageInfo.iCpuAccess = ESgCpuAccessReadWrite;
|
sl@0
|
230 |
#endif
|
sl@0
|
231 |
RSgImage sgImage;
|
sl@0
|
232 |
CleanupClosePushL(sgImage);
|
sl@0
|
233 |
ASSERT_EQUALS(sgImage.Create(imageInfo, NULL, NULL), KErrNone);
|
sl@0
|
234 |
|
sl@0
|
235 |
INFO_PRINTF1(_L("Creating one EGLImage from it"));
|
sl@0
|
236 |
EGLImageKHR imageKHR = iEglSess->eglCreateImageKhrL(iDisplay, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, &sgImage, KEglImageAttribsPreservedTrue);
|
sl@0
|
237 |
ASSERT_EGL_TRUE(imageKHR != EGL_NO_IMAGE_KHR);
|
sl@0
|
238 |
|
sl@0
|
239 |
INFO_PRINTF1(_L("Trying to create another EGLImage from the same RSgImage"));
|
sl@0
|
240 |
EGLImageKHR imageKHR2 = iEglSess->eglCreateImageKhrL(iDisplay, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, &sgImage, KEglImageAttribsPreservedTrue);
|
sl@0
|
241 |
ASSERT_EGL_TRUE(imageKHR2 == EGL_NO_IMAGE_KHR);
|
sl@0
|
242 |
ASSERT_EGL_ERROR(EGL_BAD_ACCESS);
|
sl@0
|
243 |
|
sl@0
|
244 |
INFO_PRINTF1(_L("Destroy first EGLImage and try to create another EGLImage from the same RSgImage"));
|
sl@0
|
245 |
ASSERT_EGL_TRUE(iEglSess->DestroyEGLImage(iDisplay, imageKHR));
|
sl@0
|
246 |
EGLImageKHR imageKHR3 = iEglSess->eglCreateImageKhrL(iDisplay, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, &sgImage, KEglImageAttribsPreservedTrue);
|
sl@0
|
247 |
ASSERT_EGL_TRUE(imageKHR3 != EGL_NO_IMAGE_KHR);
|
sl@0
|
248 |
ASSERT_EGL_ERROR(EGL_SUCCESS);
|
sl@0
|
249 |
|
sl@0
|
250 |
//cleanup
|
sl@0
|
251 |
CleanupStack::PopAndDestroy(&sgImage);
|
sl@0
|
252 |
ASSERT_EGL_TRUE(iEglSess->DestroyEGLImage(iDisplay, imageKHR3));
|
sl@0
|
253 |
CleanAll();
|
sl@0
|
254 |
|
sl@0
|
255 |
RecordTestResultL();
|
sl@0
|
256 |
CloseTMSGraphicsStep();
|
sl@0
|
257 |
return TestStepResult();
|
sl@0
|
258 |
}
|
sl@0
|
259 |
|
sl@0
|
260 |
/**
|
sl@0
|
261 |
@SYMTestCaseID GRAPHICS-EGL-0138
|
sl@0
|
262 |
|
sl@0
|
263 |
@SYMTestPriority 1
|
sl@0
|
264 |
|
sl@0
|
265 |
@SYMPREQ 39
|
sl@0
|
266 |
|
sl@0
|
267 |
@SYMREQ See SGL.GT0386.401 document
|
sl@0
|
268 |
|
sl@0
|
269 |
@SYMTestCaseDesc
|
sl@0
|
270 |
Attempt to create an EGLImage out of a valid RSgImage that is already linked to another VGImage (after the original EGLImage has been destroyed) has to fail.
|
sl@0
|
271 |
This is testing the EGLImage sibling rules from the EGLImage spec.
|
sl@0
|
272 |
|
sl@0
|
273 |
@SYMTestActions
|
sl@0
|
274 |
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.
|
sl@0
|
275 |
Create a reference Bitmap
|
sl@0
|
276 |
Create and fully construct an RSgImage object having the same content as the reference bitmap
|
sl@0
|
277 |
• Set the iUsage bit to ESgUsageBitOpenVgImage
|
sl@0
|
278 |
Pass the RSgImage object into eglCreateImageKHR() with
|
sl@0
|
279 |
• The target parameter set to EGL_NATIVE_PIXMAP_KHR
|
sl@0
|
280 |
• Use the current display and EGL_NO_CONTEXT
|
sl@0
|
281 |
• Use a NULL attr_list
|
sl@0
|
282 |
Check that eglCreateImageKHR() does NOT return EGL_NO_IMAGE_KHR
|
sl@0
|
283 |
Create and make current and EGL context bound to OVG APIs and linked to a pixmap surface.
|
sl@0
|
284 |
• Set the iUsage bit of the underlying RSgImage to ESgUsageBitOpenVgSurface.
|
sl@0
|
285 |
Use vgCreateEGLImageTargetKHR() to construct a VGImage object from the EGLImage.
|
sl@0
|
286 |
• Check for errors
|
sl@0
|
287 |
Pass the EGLImage into eglDestroyImageKHR()
|
sl@0
|
288 |
Pass again the same RSgImage object into eglCreateImageKHR() with
|
sl@0
|
289 |
• The target parameter set to EGL_NATIVE_PIXMAP_KHR
|
sl@0
|
290 |
• Use the current display and EGL_NO_CONTEXT
|
sl@0
|
291 |
• Use a NULL attr_list
|
sl@0
|
292 |
Check that eglCreateImageKHR() returns EGL_NO_IMAGE_KHR and the error generated is EGL_BAD_ACCESS
|
sl@0
|
293 |
Pass the VGImage into vgDestroyImage()
|
sl@0
|
294 |
Close RSgImage
|
sl@0
|
295 |
Check for memory and handle leaks
|
sl@0
|
296 |
|
sl@0
|
297 |
@SYMTestExpectedResults
|
sl@0
|
298 |
eglCreateImageKHR() returns EGL_NO_IMAGE_KHR
|
sl@0
|
299 |
• And an EGL_BAD_ACCESS error is generated
|
sl@0
|
300 |
No memory or handle leaks.
|
sl@0
|
301 |
*/
|
sl@0
|
302 |
TVerdict CEglTest_EGL_Image_Sibling_VGImage::doTestStepL()
|
sl@0
|
303 |
{
|
sl@0
|
304 |
SetTestStepID(_L("GRAPHICS-EGL-0138"));
|
sl@0
|
305 |
INFO_PRINTF1(_L("CEglTest_EGL_Image_Sibling_VGImage::doTestStepL"));
|
sl@0
|
306 |
|
sl@0
|
307 |
TBool ret = CheckForExtensionL(KEGL_RSgimage | KEGL_KHR_image_base | KEGL_KHR_image_pixmap | KVG_KHR_EGL_image);
|
sl@0
|
308 |
if(!ret)
|
sl@0
|
309 |
{
|
sl@0
|
310 |
// The extension is not supported
|
sl@0
|
311 |
RecordTestResultL();
|
sl@0
|
312 |
CloseTMSGraphicsStep();
|
sl@0
|
313 |
return TestStepResult();
|
sl@0
|
314 |
}
|
sl@0
|
315 |
|
sl@0
|
316 |
// This test is performed for default pixel format
|
sl@0
|
317 |
PrintUsedPixelConfiguration();
|
sl@0
|
318 |
|
sl@0
|
319 |
// Create display object
|
sl@0
|
320 |
GetDisplayL();
|
sl@0
|
321 |
CreateEglSessionL();
|
sl@0
|
322 |
iEglSess->InitializeL();
|
sl@0
|
323 |
iEglSess->OpenSgDriverL();
|
sl@0
|
324 |
|
sl@0
|
325 |
INFO_PRINTF1(_L("Creating one RSgImage"));
|
sl@0
|
326 |
TSgImageInfoOpenVgImage imageInfo = TSgImageInfoOpenVgImage(iSourceFormat, KPixmapSize);
|
sl@0
|
327 |
#ifndef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
|
sl@0
|
328 |
imageInfo.iCpuAccess = ESgCpuAccessReadWrite;
|
sl@0
|
329 |
#endif
|
sl@0
|
330 |
RSgImage sgImage;
|
sl@0
|
331 |
CleanupClosePushL(sgImage);
|
sl@0
|
332 |
ASSERT_EQUALS(sgImage.Create(imageInfo, NULL, NULL), KErrNone);
|
sl@0
|
333 |
|
sl@0
|
334 |
INFO_PRINTF1(_L("Creating one EGLImage from it"));
|
sl@0
|
335 |
EGLImageKHR imageKHR = iEglSess->eglCreateImageKhrL(iDisplay, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, &sgImage, KEglImageAttribsPreservedTrue);
|
sl@0
|
336 |
ASSERT_EGL_TRUE(imageKHR != EGL_NO_IMAGE_KHR);
|
sl@0
|
337 |
|
sl@0
|
338 |
//Create a Surface and Link it to a Context bound to OpenVG
|
sl@0
|
339 |
TUidPixelFormat pixelFormat = EglTestConversion::VgFormatToSgPixelFormat(iSurfaceFormat);
|
sl@0
|
340 |
TSgImageInfoOpenVgTarget imageInfo2 = TSgImageInfoOpenVgTarget(pixelFormat, KPixmapSize);
|
sl@0
|
341 |
iEglSess->CreatePixmapSurfaceAndMakeCurrentAndMatchL(imageInfo2, CTestEglSession::EResourceCloseSgImageEarly);
|
sl@0
|
342 |
|
sl@0
|
343 |
INFO_PRINTF1(_L("Creating one VGImage from it"));
|
sl@0
|
344 |
VGImage vgImage = iEglSess->vgCreateImageTargetKHR((VGeglImageKHR)imageKHR);
|
sl@0
|
345 |
ASSERT_VG_TRUE(vgImage != VG_INVALID_HANDLE);
|
sl@0
|
346 |
|
sl@0
|
347 |
INFO_PRINTF1(_L("Destroying the EGLImage but retain the handle value"));
|
sl@0
|
348 |
ASSERT_EGL_TRUE(iEglSess->DestroyEGLImage(iDisplay, imageKHR));
|
sl@0
|
349 |
|
sl@0
|
350 |
INFO_PRINTF1(_L("Attemptimg to create another VGImage from an invalid handle"));
|
sl@0
|
351 |
VGImage failingVgImage = iEglSess->vgCreateImageTargetKHR((VGeglImageKHR)imageKHR);
|
sl@0
|
352 |
ASSERT_VG_TRUE(failingVgImage == VG_INVALID_HANDLE);
|
sl@0
|
353 |
ASSERT_TRUE(vgGetError()==VG_ILLEGAL_ARGUMENT_ERROR);
|
sl@0
|
354 |
|
sl@0
|
355 |
INFO_PRINTF1(_L("Setting the handle to EGL_NO_IMAGE_KHR"));
|
sl@0
|
356 |
imageKHR = EGL_NO_IMAGE_KHR;
|
sl@0
|
357 |
|
sl@0
|
358 |
INFO_PRINTF1(_L("Trying to create another EGLImage from the same RSgImage"));
|
sl@0
|
359 |
EGLImageKHR imageKHR2 = GetEglSess()->eglCreateImageKhrL(iDisplay,EGL_NO_CONTEXT,EGL_NATIVE_PIXMAP_KHR,&sgImage,NULL);
|
sl@0
|
360 |
ASSERT_EGL_TRUE(imageKHR2 == EGL_NO_IMAGE_KHR);
|
sl@0
|
361 |
ASSERT_EGL_ERROR(EGL_BAD_ACCESS);
|
sl@0
|
362 |
|
sl@0
|
363 |
//cleanup
|
sl@0
|
364 |
CleanupStack::PopAndDestroy(&sgImage);
|
sl@0
|
365 |
vgDestroyImage(vgImage);
|
sl@0
|
366 |
ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
|
sl@0
|
367 |
CleanAll();
|
sl@0
|
368 |
|
sl@0
|
369 |
RecordTestResultL();
|
sl@0
|
370 |
CloseTMSGraphicsStep();
|
sl@0
|
371 |
return TestStepResult();
|
sl@0
|
372 |
}
|
sl@0
|
373 |
|
sl@0
|
374 |
/**
|
sl@0
|
375 |
@SYMTestCaseID GRAPHICS-EGL-0139
|
sl@0
|
376 |
|
sl@0
|
377 |
@SYMTestPriority 1
|
sl@0
|
378 |
|
sl@0
|
379 |
@SYMPREQ 39
|
sl@0
|
380 |
|
sl@0
|
381 |
@SYMREQ See SGL.GT0386.401 document
|
sl@0
|
382 |
|
sl@0
|
383 |
@SYMTestCaseDesc
|
sl@0
|
384 |
Attempt to create an EGLImage out of a valid RSgImage that is already linked
|
sl@0
|
385 |
to two VGImages (after the original EGLImage has been destroyed) has to fail.
|
sl@0
|
386 |
This is testing the EGLImage sibling rules from the EGLImage spec.
|
sl@0
|
387 |
|
sl@0
|
388 |
@SYMTestActions
|
sl@0
|
389 |
This test will check for the “VG_KHR_EGL_image” extension, if it is not supported
|
sl@0
|
390 |
on this platform then the test will return immediately without failure.
|
sl@0
|
391 |
Create a reference Bitmap
|
sl@0
|
392 |
Create and fully construct an RSgImage object having the same content as the
|
sl@0
|
393 |
reference bitmap
|
sl@0
|
394 |
• Set the iUsage bit to ESgUsageBitOpenVgImage
|
sl@0
|
395 |
Pass the RSgImage object into eglCreateImageKHR() with
|
sl@0
|
396 |
• The target parameter set to EGL_NATIVE_PIXMAP_KHR
|
sl@0
|
397 |
• Use the current display and EGL_NO_CONTEXT
|
sl@0
|
398 |
• Use a NULL attr_list
|
sl@0
|
399 |
Check that eglCreateImageKHR() does NOT return EGL_NO_IMAGE_KHR
|
sl@0
|
400 |
Create and make current and EGL context bound to OVG APIs and linked to a pixmap surface.
|
sl@0
|
401 |
• Set the iUsage bit of the underlying RSgImage to ESgUsageBitOpenVgSurface
|
sl@0
|
402 |
Use vgCreateEGLImageTargetKHR() to construct a VGImage object from the EGLImage.
|
sl@0
|
403 |
• Check for errors
|
sl@0
|
404 |
Use vgCreateEGLImageTargetKHR() to construct another VGImage object from the EGLImage.
|
sl@0
|
405 |
• Check for errors
|
sl@0
|
406 |
Pass the EGLImage into eglDestroyImageKHR()
|
sl@0
|
407 |
Pass again the same RSgImage object into eglCreateImageKHR() with
|
sl@0
|
408 |
• The target parameter set to EGL_NATIVE_PIXMAP_KHR
|
sl@0
|
409 |
• Use the current display and EGL_NO_CONTEXT
|
sl@0
|
410 |
• Use a NULL attr_list
|
sl@0
|
411 |
Check that eglCreateImageKHR() returns EGL_NO_IMAGE_KHR and the error generated is EGL_BAD_ACCESS
|
sl@0
|
412 |
Pass the first VGImage into vgDestroyImage()
|
sl@0
|
413 |
Pass the second VGImage into vgDestroyImage()
|
sl@0
|
414 |
Close RSgImage
|
sl@0
|
415 |
Check for memory and handle leaks.
|
sl@0
|
416 |
|
sl@0
|
417 |
@SYMTestExpectedResults
|
sl@0
|
418 |
eglCreateImageKHR() returns EGL_NO_IMAGE_KHR
|
sl@0
|
419 |
• And an EGL_BAD_ACCESS error is generated
|
sl@0
|
420 |
No memory or handle leaks.
|
sl@0
|
421 |
*/
|
sl@0
|
422 |
TVerdict CEglTest_EGL_Image_Sibling_Two_VGImages::doTestStepL()
|
sl@0
|
423 |
{
|
sl@0
|
424 |
SetTestStepID(_L("GRAPHICS-EGL-0139"));
|
sl@0
|
425 |
INFO_PRINTF1(_L("CEglTest_EGL_Image_Sibling_Two_VGImages::doTestStepL"));
|
sl@0
|
426 |
|
sl@0
|
427 |
TBool ret = CheckForExtensionL(KEGL_RSgimage | KEGL_KHR_image_base | KEGL_KHR_image_pixmap | KVG_KHR_EGL_image);
|
sl@0
|
428 |
if(!ret)
|
sl@0
|
429 |
{
|
sl@0
|
430 |
// The extension is not supported
|
sl@0
|
431 |
RecordTestResultL();
|
sl@0
|
432 |
CloseTMSGraphicsStep();
|
sl@0
|
433 |
return TestStepResult();
|
sl@0
|
434 |
}
|
sl@0
|
435 |
|
sl@0
|
436 |
// This test is performed for default pixel format
|
sl@0
|
437 |
PrintUsedPixelConfiguration();
|
sl@0
|
438 |
|
sl@0
|
439 |
// Create display object
|
sl@0
|
440 |
GetDisplayL();
|
sl@0
|
441 |
CreateEglSessionL();
|
sl@0
|
442 |
iEglSess->InitializeL();
|
sl@0
|
443 |
iEglSess->OpenSgDriverL();
|
sl@0
|
444 |
|
sl@0
|
445 |
INFO_PRINTF1(_L("Creating one RSgImage"));
|
sl@0
|
446 |
TSgImageInfoOpenVgImage imageInfo = TSgImageInfoOpenVgImage(iSourceFormat, KPixmapSize);
|
sl@0
|
447 |
#ifndef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
|
sl@0
|
448 |
imageInfo.iCpuAccess = ESgCpuAccessReadWrite;
|
sl@0
|
449 |
#endif
|
sl@0
|
450 |
RSgImage sgImage;
|
sl@0
|
451 |
CleanupClosePushL(sgImage);
|
sl@0
|
452 |
ASSERT_EQUALS(sgImage.Create(imageInfo, NULL, NULL), KErrNone);
|
sl@0
|
453 |
|
sl@0
|
454 |
INFO_PRINTF1(_L("Creating one EGLImage from it"));
|
sl@0
|
455 |
EGLImageKHR imageKHR = iEglSess->eglCreateImageKhrL(iDisplay, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, &sgImage, KEglImageAttribsPreservedTrue);
|
sl@0
|
456 |
ASSERT_EGL_TRUE(imageKHR != EGL_NO_IMAGE_KHR);
|
sl@0
|
457 |
|
sl@0
|
458 |
//Create a Surface and Link it to a Context bound to OpenVG
|
sl@0
|
459 |
TUidPixelFormat pixelFormat = EglTestConversion::VgFormatToSgPixelFormat(iSurfaceFormat);
|
sl@0
|
460 |
TSgImageInfoOpenVgTarget imageInfo2 = TSgImageInfoOpenVgTarget(pixelFormat, KPixmapSize);
|
sl@0
|
461 |
iEglSess->CreatePixmapSurfaceAndMakeCurrentAndMatchL(imageInfo2, CTestEglSession::EResourceCloseSgImageEarly);
|
sl@0
|
462 |
|
sl@0
|
463 |
INFO_PRINTF1(_L("Creating two VGImages from it"));
|
sl@0
|
464 |
VGImage vgImage1 = iEglSess->vgCreateImageTargetKHR((VGeglImageKHR)imageKHR);
|
sl@0
|
465 |
ASSERT_VG_TRUE(vgImage1 != VG_INVALID_HANDLE);
|
sl@0
|
466 |
VGImage vgImage2 = iEglSess->vgCreateImageTargetKHR((VGeglImageKHR)imageKHR);
|
sl@0
|
467 |
ASSERT_VG_TRUE(vgImage2 != VG_INVALID_HANDLE);
|
sl@0
|
468 |
|
sl@0
|
469 |
INFO_PRINTF1(_L("Destroying the EGLImage"));
|
sl@0
|
470 |
ASSERT_EGL_TRUE(iEglSess->DestroyEGLImage(iDisplay, imageKHR));
|
sl@0
|
471 |
|
sl@0
|
472 |
INFO_PRINTF1(_L("Trying to create an EGLImage from the same RSgImage (linked to the two VGImages)"));
|
sl@0
|
473 |
EGLImageKHR imageKHR2 = iEglSess->eglCreateImageKhrL(iDisplay,EGL_NO_CONTEXT,EGL_NATIVE_PIXMAP_KHR,&sgImage,NULL);
|
sl@0
|
474 |
ASSERT_EGL_TRUE(imageKHR2 == EGL_NO_IMAGE_KHR);
|
sl@0
|
475 |
ASSERT_EGL_ERROR(EGL_BAD_ACCESS);
|
sl@0
|
476 |
|
sl@0
|
477 |
INFO_PRINTF1(_L("Destroying the first VgImage"));
|
sl@0
|
478 |
vgDestroyImage(vgImage1);
|
sl@0
|
479 |
ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
|
sl@0
|
480 |
|
sl@0
|
481 |
INFO_PRINTF1(_L("Trying to create an EGLImage from the same RSgImage (linked now to just one VGImage)"));
|
sl@0
|
482 |
imageKHR2 = iEglSess->eglCreateImageKhrL(iDisplay,EGL_NO_CONTEXT,EGL_NATIVE_PIXMAP_KHR,&sgImage,NULL);
|
sl@0
|
483 |
ASSERT_EGL_TRUE(imageKHR2 == EGL_NO_IMAGE_KHR);
|
sl@0
|
484 |
ASSERT_EGL_ERROR(EGL_BAD_ACCESS);
|
sl@0
|
485 |
|
sl@0
|
486 |
INFO_PRINTF1(_L("Destroying the second VgImage"));
|
sl@0
|
487 |
vgDestroyImage(vgImage2);
|
sl@0
|
488 |
ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
|
sl@0
|
489 |
|
sl@0
|
490 |
INFO_PRINTF1(_L("Trying to create an EGLImage from the same RSgImage (linked now to just one VGImage)"));
|
sl@0
|
491 |
imageKHR2 = iEglSess->eglCreateImageKhrL(iDisplay,EGL_NO_CONTEXT,EGL_NATIVE_PIXMAP_KHR,&sgImage,NULL);
|
sl@0
|
492 |
ASSERT_EGL_TRUE(imageKHR2 != EGL_NO_IMAGE_KHR);
|
sl@0
|
493 |
ASSERT_EGL_ERROR(EGL_SUCCESS);
|
sl@0
|
494 |
|
sl@0
|
495 |
//cleanup
|
sl@0
|
496 |
CleanupStack::PopAndDestroy(&sgImage);
|
sl@0
|
497 |
ASSERT_EGL_TRUE(iEglSess->DestroyEGLImage(iDisplay, imageKHR2));
|
sl@0
|
498 |
CleanAll();
|
sl@0
|
499 |
|
sl@0
|
500 |
RecordTestResultL();
|
sl@0
|
501 |
CloseTMSGraphicsStep();
|
sl@0
|
502 |
return TestStepResult();
|
sl@0
|
503 |
}
|
sl@0
|
504 |
|
sl@0
|
505 |
/**
|
sl@0
|
506 |
@SYMTestCaseID GRAPHICS-EGL-0141
|
sl@0
|
507 |
|
sl@0
|
508 |
@SYMTestPriority 1
|
sl@0
|
509 |
|
sl@0
|
510 |
@SYMPREQ 39
|
sl@0
|
511 |
|
sl@0
|
512 |
@SYMREQ See SGL.GT0386.401 document
|
sl@0
|
513 |
|
sl@0
|
514 |
@SYMTestCaseDesc
|
sl@0
|
515 |
Attempt to create an EGLImage out of a valid RSgImage after that:
|
sl@0
|
516 |
• It has been created a VGImage from it (hence an EGLImage has been created too)
|
sl@0
|
517 |
• A Child VGImage has been created from the previous VGImage
|
sl@0
|
518 |
• the EGLImage has been destroyed too
|
sl@0
|
519 |
has to fail
|
sl@0
|
520 |
Another attempt to create an EGLImage from the same RSgImage has to fail even if we destroy the parent Image.
|
sl@0
|
521 |
Creation of an EGLImage from the same RSgImage has to succeed if the child VgImage has also been destroyed.
|
sl@0
|
522 |
|
sl@0
|
523 |
@SYMTestActions
|
sl@0
|
524 |
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.
|
sl@0
|
525 |
Create a reference Bitmap
|
sl@0
|
526 |
Create and fully construct an RSgImage object having the same content as the reference bitmap
|
sl@0
|
527 |
• Set the iUsage bit to ESgUsageBitOpenVgImage
|
sl@0
|
528 |
Pass the RSgImage object into eglCreateImageKHR() with
|
sl@0
|
529 |
• The target parameter set to EGL_NATIVE_PIXMAP_KHR
|
sl@0
|
530 |
• Use the current display and EGL_NO_CONTEXT
|
sl@0
|
531 |
• Use a NULL attr_list
|
sl@0
|
532 |
Check that eglCreateImageKHR() does NOT return EGL_NO_IMAGE_KHR
|
sl@0
|
533 |
Create and make current and EGL context bound to OVG APIs and linked to a pixmap surface.
|
sl@0
|
534 |
• Set the iUsage bit of the underlying RSgImage to ESgUsageBitOpenVgSurface
|
sl@0
|
535 |
Use vgCreateEGLImageTargetKHR() to construct a VGImage object from the EGLImage.
|
sl@0
|
536 |
• Check for errors
|
sl@0
|
537 |
Use vgChildImage() to construct child VGImage object from the previous VGImage.
|
sl@0
|
538 |
• Check for errors
|
sl@0
|
539 |
Pass the EGLImage into eglDestroyImageKHR()
|
sl@0
|
540 |
Pass again the same RSgImage object into eglCreateImageKHR().
|
sl@0
|
541 |
Check that eglCreateImageKHR() returns EGL_NO_IMAGE_KHR and the error generated is EGL_BAD_ACCESS
|
sl@0
|
542 |
Pass the parent VGImage into vgDestroyImage()
|
sl@0
|
543 |
Pass again the same RSgImage object into eglCreateImageKHR().
|
sl@0
|
544 |
Check that eglCreateImageKHR() returns EGL_NO_IMAGE_KHR and the error generated is EGL_BAD_ACCESS
|
sl@0
|
545 |
Pass the child VGImage into vgDestroyImage()
|
sl@0
|
546 |
Pass again the same RSgImage object into eglCreateImageKHR().
|
sl@0
|
547 |
Check that eglCreateImageKHR() does not return EGL_NO_IMAGE_KHR.
|
sl@0
|
548 |
Pass the EGLImage into eglDestroyImageKHR()
|
sl@0
|
549 |
Close RSgImage
|
sl@0
|
550 |
Check for memory and handle leaks.
|
sl@0
|
551 |
|
sl@0
|
552 |
@SYMTestExpectedResults
|
sl@0
|
553 |
eglCreateImageKHR() returns EGL_NO_IMAGE_KHR
|
sl@0
|
554 |
• And an EGL_BAD_ACCESS error is generated
|
sl@0
|
555 |
No memory or handle leaks.
|
sl@0
|
556 |
*/
|
sl@0
|
557 |
TVerdict CEglTest_EGL_Image_Sibling_VGImage_Child::doTestStepL()
|
sl@0
|
558 |
{
|
sl@0
|
559 |
SetTestStepID(_L("GRAPHICS-EGL-0141"));
|
sl@0
|
560 |
INFO_PRINTF1(_L("CEglTest_EGL_Image_Sibling_VGImage_Child::doTestStepL"));
|
sl@0
|
561 |
|
sl@0
|
562 |
TBool ret = CheckForExtensionL(KEGL_RSgimage | KEGL_KHR_image_base | KEGL_KHR_image_pixmap | KVG_KHR_EGL_image);
|
sl@0
|
563 |
if(!ret)
|
sl@0
|
564 |
{
|
sl@0
|
565 |
// The extension is not supported
|
sl@0
|
566 |
RecordTestResultL();
|
sl@0
|
567 |
CloseTMSGraphicsStep();
|
sl@0
|
568 |
return TestStepResult();
|
sl@0
|
569 |
}
|
sl@0
|
570 |
|
sl@0
|
571 |
// This test is performed for default pixel format
|
sl@0
|
572 |
PrintUsedPixelConfiguration();
|
sl@0
|
573 |
|
sl@0
|
574 |
// Create display object
|
sl@0
|
575 |
GetDisplayL();
|
sl@0
|
576 |
CreateEglSessionL();
|
sl@0
|
577 |
iEglSess->InitializeL();
|
sl@0
|
578 |
iEglSess->OpenSgDriverL();
|
sl@0
|
579 |
|
sl@0
|
580 |
INFO_PRINTF1(_L("Creating one RSgImage"));
|
sl@0
|
581 |
TSgImageInfoOpenVgImage imageInfo = TSgImageInfoOpenVgImage(iSourceFormat, KPixmapSize);
|
sl@0
|
582 |
#ifndef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
|
sl@0
|
583 |
imageInfo.iCpuAccess = ESgCpuAccessReadWrite;
|
sl@0
|
584 |
#endif
|
sl@0
|
585 |
RSgImage sgImage;
|
sl@0
|
586 |
CleanupClosePushL(sgImage);
|
sl@0
|
587 |
ASSERT_EQUALS(sgImage.Create(imageInfo, NULL, NULL), KErrNone);
|
sl@0
|
588 |
|
sl@0
|
589 |
INFO_PRINTF1(_L("Creating one EGLImage from it"));
|
sl@0
|
590 |
EGLImageKHR imageKHR = iEglSess->eglCreateImageKhrL(iDisplay, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, &sgImage, KEglImageAttribsPreservedTrue);
|
sl@0
|
591 |
ASSERT_EGL_TRUE(imageKHR != EGL_NO_IMAGE_KHR);
|
sl@0
|
592 |
|
sl@0
|
593 |
//Create a Surface and Link it to a Context bound to OpenVG
|
sl@0
|
594 |
TUidPixelFormat pixelFormat = EglTestConversion::VgFormatToSgPixelFormat(iSurfaceFormat);
|
sl@0
|
595 |
TSgImageInfoOpenVgTarget imageInfo2 = TSgImageInfoOpenVgTarget(pixelFormat, KPixmapSize);
|
sl@0
|
596 |
iEglSess->CreatePixmapSurfaceAndMakeCurrentAndMatchL(imageInfo2, CTestEglSession::EResourceCloseSgImageEarly);
|
sl@0
|
597 |
|
sl@0
|
598 |
INFO_PRINTF1(_L("Creating one VGImage from it"));
|
sl@0
|
599 |
VGImage vgImage = iEglSess->vgCreateImageTargetKHR((VGeglImageKHR)imageKHR);
|
sl@0
|
600 |
ASSERT_VG_TRUE(vgImage != VG_INVALID_HANDLE);
|
sl@0
|
601 |
|
sl@0
|
602 |
INFO_PRINTF1(_L("Creating a VGImage Child from the previous VGImage"));
|
sl@0
|
603 |
VGImage childVgImage = vgChildImage(vgImage,50,50,KPixmapSize.iWidth-50,KPixmapSize.iHeight-50);
|
sl@0
|
604 |
ASSERT_EGL_TRUE(childVgImage != VG_INVALID_HANDLE);
|
sl@0
|
605 |
|
sl@0
|
606 |
INFO_PRINTF1(_L("Destroying the EGLImage"));
|
sl@0
|
607 |
ASSERT_EGL_TRUE(iEglSess->DestroyEGLImage(iDisplay, imageKHR));
|
sl@0
|
608 |
|
sl@0
|
609 |
INFO_PRINTF1(_L("Trying to create an EGLImage from the same RSgImage (linked to both Parent and Child VGImage)"));
|
sl@0
|
610 |
EGLImageKHR imageKHR2 = iEglSess->eglCreateImageKhrL(iDisplay,EGL_NO_CONTEXT,EGL_NATIVE_PIXMAP_KHR,&sgImage,NULL);
|
sl@0
|
611 |
ASSERT_EGL_TRUE(imageKHR2 == EGL_NO_IMAGE_KHR);
|
sl@0
|
612 |
ASSERT_EGL_ERROR(EGL_BAD_ACCESS);
|
sl@0
|
613 |
|
sl@0
|
614 |
INFO_PRINTF1(_L("Destroying the Parent VGImage"));
|
sl@0
|
615 |
vgDestroyImage(vgImage);
|
sl@0
|
616 |
ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
|
sl@0
|
617 |
|
sl@0
|
618 |
INFO_PRINTF1(_L("Trying to create an EGLImage from the same RSgImage (linked to the Child VGImage)"));
|
sl@0
|
619 |
imageKHR2 = iEglSess->eglCreateImageKhrL(iDisplay,EGL_NO_CONTEXT,EGL_NATIVE_PIXMAP_KHR,&sgImage,NULL);
|
sl@0
|
620 |
ASSERT_EGL_TRUE(imageKHR2 == EGL_NO_IMAGE_KHR);
|
sl@0
|
621 |
ASSERT_EGL_ERROR(EGL_BAD_ACCESS);
|
sl@0
|
622 |
|
sl@0
|
623 |
INFO_PRINTF1(_L("Destroying the Child VGImage"));
|
sl@0
|
624 |
vgDestroyImage(childVgImage);
|
sl@0
|
625 |
ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
|
sl@0
|
626 |
|
sl@0
|
627 |
INFO_PRINTF1(_L("Trying to create an EGLImage and a new VGImage from the same RSgImage (now it's free)"));
|
sl@0
|
628 |
imageKHR2 = iEglSess->eglCreateImageKhrL(iDisplay,EGL_NO_CONTEXT,EGL_NATIVE_PIXMAP_KHR,&sgImage,NULL);
|
sl@0
|
629 |
ASSERT_EGL_TRUE(imageKHR2 != EGL_NO_IMAGE_KHR);
|
sl@0
|
630 |
ASSERT_EGL_ERROR(EGL_SUCCESS);
|
sl@0
|
631 |
|
sl@0
|
632 |
//cleanup
|
sl@0
|
633 |
CleanupStack::PopAndDestroy(&sgImage);
|
sl@0
|
634 |
ASSERT_EGL_TRUE(iEglSess->DestroyEGLImage(iDisplay, imageKHR2));
|
sl@0
|
635 |
CleanAll();
|
sl@0
|
636 |
|
sl@0
|
637 |
RecordTestResultL();
|
sl@0
|
638 |
CloseTMSGraphicsStep();
|
sl@0
|
639 |
return TestStepResult();
|
sl@0
|
640 |
}
|
sl@0
|
641 |
|
sl@0
|
642 |
|
sl@0
|
643 |
/**
|
sl@0
|
644 |
@SYMTestCaseID GRAPHICS-EGL-0142
|
sl@0
|
645 |
|
sl@0
|
646 |
@SYMTestPriority 1
|
sl@0
|
647 |
|
sl@0
|
648 |
@SYMPREQ 39
|
sl@0
|
649 |
|
sl@0
|
650 |
@SYMREQ See SGL.GT0386.401 document
|
sl@0
|
651 |
|
sl@0
|
652 |
@SYMTestCaseDesc
|
sl@0
|
653 |
Ensure that the when using a child VGImage contents of the RSgImage are preserved even if the parent VGImage and the EGLImage have been destroyed.
|
sl@0
|
654 |
|
sl@0
|
655 |
@SYMTestActions
|
sl@0
|
656 |
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.
|
sl@0
|
657 |
Create a reference Bitmap
|
sl@0
|
658 |
Create and fully construct an RSgImage object having the same content as the reference bitmap
|
sl@0
|
659 |
• Set the iUsage bit to ESgUsageBitOpenVgImage
|
sl@0
|
660 |
Pass the RSgImage object into eglCreateImageKHR() with
|
sl@0
|
661 |
• The target parameter set to EGL_NATIVE_PIXMAP_KHR
|
sl@0
|
662 |
• Use the current display and EGL_NO_CONTEXT
|
sl@0
|
663 |
• Use a NULL attr_list
|
sl@0
|
664 |
Check that eglCreateImageKHR() does NOT return EGL_NO_IMAGE_KHR
|
sl@0
|
665 |
Create and make current and EGL context bound to OVG APIs and linked to a window surface.
|
sl@0
|
666 |
Use vgCreateEGLImageTargetKHR() to construct a VGImage object from the EGLImage.
|
sl@0
|
667 |
• Check for errors
|
sl@0
|
668 |
Use vgChildImage() to construct child VGImage object from the previous VGImage.
|
sl@0
|
669 |
• Check for errors
|
sl@0
|
670 |
Pass the parent VGImage into vgDestroyImage()
|
sl@0
|
671 |
Pass the EGLImage into eglDestroyImageKHR()
|
sl@0
|
672 |
Use OpenVG APIs to draw the previous child VGImage to this surface.
|
sl@0
|
673 |
Check Contents.
|
sl@0
|
674 |
Pass the child VGImage into vgDestroyImage()
|
sl@0
|
675 |
Close RSgImage
|
sl@0
|
676 |
Check for memory and handle leaks.
|
sl@0
|
677 |
|
sl@0
|
678 |
@SYMTestExpectedResults
|
sl@0
|
679 |
What is drawn to the surface is exactly what is expected to be inside the child VGImage.
|
sl@0
|
680 |
No memory or handle leaks.
|
sl@0
|
681 |
*/
|
sl@0
|
682 |
TVerdict CEglTest_EGL_Image_Sibling_VGImage_Child_CheckContents::doTestStepL()
|
sl@0
|
683 |
{
|
sl@0
|
684 |
INFO_PRINTF1(_L("CEglTest_EGL_Image_Sibling_VGImage_Child_CheckContents::doTestStepL"));
|
sl@0
|
685 |
SetTestStepID(_L("GRAPHICS-EGL-0142"));
|
sl@0
|
686 |
|
sl@0
|
687 |
TBool ret = CheckForExtensionL(KEGL_RSgimage | KEGL_KHR_image_base | KEGL_KHR_image_pixmap | KVG_KHR_EGL_image);
|
sl@0
|
688 |
if(!ret)
|
sl@0
|
689 |
{
|
sl@0
|
690 |
// The extension is not supported
|
sl@0
|
691 |
RecordTestResultL();
|
sl@0
|
692 |
CloseTMSGraphicsStep();
|
sl@0
|
693 |
return TestStepResult();
|
sl@0
|
694 |
}
|
sl@0
|
695 |
|
sl@0
|
696 |
// This test is performed for default pixel format
|
sl@0
|
697 |
PrintUsedPixelConfiguration();
|
sl@0
|
698 |
|
sl@0
|
699 |
// Create display object
|
sl@0
|
700 |
GetDisplayL();
|
sl@0
|
701 |
CreateEglSessionL();
|
sl@0
|
702 |
iEglSess->InitializeL();
|
sl@0
|
703 |
iEglSess->OpenSgDriverL();
|
sl@0
|
704 |
|
sl@0
|
705 |
RSgImage sgImage;
|
sl@0
|
706 |
CleanupClosePushL(sgImage);
|
sl@0
|
707 |
|
sl@0
|
708 |
// Create a reference bitmap which we use to init the SgImage (we use index=8)
|
sl@0
|
709 |
TDisplayMode bitmapMode = EglTestConversion::PixelFormatToDisplayMode(iSourceFormat);
|
sl@0
|
710 |
CFbsBitmap* bitmap = iEglSess->CreateReferenceBitmapL(bitmapMode, KPixmapSize, 8);
|
sl@0
|
711 |
CleanupStack::PushL(bitmap);
|
sl@0
|
712 |
|
sl@0
|
713 |
INFO_PRINTF1(_L("Creating one RSgImage"));
|
sl@0
|
714 |
TSgImageInfoOpenVgImage imageInfo = TSgImageInfoOpenVgImage(iSourceFormat, KPixmapSize);
|
sl@0
|
715 |
ASSERT_EQUALS(sgImage.Create(imageInfo, bitmap->DataAddress(), bitmap->DataStride()), KErrNone);
|
sl@0
|
716 |
CleanupStack::PopAndDestroy(bitmap);
|
sl@0
|
717 |
bitmap = NULL;
|
sl@0
|
718 |
|
sl@0
|
719 |
INFO_PRINTF1(_L("Creating one EGLImage from it"));
|
sl@0
|
720 |
EGLImageKHR imageKHR = iEglSess->eglCreateImageKhrL(iDisplay, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, &sgImage, KEglImageAttribsPreservedTrue);
|
sl@0
|
721 |
ASSERT_EGL_TRUE(imageKHR != EGL_NO_IMAGE_KHR);
|
sl@0
|
722 |
|
sl@0
|
723 |
//Create a Surface and Link it to a Context bound to OpenVG
|
sl@0
|
724 |
TUidPixelFormat pixelFormat = EglTestConversion::VgFormatToSgPixelFormat(iSurfaceFormat);
|
sl@0
|
725 |
TSgImageInfoOpenVgTarget imageInfo2 = TSgImageInfoOpenVgTarget(pixelFormat, KPixmapSize);
|
sl@0
|
726 |
iEglSess->CreatePixmapSurfaceAndMakeCurrentAndMatchL(imageInfo2, CTestEglSession::EResourceCloseSgImageEarly);
|
sl@0
|
727 |
|
sl@0
|
728 |
INFO_PRINTF1(_L("Creating one VGImage from it"));
|
sl@0
|
729 |
VGImage vgImage = iEglSess->vgCreateImageTargetKHR((VGeglImageKHR)imageKHR);
|
sl@0
|
730 |
ASSERT_VG_TRUE(vgImage != VG_INVALID_HANDLE);
|
sl@0
|
731 |
|
sl@0
|
732 |
INFO_PRINTF1(_L("Creating a VGImage Child from the previous VGImage"));
|
sl@0
|
733 |
VGImage childVgImage = vgChildImage(vgImage,0,0,KPixmapSize.iWidth,KPixmapSize.iHeight);
|
sl@0
|
734 |
ASSERT_EGL_TRUE(childVgImage != VG_INVALID_HANDLE);
|
sl@0
|
735 |
|
sl@0
|
736 |
INFO_PRINTF1(_L("Destroying the RSgImage, the EGLImage, and the parent VGImage"));
|
sl@0
|
737 |
CleanupStack::PopAndDestroy(&sgImage); // closes RSgImage
|
sl@0
|
738 |
ASSERT_EGL_TRUE(iEglSess->DestroyEGLImage(iDisplay, imageKHR)); // closes EGLImage
|
sl@0
|
739 |
vgDestroyImage(vgImage); // closes VGImage (parent)
|
sl@0
|
740 |
ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
|
sl@0
|
741 |
|
sl@0
|
742 |
INFO_PRINTF1(_L("Draw the child VGImage to the surface and check contents"));
|
sl@0
|
743 |
vgSetPixels(0, 0, childVgImage, 0, 0, KPixmapSize.iWidth, KPixmapSize.iHeight);
|
sl@0
|
744 |
ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
|
sl@0
|
745 |
eglWaitClient();
|
sl@0
|
746 |
|
sl@0
|
747 |
// To check the contents we need to repopulate the reference bitmap (with same index used during init)
|
sl@0
|
748 |
TDisplayMode refBitmapMode = EglTestConversion::PixelFormatToDisplayMode(iSourceFormat);
|
sl@0
|
749 |
CFbsBitmap* refBitmap = iEglSess->CreateReferenceBitmapL(refBitmapMode, KPixmapSize, 8);
|
sl@0
|
750 |
CleanupStack::PushL(refBitmap);
|
sl@0
|
751 |
iEglSess->CheckVgDrawingL(iSurfaceFormat, refBitmap);
|
sl@0
|
752 |
CleanupStack::PopAndDestroy(refBitmap);
|
sl@0
|
753 |
INFO_PRINTF1(_L("Content is as expected"));
|
sl@0
|
754 |
|
sl@0
|
755 |
//cleanup
|
sl@0
|
756 |
vgDestroyImage(childVgImage);
|
sl@0
|
757 |
ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
|
sl@0
|
758 |
CleanAll();
|
sl@0
|
759 |
|
sl@0
|
760 |
RecordTestResultL();
|
sl@0
|
761 |
CloseTMSGraphicsStep();
|
sl@0
|
762 |
return TestStepResult();
|
sl@0
|
763 |
}
|
sl@0
|
764 |
|
sl@0
|
765 |
|
sl@0
|
766 |
/**
|
sl@0
|
767 |
@SYMTestCaseID GRAPHICS-EGL-0143
|
sl@0
|
768 |
|
sl@0
|
769 |
@SYMTestPriority 1
|
sl@0
|
770 |
|
sl@0
|
771 |
@SYMPREQ 39
|
sl@0
|
772 |
|
sl@0
|
773 |
@SYMREQ See SGL.GT0386.401 document
|
sl@0
|
774 |
|
sl@0
|
775 |
@SYMTestCaseDesc
|
sl@0
|
776 |
Ensure that when using a child VGImage contents of the RSgImage are preserved even
|
sl@0
|
777 |
if the parent VGImage, the EGLImage and the original RSgImage have been destroyed.
|
sl@0
|
778 |
This test that the link of references fron the child VGImage to the actual content is
|
sl@0
|
779 |
valid even when it is the only reference left to the data.
|
sl@0
|
780 |
|
sl@0
|
781 |
@SYMTestActions
|
sl@0
|
782 |
Perform the exact action described in GRAPHICS-EGL-0213 but close the RSgImage too.
|
sl@0
|
783 |
|
sl@0
|
784 |
@SYMTestExpectedResults
|
sl@0
|
785 |
What is drawn to the surface is exactly what is expected to be inside the child VGImage.
|
sl@0
|
786 |
No memory or handle leaks.
|
sl@0
|
787 |
*/
|
sl@0
|
788 |
TVerdict CEglTest_EGL_Image_Sibling_VGImage_Child_CheckContents_CloseSgEarlier::doTestStepL()
|
sl@0
|
789 |
{
|
sl@0
|
790 |
INFO_PRINTF1(_L("CEglTest_EGL_Image_Sibling_VGImage_Child_CheckContents::doTestStepL"));
|
sl@0
|
791 |
SetTestStepID(_L("GRAPHICS-EGL-0142"));
|
sl@0
|
792 |
|
sl@0
|
793 |
TBool ret = CheckForExtensionL(KEGL_RSgimage | KEGL_KHR_image_base | KEGL_KHR_image_pixmap | KVG_KHR_EGL_image);
|
sl@0
|
794 |
if(!ret)
|
sl@0
|
795 |
{
|
sl@0
|
796 |
// The extension is not supported
|
sl@0
|
797 |
RecordTestResultL();
|
sl@0
|
798 |
CloseTMSGraphicsStep();
|
sl@0
|
799 |
return TestStepResult();
|
sl@0
|
800 |
}
|
sl@0
|
801 |
|
sl@0
|
802 |
// This test is performed for default pixel format
|
sl@0
|
803 |
PrintUsedPixelConfiguration();
|
sl@0
|
804 |
|
sl@0
|
805 |
// Create display object
|
sl@0
|
806 |
GetDisplayL();
|
sl@0
|
807 |
CreateEglSessionL();
|
sl@0
|
808 |
iEglSess->InitializeL();
|
sl@0
|
809 |
iEglSess->OpenSgDriverL();
|
sl@0
|
810 |
|
sl@0
|
811 |
RSgImage sgImage;
|
sl@0
|
812 |
CleanupClosePushL(sgImage);
|
sl@0
|
813 |
|
sl@0
|
814 |
// Create a reference bitmap which we use to init the SgImage (we use index=8)
|
sl@0
|
815 |
TDisplayMode bitmapMode = EglTestConversion::PixelFormatToDisplayMode(iSourceFormat);
|
sl@0
|
816 |
CFbsBitmap* bitmap = iEglSess->CreateReferenceBitmapL(bitmapMode, KPixmapSize, 8);
|
sl@0
|
817 |
CleanupStack::PushL(bitmap);
|
sl@0
|
818 |
|
sl@0
|
819 |
INFO_PRINTF1(_L("Creating one RSgImage"));
|
sl@0
|
820 |
TSgImageInfoOpenVgImage imageInfo = TSgImageInfoOpenVgImage(iSourceFormat, KPixmapSize);
|
sl@0
|
821 |
ASSERT_EQUALS(sgImage.Create(imageInfo, bitmap->DataAddress(), bitmap->DataStride()), KErrNone);
|
sl@0
|
822 |
CleanupStack::PopAndDestroy(bitmap);
|
sl@0
|
823 |
bitmap = NULL;
|
sl@0
|
824 |
|
sl@0
|
825 |
INFO_PRINTF1(_L("Creating one EGLImage from it"));
|
sl@0
|
826 |
EGLImageKHR imageKHR = iEglSess->eglCreateImageKhrL(iDisplay, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, &sgImage, KEglImageAttribsPreservedTrue);
|
sl@0
|
827 |
ASSERT_EGL_TRUE(imageKHR != EGL_NO_IMAGE_KHR);
|
sl@0
|
828 |
|
sl@0
|
829 |
//Close the SgDriver EGL Implemtation should have its own reference to it
|
sl@0
|
830 |
CleanupStack::PopAndDestroy(&sgImage); // closes RSgImage
|
sl@0
|
831 |
iEglSess->CloseSgDriver();
|
sl@0
|
832 |
|
sl@0
|
833 |
//Create a Surface and Link it to a Context bound to OpenVG
|
sl@0
|
834 |
TUidPixelFormat pixelFormat = EglTestConversion::VgFormatToSgPixelFormat(iSurfaceFormat);
|
sl@0
|
835 |
TSgImageInfoOpenVgTarget imageInfo2 = TSgImageInfoOpenVgTarget(pixelFormat, KPixmapSize);
|
sl@0
|
836 |
iEglSess->CreatePixmapSurfaceAndMakeCurrentAndMatchL(imageInfo2, CTestEglSession::EResourceCloseSgImageEarly);
|
sl@0
|
837 |
|
sl@0
|
838 |
INFO_PRINTF1(_L("Creating one VGImage from it"));
|
sl@0
|
839 |
VGImage vgImage = iEglSess->vgCreateImageTargetKHR((VGeglImageKHR)imageKHR);
|
sl@0
|
840 |
ASSERT_VG_TRUE(vgImage != VG_INVALID_HANDLE);
|
sl@0
|
841 |
|
sl@0
|
842 |
INFO_PRINTF1(_L("Creating a VGImage Child from the previous VGImage"));
|
sl@0
|
843 |
VGImage childVgImage = vgChildImage(vgImage,0,0,KPixmapSize.iWidth,KPixmapSize.iHeight);
|
sl@0
|
844 |
ASSERT_EGL_TRUE(childVgImage != VG_INVALID_HANDLE);
|
sl@0
|
845 |
|
sl@0
|
846 |
INFO_PRINTF1(_L("Destroying the RSgImage, the EGLImage, and the parent VGImage"));
|
sl@0
|
847 |
ASSERT_EGL_TRUE(iEglSess->DestroyEGLImage(iDisplay, imageKHR)); // closes EGLImage
|
sl@0
|
848 |
vgDestroyImage(vgImage); // closes VGImage (parent)
|
sl@0
|
849 |
ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
|
sl@0
|
850 |
|
sl@0
|
851 |
INFO_PRINTF1(_L("Draw the child VGImage to the surface and check contents"));
|
sl@0
|
852 |
vgSetPixels(0, 0, childVgImage, 0, 0, KPixmapSize.iWidth, KPixmapSize.iHeight);
|
sl@0
|
853 |
ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
|
sl@0
|
854 |
eglWaitClient();
|
sl@0
|
855 |
|
sl@0
|
856 |
// To check the contents we need to repopulate the reference bitmap (with same index used during init)
|
sl@0
|
857 |
TDisplayMode refBitmapMode = EglTestConversion::PixelFormatToDisplayMode(iSourceFormat);
|
sl@0
|
858 |
CFbsBitmap* refBitmap = iEglSess->CreateReferenceBitmapL(refBitmapMode, KPixmapSize, 8);
|
sl@0
|
859 |
CleanupStack::PushL(refBitmap);
|
sl@0
|
860 |
iEglSess->CheckVgDrawingL(iSurfaceFormat, refBitmap);
|
sl@0
|
861 |
CleanupStack::PopAndDestroy(refBitmap);
|
sl@0
|
862 |
INFO_PRINTF1(_L("Content is as expected"));
|
sl@0
|
863 |
|
sl@0
|
864 |
//cleanup
|
sl@0
|
865 |
vgDestroyImage(childVgImage);
|
sl@0
|
866 |
ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
|
sl@0
|
867 |
CleanAll();
|
sl@0
|
868 |
|
sl@0
|
869 |
RecordTestResultL();
|
sl@0
|
870 |
CloseTMSGraphicsStep();
|
sl@0
|
871 |
return TestStepResult();
|
sl@0
|
872 |
}
|