os/graphics/egl/egltest/src/egltest_nativepixmaptype.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
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 <iniparser.h>
sl@0
    22
#include <test/tefunit.h> // for ASSERT macros
sl@0
    23
sl@0
    24
#include "egltest_nativepixmaptype.h"
sl@0
    25
#include <test/egltestcommonconversion.h>
sl@0
    26
#include <test/egltestcommoninisettings.h>
sl@0
    27
sl@0
    28
sl@0
    29
/**
sl@0
    30
@SYMTestCaseID GRAPHICS-EGL-0015
sl@0
    31
sl@0
    32
@SYMTestPriority 1
sl@0
    33
sl@0
    34
@SYMPREQ 39
sl@0
    35
sl@0
    36
@SYMREQ See SGL.GT0386.401 document
sl@0
    37
sl@0
    38
@SYMTestCaseDesc
sl@0
    39
Checks the single threaded usage of a Pixmap<RSgImage>
sl@0
    40
sl@0
    41
@SYMTestActions
sl@0
    42
Call eglInitialize()
sl@0
    43
Use a Pixmap<RSgImage>
sl@0
    44
sl@0
    45
@SYMTestExpectedResults
sl@0
    46
Use of Pixmap<RSgImage> succeeds
sl@0
    47
*/
sl@0
    48
TVerdict CEglTest_NativePixmapType_SingleThread_Positive_RSgImage::doTestStepL()
sl@0
    49
	{
sl@0
    50
	SetTestStepID(_L("GRAPHICS-EGL-0015"));
sl@0
    51
	INFO_PRINTF1(_L("CEglTest_NativePixmapType_SingleThread_Positive_RSgImage::doTestStepL"));
sl@0
    52
	
sl@0
    53
	TBool ret = CheckForExtensionL(KEGL_RSgimage);
sl@0
    54
	if(!ret)
sl@0
    55
		{
sl@0
    56
		// The extension is not supported
sl@0
    57
		RecordTestResultL();
sl@0
    58
		CloseTMSGraphicsStep();
sl@0
    59
		return TestStepResult();
sl@0
    60
		}
sl@0
    61
sl@0
    62
	// Create display object
sl@0
    63
	GetDisplayL();
sl@0
    64
	CTestEglSession* eglSess = CTestEglSession::NewLC(Logger(), iDisplay, 0);
sl@0
    65
	eglSess->InitializeL();
sl@0
    66
sl@0
    67
	// Try to create and use an RSgImage pixmap
sl@0
    68
	eglSess->TryUsePixmapRSgImageL();
sl@0
    69
	
sl@0
    70
	CleanupStack::PopAndDestroy(eglSess);
sl@0
    71
	TerminateDisplayL();
sl@0
    72
	RecordTestResultL();
sl@0
    73
	CloseTMSGraphicsStep();
sl@0
    74
	return TestStepResult();
sl@0
    75
	}
sl@0
    76
sl@0
    77
/**
sl@0
    78
@SYMTestCaseID GRAPHICS-EGL-0028
sl@0
    79
sl@0
    80
@SYMTestPriority 1
sl@0
    81
sl@0
    82
@SYMPREQ 39
sl@0
    83
sl@0
    84
@SYMREQ See SGL.GT0386.401 document
sl@0
    85
sl@0
    86
@SYMTestCaseDesc
sl@0
    87
These tests check usage of a Pixmap<RSgImage> within two threads.
sl@0
    88
sl@0
    89
@SYMTestActions
sl@0
    90
Execute threads A and B in the following order
sl@0
    91
A: Call eglInitialize()
sl@0
    92
B: Call eglInitialize()
sl@0
    93
-----
sl@0
    94
A: Use Pixmap<RSgImage>
sl@0
    95
B: Use Pixmap<RSgImage>
sl@0
    96
sl@0
    97
@SYMTestExpectedResults
sl@0
    98
Use_Pixmap<RSgImage> succeeds for both threads
sl@0
    99
*/
sl@0
   100
TVerdict CEglTest_NativePixmapType_MultiThread_Positive_RSgImage_InitTwice::doTestStepL()
sl@0
   101
	{
sl@0
   102
	SetTestStepID(_L("GRAPHICS-EGL-0028"));
sl@0
   103
	INFO_PRINTF1(_L("CEglTest_NativePixmapType_MultiThread_Positive_RSgImage_InitTwice::doTestStepL"));
sl@0
   104
	
sl@0
   105
	TBool ret = CheckForExtensionL(KEGL_RSgimage);
sl@0
   106
	
sl@0
   107
	if(ret)
sl@0
   108
		{
sl@0
   109
		Test_MultiThreadL(2, ETrue);
sl@0
   110
		TerminateDisplayL();
sl@0
   111
		}
sl@0
   112
	
sl@0
   113
	INFO_PRINTF1(_L("Exit: CEglTest_NativePixmapType_MultiThread_Positive_RSgImage_InitTwice::doTestStepL"));
sl@0
   114
	RecordTestResultL();
sl@0
   115
	CloseTMSGraphicsStep();
sl@0
   116
	return TestStepResult();
sl@0
   117
	}
sl@0
   118
sl@0
   119
void CEglTest_NativePixmapType_MultiThread_Positive_RSgImage_InitTwice::doThreadFunctionL(TInt aIdx)
sl@0
   120
	{
sl@0
   121
	INFO_PRINTF2(_L("thread %d: CEglTest_NativePixmapType_MultiThread_Positive_RSgImage_InitTwice::doThreadFunctionL"), aIdx);
sl@0
   122
	
sl@0
   123
	GetDisplayL();
sl@0
   124
	CTestEglSession* eglSess = CTestEglSession::NewLC(Logger(), iDisplay, aIdx);
sl@0
   125
	
sl@0
   126
	eglSess->InitializeL();
sl@0
   127
	
sl@0
   128
	Rendezvous(aIdx);
sl@0
   129
	
sl@0
   130
	eglSess->TryUsePixmapRSgImageL();
sl@0
   131
	
sl@0
   132
	CleanupStack::PopAndDestroy(eglSess);
sl@0
   133
	
sl@0
   134
	INFO_PRINTF2(_L("thread %d: Exit CEglTest_NativePixmapType_MultiThread_Positive_RSgImage_InitTwice::doThreadFunctionL"), aIdx);
sl@0
   135
	}
sl@0
   136
sl@0
   137
