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 |
#ifndef EGLTESTCOMMONSTEP_H
|
sl@0
|
22 |
#define EGLTESTCOMMONSTEP_H
|
sl@0
|
23 |
|
sl@0
|
24 |
#include <e32msgqueue.h>
|
sl@0
|
25 |
#include <EGL/egl.h>
|
sl@0
|
26 |
#include <VG/openvg.h>
|
sl@0
|
27 |
#ifdef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
|
sl@0
|
28 |
#include <sgresource/sgresource.h>
|
sl@0
|
29 |
#else
|
sl@0
|
30 |
#include <graphics/sgresource.h>
|
sl@0
|
31 |
#endif //SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
|
sl@0
|
32 |
#include <test/testexecuteserverbase.h>
|
sl@0
|
33 |
#include <test/ttmsgraphicsstep.h>
|
sl@0
|
34 |
#include <test/egltestcommonutils.h>
|
sl@0
|
35 |
#include <test/egltestcommonsession.h>
|
sl@0
|
36 |
|
sl@0
|
37 |
const TInt KDefaultWindowGroupId = 200;
|
sl@0
|
38 |
const TInt KMaxProcessNumber = 32;
|
sl@0
|
39 |
const TInt KMaxThreadNumber = 100;
|
sl@0
|
40 |
const TInt KNumSemaphore = 2;
|
sl@0
|
41 |
|
sl@0
|
42 |
class RWindow;
|
sl@0
|
43 |
|
sl@0
|
44 |
struct TEglStepMessageBuffer
|
sl@0
|
45 |
{
|
sl@0
|
46 |
TInt iBuf[64];
|
sl@0
|
47 |
};
|
sl@0
|
48 |
|
sl@0
|
49 |
/**
|
sl@0
|
50 |
Abstract base class for Egl test steps
|
sl@0
|
51 |
*/
|
sl@0
|
52 |
class CEglTestStep : public CTTMSGraphicsStep
|
sl@0
|
53 |
{
|
sl@0
|
54 |
friend class EglTestCommonProcess;
|
sl@0
|
55 |
|
sl@0
|
56 |
public:
|
sl@0
|
57 |
struct TThreadInfo
|
sl@0
|
58 |
{
|
sl@0
|
59 |
CEglTestStep* iSelf;
|
sl@0
|
60 |
TInt iIdx; // << index for example used to identify the thread to semaphores
|
sl@0
|
61 |
} iThreadInfos[KMaxThreadNumber];
|
sl@0
|
62 |
|
sl@0
|
63 |
struct TThreadStatus
|
sl@0
|
64 |
{
|
sl@0
|
65 |
TThreadStatus();
|
sl@0
|
66 |
enum TStatusId{ERendezvous, ELogin, ESize};
|
sl@0
|
67 |
RThread iThread;
|
sl@0
|
68 |
TRequestStatus iStatus[ESize];
|
sl@0
|
69 |
};
|
sl@0
|
70 |
|
sl@0
|
71 |
struct TProcessStatus
|
sl@0
|
72 |
{
|
sl@0
|
73 |
RProcess iProcess;
|
sl@0
|
74 |
TRequestStatus iStatus;
|
sl@0
|
75 |
} iProcessStatus[KMaxProcessNumber];
|
sl@0
|
76 |
|
sl@0
|
77 |
// from CTestStep
|
sl@0
|
78 |
IMPORT_C TVerdict doTestStepPreambleL();
|
sl@0
|
79 |
IMPORT_C TVerdict doTestStepPostambleL();
|
sl@0
|
80 |
IMPORT_C virtual ~CEglTestStep();
|
sl@0
|
81 |
|
sl@0
|
82 |
IMPORT_C void PartialInitialiseL(const TDesC& aStepName);
|
sl@0
|
83 |
IMPORT_C void CleanAll();
|
sl@0
|
84 |
IMPORT_C void CreateEglSessionL(TInt aIdx=0);
|
sl@0
|
85 |
inline CTestEglSession* GetEglSess() {return iEglSess;};
|
sl@0
|
86 |
|
sl@0
|
87 |
protected:
|
sl@0
|
88 |
IMPORT_C CEglTestStep();
|
sl@0
|
89 |
|
sl@0
|
90 |
// Initialisation
|
sl@0
|
91 |
void SetLoggerForProcessWrapperL();
|
sl@0
|
92 |
|
sl@0
|
93 |
// Utility Methods
|
sl@0
|
94 |
void HandleMark();
|
sl@0
|
95 |
void HandleMarkEnd();
|
sl@0
|
96 |
IMPORT_C void OpenWsSessionL(TInt aGroupId);
|
sl@0
|
97 |
IMPORT_C void CloseWsSession();
|
sl@0
|
98 |
IMPORT_C void ConstructWindowL(RWindow& aWindow, const TRect& aRect);
|
sl@0
|
99 |
IMPORT_C void PrintUsedPixelConfiguration();
|
sl@0
|
100 |
IMPORT_C void PrintPixelFormat(TUidPixelFormat aFormat);
|
sl@0
|
101 |
IMPORT_C void PrintVGImageFormat(VGImageFormat aAttr);
|
sl@0
|
102 |
|
sl@0
|
103 |
// Multi process test utils
|
sl@0
|
104 |
IMPORT_C void Test_MultiProcessL(const TDesC& aTestDllName, TInt aProcessCount, const TDesC& aTestStepName);
|
sl@0
|
105 |
IMPORT_C void Test_MultiProcessL(const TDesC& aTestDllName, TInt aProcessCount, const TDesC& aTestStepName, const TSgDrawableId& aSgId);
|
sl@0
|
106 |
IMPORT_C void Test_MultiProcessL(const TDesC& aTestDllName, TInt aProcessCount, const TDesC& aTestStepName, const RArray<TSgDrawableId>& aSgIdList);
|
sl@0
|
107 |
void CheckProcessStatusL(TInt aIndex, const TRequestStatus& aStatus, const RProcess& aProcess);
|
sl@0
|
108 |
inline TInt ImageIndexFromProcessId(TInt aProcess, TInt aImageCount) {return (aProcess % aImageCount);}
|
sl@0
|
109 |
|
sl@0
|
110 |
// Multi threaded test utils
|
sl@0
|
111 |
IMPORT_C void Test_MultiThreadL(TInt aThreadCount, TBool aWaitForCompletion);
|
sl@0
|
112 |
IMPORT_C void Test_MultiThread_WaitL(TBool aCloseThreads, TThreadStatus::TStatusId aStatusId);
|
sl@0
|
113 |
void CheckThreadStatusL(TInt aIndex, const TRequestStatus& aStatus, const RThread& aThread);
|
sl@0
|
114 |
static TInt ThreadFunction(TAny* aSelf);
|
sl@0
|
115 |
void ThreadFunctionL(TThreadInfo& aInfo);
|
sl@0
|
116 |
|
sl@0
|
117 |
IMPORT_C virtual void doThreadFunctionL(TInt aIdx);
|
sl@0
|
118 |
IMPORT_C virtual void doThreadFunctionL(TInt aIdx,const TSgDrawableId& aSgId);
|
sl@0
|
119 |
IMPORT_C void Rendezvous(TInt aIdx);
|
sl@0
|
120 |
IMPORT_C virtual void doProcessFunctionL(TInt aIdx);
|
sl@0
|
121 |
IMPORT_C virtual void doProcessFunctionL(TInt aIdx,const TSgDrawableId& aSgId);
|
sl@0
|
122 |
|
sl@0
|
123 |
// EGL helpers
|
sl@0
|
124 |
IMPORT_C TBool CheckForExtensionL(TInt aExtensions, const TDesC& aExtensionName = KNullDesC);
|
sl@0
|
125 |
IMPORT_C void GetDisplayL();
|
sl@0
|
126 |
IMPORT_C void TerminateDisplayL();
|
sl@0
|
127 |
|
sl@0
|
128 |
virtual void ReceiveMessageFromClient(RMsgQueue<TEglStepMessageBuffer>& /*aMessageQueueClientProcParam*/) {}
|
sl@0
|
129 |
protected:
|
sl@0
|
130 |
// Session object as required for most tests
|
sl@0
|
131 |
CTestEglSession* iEglSess;
|
sl@0
|
132 |
|
sl@0
|
133 |
// Whether to output verbose logging
|
sl@0
|
134 |
TBool iVerboseLogging;
|
sl@0
|
135 |
|
sl@0
|
136 |
// Whether the test step needs to wait for thread completion during postamble
|
sl@0
|
137 |
TInt iThreadCount;
|
sl@0
|
138 |
TBool iWaitForCompletionOnPostamble;
|
sl@0
|
139 |
|
sl@0
|
140 |
// The display is shared between threads.
|
sl@0
|
141 |
EGLDisplay iDisplay;
|
sl@0
|
142 |
|
sl@0
|
143 |
RSemaphore iSemaphore[KNumSemaphore];
|
sl@0
|
144 |
RArray<TThreadStatus> iThreadStatus;
|
sl@0
|
145 |
|
sl@0
|
146 |
// pixel formats the test is run
|
sl@0
|
147 |
TUidPixelFormat iSourceFormat;
|
sl@0
|
148 |
VGImageFormat iSurfaceFormat;
|
sl@0
|
149 |
|
sl@0
|
150 |
TInt iProcHandleMark;
|
sl@0
|
151 |
TInt iThreadHandleMark;
|
sl@0
|
152 |
TInt iProcHandleMarkEnd;
|
sl@0
|
153 |
TInt iThreadHandleMarkEnd;
|
sl@0
|
154 |
|
sl@0
|
155 |
RWsSession iWsSession;
|
sl@0
|
156 |
RWindowGroup iWindowGroup;
|
sl@0
|
157 |
};
|
sl@0
|
158 |
|
sl@0
|
159 |
#endif // EGLTESTCOMMONSTEP_H
|