120 iPowerUpDfc.Enque(); |
123 iPowerUpDfc.Enque(); |
121 } |
124 } |
122 |
125 |
123 void DLcdPowerHandler::PowerUpLcd(TBool aSecure) |
126 void DLcdPowerHandler::PowerUpLcd(TBool aSecure) |
124 { |
127 { |
125 #if 1 |
128 |
126 WriteReg(iPortAddr, FB_ENABLED, 0); |
129 WriteReg(iPortAddr, FB_ENABLED, 0); |
127 WriteReg(iPortAddr, FB_BASE, aSecure ? iSecurevRamPhys : ivRamPhys); |
130 WriteReg(iPortAddr, FB_BASE, aSecure ? iSecurevRamPhys : ivRamPhys); |
128 WriteReg(iPortAddr, FB_WIDTH, iVideoInfo.iSizeInPixels.iWidth); |
131 |
129 WriteReg(iPortAddr, FB_BLANK, 0); |
132 WriteReg(iPortAddr, FB_BLANK, 0); |
130 WriteReg(iPortAddr, FB_BPP, 32); |
133 WriteReg(iPortAddr, FB_BPP, 32); |
131 WriteReg(iPortAddr, FB_COLOR_ORDER, 0); |
134 WriteReg(iPortAddr, FB_COLOR_ORDER, 0); |
132 WriteReg(iPortAddr, FB_BYTE_ORDER, 0); |
135 WriteReg(iPortAddr, FB_BYTE_ORDER, 0); |
133 WriteReg(iPortAddr, FB_PIXEL_ORDER, 0); |
136 WriteReg(iPortAddr, FB_PIXEL_ORDER, 0); |
134 WriteReg(iPortAddr, FB_INT_MASK, 0); |
137 WriteReg(iPortAddr, FB_INT_MASK, 0); |
135 WriteReg(iPortAddr, FB_ENABLED, 1); |
138 WriteReg(iPortAddr, FB_ENABLED, 1); |
136 WriteReg(iPortAddr, FB_HEIGHT, iVideoInfo.iSizeInPixels.iHeight); |
139 |
137 #endif |
140 // We don't write the Height and Width of the framebuffer, this is controlled by the board model |
|
141 |
138 } |
142 } |
139 |
143 |
140 void DLcdPowerHandler::PowerDownLcd() |
144 void DLcdPowerHandler::PowerDownLcd() |
141 { |
145 { |
142 WriteReg(iPortAddr, FB_BLANK, 1); |
146 WriteReg(iPortAddr, FB_BLANK, 1); |
205 |
209 |
206 if(aMode != aInfo.iDisplayMode) |
210 if(aMode != aInfo.iDisplayMode) |
207 { |
211 { |
208 aInfo.iOffsetToFirstPixel = KCOnfigOffsetToFirstPixel; |
212 aInfo.iOffsetToFirstPixel = KCOnfigOffsetToFirstPixel; |
209 aInfo.iIsPalettized = KConfigIsPalettized; |
213 aInfo.iIsPalettized = KConfigIsPalettized; |
210 aInfo.iOffsetBetweenLines = KCOnfigOffsetBetweenLines; |
214 aInfo.iOffsetBetweenLines = iVideoInfo.iSizeInPixels.iWidth*4; //Offset depends on width of framebuffer |
211 aInfo.iBitsPerPixel = KConfigBitsPerPixel; |
215 aInfo.iBitsPerPixel = KConfigBitsPerPixel; |
212 } |
216 } |
213 return KErrNone; |
217 return KErrNone; |
214 } |
218 } |
215 |
219 |
216 TInt DLcdPowerHandler::AllocateFrameBuffer() |
220 TInt DLcdPowerHandler::AllocateFrameBuffer() |
217 { |
221 { |
218 // Allocate physical RAM for video |
222 // Allocate physical RAM for video |
219 TInt vSize = TSyborg::VideoRamSize(); |
223 |
|
224 //read width and height of display from board model and allocate size |
|
225 TInt width = ReadReg(iPortAddr, FB_WIDTH); |
|
226 TInt height = ReadReg(iPortAddr, FB_HEIGHT); |
|
227 |
|
228 iSize = 4*width*height; //*4 as 32bits per pixel |
220 |
229 |
221 NKern::ThreadEnterCS(); |
230 NKern::ThreadEnterCS(); |
222 TInt r = Epoc::AllocPhysicalRam(vSize,Syborg::VideoRamPhys); |
231 TInt r = Epoc::AllocPhysicalRam(iSize,Syborg::VideoRamPhys); |
223 if (r != KErrNone) |
232 if (r != KErrNone) |
224 { |
233 { |
225 NKern::ThreadLeaveCS(); |
234 NKern::ThreadLeaveCS(); |
226 Kern::Fault("AllocVideoRam",r); |
235 Kern::Fault("AllocVideoRam",r); |
227 } |
236 } |
228 |
237 |
229 // Map the video RAM |
238 // Map the video RAM |
230 ivRamPhys = TSyborg::VideoRamPhys(); |
239 ivRamPhys = TSyborg::VideoRamPhys(); |
231 |
240 |
232 r = DPlatChunkHw::New(iChunk,ivRamPhys,vSize,EMapAttrUserRw|EMapAttrBufferedC); |
241 r = DPlatChunkHw::New(iChunk,ivRamPhys,iSize,EMapAttrUserRw|EMapAttrBufferedC); |
233 |
242 |
234 NKern::ThreadLeaveCS(); |
243 NKern::ThreadLeaveCS(); |
235 |
244 |
236 if(r != KErrNone) |
245 if(r != KErrNone) |
237 return r; |
246 return r; |
238 |
247 |
239 TUint* pV = (TUint*)iChunk->LinearAddress(); |
248 TUint* pV = (TUint*)iChunk->LinearAddress(); |
240 |
249 |
241 // Allocate physical RAM for secure display |
250 // Allocate physical RAM for secure display |
242 NKern::ThreadEnterCS(); |
251 NKern::ThreadEnterCS(); |
243 r = Epoc::AllocPhysicalRam(vSize,Syborg::VideoRamPhysSecure); |
252 r = Epoc::AllocPhysicalRam(iSize,Syborg::VideoRamPhysSecure); |
244 if (r != KErrNone) |
253 if (r != KErrNone) |
245 { |
254 { |
246 NKern::ThreadLeaveCS(); |
255 NKern::ThreadLeaveCS(); |
247 Kern::Fault("AllocVideoRam 2",r); |
256 Kern::Fault("AllocVideoRam 2",r); |
248 } |
257 } |
249 iSecurevRamPhys = ivRamPhys + vSize; |
258 iSecurevRamPhys = ivRamPhys + iSize; |
250 TInt r2 = DPlatChunkHw::New(iSecureChunk,iSecurevRamPhys,vSize,EMapAttrUserRw|EMapAttrBufferedC); |
259 TInt r2 = DPlatChunkHw::New(iSecureChunk,iSecurevRamPhys,iSize,EMapAttrUserRw|EMapAttrBufferedC); |
251 |
260 |
252 NKern::ThreadLeaveCS(); |
261 NKern::ThreadLeaveCS(); |
253 |
262 |
254 if(r2 != KErrNone) |
263 if(r2 != KErrNone) |
255 return r2; |
264 return r2; |
256 |
265 |
257 TUint* pV2 = (TUint*)iSecureChunk->LinearAddress(); |
266 TUint* pV2 = (TUint*)iSecureChunk->LinearAddress(); |
258 |
267 |
259 iVideoInfo.iSizeInPixels.iWidth = KConfigLcdWidth; |
268 //width and height set by reading board model |
260 iVideoInfo.iSizeInPixels.iHeight = KConfigLcdHeight; |
269 iVideoInfo.iSizeInPixels.iWidth = width; |
|
270 iVideoInfo.iSizeInPixels.iHeight = height; |
|
271 |
|
272 //offset between lines depends on width of screen |
|
273 iVideoInfo.iOffsetBetweenLines = width*4; |
|
274 |
261 iVideoInfo.iDisplayMode = KConfigLcdDisplayMode; |
275 iVideoInfo.iDisplayMode = KConfigLcdDisplayMode; |
262 iVideoInfo.iOffsetToFirstPixel = KCOnfigOffsetToFirstPixel; |
276 iVideoInfo.iOffsetToFirstPixel = KConfigOffsetToFirstPixel; |
263 iVideoInfo.iOffsetBetweenLines = KCOnfigOffsetBetweenLines; |
277 |
264 iVideoInfo.iIsPalettized = KConfigIsPalettized; |
278 iVideoInfo.iIsPalettized = KConfigIsPalettized; |
265 iVideoInfo.iBitsPerPixel = KConfigBitsPerPixel; |
279 iVideoInfo.iBitsPerPixel = KConfigBitsPerPixel; |
266 iVideoInfo.iSizeInTwips.iWidth = KConfigLcdWidthInTwips; |
280 iVideoInfo.iSizeInTwips.iWidth = KConfigLcdWidthInTwips; |
267 iVideoInfo.iSizeInTwips.iHeight = KConfigLcdHeightInTwips; |
281 iVideoInfo.iSizeInTwips.iHeight = KConfigLcdHeightInTwips; |
268 iVideoInfo.iIsMono = KConfigIsMono; |
282 iVideoInfo.iIsMono = KConfigIsMono; |
271 iVideoInfo.iIsPixelOrderRGB = KConfigPixelOrderRGB; |
285 iVideoInfo.iIsPixelOrderRGB = KConfigPixelOrderRGB; |
272 |
286 |
273 iSecureVideoInfo = iVideoInfo; |
287 iSecureVideoInfo = iVideoInfo; |
274 iSecureVideoInfo.iVideoAddress = (TInt)pV2; |
288 iSecureVideoInfo.iVideoAddress = (TInt)pV2; |
275 |
289 |
276 // Alloc Physical RAM for the Composition Buffers used by the GCE |
290 // Alloc Physical RAM for the Composition Buffers used by OpenWF |
277 iSize = 4*480*640;//FRAME_BUFFER_SIZE( iVideoInfo.iBitsPerPixel, iVideoInfo.iSizeInPixels.iWidth, iVideoInfo.iSizeInPixels.iHeight); |
|
278 __GCE_DEBUG_PRINT2("DLcdPowerHandler.iSize = %d\n", iSize ); |
|
279 // double and round the page size |
291 // double and round the page size |
280 TUint round = 2*Kern::RoundToPageSize(iSize); |
292 TUint round = 2*Kern::RoundToPageSize(iSize); |
281 |
293 |
282 r=Epoc::AllocPhysicalRam(round , iCompositionPhysical); |
294 r=Epoc::AllocPhysicalRam(round , iCompositionPhysical); |
283 if(r!=KErrNone) |
295 if(r!=KErrNone) |
431 { |
443 { |
432 __KTRACE_OPT(KEXTENSION ,Kern::Printf("DLcdPowerHandler::Create") ); |
444 __KTRACE_OPT(KEXTENSION ,Kern::Printf("DLcdPowerHandler::Create") ); |
433 pLcd = this; |
445 pLcd = this; |
434 |
446 |
435 iPortAddr = KHwBaseClcd; |
447 iPortAddr = KHwBaseClcd; |
436 |
|
437 iVideoInfo.iSizeInPixels.iWidth = KConfigLcdWidth; |
|
438 iVideoInfo.iSizeInPixels.iHeight = KConfigLcdHeight; |
|
439 iVideoInfo.iDisplayMode = KConfigLcdDisplayMode; |
|
440 iVideoInfo.iOffsetToFirstPixel = KCOnfigOffsetToFirstPixel; |
|
441 iVideoInfo.iOffsetBetweenLines = KCOnfigOffsetBetweenLines; |
|
442 iVideoInfo.iIsPalettized = KConfigIsPalettized; |
|
443 iVideoInfo.iBitsPerPixel = KConfigBitsPerPixel; |
|
444 iVideoInfo.iSizeInTwips.iWidth = KConfigLcdWidthInTwips; |
|
445 iVideoInfo.iSizeInTwips.iHeight = KConfigLcdHeightInTwips; |
|
446 iVideoInfo.iIsMono = KConfigIsMono; |
|
447 // !@! iVideoInfo.iVideoAddress = (TInt)pV; |
|
448 iVideoInfo.iIsPixelOrderLandscape = KConfigPixelOrderLandscape; |
|
449 iVideoInfo.iIsPixelOrderRGB = KConfigPixelOrderRGB; |
|
450 |
|
451 iSecureVideoInfo = iVideoInfo; |
|
452 // !@! iSecureVideoInfo.iVideoAddress = (TInt)pV2; |
|
453 |
448 |
454 TInt r = AllocateFrameBuffer(); |
449 TInt r = AllocateFrameBuffer(); |
455 if(r == KErrNone) |
450 if(r == KErrNone) |
456 { |
451 { |
457 r = Kern::AddHalEntry(EHalGroupDisplay,DoHalFunction,this); |
452 r = Kern::AddHalEntry(EHalGroupDisplay,DoHalFunction,this); |
911 |
906 |
912 |
907 |
913 //If no buffer was available during a call to GetCompositionBuffer the active buffer has |
908 //If no buffer was available during a call to GetCompositionBuffer the active buffer has |
914 //been returned as the next available one, so we must set the buffer to the proper state before we |
909 //been returned as the next available one, so we must set the buffer to the proper state before we |
915 //send the notification. |
910 //send the notification. |
916 if(channel->iLdd->iPendingReq[RDisplayChannel::EReqGetCompositionBuffer].iStatus) |
911 TInt pendingIndex = channel->iLdd->iPendingIndex[RDisplayChannel::EReqGetCompositionBuffer]; |
|
912 if(channel->iLdd->iPendingReq[RDisplayChannel::EReqGetCompositionBuffer][pendingIndex].iTClientReq) |
|
913 { |
|
914 if(channel->iLdd->iPendingReq[RDisplayChannel::EReqGetCompositionBuffer][pendingIndex].iTClientReq->IsReady()) |
917 { |
915 { |
918 channel->iActiveBuffer->iState = EBufferCompose; |
916 channel->iActiveBuffer->iState = EBufferCompose; |
919 channel->RequestComplete(RDisplayChannel::EReqGetCompositionBuffer, KErrNone); |
917 channel->RequestComplete(RDisplayChannel::EReqGetCompositionBuffer,KErrNone); |
920 |
|
921 } |
918 } |
|
919 |
|
920 } |
922 |
921 |
923 channel->iActiveBuffer = NULL; |
922 channel->iActiveBuffer = NULL; |
924 } |
923 } |
925 |
924 |
926 if (channel->iPendingBuffer) |
925 if (channel->iPendingBuffer) |