/**
sl@0
   138
@SYMTestCaseID GRAPHICS-EGL-0029
sl@0
   139
sl@0
   140
@SYMTestPriority 1
sl@0
   141
sl@0
   142
@SYMPREQ 39
sl@0
   143
sl@0
   144
@SYMREQ See SGL.GT0386.401 document
sl@0
   145
sl@0
   146
@SYMTestCaseDesc
sl@0
   147
These tests check usage of a Pixmap<RSgImage> within two threads.
sl@0
   148
Threads are indipendent (no rendezvous).
sl@0
   149
sl@0
   150
@SYMTestActions
sl@0
   151
Execute threads A and B in the following order
sl@0
   152
A: Call eglInitialize()
sl@0
   153
B: Call eglInitialize()
sl@0
   154
-----
sl@0
   155
A: Use Pixmap<RSgImage>
sl@0
   156
B: Use Pixmap<RSgImage>
sl@0
   157
sl@0
   158
@SYMTestExpectedResults
sl@0
   159
Use_Pixmap<RSgImage> succeeds for both threads
sl@0
   160
*/
sl@0
   161
TVerdict CEglTest_NativePixmapType_MultiThread_Positive_RSgImage_InitTwice_NoRendezvous::doTestStepL()
sl@0
   162
	{
sl@0
   163
	SetTestStepID(_L("GRAPHICS-EGL-0029"));
sl@0
   164
	INFO_PRINTF1(_L("CEglTest_NativePixmapType_MultiThread_Positive_RSgImage_InitTwice_NoRendezvous::doTestStepL"));
sl@0
   165
	
sl@0
   166
	TBool ret = CheckForExtensionL(KEGL_RSgimage);
sl@0
   167
		
sl@0
   168
	if(ret)
sl@0
   169
		{
sl@0
   170
		Test_MultiThreadL(2, ETrue);
sl@0
   171
		TerminateDisplayL();
sl@0
   172
		}
sl@0
   173
	
sl@0
   174
	INFO_PRINTF1(_L("Exit: CEglTest_NativePixmapType_MultiThread_Positive_RSgImage_InitTwice_NoRendezvous::doTestStepL"));
sl@0
   175
	RecordTestResultL();
sl@0
   176
	CloseTMSGraphicsStep();
sl@0
   177
	return TestStepResult();
sl@0
   178
	}
sl@0
   179
sl@0
   180
void CEglTest_NativePixmapType_MultiThread_Positive_RSgImage_InitTwice_NoRendezvous::doThreadFunctionL(TInt aIdx)
sl@0
   181
	{
sl@0
   182
	INFO_PRINTF2(_L("thread %d: CEglTest_NativePixmapType_MultiThread_Positive_RSgImage_InitTwice_NoRendezvous::doThreadFunctionL"), aIdx);
sl@0
   183
	GetDisplayL();
sl@0
   184
	//first check if the extension is present
sl@0
   185
	CTestEglSession* eglSess = CTestEglSession::NewLC(Logger(), iDisplay, aIdx);	
sl@0
   186
	eglSess->InitializeL();
sl@0
   187
		
sl@0
   188
	eglSess->TryUsePixmapRSgImageL();
sl@0
   189
	
sl@0
   190
	CleanupStack::PopAndDestroy(eglSess);
sl@0
   191
	
sl@0
   192
	INFO_PRINTF2(_L("thread %d: Exit CEglTest_NativePixmapType_MultiThread_Positive_RSgImage_InitTwice_NoRendezvous::doThreadFunctionL"), aIdx);
sl@0
   193
	}
sl@0
   194
sl@0
   195
sl@0
   196
/**
sl@0
   197
@SYMTestCaseID GRAPHICS-EGL-0030
sl@0
   198
sl@0
   199
@SYMTestPriority 1
sl@0
   200
sl@0
   201
@SYMPREQ 39
sl@0
   202
sl@0
   203
@SYMREQ See SGL.GT0386.401 document
sl@0
   204
sl@0
   205
@SYMTestCaseDesc
sl@0
   206
These test checks that one call to eglInitialize per process is sufficient.
sl@0
   207
Both threads use a Pixmap<RSgImage> 
sl@0
   208
sl@0
   209
@SYMTestActions
sl@0
   210
Execute threads A and B in the following order
sl@0
   211
A: Call eglInitialize()
sl@0
   212
B: <no initialisation>
sl@0
   213
-----
sl@0
   214
A: Use Pixmap<RSgImage>
sl@0
   215
B: Use Pixmap<RSgImage>
sl@0
   216
sl@0
   217
@SYMTestExpectedResults
sl@0
   218
Use_Pixmap<RSgImage> succeeds for both threads
sl@0
   219
*/
sl@0
   220
TVerdict CEglTest_NativePixmapType_MultiThread_Positive_RSgImage_InitOneThreadOnly::doTestStepL()
sl@0
   221
	{
sl@0
   222
	SetTestStepID(_L("GRAPHICS-EGL-0030"));
sl@0
   223
	INFO_PRINTF1(_L("CEglTest_NativePixmapType_MultiThread_Positive_RSgImage_InitOneThreadOnly::doTestStepL"));
sl@0
   224
sl@0
   225
	TBool ret = CheckForExtensionL(KEGL_RSgimage);
sl@0
   226
		
sl@0
   227
	if(ret)
sl@0
   228
		{
sl@0
   229
		Test_MultiThreadL(2, ETrue);
sl@0
   230
		TerminateDisplayL();
sl@0
   231
		}
sl@0
   232
	
sl@0
   233
	INFO_PRINTF1(_L("Exit: CEglTest_NativePixmapType_MultiThread_Positive_RSgImage_InitOneThreadOnly::doTestStepL"));
sl@0
   234
	RecordTestResultL();
sl@0
   235
	CloseTMSGraphicsStep();
sl@0
   236
	return TestStepResult();
sl@0
   237
	}
sl@0
   238
sl@0
   239
