baseport/syborg/svpframebuffer/svpframebuffer.cpp
author andy simpson <andrews@symbian.org>
Fri, 08 Oct 2010 16:52:59 +0100
changeset 119 931f2bbaabf7
parent 46 b6935a90ca64
permissions -rw-r--r--
work-a-round for Bug 3645 change ARGB->XRGB pixel format
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
38
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
     1
/*
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
     3
* All rights reserved.
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
     4
* This component and the accompanying materials are made available
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
     6
* which accompanies this distribution, and is available
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
     8
*
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
     9
* Initial Contributors:
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    11
*
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    12
* Contributors:
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    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
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    16
* Description: Minimalistic frame buffer driver
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    17
*
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    18
*/
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    19
#include <videodriver.h>
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    20
#include "platform.h"
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    21
#include <nkern.h>
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    22
#include <kernel/kernel.h>
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    23
#include <kernel/kern_priv.h>
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    24
#include <kernel/kpower.h>
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    25
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    26
#include <syborg_priv.h>
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    27
#include "svpframebuffer.h"
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    28
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    29
DLcdPowerHandler	*  DLcdPowerHandler::pLcd			= NULL;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    30
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    31
TPhysAddr Syborg::VideoRamPhys;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    32
TPhysAddr Syborg::VideoRamPhysSecure;		// Secure display memory
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    33
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    34
TPhysAddr TSyborg::VideoRamPhys()
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    35
{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    36
  __KTRACE_OPT(KEXTENSION,Kern::Printf("TSyborg::VideoRamPhys: VideoRamPhys=0x%x", Syborg::VideoRamPhys));
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    37
  return Syborg::VideoRamPhys;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    38
}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    39
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    40
TPhysAddr TSyborg::VideoRamPhysSecure()
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    41
{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    42
  return Syborg::VideoRamPhysSecure;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    43
}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    44
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    45
LOCAL_C TInt DoHalFunction(TAny* aPtr, TInt aFunction, TAny* a1, TAny* a2)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    46
{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    47
  DLcdPowerHandler* pH=(DLcdPowerHandler*)aPtr;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    48
  return pH->HalFunction(aFunction,a1,a2);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    49
}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    50
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    51
static void rxMsg(TAny* aPtr)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    52
{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    53
  DLcdPowerHandler& h=*(DLcdPowerHandler*)aPtr;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    54
  TMessageBase* pM = h.iMsgQ.iMessage;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    55
  if(pM)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    56
	h.HandleMsg(pM);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    57
}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    58
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    59
static void power_up_dfc(TAny* aPtr)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    60
{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    61
  ((DLcdPowerHandler*)aPtr)->PowerUpDfc();
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    62
}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    63
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    64
void power_down_dfc(TAny* aPtr)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    65
{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    66
  ((DLcdPowerHandler*)aPtr)->PowerDownDfc();
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    67
}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    68
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    69
void DLcdPowerHandler::DisplayOn()
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    70
{ 
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    71
  PowerUpLcd(iSecureDisplay);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    72
  iDisplayOn = ETrue;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    73
}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    74
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    75
void DLcdPowerHandler::DisplayOff()
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    76
{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    77
  PowerDownLcd();
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    78
  iDisplayOn = EFalse;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    79
}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    80
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    81
void DLcdPowerHandler::SwitchDisplay(TBool aSecure)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    82
 {
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    83
   if(aSecure)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    84
	 {
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    85
	   if(!iSecureDisplay)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    86
		 {
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    87
		   DisplayOff();
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    88
		   iSecureDisplay = ETrue;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    89
		   DisplayOn();
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    90
		 }
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    91
	 }
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    92
   else
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    93
	 {
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    94
	   if(iSecureDisplay)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    95
		 {
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    96
		   DisplayOff();
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    97
		   iSecureDisplay = EFalse;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    98
		   DisplayOn();
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
    99
		 }
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   100
	 }
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   101
 }
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   102
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   103
void DLcdPowerHandler::PowerUpDfc()
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   104
{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   105
  DisplayOn();
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   106
  PowerUpDone();
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   107
}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   108
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   109
void DLcdPowerHandler::PowerDownDfc()
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   110
{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   111
  DisplayOff();
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
   112
38
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   113
  PowerDownDone();
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   114
}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   115
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   116
void DLcdPowerHandler::PowerDown(TPowerState)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   117
{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   118
  iPowerDownDfc.Enque();
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   119
}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   120
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   121
void DLcdPowerHandler::PowerUp()
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   122
{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   123
  iPowerUpDfc.Enque();
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   124
}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   125
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   126
void DLcdPowerHandler::PowerUpLcd(TBool aSecure)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   127
{
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
   128
38
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   129
  WriteReg(iPortAddr, FB_ENABLED, 0);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   130
  WriteReg(iPortAddr, FB_BASE, aSecure ? iSecurevRamPhys : ivRamPhys);
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
   131
38
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   132
  WriteReg(iPortAddr, FB_BLANK, 0);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   133
  WriteReg(iPortAddr, FB_BPP, 32);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   134
  WriteReg(iPortAddr, FB_COLOR_ORDER, 0);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   135
  WriteReg(iPortAddr, FB_BYTE_ORDER, 0);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   136
  WriteReg(iPortAddr, FB_PIXEL_ORDER, 0);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   137
  WriteReg(iPortAddr, FB_INT_MASK, 0);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   138
  WriteReg(iPortAddr, FB_ENABLED, 1);
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
   139
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
   140
// We don't write the Height and Width of the framebuffer, this is controlled by the board model
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
   141
38
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   142
}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   143
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   144
void DLcdPowerHandler::PowerDownLcd()
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   145
{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   146
  WriteReg(iPortAddr, FB_BLANK, 1);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   147
}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   148
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   149
DLcdPowerHandler::DLcdPowerHandler()
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   150
	:	DPowerHandler(KLitLcd),
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   151
		iMsgQ(rxMsg,this,NULL,1),
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   152
		iPowerUpDfc(&power_up_dfc,this,6),
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   153
		iPowerDownDfc(&power_down_dfc,this,7)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   154
{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   155
}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   156
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   157
void DLcdPowerHandler::ScreenInfo(TScreenInfoV01& anInfo)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   158
{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   159
  anInfo.iWindowHandleValid = EFalse;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   160
  anInfo.iWindowHandle = NULL;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   161
  anInfo.iScreenAddressValid = ETrue;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   162
  anInfo.iScreenAddress = (TAny *)(iChunk->LinearAddress());
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   163
  anInfo.iScreenSize.iWidth = iVideoInfo.iSizeInPixels.iWidth;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   164
  anInfo.iScreenSize.iHeight = iVideoInfo.iSizeInPixels.iHeight;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   165
}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   166
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   167
void DLcdPowerHandler::HandleMsg(TMessageBase* aMsg)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   168
{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   169
  if(aMsg->iValue)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   170
	DisplayOn();
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   171
  else
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   172
	DisplayOff();
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   173
  aMsg->Complete(KErrNone,ETrue);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   174
}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   175
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   176
void DLcdPowerHandler::WsSwitchOnScreen()
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   177
{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   178
  TThreadMessage& m = Kern::Message();
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   179
  m.iValue = ETrue;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   180
  m.SendReceive(&iMsgQ);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   181
}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   182
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   183
void DLcdPowerHandler::WsSwitchOffScreen()
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   184
{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   185
  TThreadMessage& m = Kern::Message();
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   186
  m.iValue = EFalse;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   187
  m.SendReceive(&iMsgQ);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   188
}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   189
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   190
TInt DLcdPowerHandler::GetCurrentDisplayModeInfo(TVideoInfoV01& aInfo, TBool aSecure)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   191
{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   192
  NKern::FMWait(&iLock);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   193
  if(aSecure)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   194
	aInfo = iSecureVideoInfo;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   195
  else
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   196
	aInfo = iVideoInfo;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   197
  NKern::FMSignal(&iLock);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   198
  return KErrNone;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   199
}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   200
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   201
TInt DLcdPowerHandler::GetSpecifiedDisplayModeInfo(TInt aMode, TVideoInfoV01& aInfo)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   202
{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   203
  if(aMode < 0 || aMode >= KConfigLcdNumberOfDisplayModes)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   204
	return KErrArgument;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   205
  
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   206
  NKern::FMWait(&iLock);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   207
  aInfo = iVideoInfo;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   208
  NKern::FMSignal(&iLock);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   209
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   210
  if(aMode != aInfo.iDisplayMode)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   211
	{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   212
	  aInfo.iOffsetToFirstPixel = KCOnfigOffsetToFirstPixel;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   213
	  aInfo.iIsPalettized       = KConfigIsPalettized;
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
   214
	  aInfo.iOffsetBetweenLines = iVideoInfo.iSizeInPixels.iWidth*4; //Offset depends on width of framebuffer
38
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   215
	  aInfo.iBitsPerPixel       = KConfigBitsPerPixel;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   216
	}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   217
  return KErrNone;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   218
}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   219
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   220
TInt DLcdPowerHandler::AllocateFrameBuffer()
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   221
{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   222
	// Allocate physical RAM for video
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
   223
	
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
   224
	//read width and height of display from board model and allocate size
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
   225
	TInt width = ReadReg(iPortAddr, FB_WIDTH);
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
   226
	TInt height = ReadReg(iPortAddr, FB_HEIGHT);
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
   227
	
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
   228
	iSize = 4*width*height; //*4 as 32bits per pixel
38
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   229
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   230
	NKern::ThreadEnterCS();
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
   231
	TInt r = Epoc::AllocPhysicalRam(iSize,Syborg::VideoRamPhys);
38
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   232
	if (r != KErrNone)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   233
	{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   234
	        NKern::ThreadLeaveCS();
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   235
		Kern::Fault("AllocVideoRam",r);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   236
	}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   237
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   238
	// Map the video RAM
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   239
	ivRamPhys = TSyborg::VideoRamPhys();
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   240
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
   241
	r = DPlatChunkHw::New(iChunk,ivRamPhys,iSize,EMapAttrUserRw|EMapAttrBufferedC);
38
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   242
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   243
	NKern::ThreadLeaveCS();
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   244
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   245
	if(r != KErrNone)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   246
	  return r;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   247
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   248
	TUint* pV = (TUint*)iChunk->LinearAddress();
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   249
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   250
	// Allocate physical RAM for secure display
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   251
	NKern::ThreadEnterCS();
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
   252
	r = Epoc::AllocPhysicalRam(iSize,Syborg::VideoRamPhysSecure);
38
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   253
	if (r != KErrNone)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   254
	{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   255
	        NKern::ThreadLeaveCS();
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   256
		Kern::Fault("AllocVideoRam 2",r);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   257
	}
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
   258
	iSecurevRamPhys = ivRamPhys + iSize;
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
   259
	TInt r2 = DPlatChunkHw::New(iSecureChunk,iSecurevRamPhys,iSize,EMapAttrUserRw|EMapAttrBufferedC);
38
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   260
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   261
	NKern::ThreadLeaveCS();
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   262
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   263
	if(r2 != KErrNone)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   264
	  return r2;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   265
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   266
	TUint* pV2 = (TUint*)iSecureChunk->LinearAddress();
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   267
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
   268
	//width and height set by reading board model
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
   269
	iVideoInfo.iSizeInPixels.iWidth  = width;
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
   270
	iVideoInfo.iSizeInPixels.iHeight = height;
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
   271
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
   272
	//offset between lines depends on width of screen
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
   273
	iVideoInfo.iOffsetBetweenLines = width*4;
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
   274
38
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   275
	iVideoInfo.iDisplayMode = KConfigLcdDisplayMode;
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
   276
	iVideoInfo.iOffsetToFirstPixel = KConfigOffsetToFirstPixel;
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
   277
	
38
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   278
	iVideoInfo.iIsPalettized = KConfigIsPalettized;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   279
	iVideoInfo.iBitsPerPixel = KConfigBitsPerPixel;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   280
	iVideoInfo.iSizeInTwips.iWidth = KConfigLcdWidthInTwips;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   281
	iVideoInfo.iSizeInTwips.iHeight = KConfigLcdHeightInTwips;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   282
	iVideoInfo.iIsMono = KConfigIsMono;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   283
	iVideoInfo.iVideoAddress = (TInt)pV;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   284
	iVideoInfo.iIsPixelOrderLandscape = KConfigPixelOrderLandscape;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   285
	iVideoInfo.iIsPixelOrderRGB = KConfigPixelOrderRGB;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   286
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   287
	iSecureVideoInfo = iVideoInfo;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   288
	iSecureVideoInfo.iVideoAddress = (TInt)pV2;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   289
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
   290
	// Alloc Physical RAM for the Composition Buffers used by OpenWF
38
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   291
	// double and round the page size
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   292
	TUint round = 2*Kern::RoundToPageSize(iSize);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   293
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   294
	r=Epoc::AllocPhysicalRam(round , iCompositionPhysical);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   295
	if(r!=KErrNone)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   296
		{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   297
		return r;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   298
		}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   299
	
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   300
	return KErrNone;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   301
}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   302
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   303
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   304
TInt DLcdPowerHandler::SetDisplayMode(TInt aMode)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   305
{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   306
  if(aMode < 0 || aMode >= KConfigLcdNumberOfDisplayModes)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   307
	return KErrArgument;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   308
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   309
  // store the current mode
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   310
  iVideoInfo.iDisplayMode = aMode;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   311
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   312
  // store the current mode for secure screen
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   313
  iSecureVideoInfo.iDisplayMode = aMode;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   314
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   315
  return KErrNone;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   316
}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   317
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   318
TInt DLcdPowerHandler::HalFunction(TInt aFunction, TAny* a1, TAny* a2)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   319
{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   320
  TInt r=KErrNone;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   321
  switch(aFunction)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   322
	{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   323
	case EDisplayHalScreenInfo:
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   324
	  {
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   325
		TPckgBuf<TScreenInfoV01> vPckg;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   326
		ScreenInfo(vPckg());
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   327
		Kern::InfoCopy(*(TDes8*)a1,vPckg);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   328
		break;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   329
	  }
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   330
	case EDisplayHalWsRegisterSwitchOnScreenHandling:
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   331
	  {
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   332
		iWsSwitchOnScreen=(TBool)a1;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   333
		break;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   334
	  }
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   335
	case EDisplayHalWsSwitchOnScreen:
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   336
	  {
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   337
		WsSwitchOnScreen();
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   338
		break;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   339
	  }
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   340
	case EDisplayHalModeCount:
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   341
	  {
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   342
		TInt ndm = KConfigLcdNumberOfDisplayModes;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   343
		kumemput32(a1, &ndm, sizeof(ndm));
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   344
		break;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   345
	  }
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   346
	case EDisplayHalSetMode:
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   347
	  {
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   348
		__KTRACE_OPT(KEXTENSION,Kern::Printf("EDisplayHalSetMode"));
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   349
		__SECURE_KERNEL(
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   350
						if(!Kern::CurrentThreadHasCapability(ECapabilityMultimediaDD,__PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EDisplayHalSetMode")))
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   351
						return KErrPermissionDenied;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   352
						)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   353
		  r = SetDisplayMode((TInt)a1);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   354
		break;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   355
	  }
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   356
	case EDisplayHalMode:
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   357
	  {
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   358
		kumemput32(a1, &iVideoInfo.iDisplayMode, sizeof(iVideoInfo.iDisplayMode));
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   359
		r = KErrNone;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   360
		break;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   361
	  }
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   362
	case EDisplayHalSetPaletteEntry:
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   363
	  {
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   364
		__SECURE_KERNEL(
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   365
						if(!Kern::CurrentThreadHasCapability(ECapabilityMultimediaDD,__PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EDisplayHalSetPaletteEntry")))
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   366
						return KErrPermissionDenied;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   367
						)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   368
		  r = KErrNotSupported;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   369
		break;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   370
	  }
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   371
	case EDisplayHalPaletteEntry:
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   372
	  {
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   373
		TInt entry;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   374
		kumemget32(&entry, a1, sizeof(TInt));
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   375
		r = KErrNotSupported;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   376
		break;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   377
	  }
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   378
	case EDisplayHalSetState:
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   379
	  {
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   380
		__SECURE_KERNEL(
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   381
						if(!Kern::CurrentThreadHasCapability(ECapabilityPowerMgmt,__PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EDisplayHalSetState")))
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   382
						return KErrPermissionDenied;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   383
						)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   384
		  if((TBool)a1)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   385
			WsSwitchOnScreen();
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   386
		  else
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   387
			WsSwitchOffScreen();
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   388
		break;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   389
	  }
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   390
	case EDisplayHalState:
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   391
	  {
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   392
		kumemput32(a1, &iDisplayOn, sizeof(TBool));
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   393
		break;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   394
	  }
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   395
	case EDisplayHalColors:
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   396
	  {
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   397
		TInt mdc = 1<<24;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   398
		kumemput32(a1, &mdc, sizeof(mdc));
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   399
		break;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   400
	  }
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   401
	case EDisplayHalCurrentModeInfo:
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   402
	  {
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   403
		TPckgBuf<TVideoInfoV01> vPckg;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   404
		r = GetCurrentDisplayModeInfo(vPckg(), (TBool)a2);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   405
		if(KErrNone == r)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   406
		  Kern::InfoCopy(*(TDes8*)a1,vPckg);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   407
		break;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   408
	  }
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   409
	case EDisplayHalSpecifiedModeInfo:
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   410
	  {
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   411
		TPckgBuf<TVideoInfoV01> vPckg;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   412
		TInt mode;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   413
		kumemget32(&mode, a1, sizeof(mode));
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   414
		r = GetSpecifiedDisplayModeInfo(mode, vPckg());
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   415
		if(KErrNone == r)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   416
		  Kern::InfoCopy(*(TDes8*)a2,vPckg);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   417
		break;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   418
	  }	
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   419
	case EDisplayHalSecure:
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   420
	  {
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   421
		kumemput32(a1, &iSecureDisplay, sizeof(TBool));
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   422
		break;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   423
	  }
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   424
	case EDisplayHalSetSecure:
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   425
	  {
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   426
		__SECURE_KERNEL(
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   427
						if(!Kern::CurrentThreadHasCapability(ECapabilityMultimediaDD,__PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EDisplayHalSetSecure")))
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   428
						return KErrPermissionDenied;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   429
						)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   430
		  SwitchDisplay((TBool)a1);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   431
		break;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   432
	  }
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   433
	default:
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   434
	  {
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   435
		r = KErrNotSupported;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   436
		break;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   437
	  }			
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   438
	}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   439
  return r;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   440
}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   441
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   442
TInt DLcdPowerHandler::Create()
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   443
{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   444
	__KTRACE_OPT(KEXTENSION ,Kern::Printf("DLcdPowerHandler::Create") );
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   445
	pLcd			= this;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   446
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   447
	iPortAddr = KHwBaseClcd;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   448
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   449
	TInt r = AllocateFrameBuffer();
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   450
	if(r == KErrNone)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   451
		{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   452
		r = Kern::AddHalEntry(EHalGroupDisplay,DoHalFunction,this);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   453
		}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   454
	    
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   455
	if(r != KErrNone)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   456
		{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   457
		__KTRACE_OPT(KEXTENSION ,Kern::Printf("DLcdPowerHandler::Create failed %d", r) );
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   458
		return r;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   459
		}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   460
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   461
	iPowerUpDfc.SetDfcQ(iDfcQ);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   462
	iPowerDownDfc.SetDfcQ(iDfcQ);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   463
	iMsgQ.SetDfcQ(iDfcQ);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   464
	iMsgQ.Receive();
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   465
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   466
	Add();
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   467
	DisplayOn();
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   468
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   469
	return KErrNone;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   470
}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   471
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   472
/**
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   473
 * Register the call back function.
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   474
 * Components interested in receiving notification of the Vsync interrupt should register a callback function.
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   475
 */
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   476
EXPORT_C TInt DLcdPowerHandler::RegisterCallback(TLcdUserCallBack* aCbPtr)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   477
{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   478
	__KTRACE_OPT(KEXTENSION ,Kern::Printf("DLcdPowerHandler::RegisterCallBack %08x\n",aCbPtr->iCbFn) );
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   479
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   480
	TInt irq=__SPIN_LOCK_IRQSAVE(callbackLock);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   481
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   482
	if(aCbPtr != NULL)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   483
		{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   484
		if ( pLcd->iAppCallBk[0] == NULL  )
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   485
			{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   486
			pLcd->iAppCallBk[0] = aCbPtr;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   487
			}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   488
		else
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   489
			{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   490
			if((pLcd->iAppCallBk[1] == NULL) && (pLcd->iAppCallBk[0]->iCbFn != aCbPtr->iCbFn))
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   491
				{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   492
				pLcd->iAppCallBk[1] = aCbPtr;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   493
				}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   494
			else
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   495
				{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   496
				__SPIN_UNLOCK_IRQRESTORE(callbackLock,irq);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   497
				return KErrInUse;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   498
				}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   499
			}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   500
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   501
		__SPIN_UNLOCK_IRQRESTORE(callbackLock,irq);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   502
		__KTRACE_OPT(KEXTENSION ,Kern::Printf("<DLcdPowerHandler::RegisterCallBack ok %08x\n",aCbPtr->iCbFn) );
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   503
		return KErrNone;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   504
		}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   505
	else
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   506
		{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   507
		__SPIN_UNLOCK_IRQRESTORE(callbackLock,irq);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   508
		__KTRACE_OPT(KEXTENSION, Kern::Printf("Error: The supplied listener's callback is NULL"));
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   509
		return KErrArgument;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   510
		}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   511
}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   512
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   513
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   514
/**
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   515
 *DeRegister the call back function
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   516
 */
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   517
EXPORT_C void DLcdPowerHandler::DeRegisterCallback(TLcdUserCallBack* aCbPtr)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   518
{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   519
	__KTRACE_OPT(KEXTENSION ,Kern::Printf("DLcdPowerHandler::DeRegisterCallBack %08x\n ",aCbPtr->iCbFn)  );
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   520
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   521
	TInt irq=__SPIN_LOCK_IRQSAVE(callbackLock);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   522
	if(aCbPtr != NULL)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   523
		{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   524
	    if( pLcd->iAppCallBk[0] != NULL)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   525
			{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   526
			if ( (pLcd->iAppCallBk[0]->iDataPtr == aCbPtr->iDataPtr) && (pLcd->iAppCallBk[0]->iCbFn == aCbPtr->iCbFn) )
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   527
				{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   528
				pLcd->iAppCallBk[0] = NULL;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   529
				}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   530
			}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   531
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   532
		if( pLcd->iAppCallBk[1] != NULL)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   533
			{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   534
			if ( (pLcd->iAppCallBk[1]->iDataPtr == aCbPtr->iDataPtr) && (pLcd->iAppCallBk[1]->iCbFn == aCbPtr->iCbFn) )
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   535
				{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   536
				pLcd->iAppCallBk[1] = NULL;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   537
				}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   538
			}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   539
		}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   540
	__SPIN_UNLOCK_IRQRESTORE(callbackLock,irq);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   541
	__KTRACE_OPT(KEXTENSION ,Kern::Printf("<DLcdPowerHandler::DeRegisterCallBack %08x\n ",aCbPtr->iCbFn)  );
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   542
}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   543
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   544
/**
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   545
	Constructor
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   546
*/
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   547
DDisplayPddSyborg::DDisplayPddSyborg():
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   548
	iPendingBuffer(NULL),
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   549
	iActiveBuffer(NULL),
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   550
	iChunk(NULL),
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   551
	iLcdCallback(NULL),
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   552
	iVSyncDfc(&VSyncDfcFn, this, KVSyncDfcPriority)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   553
	{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   554
	__GCE_DEBUG_PRINT("DDisplayPddSyborg::DDisplayPddSyborg\n");
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   555
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   556
	iPostFlag = EFalse;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   557
	}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   558
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   559
/**
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   560
	Destructor
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   561
*/
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   562
DDisplayPddSyborg::~DDisplayPddSyborg()
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   563
	{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   564
	__GCE_DEBUG_PRINT("DDisplayPddSyborg::~DDisplayPddSyborg()  \n");
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   565
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   566
	if(iLcdCallback)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   567
		{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   568
		DLcdPowerHandler::pLcd->DeRegisterCallback(iLcdCallback) ;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   569
		delete iLcdCallback;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   570
		iLcdCallback = NULL;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   571
		}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   572
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   573
	//The DFC Queue is owned by DLcdPowerHandler so we shouldn't call Destroy() at this point.
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   574
	if (iDfcQ)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   575
		{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   576
		iDfcQ=NULL;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   577
		}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   578
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   579
	DChunk* chunk = (DChunk*) __e32_atomic_swp_ord_ptr(&iChunk, 0);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   580
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   581
	if(chunk)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   582
		{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   583
		Kern::ChunkClose(chunk);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   584
		}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   585
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   586
	}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   587
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   588
/**
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   589
    Set the Legacy Mode by setting the appropriate Frame control value.
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   590
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   591
*/
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   592
TInt DDisplayPddSyborg::SetLegacyMode()
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   593
	{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   594
	__GCE_DEBUG_PRINT("DDisplayPddSyborg::SetLegacyMode()\n");
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   595
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   596
    return KErrNone;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   597
	}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   598
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   599
/**
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   600
    Set the GCE mode by posting a composition buffer.
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   601
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   602
*/
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   603
TInt DDisplayPddSyborg::SetGceMode()
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   604
	{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   605
	__GCE_DEBUG_PRINT("DDisplayPddSyborg::SetGceMode()\n");
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   606
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   607
    PostCompositionBuffer(&iLdd->iCompositionBuffer[0]);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   608
    return KErrNone;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   609
	}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   610
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   611
/**
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   612
	@param	aDegOfRot  The requested rotation
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   613
	@return KErrNone
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   614
*/
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
   615
TInt DDisplayPddSyborg::SetRotation(RDisplayChannel::TDisplayRotation aDegOfRot)
38
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   616
	{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   617
	return KErrNone;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   618
	}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   619
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   620
/**
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   621
    Remove any previous post operations, set the appropriate layer as the next layer to be displayed( This value is updated in synchronization
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   622
    with V Sync so it will take affect in the next V Sync after that) and also set the buffer provided as the buffer to
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   623
    be posted next. Layer 3 is associated with user buffers.
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   624
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   625
	@param	aNode  Pointer to the User buffer to post.
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   626
*/
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   627
TInt DDisplayPddSyborg::PostUserBuffer(TBufferNode* aNode)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   628
	{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   629
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   630
	__GCE_DEBUG_PRINT2("DDisplayPddSyborg::PostUserBuffer :  aNode->iAddress = %08x\n", aNode->iAddress);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   631
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   632
	if(iPendingBuffer)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   633
		{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   634
		iPendingBuffer->iState = EBufferFree;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   635
		if (!(iPendingBuffer->iType == EBufferTypeUser) )
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   636
			{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   637
			iPendingBuffer->iFree  = ETrue;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   638
			}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   639
		}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   640
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   641
	aNode->iState   = EBufferPending;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   642
	iPendingBuffer	= aNode;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   643
	iPostFlag		= ETrue;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   644
	
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   645
  	// Activate the posted buffer
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   646
	TUint32 physicalAddress = Epoc::LinearToPhysical( aNode->iAddress );
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   647
  	WriteReg(DLcdPowerHandler::pLcd->iPortAddr, DLcdPowerHandler::FB_BASE, physicalAddress );
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   648
	/* Queue a DFC to complete the request*/
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   649
	iVSyncDfc.Enque();
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   650
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   651
	return KErrNone;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   652
	}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   653
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   654
/**
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   655
    Remove any previous post operations, set the appropriate layer as the next layer to be displayed( This value is updated in synchronization
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   656
    with V Sync so it will take affect in the next V Sync after that) and also set the buffer provided as the buffer to
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   657
    be posted next. Layer 1 and 2 are associated with composition buffers 0 and 1 respectively.
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   658
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   659
	@param	aNode  Pointer to the Composition buffer to post.
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   660
*/
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   661
TInt DDisplayPddSyborg::PostCompositionBuffer(TBufferNode* aNode)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   662
	{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   663
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   664
	__GCE_DEBUG_PRINT2("DDisplayPddSyborg::PostCompositionBuffer :  aNode->iAddress = %08x\n", aNode->iAddress);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   665
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   666
	if(iPendingBuffer)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   667
		{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   668
		iPendingBuffer->iState = EBufferFree;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   669
		if (iPendingBuffer->iType == EBufferTypeUser)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   670
			{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   671
			RequestComplete(RDisplayChannel::EReqPostUserBuffer, KErrCancel);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   672
			}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   673
		else
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   674
			{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   675
			iPendingBuffer->iFree  = ETrue;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   676
			}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   677
		}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   678
	aNode->iState	= EBufferPending;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   679
	aNode->iFree	= EFalse;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   680
	iPendingBuffer	= aNode;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   681
	iPostFlag		= ETrue;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   682
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   683
  	// Activate the posted buffer
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   684
	TUint32 physicalAddress = Epoc::LinearToPhysical( aNode->iAddress );
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   685
  	WriteReg(DLcdPowerHandler::pLcd->iPortAddr, DLcdPowerHandler::FB_BASE, physicalAddress );
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   686
	
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   687
	/* Queue a DFC to complete the request*/
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   688
	iVSyncDfc.Enque();
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   689
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   690
	return KErrNone;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   691
	}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   692
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   693
/**
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   694
    Remove any previous post operations, set the appropriate layer as the next layer to be displayed( This value is updated in synchronization
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   695
    with V Sync so it will take affect in the next V Sync after that) and also set the Legacy Buffer as the buffer to
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   696
    be posted next.Layer 0 is associated with legacy buffer.
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   697
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   698
	@param	aNode  Pointer to the Composition buffer to post.
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   699
*/
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   700
TInt DDisplayPddSyborg::PostLegacyBuffer()
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   701
	{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   702
	__GCE_DEBUG_PRINT("DDisplayPddSyborg::PostLegacyBuffer() \n");
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   703
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   704
	if(iPendingBuffer)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   705
		{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   706
		iPendingBuffer->iState = EBufferFree;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   707
		if (iPendingBuffer->iType == EBufferTypeUser)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   708
			{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   709
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   710
			RequestComplete(RDisplayChannel::EReqPostUserBuffer, KErrCancel);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   711
			}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   712
		else
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   713
			{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   714
			iPendingBuffer->iFree  = ETrue;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   715
			}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   716
		}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   717
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   718
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   719
	iLdd->iLegacyBuffer[0].iState		= EBufferPending;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   720
	iLdd->iLegacyBuffer[0].iFree		= EFalse;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   721
	iPendingBuffer						= &iLdd->iLegacyBuffer[0];
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   722
	iPostFlag		= ETrue;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   723
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   724
  	// Activate the posted buffer
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   725
  	WriteReg(DLcdPowerHandler::pLcd->iPortAddr, DLcdPowerHandler::FB_BASE, TSyborg::VideoRamPhys() );
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   726
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   727
	/* Queue a DFC to complete the request*/
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   728
	iVSyncDfc.Enque();
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   729
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   730
	return KErrNone;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   731
	}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   732
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   733
/**
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   734
    Handles device specific operations when a close message has been sent to the Logical Channel.
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   735
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   736
*/
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   737
TInt DDisplayPddSyborg::CloseMsg()
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   738
	{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   739
	__GCE_DEBUG_PRINT("DDisplayPddSyborg::CloseMsg()\n");
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   740
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   741
	iPendingBuffer  = NULL;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   742
	iActiveBuffer	= NULL;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   743
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   744
	iVSyncDfc.Cancel();
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   745
    return KErrNone;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   746
	}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   747
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   748
/**
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   749
    Called by the LDD's DoCreate function to handle the device specific part of opening the channel.
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   750
    (DoCreate is called by RDisplayChannel::Open)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   751
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   752
	@param aUnit	The screen unit
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   753
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   754
    @return KErrNone if successful; or one of the other system wide error codes.
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   755
*/
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   756
TInt DDisplayPddSyborg::CreateChannelSetup(TInt aUnit)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   757
	{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   758
	__GCE_DEBUG_PRINT("DDisplayPddSyborg::CreateChannelSetup\n");
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   759
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   760
	iScreenInfo = DLcdPowerHandler::pLcd->iVideoInfo;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   761
	iLdd->iUnit = aUnit;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   762
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   763
	iLdd->iDisplayInfo.iAvailableRotations			= RDisplayChannel::ERotationNormal;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   764
	iLdd->iDisplayInfo.iNormal.iOffsetBetweenLines	= iScreenInfo.iOffsetBetweenLines;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   765
	iLdd->iDisplayInfo.iNormal.iHeight				= iScreenInfo.iSizeInPixels.iHeight;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   766
	iLdd->iDisplayInfo.iNormal.iWidth				= iScreenInfo.iSizeInPixels.iWidth;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   767
	iLdd->iDisplayInfo.iNumCompositionBuffers		= KDisplayCBMax;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   768
	iLdd->iDisplayInfo.iBitsPerPixel				= iScreenInfo.iBitsPerPixel;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   769
    iLdd->iDisplayInfo.iRefreshRateHz = 60;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   770
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   771
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   772
	switch (iScreenInfo.iBitsPerPixel)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   773
		{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   774
		case 16:
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   775
			iLdd->iDisplayInfo.iPixelFormat = EUidPixelFormatRGB_565;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   776
			break;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   777
		case 24:
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   778
			iLdd->iDisplayInfo.iPixelFormat = EUidPixelFormatRGB_888;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   779
			break;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   780
		case 32:
119
931f2bbaabf7 work-a-round for Bug 3645 change ARGB->XRGB pixel format
andy simpson <andrews@symbian.org>
parents: 46
diff changeset
   781
			iLdd->iDisplayInfo.iPixelFormat = EUidPixelFormatXRGB_8888;
38
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   782
			break;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   783
		default:
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   784
			iLdd->iDisplayInfo.iPixelFormat = EUidPixelFormatUnknown;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   785
			break;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   786
		}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   787
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   788
	iLdd->iCurrentRotation = RDisplayChannel::ERotationNormal;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   789
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   790
	// Open shared chunk to the composition framebuffer
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   791
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   792
	DChunk* chunk = 0;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   793
	TLinAddr chunkKernelAddr  = 0;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   794
	TUint32 chunkMapAttr = 0;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   795
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   796
	// round to twice the page size
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   797
	TUint round  =  2*Kern::RoundToPageSize(DLcdPowerHandler::pLcd->iSize);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   798
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   799
	__GCE_DEBUG_PRINT2("DDisplayPddSyborg::CreateChannelSetup DLcdPowerHandler::pLcd->iSize  = %d\n", DLcdPowerHandler::pLcd->iSize );
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   800
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   801
	TChunkCreateInfo info;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   802
	info.iType					 = TChunkCreateInfo::ESharedKernelMultiple;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   803
	info.iMaxSize				 = round;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   804
	info.iMapAttr				 = EMapAttrFullyBlocking;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   805
	info.iOwnsMemory			 = EFalse;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   806
	info.iDestroyedDfc			 = 0;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   807
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   808
	TInt r = Kern::ChunkCreate(info, chunk, chunkKernelAddr, chunkMapAttr);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   809
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   810
	__GCE_DEBUG_PRINT2("CreateChannelSetup:ChunkCreate called for composition chunk. Set iChunkKernelAddr  = %08x\n", chunkKernelAddr );
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   811
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   812
	if( r == KErrNone)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   813
		{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   814
		// map our chunk
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   815
		r = Kern::ChunkCommitPhysical(chunk, 0,round , DLcdPowerHandler::pLcd->iCompositionPhysical);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   816
		__GCE_DEBUG_PRINT2("Mapping chunk %d", r);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   817
		if(r != KErrNone)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   818
			{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   819
			Kern::ChunkClose(chunk);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   820
			}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   821
		}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   822
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   823
	if ( r!= KErrNone)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   824
		{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   825
		return r;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   826
		}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   827
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   828
	iChunk	= chunk;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   829
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   830
	// init CB 0
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   831
	iLdd->iCompositionBuffer[0].iType			= EBufferTypeComposition;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   832
	iLdd->iCompositionBuffer[0].iBufferId		= 0;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   833
	iLdd->iCompositionBuffer[0].iFree			= ETrue;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   834
	iLdd->iCompositionBuffer[0].iState			= EBufferFree;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   835
	iLdd->iCompositionBuffer[0].iAddress		= chunkKernelAddr;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   836
	iLdd->iCompositionBuffer[0].iPhysicalAddress = Epoc::LinearToPhysical(chunkKernelAddr);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   837
	iLdd->iCompositionBuffer[0].iChunk			= chunk;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   838
	iLdd->iCompositionBuffer[0].iHandle			= 0;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   839
	iLdd->iCompositionBuffer[0].iOffset			= 0;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   840
	iLdd->iCompositionBuffer[0].iSize			= DLcdPowerHandler::pLcd->iSize;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   841
	iLdd->iCompositionBuffer[0].iPendingRequest = 0;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   842
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   843
	// init CB 1
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   844
	iLdd->iCompositionBuffer[1].iType			= EBufferTypeComposition;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   845
	iLdd->iCompositionBuffer[1].iBufferId		= 1;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   846
	iLdd->iCompositionBuffer[1].iFree			= ETrue;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   847
	iLdd->iCompositionBuffer[1].iState			= EBufferFree;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   848
	iLdd->iCompositionBuffer[1].iAddress		= chunkKernelAddr + DLcdPowerHandler::pLcd->iSize;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   849
	iLdd->iCompositionBuffer[1].iPhysicalAddress = Epoc::LinearToPhysical(chunkKernelAddr + DLcdPowerHandler::pLcd->iSize);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   850
	iLdd->iCompositionBuffer[1].iChunk			= chunk;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   851
	iLdd->iCompositionBuffer[1].iHandle			= 0;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   852
	iLdd->iCompositionBuffer[1].iOffset			= DLcdPowerHandler::pLcd->iSize;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   853
	iLdd->iCompositionBuffer[1].iSize			= DLcdPowerHandler::pLcd->iSize;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   854
	iLdd->iCompositionBuffer[1].iPendingRequest = 0;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   855
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   856
	iLdd->iCompositionBuffIdx					= 0;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   857
	//Use the same DFC queue created by the DLcdPowerHandler so all hardware accesses are executed under the same DFC thread.
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   858
	iDfcQ= DLcdPowerHandler::pLcd->iDfcQ;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   859
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   860
	// Set the Post DFC.
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   861
	iVSyncDfc.SetDfcQ(iDfcQ);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   862
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   863
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   864
	return KErrNone;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   865
	}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   866
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   867
/**
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   868
Detect whether a post operation is pending
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   869
*/
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   870
TBool DDisplayPddSyborg::PostPending()
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   871
	{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   872
	return (iPendingBuffer != NULL);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   873
	}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   874
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   875
/**
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   876
	Return the DFC queue to be used for this device.
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   877
 */
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   878
TDfcQue * DDisplayPddSyborg::DfcQ(TInt aUnit)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   879
	{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   880
	return iDfcQ;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   881
	}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   882
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   883
void DDisplayPddSyborg::VSyncDfcFn(TAny* aChannel)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   884
	{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   885
	DDisplayPddSyborg * channel =(DDisplayPddSyborg*)aChannel;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   886
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   887
	if (channel->iPostFlag)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   888
		{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   889
		 channel->iPostFlag = EFalse;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   890
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   891
		if (channel->iActiveBuffer)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   892
			{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   893
			//When a User buffer is registered its iFree member becomes EFalse and Deregister sets it
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   894
			//back to ETrue. Composition and Legacy buffers are not free when they are in the pending or
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   895
			//active state.
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   896
			if (channel->iActiveBuffer->iType == EBufferTypeUser)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   897
				{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   898
				channel->RequestComplete(RDisplayChannel::EReqPostUserBuffer, KErrNone);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   899
				}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   900
			else
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   901
				{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   902
				channel->iActiveBuffer->iFree	= ETrue;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   903
				}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   904
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   905
			channel->iActiveBuffer->iState		= EBufferFree;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   906
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   907
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   908
			//If no buffer was available during a call to GetCompositionBuffer the active buffer has
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   909
			//been returned as the next available one, so we must set the buffer to the proper state before we
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   910
			//send the notification.
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
   911
			TInt pendingIndex = channel->iLdd->iPendingIndex[RDisplayChannel::EReqGetCompositionBuffer];
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
   912
			if(channel->iLdd->iPendingReq[RDisplayChannel::EReqGetCompositionBuffer][pendingIndex].iTClientReq)
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
   913
			{
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
   914
				if(channel->iLdd->iPendingReq[RDisplayChannel::EReqGetCompositionBuffer][pendingIndex].iTClientReq->IsReady())
38
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   915
				{
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
   916
				channel->iActiveBuffer->iState = EBufferCompose;
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
   917
				channel->RequestComplete(RDisplayChannel::EReqGetCompositionBuffer,KErrNone);
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
   918
				}
38
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   919
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
   920
			}
38
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   921
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   922
			channel->iActiveBuffer				= NULL;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   923
			}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   924
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   925
		if (channel->iPendingBuffer)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   926
			{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   927
			__GCE_DEBUG_PRINT2("DDisplayPddSyborg::VSyncDfcFn moving pending buffer at address %08x to the active state\n", channel->iPendingBuffer->iAddress);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   928
			channel->iActiveBuffer			= channel->iPendingBuffer;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   929
			channel->iActiveBuffer->iState	= EBufferActive;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   930
			channel->iPendingBuffer			= NULL;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   931
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   932
			channel->RequestComplete(RDisplayChannel::EReqWaitForPost,  KErrNone);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   933
			}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   934
		}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   935
	}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   936
//*****************************************************************
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   937
//DDisplayPddFactory
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   938
//*****************************************************************/
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   939
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   940
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   941
/**
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   942
	Constructor
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   943
*/
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   944
DDisplayPddFactory::DDisplayPddFactory()
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   945
	{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   946
	__GCE_DEBUG_PRINT("DDisplayPddFactory::DDisplayPddFactory()\n");
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   947
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   948
	iVersion		= TVersion(KDisplayChMajorVersionNumber,
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   949
                      KDisplayChMinorVersionNumber,
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   950
                      KDisplayChBuildVersionNumber);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   951
	}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   952
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   953
/**
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   954
	PDD factory function. Creates a PDD object.
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   955
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   956
	@param  aChannel  A pointer to an PDD channel object which will be initialised on return.
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   957
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   958
	@return KErrNone  if object successfully allocated, KErrNoMemory if not.
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   959
*/
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   960
TInt DDisplayPddFactory::Create(DBase*& aChannel, TInt aUnit, const TDesC8* aInfo, const TVersion& aVer)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   961
	{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   962
	DDisplayPddSyborg *device= new DDisplayPddSyborg() ;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   963
	aChannel=device;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   964
	if (!device)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   965
		{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   966
		return KErrNoMemory;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   967
		}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   968
	return KErrNone;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   969
	}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   970
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   971
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   972
/**
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   973
    Set the Pdd name and return error code
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   974
*/
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   975
TInt DDisplayPddFactory::Install()
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   976
	{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   977
	__GCE_DEBUG_PRINT("DDisplayPddFactory::Install() \n");
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   978
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   979
	TBuf<32> name(RDisplayChannel::Name());
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   980
	_LIT(KPddExtension,".pdd");
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   981
	name.Append(KPddExtension);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   982
	return SetName(&name);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   983
	}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   984
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   985
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   986
void DDisplayPddFactory::GetCaps(TDes8& /*aDes*/) const
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   987
	{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   988
	//Not supported
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   989
	}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   990
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   991
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   992
/**
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   993
    Validate version and number of units.
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   994
*/
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   995
TInt DDisplayPddFactory::Validate(TInt aUnit, const TDesC8* /*anInfo*/, const TVersion& aVer)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   996
	{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   997
	if (!Kern::QueryVersionSupported(iVersion,aVer))
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   998
		{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
   999
		return KErrNotSupported;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1000
		}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1001
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1002
	if (aUnit != 0)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1003
		{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1004
		return KErrNotSupported;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1005
		}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1006
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1007
	return KErrNone;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1008
	}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1009
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1010
DECLARE_EXTENSION_PDD()
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1011
/**
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1012
	"Standard PDD" entrypoint.Creates PDD factory when Kern::InstallPhysicalDevice is called
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1013
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1014
	@return pointer to the PDD factory object.
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1015
*/
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1016
	{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1017
	__GCE_DEBUG_PRINT("DECLARE_EXTENSION_PDD()\n");
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1018
	return new DDisplayPddFactory ;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1019
	}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1020
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1021
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1022
DECLARE_STANDARD_EXTENSION()
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1023
{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1024
  TInt r = KErrNoMemory;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1025
  DLcdPowerHandler* pH=new DLcdPowerHandler;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1026
  if(pH)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1027
	{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1028
	r = pH->Create();
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1029
	if ( r == KErrNone)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1030
		{
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
  1031
		TInt r = Kern::DfcQCreate(pH->iDfcQ, 29 , &KLitLcd);
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
  1032
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
  1033
		if(r!=KErrNone)
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
  1034
		{
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
  1035
			return r;
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
  1036
		}
38
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1037
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1038
		DDisplayPddFactory * device = new DDisplayPddFactory;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1039
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1040
		if (device==NULL)
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1041
			{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1042
			r=KErrNoMemory;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1043
			}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1044
		else
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1045
			{
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1046
			r=Kern::InstallPhysicalDevice(device);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1047
			}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1048
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1049
		#ifdef CPU_AFFINITY_ANY
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1050
        NKern::ThreadSetCpuAffinity((NThread*) pH->iDfcQ->iThread, KCpuAffinityAny);
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1051
		#endif
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1052
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1053
		__KTRACE_OPT(KEXTENSION,Kern::Printf("Installing the display device from the kernel extension returned with error code %d",r));
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1054
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1055
		}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1056
	}
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1057
  
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1058
  return r;
33dfab4ab0fc PDD Display Driver for Syborg
emilioc
parents:
diff changeset
  1059
}