egl/egltest/src/egltest_oom_sgimage.cpp
changeset 85 cdf2f6e5c390
child 110 7f25ef56562d
equal deleted inserted replaced
69:3365349494cc 85:cdf2f6e5c390
       
     1 // Copyright (c) 2009 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".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @test
       
    19 */
       
    20 
       
    21 #include <test/tefunit.h> // for ASSERT macros
       
    22 #include <e32msgqueue.h>
       
    23 
       
    24 #include <test/egltestcommonprocess.h>
       
    25 #include <test/egltestcommonconversion.h>
       
    26 #include <test/egltestcommoninisettings.h>
       
    27 #include "egltest_oom_sgimage.h"
       
    28 
       
    29 
       
    30 _LIT(KOOMSection, "OOM");
       
    31 
       
    32 
       
    33 //Since we want to exhaust the memory it probably makes sense to use any 32bpp mode  
       
    34 //There is no need to put it into INI file
       
    35 const TUidPixelFormat KOOMPixelFormat = EUidPixelFormatARGB_8888; 
       
    36 
       
    37 
       
    38 CEglTest_OOM_Base::~CEglTest_OOM_Base()
       
    39     {
       
    40     CleanGraphicsResources();
       
    41     CleanAll();
       
    42     }
       
    43 
       
    44 TVerdict CEglTest_OOM_Base::doTestStepPreambleL()
       
    45     {
       
    46     TVerdict verdict = CEglTestStep::doTestStepPreambleL();
       
    47     //read all parameters from config
       
    48     CEglTestCommonIniSettings* iniParser = CEglTestCommonIniSettings::NewL();
       
    49     CleanupStack::PushL(iniParser);
       
    50     iNumIterations = iniParser->GetNumberOfIterations(KOOMSection);
       
    51     if(!iNumIterations)
       
    52         {
       
    53         ERR_PRINTF1(_L("The number iterations is not specified in INI file, the test will not be executed!"));
       
    54         User::Leave(KErrArgument);      
       
    55         }
       
    56     
       
    57     iImageSize = iniParser->GetImageSize(KOOMSection);
       
    58     if(iImageSize == TSize(0,0))
       
    59         {
       
    60         ERR_PRINTF1(_L("The image size whether is not specified in INI file or is TSize(0,0), the test will not be executed!"));
       
    61         User::Leave(KErrArgument);      
       
    62         }
       
    63     iPixelFormat = KOOMPixelFormat;
       
    64     
       
    65     iThresholdGPUUsedMemory = iniParser->GetThresholdGPUUsedMemory(KOOMSection);
       
    66     if(iThresholdGPUUsedMemory == 0)
       
    67         {
       
    68         ERR_PRINTF1(_L("Threshold GPU used memory whether is not specified in INI file or is 0, the test will not be executed!"));
       
    69         User::Leave(KErrArgument);      
       
    70         }
       
    71 
       
    72     iThresholdLastIteration = iniParser->GetThresholdLastIteration(KOOMSection);
       
    73     if(iThresholdLastIteration == 0)
       
    74         {
       
    75         ERR_PRINTF1(_L("Threshold last iteration whether is not specified in INI file or is 0, the test will not be executed!"));
       
    76         User::Leave(KErrArgument);      
       
    77         }
       
    78     
       
    79     CleanupStack::PopAndDestroy(iniParser);
       
    80 
       
    81     INFO_PRINTF4(_L("**** The test will be run in following configuration: number of iterations %d, image size (%d, %d)"), iNumIterations, iImageSize.iWidth, iImageSize.iHeight);
       
    82     INFO_PRINTF3(_L("**** Threshold GPU used memory %d, threshold last iteration %d"), iThresholdGPUUsedMemory, iThresholdLastIteration);
       
    83     
       
    84     PrintUsedPixelConfiguration();    
       
    85     return verdict;
       
    86     }
       
    87 
       
    88 TVerdict CEglTest_OOM_Base::doTestStepPostambleL()
       
    89     {
       
    90     //to keep heap checking happy we have to clean up before destructor 
       
    91     CleanGraphicsResources();
       
    92     return CEglTestStep::doTestStepPostambleL();
       
    93     }
       
    94 
       
    95 //receive last successful index from the client process
       
    96 void CEglTest_OOM_Base::ReceiveMessageFromClient(RMsgQueue<TEglStepMessageBuffer>& aMessageQueueClientProcParam) 
       
    97     {
       
    98     TEglStepMessageBuffer param;
       
    99     aMessageQueueClientProcParam.ReceiveBlocking(param);
       
   100     iLastIterationNumber = *(TInt*) (param.iBuf);
       
   101     }
       
   102 
       
   103 //send last successful index to the main process for analysis
       
   104 void CEglTest_OOM_Base::SendIndexToMainProcessL(TInt aIndex)
       
   105     {
       
   106     TEglStepMessageBuffer param;
       
   107     RMsgQueue<TEglStepMessageBuffer> messageQueueClientProcParam;
       
   108     CleanupClosePushL(messageQueueClientProcParam);
       
   109     User::LeaveIfError(messageQueueClientProcParam.Open(EProcSlotCustomClientParam, EOwnerProcess));
       
   110     *((TInt*)param.iBuf) = aIndex;
       
   111     messageQueueClientProcParam.SendBlocking(param);
       
   112     CleanupStack::PopAndDestroy(&messageQueueClientProcParam);
       
   113     }
       
   114 
       
   115 //clean Sg/Egl/Vg images allocated. Reset arrays for various deviation variables.
       
   116 void CEglTest_OOM_Base::CleanGraphicsResources()
       
   117     {
       
   118 #ifdef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
       
   119     while(iSurfaces.Count() > 0)
       
   120         {
       
   121         eglDestroySurface(iDisplay, iSurfaces[0]);
       
   122         iSurfaces.Remove(0);
       
   123         }
       
   124     iSurfaces.Reset();
       
   125 
       
   126     while(iVgImages.Count() > 0)
       
   127         {
       
   128         vgDestroyImage(iVgImages[0]);
       
   129         iVgImages.Remove(0);
       
   130         }
       
   131     iVgImages.Reset();
       
   132 
       
   133     while(iEglImages.Count() > 0)
       
   134         {
       
   135         iEglSess->DestroyEGLImage(iDisplay, iEglImages[0]);
       
   136         iEglImages.Remove(0);
       
   137         }
       
   138     iEglImages.Reset();
       
   139     
       
   140     while(iSgImages.Count() > 0)
       
   141         {
       
   142         iSgImages[0].Close();
       
   143         iSgImages.Remove(0);
       
   144         }
       
   145     iSgImages.Reset();
       
   146 
       
   147     iGPUUsedMemory.Reset();
       
   148     iLastIterations.Reset();
       
   149 #endif
       
   150     }
       
   151 
       
   152 //if an array is empty, it returns zero for both aMin and aMax
       
   153 void CEglTest_OOM_Base::GetMinMax(const RArray<TInt>& aArray, TInt& aMin, TInt& aMax) const
       
   154     {
       
   155     aMin = 0;
       
   156     aMax = 0;
       
   157     if(aArray.Count() == 0)
       
   158         return;
       
   159     aMax = aArray[0];
       
   160     aMin = aArray[0];
       
   161     for(TInt ii = 1; ii < aArray.Count(); ii++)
       
   162         {
       
   163         if(aMin > aArray[ii])
       
   164             {
       
   165             aMin = aArray[ii];
       
   166             }
       
   167         if(aMax < aArray[ii])
       
   168             {
       
   169             aMax = aArray[ii];
       
   170             }
       
   171         }
       
   172     }
       
   173 
       
   174 TInt CEglTest_OOM_Base::Deviation(const RArray<TInt>& aArray) const
       
   175     {
       
   176     TInt min = 0;
       
   177     TInt max = 0;
       
   178     
       
   179     GetMinMax(aArray, min, max);
       
   180     if(max == 0) 
       
   181         return 0; // to avoid division by zero
       
   182     return (max - min) / (((TReal)(min + max)) / 2) * 100;  
       
   183     }
       
   184 
       
   185 //Calculate and output deviation of various parameters. 
       
   186 //If the measurement for particular parameter doesn’t take place, for instance, 
       
   187 //due to absence of the extension, the output will be skipped. 
       
   188 void CEglTest_OOM_Base::CheckDeviation()
       
   189     {
       
   190     TInt res = KErrNone;
       
   191     
       
   192     if(iGPUUsedMemory.Count() > 0)
       
   193         {
       
   194         res = Deviation(iGPUUsedMemory);
       
   195         TEST(iThresholdGPUUsedMemory >= res);
       
   196         INFO_PRINTF3(_L("GPU used memory deviation %d %%, threshold %d %%"), res, iThresholdGPUUsedMemory);
       
   197         }
       
   198     
       
   199     if(iLastIterations.Count() > 0)
       
   200         {
       
   201         res = Deviation(iLastIterations);
       
   202         TEST(iThresholdLastIteration >= res);
       
   203         INFO_PRINTF3(_L("Last iteration deviation %d %%, threshold %d %%"), res, iThresholdLastIteration);
       
   204         }
       
   205     }
       
   206 
       
   207 void CEglTest_OOM_Base::RetrieveExtensionDataL()
       
   208     {
       
   209     PrintEglResourceProfilingInfoL();
       
   210     INFO_PRINTF2(_L("Nember iterations before the failure occurs, %d"), iLastIterationNumber);
       
   211     iLastIterations.Append(iLastIterationNumber);
       
   212     iLastIterationNumber = -1;
       
   213     }
       
   214 
       
   215 //Print GPU information provided be NOK_resource_profiling2 egl extension
       
   216 //Some data, like GPU usage, will be memorized for further comparison
       
   217 //This extension is optional and may not be present in the system
       
   218 void CEglTest_OOM_Base::PrintEglResourceProfilingInfoL()
       
   219     {
       
   220 #ifdef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
       
   221 #ifdef EGL_PROF_MEMORY_USAGE_THRESHOLD_NOK    
       
   222 
       
   223     GetDisplayL();
       
   224     CreateEglSessionL();
       
   225     iEglSess->InitializeL();    
       
   226     
       
   227     if(!iPFnEglQueryProfilingDataNOK)
       
   228         {
       
   229         iPFnEglQueryProfilingDataNOK = (PFNEGLQUERYPROFILINGDATANOKPROC) eglGetProcAddress("eglQueryProfilingDataNOK");
       
   230     
       
   231         if(!iPFnEglQueryProfilingDataNOK)
       
   232             {
       
   233             CleanAll();
       
   234             WARN_PRINTF1(_L("NOK_resource_profiling2 extension is not available"));
       
   235             return;
       
   236             }
       
   237         }
       
   238         
       
   239     EGLint data_count;
       
   240     // Find out how much profiling data is available 
       
   241     iPFnEglQueryProfilingDataNOK(iDisplay, 
       
   242                              EGL_PROF_QUERY_GLOBAL_BIT_NOK | 
       
   243                              EGL_PROF_QUERY_MEMORY_USAGE_BIT_NOK,
       
   244                              NULL,
       
   245                              0,
       
   246                              &data_count);
       
   247 
       
   248     // Allocate room for the profiling data
       
   249     EGLint* prof_data = (EGLint*)User::AllocL(data_count * sizeof(EGLint));
       
   250 
       
   251     CleanupStack::PushL(prof_data);
       
   252     
       
   253     // Retrieve the profiling data 
       
   254     iPFnEglQueryProfilingDataNOK(iDisplay, 
       
   255                              EGL_PROF_QUERY_GLOBAL_BIT_NOK | 
       
   256                              EGL_PROF_QUERY_MEMORY_USAGE_BIT_NOK,
       
   257                              prof_data,
       
   258                              data_count,
       
   259                              &data_count);
       
   260 
       
   261     // Iterate over the returned data 
       
   262     EGLint i = 0;
       
   263     while (i < data_count)
       
   264     {
       
   265         switch (prof_data[i++])
       
   266         {
       
   267         case EGL_PROF_TOTAL_MEMORY_NOK:
       
   268             INFO_PRINTF2(_L("Total memory: %d"), prof_data[i++]);
       
   269             break;
       
   270         case EGL_PROF_USED_MEMORY_NOK:
       
   271             iGPUUsedMemory.AppendL(prof_data[i]);
       
   272             INFO_PRINTF2(_L("Used memory: %d"), prof_data[i++]);
       
   273             break;
       
   274         case EGL_PROF_PROCESS_ID_NOK:    
       
   275             if(sizeof(EGLNativeProcessIdTypeNOK) == 4)
       
   276                 {
       
   277                 INFO_PRINTF2(_L("Process ID(4 bytes), 0x%08X"), prof_data[i++]);
       
   278                 }
       
   279             else if(sizeof(EGLNativeProcessIdTypeNOK) == 8)
       
   280                 {
       
   281                 EGLNativeProcessIdTypeNOK processId = ((EGLNativeProcessIdTypeNOK)(prof_data[i])) + (((EGLNativeProcessIdTypeNOK)(prof_data[i + 1]))<<32);
       
   282                 RProcess process;
       
   283                 TProcessId pid(processId);
       
   284                 TInt err = process.Open(pid);
       
   285                 if (err == KErrNone)
       
   286                     {
       
   287                     TPtrC ptr(process.FullName());
       
   288                     INFO_PRINTF4(_L("Process ID, %lu - 0x%lu - %S"), processId, processId, &ptr);
       
   289                     process.Close();
       
   290                     }
       
   291                 else
       
   292                     {//this parameter is not in use in the test, thus is no point to set an error.
       
   293                     WARN_PRINTF4(_L("Process ID, %lu - 0x%lx, fail to open process with error %d"), processId, processId, err);
       
   294                     }                    
       
   295                 i += 2;
       
   296                 }
       
   297             else
       
   298                 {//this parameter is for information only. It doesn't impact our measurement. So there is no need to set an error.
       
   299                 WARN_PRINTF1(_L("Unknown EGLNativeProcessIdTypeNOK"));
       
   300                 }
       
   301             break;
       
   302         case EGL_PROF_PROCESS_USED_PRIVATE_MEMORY_NOK:
       
   303             INFO_PRINTF2(_L("Process used private memory: %d"), prof_data[i++]);
       
   304             break;
       
   305         case EGL_PROF_PROCESS_USED_SHARED_MEMORY_NOK:
       
   306             INFO_PRINTF2(_L("Process used shared memory: %d"), prof_data[i++]);
       
   307             break;
       
   308         }
       
   309     }
       
   310 
       
   311     // Free allocated memory 
       
   312     CleanupStack::PopAndDestroy(prof_data);
       
   313     CleanAll();
       
   314     
       
   315 #endif //EGL_PROF_MEMORY_USAGE_THRESHOLD_NOK    
       
   316 #endif //SYMBIAN_GRAPHICS_EGL_SGIMAGELITE   
       
   317     }
       
   318 
       
   319 /**
       
   320 @SYMTestCaseID GRAPHICS-EGL-0438
       
   321 
       
   322 @SYMTestPriority 1
       
   323 
       
   324 @SYMPREQ 2637
       
   325 
       
   326 @SYMTestCaseDesc
       
   327     OOM test – Free VG/Egl/Sg Images while the process which owns them is terminated
       
   328 
       
   329 @SYMTestActions
       
   330 Environmental settings:
       
   331 •   Image Size: w50 h50
       
   332 •   List of simulated load: 0%
       
   333 •   List of pixel formats
       
   334 ESgPixelFormatARGB_8888
       
   335 •   Client process priorities - all the same
       
   336 •   Client process random parameters:
       
   337 -   None
       
   338 
       
   339 The creation of RSgImages and launching of processes is along the lines of the method outlined in GRAPHICS-EGL-RSGIMAGE_LITE-0406
       
   340 
       
   341     From the main process:
       
   342     For i = 0 to N
       
   343     Spawn 2 client processes A and B.
       
   344         Signal all client processes to start by use of a semaphore
       
   345         Wait until client processes exit
       
   346     If the test fails not due to the memory allocation record an error code to the log file then set a test result as a failure and skip further actions.
       
   347     End loop
       
   348     Exit
       
   349 
       
   350     From client process A:
       
   351     Get EGL display
       
   352     Initialize EGL
       
   353     Open RSgDriver
       
   354     Create context, pbuffer surface.
       
   355     Make pbuffer surface current for the given context  
       
   356     Loop until exit condition met
       
   357     Start loop:
       
   358 Create SgImage
       
   359 Create EglImage with underlying SgImage
       
   360     Create VgImage with underlying EglImage
       
   361     Exit condition – Sg/Egl/Vg image creation has failed.
       
   362 End loop:
       
   363     Destroy the pbuffer surface
       
   364 Log the last iteration number and exact operation which precedes a failure. 
       
   365 In the environment supporting NOK_resource_profiling2 extension retrieve for further analyzes the following GPU profiling data (if available):
       
   366 •   Total memory
       
   367 •   Used memory
       
   368 •   Process ID
       
   369 •   Process used private memory
       
   370 •   Process used shared memory
       
   371 
       
   372 Make the process busy by putting it into the indefinite loop.
       
   373     
       
   374     From client process B:
       
   375     Wait until process A fails with the image creation.
       
   376     Terminate the process A.
       
   377 
       
   378 @SYMTestExpectedResults
       
   379 For each step from 0 to N in the main process, 
       
   380 -   Image allocation failure must happen at approximately the same iteration in process A. 
       
   381     MaxIterationNumber – MinIterationNumber < Threashold, where Treashold will not 
       
   382     exceeds 5 and exact value to be defined during implementation. 
       
   383 -   GPU memory usage retrieved through NOK_resource_profiling2 extension, if available, 
       
   384     is consistent and doesn’t decrease over the time. 
       
   385     MaxGPUMemoryUsage – MinGPUMemoryUsage < Threshold, where Threshold will not exceed 
       
   386     5 and exact value to be defined during implementation. 
       
   387 */
       
   388 TVerdict CEglTest_OOM_CloseVGImageWithTermination::doTestStepL()
       
   389     {
       
   390     SetTestStepID(_L("GRAPHICS-EGL-0438"));
       
   391     SetTestStepName(KOOM_CloseVGImageWithTermination);
       
   392     INFO_PRINTF1(_L("CEglTest_Benchmark_Multi_Process_CreateCloseImage::doTestStepL"));
       
   393 
       
   394 #ifndef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
       
   395 	INFO_PRINTF1(_L("CEglTest_OOM_CloseVGImageWithTermination can only be run with SgImage-Lite"));
       
   396 #else
       
   397     TBool ret = CheckForExtensionL(KEGL_RSgimage | KEGL_KHR_image_base | KVG_KHR_EGL_image | KEGL_KHR_image_pixmap);
       
   398     if(ret)
       
   399         {
       
   400         // The extension is supported
       
   401         // if the test fails not due to the memory allocation, then skip further actions
       
   402         for(TInt index = 0; (index < iNumIterations) && (TestStepResult()== EPass); index++)
       
   403             {
       
   404             // launch 2 processes
       
   405             Test_MultiProcessL(KEglTestStepDllName, 2, TestStepName());
       
   406             RetrieveExtensionDataL();
       
   407             }
       
   408         CheckDeviation();
       
   409         }
       
   410 #endif //SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
       
   411 
       
   412     RecordTestResultL();
       
   413     CloseTMSGraphicsStep();
       
   414     return TestStepResult();
       
   415     }
       
   416 
       
   417 void CEglTest_OOM_CloseVGImageWithTermination::doProcessFunctionL(TInt aIdx)
       
   418     {
       
   419     INFO_PRINTF2(_L("CEglTest_OOM_CloseVGImageWithTermination::doProcessFunctionL, Process %d"),aIdx);
       
   420 #ifdef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
       
   421 
       
   422     if(aIdx == 0)
       
   423         {
       
   424         GetDisplayL();
       
   425         CreateEglSessionL(aIdx);
       
   426         iEglSess->InitializeL();    
       
   427         iEglSess->OpenSgDriverL();
       
   428 
       
   429         //create a dummy surface and context for the purpose of enabling use of VG
       
   430         TEglTestConfig pbufferFormat = EglTestConversion::VgFormatToPBufferSurfaceFormat(EglTestConversion::PixelFormatToVgFormat(iPixelFormat));
       
   431         EGLConfig currentConfig = 0;
       
   432         TRAPD(res, currentConfig = iEglSess->GetConfigExactMatchL( pbufferFormat ));
       
   433         User::LeaveIfError(res);
       
   434         
       
   435         iEglSess->CreatePbufferSurfaceAndMakeCurrentL(currentConfig, iImageSize, EGL_OPENVG_API);
       
   436         TInt index = 0;
       
   437         TSgImageInfo imageInfo;
       
   438         imageInfo.iUsage = ESgUsageBitOpenVgImage | ESgUsageBitOpenVgSurface;
       
   439         imageInfo.iPixelFormat = iPixelFormat;
       
   440         imageInfo.iSizeInPixels = iImageSize;
       
   441         for(;;++index)
       
   442             {
       
   443             RSgImage sgImage;
       
   444             TInt res = sgImage.Create(imageInfo, NULL);
       
   445             if(res != KErrNone || sgImage.IsNull())
       
   446                 {
       
   447                 INFO_PRINTF5(_L("***Fail to create RSgImage after %d attempts, error: %d, expected %d or %d"), index, res, KErrNoMemory, KErrNoGraphicsMemory);
       
   448                 TEST((res == KErrNoMemory) || (res == KErrNoGraphicsMemory));
       
   449                 break;
       
   450                 }
       
   451             EGLImageKHR eglImages = iEglSess->eglCreateImageKhrL(iDisplay,EGL_NO_CONTEXT,EGL_NATIVE_PIXMAP_KHR,&sgImage,const_cast<EGLint *> (KEglImageAttribsPreservedTrue));
       
   452             EGLint eglError = eglGetError();
       
   453             if((eglImages == EGL_NO_IMAGE_KHR) || (eglError != EGL_SUCCESS))
       
   454                 {
       
   455                 INFO_PRINTF4(_L("***Fail to create EGLImage after %d attempts, error: %d, expected: %d"), index, eglError, EGL_BAD_ALLOC);
       
   456                 TEST(eglError == EGL_BAD_ALLOC);
       
   457                 break;
       
   458                 }
       
   459 
       
   460             VGImage vgImage = iEglSess->vgCreateImageTargetKHR((VGeglImageKHR)eglImages);
       
   461             VGErrorCode vgError = vgGetError();
       
   462             if(vgImage == VG_INVALID_HANDLE || (vgError != VG_NO_ERROR))
       
   463                 {
       
   464                 INFO_PRINTF4(_L("***Fail to create VGImage after %d attempts, error: %d, expected: %d"), index, vgError, VG_OUT_OF_MEMORY_ERROR);
       
   465                 TEST(vgError == VG_OUT_OF_MEMORY_ERROR);
       
   466                 break;
       
   467                 }
       
   468             } //for
       
   469         SendIndexToMainProcessL(index);
       
   470         }
       
   471     Rendezvous(aIdx);
       
   472     
       
   473     //create the queue to send/receive Process ID between processes
       
   474     RMsgQueue<TProcessId> messageQueueProcId;
       
   475     User::LeaveIfError(messageQueueProcId.Open(EProcSlotMsgQueueProcId, EOwnerProcess));
       
   476     CleanupClosePushL(messageQueueProcId);
       
   477     
       
   478     if(aIdx == 0)
       
   479         {
       
   480         // Sending Process ID to other process... so that the other process can kill it.
       
   481         TProcessId procId = RProcess().Id();
       
   482         messageQueueProcId.SendBlocking(procId);
       
   483         CleanupStack::PopAndDestroy(&messageQueueProcId);
       
   484         //go into indefinite loop which will be terminated by the second process
       
   485         for(;;) { }
       
   486         }
       
   487     else
       
   488         {
       
   489         TProcessId procId;
       
   490         messageQueueProcId.ReceiveBlocking(procId);
       
   491         CleanupStack::PopAndDestroy(&messageQueueProcId);
       
   492 
       
   493         RProcess process;
       
   494         TESTL(process.Open(procId) == KErrNone);
       
   495         process.Kill(KErrNone);
       
   496         process.Close();
       
   497         
       
   498         // small delay to ensure the kernel finishes the clean-up
       
   499         User::After(1*1000*1000); // 1 second
       
   500         }
       
   501 #endif //SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
       
   502     }
       
   503 
       
   504 /**
       
   505 @SYMTestCaseID GRAPHICS-EGL-0439
       
   506 
       
   507 @SYMTestPriority 1
       
   508 
       
   509 @SYMPREQ 2637
       
   510 
       
   511 @SYMTestCaseDesc
       
   512     OOM test – Free VG/Egl/Sg Images while the process which owns them exits gracefully
       
   513 
       
   514 @SYMTestActions
       
   515 Environmental settings:
       
   516 •   Image Size: w50 h50
       
   517 •   List of simulated load: 0%
       
   518 •   List of pixel formats
       
   519 ESgPixelFormatARGB_8888
       
   520 •   Client process priorities - all the same
       
   521 •   Client process random parameters:
       
   522 -   None
       
   523 
       
   524 The creation of RSgImages and launching of processes is along the lines of the method outlined in GRAPHICS-EGL-RSGIMAGE_LITE-0406
       
   525 
       
   526     From the main process:
       
   527     For i = 0 to N
       
   528     Spawn 1 client process.
       
   529         Signal client process to start by use of a semaphore
       
   530         Wait until client process exits
       
   531     If the test fails not due to the memory allocation record an error code to the log file then set a test result as a failure and skip further actions.
       
   532     End loop
       
   533     Exit
       
   534 
       
   535     From client process A:
       
   536     Get EGL display
       
   537     Initialize EGL
       
   538     Open RSgDriver
       
   539     Create context, pbuffer surface.
       
   540     Make pbuffer surface current for the given context  
       
   541     Loop until exit condition met
       
   542     Start loop:
       
   543 Create SgImage
       
   544 Create EglImage with underlying SgImage
       
   545     Create VgImage with underlying EglImage
       
   546     Exit condition – Sg/Egl/Vg image creation has failed.
       
   547 End loop:
       
   548     Destroy the pbuffer surface
       
   549 Log the last iteration number and exact operation which precedes a failure. 
       
   550 Close all allocated graphics resources (Sg/Egl/Vg images)
       
   551 In the environment supporting NOK_resource_profiling2 extension, retrieve for further analyzes the following GPU profiling data (if available):
       
   552 •   Total memory
       
   553 •   Used memory
       
   554 •   Process ID
       
   555 •   Process used private memory
       
   556 •   Process used shared memory
       
   557 
       
   558 Terminate EGL
       
   559 Close RSgDriver
       
   560 
       
   561 @SYMTestExpectedResults
       
   562 For each step from 0 to N in the main process, 
       
   563 -   Image allocation failure must happen at approximately the same iteration in process A. 
       
   564     MaxIterationNumber – MinIterationNumber < Threashold, where Treashold will not 
       
   565     exceeds 5 and exact value to be defined during implementation. 
       
   566 -   GPU memory usage retrieved through NOK_resource_profiling2 extension, if available, 
       
   567     is consistent and doesn’t decrease over the time.
       
   568     MaxGPUMemoryUsage – MinGPUMemoryUsage < Threshold, where Threshold will not exceed 
       
   569     5 and exact value to be defined during implementation. 
       
   570 */
       
   571 TVerdict CEglTest_OOM_CloseVGImage::doTestStepL()
       
   572     {
       
   573     SetTestStepID(_L("GRAPHICS-EGL-0439"));
       
   574     SetTestStepName(KOOM_CloseVGImage);
       
   575     INFO_PRINTF1(_L("CEglTest_OOM_CloseVGImage::doTestStepL"));
       
   576 
       
   577 #ifndef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
       
   578     INFO_PRINTF1(_L("CEglTest_OOM_CloseVGImage can only be run with SgImage-Lite"));
       
   579 #else
       
   580     TBool ret = CheckForExtensionL(KEGL_RSgimage | KEGL_KHR_image_base | KVG_KHR_EGL_image | KEGL_KHR_image_pixmap);
       
   581     if(ret)
       
   582         {
       
   583         // if the test fails not due to the memory allocation, then skip further actions
       
   584         for(TInt index = 0; (index < iNumIterations) && (TestStepResult()== EPass); index++)
       
   585             {
       
   586             // launch 1 process
       
   587             Test_MultiProcessL(KEglTestStepDllName, 1, TestStepName());
       
   588             RetrieveExtensionDataL();
       
   589             }
       
   590         CheckDeviation();
       
   591         }
       
   592 #endif //SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
       
   593 
       
   594     RecordTestResultL();
       
   595     CloseTMSGraphicsStep();
       
   596     return TestStepResult();
       
   597     }
       
   598 
       
   599 void CEglTest_OOM_CloseVGImage::doProcessFunctionL(TInt aIdx)
       
   600     {
       
   601     INFO_PRINTF2(_L("CEglTest_OOM_CloseVGImageWithTermination::doProcessFunctionL, Process %d"),aIdx);
       
   602 #ifdef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
       
   603     GetDisplayL();
       
   604     CreateEglSessionL(aIdx);
       
   605     iEglSess->InitializeL();    
       
   606     iEglSess->OpenSgDriverL();
       
   607 
       
   608     //create a dummy surface and context for the purpose of enabling use of VG
       
   609     TEglTestConfig pbufferFormat = EglTestConversion::VgFormatToPBufferSurfaceFormat(EglTestConversion::PixelFormatToVgFormat(iPixelFormat));
       
   610     EGLConfig currentConfig = 0;
       
   611     TRAPD(res, currentConfig = iEglSess->GetConfigExactMatchL( pbufferFormat ));
       
   612     User::LeaveIfError(res);
       
   613 
       
   614     iEglSess->CreatePbufferSurfaceAndMakeCurrentL(currentConfig, iImageSize, EGL_OPENVG_API);
       
   615     TInt index = 0;
       
   616     TSgImageInfo imageInfo;
       
   617     imageInfo.iUsage = ESgUsageBitOpenVgImage | ESgUsageBitOpenVgSurface;
       
   618     imageInfo.iPixelFormat = iPixelFormat;
       
   619     imageInfo.iSizeInPixels = iImageSize;
       
   620 
       
   621     for(;;++index)
       
   622         {
       
   623         RSgImage sgImage;
       
   624         TInt res = sgImage.Create(imageInfo, NULL);
       
   625         if(res != KErrNone || sgImage.IsNull())
       
   626             {
       
   627             INFO_PRINTF5(_L("***Fail to create RSgImage after %d attempts, error: %d, expected: %d or %d"), index, res, KErrNoMemory, KErrNoGraphicsMemory);
       
   628             TEST((res == KErrNoMemory) || (res == KErrNoGraphicsMemory));
       
   629             break;
       
   630             }
       
   631         iSgImages.AppendL(sgImage);
       
   632         
       
   633         EGLImageKHR eglImage = iEglSess->eglCreateImageKhrL(iDisplay,EGL_NO_CONTEXT,EGL_NATIVE_PIXMAP_KHR,&sgImage,const_cast<EGLint *> (KEglImageAttribsPreservedTrue));
       
   634         EGLint eglError = eglGetError();
       
   635         if((eglImage == EGL_NO_IMAGE_KHR) || (eglError != EGL_SUCCESS))
       
   636             {
       
   637             INFO_PRINTF4(_L("***Fail to create EGLImage after %d attempts, error: %d, expected: %d"), index, eglError, EGL_BAD_ALLOC);
       
   638             TEST(eglError == EGL_BAD_ALLOC);
       
   639             break;
       
   640             }
       
   641         iEglImages.AppendL(eglImage);
       
   642         
       
   643         VGImage vgImage = iEglSess->vgCreateImageTargetKHR((VGeglImageKHR)eglImage);
       
   644         VGErrorCode vgError = vgGetError();
       
   645         if(vgImage == VG_INVALID_HANDLE || (vgError != VG_NO_ERROR))
       
   646             {
       
   647             INFO_PRINTF4(_L("***Fail to create VGImage after %d attempts, error: %d, expected: %d"), index, vgError, VG_OUT_OF_MEMORY_ERROR);
       
   648             TEST(vgError == VG_OUT_OF_MEMORY_ERROR);
       
   649             break;
       
   650             }
       
   651         iVgImages.AppendL(vgImage);
       
   652         }
       
   653 
       
   654     SendIndexToMainProcessL(index);
       
   655     
       
   656     //now clean everything
       
   657     CleanGraphicsResources();
       
   658     iEglSess->CloseSgDriver();
       
   659     CleanAll();
       
   660 #endif    
       
   661     }    
       
   662 
       
   663 /**
       
   664 @SYMTestCaseID GRAPHICS-EGL-0440
       
   665 
       
   666 @SYMTestPriority 1
       
   667 
       
   668 @SYMPREQ 2637
       
   669 
       
   670 @SYMTestCaseDesc
       
   671     OOM test – Free SgImages/Pixmap surfaces while the process which owns them is terminated
       
   672 
       
   673 @SYMTestActions
       
   674 Environmental settings:
       
   675 •   Image Size: w50 h50
       
   676 •   List of simulated load: 0%
       
   677 •   List of pixel formats
       
   678 ESgPixelFormatARGB_8888
       
   679 •   Client process priorities - all the same
       
   680 •   Client process random parameters:
       
   681 -   None
       
   682 
       
   683 The creation of RSgImages and launching of processes is along the lines of the method outlined in GRAPHICS-EGL-RSGIMAGE_LITE-0406
       
   684 
       
   685     From the main process:
       
   686     For i = 0 to N
       
   687         Spawn 2 client processes A and B.
       
   688         Signal all client processes to start by use of a semaphore
       
   689         Wait until client processes exit
       
   690     If the test fails not due to the memory allocation record an error code to the log file then set a test result as a failure and skip further actions.
       
   691     End loop
       
   692     Exit
       
   693 
       
   694     From client process A:
       
   695     Get EGL display
       
   696     Initialize EGL
       
   697     Open RSgDriver
       
   698     Loop until exit condition met
       
   699     Start loop:
       
   700         Create SgImage
       
   701         Create Pixmap surface with underlying SgImage
       
   702         Exit condition – SgImage/Pixmap surface creation has failed.
       
   703     End loop:
       
   704     Log the last iteration number and exact operation which precedes a failure. 
       
   705     In the environment supporting NOK_resource_profiling2 extension retrieve for further analyzes the following GPU profiling data (if available):
       
   706         •   Total memory
       
   707         •   Used memory
       
   708         •   Process ID
       
   709         •   Process used private memory
       
   710         •   Process used shared memory
       
   711     Make the process busy by putting it into the indefinite loop.
       
   712     
       
   713     From client process B:
       
   714     Wait until process A fails with the image/surface creation.
       
   715     Terminate the process A.
       
   716 
       
   717 @SYMTestExpectedResults
       
   718 For each step from 0 to N in the main process, 
       
   719 -   Image or surface allocation failure must happen at approximately the same iteration 
       
   720     in process A. MaxIterationNumber – MinIterationNumber < Threashold, 
       
   721     where Treashold will not exceeds 5 and exact value to be defined during implementation. 
       
   722 -   GPU memory usage retrieved through NOK_resource_profiling2 extension, if available, 
       
   723     is consistent and doesn’t decrease over the time.
       
   724     MaxGPUMemoryUsage – MinGPUMemoryUsage < Threshold, where Threshold will not exceed 
       
   725     5 and exact value to be defined during implementation. 
       
   726 */
       
   727 TVerdict CEglTest_OOM_ClosePixmapSurfaceWithTermination::doTestStepL()
       
   728     {
       
   729     SetTestStepID(_L("GRAPHICS-EGL-0438"));
       
   730     SetTestStepName(KOOM_ClosePixmapSurfaceWithTermination);
       
   731     INFO_PRINTF1(_L("CEglTest_OOM_ClosePixmapSurfaceWithTermination::doTestStepL"));
       
   732 
       
   733 #ifndef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
       
   734     INFO_PRINTF1(_L("CEglTest_OOM_ClosePixmapSurfaceWithTermination can only be run with SgImage-Lite"));
       
   735 #else
       
   736     TBool ret = CheckForExtensionL(KEGL_RSgimage | KEGL_KHR_image_base | KVG_KHR_EGL_image | KEGL_KHR_image_pixmap);
       
   737     if(ret)
       
   738         {
       
   739         // if the test fails not due to the memory allocation, then skip further actions
       
   740         for(TInt index = 0; (index < iNumIterations) && (TestStepResult()== EPass); index++)
       
   741             {
       
   742             // launch 2 processes
       
   743             Test_MultiProcessL(KEglTestStepDllName, 2, TestStepName());
       
   744             RetrieveExtensionDataL();
       
   745             }
       
   746         CheckDeviation();
       
   747         }
       
   748 #endif //SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
       
   749 
       
   750     RecordTestResultL();
       
   751     CloseTMSGraphicsStep();
       
   752     return TestStepResult();
       
   753     }
       
   754 
       
   755 void CEglTest_OOM_ClosePixmapSurfaceWithTermination::doProcessFunctionL(TInt aIdx)
       
   756     {
       
   757     INFO_PRINTF2(_L("CEglTest_OOM_ClosePixmapSurfaceWithTermination::doProcessFunctionL, Process %d"),aIdx);
       
   758 #ifdef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
       
   759 
       
   760     if(aIdx == 0)
       
   761         {
       
   762         GetDisplayL();
       
   763         CreateEglSessionL(aIdx);
       
   764         iEglSess->InitializeL();    
       
   765         iEglSess->OpenSgDriverL();
       
   766 
       
   767         TInt index = 0;
       
   768         TSgImageInfo imageInfo;
       
   769         imageInfo.iUsage = ESgUsageBitOpenVgImage | ESgUsageBitOpenVgSurface;
       
   770         imageInfo.iPixelFormat = iPixelFormat;
       
   771         imageInfo.iSizeInPixels = iImageSize;
       
   772 
       
   773         for(;;++index)
       
   774             {
       
   775             RSgImage sgImage;
       
   776             TInt res = sgImage.Create(imageInfo, NULL);
       
   777             if(res != KErrNone || sgImage.IsNull())
       
   778                 {
       
   779                 INFO_PRINTF5(_L("***Fail to create RSgImage after %d attempts, error: %d, expected: %d or %d"), index, res, KErrNoMemory, KErrNoGraphicsMemory);
       
   780                 TEST((res == KErrNoMemory) || (res == KErrNoGraphicsMemory));
       
   781                 break;
       
   782                 }
       
   783             
       
   784             EGLConfig currentConfig = 0;
       
   785             const EGLint KAttrib[] = { EGL_MATCH_NATIVE_PIXMAP,   (TInt)&sgImage,
       
   786                                        EGL_RENDERABLE_TYPE,       EGL_OPENVG_BIT,
       
   787                                        EGL_SURFACE_TYPE,          EGL_PIXMAP_BIT,
       
   788                                        EGL_NONE };
       
   789             
       
   790             EGLint config_size;
       
   791             ASSERT_EGL_TRUE(eglChooseConfig(iDisplay,KAttrib,&currentConfig,1,&config_size));
       
   792             ASSERT_TRUE(currentConfig!=0);
       
   793             
       
   794             // Create a pixmap surface from the native image
       
   795             EGLSurface surface = eglCreatePixmapSurface(iDisplay, currentConfig, &sgImage, NULL);
       
   796             EGLint eglError = eglGetError();
       
   797             if((surface == EGL_NO_SURFACE) || (eglError != EGL_SUCCESS))
       
   798                 {
       
   799                 INFO_PRINTF4(_L("***Fail to create Pixmap surface after %d attempts, error: %d, expected: %d"), index, eglError, EGL_BAD_ALLOC);
       
   800                 TEST(eglError == EGL_BAD_ALLOC);
       
   801                 break;
       
   802                 }            
       
   803             } //for
       
   804         SendIndexToMainProcessL(index);
       
   805         }
       
   806     Rendezvous(aIdx);
       
   807     
       
   808     //create the queue to send/receive Process ID between processes
       
   809     RMsgQueue<TProcessId> messageQueueProcId;
       
   810     User::LeaveIfError(messageQueueProcId.Open(EProcSlotMsgQueueProcId, EOwnerProcess));
       
   811     CleanupClosePushL(messageQueueProcId);
       
   812     
       
   813     if(aIdx == 0)
       
   814         {
       
   815         // Sending Process ID to other process... so that the other process can kill it.
       
   816         TProcessId procId = RProcess().Id();
       
   817         messageQueueProcId.SendBlocking(procId);
       
   818         CleanupStack::PopAndDestroy(&messageQueueProcId);
       
   819         //go into indefinite loop which will be terminated by the second process
       
   820         for(;;) { }
       
   821         }
       
   822     else
       
   823         {
       
   824         TProcessId procId;
       
   825         messageQueueProcId.ReceiveBlocking(procId);
       
   826         CleanupStack::PopAndDestroy(&messageQueueProcId);
       
   827 
       
   828         RProcess process;
       
   829         TESTL(process.Open(procId) == KErrNone);
       
   830         process.Kill(KErrNone);
       
   831 		process.Close();
       
   832 
       
   833         // small delay to ensure the kernel finishes the clean-up
       
   834         User::After(1*1000*1000); // 1 second
       
   835         }
       
   836 #endif //SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
       
   837     }
       
   838 
       
   839 /**
       
   840 @SYMTestCaseID GRAPHICS-EGL-0441
       
   841 
       
   842 @SYMTestPriority 1
       
   843 
       
   844 @SYMPREQ 2637
       
   845 
       
   846 @SYMTestCaseDesc
       
   847     OOM test – Free SgImages/Pixmap surfaces while the process which owns them exits gracefully
       
   848 
       
   849 @SYMTestActions
       
   850 Environmental settings:
       
   851 •   Image Size: w50 h50
       
   852 •   List of simulated load: 0%
       
   853 •   List of pixel formats
       
   854 ESgPixelFormatARGB_8888
       
   855 •   Client process priorities - all the same
       
   856 •   Client process random parameters:
       
   857 -   None
       
   858 
       
   859 The creation of RSgImages and launching of processes is along the lines of the method outlined in GRAPHICS-EGL-RSGIMAGE_LITE-0406
       
   860 
       
   861     From the main process:
       
   862     For i = 0 to N
       
   863         Spawn 1 client process.
       
   864         Signal client process to start by use of a semaphore
       
   865         Wait until client process exits
       
   866     If the test fails not due to the memory allocation record an error code to the log file then set a test result as a failure and skip further actions.
       
   867     End loop
       
   868     Exit
       
   869 
       
   870     From client process A:
       
   871     Get EGL display
       
   872     Initialize EGL
       
   873     Open RSgDriver
       
   874     Loop until exit condition met
       
   875     Start loop:
       
   876         Create SgImage
       
   877         Create Pixmap surface with underlying SgImage
       
   878         Exit condition – SgImage/Pixmap surface creation has failed.
       
   879     End loop:
       
   880     Log the last iteration number and exact operation which precedes a failure.
       
   881     CLose all allocated graphics resources (SgImages/Pixmap surfaces) 
       
   882     In the environment supporting NOK_resource_profiling2 extension retrieve for further analyzes the following GPU profiling data (if available):
       
   883         •   Total memory
       
   884         •   Used memory
       
   885         •   Process ID
       
   886         •   Process used private memory
       
   887         •   Process used shared memory
       
   888     Terminate EGL
       
   889     Close RSgDriver
       
   890 
       
   891 @SYMTestExpectedResults
       
   892 For each step from 0 to N in the main process, 
       
   893 -   Image or surface allocation failure must happen at approximately the same iteration in process A. 
       
   894     MaxIterationNumber – MinIterationNumber < Threashold, 
       
   895     where Treashold will not exceeds 5 and exact value to be defined during implementation. 
       
   896 -   GPU memory usage retrieved through NOK_resource_profiling2 extension, 
       
   897     if available, is consistent and doesn’t decrease over the time. 
       
   898 */
       
   899 TVerdict CEglTest_OOM_ClosePixmapSurface::doTestStepL()
       
   900     {
       
   901     SetTestStepID(_L("GRAPHICS-EGL-0441"));
       
   902     SetTestStepName(KOOM_ClosePixmapSurface);
       
   903     INFO_PRINTF1(_L("CEglTest_OOM_ClosePixmapSurface::doTestStepL"));
       
   904 
       
   905 #ifndef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
       
   906     INFO_PRINTF1(_L("CEglTest_OOM_ClosePixmapSurface can only be run with SgImage-Lite"));
       
   907 #else
       
   908     TBool ret = CheckForExtensionL(KEGL_RSgimage | KEGL_KHR_image_base | KVG_KHR_EGL_image | KEGL_KHR_image_pixmap);
       
   909     if(ret)
       
   910         {
       
   911         // if the test fails not due to the memory allocation, then skip further actions
       
   912         for(TInt index = 0; (index < iNumIterations) && (TestStepResult()== EPass); index++)
       
   913             {
       
   914             // launch 1 process
       
   915             Test_MultiProcessL(KEglTestStepDllName, 1, TestStepName());
       
   916             RetrieveExtensionDataL();
       
   917             } //for
       
   918         CheckDeviation();
       
   919         }
       
   920 #endif //SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
       
   921 
       
   922     RecordTestResultL();
       
   923     CloseTMSGraphicsStep();
       
   924     return TestStepResult();
       
   925     }
       
   926 
       
   927 void CEglTest_OOM_ClosePixmapSurface::doProcessFunctionL(TInt aIdx)
       
   928     {
       
   929     INFO_PRINTF2(_L("CEglTest_OOM_ClosePixmapSurface::doProcessFunctionL, Process %d"),aIdx);
       
   930 #ifdef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
       
   931     GetDisplayL();
       
   932     CreateEglSessionL(aIdx);
       
   933     iEglSess->InitializeL();    
       
   934     iEglSess->OpenSgDriverL();
       
   935 
       
   936     TInt index = 0;
       
   937     TSgImageInfo imageInfo;
       
   938     imageInfo.iUsage = ESgUsageBitOpenVgImage | ESgUsageBitOpenVgSurface;
       
   939     imageInfo.iPixelFormat = iPixelFormat;
       
   940     imageInfo.iSizeInPixels = iImageSize;
       
   941 
       
   942     for(;;++index)
       
   943         {
       
   944         RSgImage sgImage;
       
   945         TInt res = sgImage.Create(imageInfo, NULL);
       
   946         if(res != KErrNone || sgImage.IsNull())
       
   947             {
       
   948             INFO_PRINTF5(_L("***Fail to create RSgImage after %d attempts, error: %d, expected: %d or %d"), index, res, KErrNoMemory, KErrNoGraphicsMemory);
       
   949             TEST((res == KErrNoMemory) || (res == KErrNoGraphicsMemory));
       
   950             break;
       
   951             }
       
   952         iSgImages.AppendL(sgImage);
       
   953         
       
   954         EGLConfig currentConfig = 0;
       
   955         const EGLint KAttrib[] = { EGL_MATCH_NATIVE_PIXMAP,   (TInt)&sgImage,
       
   956                                    EGL_RENDERABLE_TYPE,       EGL_OPENVG_BIT,
       
   957                                    EGL_SURFACE_TYPE,          EGL_PIXMAP_BIT,
       
   958                                    EGL_NONE };
       
   959         
       
   960         EGLint config_size;
       
   961         ASSERT_EGL_TRUE(eglChooseConfig(iDisplay,KAttrib,&currentConfig,1,&config_size));
       
   962         ASSERT_TRUE(currentConfig!=0);
       
   963         
       
   964         // Create a pixmap surface from the native image
       
   965         EGLSurface surface = eglCreatePixmapSurface(iDisplay, currentConfig, &sgImage, NULL);
       
   966         EGLint eglError = eglGetError();
       
   967         if((surface == EGL_NO_SURFACE) || (eglError != EGL_SUCCESS))
       
   968             {
       
   969             INFO_PRINTF4(_L("***Fail to create Pixmap surface after %d attempts, error: %d, expected: %d "), index, eglError, EGL_BAD_ALLOC);
       
   970             TEST(eglError == EGL_BAD_ALLOC);
       
   971             break;
       
   972             }       
       
   973         iSurfaces.AppendL(surface);
       
   974         } //for
       
   975     SendIndexToMainProcessL(index);
       
   976     //now clean everything
       
   977     CleanGraphicsResources();
       
   978     iEglSess->CloseSgDriver();
       
   979     CleanAll();
       
   980 #endif    
       
   981     }    
       
   982