void CEglTest_NativePixmapType_MultiThread_Positive_RSgImage_InitOneThreadOnly::doThreadFunctionL(TInt aIdx)
sl@0
   240
	{
sl@0
   241
	INFO_PRINTF2(_L("thread %d: CEglTest_NativePixmapType_MultiThread_Positive_RSgImage_InitOneThreadOnly::doThreadFunctionL"), aIdx);
sl@0
   242
	
sl@0
   243
	GetDisplayL();
sl@0
   244
	CTestEglSession* eglSess = CTestEglSession::NewLC(Logger(), iDisplay, aIdx);
sl@0
   245
	
sl@0
   246
	if (aIdx == 0)
sl@0
   247
		{
sl@0
   248
		eglSess->InitializeL();
sl@0
   249
		}
sl@0
   250
	Rendezvous(aIdx);
sl@0
   251
	if (aIdx == 1)
sl@0
   252
		{
sl@0
   253
		INFO_PRINTF2(_L("thread %d: skipping initialisation"), aIdx);
sl@0
   254
		}
sl@0
   255
	
sl@0
   256
	Rendezvous(aIdx);
sl@0
   257
	
sl@0
   258
	eglSess->TryUsePixmapRSgImageL();
sl@0
   259
	
sl@0
   260
	CleanupStack::PopAndDestroy(eglSess);
sl@0
   261
sl@0
   262
	INFO_PRINTF2(_L("thread %d: Exit CEglTest_NativePixmapType_MultiThread_Positive_RSgImage_InitOneThreadOnly::doThreadFunctionL"), aIdx);
sl@0
   263
	}
sl@0
   264
sl@0
   265
// MultiProcess tests
sl@0
   266
sl@0
   267
/**
sl@0
   268
@SYMTestCaseID GRAPHICS-EGL-0041
sl@0
   269
sl@0
   270
@SYMTestPriority 1
sl@0
   271
sl@0
   272
@SYMPREQ 39
sl@0
   273
sl@0
   274
@SYMREQ See SGL.GT0386.401 document
sl@0
   275
sl@0
   276
@SYMTestCaseDesc
sl@0
   277
These tests check usage of a Pixmap<RSgImage> within two processes.
sl@0
   278
sl@0
   279
@SYMTestActions
sl@0
   280
Execute processes A and B in the following order
sl@0
   281
sl@0
   282
A: Call eglInitialize()
sl@0
   283
B: Call eglInitialize()
sl@0
   284
-----
sl@0
   285
A: Use_Pixmap<RSgImage>
sl@0
   286
B: Use_Pixmap<RSgImage>
sl@0
   287
sl@0
   288
@SYMTestExpectedResults
sl@0
   289
Use_Pixmap<RSgImage> should succeed for both processes
sl@0
   290
*/
sl@0
   291
TVerdict CEglTest_NativePixmapType_MultiProcess_Both_RSgImage::doTestStepL()
sl@0
   292
	{
sl@0
   293
    SetTestStepID(_L("GRAPHICS-EGL-0041"));
sl@0
   294
	INFO_PRINTF1(_L("CEglTest_NativePixmapType_MultiProcess_Both_RSgImage::doTestStepL"));
sl@0
   295
sl@0
   296
	// First check whether RSgImage is supported
sl@0
   297
	TBool ret = CheckForExtensionL(KEGL_RSgimage);
sl@0
   298
		
sl@0
   299
	if(ret)
sl@0
   300
		{
sl@0
   301
		// Now run the multiprocess test - each process can safely assume that RSgImage support is available.
sl@0
   302
		Test_MultiProcessL(KEglTestStepDllName, 2, KNativePixmapType_MultiProcess_Both_RSgImage);
sl@0
   303
		}
sl@0
   304
	
sl@0
   305
	INFO_PRINTF1(_L("Exit: CEglTest_NativePixmapType_MultiProcess_Both_RSgImage::doTestStepL"));
sl@0
   306
	RecordTestResultL();
sl@0
   307
	CloseTMSGraphicsStep();
sl@0
   308
	return TestStepResult();
sl@0
   309
	}
sl@0
   310
sl@0
   311
void CEglTest_NativePixmapType_MultiProcess_Both_RSgImage::doProcessFunctionL(TInt aIdx)
sl@0
   312
	{
sl@0
   313
	INFO_PRINTF2(_L("process %d: CEglTest_NativePixmapType_MultiProcess_Both_RSgImage::doProcessFunctionL"), aIdx);
sl@0
   314
sl@0
   315
	// Create display object
sl@0
   316
	GetDisplayL();
sl@0
   317
	
sl@0
   318
	CTestEglSession* eglSess = CTestEglSession::NewLC(Logger(), iDisplay, aIdx);
sl@0
   319
	
sl@0
   320
	// Initialize the thread
sl@0
   321
	eglSess->InitializeL();
sl@0
   322
	
sl@0
   323
	// Rendezvous: ensure that both threads get to this point before continuing
sl@0
   324
	Rendezvous(aIdx);	
sl@0
   325
sl@0
   326
	// Try to create and use an RSgImage pixmap
sl@0
   327
	INFO_PRINTF2(_L("process %d: Calling TryUsePixmapRSgImageL..."), aIdx);
sl@0
   328
	eglSess->TryUsePixmapRSgImageL();
sl@0
   329
	
sl@0
   330
	CleanupStack::PopAndDestroy(eglSess);
sl@0
   331
	TerminateDisplayL();
sl@0
   332
	
sl@0
   333
	INFO_PRINTF2(_L("process %d: Exit CEglTest_NativePixmapType_MultiProcess_Both_RSgImage::doThreadFunctionL"), aIdx);
sl@0
   334
	}
sl@0
   335
sl@0
   336
/**
sl@0
   337
@SYMTestCaseID GRAPHICS-EGL-0044
sl@0
   338
sl@0
   339
@SYMTestPriority 1
sl@0
   340
sl@0
   341
@SYMPREQ 39
sl@0
   342
sl@0
   343
@SYMREQ See SGL.GT0386.401 document
sl@0
   344
sl@0
   345
@SYMTestCaseDesc
sl@0
   346
Ensure that when asking for an EGLconfig via eglChooseConfig
sl@0
   347
passing an RSgImage with given iUsage and iPixelFormat attributes,
sl@0
   348
just the matching configs are returned.
sl@0
   349
sl@0
   350
@SYMTestActions
sl@0
   351
Fully construct an RSgImage setting iUsage and/or iPixelFormat
sl@0
   352
Loop through different values of iUsage and iPixelFormat and change RSgImage attributes accordingly
sl@0
   353
•	Query all the configs available on the display calling eglGetConfigs.
sl@0
   354
•	Loop through the possible configs and manually check how many they are and save their index.
sl@0
   355
•	Call eglChooseConfig() having in the attrib_list the attribute EGL MATCH NATIVE PIXMAP set as the handle to the RSgImage previously created.
sl@0
   356
•	Check if the number of the returned matching config is equal to the one manually checked earlier. Check if the returned configs are actually the same.
sl@0
   357
End Loop
sl@0
   358
Destroy the RSgImage object
sl@0
   359
sl@0
   360
@SYMTestExpectedResults
sl@0
   361
Returned Configs have to be the ones expected.
sl@0
   362
The values that iPixelFormat have to assume are:
sl@0
   363
•	EUidPixelFormatRGB_565
sl@0
   364
•	EUidPixelFormatXRGB_8888
sl@0
   365
•	EUidPixelFormatARGB_8888_PRE
sl@0
   366
It’s not possible to test any other pixel formats (such as 
sl@0
   367
EUidPixelFormatARGB_8888) because it is not allowed to create an RSgImage 
sl@0
   368
with that pixel format and iUsage bit saying that it is going to be used 
sl@0
   369
as a target.
sl@0
   370
The values that iUsage have to assume are:
sl@0
   371
•   ESgUsageBitOpenVgSurface
sl@0
   372
•   ESgUsageBitOpenGles2Surface
sl@0
   373
•	ESgUsageBitOpenVgSurface | ESgUsageBitOpenGles2Surface
sl@0
   374
•	ESgUsageBitOpenVgImage
sl@0
   375
If OpenGLES2 is not supported creation of the SgImage is expected to fail 
sl@0
   376
with KErrNotSupported error code.
sl@0
   377
*/
sl@0
   378
