author | Shimizu Satoshi <s_shimizu@isb.co.jp> |
Mon, 18 Oct 2010 19:39:25 +0900 | |
changeset 124 | 606eafc6d6a8 |
parent 46 | b6935a90ca64 |
permissions | -rw-r--r-- |
38 | 1 |
/* |
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
46
b6935a90ca64
Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
38
diff
changeset
|
14 |
* Accenture Ltd - Syborg framebuffer improvements, now auto determines frame size from board model, performance and memory improvements |
b6935a90ca64
Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
38
diff
changeset
|
15 |
* |
38 | 16 |
* Description: Minimalistic frame buffer driver |
17 |
* |
|
18 |
*/ |
|
19 |
||
20 |
#ifndef _SVPFRAMEBUFFER_H |
|
21 |
#define _SVPFRAMEBUFFER_H |
|
22 |
||
23 |
#include <display.h> |
|
24 |
||
25 |
#include <videodriver.h> |
|
26 |
#include <system.h> |
|
27 |
||
28 |
#define __SVPFRAMEBUFFER_DEBUG |
|
29 |
||
30 |
#ifdef __SVPFRAMEBUFFER_DEBUG |
|
31 |
||
32 |
#define __GCE_DEBUG_PRINT(a) Kern::Printf(a) |
|
33 |
#define __GCE_DEBUG_PRINT2(a,b) Kern::Printf(a,b) |
|
34 |
||
35 |
#else |
|
36 |
||
37 |
#define __GCE_DEBUG_PRINT(a) |
|
38 |
#define __GCE_DEBUG_PRINT2(a,b) |
|
39 |
||
40 |
#endif |
|
41 |
||
42 |
// Macro to calculate the screen buffer size |
|
43 |
// aBpp is the number of bits-per-pixel, aPpl is the number of pixels per line and aLpp number of lines per panel |
|
44 |
#define FRAME_BUFFER_SIZE(aBpp,aPpl,aLpp) ((aBpp/8)*aPpl*aLpp) |
|
45 |
||
46 |
_LIT(KLitLcd,"SYBORG_FB"); |
|
47 |
||
46
b6935a90ca64
Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
38
diff
changeset
|
48 |
|
b6935a90ca64
Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
38
diff
changeset
|
49 |
const TInt KConfigLcdWidthInTwips = 1996; |
b6935a90ca64
Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
38
diff
changeset
|
50 |
const TInt KConfigLcdHeightInTwips = 3550; |
b6935a90ca64
Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
38
diff
changeset
|
51 |
|
38 | 52 |
const TBool KConfigIsMono = 0; |
53 |
const TBool KConfigIsPalettized = 0; |
|
54 |
const TInt KCOnfigOffsetToFirstPixel = 0; |
|
55 |
const TBool KConfigPixelOrderRGB = 0; |
|
56 |
const TBool KConfigPixelOrderLandscape = 1; |
|
57 |
const TInt KConfigLcdDisplayMode = 2; |
|
46
b6935a90ca64
Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
38
diff
changeset
|
58 |
|
b6935a90ca64
Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
38
diff
changeset
|
59 |
const TInt KConfigOffsetToFirstPixel =0; |
b6935a90ca64
Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
38
diff
changeset
|
60 |
|
38 | 61 |
const TInt KConfigLcdNumberOfDisplayModes = 3; |
62 |
||
63 |
||
46
b6935a90ca64
Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
38
diff
changeset
|
64 |
const TInt KConfigBitsPerPixel = 32; |
b6935a90ca64
Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
38
diff
changeset
|
65 |
|
38 | 66 |
|
67 |
const TInt KVSyncDfcPriority = 7 ; //priority of DFC within the queue (0 to 7, where 7 is highest) |
|
68 |
||
69 |
/********************************************************************/ |
|
70 |
/* Class Definition */ |
|
71 |
/********************************************************************/ |
|
72 |
/** |
|
73 |
* This class defines a callback mechanism that is used by a resource user to specify its callback. It contains a |
|
74 |
* function pointer and data pointer. The function pointer specifies the user callback function to be invoked by the |
|
75 |
* resource while the data pointer specifies the data to be passed to the callback function. |
|
76 |
*/ |
|
77 |
class TLcdUserCallBack |
|
78 |
{ |
|
79 |
public: |
|
80 |
// The constructor for the callback mechanism. |
|
81 |
TLcdUserCallBack(TInt (*aFunction)(TUint aResID, TAny* aPtr), TAny* aPtr) |
|
82 |
||
83 |
{ |
|
84 |
iCbFn = aFunction; |
|
85 |
iDataPtr = aPtr; |
|
86 |
} |
|
87 |
||
88 |
public: |
|
89 |
// The callback function pointer. |
|
90 |
TInt (*iCbFn)(TUint aResID, TAny* aPtr); |
|
91 |
||
92 |
// Pointer to the data structure to be passed to the callback function. |
|
93 |
TAny *iDataPtr; |
|
94 |
}; |
|
95 |
||
96 |
class DLcdPowerHandler : public DPowerHandler |
|
97 |
{ |
|
98 |
public: // from DPowerHandler |
|
99 |
void PowerDown(TPowerState); |
|
100 |
void PowerUp(); |
|
101 |
public: // to prevent a race condition with WServer trying to power up/down at the same time |
|
102 |
void PowerUpDfc(); |
|
103 |
void PowerDownDfc(); |
|
104 |
public: |
|
105 |
DLcdPowerHandler(); |
|
106 |
TInt Create(); |
|
107 |
void DisplayOn(); |
|
108 |
void DisplayOff(); |
|
109 |
TInt HalFunction(TInt aFunction, TAny* a1, TAny* a2); |
|
110 |
||
111 |
void PowerUpLcd(TBool aSecure); |
|
112 |
void PowerDownLcd(); |
|
113 |
||
114 |
void ScreenInfo(TScreenInfoV01& aInfo); |
|
115 |
void WsSwitchOnScreen(); |
|
116 |
void WsSwitchOffScreen(); |
|
117 |
void HandleMsg(TMessageBase* aMsg); |
|
118 |
void SwitchDisplay(TBool aSecure); |
|
119 |
||
120 |
private: |
|
121 |
TInt GetCurrentDisplayModeInfo(TVideoInfoV01& aInfo, TBool aSecure); |
|
122 |
TInt GetSpecifiedDisplayModeInfo(TInt aMode, TVideoInfoV01& aInfo); |
|
123 |
TInt SetDisplayMode(TInt aMode); |
|
124 |
TInt AllocateFrameBuffer(); |
|
125 |
||
126 |
public: |
|
127 |
IMPORT_C static TInt RegisterCallback(TLcdUserCallBack* aCbPtr); |
|
128 |
IMPORT_C static void DeRegisterCallback(TLcdUserCallBack* aCbPtr); |
|
129 |
||
130 |
private: |
|
131 |
TBool iDisplayOn; |
|
132 |
DPlatChunkHw* iChunk; |
|
133 |
DPlatChunkHw* iSecureChunk; |
|
134 |
TBool iWsSwitchOnScreen; |
|
135 |
TBool iSecureDisplay; |
|
136 |
||
137 |
public: |
|
138 |
TDfcQue* iDfcQ; |
|
139 |
TMessageQue iMsgQ; // to prevent a race condition with Power Manager trying to power up/down at the same time |
|
140 |
TDfc iPowerUpDfc; |
|
141 |
TDfc iPowerDownDfc; |
|
142 |
||
143 |
private: |
|
144 |
NFastMutex iLock; |
|
145 |
TPhysAddr ivRamPhys; |
|
146 |
TPhysAddr iSecurevRamPhys; |
|
147 |
TLcdUserCallBack * iAppCallBk[2]; |
|
148 |
||
149 |
public: |
|
150 |
TVideoInfoV01 iVideoInfo; |
|
151 |
TVideoInfoV01 iSecureVideoInfo; |
|
152 |
TInt iSize; |
|
153 |
TLinAddr iPortAddr; |
|
154 |
TPhysAddr iCompositionPhysical; |
|
155 |
static DLcdPowerHandler * pLcd; |
|
156 |
||
157 |
enum { |
|
158 |
FB_ID = 0, |
|
159 |
FB_BASE = 1, |
|
160 |
FB_HEIGHT = 2, |
|
161 |
FB_WIDTH = 3, |
|
162 |
FB_ORIENTATION = 4, |
|
163 |
FB_BLANK = 5, |
|
164 |
FB_INT_MASK = 6, |
|
165 |
/* begin new interface */ |
|
166 |
FB_INTERRUPT_CAUSE = 7, |
|
167 |
FB_BPP = 8, |
|
168 |
FB_COLOR_ORDER = 9, |
|
169 |
FB_BYTE_ORDER = 10, |
|
170 |
FB_PIXEL_ORDER = 11, |
|
171 |
FB_ROW_PITCH = 12, |
|
172 |
FB_ENABLED = 13, |
|
173 |
FB_PALETTE_START = 0x400 >> 2, |
|
174 |
FB_PALETTE_END = FB_PALETTE_START+256-1, |
|
175 |
/* end new interface */ |
|
176 |
}; |
|
177 |
||
178 |
#define FB_INT_VSYNC (1U << 0) |
|
179 |
#define FB_INT_BASE_UPDATE_DONE (1U << 1) |
|
180 |
||
181 |
}; |
|
182 |
||
183 |
class DDisplayPddSyborg : public DDisplayPdd |
|
184 |
{ |
|
185 |
||
186 |
public: |
|
187 |
DDisplayPddSyborg(); |
|
188 |
~DDisplayPddSyborg(); |
|
189 |
||
190 |
/** |
|
191 |
Called by the LDD to handle the device specific part of switching to Legacy mode. |
|
192 |
||
193 |
@return KErrNone if successful; or one of the other system wide error codes. |
|
194 |
*/ |
|
195 |
virtual TInt SetLegacyMode(); |
|
196 |
||
197 |
/** |
|
198 |
Called by the LDD to handle the device specific part of switching to GCE mode. |
|
199 |
||
200 |
@return KErrNone if successful; or one of the other system wide error codes. |
|
201 |
*/ |
|
202 |
virtual TInt SetGceMode(); |
|
203 |
||
204 |
/** |
|
205 |
Called by the LDD to handle the device specific part of setting the rotation. |
|
206 |
||
207 |
@return KErrNone if successful; or one of the other system wide error codes. |
|
208 |
*/ |
|
46
b6935a90ca64
Modify framebuffer and NGA framebuffer to read screen size from board model dtb file. Optimise memory usuage of frame buffer
johnathan.white@2718R8BGH51.accenture.com
parents:
38
diff
changeset
|
209 |
virtual TInt SetRotation(RDisplayChannel::TDisplayRotation aRotation); |
38 | 210 |
|
211 |
/** |
|
212 |
Called by the LDD to handle the device specific part of posting a User Buffer. |
|
213 |
||
214 |
@return KErrNone if successful; or one of the other system wide error codes. |
|
215 |
*/ |
|
216 |
virtual TInt PostUserBuffer(TBufferNode* aNode); |
|
217 |
||
218 |
/** |
|
219 |
Called by the LDD to handle the device specific part of posting a Composition Buffer |
|
220 |
||
221 |
@return KErrNone if successful; or one of the other system wide error codes. |
|
222 |
*/ |
|
223 |
virtual TInt PostCompositionBuffer(TBufferNode* aNode); |
|
224 |
||
225 |
/** |
|
226 |
Called by the LDD to handle the device specific part of posting the Legacy Buffuer |
|
227 |
||
228 |
@return KErrNone if successful; or one of the other system wide error codes. |
|
229 |
*/ |
|
230 |
virtual TInt PostLegacyBuffer(); |
|
231 |
||
232 |
/** |
|
233 |
Called by the LDD to handle device specific cleanup operations when a channel is closed. |
|
234 |
||
235 |
@return KErrNone if successful; or one of the other system wide error codes. |
|
236 |
*/ |
|
237 |
virtual TInt CloseMsg(); |
|
238 |
||
239 |
/** |
|
240 |
Called by the LDD to handle device specific initialisation tasks when a channel is opened. |
|
241 |
||
242 |
@param aUnit The screen/hardware unit number. |
|
243 |
@return KErrNone if successful; or one of the other system wide error codes. |
|
244 |
*/ |
|
245 |
virtual TInt CreateChannelSetup(TInt aUnit); |
|
246 |
||
247 |
/** |
|
248 |
Called by the LDD in order to detect whether a post operation is pending. This type of |
|
249 |
information is specific to the actual physical device. |
|
250 |
||
251 |
@return ETrue if a Post operation is pending otherwise EFalse. |
|
252 |
*/ |
|
253 |
virtual TBool PostPending(); |
|
254 |
||
255 |
/** |
|
256 |
Called by the LDD to retrieve the DFC Queue created in the PDD. |
|
257 |
||
258 |
@param aUnit The screen/hardware unit number. |
|
259 |
@return A pointer to the TDfcQue object created in the PDD. |
|
260 |
*/ |
|
261 |
virtual TDfcQue* DfcQ(TInt aUnit); |
|
262 |
||
263 |
public: |
|
264 |
static void VSyncDfcFn(TAny* aChannel); |
|
265 |
||
266 |
private: |
|
267 |
TDfcQue* iDfcQ; |
|
268 |
||
269 |
//generic display info |
|
270 |
TVideoInfoV01 iScreenInfo; |
|
271 |
||
272 |
//Pointer to a buffer in the Pending state |
|
273 |
TBufferNode* iPendingBuffer; |
|
274 |
||
275 |
//Pointer to a buffer in the Active state |
|
276 |
TBufferNode* iActiveBuffer; |
|
277 |
||
278 |
DChunk * iChunk; |
|
279 |
TLcdUserCallBack* iLcdCallback; |
|
280 |
||
281 |
public: |
|
282 |
TDfc iVSyncDfc; |
|
283 |
}; |
|
284 |
||
285 |
||
286 |
/** |
|
287 |
PDD Factory class |
|
288 |
*/ |
|
289 |
||
290 |
class DDisplayPddFactory : public DPhysicalDevice |
|
291 |
{ |
|
292 |
public: |
|
293 |
DDisplayPddFactory(); |
|
294 |
||
295 |
virtual TInt Install(); |
|
296 |
virtual void GetCaps(TDes8& aDes) const; |
|
297 |
virtual TInt Create(DBase*& aChannel, TInt aUnit, const TDesC8* aInfo, const TVersion& aVer); |
|
298 |
virtual TInt Validate(TInt aDeviceType, const TDesC8* anInfo, const TVersion& aVer); |
|
299 |
}; |
|
300 |
||
301 |
#endif |