|
1 // Copyright (c) 2007-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 @internalComponent - Internal Symbian test code |
|
20 */ |
|
21 |
|
22 #ifndef __TDIRECTGDIEGLCONTENT_SERVER_H__ |
|
23 #define __TDIRECTGDIEGLCONTENT_SERVER_H__ |
|
24 |
|
25 #include <e32base.h> |
|
26 #include <pixelformats.h> |
|
27 #include <graphics/sgimage.h> |
|
28 #include <graphics/sgimagecollection.h> |
|
29 #include <GLES/egl.h> |
|
30 |
|
31 /** |
|
32 Egl content panic codes |
|
33 */ |
|
34 enum TEglContentPanic |
|
35 { |
|
36 EPanicBadDescriptor, |
|
37 EPanicIllegalFunction, |
|
38 EPanicAlreadyReceiving |
|
39 }; |
|
40 |
|
41 void PanicClient(const RMessagePtr2& aMessage, TEglContentPanic aPanic); |
|
42 |
|
43 const TInt KEglContentDelay = 33333; // frame rate: 30 fps |
|
44 |
|
45 class CGLCube; |
|
46 |
|
47 /** |
|
48 This class contains the egl content renderer. |
|
49 CEglContent is a wrapper for CGLCube and works in two modes: |
|
50 - Synchronous – when requested for a TsgDrawableId object CEglContent |
|
51 it returns it from CGLCube and the frame number is increased. |
|
52 Thus in the next request the next frame is obtained. |
|
53 Nothing is rendered until the new request occurs. |
|
54 - Asynchronous – in this mode CEglContent forces GLCube to render |
|
55 frames at 30 fps frequency. On the request last rendered a frame is returned |
|
56 and generation is continued in the background. |
|
57 - Asynchronous debug - start rendering the next frame (only one) immediately |
|
58 */ |
|
59 class CEglContent : public CTimer |
|
60 { |
|
61 public: |
|
62 /** Available rendering modes */ |
|
63 enum TMode |
|
64 { |
|
65 ESync, // Rendering is synchronised with client |
|
66 EAsync, // Rendering is asynchronous with fixed rate |
|
67 EAsyncDebug // Rendering is debug asynchronous with fixed rate |
|
68 }; |
|
69 public: |
|
70 static CEglContent* NewL(); |
|
71 static CEglContent* NewLC(); |
|
72 virtual ~CEglContent(); |
|
73 |
|
74 void SetMode(TMode aMode); |
|
75 TInt GetImage(TSgDrawableId& aId); |
|
76 |
|
77 private: |
|
78 CEglContent(); |
|
79 void ConstructL(); |
|
80 void RenderNextFrame(); |
|
81 |
|
82 private: // from CTimer |
|
83 void RunL(); |
|
84 |
|
85 private: |
|
86 CGLCube* iCube; |
|
87 /** Rendering mode (sync or async) */ |
|
88 TMode iMode; |
|
89 /** Frame number to be rendered */ |
|
90 TInt iFrame; |
|
91 /** Last rendered frame number */ |
|
92 TInt iLastFrame; |
|
93 }; |
|
94 |
|
95 /** |
|
96 This class contains egl content server. |
|
97 Implements server and manages CEglContent object. |
|
98 */ |
|
99 class CEglContentServer : public CServer2 |
|
100 { |
|
101 public: |
|
102 static CServer2* NewLC(); |
|
103 void AddSession(); |
|
104 void DropSession(); |
|
105 void GetSyncImage(TSgDrawableId& aId); |
|
106 TInt GetAsyncImage(TSgDrawableId& aId); |
|
107 TInt GetAsyncImageDebug(TSgDrawableId& aId); |
|
108 private: |
|
109 CEglContentServer(); |
|
110 ~CEglContentServer(); |
|
111 void ConstructL(); |
|
112 CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const; |
|
113 private: |
|
114 TInt iSessionCount; |
|
115 CEglContent* iContent; |
|
116 }; |
|
117 |
|
118 /** |
|
119 This class contains server side of egl content server session. |
|
120 */ |
|
121 class CEglContentSession : public CSession2 |
|
122 { |
|
123 public: |
|
124 CEglContentSession(); |
|
125 void Create(); |
|
126 private: |
|
127 ~CEglContentSession(); |
|
128 CEglContentServer& Server(); |
|
129 void ServiceL(const RMessage2& aMessage); |
|
130 void ServiceError(const RMessage2& aMessage, TInt aError); |
|
131 }; |
|
132 |
|
133 #endif |