TVerdict CEglTest_ChooseConfig_EGL_MATCH_NATIVE_PIXMAP_KHR::doTestStepL()
sl@0
   379
	{
sl@0
   380
	SetTestStepID(_L("GRAPHICS-EGL-0044"));
sl@0
   381
	INFO_PRINTF1(_L("CEglTest_ChooseConfig_EGL_MATCH_NATIVE_PIXMAP_KHR::doTestStepL"));
sl@0
   382
sl@0
   383
	TBool ret = CheckForExtensionL(KEGL_RSgimage);
sl@0
   384
	if(!ret)
sl@0
   385
		{
sl@0
   386
		// The extension is not supported
sl@0
   387
		RecordTestResultL();
sl@0
   388
		CloseTMSGraphicsStep();
sl@0
   389
		return TestStepResult();
sl@0
   390
		}
sl@0
   391
sl@0
   392
	// Create display object
sl@0
   393
	GetDisplayL();
sl@0
   394
	CreateEglSessionL();
sl@0
   395
	iEglSess->InitializeL();
sl@0
   396
	iEglSess->OpenSgDriverL();
sl@0
   397
	
sl@0
   398
	CEglTestCommonIniSettings* iniParser = CEglTestCommonIniSettings::NewL();
sl@0
   399
	CleanupStack::PushL(iniParser);
sl@0
   400
				
sl@0
   401
	TInt numRSgImageTargetFormats = iniParser->GetNumberOfFormats(KSectionPixmapSgSurfaceFormats);
sl@0
   402
	if(!numRSgImageTargetFormats)
sl@0
   403
		{
sl@0
   404
		ERR_PRINTF1(_L("No formats to iterate through!"));
sl@0
   405
		User::Leave(KErrArgument);		
sl@0
   406
		}
sl@0
   407
	
sl@0
   408
	TBool isGles2Supported = iEglSess->IsOpenGLES2Supported();
sl@0
   409
	for(TUint i=0; i < numRSgImageTargetFormats; i++)
sl@0
   410
		{
sl@0
   411
		//We are running thorugh all the possible "target" configurations because
sl@0
   412
		//they have one allowed pixel format less than the source has
sl@0
   413
		//so this test is expected to fail for EUidPixelFormatARGB_8888
sl@0
   414
		iSurfaceFormat			= iniParser->GetVgFormat(KSectionPixmapSgSurfaceFormats,i);
sl@0
   415
		iSourceFormat 			= EglTestConversion::VgFormatToSgPixelFormat(iSurfaceFormat);
sl@0
   416
		
sl@0
   417
#ifdef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
sl@0
   418
		INFO_PRINTF1(_L("Trying usage bit ESgUsageBitOpenVgSurface"));
sl@0
   419
		iSgImageSurfaceUsage 	= ESgUsageBitOpenVgSurface;
sl@0
   420
#else
sl@0
   421
		INFO_PRINTF1(_L("Trying usage bit ESgUsageOpenVgTarget"));
sl@0
   422
		iSgImageSurfaceUsage 	= ESgUsageOpenVgTarget;
sl@0
   423
#endif //SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
sl@0
   424
		doTestPartialStepL();
sl@0
   425
sl@0
   426
		//if OpenGLES2 is not supported we must not succeed in creating SgImage
sl@0
   427
#ifdef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
sl@0
   428
		INFO_PRINTF1(_L("Trying usage bit ESgUsageVitOpenGles2Surface"));
sl@0
   429
		iSgImageSurfaceUsage    = ESgUsageBitOpenGles2Surface; 
sl@0
   430
		TRAPD(res, doTestPartialStepL());
sl@0
   431
		TESTL(res == (isGles2Supported ? KErrNone : KErrTEFUnitFail));
sl@0
   432
#endif //SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
sl@0
   433
sl@0
   434
		//if OpenGLES2 is not supported we must not succeed in creating SgImage
sl@0
   435
#ifdef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
sl@0
   436
		INFO_PRINTF1(_L("Trying usage bit ESgUsageBitOpenVgSurface | ESgUsageBitOpenGles2Surface"));
sl@0
   437
		iSgImageSurfaceUsage 	= ESgUsageBitOpenVgSurface | ESgUsageBitOpenGles2Surface; 
sl@0
   438
		TRAP(res, doTestPartialStepL());
sl@0
   439
		TESTL(res == (isGles2Supported ? KErrNone : KErrTEFUnitFail));
sl@0
   440
#endif //SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
sl@0
   441
sl@0
   442
#ifdef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
sl@0
   443
		INFO_PRINTF1(_L("Trying usage bit ESgUsageBitOpenVgImage"));
sl@0
   444
		iSgImageSurfaceUsage 	= ESgUsageBitOpenVgImage;
sl@0
   445
#else
sl@0
   446
		INFO_PRINTF1(_L("Trying usage bit ESgUsageOpenVgImage"));
sl@0
   447
		iSgImageSurfaceUsage 	= ESgUsageOpenVgImage;
sl@0
   448
#endif //SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
sl@0
   449
		doTestPartialStepL();
sl@0
   450
		}
sl@0
   451
	
sl@0
   452
	CleanupStack::PopAndDestroy(iniParser);
sl@0
   453
	CleanAll();
sl@0
   454
	
sl@0
   455
    RecordTestResultL();
sl@0
   456
	CloseTMSGraphicsStep();
sl@0
   457
	return TestStepResult();
sl@0
   458
	}
