1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/egl/egltest/inc/egltestcommonstep.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,159 @@
1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +/**
1.20 + @file
1.21 + @test
1.22 +*/
1.23 +
1.24 +#ifndef EGLTESTCOMMONSTEP_H
1.25 +#define EGLTESTCOMMONSTEP_H
1.26 +
1.27 +#include <e32msgqueue.h>
1.28 +#include <EGL/egl.h>
1.29 +#include <VG/openvg.h>
1.30 +#ifdef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
1.31 +#include <sgresource/sgresource.h>
1.32 +#else
1.33 +#include <graphics/sgresource.h>
1.34 +#endif //SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
1.35 +#include <test/testexecuteserverbase.h>
1.36 +#include <test/ttmsgraphicsstep.h>
1.37 +#include <test/egltestcommonutils.h>
1.38 +#include <test/egltestcommonsession.h>
1.39 +
1.40 +const TInt KDefaultWindowGroupId = 200;
1.41 +const TInt KMaxProcessNumber = 32;
1.42 +const TInt KMaxThreadNumber = 100;
1.43 +const TInt KNumSemaphore = 2;
1.44 +
1.45 +class RWindow;
1.46 +
1.47 +struct TEglStepMessageBuffer
1.48 + {
1.49 + TInt iBuf[64];
1.50 + };
1.51 +
1.52 +/**
1.53 +Abstract base class for Egl test steps
1.54 +*/
1.55 +class CEglTestStep : public CTTMSGraphicsStep
1.56 + {
1.57 + friend class EglTestCommonProcess;
1.58 +
1.59 +public:
1.60 + struct TThreadInfo
1.61 + {
1.62 + CEglTestStep* iSelf;
1.63 + TInt iIdx; // << index for example used to identify the thread to semaphores
1.64 + } iThreadInfos[KMaxThreadNumber];
1.65 +
1.66 + struct TThreadStatus
1.67 + {
1.68 + TThreadStatus();
1.69 + enum TStatusId{ERendezvous, ELogin, ESize};
1.70 + RThread iThread;
1.71 + TRequestStatus iStatus[ESize];
1.72 + };
1.73 +
1.74 + struct TProcessStatus
1.75 + {
1.76 + RProcess iProcess;
1.77 + TRequestStatus iStatus;
1.78 + } iProcessStatus[KMaxProcessNumber];
1.79 +
1.80 + // from CTestStep
1.81 + IMPORT_C TVerdict doTestStepPreambleL();
1.82 + IMPORT_C TVerdict doTestStepPostambleL();
1.83 + IMPORT_C virtual ~CEglTestStep();
1.84 +
1.85 + IMPORT_C void PartialInitialiseL(const TDesC& aStepName);
1.86 + IMPORT_C void CleanAll();
1.87 + IMPORT_C void CreateEglSessionL(TInt aIdx=0);
1.88 + inline CTestEglSession* GetEglSess() {return iEglSess;};
1.89 +
1.90 +protected:
1.91 + IMPORT_C CEglTestStep();
1.92 +
1.93 + // Initialisation
1.94 + void SetLoggerForProcessWrapperL();
1.95 +
1.96 + // Utility Methods
1.97 + void HandleMark();
1.98 + void HandleMarkEnd();
1.99 + IMPORT_C void OpenWsSessionL(TInt aGroupId);
1.100 + IMPORT_C void CloseWsSession();
1.101 + IMPORT_C void ConstructWindowL(RWindow& aWindow, const TRect& aRect);
1.102 + IMPORT_C void PrintUsedPixelConfiguration();
1.103 + IMPORT_C void PrintPixelFormat(TUidPixelFormat aFormat);
1.104 + IMPORT_C void PrintVGImageFormat(VGImageFormat aAttr);
1.105 +
1.106 + // Multi process test utils
1.107 + IMPORT_C void Test_MultiProcessL(const TDesC& aTestDllName, TInt aProcessCount, const TDesC& aTestStepName);
1.108 + IMPORT_C void Test_MultiProcessL(const TDesC& aTestDllName, TInt aProcessCount, const TDesC& aTestStepName, const TSgDrawableId& aSgId);
1.109 + IMPORT_C void Test_MultiProcessL(const TDesC& aTestDllName, TInt aProcessCount, const TDesC& aTestStepName, const RArray<TSgDrawableId>& aSgIdList);
1.110 + void CheckProcessStatusL(TInt aIndex, const TRequestStatus& aStatus, const RProcess& aProcess);
1.111 + inline TInt ImageIndexFromProcessId(TInt aProcess, TInt aImageCount) {return (aProcess % aImageCount);}
1.112 +
1.113 + // Multi threaded test utils
1.114 + IMPORT_C void Test_MultiThreadL(TInt aThreadCount, TBool aWaitForCompletion);
1.115 + IMPORT_C void Test_MultiThread_WaitL(TBool aCloseThreads, TThreadStatus::TStatusId aStatusId);
1.116 + void CheckThreadStatusL(TInt aIndex, const TRequestStatus& aStatus, const RThread& aThread);
1.117 + static TInt ThreadFunction(TAny* aSelf);
1.118 + void ThreadFunctionL(TThreadInfo& aInfo);
1.119 +
1.120 + IMPORT_C virtual void doThreadFunctionL(TInt aIdx);
1.121 + IMPORT_C virtual void doThreadFunctionL(TInt aIdx,const TSgDrawableId& aSgId);
1.122 + IMPORT_C void Rendezvous(TInt aIdx);
1.123 + IMPORT_C virtual void doProcessFunctionL(TInt aIdx);
1.124 + IMPORT_C virtual void doProcessFunctionL(TInt aIdx,const TSgDrawableId& aSgId);
1.125 +
1.126 + // EGL helpers
1.127 + IMPORT_C TBool CheckForExtensionL(TInt aExtensions, const TDesC& aExtensionName = KNullDesC);
1.128 + IMPORT_C void GetDisplayL();
1.129 + IMPORT_C void TerminateDisplayL();
1.130 +
1.131 + virtual void ReceiveMessageFromClient(RMsgQueue<TEglStepMessageBuffer>& /*aMessageQueueClientProcParam*/) {}
1.132 +protected:
1.133 + // Session object as required for most tests
1.134 + CTestEglSession* iEglSess;
1.135 +
1.136 + // Whether to output verbose logging
1.137 + TBool iVerboseLogging;
1.138 +
1.139 + // Whether the test step needs to wait for thread completion during postamble
1.140 + TInt iThreadCount;
1.141 + TBool iWaitForCompletionOnPostamble;
1.142 +
1.143 + // The display is shared between threads.
1.144 + EGLDisplay iDisplay;
1.145 +
1.146 + RSemaphore iSemaphore[KNumSemaphore];
1.147 + RArray<TThreadStatus> iThreadStatus;
1.148 +
1.149 + // pixel formats the test is run
1.150 + TUidPixelFormat iSourceFormat;
1.151 + VGImageFormat iSurfaceFormat;
1.152 +
1.153 + TInt iProcHandleMark;
1.154 + TInt iThreadHandleMark;
1.155 + TInt iProcHandleMarkEnd;
1.156 + TInt iThreadHandleMarkEnd;
1.157 +
1.158 + RWsSession iWsSession;
1.159 + RWindowGroup iWindowGroup;
1.160 + };
1.161 +
1.162 +#endif // EGLTESTCOMMONSTEP_H