sl@0
   459
sl@0
   460
TVerdict CEglTest_ChooseConfig_EGL_MATCH_NATIVE_PIXMAP_KHR::doTestPartialStepL()
sl@0
   461
	{
sl@0
   462
	INFO_PRINTF1(_L("CEglTest_ChooseConfig_EGL_MATCH_NATIVE_PIXMAP_KHR::doTestPartialStepL"));
sl@0
   463
	PrintUsedPixelConfiguration();
sl@0
   464
		
sl@0
   465
	//Creating one RSgImage containing reference bitmap's contents
sl@0
   466
	INFO_PRINTF1(_L("Creating one RSgImage"));
sl@0
   467
	RSgImage sgImage;
sl@0
   468
	CleanupClosePushL(sgImage);
sl@0
   469
	TUidPixelFormat pixelFormat = EglTestConversion::VgFormatToSgPixelFormat(iSurfaceFormat);
sl@0
   470
	TSgImageInfo imageInfo;
sl@0
   471
	imageInfo.iSizeInPixels = KPixmapSize;
sl@0
   472
	imageInfo.iPixelFormat = pixelFormat;
sl@0
   473
	imageInfo.iUsage = iSgImageSurfaceUsage;
sl@0
   474
sl@0
   475
	// Create a reference bitmap which we use to init the SgImage (we use index=4)
sl@0
   476
	TDisplayMode bitmapMode = EglTestConversion::VgFormatToDisplayMode(iSurfaceFormat);
sl@0
   477
	CFbsBitmap* bitmap = iEglSess->CreateReferenceBitmapL(bitmapMode, 4);
sl@0
   478
	CleanupStack::PushL(bitmap);	
sl@0
   479
	ASSERT_EQUALS(sgImage.Create(imageInfo, bitmap->DataAddress(), bitmap->DataStride()), KErrNone);
sl@0
   480
	CleanupStack::PopAndDestroy(bitmap);
sl@0
   481
	bitmap = NULL;
sl@0
   482
sl@0
   483
	//create bitmap for further use
sl@0
   484
    bitmap = new (ELeave) CFbsBitmap;
sl@0
   485
    CleanupStack::PushL(bitmap);
sl@0
   486
    TSgImageInfo requestedImageInfo;
sl@0
   487
    sgImage.GetInfo(requestedImageInfo);
sl@0
   488
sl@0
   489
    TDisplayMode displayMode = EglTestConversion::PixelFormatToDisplayMode((TUidPixelFormat) (requestedImageInfo.iPixelFormat));
sl@0
   490
    TESTL(bitmap->Create(requestedImageInfo.iSizeInPixels, displayMode) == KErrNone);
sl@0
   491
	
sl@0
   492
	//Query all the config available on the display
sl@0
   493
	INFO_PRINTF1(_L("Calling eglGetConfigs, querying for the configs' number available on this display"));
sl@0
   494
	EGLint numConfigs;
sl@0
   495
	eglGetConfigs(iDisplay,NULL,0,&numConfigs);
sl@0
   496
	if(!numConfigs)
sl@0
   497
		{
sl@0
   498
		ERR_PRINTF1(_L("No available configs!"));
sl@0
   499
		CleanAll();
sl@0
   500
		User::Leave(KErrTEFUnitFail);
sl@0
   501
		}	
sl@0
   502
	
sl@0
   503
	//allocate a array to store all these configs and retrieve all the IDs	
sl@0
   504
	INFO_PRINTF2(_L("There are %d configs available on this display"),numConfigs);
sl@0
   505
	EGLConfig* configs = new(ELeave) EGLConfig[numConfigs];
sl@0
   506
	CleanupStack::PushL(configs);
sl@0
   507
	INFO_PRINTF1(_L("Calling eglGetConfigs, querying for all configs available on this display"));
sl@0
   508
	ASSERT_EGL_TRUE(eglGetConfigs(iDisplay,configs,KMaxEglConfigs,&numConfigs));		
sl@0
   509
	
sl@0
   510
	//"manually check" if a config is compatible with this RSgImage
sl@0
   511
    RArray<EGLint> compatibleConfigsIdsArray;
sl@0
   512
    CleanupClosePushL(compatibleConfigsIdsArray);
sl@0
   513
    RArray<EGLConfig> compatibleConfigsHandleArray;
sl@0
   514
    CleanupClosePushL(compatibleConfigsHandleArray);
sl@0
   515
  	for(TUint i=0;i<numConfigs;i++)
sl@0
   516
		{
sl@0
   517
		if(GetEglSess()->IsACompatibleConfig(configs[i],sgImage,EFalse))
sl@0
   518
			{
sl@0
   519
			compatibleConfigsHandleArray.AppendL(configs[i]);
sl@0
   520
			EGLint configID = 0;
sl@0
   521
			eglGetConfigAttrib(iDisplay, configs[i], EGL_CONFIG_ID, &configID);
sl@0
   522
			compatibleConfigsIdsArray.Append(configID);
sl@0
   523
            VERBOSE_INFO_PRINTF2(_L("Config %d is compatible"), configs[i]);
sl@0
   524
			}
sl@0
   525
		}
sl@0
   526
    const TInt numCompatibleConfigs = compatibleConfigsIdsArray.Count();  
sl@0
   527
	INFO_PRINTF2(_L("Of which %d are compatible with this RSgImage"),numCompatibleConfigs);
sl@0
   528
sl@0
   529
	//Setting the attributes list to EGL_MATCH_NATIVE_PIXMAP with value the handle to the RSgImage	
sl@0
   530
	const EGLint KAttrib_listFail[] = { EGL_MATCH_NATIVE_PIXMAP,NULL,EGL_NONE };
sl@0
   531
	const EGLint KAttrib_list[] = { EGL_MATCH_NATIVE_PIXMAP,(TInt)&sgImage,EGL_NONE };
sl@0
   532
sl@0
   533
	Mem::FillZ(configs, sizeof(EGLConfig)*numConfigs);
sl@0
   534
	
sl@0
   535
	//Ask all the configs eglChooseConfig thinks are compatible with this RSgImage
sl@0
   536
	//just a negative test
sl@0
   537
	INFO_PRINTF1(_L("Calling eglChooseConfig with the EGL_MATCH_NATIVE_PIXMAP flag set, but null pointer"));	
sl@0
   538
	ASSERT_EGL_TRUE(eglChooseConfig(iDisplay,KAttrib_listFail,configs,numConfigs,&numConfigs) == EGL_FALSE);
sl@0
   539
	GetEglSess()->CheckExpectedErrorL(EGL_BAD_ATTRIBUTE);
sl@0
   540
	
sl@0
   541
	//actually retrieve those config
sl@0
   542
	INFO_PRINTF1(_L("Calling eglChooseConfig with the EGL_MATCH_NATIVE_PIXMAP flag set"));
sl@0
   543
	ASSERT_EGL_TRUE(eglChooseConfig(iDisplay,KAttrib_list,configs,numConfigs,&numConfigs) == EGL_TRUE);
sl@0
   544
sl@0
   545
    RArray<EGLint> configsIdsArray;
sl@0
   546
    CleanupClosePushL(configsIdsArray);
sl@0
   547
    RArray<EGLConfig> configsHandleArray;
sl@0
   548
    CleanupClosePushL(configsHandleArray);
sl@0
   549
 	for(TUint i=0;i<numConfigs;i++)
sl@0
   550
        {
sl@0
   551
        configsHandleArray.Append(configs[i]);
sl@0
   552
        EGLint configID = 0;
sl@0
   553
        eglGetConfigAttrib(iDisplay, configs[i], EGL_CONFIG_ID, &configID);
sl@0
   554
        configsIdsArray.Append(configID);
sl@0
   555
        }
sl@0
   556
sl@0
   557
    INFO_PRINTF3(_L("Checking number of configs returned by eglChooseConfig: %d, number configs, calculated mannually: %d"), numConfigs, numCompatibleConfigs);
sl@0
   558
    ASSERT_EGL_TRUE(numConfigs <= numCompatibleConfigs);
sl@0
   559
    
sl@0
   560
	//Check if the config "manually checked" match with the ones eglChooseConfig returned
sl@0
   561
	TInt numFoundInConfig = 0; //signify, how many IDs from compatible configs matches 
sl@0
   562
	//to the IDs from config retreived by eglChooseConfig, where image is supplied as a native pixmap
sl@0
   563
sl@0
   564
	//check that all configs we checked previously mannually, have corresponding config retrieved via EGL API
sl@0
   565
	for(TUint i=0;i<numCompatibleConfigs;i++)
sl@0
   566
		{
sl@0
   567
		TBool found = EFalse;
sl@0
   568
	    if (configsIdsArray.Find(compatibleConfigsIdsArray[i]) != KErrNotFound)
sl@0
   569
            {
sl@0
   570
            found = ETrue;
sl@0
   571
            VERBOSE_INFO_PRINTF2(_L("Config %d It's compatible as expected!"),compatibleConfigsHandleArray[i]);
sl@0
   572
            numFoundInConfig++;
sl@0
   573
            }
sl@0
   574
		if(!found)
sl@0
   575
			{
sl@0
   576
			//Check whether we can create pixmap surface based on CFbsBitmap. 
sl@0
   577
			//If this succeeds the config was not intended to be used 
sl@0
   578
			//for RSgImage but CFbsBitmap, which is legitimate and we 
sl@0
   579
			//shall exclude this config from our consideration.
sl@0
   580
            EGLint EGL_RENDERABLE_TYPE_value = 0;
sl@0
   581
            eglGetConfigAttrib(iDisplay, compatibleConfigsHandleArray[i], EGL_RENDERABLE_TYPE, &EGL_RENDERABLE_TYPE_value);
sl@0
   582
            const EGLint* KAttribs = ((pixelFormat == EUidPixelFormatARGB_8888_PRE) && (EGL_RENDERABLE_TYPE_value & EGL_OPENVG_BIT)) ? KPixmapAttribsVgAlphaFormatPre : KPixmapAttribsNone;
sl@0
   583
            EGLSurface surface = eglCreatePixmapSurface(iDisplay,compatibleConfigsHandleArray[i],bitmap,KAttribs);
sl@0
   584
            ASSERT_EGL_TRUE(surface != EGL_NO_SURFACE);
sl@0
   585
            ASSERT_EGL_TRUE(eglDestroySurface(iDisplay,surface));
sl@0
   586
			}
sl@0
   587
		}
sl@0
   588
	TEST(numFoundInConfig==numConfigs);
sl@0
   589
sl@0
   590
	//now checking that eglCreatePixmapSurface returns a surface just with the proper configs
sl@0
   591
	//just the configs seen as compatible should allow to create a pixmap surface
sl@0
   592
	memset(configs,0,sizeof(EGLConfig)*numConfigs);
sl@0
   593
	
sl@0
   594
	INFO_PRINTF1(_L("Now testing eglCreatePixmapSurface"));	
sl@0
   595
	INFO_PRINTF1(_L("Calling eglGetConfigs, querying for all configs available on this display"));
sl@0
   596
	ASSERT_EGL_TRUE(eglGetConfigs(iDisplay,configs,KMaxEglConfigs,&numConfigs));
sl@0
   597
sl@0
   598
	configsHandleArray.Reset();
sl@0
   599
	configsIdsArray.Reset();
sl@0
   600
    for(TUint i=0;i<numConfigs;i++)
sl@0
   601
        {
sl@0
   602
        configsHandleArray.Append(configs[i]);
sl@0
   603
        EGLint configID = 0;
sl@0
   604
        eglGetConfigAttrib(iDisplay, configs[i], EGL_CONFIG_ID, &configID);
sl@0
   605
        configsIdsArray.Append(configID);
sl@0
   606
        }
sl@0
   607
sl@0
   608
	for(TUint i=0;i<numConfigs;i++)//iterates through all the configs available on this display
sl@0
   609
		{		
sl@0
   610
		EGLint EGL_SURFACE_TYPE_value = 0;
sl@0
   611
		EGLint EGL_RENDERABLE_TYPE_value = 0;
sl@0
   612
		eglGetConfigAttrib(iDisplay, configsHandleArray[i], EGL_SURFACE_TYPE, &EGL_SURFACE_TYPE_value);
sl@0
   613
		eglGetConfigAttrib(iDisplay, configsHandleArray[i], EGL_RENDERABLE_TYPE, &EGL_RENDERABLE_TYPE_value);
sl@0
   614
		
sl@0
   615
		//bind the API to the renderable type of the config
sl@0
   616
		if (EGL_RENDERABLE_TYPE_value & EGL_OPENVG_BIT)
sl@0
   617
			{
sl@0
   618
			eglBindAPI(EGL_OPENVG_API);
sl@0
   619
			}
sl@0
   620
		else
sl@0
   621
			{
sl@0
   622
			eglBindAPI(EGL_OPENGL_ES_API);
sl@0
   623
			}
sl@0
   624
sl@0
   625
		TBool found = EFalse;
sl@0
   626
	    if (compatibleConfigsIdsArray.Find(configsIdsArray[i]) != KErrNotFound)
sl@0
   627
            {
sl@0
   628
            found = ETrue;
sl@0
   629
            VERBOSE_INFO_PRINTF2(_L("Config %d It's compatible as expected!"),configsHandleArray[i]);
sl@0
   630
            numFoundInConfig++;
sl@0
   631
            }
sl@0
   632
sl@0
   633
	    if(EGL_SURFACE_TYPE_value & EGL_PIXMAP_BIT)	//we are interested just on pixmap surfaces
sl@0
   634
			{
sl@0
   635
			//we need to set the alpha bit value if we are using 16MAP sgImages and vgtarget
sl@0
   636
			const EGLint* KAttribs = ((pixelFormat == EUidPixelFormatARGB_8888_PRE) && (EGL_RENDERABLE_TYPE_value & EGL_OPENVG_BIT)) ? KPixmapAttribsVgAlphaFormatPre : KPixmapAttribsNone;
sl@0
   637
			EGLSurface surface = eglCreatePixmapSurface(iDisplay,configsHandleArray[i],&sgImage,KAttribs);
sl@0
   638
			if(surface != EGL_NO_SURFACE)
sl@0
   639
				{
sl@0
   640
				ASSERT_EGL_ERROR(EGL_SUCCESS);
sl@0
   641
				}
sl@0
   642
			else if (found)
sl@0
   643
				{
sl@0
   644
				//if EGL_NO_SURFACE and found,
sl@0
   645
				//we have to eliminate the case when it is possible to create pixmap surface based on CFbsBitmap. 
sl@0
   646
				//If this succeeds the config was not intended to be used 
sl@0
   647
				//for RSgImage but CFbsBitmap, which is legitimate and we 
sl@0
   648
				//shall exclude this config from our consideration.
sl@0
   649
				surface = eglCreatePixmapSurface(iDisplay,configsHandleArray[i],bitmap,KAttribs);
sl@0
   650
				ASSERT_EGL_TRUE(surface != EGL_NO_SURFACE);
sl@0
   651
				ASSERT_EGL_ERROR(EGL_SUCCESS);
sl@0
   652
				}
sl@0
   653
			else 
sl@0
   654
				{
sl@0
   655
				// if EGL_NO_SURFACE and !found, then the error raised by eglCreatePixmapSurface must be EGL_BAD_MATCH
sl@0
   656
				ASSERT_EGL_ERROR(EGL_BAD_MATCH);
sl@0
   657
				}
sl@0
   658
			if(surface != EGL_NO_SURFACE)
sl@0
   659
				{
sl@0
   660
				ASSERT_EGL_TRUE(eglDestroySurface(iDisplay,surface));
sl@0
   661
				}
sl@0
   662
			}
sl@0
   663
		}
sl@0
   664
	
sl@0
   665
	// clean-up everything
sl@0
   666
	CleanupStack::PopAndDestroy(7, &sgImage); // the 4 arrays, config, bitmap, sgimage
sl@0
   667
	return TestStepResult();
sl@0
   668
	}
sl@0
   669
sl@0
   670
sl@0
   671
/**
sl@0
   672
@SYMTestCaseID GRAPHICS-EGL-0420
sl@0
   673
sl@0
   674
@SYMTestPriority 1
sl@0
   675
sl@0
   676
@SYMPREQ 2637
sl@0
   677
sl@0
   678
@SYMTestCaseDesc
sl@0
   679
Ensure that the system can tell the difference between an RSgImage and a CFbsBitmap.
sl@0
   680
sl@0
   681
@SYMTestActions
sl@0
   682
Cycling through 64K, 16MU and 16MAP.
sl@0
   683
 - For each pixel format, create a CFbsBitmap and pass it into eglChooseConfig() via EGL_MATCH_NATIVE_PIXMAP.
sl@0
   684
 - If eglChooseConfig() returns no results for any pixel format then that’s OK, as we are not mandating that 
sl@0
   685
   the EGL implementation supports CFbsBitmaps 
sl@0
   686
	- call eglCreatePixmapSurface() with the bitmap to check it returns a suitable error and doesn’t crash. 
sl@0
   687
	- If it doesn’t crash then we have started to demonstrate it recognises this is not an RSgImage.
sl@0
   688
	- This also ensures that we are not mandating any of the above pixel formats, just trying them out.
sl@0
   689
 - If eglChooseConfig() does return some results, then use each config to create a pixmap surface and draw something. 
sl@0
   690
	- This will check that eglCreatePixmapSurface() can tell the difference, as well as some very basic sanity checking.
sl@0
   691
sl@0
   692
@SYMTestExpectedResults
sl@0
   693
If eglChooseConfig() returns no results, that's ok as long as it doesn’t crash.
sl@0
   694
If eglChooseConfig() returns some results, eglCreatePixmapSurface(), a surface can be successfully created and used.
sl@0
   695
*/
sl@0
   696
TVerdict CEglTest_CFbsBitmap_EGL_MATCH_NATIVE_PIXMAP_KHR::doTestStepL()
sl@0
   697
	{
sl@0
   698
	SetTestStepID(_L("GRAPHICS-EGL-0420"));
sl@0
   699
	INFO_PRINTF1(_L("CEglTest_CFbsBitmap_EGL_MATCH_NATIVE_PIXMAP_KHR::doTestStepL"));
sl@0
   700
sl@0
   701
	TBool ret = CheckForExtensionL(KEGL_RSgimage);
sl@0
   702
	if(!ret)
sl@0
   703
		{
sl@0
   704
		// The extension is not supported
sl@0
   705
		RecordTestResultL();
sl@0
   706
		CloseTMSGraphicsStep();
sl@0
   707
		return TestStepResult();
sl@0
   708
		}
sl@0
   709
sl@0
   710
	// Create display object
sl@0
   711
	GetDisplayL();
sl@0
   712
	CreateEglSessionL();
sl@0
   713
	iEglSess->InitializeL();
sl@0
   714
    iEglSess->OpenSgDriverL();
sl@0
   715
sl@0
   716
	CEglTestCommonIniSettings* iniParser = CEglTestCommonIniSettings::NewL();
sl@0
   717
	CleanupStack::PushL(iniParser);
sl@0
   718
	TInt numPixmapFbsSurfaceFormats = iniParser->GetNumberOfFormats(KSectionPixmapFbsSurfaceFormats);
sl@0
   719
	if(!numPixmapFbsSurfaceFormats)
sl@0
   720
		{
sl@0
   721
		ERR_PRINTF1(_L("No formats to iterate through!"));
sl@0
   722
		User::Leave(KErrArgument);		
sl@0
   723
		}
sl@0
   724
sl@0
   725
	for(TUint i=0; i < numPixmapFbsSurfaceFormats; i++)
sl@0
   726
		{
sl@0
   727
		//We are running thorugh all the possible CFbsBitmap format configurations
sl@0
   728
		iSurfaceFormat = iniParser->GetVgFormat(KSectionPixmapFbsSurfaceFormats,i);
sl@0
   729
		iSourceFormat = EglTestConversion::VgFormatToSgPixelFormat(iSurfaceFormat);
sl@0
   730
		doTestPartialStepL();
sl@0
   731
		}
sl@0
   732
sl@0
   733
	CleanupStack::PopAndDestroy(iniParser);
sl@0
   734
	CleanAll();
sl@0
   735
	
sl@0
   736
    RecordTestResultL();
sl@0
   737
	CloseTMSGraphicsStep();
sl@0
   738
	return TestStepResult();
sl@0
   739
	}
sl@0
   740
sl@0
   741
TVerdict CEglTest_CFbsBitmap_EGL_MATCH_NATIVE_PIXMAP_KHR::doTestPartialStepL()
sl@0
   742
	{
sl@0
   743
	INFO_PRINTF1(_L("CEglTest_CFbsBitmap_EGL_MATCH_NATIVE_PIXMAP_KHR::doTestPartialStepL"));
sl@0
   744
	PrintUsedPixelConfiguration();
sl@0
   745
sl@0
   746
	//Creating one reference CFbsBitmap in the specified format
sl@0
   747
	INFO_PRINTF1(_L("Creating a CFbsBitmap..."));
sl@0
   748
    TDisplayMode bitmapMode = EglTestConversion::PixelFormatToDisplayMode(iSourceFormat);
sl@0
   749
	CFbsBitmap* bitmap = GetEglSess()->CreateReferenceBitmapL(bitmapMode);
sl@0
   750
	CleanupStack::PushL(bitmap);	
sl@0
   751
	
sl@0
   752
	//Calling eglBindAPI
sl@0
   753
    ASSERT_EGL_TRUE(eglBindAPI(EGL_OPENVG_API));
sl@0
   754
sl@0
   755
	const EGLint KAttribList[] = {EGL_MATCH_NATIVE_PIXMAP, reinterpret_cast<EGLint>(bitmap), 
sl@0
   756
							 	  EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT,
sl@0
   757
							 	  EGL_SURFACE_TYPE, EGL_PIXMAP_BIT,
sl@0
   758
							 	  EGL_NONE };
sl@0
   759
	const EGLint* KPixmapAttribs = (iSourceFormat == EUidPixelFormatARGB_8888_PRE) ? KPixmapAttribsVgAlphaFormatPre : KPixmapAttribsNone;
sl@0
   760
sl@0
   761
  	//Calling eglChooseConfig with the reference CFbsBitmap
sl@0
   762
	INFO_PRINTF1(_L("Calling eglChooseConfig with EGL_MATCH_NATIVE_PIXMAP to check if the system understands CFbsBitmaps..."));
sl@0
   763
	EGLConfig currentConfig;
sl@0
   764
	EGLint numconfigs=0;
sl@0
   765
    ASSERT_EGL_TRUE(eglChooseConfig(iDisplay,KAttribList,&currentConfig,1,&numconfigs))
sl@0
   766
    if (numconfigs==0)
sl@0
   767
    	{
sl@0
   768
    	//If eglChooseConfig() returns no results for any pixel format then that’s OK.
sl@0
   769
    	//This also ensures that we are not mandating any of the above pixel formats, just trying them out.
sl@0
   770
    	INFO_PRINTF1(_L("eglChooseConfig() returns no results for this pixel format. Continue the test"));
sl@0
   771
    	}
sl@0
   772
    else
sl@0
   773
    	{
sl@0
   774
    	//If eglChooseConfig() does return some results, then use config to create a pixmap surface and draw something
sl@0
   775
    	INFO_PRINTF1(_L("eglChooseConfig() returns a config for this pixel format. Do some sanity"));
sl@0
   776
    	EGLSurface surface = eglCreatePixmapSurface(iDisplay,currentConfig,bitmap,KPixmapAttribs);
sl@0
   777
    	ASSERT_EGL_TRUE(surface != EGL_NO_SURFACE);
sl@0
   778
	    EGLContext context = eglCreateContext(iDisplay, currentConfig, EGL_NO_CONTEXT, NULL);
sl@0
   779
	    ASSERT_EGL_TRUE(context != EGL_NO_CONTEXT);
sl@0
   780
	    ASSERT_EGL_TRUE(eglMakeCurrent(iDisplay, surface, surface, context));
sl@0
   781
sl@0
   782
	    // Draw something to the surface
sl@0
   783
		VGfloat color[4] = { 1.0f, 0.f, 1.0f, 0.f };
sl@0
   784
		vgSetfv(VG_CLEAR_COLOR, 4, color);
sl@0
   785
		ASSERT_EGL_TRUE(vgGetError() == VG_NO_ERROR);
sl@0
   786
		vgClear(0, 0, bitmap->SizeInPixels().iWidth, bitmap->SizeInPixels().iHeight);
sl@0
   787
		ASSERT_EGL_TRUE(vgGetError() == VG_NO_ERROR);
sl@0
   788
    	INFO_PRINTF1(_L("Pixmap successfully created and drawn onto. Sanity check completed!"));
sl@0
   789
sl@0
   790
	    //destroy surface-context
sl@0
   791
	    ASSERT_EGL_TRUE(eglDestroySurface(iDisplay,surface));
sl@0
   792
    	ASSERT_EGL_TRUE(eglMakeCurrent(iDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
sl@0
   793
    	}
sl@0
   794
sl@0
   795
	// clean-up everything
sl@0
   796
	CleanupStack::PopAndDestroy(bitmap);
sl@0
   797
	return TestStepResult();
sl@0
   798
	}