summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/CInt10.c1449
-rw-r--r--src/CInt10.h37
-rw-r--r--src/CInt10FunProto.h15
-rw-r--r--src/CInt10Tbl.h72
-rw-r--r--src/Makefile24
-rw-r--r--src/rdc.h65
-rw-r--r--src/rdc_2dtool.c59
-rw-r--r--src/rdc_2dtool.h39
-rw-r--r--src/rdc_accel.c219
-rw-r--r--src/rdc_cursor.c302
-rw-r--r--src/rdc_cursor.h3
-rw-r--r--src/rdc_driver.c342
-rw-r--r--src/rdc_extension.c203
-rw-r--r--src/rdc_extension.h69
-rw-r--r--src/rdc_mode.c102
-rw-r--r--src/rdc_mode.h17
-rw-r--r--src/rdc_tool.c25
-rw-r--r--src/rdc_vgatool.c51
-rw-r--r--src/rdc_vgatool.h32
-rw-r--r--src/rdc_video.c251
-rw-r--r--src/rdc_video.h17
-rw-r--r--src/typedef.h67
22 files changed, 1568 insertions, 1892 deletions
diff --git a/src/CInt10.c b/src/CInt10.c
index 1510ce8..3737bd0 100644
--- a/src/CInt10.c
+++ b/src/CInt10.c
@@ -18,6 +18,7 @@
* <jason.lin@rdc.com.tw>
*/
+
#include <string.h>
#ifndef XFree86Module
@@ -31,15 +32,15 @@
#include "CInt10FunProto.h"
#include "CInt10Tbl.h"
+#define I2C_ERROR 0
+#define I2C_OK 1
+#define I2CWriteCMD 0
+#define I2CReadCMD 1
+
-/* Global for related IO address */
USHORT Relocate_IOAddress;
-/*--------------------------------------------------------------------------
-;
-; IO port function replace
-;
-;---------------------------------------------------------------------------*/
+
__inline void OutPort(UCHAR Index,UCHAR Value)
{
@@ -57,34 +58,233 @@ __inline UCHAR InPort(UCHAR Index)
return bInVal;
}
-/*----------------------------------------------------------------------------
-;
-; SetVBERerurnStatus
-;
-; in:
-; VBEReturnStatus =
-; VBEFunctionCallSuccessful 0x004F
-; VBEFunctionCallFail 0x014F
-; VBEFunctionCallNotSupported 0x024F
-; VBEFunctionCallInvalid 0x034F
-; out:
-; pCBiosArguments->Eax
-;---------------------------------------------------------------------------*/
+void I2CWriteClock(UCHAR I2CPort, UCHAR data)
+{
+ UCHAR i;
+ UCHAR ujCRB7, jtemp;
+
+ for (i=0;i<0x1000; i++)
+ {
+ ujCRB7 = ((data & 0x01) ? 0:1);
+ SetCRReg(I2CPort, ujCRB7, 0xFE);
+
+ jtemp = GetCRReg(I2CPort) & 0x01;
+
+ if (ujCRB7 == jtemp) break;
+ }
+}
+
+void I2CDelay(UCHAR I2CPort)
+{
+ ULONG i;
+ UCHAR jtemp;
+
+
+
+
+ for (i=0;i<100;i++)
+ {
+
+ jtemp = inb(0x80);
+ }
+}
+
+void I2CWriteData(UCHAR I2CPort, UCHAR data)
+{
+ UCHAR ujCRB7, jtemp;
+ ULONG i;
+
+ for (i=0;i<0x1000; i++)
+ {
+ ujCRB7 = ((data & 0x01) ? 0:1) << 2;
+ SetCRReg(I2CPort, ujCRB7, 0xFB);
+
+ jtemp = GetCRReg(I2CPort) & 0x04;
+
+ if (ujCRB7 == jtemp) break;
+ }
+}
+
+void I2CStart(UCHAR I2CPort)
+{
+ I2CWriteClock(I2CPort, 0x00);
+ I2CDelay(I2CPort);
+ I2CWriteData(I2CPort, 0x01);
+ I2CDelay(I2CPort);
+ I2CWriteClock(I2CPort, 0x01);
+ I2CDelay(I2CPort);
+ I2CWriteData(I2CPort, 0x00);
+ I2CDelay(I2CPort);
+ I2CWriteClock(I2CPort, 0x01);
+ I2CDelay(I2CPort);
+}
+
+void SendI2CDataByte(UCHAR I2CPort, UCHAR Data)
+{
+ UCHAR jData;
+ UCHAR i;
+
+ for (i=7;i>=0;i--)
+ {
+ I2CWriteClock(I2CPort, 0x00);
+ I2CDelay(I2CPort);
+
+ jData = ((Data >> i) & 0x01) ? 1:0;
+ I2CWriteData(I2CPort, jData);
+ I2CDelay(I2CPort);
+
+ I2CWriteClock(I2CPort, 0x01);
+ I2CDelay(I2CPort);
+ }
+}
+
+bool CheckACK(UCHAR I2CPort)
+{
+ UCHAR Data;
+
+ I2CWriteClock(I2CPort, 0x00);
+ I2CDelay(I2CPort);
+ I2CWriteData(I2CPort, 0x01);
+ I2CDelay(I2CPort);
+ I2CWriteClock(I2CPort, 0x01);
+ I2CDelay(I2CPort);
+ Data = (GetCRReg(I2CPort) & 0x20) >> 5;
+
+
+ return ((Data & 0x01) ? 0:1);
+}
+
+UCHAR ReceiveI2CDataByte(UCHAR I2CPort, UCHAR I2CSlave)
+{
+
+ UCHAR jData=0, jTempData;
+ UCHAR i, j;
+
+ for (i=7;i>=0;i--)
+ {
+ I2CWriteClock(I2CPort, 0x00);
+ I2CDelay(I2CPort);
+
+ I2CWriteData(I2CPort, 0x01);
+ I2CDelay(I2CPort);
+
+ I2CWriteClock(I2CPort, 0x01);
+ I2CDelay(I2CPort);
+
+ for (j=0; j<0x1000; j++)
+ {
+ if (((GetCRReg(I2CPort) & 0x10) >> 4)) break;
+ }
+
+ jTempData = (GetCRReg(I2CPort) & 0x20) >> 5;
+ jData |= ((jTempData & 0x01) << i);
+
+ I2CWriteClock(I2CPort, 0x01);
+ I2CDelay(I2CPort);
+ }
+
+ return (jData);
+}
+
+void SendNACK(UCHAR I2CPort)
+{
+ I2CWriteClock(I2CPort, 0x00);
+ I2CDelay(I2CPort);
+ I2CWriteData(I2CPort, 0x01);
+ I2CDelay(I2CPort);
+ I2CWriteClock(I2CPort, 0x01);
+ I2CDelay(I2CPort);
+}
+
+void I2CStop(UCHAR I2CPort)
+{
+ I2CWriteClock(I2CPort, 0x00);
+ I2CDelay(I2CPort);
+ I2CWriteData(I2CPort, 0x00);
+ I2CDelay(I2CPort);
+ I2CWriteClock(I2CPort, 0x01);
+ I2CDelay(I2CPort);
+ I2CWriteData(I2CPort, 0x01);
+ I2CDelay(I2CPort);
+ I2CWriteClock(I2CPort, 0x01);
+ I2CDelay(I2CPort);
+}
+
+
+UCHAR ReadI2C(UCHAR I2CPort, UCHAR I2CSlave, UCHAR RegIdx, UCHAR* RegData)
+{
+ I2CStart(I2CPort);
+
+
+ SendI2CDataByte(I2CPort, I2CSlave|I2CWriteCMD);
+ if (!CheckACK(I2CPort))
+ {
+ return I2C_ERROR;
+ }
+
+
+ SendI2CDataByte(I2CPort, RegIdx);
+ if (!CheckACK(I2CPort))
+ {
+ return I2C_ERROR;
+ }
+
+ I2CStart(I2CPort);
+
+
+ SendI2CDataByte(I2CPort, I2CSlave|I2CReadCMD);
+ if (!CheckACK(I2CPort))
+ {
+ return I2C_ERROR;
+ }
+
+
+ *RegData = ReceiveI2CDataByte(I2CPort, I2CSlave);
+ SendNACK(I2CPort);
+
+ I2CStop(I2CPort);
+
+ return I2C_OK;
+}
+
+UCHAR WriteI2C(UCHAR I2CPort, UCHAR I2CSlave, UCHAR RegIdx, UCHAR RegData)
+{
+ I2CStart(I2CPort);
+
+
+ SendI2CDataByte(I2CPort, I2CSlave|I2CWriteCMD);
+ if (!CheckACK(I2CPort))
+ {
+ return I2C_ERROR;
+ }
+
+
+ SendI2CDataByte(I2CPort, RegIdx);
+ if (!CheckACK(I2CPort))
+ {
+ return I2C_ERROR;
+ }
+
+
+ SendI2CDataByte(I2CPort, RegData);
+ if (!CheckACK(I2CPort))
+ {
+ return I2C_ERROR;
+ }
+
+ SendNACK(I2CPort);
+
+ I2CStop(I2CPort);
+ return I2C_OK;
+}
+
+
void SetVBERerurnStatus(USHORT VBEReturnStatus, CBIOS_ARGUMENTS *pCBiosArguments)
{
pCBiosArguments->reg.x.AX = VBEReturnStatus;
}
-/*----------------------------------------------------------------------------
-;
-; SetTimingRegs
-;
-; in:
-; bDisplayPath = display path
-; pMODE_INFO = pointer to MODE_INFO
-; pRRATE_TABLE = pointer to RRATE_TABLE
-;
-;---------------------------------------------------------------------------*/
+
void SetTimingRegs(UCHAR ucDisplayPath, MODE_INFO *pModeInfo, RRATE_TABLE *pRRateTable)
{
USHORT usHBorder = 0, usVBorder = 0;
@@ -162,21 +362,13 @@ void SetTimingRegs(UCHAR ucDisplayPath, MODE_INFO *pModeInfo, RRATE_TABLE *pRRat
xf86DrvMsgVerb(0, X_INFO, DefaultLevel, "==Exit SetTimingRegs()==\n");
}
-/*-------------------------------------------------------------------
-;
-; SetHTotal()
-;
-; in:
-; DisplayPath = display path
-; Value = H total in pixel
-;
-;------------------------------------------------------------------*/
+
void SetHTotal(UCHAR DisplayPath, USHORT Value)
{
- /* Subtract the 40 pixels for setting HW */
+
Value -= 40;
- /* low-3-bits of H total has bug, HW will remove it. So the value have to align to 8*/
+
Value += 7;
if(DisplayPath == DISP1)
@@ -191,18 +383,10 @@ void SetHTotal(UCHAR DisplayPath, USHORT Value)
return;
}
-/*-------------------------------------------------------------------
-;
-; SetHDisplayEnd()
-;
-; in:
-; DisplayPath = display path
-; Value = H display end in pixel
-;
-;------------------------------------------------------------------*/
+
void SetHDisplayEnd(UCHAR DisplayPath, USHORT Value)
{
- /* Subtract the 8 pixels for setting HW */
+
Value -= 8;
if(DisplayPath == DISP1)
@@ -218,18 +402,10 @@ void SetHDisplayEnd(UCHAR DisplayPath, USHORT Value)
}
-/*-------------------------------------------------------------------
-;
-; SetHBlankingStart()
-;
-; in:
-; DisplayPath = display path
-; Value = H blanking start in pixel
-;
-;------------------------------------------------------------------*/
+
void SetHBlankingStart(UCHAR DisplayPath, USHORT Value)
{
- /* Subtract the 8 pixels for setting HW */
+
Value -= 8;
if(DisplayPath == DISP1)
@@ -245,18 +421,10 @@ void SetHBlankingStart(UCHAR DisplayPath, USHORT Value)
}
-/*-------------------------------------------------------------------
-;
-; SetHBlankingEnd()
-;
-; in:
-; DisplayPath = display path
-; Value = H blanking end in pixel
-;
-;------------------------------------------------------------------*/
+
void SetHBlankingEnd(UCHAR DisplayPath, USHORT Value)
{
- /* Subtract the 8 pixels for setting HW */
+
Value -= 8;
if(DisplayPath == DISP1)
@@ -272,18 +440,10 @@ void SetHBlankingEnd(UCHAR DisplayPath, USHORT Value)
}
-/*-------------------------------------------------------------------
-;
-; SetHSyncStart()
-;
-; in:
-; DisplayPath = display path
-; Value = H Sync start in pixel
-;
-;------------------------------------------------------------------*/
+
void SetHSyncStart(UCHAR DisplayPath, USHORT Value)
{
- /* Subtract the 0 pixels for setting HW */
+
Value -= 0;
if(DisplayPath == DISP1)
@@ -299,18 +459,10 @@ void SetHSyncStart(UCHAR DisplayPath, USHORT Value)
}
-/*-------------------------------------------------------------------
-;
-; SetHSyncEnd()
-;
-; in:
-; DisplayPath = display path
-; Value = H Sync end in pixel
-;
-;------------------------------------------------------------------*/
+
void SetHSyncEnd(UCHAR DisplayPath, USHORT Value)
{
- /* Subtract the 0 pixels for setting HW */
+
Value -= 0;
if(DisplayPath == DISP1)
@@ -326,18 +478,10 @@ void SetHSyncEnd(UCHAR DisplayPath, USHORT Value)
}
-/*-------------------------------------------------------------------
-;
-; SetVTotal()
-;
-; in:
-; DisplayPath = display path
-; Value = V total
-;
-;------------------------------------------------------------------*/
+
void SetVTotal(UCHAR DisplayPath, USHORT Value)
{
- /* Subtract the 2 line for setting HW */
+
Value -= 2;
if(DisplayPath == DISP1)
@@ -353,18 +497,10 @@ void SetVTotal(UCHAR DisplayPath, USHORT Value)
}
-/*-------------------------------------------------------------------
-;
-; SetVDisplayEnd()
-;
-; in:
-; DisplayPath = display path
-; Value = V display end
-;
-;------------------------------------------------------------------*/
+
void SetVDisplayEnd(UCHAR DisplayPath, USHORT Value)
{
- /* Subtract the 1 line for setting HW */
+
Value -= 1;
if(DisplayPath == DISP1)
@@ -380,18 +516,10 @@ void SetVDisplayEnd(UCHAR DisplayPath, USHORT Value)
}
-/*-------------------------------------------------------------------
-;
-; SetVBlankingStart()
-;
-; in:
-; DisplayPath = display path
-; Value = V blanking start
-;
-;------------------------------------------------------------------*/
+
void SetVBlankingStart(UCHAR DisplayPath, USHORT Value)
{
- /* Subtract the 1 line for setting HW */
+
Value -= 1;
if(DisplayPath == DISP1)
@@ -407,18 +535,10 @@ void SetVBlankingStart(UCHAR DisplayPath, USHORT Value)
}
-/*-------------------------------------------------------------------
-;
-; SetVBlankingEnd()
-;
-; in:
-; DisplayPath = display path
-; Value = V blanking end
-;
-;------------------------------------------------------------------*/
+
void SetVBlankingEnd(UCHAR DisplayPath, USHORT Value)
{
- /* Subtract the 1 line for setting HW */
+
Value -= 1;
if(DisplayPath == DISP1)
@@ -434,18 +554,10 @@ void SetVBlankingEnd(UCHAR DisplayPath, USHORT Value)
}
-/*-------------------------------------------------------------------
-;
-; SetVSyncStart()
-;
-; in:
-; DisplayPath = display path
-; Value = V sync start
-;
-;------------------------------------------------------------------*/
+
void SetVSyncStart(UCHAR DisplayPath, USHORT Value)
{
- /* Subtract the 1 line for setting HW */
+
Value -= 1;
if(DisplayPath == DISP1)
@@ -461,18 +573,10 @@ void SetVSyncStart(UCHAR DisplayPath, USHORT Value)
}
-/*-------------------------------------------------------------------
-;
-; SetVSyncEnd()
-;
-; in:
-; DisplayPath = display path
-; Value = V sync end
-;
-;------------------------------------------------------------------*/
+
void SetVSyncEnd(UCHAR DisplayPath, USHORT Value)
{
- /* Subtract the 1 line for setting HW */
+
Value -= 1;
if(DisplayPath == DISP1)
@@ -488,15 +592,7 @@ void SetVSyncEnd(UCHAR DisplayPath, USHORT Value)
}
-/*-------------------------------------------------------------------
-;
-; SetPixelClock()
-;
-; in:
-; DisplayPath = display path
-; Clock = pixel clock in khz
-;
-;------------------------------------------------------------------*/
+
void SetPixelClock(UCHAR bDisplayPath, ULONG dwClock)
{
PLL_Info PLLInfo;
@@ -504,15 +600,7 @@ void SetPixelClock(UCHAR bDisplayPath, ULONG dwClock)
PLLInfo = ClockToPLLF9003A(dwClock);
SetDPLL(bDisplayPath, PLLInfo);
}
-/*-------------------------------------------------------------------
-;
-; SetHSource()
-;
-; in:
-; DisplayPath = display path
-; wValue = number of pixels of source data
-;
-;------------------------------------------------------------------*/
+
void SetHSource(UCHAR bDisplayPath, USHORT wValue)
{
wValue -= 1;
@@ -528,19 +616,10 @@ void SetHSource(UCHAR bDisplayPath, USHORT wValue)
}
-/*-------------------------------------------------------------------
-;
-; ClockToPLLF9003A()
-;
-; in:
-; Clock = pixel clock in khz
-; return:
-; PLL_Info = PLL value
-;
-;------------------------------------------------------------------*/
+
PLL_Info ClockToPLLF9003A(ULONG Clock)
{
- ULONG MSCount, NSCount, RSCount, FCKVCO, FCKOUT; /*defined in PLL module */
+ ULONG MSCount, NSCount, RSCount, FCKVCO, FCKOUT;
ULONG NearestClock = 0xFFFFFFFF;
PLL_Info PLLInfo;
@@ -577,15 +656,7 @@ PLL_Info ClockToPLLF9003A(ULONG Clock)
}
-/*-------------------------------------------------------------------
-;
-; SetDPLL() - set display PLL
-;
-; in:
-; DisplayPath = display path
-; PLLInfo: PLL value
-;
-;------------------------------------------------------------------*/
+
void SetDPLL(UCHAR DisplayPath, PLL_Info PLLInfo)
{
UCHAR RetValue;
@@ -603,26 +674,16 @@ void SetDPLL(UCHAR DisplayPath, PLL_Info PLLInfo)
SetCRReg(0xCE, PLLInfo.RS, BIT2+BIT1+BIT0);
}
- /* Fire the PLL setting */
+
RetValue = GetCRReg(0xBB);
SetCRReg(0xBB, RetValue, 0xFF);
}
-/*-------------------------------------------------------------------
-;
-; SetPolarity()
-;
-; in:
-; DisplayPath = display path
-; Value: bit1 = 1 for positive H sync
-; = 0 for negative H sync
-; bit2 = 1 for positive V sync
-; = 0 for negative V sync
-;------------------------------------------------------------------*/
+
void SetPolarity(UCHAR DevicePort, UCHAR Value)
{
- Value ^= BIT2+BIT1; /* invert Bit[2:1] */
+ Value ^= BIT2+BIT1;
switch (DevicePort)
{
@@ -641,20 +702,12 @@ void SetPolarity(UCHAR DevicePort, UCHAR Value)
}
}
-/*-------------------------------------------------------------------
-;
-; SetFIFO()
-;
-; in:
-; DisplayPath = display path
-; out:
-; none
-;------------------------------------------------------------------*/
+
void SetFIFO(UCHAR DisplayPath)
{
if (DisplayPath == DISP1)
{
- SetCRReg(0xA7, 0x3F, 0xFF);
+ SetCRReg(0xA7, 0x5F, 0xFF);
SetCRReg(0xA6, 0x3F, 0xFF);
}
else if (DisplayPath == DISP2)
@@ -664,18 +717,10 @@ void SetFIFO(UCHAR DisplayPath)
}
}
-/*-------------------------------------------------------------------
-;
-; SetPitch()
-;
-; in:
-; DisplayPath = display path
-; Value = Pitch in byte
-;
-;------------------------------------------------------------------*/
+
void SetPitch(UCHAR DisplayPath, USHORT Value)
{
- /* adjust pitch in 8 byte alignment */
+
Value += 7;
Value >>= 3;
@@ -692,16 +737,7 @@ void SetPitch(UCHAR DisplayPath, USHORT Value)
}
-/*-------------------------------------------------------------------
-;
-; GetPitch()
-;
-; in:
-; DisplayPath = display path
-; out:
-; return pitch in byte
-;
-;------------------------------------------------------------------*/
+
USHORT GetPitch(UCHAR DisplayPath)
{
USHORT wPitch;
@@ -720,16 +756,7 @@ USHORT GetPitch(UCHAR DisplayPath)
return wPitch;
}
-/*-------------------------------------------------------------------
-;
-; GetVDisplayEnd()
-;
-; in:
-; DisplayPath = display path
-; out:
-; return V disp end
-;
-;------------------------------------------------------------------*/
+
USHORT GetVDisplayEnd(UCHAR DisplayPath)
{
USHORT wDisplayEnd = 0x0;
@@ -743,21 +770,13 @@ USHORT GetVDisplayEnd(UCHAR DisplayPath)
wDisplayEnd = ReadRegFromHW(VDispEnd2);
}
- /* Add 1 for query value. */
+
wDisplayEnd += 1;
return wDisplayEnd;
}
-/*-------------------------------------------------------------------
-;
-; SetColorDepth()
-;
-; in:
-; DisplayPath = display path
-; Value = color depth (8/16/32)
-;
-;------------------------------------------------------------------*/
+
void SetColorDepth(UCHAR DisplayPath, UCHAR Value)
{
UCHAR bSetBit = 0x0;
@@ -783,7 +802,7 @@ void SetColorDepth(UCHAR DisplayPath, UCHAR Value)
}
else
{
- /* Display2 would not support 8bit color depth */
+
if(Value == 8)
return;
@@ -792,14 +811,7 @@ void SetColorDepth(UCHAR DisplayPath, UCHAR Value)
}
-/*-------------------------------------------------------------------
-;
-; ConfigDigitalPort()
-;
-; in:
-; bDisplayPath = display path
-;
-;------------------------------------------------------------------*/
+
void ConfigDigitalPort(UCHAR bDisplayPath)
{
PORT_CONFIG *pDevicePortConfig;
@@ -843,20 +855,12 @@ void ConfigDigitalPort(UCHAR bDisplayPath)
}
}
-/*----------------------------------------------------------------------------
-;
-; LoadTiming
-;
-; in:
-; bDisplayPath = display path
-; wModeNum = mode no.
-;
-;---------------------------------------------------------------------------*/
+
void LoadTiming(UCHAR bDisplayPath, USHORT wModeNum)
{
UCHAR bDeviceIndex = Get_DEV_ID(bDisplayPath);
- /* Obtain the display device */
+
switch(bDeviceIndex)
{
@@ -875,15 +879,7 @@ void LoadTiming(UCHAR bDisplayPath, USHORT wModeNum)
}
-/*----------------------------------------------------------------------------
-;
-; LoadVESATiming
-;
-; in:
-; bDisplayPath = display path
-; wModeNum = mode no.
-;
-;---------------------------------------------------------------------------*/
+
void LoadVESATiming(UCHAR bDisplayPath, USHORT wModeNum)
{
UCHAR bR_Rate_value = 0x0;
@@ -899,19 +895,11 @@ void LoadVESATiming(UCHAR bDisplayPath, USHORT wModeNum)
else
{
xf86DrvMsgVerb(0, X_INFO, InfoLevel, "Mode not found!!\n");
- /*ASSERT(true); */
+
}
xf86DrvMsgVerb(0, X_INFO, DefaultLevel, "==Exit LoadVESATiming()==\n");
}
-/*----------------------------------------------------------------------------
-;
-; LoadLCDTiming
-;
-; in:
-; bDisplayPath = display path
-; wModeNum = mode no.
-;
-;---------------------------------------------------------------------------*/
+
void LoadLCDTiming(UCHAR bDisplayPath, USHORT wModeNum)
{
UCHAR bDeviceIndex = Get_DEV_ID(bDisplayPath);
@@ -929,20 +917,12 @@ void LoadLCDTiming(UCHAR bDisplayPath, USHORT wModeNum)
}
else
{
- /*ASSERT(true); */
+
}
xf86DrvMsgVerb(0, X_INFO, DefaultLevel, "==Exit LoadLCDTiming()==\n");
}
-/*----------------------------------------------------------------------------
-;
-; SetScalingFactor
-;
-; in:
-; pUserModeInfo = pointer to MODE_INFO of user mode
-; pPanelModeInfo = pointer to LCD MODE_INFO of panel
-;
-;---------------------------------------------------------------------------*/
+
void SetScalingFactor(UCHAR bDisplayPath, MODE_INFO *pUserModeInfo, MODE_INFO *pPanelModeInfo)
{
ULONG dwScalingFactor;
@@ -986,15 +966,7 @@ void SetScalingFactor(UCHAR bDisplayPath, MODE_INFO *pUserModeInfo, MODE_INFO *p
}
xf86DrvMsgVerb(0, X_INFO, DefaultLevel, "==Exit SetScalingFactor()==\n");
}
-/*-------------------------------------------------------------------
-;
-; SetHorScalingFactor()
-;
-; in:
-; DisplayPath = display path
-; wValue = scaling factor
-;
-;------------------------------------------------------------------*/
+
void SetHorScalingFactor(UCHAR bDisplayPath, USHORT wValue)
{
if(bDisplayPath == DISP1)
@@ -1006,15 +978,7 @@ void SetHorScalingFactor(UCHAR bDisplayPath, USHORT wValue)
WriteRegToHW(HScalingFactor2, wValue);
}
}
-/*-------------------------------------------------------------------
-;
-; SetVerScalingFactor()
-;
-; in:
-; DisplayPath = display path
-; wValue = scaling factor
-;
-;------------------------------------------------------------------*/
+
void SetVerScalingFactor(UCHAR bDisplayPath, USHORT wValue)
{
if(bDisplayPath == DISP1)
@@ -1026,17 +990,7 @@ void SetVerScalingFactor(UCHAR bDisplayPath, USHORT wValue)
WriteRegToHW(VScalingFactor2, wValue);
}
}
-/*-------------------------------------------------------------------
-;
-; isLCDFitMode() -
-;
-; Input:
-; bDeviceIndex = LCD/LCD2
-; wModeNom = mode number
-; return:
-; true if wModeNom is LCD fit mode
-;
-;------------------------------------------------------------------*/
+
CI_STATUS isLCDFitMode(UCHAR bDeviceIndex, USHORT wModeNum)
{
MODE_INFO *pModeInfo;
@@ -1059,29 +1013,17 @@ CI_STATUS isLCDFitMode(UCHAR bDeviceIndex, USHORT wModeNum)
return false;
}
}
-/*----------------------------------------------------------------------------
-;
-; GetModePointerFromVESATable
-;
-; in:
-; wModeNum = mode no.
-; bRRIndex = refresh rate index
-; out:
-; return = true, pModeInfo = pointer to MODE_INFO
-; pRRateTable = pointer to RRATE_TABLE
-; = false, fail
-;
-;---------------------------------------------------------------------------*/
+
CI_STATUS GetModePointerFromVESATable(USHORT wModeNum, UCHAR ucRRIndex, MODE_INFO **ppModeInfo, RRATE_TABLE **ppRRateTable)
{
int iRRateTableIndex;
xf86DrvMsgVerb(0, X_INFO, DefaultLevel, "==Enter GetModePointerFromVESATable()==\n");
- /* Don't find out any fit mode table in the vesa table */
+
if(Get_MODE_INFO_From_VESA_Table(wModeNum, ppModeInfo))
{
- /* Obtain the frequence table. */
+
*ppRRateTable = (RRATE_TABLE*)((int)(*ppModeInfo) + sizeof(MODE_INFO));
for(iRRateTableIndex = 0; iRRateTableIndex < (*ppModeInfo)->RRTableCount; iRRateTableIndex++, (*ppRRateTable)++)
@@ -1097,23 +1039,12 @@ CI_STATUS GetModePointerFromVESATable(USHORT wModeNum, UCHAR ucRRIndex, MODE_INF
}
}
- /* Can't find any fresh rate be conformed */
+
xf86DrvMsgVerb(0, X_INFO, DefaultLevel, " Exit2 GetModePointerFromVESATable()== return fail!!\n");
return false;
}
-/*----------------------------------------------------------------------------
-;
-; GetModePointerFromLCDTable
-;
-; in:
-; bDeviceIndex = device index
-; out:
-; return = true, ppPanelInfo = pointer to PANEL_INFO
-; pPanelTable = pointerto PANEL_TABLE
-; = false, fail
-;
-;---------------------------------------------------------------------------*/
+
CI_STATUS GetModePointerFromLCDTable(UCHAR bDeviceIndex, MODE_INFO **ppModeInfo, PANEL_TABLE **ppPanelTable)
{
xf86DrvMsgVerb(0, X_INFO, DefaultLevel, "==Enter GetModePointerFromLCDTable()==\n");
@@ -1130,17 +1061,7 @@ CI_STATUS GetModePointerFromLCDTable(UCHAR bDeviceIndex, MODE_INFO **ppModeInfo,
return false;
}
}
-/*----------------------------------------------------------------------------
-;
-; Get_MODE_INFO
-;
-; in:
-; wModeNum = mode no.
-; out:
-; return = true, pModeInfo = pointer to MODE_INFO
-; = false, fail
-;
-;---------------------------------------------------------------------------*/
+
CI_STATUS Get_MODE_INFO(USHORT wModeNum, MODE_INFO **ppModeInfo)
{
if (Get_MODE_INFO_From_VESA_Table(wModeNum, ppModeInfo))
@@ -1162,17 +1083,7 @@ CI_STATUS Get_MODE_INFO(USHORT wModeNum, MODE_INFO **ppModeInfo)
return false;
}
}
-/*----------------------------------------------------------------------------
-;
-; Get_MODE_INFO_From_LCD_Table
-;
-; in:
-; bDeviceIndex = device index.
-; out:
-; return = true, pModeInfo = pointer to PANEL_INFO
-; = false, fail
-;
-;---------------------------------------------------------------------------*/
+
CI_STATUS Get_MODE_INFO_From_LCD_Table(UCHAR bDeviceIndex, MODE_INFO **ppModeInfo)
{
int i;
@@ -1222,17 +1133,7 @@ CI_STATUS Get_MODE_INFO_From_LCD_Table(UCHAR bDeviceIndex, MODE_INFO **ppModeInf
return false;
}
-/*----------------------------------------------------------------------------
-;
-; Get_MODE_INFO_From_VESA_Table
-;
-; in:
-; wModeNum = mode no.
-; out:
-; return = true, pModeInfo = pointer to MODE_INFO
-; = false, fail
-;
-;---------------------------------------------------------------------------*/
+
#if 0
CI_STATUS Get_MODE_INFO_From_VESA_Table(USHORT wModeNum, MODE_INFO **ppModeInfo)
{
@@ -1295,18 +1196,7 @@ CI_STATUS Get_MODE_INFO_From_VESA_Table(USHORT wModeNum, MODE_INFO **ppModeInfo)
return false;
}
#endif
-/*----------------------------------------------------------------------------
-;
-; GetModeColorDepth
-;
-; in:
-; wModeNum = mode no.
-; pMODE_INFO = pointer to MODE_INFO
-; out:
-; return = true, *pbColorDepth = color depth
-; = false, fail
-;
-;---------------------------------------------------------------------------*/
+
CI_STATUS GetModeColorDepth(USHORT wModeNum, MODE_INFO *pModeInfo, UCHAR *pucColorDepth)
{
#if CBIOS_DEBUG
@@ -1348,23 +1238,13 @@ CI_STATUS GetModeColorDepth(USHORT wModeNum, MODE_INFO *pModeInfo, UCHAR *pucCol
return false;
}
}
-/*----------------------------------------------------------------------------
-;
-; GetModePitch()
-;
-; In:
-; ModeNum = mode no
-; Out:
-; return = true, *pPitch = pitch in byte
-; = false, fail
-;
-;---------------------------------------------------------------------------*/
+
CI_STATUS GetModePitch(USHORT ModeNum, USHORT *pPitch)
{
MODE_INFO *pModeInfo = NULL;
UCHAR ucColorDepth = 0;
- /* Don't find out any fit mode table in the vesa table */
+
if(!Get_MODE_INFO(ModeNum, &pModeInfo))
{
return false;
@@ -1384,16 +1264,7 @@ CI_STATUS GetModePitch(USHORT ModeNum, USHORT *pPitch)
return true;
}
-/*----------------------------------------------------------------------------
-;
-; ReadRegFromHW
-;
-; in:
-; pRegOp = pointer to REG_OP table
-; out:
-; return = register value
-;
-;---------------------------------------------------------------------------*/
+
USHORT ReadRegFromHW(REG_OP *pRegOp)
{
USHORT wValue = 0x0;
@@ -1403,33 +1274,33 @@ USHORT ReadRegFromHW(REG_OP *pRegOp)
{
if(pRegOp->RegGroup == CR)
{
- /*CR */
+
OutPort(COLOR_CRTC_INDEX,(pRegOp->RegIndex));
btemp = (UCHAR)InPort(COLOR_CRTC_DATA);
}
else
{
- /*SR */
+
OutPort(SEQ_INDEX,(pRegOp->RegIndex));
btemp = (UCHAR)InPort(SEQ_DATA);
}
bMasktemp = (pRegOp->RegMask);
- /* Mask the bit that we need. */
+
btemp &= bMasktemp;
- /* Shift all register into LSB. */
+
while(!(bMasktemp & BIT0))
{
bMasktemp = bMasktemp >> 1;
btemp = btemp >> 1;
}
- /* Shift the register and add in the value. */
+
wValue |= (((USHORT)btemp) << (pRegOp->RegShiftBit));
- /* Next register. */
+
pRegOp++;
}
@@ -1437,15 +1308,7 @@ USHORT ReadRegFromHW(REG_OP *pRegOp)
return wValue;
}
-/*----------------------------------------------------------------------------
-;
-; WriteRegToHW
-;
-; in:
-; pRegOp = pointer to REG_OP table
-; value = value to be written
-;
-;---------------------------------------------------------------------------*/
+
void WriteRegToHW(REG_OP *pRegOp, USHORT value)
{
UCHAR btemp, btemp1;
@@ -1459,18 +1322,18 @@ void WriteRegToHW(REG_OP *pRegOp, USHORT value)
bMasktemp = (pRegOp->RegMask);
- /* Shift all register into LSB. */
+
while(!(bMasktemp & BIT0))
{
bMasktemp = bMasktemp >> 1;
bCount ++;
}
- /* Calculate the value that we need to set into register. */
+
btemp = value >> (pRegOp->RegShiftBit);
btemp &= (bMasktemp);
- /* Shift the data bit into right position. */
+
if(!(pRegOp->RegMask & BIT0))
{
btemp = btemp << bCount;
@@ -1478,7 +1341,7 @@ void WriteRegToHW(REG_OP *pRegOp, USHORT value)
if(pRegOp->RegGroup == CR)
{
- /*CR */
+
OutPort(COLOR_CRTC_INDEX,(pRegOp->RegIndex));
btemp1 = (UCHAR)InPort(COLOR_CRTC_DATA);
btemp1 &= ~(pRegOp->RegMask);
@@ -1487,7 +1350,7 @@ void WriteRegToHW(REG_OP *pRegOp, USHORT value)
}
else
{
- /*SR */
+
OutPort(SEQ_INDEX,(pRegOp->RegIndex));
btemp1 = (UCHAR)InPort(SEQ_DATA);
btemp1 &= ~(pRegOp->RegMask);
@@ -1501,62 +1364,27 @@ void WriteRegToHW(REG_OP *pRegOp, USHORT value)
}
-/*----------------------------------------------------------------------------
-;
-; UnLockCR0ToCR7
-;
-; in:
-; none
-; out:
-; none
-;
-;---------------------------------------------------------------------------*/
+
void UnLockCR0ToCR7()
{
- /* CR11[7] = 0 */
+
SetCRReg(0x11, 0x00, BIT7);
}
-/*----------------------------------------------------------------------------
-;
-; LockCR0ToCR7
-;
-; in:
-; none
-; out:
-; none
-;
-;---------------------------------------------------------------------------*/
+
void LockCR0ToCR7()
{
- /* CR11[7] = 1 */
+
SetCRReg(0x11, 0x80, BIT7);
}
-/*----------------------------------------------------------------------------
-;
-; CheckForModeAvailable
-;
-; in:
-; ModeNum = mode no.
-; out:
-; return = true, if mode is available. Else, return false
-;
-;---------------------------------------------------------------------------*/
+
CI_STATUS CheckForModeAvailable(USHORT ModeNum)
{
MODE_INFO *pModeInfo = NULL;
return Get_MODE_INFO_From_VESA_Table(ModeNum, &pModeInfo);
}
-/*--------------------------------------------------------------------
-;
-; CheckForNewDeviceAvailable() -
-;
-; Input:
-; bDeviceIndex = device index
-; return:
-; true if device is supported
-;--------------------------------------------------------------------*/
+
CI_STATUS CheckForNewDeviceAvailable(UCHAR bDeviceIndex)
{
PORT_CONFIG *pDevicePortConfig;
@@ -1584,14 +1412,7 @@ void Display2TurnOffTX()
}
-/*----------------------------------------------------------------------------
-;
-; TurnOnDigitalPort
-;
-; in:
-; DisplayPath = device index
-;
-;---------------------------------------------------------------------------*/
+
void TurnOnDigitalPort(UCHAR bDeviceIndex)
{
PORT_CONFIG *pDevicePortConfig;
@@ -1619,14 +1440,7 @@ void TurnOnDigitalPort(UCHAR bDeviceIndex)
}
}
}
-/*----------------------------------------------------------------------------
-;
-; TurnOffDigitalPort
-;
-; in:
-; bDeviceIndex = device index
-;
-;---------------------------------------------------------------------------*/
+
void TurnOffDigitalPort(UCHAR bDeviceIndex)
{
PORT_CONFIG *pDevicePortConfig;
@@ -1654,17 +1468,7 @@ void TurnOffDigitalPort(UCHAR bDeviceIndex)
}
}
-/*-----------------------------------------------------------------------------
-;
-; GetPortConnectPath
-;
-; in:
-; PortType = 0: CRT port, 1: DVP1, 2: DVP2, 3: 24-bit DVP1+2
-; out:
-; return = 0 if port connecting on display1
-; = 1 if port connecting on display2
-;
-;-----------------------------------------------------------------------------*/
+
UCHAR GetPortConnectPath(UCHAR PortType)
{
UCHAR SR1F, PortMask;
@@ -1692,16 +1496,7 @@ UCHAR GetPortConnectPath(UCHAR PortType)
}
-/*----------------------------------------------------------------------------
-;
-; TransDevIDtoBit
-;
-; in:
-; DeviceIndex = device index
-; out:
-; return device bit
-;
-;---------------------------------------------------------------------------*/
+
USHORT TransDevIDtoBit(UCHAR DeviceIndex)
{
return (1 << (DeviceIndex - 1));
@@ -1837,18 +1632,7 @@ void Display2HWResetOn()
}
#endif
-/*----------------------------------------------------------------------------
-;
-; SerialLoadTable
-;
-; in:
-; pucDisplay1VESAModeInitRegs = pointer to start of table
-; (ucI2Cport = I2C port)
-; (ucI2CAddr = I2C address)
-; out:
-; *ppucTablePointer = table end + 1
-;
-;---------------------------------------------------------------------------*/
+
void SerialLoadTable(UCHAR **ppucTablePointer, UCHAR ucI2Cport, UCHAR ucI2CAddr)
{
UCHAR ucRegGroup;
@@ -1869,19 +1653,7 @@ void SerialLoadTable(UCHAR **ppucTablePointer, UCHAR ucI2Cport, UCHAR ucI2CAddr)
(*ppucTablePointer)++;
}
-/*---------------------
-;
-; SerialLoadRegBits
-;
-; in:
-; pucDisplay1VESAModeInitRegs = pointer to start of table
-; ucRegGroup = register group
-; (ucI2Cport = I2C device address)
-; (ucI2CAddr = I2C port)
-; out:
-; *ppucTablePointer = pointer to end of table +1
-;
-;----------------------*/
+
void SerialLoadRegBits(UCHAR **ppucTablePointer, UCHAR ucRegGroup, UCHAR ucI2Cport, UCHAR ucI2CAddr)
{
UCHAR ucRegIndex, ucRegValue, ucMask;
@@ -1915,19 +1687,7 @@ void SerialLoadRegBits(UCHAR **ppucTablePointer, UCHAR ucRegGroup, UCHAR ucI2Cpo
(*ppucTablePointer)++;
}
-/*---------------------
-;
-; SerialLoadReg
-;
-; in:
-; pucDisplay1VESAModeInitRegs = pointer to start of table
-; ucRegGroup = register group
-; (ucI2Cport = I2C device address)
-; (ucI2CAddr = I2C port)
-; out:
-; *ppucTablePointer = pointer to end of table +1
-;
-;----------------------*/
+
void SerialLoadReg(UCHAR **ppucTablePointer, UCHAR ucRegGroup, UCHAR ucI2Cport, UCHAR ucI2CAddr)
{
UCHAR ucRegIndex, ucRegValue;
@@ -1990,30 +1750,23 @@ void LoadDisplay1VESAModeInitRegs()
void VESASetBIOSData(USHORT ModeNum)
{
- /* no need to implement */
+
}
-/*----------------------------------------------------------------------------
-;
-; DisableDisplayPathAndDevice
-;
-; in:
-; bDisplayPath = display path
-;
-;---------------------------------------------------------------------------*/
+
void DisableDisplayPathAndDevice(UCHAR bDisplayPath)
{
UCHAR bDeviceIndex = Get_DEV_ID(bDisplayPath);
- /* disable device */
+
ControlPwrSeqOff(bDeviceIndex);
- /* turn off TX */
+
- /* disable port */
+
TurnOffDigitalPort(bDeviceIndex);
- /* disable display path */
+
SequencerOff(bDisplayPath);
}
@@ -2041,32 +1794,32 @@ CI_STATUS GetDevicePortConfig(UCHAR bDeviceIndex, PORT_CONFIG **ppDevicePortConf
void PowerSequenceOn()
{
- /* check if power sequence already on */
+
if (!(GetSRReg(0x11) & BIT0))
{
- /* Power Sequence Control Pad Output Enable */
+
SetSRReg(0x32, BIT1, BIT1);
- /* panel on */
+
SetSRReg(0x11, BIT0, BIT0);
- /* delay for power sequence done */
+
WaitPowerSequenceDone();
}
}
void PowerSequenceOff()
{
- /* check if power sequence already off */
+
if (GetSRReg(0x11) & BIT0)
{
- /* panel off */
+
SetSRReg(0x11, 0, BIT0);
- /* wait power sequence done */
+
WaitPowerSequenceDone();
- /* Power Sequence Control Pad Output Disable */
+
SetSRReg(0x32, 0, BIT1);
}
}
@@ -2096,14 +1849,14 @@ void SequencerOff(UCHAR bDisplayPath)
void ControlPwrSeqOn(UCHAR bDeviceIndex)
{
PORT_CONFIG *pDevicePortConfig;
- /* check if LCD or LCD2 */
+
if ((TransDevIDtoBit(bDeviceIndex) & (B_LCD+B_LCD2)) && (GetDevicePortConfig(bDeviceIndex, &pDevicePortConfig)))
{
if (pDevicePortConfig->Attribute & TX_PS)
{
if (pDevicePortConfig->TX_Enc_ID == TX_VT1636)
{
-/* VT1636PowerSequenceOnOn();*/
+
}
}
else if ((pDevicePortConfig->PortID == DVP1) || (pDevicePortConfig->PortID == DVP12))
@@ -2116,14 +1869,14 @@ void ControlPwrSeqOn(UCHAR bDeviceIndex)
void ControlPwrSeqOff(UCHAR bDeviceIndex)
{
PORT_CONFIG *pDevicePortConfig;
- /* check if LCD or LCD2 */
+
if ((TransDevIDtoBit(bDeviceIndex) & (B_LCD+B_LCD2)) && (GetDevicePortConfig(bDeviceIndex, &pDevicePortConfig)))
{
if (pDevicePortConfig->Attribute & TX_PS)
{
if (pDevicePortConfig->TX_Enc_ID == TX_VT1636)
{
-/* VT1636PowerSequenceOnOff();*/
+
}
}
else if ((pDevicePortConfig->PortID == DVP1) || (pDevicePortConfig->PortID == DVP12))
@@ -2132,16 +1885,7 @@ void ControlPwrSeqOff(UCHAR bDeviceIndex)
}
}
}
-/*----------------------------------------------------------------------------
-;
-; LongWait() - wait V sync of display1
-;
-; in:
-; none
-; out:
-; none
-;
-;---------------------------------------------------------------------------*/
+
void LongWait()
{
while (GetIS1Reg() & BIT3);
@@ -2316,7 +2060,7 @@ void EnableATTR()
OutPort(ATTR_DATA_WRITE, 0x20);
}
-/* Set Cr register value with Mask */
+
void SetCRReg(UCHAR bRegIndex, UCHAR bRegValue, UCHAR bMask)
{
UCHAR btemp = 0x0;
@@ -2339,7 +2083,7 @@ void SetCRReg(UCHAR bRegIndex, UCHAR bRegValue, UCHAR bMask)
return;
}
-/* Get Cr register value */
+
UCHAR GetCRReg(UCHAR bRegIndex)
{
UCHAR btemp = 0x0;
@@ -2350,7 +2094,7 @@ UCHAR GetCRReg(UCHAR bRegIndex)
return btemp;
}
-/* Set Sr register value with Mask */
+
void SetSRReg(UCHAR bRegIndex, UCHAR bRegValue, UCHAR bMask)
{
UCHAR btemp = 0x0;
@@ -2373,7 +2117,7 @@ void SetSRReg(UCHAR bRegIndex, UCHAR bRegValue, UCHAR bMask)
return;
}
-/* Get Sr register value */
+
UCHAR GetSRReg(UCHAR bRegIndex)
{
UCHAR btemp = 0x0;
@@ -2401,7 +2145,7 @@ UCHAR GetARReg(UCHAR index)
return bTmp;
}
-/* Set Gr register value with Mask */
+
void SetGRReg(UCHAR bRegIndex, UCHAR bRegValue, UCHAR bMask)
{
UCHAR btemp = 0x0;
@@ -2434,16 +2178,16 @@ UCHAR GetIS1Reg()
return InPort(COLOR_INPUT_STATUS1_READ);
}
-/* Clear frame buffer */
+
void ClearFrameBuffer(UCHAR DisplayPath,ULONG *pFrameBufferBase, MODE_INFO *pModeInfo, UCHAR ucColorDepth)
{
ULONG dwWidth = (ULONG)pModeInfo->H_Size, dwHeight = (ULONG)pModeInfo->V_Size, dwFactor = 0;
ULONG i = 0;
xf86DrvMsgVerb(0, X_INFO, DefaultLevel, "==Enter ClearFrameBuffer()==\n");
- /* get display1/2 starting address */
- /* Check the color depth */
+
+
switch(ucColorDepth)
{
case 8:
@@ -2456,7 +2200,7 @@ void ClearFrameBuffer(UCHAR DisplayPath,ULONG *pFrameBufferBase, MODE_INFO *pMod
return;
}
- /* Clear */
+
for(i = 0;i<((dwWidth*dwHeight)/dwFactor);i++)
{
*(pFrameBufferBase+i) = 0x00000000;
@@ -2473,16 +2217,7 @@ ULONG Difference(ULONG Value1, ULONG Value2)
return (Value2 - Value1);
}
-/*----------------------------------------------------------------------------
-;
-; ReadScratch()
-;
-; in:
-; Index = scratch index
-; out:
-; return = scratch data aligned to LSB
-;
-;---------------------------------------------------------------------------*/
+
UCHAR ReadScratch(USHORT IndexMask)
{
UCHAR Index = (UCHAR)(IndexMask >> 8);
@@ -2497,16 +2232,7 @@ UCHAR ReadScratch(USHORT IndexMask)
return RetValue;
}
-/*----------------------------------------------------------------------------
-;
-; WriteScratch()
-;
-; in:
-; Index = scratch index
-; Data = data to be written
-; out:
-; none
-;---------------------------------------------------------------------------*/
+
void WriteScratch(USHORT IndexMask, UCHAR Data)
{
UCHAR Index = (UCHAR)(IndexMask >> 8);
@@ -2517,17 +2243,7 @@ void WriteScratch(USHORT IndexMask, UCHAR Data)
SetCRReg(Index, Data, Mask);
}
-/*----------------------------------------------------------------------------
-;
-; AlignDataToLSB()
-;
-; in:
-; Data = data to be aligned
-; Mask = mask of data
-; out:
-; return = aligned data
-;
-;---------------------------------------------------------------------------*/
+
UCHAR AlignDataToLSB(UCHAR bData, UCHAR bMask)
{
bData &= bMask;
@@ -2541,17 +2257,7 @@ UCHAR AlignDataToLSB(UCHAR bData, UCHAR bMask)
return bData;
}
-/*----------------------------------------------------------------------------
-;
-; AlignDataToMask()
-;
-; in:
-; Data = data to be aligned
-; Mask = mask of data
-; out:
-; return = aligned data
-;
-;---------------------------------------------------------------------------*/
+
UCHAR AlignDataToMask(UCHAR bData, UCHAR bMask)
{
while ((bMask & BIT0) == 0)
@@ -2563,16 +2269,7 @@ UCHAR AlignDataToMask(UCHAR bData, UCHAR bMask)
return bData;
}
-/*----------------------------------------------------------------------------
-;
-; SetDPMS -
-; Input:
-; DPMSState = DPMS_ON, DPMS_STANDBY, DPMS_SUSPEND, DPMS_OFF
-; DisplayPath
-; Output:
-; none
-;
-;---------------------------------------------------------------------------*/
+
void SetDPMS(UCHAR DPMSState, UCHAR DisplayPath)
{
UCHAR RegValue;
@@ -2588,46 +2285,28 @@ void SetDPMS(UCHAR DPMSState, UCHAR DisplayPath)
SetCRReg(0x3E, RegValue, BIT1+BIT0);
}
-/*----------------------------------------------------------------------------
-;
-; DetectMonitor()
-;
-; in:
-; none
-; out:
-; return = true if CRT connected
-;
-;---------------------------------------------------------------------------*/
+
CI_STATUS DetectMonitor()
{
CI_STATUS ConnectStatus;
- /* CRA9 = sense data = 0x80 */
+
SetCRReg(0xA9, 0x80, 0xFF);
- /* CRA8[6] = 1, start DAC sense */
+
SetCRReg(0xA8, BIT6, BIT6);
- /* wait H sync */
+
WaitDisplayPeriod();
- /* ISR0[4] = 1, CRT attached */
+
ConnectStatus = ((InPort(INPUT_STATUS_0_READ) & BIT4) ? true : false);
SetCRReg(0xA8, 0x00, BIT6);
return ConnectStatus;
}
-/*----------------------------------------------------------------------------
-;
-; WaitDisplayPeriod() - wait H sync of display1
-;
-; in:
-; none
-; out:
-; none
-;
-;---------------------------------------------------------------------------*/
+
void WaitDisplayPeriod()
{
while ((InPort(COLOR_INPUT_STATUS1_READ)&BIT0) == 1);
@@ -2635,36 +2314,17 @@ void WaitDisplayPeriod()
while ((InPort(COLOR_INPUT_STATUS1_READ)&BIT0) == 0);
}
-/*----------------------------------------------------------------------------
-;
-; WaitPowerSequenceDone() - SR32[2] = 1, power sequence on complete
-; = 0, power sequence off complete
-;
-; Input:
-; none
-; Output:
-; none
-;
-;---------------------------------------------------------------------------*/
+
void WaitPowerSequenceDone()
{
UCHAR SR32;
SR32 = GetSRReg(0x32);
- /* loop while power sequence status not changed */
+
while(SR32 == GetSRReg(0x32));
}
-/*--------------------------------------------------------------------
-;
-; CheckForDSTNPanel() -
-;
-; Input:
-; bDeviceIndex = device index
-; return:
-; true if device is DSTN panel
-;
-;--------------------------------------------------------------------*/
+
CI_STATUS CheckForDSTNPanel(UCHAR bDeviceIndex)
{
PORT_CONFIG *pDevicePortConfig;
@@ -2686,15 +2346,7 @@ CI_STATUS CheckForDSTNPanel(UCHAR bDeviceIndex)
return false;
}
}
-/*-------------------------------------------------------------------
-;
-; GetVESAMEMSize()
-; Input:
-; none
-; Output:
-; return VESA Memory Size (Unit: MB)
-;
-;------------------------------------------------------------------*/
+
USHORT GetVESAMEMSize()
{
UCHAR bHWStrapping;
@@ -2759,76 +2411,76 @@ CI_STATUS VBE_SetMode(CBIOS_Extension *pCBIOSExtension)
#endif
return true;
}
- /* update mode no */
+
Set_VESA_MODE(wModeNum, DISP1);
- /* cut data */
+
SequencerOff(DISP1);
- /* disable scaler */
+
TurnOffScaler(DISP1);
if (bCurDeviceID != bNewDeviceID)
{
- /* control power sequence off */
+
ControlPwrSeqOff(bCurDeviceID);
- /* turn off TX if necessary */
+
- /* turn off digital port */
+
TurnOffDigitalPort(bCurDeviceID);
- /* update scratch IDX_IGA1_DEV_ID */
+
Set_DEV_ID(bNewDeviceID, DISP1);
}
- /* update BDA? */
+
- /* load Display1 VESA Mode init registers */
+
LoadDisplay1VESAModeInitRegs();
- /* load timing on display1 */
+
LoadTiming(DISP1, wModeNum);
- /* set pitch */
+
GetModePitch(wModeNum, &wPitch);
SetPitch(DISP1, wPitch);
- /* set color depth */
- xf86DrvMsgVerb(0, X_INFO, InfoLevel, " /* set color depth */\n");
+
+ xf86DrvMsgVerb(0, X_INFO, InfoLevel, " \n");
Get_MODE_INFO(wModeNum, &pModeInfo);
GetModeColorDepth(wModeNum, pModeInfo, &bColorDepth);
SetColorDepth(DISP1, bColorDepth);
- /* load font */
+
- /* load LUT */
+
- /* clear FB */
- xf86DrvMsgVerb(0, X_INFO, InfoLevel, " /* clear FB */\n");
+
+ xf86DrvMsgVerb(0, X_INFO, InfoLevel, " \n");
if(!(pCBIOSExtension->pCBiosArguments->reg.x.BX & BIT15))
{
ClearFrameBuffer(DISP1,(ULONG*)(pCBIOSExtension->VideoVirtualAddress),pModeInfo,bColorDepth);
}
- /* set FIFO */
- xf86DrvMsgVerb(0, X_INFO, InfoLevel, " /* set FIFO */\n");
+
+ xf86DrvMsgVerb(0, X_INFO, InfoLevel, " \n");
SetFIFO(DISP1);
- /* config digital port */
- xf86DrvMsgVerb(0, X_INFO, InfoLevel, " /* config difital port */\n");
+
+ xf86DrvMsgVerb(0, X_INFO, InfoLevel, " \n");
ConfigDigitalPort(DISP1);
TurnOnDigitalPort(bNewDeviceID);
- /* Turu on TX */
+
- /* turn on power sequence if necessary */
- xf86DrvMsgVerb(0, X_INFO, InfoLevel, " /* turn on power sequence if necessary */\n");
+
+ xf86DrvMsgVerb(0, X_INFO, InfoLevel, " \n");
ControlPwrSeqOn(bNewDeviceID);
- /* turn on sequencer */
- xf86DrvMsgVerb(0, X_INFO, InfoLevel, " /* turn on sequencer */\n");
+
+ xf86DrvMsgVerb(0, X_INFO, InfoLevel, " \n");
SequencerOn(DISP1);
SetVBERerurnStatus(VBEFunctionCallSuccessful, pCBIOSExtension->pCBiosArguments);
@@ -2838,35 +2490,7 @@ CI_STATUS VBE_SetMode(CBIOS_Extension *pCBIOSExtension)
#endif
return true;
}
-/*-------------------------------------------------------------------
-;
-; VBE_SetGetScanLineLength()
-;
-; Input1: set/get display2 pitch
-; pCBiosArguments->AX = 0x4F06
-; BL = 0x00: Set Scan Line Length in Pixels
-; 0x01: Get Scan Line Length
-; 0x02: Set Scan Line Length in Bytes
-; 0x03: Get Maximum Scan Line Length
-; CX = Desired Width in Pixels if BL = 00
-; Desired Width in Bytes if BL = 02
-;
-; Input2: set/get display2 pitch
-; pCBiosArguments->AX = 0x4F14
-; BL = 0x00: Set Scan Line Length in Pixels
-; 0x01: Get Scan Line Length
-; 0x02: Set Scan Line in Bytes
-; 0x03: Get Maximum Scan Line Length
-; CX = Desired Width in Pixels if BL = 00
-; Desired Width in Bytes if BL = 02
-;
-; Output:
-; pCBiosArguments->AX = VBE Return Status
-; BX = Bytes Per Scan Line
-; CX = Actual Pixels Pet Scan Line (truncated to nearest complete pixel)
-; DX = Maximum Number of Scan Lines
-;
-;------------------------------------------------------------------*/
+
CI_STATUS VBE_SetGetScanLineLength (CBIOS_ARGUMENTS *pCBiosArguments)
{
USHORT wModeNum;
@@ -2876,7 +2500,7 @@ CI_STATUS VBE_SetGetScanLineLength (CBIOS_ARGUMENTS *pCBiosArguments)
ULONG dwVESAMemSizeInBytes;
USHORT wMaxPitchInBytes, wCurrentVDispEnd;
USHORT VBEReturnStatus = VBEFunctionCallFail;
- USHORT wPitchToBeSet = pCBiosArguments->reg.x.CX; /* maybe in pixel or in byte */
+ USHORT wPitchToBeSet = pCBiosArguments->reg.x.CX;
#if CBIOS_DEBUG
xf86DrvMsgVerb(0, X_INFO, DefaultLevel, "==Entry VBE_SetGetScanLineLength== \n");
@@ -2912,7 +2536,7 @@ CI_STATUS VBE_SetGetScanLineLength (CBIOS_ARGUMENTS *pCBiosArguments)
wCurrentVDispEnd = GetVDisplayEnd(bDispalyPath);
- /* align pitch to 8-byte */
+
if (((ULONG)(dwVESAMemSizeInBytes / (ULONG)wCurrentVDispEnd) & 0xFFFF0000) == 0)
{
wMaxPitchInBytes = (USHORT)(dwVESAMemSizeInBytes / (ULONG)wCurrentVDispEnd) & 0xFFF8;
@@ -2931,7 +2555,7 @@ CI_STATUS VBE_SetGetScanLineLength (CBIOS_ARGUMENTS *pCBiosArguments)
{
if (pCBiosArguments->reg.lh.BL == 0)
{
- /* transform pitch size from pixels to bytes */
+
wPitchToBeSet <<= (bColorDepth >> 4);
}
@@ -2948,16 +2572,16 @@ CI_STATUS VBE_SetGetScanLineLength (CBIOS_ARGUMENTS *pCBiosArguments)
if (pCBiosArguments->reg.lh.BL == 3)
{
- /* get maximum pitch in bytes */
+
pCBiosArguments->reg.x.BX = wMaxPitchInBytes;
}
else
{
- /* get current pitch in bytes */
+
pCBiosArguments->reg.x.BX =GetPitch(bDispalyPath);
}
- /* get current pitch in pixels */
+
pCBiosArguments->reg.x.CX = pCBiosArguments->reg.x.BX >> (bColorDepth >> 4);
pCBiosArguments->reg.x.DX = (dwVESAMemSizeInBytes / (USHORT)pCBiosArguments->reg.x.BX);
@@ -2973,54 +2597,78 @@ CI_STATUS VBE_SetGetScanLineLength (CBIOS_ARGUMENTS *pCBiosArguments)
CI_STATUS OEM_QueryBiosInfo (CBIOS_ARGUMENTS *pCBiosArguments)
{
USHORT VBEReturnStatus = VBEFunctionCallFail;
+ char bProjCode;
+ int wCustomerCode;
+ char bRelVersion;
+ char szPrj[2], szMajor[3], szMinor[3] ;
+ int wYear;
+ char bMonth, bDay;
+ char szYear[5], szMonth[3], szDay[3];
+ char i,ucCRAA,ucCRAB;
+
#if CBIOS_DEBUG
xf86DrvMsgVerb(0, X_INFO, DefaultLevel, "==Entry OEM_QueryBiosInfo()== \n");
#endif
- /* bx[15:0] = version number */
-
- /*-------------------EBX PART--------------------;
- ; ;
- ;[31:24] : Branch version number
- ;[23:8] : Customer Index
- ;[7:0] : Release version number
- */
-
-
- /*-------------------ECX PART--------------------;
- ; ;
- ; [31:18] : Reserved
- ; [17:16] : DRAM bus width
- ; 00 : 16bit
- ; 01 : 32bit
- ; 10 : 64bit
- ; 11 : reserved
- ; [15:4] : memory size in 256k unit
- ; [3:0] : Memory data rate
- ; 000 : DDR333
- ; 001 : DDR400
- ; 010 : DDR533
- ; 011 : DDR667
- ; 100 : DDR800
- ; xxx : Reserved
- */
-
-
- /*-------------------EDX PART--------------------;
- ; ;
- ; VGA BIOS Build TIME ;
- ;[31:16] : Year
- ;[15: 8] : Month
- ;[ 7: 0] : Day
- */
-
-
-
- /*-------------------SI PART--------------------;
- ; ;
- ; SI = supported device
- */
+
+
+
+
+
+ if (BiosInfoData != NULL)
+ {
+ szPrj[1] = szMajor[2] = szMinor[2] = '\0';
+ strncpy(szPrj, ((char *)BiosInfoData)+0x10, 1);
+ strncpy(szMajor, ((char *)BiosInfoData)+0x12, 2);
+ strncpy(szMinor, ((char *)BiosInfoData)+0x15, 2);
+
+
+ bProjCode = atoi(szPrj) ;
+ wCustomerCode = atoi(szMajor);
+ bRelVersion = atoi(szMinor);
+ pCBiosArguments->reg.ex.EBX = (bProjCode<<24) | (wCustomerCode<8) | bRelVersion;
+
+#if CBIOS_DEBUG
+ xf86DrvMsgVerb(0, X_INFO, InfoLevel, "Bios version : %d\n",pCBiosArguments->reg.ex.EBX);
+#endif
+ }
+
+
+
+
+
+
+ ucCRAA = GetCRReg(0xAA);
+ pCBiosArguments->reg.ex.ECX = ucCRAA;
+ pCBiosArguments->reg.ex.ECX <<= 6;
+
+
+ ucCRAB = GetCRReg(0xAB);
+ ucCRAB &= BIT0 + BIT1 + BIT2;
+ pCBiosArguments->reg.ex.ECX |= ucCRAB;
+
+
+
+
+ if (BiosInfoData != NULL)
+ {
+ szMonth[2] = szDay[2] = szYear[4] = '\0';
+ strncpy(szMonth, ((char *)BiosInfoData)+0x47, 2);
+ strncpy(szDay, ((char *)BiosInfoData)+0x4a, 2);
+ strncpy(szYear, ((char *)BiosInfoData)+0x56, 4);
+
+ wYear = atoi(szYear);
+ bMonth = atoi(szMonth);
+ bDay = atoi(szDay);
+ pCBiosArguments->reg.ex.EDX = (wYear<<16) | (bMonth<8) | bDay;
+
+#if CBIOS_DEBUG
+ xf86DrvMsgVerb(0, X_INFO, InfoLevel, "Bios date : %d\n",pCBiosArguments->reg.ex.EDX);
+#endif
+ }
+
+
pCBiosArguments->reg.x.SI = 0;
if(bCRTSUPPORT)
{
@@ -3039,9 +2687,7 @@ CI_STATUS OEM_QueryBiosInfo (CBIOS_ARGUMENTS *pCBiosArguments)
pCBiosArguments->reg.x.SI |= B_DVI;
}
- /*-------------------EAX PART--------------------;
- ; ;
- */
+
VBEReturnStatus = VBEFunctionCallSuccessful;
SetVBERerurnStatus(VBEReturnStatus, pCBiosArguments);
@@ -3052,7 +2698,7 @@ CI_STATUS OEM_QueryBiosInfo (CBIOS_ARGUMENTS *pCBiosArguments)
}
CI_STATUS OEM_QueryBiosCaps (CBIOS_ARGUMENTS *pCBiosArguments)
{
- /* VBIOS not implemented */
+
#if CBIOS_DEBUG
xf86DrvMsgVerb(0, X_INFO, DefaultLevel, "==Entry OEM_QueryBiosCaps()== \n");
#endif
@@ -3099,10 +2745,10 @@ CI_STATUS OEM_QueryDisplayPathInfo (CBIOS_ARGUMENTS *pCBiosArguments)
pCBiosArguments->reg.lh.BL |= Get_NEW_DEV_ID(DISP1);
pCBiosArguments->reg.ex.EBX <<= 2;
- ScratchTempData = GetSRReg(0x58); /* First Display scaling control */
+ ScratchTempData = GetSRReg(0x58);
if (ScratchTempData & BIT0)
{
- ScratchTempData &= (BIT2 + BIT1); /* reserve H and V scaling control bits */
+ ScratchTempData &= (BIT2 + BIT1);
ScratchTempData >>= 1;
pCBiosArguments->reg.lh.BL |= ScratchTempData;
}
@@ -3122,10 +2768,10 @@ CI_STATUS OEM_QueryDisplayPathInfo (CBIOS_ARGUMENTS *pCBiosArguments)
pCBiosArguments->reg.lh.CL |= Get_NEW_DEV_ID(DISP1);
pCBiosArguments->reg.ex.ECX <<= 2;
- ScratchTempData = GetSRReg(0x50); /* Second Display scaling control */
+ ScratchTempData = GetSRReg(0x50);
if (ScratchTempData & BIT0)
{
- ScratchTempData &= (BIT2 + BIT1); /* reserve H and V scaling control bits */
+ ScratchTempData &= (BIT2 + BIT1);
ScratchTempData >>= 1;
pCBiosArguments->reg.lh.BL |= ScratchTempData;
}
@@ -3165,7 +2811,7 @@ CI_STATUS OEM_QueryDeviceConnectStatus (CBIOS_ARGUMENTS *pCBiosArguments)
}
else
{
- /* Detect Monitor From EDID */
+
}
if (bLCDSUPPORT)
@@ -3184,13 +2830,13 @@ CI_STATUS OEM_QueryDeviceConnectStatus (CBIOS_ARGUMENTS *pCBiosArguments)
}
else
{
- /* Query DVI Connect Status */
+
}
}
if (bTVSUPPORT)
{
- /* TV DAC Sense */
+
}
SetVBERerurnStatus(VBEFunctionCallSuccessful, pCBiosArguments);
@@ -3251,26 +2897,26 @@ CI_STATUS OEM_QuerySupportedMode (CBIOS_ARGUMENTS *pCBiosArguments)
{
if (wSerialNumber == 0)
{
- /* BX = VESA mode number */
+
pCBiosArguments->reg.x.BX = wModeNum;
xf86DrvMsgVerb(0, X_INFO, InternalLevel, "mode num = 0x%x \n", pCBiosArguments->reg.x.BX);
- /* CL = Color depth */
+
GetModeColorDepth(wModeNum, pModeInfo, &pCBiosArguments->reg.lh.CL);
xf86DrvMsgVerb(0, X_INFO, InternalLevel, "color depth = %d \n", pCBiosArguments->reg.lh.CL);
- /* CH = Refresh rate index */
+
pCBiosArguments->reg.lh.CH = pRRateTable->RRate_ID;
xf86DrvMsgVerb(0, X_INFO, InternalLevel, "RRate ID = %d \n", pCBiosArguments->reg.lh.CH);
- /* EDX = mode resolution */
+
pCBiosArguments->reg.ex.EDX = (((ULONG)pModeInfo->V_Size) << 16) | (ULONG)pModeInfo->H_Size;
xf86DrvMsgVerb(0, X_INFO, InternalLevel, "H x V = %d x %d \n", pCBiosArguments->reg.x.DX, pCBiosArguments->reg.ex.EDX>>16);
- /* ESI = attribute */
+
pCBiosArguments->reg.x.SI = pRRateTable->Attribute;
- /* EDI = pixel clock */
+
pCBiosArguments->reg.ex.EDI = pRRateTable->Clock;
xf86DrvMsgVerb(0, X_INFO, InternalLevel, "dot clk = %dkhz \n", pCBiosArguments->reg.ex.EDI);
@@ -3330,26 +2976,26 @@ CI_STATUS OEM_QuerySupportedMode (CBIOS_ARGUMENTS *pCBiosArguments)
{
if (wSerialNumber == 0)
{
- /* BX = VESA mode number */
+
pCBiosArguments->reg.x.BX = wModeNum;
xf86DrvMsgVerb(0, X_INFO, InternalLevel, "mode num = 0x%x \n", pCBiosArguments->reg.x.BX);
- /* CL = Color depth */
+
GetModeColorDepth(wModeNum, pModeInfo, &pCBiosArguments->reg.lh.CL);
xf86DrvMsgVerb(0, X_INFO, InternalLevel, "color depth = %d \n", pCBiosArguments->reg.lh.CL);
- /* CH = Refresh rate index */
+
pCBiosArguments->reg.lh.CH = pRRateTable->RRate_ID;
xf86DrvMsgVerb(0, X_INFO, InternalLevel, "RRate ID = %d \n", pCBiosArguments->reg.lh.CH);
- /* EDX = mode resolution */
+
pCBiosArguments->reg.ex.EDX = (((ULONG)pModeInfo->V_Size) << 16) | (ULONG)pModeInfo->H_Size;
xf86DrvMsgVerb(0, X_INFO, InternalLevel, "H x V = %d x %d \n", pCBiosArguments->reg.x.DX, pCBiosArguments->reg.ex.EDX>>16);
- /* ESI = attribute */
+
pCBiosArguments->reg.x.SI = pRRateTable->Attribute;
- /* EDI = pixel clock */
+
pCBiosArguments->reg.ex.EDI = pRRateTable->Clock;
xf86DrvMsgVerb(0, X_INFO, InternalLevel, "dot clk = %dkhz \n", pCBiosArguments->reg.ex.EDI);
@@ -3418,19 +3064,19 @@ CI_STATUS OEM_QueryLCDPanelSizeMode (CBIOS_ARGUMENTS *pCBiosArguments)
return true;
}
- /* BX = VESA mode number */
+
pCBiosArguments->reg.x.BX = wModeNum;
- /* CH = Refresh rate index */
+
pCBiosArguments->reg.lh.CH = pPanelTable->Timing.RRate_ID;
- /* EDX = mode resolution */
+
pCBiosArguments->reg.ex.EDX = (ULONG)pModeInfo->H_Size | ((ULONG)pModeInfo->V_Size) << 16;
- /* SI = attribute */
+
pCBiosArguments->reg.x.SI = pPanelTable->Timing.Attribute;
- /* EDI = pixel clock */
+
pCBiosArguments->reg.ex.EDI = pPanelTable->Timing.Clock;
SetVBERerurnStatus (VBEFunctionCallSuccessful, pCBiosArguments);
@@ -3495,7 +3141,7 @@ CI_STATUS OEM_SetActiveDisplayDevice (CBIOS_ARGUMENTS *pCBiosArguments)
xf86DrvMsgVerb(0, X_INFO, DefaultLevel, "==Entry OEM_SetActiveDisplayDevice()== \n");
#endif
- /* check if new device is available */
+
if ((!CheckForNewDeviceAvailable(bNewDeviceIndex1)&& (bNewDeviceIndex1!=0)) || (!CheckForNewDeviceAvailable(bNewDeviceIndex2)&& (bNewDeviceIndex2!=0)))
{
SetVBERerurnStatus(VBEFunctionCallFail, pCBiosArguments);
@@ -3560,7 +3206,7 @@ CI_STATUS OEM_SetVESAModeForDisplay2 (CBIOS_Extension *pCBIOSExtension)
bCurDeviceID = Get_DEV_ID(DISP2);
bNewDeviceID = Get_NEW_DEV_ID(DISP2);
- /* check if mode is supported no matter which device is preferred */
+
if(!Get_MODE_INFO(wModeNum, &pModeInfo))
{
SetVBERerurnStatus(VBEFunctionCallFail, pCBIOSExtension->pCBiosArguments);
@@ -3569,64 +3215,64 @@ CI_STATUS OEM_SetVESAModeForDisplay2 (CBIOS_Extension *pCBIOSExtension)
#endif
return true;
}
- /* update mode no */
+
Set_VESA_MODE(wModeNum, DISP2);
- /* cut data */
+
SequencerOff(DISP2);
- /* disable scaler */
+
TurnOffScaler(DISP2);
if (bCurDeviceID != bNewDeviceID)
{
- /* control power sequence off */
+
ControlPwrSeqOff(bCurDeviceID);
- /* turn off TX if necessary */
+
- /* turn off digital port */
+
TurnOffDigitalPort(bCurDeviceID);
- /* update scratch IDX_IGA2_DEV_ID */
+
Set_DEV_ID(bNewDeviceID, DISP2);
}
- /* load Display2 VESA Mode init registers??*/
- /* load timing on display2 */
+
+
LoadTiming(DISP2, wModeNum);
- /* set pitch */
+
GetModePitch(wModeNum, &wPitch);
SetPitch(DISP2, wPitch);
- /* set color depth */
+
Get_MODE_INFO(wModeNum, &pModeInfo);
GetModeColorDepth(wModeNum, pModeInfo, &bColorDepth);
SetColorDepth(DISP2, bColorDepth);
- /* load font */
+
- /* load LUT */
+
- /* clear FB */
+
if(!(pCBIOSExtension->pCBiosArguments->reg.x.CX & BIT15))
{
ClearFrameBuffer(DISP2,(ULONG*)(pCBIOSExtension->VideoVirtualAddress),pModeInfo,bColorDepth);
}
- /* set FIFO */
+
SetFIFO(DISP2);
- /* config digital port */
+
ConfigDigitalPort(DISP2);
TurnOnDigitalPort(bNewDeviceID);
- /* Turu on TX */
+
- /* turn on power sequence if necessary */
+
ControlPwrSeqOn(bNewDeviceID);
SequencerOn(DISP2);
@@ -3753,27 +3399,27 @@ CI_STATUS OEM_VideoPOST (CBIOS_ARGUMENTS *pCBiosArguments)
xf86DrvMsgVerb(0, X_INFO, DefaultLevel, "==Entry OEM_VideoPOST()== \n");
#endif
- /* Enable VGA */
+
btemp = InPort(RIO_VGA_ENABLE);
btemp |= 1;
OutPort(RIO_VGA_ENABLE,btemp);
- /* Select 3D4 as CRTC I/O base & Add memory access */
+
btemp = InPort(MISC_READ);
btemp |= 3;
OutPort(MISC_WRITE,btemp);
- /* Open write key */
+
SetCRReg(0x80, 0xA8, 0xFF);
- /* Clear Scratch pad */
+
for(i = 0x81;i < 0x9F;i++)
{
SetCRReg(i, 0x00, 0xFF);
}
- /* Load DRAM timing */
- /* Get HW Trapping */
+
+
btemp = GetCRReg(0xAB);
if((btemp & 0x3) == 0x3)
{
@@ -3782,43 +3428,43 @@ CI_STATUS OEM_VideoPOST (CBIOS_ARGUMENTS *pCBiosArguments)
if(bDDRII400)
{
- /* Set memory PLL(Memory clock:200MHz NS:0x1B, MS:0x00, RS:0x02) */
+
SetCRReg(0xD9, 0x00, 0x80);
SetCRReg(0xD8, 0x9B, 0xFF);
}
else
{
- /* Set memory PLL(Memory clock:266MHz NS:0x38, MS:0x00, RS:0x01) */
+
SetCRReg(0xD9, 0x80, 0x80);
SetCRReg(0xD8, 0x78, 0xFF);
}
- /* Fire memory PLL timing setting */
- /* btemp = GetCRReg(0xBB); */
+
+
btemp = 0x00;
SetCRReg(0xBB, btemp, 0xFF);
- /* Open LCK PLL */
- /* SetCRReg(0xB4, 0x01, 0x01); */
+
+
- /* Load extend table */
+
SerialLoadTable(&pucPOSTInItRegs, 0, 0);
- /* Write the default disp1 scratch pad as CRT */
+
Set_NEW_DEV_ID(0, DISP1);
if(bDDRII400)
{
- /* Load DDRII400 timing table. */
+
SerialLoadTable(&pucDDRII400Tbl, 0, 0);
}
else
{
- /* Load DDRII533 timing table. */
+
SerialLoadTable(&pucDDRII533Tbl, 0, 0);
}
- /* Wait for DDRII setting */
+
do{
btemp = GetCRReg(0x5D);
btemp &= 0x80;
@@ -3826,9 +3472,9 @@ CI_STATUS OEM_VideoPOST (CBIOS_ARGUMENTS *pCBiosArguments)
btemp1 &= 0x01;
}while((btemp != 0x80)||(btemp1 != 0x01));
- /* Set the other registers */
+
SerialLoadTable(&pucExtendRegs2, 0, 0);
- /* SetDCC */
+
#if CBIOS_DEBUG
xf86DrvMsgVerb(0, X_INFO, DefaultLevel, "==Exit OEM_VideoPOST()== \n");
#endif
@@ -3873,15 +3519,18 @@ CI_STATUS OEM_CINT10DataInit (CBIOS_ARGUMENTS *pCBiosArguments)
ParseTable("PCIR", (UCHAR*)pCBiosArguments->reg.ex.ECX, (UCHAR**)(&PCIDataStruct));
xf86DrvMsgVerb(0, X_INFO, InfoLevel, "PCI Data Struct = %x", PCIDataStruct);
+ BiosInfoData = (UCHAR*)pCBiosArguments->reg.ex.ECX;
+ xf86DrvMsgVerb(0, X_INFO, InfoLevel, "Bios info data (header) = %x", BiosInfoData);
+
ParseTable("D1INIT", (UCHAR*)pCBiosArguments->reg.ex.ECX, (UCHAR**)(&Display1VESAModeInitRegs));
xf86DrvMsgVerb(0, X_INFO, InfoLevel, "Display1 VESA Mode Init Regs = %x", Display1VESAModeInitRegs);
SetDeviceSupport();
#if 0
- ParseTable("??????", &ExtendRegs); // POST init table
- ParseTable("??????", &ExtendRegs2); // POST init table
- ParseTable("??????", &DDRII400Tbl); // DDR400 DRAM table
- ParseTable("??????", &DDRII533Tbl); // DDR533 DRAM table
+ ParseTable("??????", &ExtendRegs);
+ ParseTable("??????", &ExtendRegs2);
+ ParseTable("??????", &DDRII400Tbl);
+ ParseTable("??????", &DDRII533Tbl);
#endif
SetVBERerurnStatus(VBEFunctionCallSuccessful, pCBiosArguments);
}
@@ -3897,7 +3546,7 @@ CI_STATUS CInt10(CBIOS_Extension *pCBIOSExtension)
#endif
- /* Fill related IO address */
+
Relocate_IOAddress = pCBIOSExtension->IOAddress;
switch(pCBIOSExtension->pCBiosArguments->reg.x.AX)
@@ -3913,28 +3562,28 @@ CI_STATUS CInt10(CBIOS_Extension *pCBIOSExtension)
case OEMFunction:
switch(pCBIOSExtension->pCBiosArguments->reg.x.BX)
{
- case QueryBiosInfo: /* 0000 */
+ case QueryBiosInfo:
CInt10_Status = OEM_QueryBiosInfo(pCBIOSExtension->pCBiosArguments);
break;
- case QueryBiosCaps: /* 0001 */
+ case QueryBiosCaps:
CInt10_Status = OEM_QueryBiosCaps(pCBIOSExtension->pCBiosArguments);
break;
- case QueryExternalDeviceInfo: /* 0100 */
+ case QueryExternalDeviceInfo:
CInt10_Status = OEM_QueryExternalDeviceInfo(pCBIOSExtension->pCBiosArguments);
break;
- case QueryDisplayPathInfo: /* 0200 */
+ case QueryDisplayPathInfo:
CInt10_Status = OEM_QueryDisplayPathInfo(pCBIOSExtension->pCBiosArguments);
break;
- case QueryDeviceConnectStatus: /* 0201 */
+ case QueryDeviceConnectStatus:
CInt10_Status = OEM_QueryDeviceConnectStatus(pCBIOSExtension->pCBiosArguments);
break;
- case QuerySupportedMode: /* 0202 */
+ case QuerySupportedMode:
CInt10_Status = OEM_QuerySupportedMode(pCBIOSExtension->pCBiosArguments);
break;
- case QueryLCDPanelSizeMode: /* 0203 */
+ case QueryLCDPanelSizeMode:
CInt10_Status = OEM_QueryLCDPanelSizeMode(pCBIOSExtension->pCBiosArguments);
break;
- case QueryLCDPWMLevel: /* 0301 */
+ case QueryLCDPWMLevel:
CInt10_Status = OEM_QueryLCDPWMLevel(pCBIOSExtension->pCBiosArguments);
break;
case QueryTVConfiguration:
@@ -3954,20 +3603,20 @@ CI_STATUS CInt10(CBIOS_Extension *pCBIOSExtension)
CInt10_Status = VBE_SetGetScanLineLength(pCBIOSExtension->pCBiosArguments);
break;
- case SetActiveDisplayDevice: /* 8200 */
+ case SetActiveDisplayDevice:
CInt10_Status = OEM_SetActiveDisplayDevice(pCBIOSExtension->pCBiosArguments);
break;
case SetVESAModeForDisplay2:
CInt10_Status = OEM_SetVESAModeForDisplay2(pCBIOSExtension);
break;
- case SetDevicePowerState: /* 8203 */
+ case SetDevicePowerState:
CInt10_Status = OEM_SetDevicePowerState(pCBIOSExtension->pCBiosArguments);
break;
- case SetDisplay1RefreshRate: /* 8301 */
- case SetDisplay2RefreshRate: /* 8381 */
+ case SetDisplay1RefreshRate:
+ case SetDisplay2RefreshRate:
CInt10_Status = OEM_SetRefreshRate(pCBIOSExtension->pCBiosArguments);
break;
- case SetLCDPWMLevel: /* 8302 */
+ case SetLCDPWMLevel:
CInt10_Status = OEM_SetLCDPWMLevel(pCBIOSExtension->pCBiosArguments);
break;
case SetTVType:
@@ -4017,5 +3666,5 @@ CI_STATUS CInt10(CBIOS_Extension *pCBIOSExtension)
#endif
return CInt10_Status;
-} /* end CInt10() */
+}
diff --git a/src/CInt10.h b/src/CInt10.h
index 9707f6f..894047f 100644
--- a/src/CInt10.h
+++ b/src/CInt10.h
@@ -18,17 +18,18 @@
* <jason.lin@rdc.com.tw>
*/
-/* CBios Compile Flag */
-#define CBIOS_DEBUG 1
-/* VBE return status */
+
+#define CBIOS_DEBUG 0
+
+
#define VBEFunctionCallSuccessful 0x004F
#define VBEFunctionCallFail 0x014F
#define VBEFunctionCallNotSupported 0x024F
#define VBEFunctionCallInvalid 0x034F
-/* Function argument */
+
#define VBESetMode 0x4F02
#define VBESetGetScanLineLength 0x4F06
#define OEMFunction 0x4F14
@@ -73,20 +74,20 @@
#define SetVideoPOST 0xF100
#define CINT10DataInit 0xF101
-/* definitions only for RRATE_TABLE.Attribute */
-#define DISABLE 0x0001 // mode disable
-#define NHS 0x0002 // 1= negative H sync
+
+#define DISABLE 0x0001
+#define NHS 0x0002
#define PHS 0
-#define NVS 0x0004 // 1= negative V sync
+#define NVS 0x0004
#define PVS 0
-#define HB 0x0008 // 1= 1-character-wide H border
-#define VB 0x0010 // 1= 8-line-wide V border
-#define RBK 0x0020 // 1= Reduced Blanking
-#define ROT 0x0040 // rotation output format
-#define EN_DIT 0x0080 // enable dither for 18-bit panel
-#define MSB 0x0100 // MSB panel
-#define _2_CH 0x0200 // 2 channel panel
-#define SW_PS 0x0400 // SW power sequence
+#define HB 0x0008
+#define VB 0x0010
+#define RBK 0x0020
+#define ROT 0x0040
+#define EN_DIT 0x0080
+#define MSB 0x0100
+#define _2_CH 0x0200
+#define SW_PS 0x0400
#define BIOS_ROM_SIZE 32*1024
@@ -146,10 +147,10 @@ typedef struct _CBIOS_ARGUMENTS {
typedef struct _CBIOS_Extension {
- /* Cbios argument */
+
CBIOS_ARGUMENTS *pCBiosArguments;
- /* Extension value */
+
unsigned long VideoVirtualAddress;
unsigned short IOAddress;
}CBIOS_Extension;
diff --git a/src/CInt10FunProto.h b/src/CInt10FunProto.h
index 922e894..bf1602d 100644
--- a/src/CInt10FunProto.h
+++ b/src/CInt10FunProto.h
@@ -18,7 +18,8 @@
* <jason.lin@rdc.com.tw>
*/
-/* internal functions prototype */
+
+
void SetVBERerurnStatus(USHORT VBEReturnStatus, CBIOS_ARGUMENTS *pCBiosArguments);
void SetTimingRegs(UCHAR ucDisplayPath, MODE_INFO *pModeInfo, RRATE_TABLE *pRRateTable);
@@ -149,3 +150,15 @@ CI_STATUS CheckForDSTNPanel(UCHAR bDeviceIndex);
USHORT GetVESAMEMSize();
void SetDeviceSupport();
+
+void I2CWriteClock(UCHAR I2CPort, UCHAR data);
+void I2CDelay(UCHAR I2CPort);
+void I2CWriteData(UCHAR I2CPort, UCHAR data);
+void I2CStart(UCHAR I2CPort);
+void SendI2CDataByte(UCHAR I2CPort, UCHAR Data);
+bool CheckACK(UCHAR I2CPort);
+UCHAR ReceiveI2CDataByte(UCHAR I2CPort, UCHAR I2CSlave);
+void SendNACK(UCHAR I2CPort);
+void I2CStop(UCHAR I2CPort);
+UCHAR ReadI2C(UCHAR I2CPort, UCHAR I2CSlave, UCHAR RegIdx, UCHAR* RegData);
+UCHAR WriteI2C(UCHAR I2CPort, UCHAR I2CSlave, UCHAR RegIdx, UCHAR RegData);
diff --git a/src/CInt10Tbl.h b/src/CInt10Tbl.h
index d260474..99bc613 100644
--- a/src/CInt10Tbl.h
+++ b/src/CInt10Tbl.h
@@ -18,34 +18,36 @@
* <jason.lin@rdc.com.tw>
*/
+
PORT_CONFIG *pPortConfig;
MODE_INFO *pLCDTable;
MODE_INFO *pVESATable;
void *PCIDataStruct;
+void *BiosInfoData;
bool bCRTSUPPORT = false;
bool bLCDSUPPORT = false;
bool bDVISUPPORT = false;
bool bTVSUPPORT = false;
-/* common table for all VESA modes on display1 */
+
void *Display1VESAModeInitRegs;
-/* table pointers for VBIOS POST */
+
void *POSTInItRegs;
void *DDRII400Tbl;
void *DDRII533Tbl;
void *ExtendRegs2;
-/* Display 1 registers table */
-/* Display 1 H total */
+
+
REG_OP HTotal1[] = {
- {CR, 0xFF, 0x00,3}, /* [7:0] */
- {CR, BIT0, 0xAC,11}, /* [8] */
+ {CR, 0xFF, 0x00,3},
+ {CR, BIT0, 0xAC,11},
{NR,0x0,0x0,0x0}
};
-/* Display 1 H DispEnd */
+
REG_OP HDispEnd1[] = {
{SR, BIT6+BIT5+BIT4, 0x33,0},
{CR, 0xFF, 0x01,3},
@@ -53,7 +55,7 @@ REG_OP HDispEnd1[] = {
{NR,0x0,0x0,0x0}
};
-/* Display 1 H BnkSt */
+
REG_OP HBnkSt1[] = {
{SR, BIT2+BIT1+BIT0, 0x34,0},
{CR, 0xFF, 0x02,3},
@@ -61,7 +63,7 @@ REG_OP HBnkSt1[] = {
{NR,0x0,0x0,0x0}
};
-/* Display 1 H BnkEnd */
+
REG_OP HBnkEnd1[] = {
{SR, BIT6+BIT5+BIT4, 0x34,0},
{CR, 0x1F, 0x03,3},
@@ -70,7 +72,7 @@ REG_OP HBnkEnd1[] = {
{NR,0x0,0x0,0x0}
};
-/* Display 1 H SyncSt */
+
REG_OP HSyncSt1[] = {
{SR, BIT2+BIT1+BIT0, 0x35,0},
{CR, 0xFF, 0x04,3},
@@ -78,7 +80,7 @@ REG_OP HSyncSt1[] = {
{NR,0x0,0x0,0x0}
};
-/* Display 1 H SyncEnd */
+
REG_OP HSyncEnd1[] = {
{SR, BIT6+BIT5+BIT4, 0x35,0},
{CR, 0x1F, 0x05,3},
@@ -86,7 +88,7 @@ REG_OP HSyncEnd1[] = {
{NR,0x0,0x0,0x0}
};
-/* Display 1 V Total */
+
REG_OP VTotal1[] = {
{CR, 0xFF, 0x06,0},
{CR, BIT0, 0x07,8},
@@ -95,7 +97,7 @@ REG_OP VTotal1[] = {
{NR,0x0,0x0,0x0}
};
-/* Display 1 V DispEnd */
+
REG_OP VDispEnd1[] = {
{CR, 0xFF, 0x12,0},
{CR, BIT1, 0x07,8},
@@ -104,7 +106,7 @@ REG_OP VDispEnd1[] = {
{NR,0x0,0x0,0x0}
};
-/* Display 1 V BnkSt */
+
REG_OP VBnkSt1[] = {
{CR, 0xFF, 0x15,0},
{CR, BIT3, 0x07,8},
@@ -113,14 +115,14 @@ REG_OP VBnkSt1[] = {
{NR,0x0,0x0,0x0}
};
-/* Display 1 V BnkEnd */
+
REG_OP VBnkEnd1[] = {
{CR, 0xFF, 0x16,0},
{CR, BIT4, 0xAE,8},
{NR,0x0,0x0,0x0}
};
-/* Display 1 V SyncSt */
+
REG_OP VSyncSt1[] = {
{CR, 0xFF, 0x10,0},
{CR, BIT2, 0x07,8},
@@ -129,30 +131,30 @@ REG_OP VSyncSt1[] = {
{NR,0x0,0x0,0x0}
};
-/* Display 1 V SyncEnd */
+
REG_OP VSyncEnd1[] = {
{CR, BIT3+BIT2+BIT1+BIT0, 0x11,0},
{CR, BIT6+BIT5, 0xAE,4},
{NR,0x0,0x0,0x0}
};
-/* Display 1 Pitch */
+
REG_OP Pitch1[] = {
{CR, 0xFF, 0x13,0},
{CR, 0x3F, 0xB0,8},
{NR,0x0,0x0,0x0}
};
-/* Display 2 registers table */
-/* Display 2 H total */
+
+
REG_OP HTotal2[] = {
- {CR, 0xFF, 0x23,3}, /* [7:0] */
- {CR, BIT0, 0x29,11}, /* [8] */
+ {CR, 0xFF, 0x23,3},
+ {CR, BIT0, 0x29,11},
{NR,0x0,0x0,0x0}
};
-/* Display 2 H DispEnd */
+
REG_OP HDispEnd2[] = {
{SR, BIT6+BIT5+BIT4, 0x36,0},
{CR, 0xFF, 0x24,3},
@@ -160,7 +162,7 @@ REG_OP HDispEnd2[] = {
{NR,0x0,0x0,0x0}
};
-/* Display 2 H BnkSt */
+
REG_OP HBnkSt2[] = {
{SR, BIT2+BIT1+BIT0, 0x37,0},
{CR, 0xFF, 0x25,3},
@@ -168,7 +170,7 @@ REG_OP HBnkSt2[] = {
{NR,0x0,0x0,0x0}
};
-/* Display 2 H BnkEnd */
+
REG_OP HBnkEnd2[] = {
{SR, BIT6+BIT5+BIT4, 0x37,0},
{CR, 0x1F, 0x26,3},
@@ -177,7 +179,7 @@ REG_OP HBnkEnd2[] = {
{NR,0x0,0x0,0x0}
};
-/* Display 2 H SyncSt */
+
REG_OP HSyncSt2[] = {
{SR, BIT2+BIT1+BIT0, 0x38,0},
{CR, 0xFF, 0x27,3},
@@ -185,7 +187,7 @@ REG_OP HSyncSt2[] = {
{NR,0x0,0x0,0x0}
};
-/* Display 2 H SyncEnd */
+
REG_OP HSyncEnd2[] = {
{SR, BIT6+BIT5+BIT4, 0x38,0},
{CR, 0x1F, 0x28,3},
@@ -193,7 +195,7 @@ REG_OP HSyncEnd2[] = {
{NR,0x0,0x0,0x0}
};
-/* Display 2 V Total */
+
REG_OP VTotal2[] = {
{CR, 0xFF, 0x2B,0},
{CR, BIT0, 0x31,8},
@@ -202,7 +204,7 @@ REG_OP VTotal2[] = {
{NR,0x0,0x0,0x0}
};
-/* Display 2 V DispEnd */
+
REG_OP VDispEnd2[] = {
{CR, 0xFF, 0x2C,0},
{CR, BIT1, 0x31,8},
@@ -211,7 +213,7 @@ REG_OP VDispEnd2[] = {
{NR,0x0,0x0,0x0}
};
-/* Display 2 V BnkSt */
+
REG_OP VBnkSt2[] = {
{CR, 0xFF, 0x2D,0},
{CR, BIT3, 0x31,8},
@@ -220,14 +222,14 @@ REG_OP VBnkSt2[] = {
{NR,0x0,0x0,0x0}
};
-/* Display 2 V VBnkEnd2 */
+
REG_OP VBnkEnd2[] = {
{CR, 0xFF, 0x2E,0},
{CR, BIT4, 0x32,8},
{NR,0x0,0x0,0x0}
};
-/* Display 2 V SyncSt */
+
REG_OP VSyncSt2[] = {
{CR, 0xFF, 0x2F,0},
{CR, BIT2, 0x31,8},
@@ -236,21 +238,21 @@ REG_OP VSyncSt2[] = {
{NR,0x0,0x0,0x0}
};
-/* Display 2 V SyncEnd */
+
REG_OP VSyncEnd2[] = {
{CR, BIT3+BIT2+BIT1+BIT0, 0x30,0},
{CR, BIT6+BIT5, 0x32,4},
{NR,0x0,0x0,0x0}
};
-/* Display 2 Pitch */
+
REG_OP Pitch2[] = {
{CR, 0xFF, 0x3A,0},
{CR, 0x3F, 0x3B,8},
{NR,0x0,0x0,0x0}
};
-/*============================================================================= */
+
REG_OP HSource1[] = {
{SR, 0xFF, 0x4B, 0},
{SR, BIT3+BIT2+BIT1+BIT0, 0x4C, 8},
diff --git a/src/Makefile b/src/Makefile
index 1c3e0cb..ec36bad 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -95,16 +95,16 @@ DIST_SOURCES = $(rdc_drv_la_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = aclocal -I /home/jason/Desktop/Xorg/compiled/1.6.0/share/aclocal
+ACLOCAL = aclocal -I /home/pub/Xorg/1.6.0/share/aclocal
ADMIN_MAN_DIR = $(mandir)/man$(ADMIN_MAN_SUFFIX)
ADMIN_MAN_SUFFIX = 8
-AMTAR = ${SHELL} /home/jason/Desktop/Xorg/driver/TipCode/missing --run tar
+AMTAR = ${SHELL} /home/jason/Desktop/Xorg/driver/xf86-video-rdc/missing --run tar
APP_MAN_DIR = $(mandir)/man$(APP_MAN_SUFFIX)
APP_MAN_SUFFIX = 1
AR = ar
-AUTOCONF = ${SHELL} /home/jason/Desktop/Xorg/driver/TipCode/missing --run autoconf
-AUTOHEADER = ${SHELL} /home/jason/Desktop/Xorg/driver/TipCode/missing --run autoheader
-AUTOMAKE = ${SHELL} /home/jason/Desktop/Xorg/driver/TipCode/missing --run automake-1.10
+AUTOCONF = ${SHELL} /home/jason/Desktop/Xorg/driver/xf86-video-rdc/missing --run autoconf
+AUTOHEADER = ${SHELL} /home/jason/Desktop/Xorg/driver/xf86-video-rdc/missing --run autoheader
+AUTOMAKE = ${SHELL} /home/jason/Desktop/Xorg/driver/xf86-video-rdc/missing --run automake-1.10
AWK = gawk
CC = gcc
CCDEPMODE = depmode=gcc3
@@ -146,7 +146,7 @@ LIB_MAN_SUFFIX = 3
LN_S = ln -s
LTLIBOBJS =
MAINT =
-MAKEINFO = ${SHELL} /home/jason/Desktop/Xorg/driver/TipCode/missing --run makeinfo
+MAKEINFO = ${SHELL} /home/jason/Desktop/Xorg/driver/xf86-video-rdc/missing --run makeinfo
MISC_MAN_DIR = $(mandir)/man$(MISC_MAN_SUFFIX)
MISC_MAN_SUFFIX = 7
MKDIR_P = /bin/mkdir -p
@@ -167,10 +167,10 @@ STRIP = strip
VERSION = 0.80
XORG_CFLAGS = -I/home/jason/Desktop/Xorg/compiled/1.6.0//include/xorg -I/home/jason/Desktop/Xorg/compiled/1.6.0//include/pixman-1 -I/home/jason/Desktop/Xorg/compiled/1.6.0//include -I/home/jason/Desktop/Xorg/compiled/1.6.0/include
XORG_LIBS = -L/home/jason/Desktop/Xorg/compiled/1.6.0//lib -lpixman-1 -lpciaccess
-abs_builddir = /home/jason/Desktop/Xorg/driver/TipCode/src
-abs_srcdir = /home/jason/Desktop/Xorg/driver/TipCode/src
-abs_top_builddir = /home/jason/Desktop/Xorg/driver/TipCode
-abs_top_srcdir = /home/jason/Desktop/Xorg/driver/TipCode
+abs_builddir = /home/jason/Desktop/Xorg/driver/xf86-video-rdc/src
+abs_srcdir = /home/jason/Desktop/Xorg/driver/xf86-video-rdc/src
+abs_top_builddir = /home/jason/Desktop/Xorg/driver/xf86-video-rdc
+abs_top_srcdir = /home/jason/Desktop/Xorg/driver/xf86-video-rdc
ac_ct_CC = gcc
ac_ct_CXX = g++
ac_ct_F77 = gfortran
@@ -199,7 +199,7 @@ host_vendor = pc
htmldir = ${docdir}
includedir = ${prefix}/include
infodir = ${datarootdir}/info
-install_sh = $(SHELL) /home/jason/Desktop/Xorg/driver/TipCode/install-sh
+install_sh = $(SHELL) /home/jason/Desktop/Xorg/driver/xf86-video-rdc/install-sh
libdir = ${exec_prefix}/lib
libexecdir = ${exec_prefix}/libexec
localedir = ${datarootdir}/locale
@@ -209,7 +209,7 @@ mkdir_p = /bin/mkdir -p
moduledir = ${exec_prefix}/lib/xorg/modules
oldincludedir = /usr/include
pdfdir = ${docdir}
-prefix = /home/jason/Desktop/Xorg/compiled/1.6.0/
+prefix = /usr/local
program_transform_name = s,x,x,
psdir = ${docdir}
sbindir = ${exec_prefix}/sbin
diff --git a/src/rdc.h b/src/rdc.h
index 05ce1ed..c159833 100644
--- a/src/rdc.h
+++ b/src/rdc.h
@@ -19,6 +19,7 @@
*/
+
#if XSERVER_LIBPCIACCESS
#include <pciaccess.h>
#endif
@@ -43,15 +44,15 @@
#define CHIP_REVISION(p) (p)->chipRev
#endif
-/* Compiler Options */
+
#define Accel_2D
#define Accel_2D_DEBUG 0
-/* #define MMIO_2D */
+
#define HWC
#define HWC_DEBUG 0
-/* Vendor & Device Info */
+
#ifndef PCI_VENDOR_RDC
#define PCI_VENDOR_RDC 0x17F3
#endif
@@ -78,7 +79,7 @@ typedef enum _CHIP_ID {
M2011
} CHIP_ID;
-/* RDC REC Info */
+
#define RDC_NAME "RDC"
#define RDC_DRIVER_NAME "rdc"
#define RDC_MAJOR_VERSION 0
@@ -87,7 +88,7 @@ typedef enum _CHIP_ID {
#define RDC_VERSION \
((RDC_MAJOR_VERSION << 20) | (RDC_MINOR_VERSION << 10) | RDC_PATCH_VERSION)
-/* Customized Info */
+
#define DEFAULT_VIDEOMEM_SIZE 0x00800000
#define DEFAULT_MMIO_SIZE 0x00020000
#define DEFAULT_CMDQ_SIZE 0x00100000
@@ -95,17 +96,17 @@ typedef enum _CHIP_ID {
#define CMD_QUEUE_GUARD_BAND 0x00000020
#define DEFAULT_HWC_NUM 0x00000002
-/* Data Type Definition */
+
typedef INT32 LONG;
typedef CARD8 UCHAR;
typedef CARD16 USHORT;
typedef CARD32 ULONG;
-/* Verberse level define */
-#define ErrorLevel 0 /* Report Error message */
-#define DefaultLevel 4 /* Driver entry function */
-#define InfoLevel 5 /* Report information */
-#define InternalLevel 6 /* Driver interanl function entry */
+
+#define ErrorLevel 0
+#define DefaultLevel 4
+#define InfoLevel 5
+#define InternalLevel 6
#define BIT0 0x00000001
@@ -147,9 +148,9 @@ typedef CARD32 ULONG;
-/* Data Structure Definition */
+
typedef struct _RDCRegRec {
-/* UCHAR ucScratch[0x1F];*/
+
UCHAR ucPLLValue[3];
UCHAR ucCRA3;
UCHAR ucSR58;
@@ -184,7 +185,7 @@ typedef struct {
ULONG ulWritePointer;
ULONG ulReadPointer;
- ULONG ulReadPointer_OK; /* for Eng_DBGChk */
+ ULONG ulReadPointer_OK;
} CMDQINFO, *PCMDQINFO;
@@ -232,11 +233,12 @@ typedef struct {
} SCALER;
typedef struct {
- UCHAR ucDeviceID;
+ UCHAR ucDeviceID;
UCHAR ucDisplayPath;
MONITORSIZE MonitorSize;
SCALER ScalerConfig;
- /* current mode: uce pScrn->currentMode */
+ UCHAR ucNewDeviceID;
+
} DEVICEINFO;
typedef struct {
@@ -247,12 +249,15 @@ typedef struct {
int iDstTop;
int iDstWidth;
int iDstHeight;
+ ULONG ulVidDispCtrl;
+ Bool bPanningOverlayEnable;
} OVERLAY_STATUS;
-typedef struct _RDCRec {
-
+typedef struct _RDCRec
+{
+ vbeInfoPtr pVbe;
EntityInfoPtr pEnt;
#if XSERVER_LIBPCIACCESS
struct pci_device *PciInfo;
@@ -263,11 +268,11 @@ typedef struct _RDCRec {
OptionInfoPtr Options;
- DisplayModePtr ModePtr; /* duplicate of pScrn->currentMode, delete this one */
+ DisplayModePtr ModePtr;
XAAInfoRecPtr AccelInfoPtr;
xf86CursorInfoPtr HWCInfoPtr;
- VIDEOMODE VideoModeInfo; /* duplicate of pScrn->currentMode, delete this one */
+ VIDEOMODE VideoModeInfo;
RDCRegRec SavedReg;
CMDQINFO CMDQInfo;
HWCINFO HWCInfo;
@@ -276,25 +281,25 @@ typedef struct _RDCRec {
ULONG ulCMDReg;
Bool EnableClip;
- /* adapter information */
+
UCHAR jChipType;
ULONG ENGCaps;
- ULONG FBPhysAddr; /* Frame buffer physical address */
- UCHAR *FBVirtualAddr; /* Map of frame buffer */
+ ULONG FBPhysAddr;
+ UCHAR *FBVirtualAddr;
unsigned long FbMapSize;
unsigned long AvailableFBsize;
- ULONG MMIOPhysAddr; /* MMIO region physical address */
- UCHAR *MMIOVirtualAddr; /* Map of MMIO region */
+ ULONG MMIOPhysAddr;
+ UCHAR *MMIOVirtualAddr;
unsigned long MMIOMapSize;
- UCHAR *BIOSVirtualAddr; /* BIOS virtual address */
- ULONG ulROMType; /* 0: no BIOS 1: VBIOS, 2: ROM file */
+ UCHAR *BIOSVirtualAddr;
+ ULONG ulROMType;
- ULONG MemoryBandwidth; /* The unit is MB*/
+ ULONG MemoryBandwidth;
- IOADDRESS IODBase; /* Base of PIO memory area */
+ IOADDRESS IODBase;
IOADDRESS PIOOffset;
IOADDRESS RelocateIO;
@@ -311,7 +316,7 @@ typedef struct _RDCRec {
#define RDCPTR(p) ((RDCRecPtr)((p)->driverPrivate))
#define MODE_PRIVATE_PTR(p) ((MODE_PRIVATE*)(p->Private))
-/* Include Files */
+
#include "rdc_mode.h"
#include "rdc_vgatool.h"
#include "rdc_2dtool.h"
diff --git a/src/rdc_2dtool.c b/src/rdc_2dtool.c
index 16d9e26..12b2a63 100644
--- a/src/rdc_2dtool.c
+++ b/src/rdc_2dtool.c
@@ -18,6 +18,7 @@
* <jason.lin@rdc.com.tw>
*/
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -42,22 +43,22 @@
#include "xf86PciInfo.h"
#include "xf86Pci.h"
-/* framebuffer offscreen manager */
+
#include "xf86fbman.h"
-/* include xaa includes */
+
#include "xaa.h"
#include "xaarop.h"
-/* H/W cursor support */
+
#include "xf86Cursor.h"
-/* Driver specific headers */
+
#include "rdc.h"
#ifdef Accel_2D
-/* Prototype type declaration */
+
Bool bInitCMDQInfo(ScrnInfoPtr pScrn, RDCRecPtr pRDC);
Bool bEnableCMDQ(ScrnInfoPtr pScrn, RDCRecPtr pRDC);
Bool bEnable2D(ScrnInfoPtr pScrn, RDCRecPtr pRDC);
@@ -78,7 +79,7 @@ bInitCMDQInfo(ScrnInfoPtr pScrn, RDCRecPtr pRDC)
pRDC->CMDQInfo.pjReadPort = pRDC->MMIOVirtualAddr+ 0x804C;
pRDC->CMDQInfo.pjEngStatePort = pRDC->MMIOVirtualAddr+ 0x804C;
- /* CMDQ mode Init */
+
if (!pRDC->MMIO2D)
{
pRDC->CMDQInfo.ulCMDQType = VM_CMD_QUEUE;
@@ -90,7 +91,7 @@ bInitCMDQInfo(ScrnInfoPtr pScrn, RDCRecPtr pRDC)
pRDC->CMDQInfo.ulCMDQMask = pRDC->CMDQInfo.ulCMDQSize - 1 ;
}
- /* MMIO mode init */
+
if (pRDC->MMIO2D)
{
pRDC->CMDQInfo.ulCMDQType = VM_CMD_MMIO;
@@ -108,22 +109,22 @@ bEnableCMDQ(ScrnInfoPtr pScrn, RDCRecPtr pRDC)
vWaitEngIdle(pScrn, pRDC);
- /* set DBG Select Info */
+
if (pRDC->DBGSelect)
{
*(ULONG *) (pRDC->MMIOVirtualAddr + 0x804C) = (ULONG) (pRDC->DBGSelect);
}
- /* set CMDQ base */
+
switch (pRDC->CMDQInfo.ulCMDQType)
{
case VM_CMD_QUEUE:
ulVMCmdQBasePort = pRDC->CMDQInfo.ulCMDQOffsetAddr >> 3;
- /* set CMDQ Threshold */
+
ulVMCmdQBasePort |= 0xF0000000;
- /* set CMDQ Size */
+
switch (pRDC->CMDQInfo.ulCMDQSize)
{
case CMD_QUEUE_SIZE_256K:
@@ -152,9 +153,9 @@ bEnableCMDQ(ScrnInfoPtr pScrn, RDCRecPtr pRDC)
break;
case VM_CMD_MMIO:
- /* set CMDQ Threshold */
+
ulVMCmdQBasePort |= 0xF0000000;
- ulVMCmdQBasePort |= 0x02000000; /* MMIO mode */
+ ulVMCmdQBasePort |= 0x02000000;
*(ULONG *) (pRDC->CMDQInfo.pjCmdQBasePort) = ulVMCmdQBasePort;
break;
@@ -172,9 +173,9 @@ bEnable2D(ScrnInfoPtr pScrn, RDCRecPtr pRDC)
xf86DrvMsgVerb(0, X_INFO, InternalLevel, "==Enable 2D== \n");
- SetIndexRegMask(CRTC_PORT, 0xA4, 0xFE, 0x01); /* enable 2D */
+ SetIndexRegMask(CRTC_PORT, 0xA4, 0xFE, 0x01);
- SetIndexRegMask(CRTC_PORT, 0xA3, ~0x20, 0x20); /* enable flip */
+ SetIndexRegMask(CRTC_PORT, 0xA3, ~0x20, 0x20);
*(ULONG *)MMIOREG_1ST_FLIP |= 0x80000000;
if (!bInitCMDQInfo(pScrn, pRDC))
@@ -198,10 +199,9 @@ vDisable2D(ScrnInfoPtr pScrn, RDCRecPtr pRDC)
xf86DrvMsgVerb(0, X_INFO, InternalLevel, "==Engine Disable 2D== \n");
vWaitEngIdle(pScrn, pRDC);
- vWaitEngIdle(pScrn, pRDC);
SetIndexRegMask(CRTC_PORT, 0xA4, 0xFE, 0x00);
- SetIndexRegMask(CRTC_PORT, 0xA3, ~0x20, 0x00); /* disable flip */
+ SetIndexRegMask(CRTC_PORT, 0xA3, ~0x20, 0x00);
*(ULONG *)MMIOREG_1ST_FLIP &= ~0x80000000;
}
@@ -213,7 +213,7 @@ vWaitEngIdle(ScrnInfoPtr pScrn, RDCRecPtr pRDC)
xf86DrvMsgVerb(0, X_INFO, 10, "==Entry Wait Idle== \n");
- do /* wait engine idle */
+ do
{
ulEngState = *((volatile ULONG*)(pRDC->MMIOVirtualAddr + 0x804c));
ulEngState2 = *((volatile ULONG*)(pRDC->MMIOVirtualAddr + 0x8048));
@@ -223,19 +223,12 @@ vWaitEngIdle(ScrnInfoPtr pScrn, RDCRecPtr pRDC)
xf86DrvMsgVerb(0, X_INFO, 10, "==Exit Wait Idle== \n");
}
-/* ULONG ulGetCMDQLength() */
+
__inline ULONG ulGetCMDQLength(RDCRecPtr pRDC, ULONG ulWritePointer, ULONG ulCMDQMask)
{
- ULONG ulReadPointer, ulReadPointer2;
+ ULONG ulReadPointer;
- do {
- ulReadPointer = *((volatile ULONG *)(pRDC->CMDQInfo.pjReadPort)) & 0x0003FFFF;
- ulReadPointer2 = *((volatile ULONG *)(pRDC->CMDQInfo.pjReadPort)) & 0x0003FFFF;
- ulReadPointer2 = *((volatile ULONG *)(pRDC->CMDQInfo.pjReadPort)) & 0x0003FFFF;
- ulReadPointer2 = *((volatile ULONG *)(pRDC->CMDQInfo.pjReadPort)) & 0x0003FFFF;
- ulReadPointer2 = *((volatile ULONG *)(pRDC->CMDQInfo.pjReadPort)) & 0x0003FFFF;
- ulReadPointer2 = *((volatile ULONG *)(pRDC->CMDQInfo.pjReadPort)) & 0x0003FFFF;
- } while (ulReadPointer != ulReadPointer2);
+ ulReadPointer = *((volatile ULONG *)(pRDC->CMDQInfo.pjReadPort)) & 0x0003FFFF;
return ((ulReadPointer << 3) - ulWritePointer - CMD_QUEUE_GUARD_BAND) & ulCMDQMask;
}
@@ -252,7 +245,7 @@ RDCRecPtr pRDC, ULONG ulDataLen)
if (ulContinueCMDQLen >= ulDataLen)
{
- /* Get CMDQ Buffer */
+
if (pRDC->CMDQInfo.ulCurCMDQueueLen < ulDataLen)
{
do
@@ -271,7 +264,7 @@ RDCRecPtr pRDC, ULONG ulDataLen)
else
{
- /* Fill NULL CMD to the last of the CMDQ */
+
if (pRDC->CMDQInfo.ulCurCMDQueueLen < ulContinueCMDQLen)
{
do
@@ -293,7 +286,7 @@ RDCRecPtr pRDC, ULONG ulDataLen)
pRDC->CMDQInfo.ulCurCMDQueueLen -= ulContinueCMDQLen;
pRDC->CMDQInfo.ulWritePointer = ulWritePointer = 0;
- /* Get CMDQ Buffer */
+
if (pRDC->CMDQInfo.ulCurCMDQueueLen < ulDataLen)
{
do
@@ -310,6 +303,6 @@ RDCRecPtr pRDC, ULONG ulDataLen)
return pjBuffer;
}
-} /* end of pjRequestCmdQ() */
+}
-#endif /* end of Accel_2D */
+#endif
diff --git a/src/rdc_2dtool.h b/src/rdc_2dtool.h
index 1763f2c..2a1e3f0 100644
--- a/src/rdc_2dtool.h
+++ b/src/rdc_2dtool.h
@@ -19,7 +19,8 @@
*/
-/* Eng Capability Definition */
+
+
#define ENG_CAP_Sync 0x00000001
#define ENG_CAP_ScreenToScreenCopy 0x00000002
#define ENG_CAP_SolidFill 0x00000004
@@ -39,7 +40,7 @@
#define ENG_CAP_VIDEO_POS 0x00000800
#define ENG_CAP_HWC_MMIO 0x00001000
-/* CMDQ Definition */
+
#define VM_CMD_QUEUE 0
#define VM_CMD_MMIO 2
@@ -49,7 +50,7 @@
#define CMD_QUEUE_SIZE_2M 0x00200000
#define CMD_QUEUE_SIZE_4M 0x00400000
-/* CMD Type Info */
+
#define PKT_NULL_CMD 0x00009561
#define PKT_SINGLE_LENGTH 8
@@ -62,7 +63,7 @@ typedef struct _PKT_SC
} PKT_SC, *PPKT_SC;
-/* Eng Reg. Limitation */
+
#define MAX_SRC_X 0x7FF
#define MAX_SRC_Y 0x7FF
#define MAX_DST_X 0x7FF
@@ -80,19 +81,20 @@ typedef struct _PKT_SC
#define MASK_CLIP 0xFFF
#define MASK_1ST_FLIP_BASE 0x0FFFFFF8
+
#define MASK_LINE_X 0xFFF
#define MASK_LINE_Y 0xFFF
#define MASK_LINE_ERR 0x3FFFFF
#define MASK_LINE_WIDTH 0x7FF
#define MASK_LINE_K1 0x3FFFFF
#define MASK_LINE_K2 0x3FFFFF
-#define MASK_M2010LINE_X 0xFFF
-#define MASK_M2010LINE_Y 0xFFF
+#define MASK_M2010LINE_X 0xFFF
+#define MASK_M2010LINE_Y 0xFFF
#define MAX_PATReg_Size 256
-/* Eng Reg. Definition */
-/* MMIO Reg */
+
+
#define MMIOREG_SRC_BASE (pRDC->MMIOVirtualAddr + 0x8000)
#define MMIOREG_SRC_PITCH (pRDC->MMIOVirtualAddr + 0x8004)
#define MMIOREG_DST_BASE (pRDC->MMIOVirtualAddr + 0x8008)
@@ -122,7 +124,7 @@ typedef struct _PKT_SC
#define MMIOREG_LINE_XY2 (pRDC->MMIOVirtualAddr + 0x8014)
#define MMIOREG_LINE_NUMBER (pRDC->MMIOVirtualAddr + 0x8018)
-/* CMDQ Reg */
+
#define CMDQREG_SRC_BASE (0x00 << 24)
#define CMDQREG_SRC_PITCH (0x01 << 24)
#define CMDQREG_DST_BASE (0x02 << 24)
@@ -151,7 +153,7 @@ typedef struct _PKT_SC
#define CMDQREG_LINE_XY2 (0x05 << 24)
#define CMDQREG_LINE_NUMBER (0x06 << 24)
-/* CMD Reg. Definition */
+
#define CMD_BITBLT 0x00000000
#define CMD_LINEDRAW 0x00000001
#define CMD_COLOREXP 0x00000002
@@ -197,7 +199,10 @@ typedef struct _PKT_SC
#define BURST_FORCE_CMD 0x80000000
-/* Line */
+
+#define CMD_ENABLE_1STFLIP 0x80000000
+
+
#define LINEPARAM_XM 0x00000001
#define LINEPARAM_X_DEC 0x00000002
#define LINEPARAM_Y_DEC 0x00000004
@@ -219,8 +224,8 @@ typedef struct {
LONG Y2;
} _LINEInfo;
-/* Macro */
-/* MMIO 2D Macro */
+
+
#define RDCSetupSRCBase_MMIO(base) \
{ \
do { \
@@ -322,7 +327,7 @@ typedef struct {
} while (*(volatile ULONG *)(MMIOREG_PAT + patreg*4) != (ULONG)(pat)); \
}
-/* Line CMD */
+
#define RDCSetupLineXMErrTerm_MMIO(xm, err) \
{ \
ULONG lineerr; \
@@ -387,10 +392,10 @@ typedef struct {
} while (*(volatile ULONG *)(MMIOREG_LINE_NUMBER) != (ULONG) no); \
}
-/* CMDQ Mode Macro */
+
#define mUpdateWritePointer *(ULONG *) (pRDC->CMDQInfo.pjWritePort) = (pRDC->CMDQInfo.ulWritePointer >>3)
-/* General CMD */
+
#define RDCSetupSRCBase(addr, base) \
{ \
addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_SRC_BASE); \
@@ -467,7 +472,7 @@ typedef struct {
addr->PKT_SC_dwData[0] = (ULONG)(pat); \
}
-/* Line CMD */
+
#define RDCSetupLineStyle1(addr, pat) \
{ \
addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_LINE_STYLE1); \
diff --git a/src/rdc_accel.c b/src/rdc_accel.c
index d78b9ec..dfba6c2 100644
--- a/src/rdc_accel.c
+++ b/src/rdc_accel.c
@@ -19,6 +19,7 @@
*/
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -43,39 +44,39 @@
#include "xf86PciInfo.h"
#include "xf86Pci.h"
-/* framebuffer offscreen manager */
+
#include "xf86fbman.h"
-/* include xaa includes */
+
#include "xaa.h"
#include "xaarop.h"
-/* H/W cursor support */
+
#include "xf86Cursor.h"
-/* Driver specific headers */
+
#include "rdc.h"
#ifdef Accel_2D
-/* ROP Translation Table */
+
int RDCXAACopyROP[16] =
{
- ROP_0, /* GXclear */
- ROP_DSa, /* GXand */
- ROP_SDna, /* GXandReverse */
- ROP_S, /* GXcopy */
- ROP_DSna, /* GXandInverted */
- ROP_D, /* GXnoop */
- ROP_DSx, /* GXxor */
- ROP_DSo, /* GXor */
- ROP_DSon, /* GXnor */
- ROP_DSxn, /* GXequiv */
- ROP_Dn, /* GXinvert*/
- ROP_SDno, /* GXorReverse */
- ROP_Sn, /* GXcopyInverted */
- ROP_DSno, /* GXorInverted */
- ROP_DSan, /* GXnand */
- ROP_1 /* GXset */
+ ROP_0,
+ ROP_DSa,
+ ROP_SDna,
+ ROP_S,
+ ROP_DSna,
+ ROP_D,
+ ROP_DSx,
+ ROP_DSo,
+ ROP_DSon,
+ ROP_DSxn,
+ ROP_Dn,
+ ROP_SDno,
+ ROP_Sn,
+ ROP_DSno,
+ ROP_DSan,
+ ROP_1
};
int RDCXAAPatternROP[16]=
@@ -98,12 +99,12 @@ int RDCXAAPatternROP[16]=
ROP_1
};
-/* extern function */
+
extern void vWaitEngIdle(ScrnInfoPtr pScrn, RDCRecPtr pRDC);
extern UCHAR *pjRequestCMDQ(RDCRecPtr pRDC, ULONG ulDataLen);
extern Bool bGetLineTerm(_LINEInfo *LineInfo, LINEPARAM *dsLineParam);
-/* Prototype type declaration */
+
Bool RDCAccelInit(ScreenPtr pScreen);
static void RDCSync(ScrnInfoPtr pScrn);
static void RDCSetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
@@ -176,11 +177,11 @@ RDCAccelInit(ScreenPtr pScreen)
OFFSCREEN_PIXMAPS |
PIXMAP_CACHE;
- /* Sync */
+
if (pRDC->ENGCaps & ENG_CAP_Sync)
infoPtr->Sync = RDCSync;
- /* Screen To Screen copy */
+
if (pRDC->ENGCaps & ENG_CAP_ScreenToScreenCopy)
{
infoPtr->SetupForScreenToScreenCopy = RDCSetupForScreenToScreenCopy;
@@ -188,7 +189,7 @@ RDCAccelInit(ScreenPtr pScreen)
infoPtr->ScreenToScreenCopyFlags = NO_TRANSPARENCY | NO_PLANEMASK;
}
- /* Solid fill */
+
if (pRDC->ENGCaps & ENG_CAP_SolidFill)
{
infoPtr->SetupForSolidFill = RDCSetupForSolidFill;
@@ -196,7 +197,7 @@ RDCAccelInit(ScreenPtr pScreen)
infoPtr->SolidFillFlags = NO_PLANEMASK;
}
- /* Solid Lines */
+
if (pRDC->ENGCaps & ENG_CAP_SolidLine)
{
infoPtr->SetupForSolidLine = RDCSetupForSolidLine;
@@ -205,7 +206,7 @@ RDCAccelInit(ScreenPtr pScreen)
infoPtr->SolidLineFlags = NO_PLANEMASK;
}
- /* Dashed Lines */
+
if (pRDC->ENGCaps & ENG_CAP_DashedLine)
{
infoPtr->SetupForDashedLine = RDCSetupForDashedLine;
@@ -215,7 +216,7 @@ RDCAccelInit(ScreenPtr pScreen)
LINE_PATTERN_MSBFIRST_LSBJUSTIFIED;
}
- /* 8x8 mono pattern fill */
+
if (pRDC->ENGCaps & ENG_CAP_Mono8x8PatternFill)
{
infoPtr->SetupForMono8x8PatternFill = RDCSetupForMonoPatternFill;
@@ -227,7 +228,7 @@ RDCAccelInit(ScreenPtr pScreen)
BIT_ORDER_IN_BYTE_MSBFIRST;
}
- /* 8x8 color pattern fill */
+
if (pRDC->ENGCaps & ENG_CAP_Color8x8PatternFill)
{
infoPtr->SetupForColor8x8PatternFill = RDCSetupForColor8x8PatternFill;
@@ -237,7 +238,7 @@ RDCAccelInit(ScreenPtr pScreen)
HARDWARE_PATTERN_SCREEN_ORIGIN;
}
- /* CPU To Screen Color Expand */
+
if (pRDC->ENGCaps & ENG_CAP_CPUToScreenColorExpand)
{
infoPtr->SetupForCPUToScreenColorExpandFill = RDCSetupForCPUToScreenColorExpandFill;
@@ -248,7 +249,7 @@ RDCAccelInit(ScreenPtr pScreen)
BIT_ORDER_IN_BYTE_MSBFIRST;
}
- /* Screen To Screen Color Expand */
+
if (pRDC->ENGCaps & ENG_CAP_ScreenToScreenColorExpand)
{
infoPtr->SetupForScreenToScreenColorExpandFill = RDCSetupForScreenToScreenColorExpandFill;
@@ -257,7 +258,7 @@ RDCAccelInit(ScreenPtr pScreen)
BIT_ORDER_IN_BYTE_MSBFIRST;
}
- /* Clipping */
+
if (pRDC->ENGCaps & ENG_CAP_Clipping)
{
infoPtr->SetClippingRectangle = RDCSetClippingRectangle;
@@ -275,7 +276,7 @@ RDCAccelInit(ScreenPtr pScreen)
#endif
return(XAAInit(pScreen, infoPtr));
-} /* end of RDCAccelInit */
+}
static void
@@ -286,12 +287,12 @@ RDCSync(ScrnInfoPtr pScrn)
#if Accel_2D_DEBUG
xf86DrvMsgVerb(0, X_INFO, DefaultLevel, "==Enter RDCSync()== \n");
#endif
- /* wait engle idle */
+
vWaitEngIdle(pScrn, pRDC);
#if Accel_2D_DEBUG
xf86DrvMsgVerb(0, X_INFO, DefaultLevel, "==Exit RDCSync()== \n");
#endif
-} /* end of RDCSync */
+}
static void RDCSetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
@@ -305,7 +306,7 @@ static void RDCSetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
#if Accel_2D_DEBUG
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Enter RDCSetupForScreenToScreenCopy(xdir = %d, ydir = %d, rop = 0x%x, planemask = 0x%x, trans_color = 0x%x)== \n", xdir, ydir, rop, planemask, trans_color);
#endif
- /* Modify Reg. Value */
+
cmdreg = CMD_BITBLT;
switch (pRDC->VideoModeInfo.bitsPerPixel)
{
@@ -337,7 +338,7 @@ static void RDCSetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
if (!pRDC->MMIO2D)
{
- /* Write to CMDQ */
+
pSingleCMD = (PKT_SC *) pjRequestCMDQ(pRDC, PKT_SINGLE_LENGTH*2);
RDCSetupSRCPitch(pSingleCMD, pRDC->VideoModeInfo.ScreenPitch);
@@ -346,7 +347,7 @@ static void RDCSetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
}
else
{
- /* Write to MMIO */
+
RDCSetupSRCPitch_MMIO(pRDC->VideoModeInfo.ScreenPitch);
RDCSetupDSTPitchHeight_MMIO(pRDC->VideoModeInfo.ScreenPitch, -1);
}
@@ -354,7 +355,7 @@ static void RDCSetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
#if Accel_2D_DEBUG
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Exit RDCSetupForScreenToScreenCopy()== \n");
#endif
-} /* end of RDCSetupForScreenToScreenCopy */
+}
static void
RDCSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2,
@@ -368,7 +369,7 @@ RDCSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2,
#if Accel_2D_DEBUG
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Enter RDCSubsequentScreenToScreenCopy(x1 = %d, y1 = %d, x2 = %d, y2 = %d, width = %d, height = %d)== \n", x1, y1, x2, y2, width, height);
#endif
- /* Modify Reg. Value */
+
cmdreg = pRDC->ulCMDReg;
if (pRDC->EnableClip)
@@ -403,7 +404,7 @@ RDCSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2,
if (!pRDC->MMIO2D)
{
- /* Write to CMDQ */
+
pSingleCMD = (PKT_SC *) pjRequestCMDQ(pRDC, PKT_SINGLE_LENGTH*6);
RDCSetupSRCBase(pSingleCMD, srcbase);
@@ -418,7 +419,7 @@ RDCSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2,
pSingleCMD++;
RDCSetupCMDReg(pSingleCMD, cmdreg);
- /* Update Write Pointer */
+
mUpdateWritePointer;
}
@@ -436,7 +437,7 @@ RDCSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2,
#if Accel_2D_DEBUG
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Exit RDCSubsequentScreenToScreenCopy()== \n");
#endif
-} /* end of RDCSubsequentScreenToScreenCopy */
+}
static void
RDCSetupForSolidFill(ScrnInfoPtr pScrn,
@@ -450,7 +451,7 @@ RDCSetupForSolidFill(ScrnInfoPtr pScrn,
#if Accel_2D_DEBUG
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Enter RDCSetupForSolidFill(color = 0x%x, rop = 0x%x, planemake = 0x%x)== \n", color, rop, planemask);
#endif
- /* Modify Reg. Value */
+
cmdreg = CMD_BITBLT | CMD_PAT_FGCOLOR;
switch (pRDC->VideoModeInfo.bitsPerPixel)
{
@@ -471,7 +472,7 @@ RDCSetupForSolidFill(ScrnInfoPtr pScrn,
if (!pRDC->MMIO2D)
{
- /* Write to CMDQ */
+
pSingleCMD = (PKT_SC *) pjRequestCMDQ(pRDC, PKT_SINGLE_LENGTH*2);
RDCSetupDSTPitchHeight(pSingleCMD, pRDC->VideoModeInfo.ScreenPitch, -1);
@@ -487,7 +488,7 @@ RDCSetupForSolidFill(ScrnInfoPtr pScrn,
#if Accel_2D_DEBUG
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Exit RDCSetupForSolidFill()== \n");
#endif
-} /* end of RDCSetupForSolidFill */
+}
static void
@@ -501,7 +502,7 @@ RDCSubsequentSolidFillRect(ScrnInfoPtr pScrn,
#if Accel_2D_DEBUG
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Enter RDCSubsequentSolidFillRect(dst_x = %d, dst_y = %d, width = %d, height = %d)== \n", dst_x, dst_y, width, height);
#endif
- /* Modify Reg. Value */
+
cmdreg = pRDC->ulCMDReg;
if (pRDC->EnableClip)
cmdreg |= CMD_ENABLE_CLIP;
@@ -517,7 +518,7 @@ RDCSubsequentSolidFillRect(ScrnInfoPtr pScrn,
if (!pRDC->MMIO2D)
{
- /* Write to CMDQ */
+
pSingleCMD = (PKT_SC *) pjRequestCMDQ(pRDC, PKT_SINGLE_LENGTH*4);
RDCSetupDSTBase(pSingleCMD, dstbase);
@@ -528,7 +529,7 @@ RDCSubsequentSolidFillRect(ScrnInfoPtr pScrn,
pSingleCMD++;
RDCSetupCMDReg(pSingleCMD, cmdreg);
- /* Update Write Pointer */
+
mUpdateWritePointer;
}
@@ -546,9 +547,9 @@ RDCSubsequentSolidFillRect(ScrnInfoPtr pScrn,
#if Accel_2D_DEBUG
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Exit RDCSubsequentSolidFillRect()== \n");
#endif
-} /* end of RDCSubsequentSolidFillRect */
+}
+
-/* Line */
static void RDCSetupForSolidLine(ScrnInfoPtr pScrn,
int color, int rop, unsigned int planemask)
{
@@ -559,7 +560,7 @@ static void RDCSetupForSolidLine(ScrnInfoPtr pScrn,
#if Accel_2D_DEBUG
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==RDCSetupForSolidLine(color = 0x%x, rop = 0x%x, planemask = 0x%x)\n==", color, rop, planemask);
#endif
- /* Modify Reg. Value */
+
cmdreg = CMD_BITBLT;
switch (pRDC->VideoModeInfo.bitsPerPixel)
@@ -582,7 +583,7 @@ static void RDCSetupForSolidLine(ScrnInfoPtr pScrn,
if (!pRDC->MMIO2D)
{
- /* Write to CMDQ */
+
pSingleCMD = (PKT_SC *) pjRequestCMDQ(pRDC, PKT_SINGLE_LENGTH*3);
RDCSetupDSTPitchHeight(pSingleCMD, pRDC->VideoModeInfo.ScreenPitch, -1);
@@ -594,7 +595,7 @@ static void RDCSetupForSolidLine(ScrnInfoPtr pScrn,
}
else
{
- /* Write to MMIO */
+
RDCSetupDSTPitchHeight_MMIO(pRDC->VideoModeInfo.ScreenPitch, -1);
RDCSetupFG_MMIO(color);
RDCSetupBG_MMIO(0);
@@ -602,7 +603,7 @@ static void RDCSetupForSolidLine(ScrnInfoPtr pScrn,
#if Accel_2D_DEBUG
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Exit RDCSetupForSolidLine()== \n");
#endif
-} /* end of RDCSetupForSolidLine */
+}
static void RDCSubsequentSolidHorVertLine(ScrnInfoPtr pScrn,
@@ -617,7 +618,7 @@ static void RDCSubsequentSolidHorVertLine(ScrnInfoPtr pScrn,
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Enter RDCSubsequentSolidHorVertLine(x = %d, y = %d, len = %d, dir = %d)\n==", x, y, len, dir);
#endif
- /* Modify Reg. Value */
+
cmdreg = (pRDC->ulCMDReg & (~CMD_MASK)) | CMD_BITBLT;
if (pRDC->EnableClip)
cmdreg |= CMD_ENABLE_CLIP;
@@ -626,12 +627,12 @@ static void RDCSubsequentSolidHorVertLine(ScrnInfoPtr pScrn,
dstbase = 0;
if(dir == DEGREES_0)
- { /* horizontal */
+ {
width = len;
height = 1;
}
else
- { /* vertical */
+ {
width = 1;
height = len;
}
@@ -645,7 +646,7 @@ static void RDCSubsequentSolidHorVertLine(ScrnInfoPtr pScrn,
if (!pRDC->MMIO2D)
{
- /* Write to CMDQ */
+
pSingleCMD = (PKT_SC *) pjRequestCMDQ(pRDC, PKT_SINGLE_LENGTH*4);
RDCSetupDSTBase(pSingleCMD, dstbase);
@@ -656,7 +657,7 @@ static void RDCSubsequentSolidHorVertLine(ScrnInfoPtr pScrn,
pSingleCMD++;
RDCSetupCMDReg(pSingleCMD, cmdreg);
- /* Update Write Pointer */
+
mUpdateWritePointer;
}
@@ -673,9 +674,9 @@ static void RDCSubsequentSolidHorVertLine(ScrnInfoPtr pScrn,
#if Accel_2D_DEBUG
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Exit RDCSubsequentSolidHorVertLine()== \n");
#endif
-} /* end of RDCSubsequentSolidHorVertLine */
+}
+
-/* Dash Line */
static void
RDCSetupForDashedLine(ScrnInfoPtr pScrn,
int fg, int bg, int rop, unsigned int planemask,
@@ -688,7 +689,7 @@ RDCSetupForDashedLine(ScrnInfoPtr pScrn,
#if Accel_2D_DEBUG
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Enter RDCSetupForDashedLine(fg = 0x%x, bg = 0x%x, rop = 0x%x, planemask = 0x%x, length = %d)\n==", fg, bg, rop, planemask, length);
#endif
- /* Modify Reg. Value */
+
cmdreg = CMD_LINEDRAW | CMD_RESET_STYLE_COUNTER | CMD_ENABLE_LINE_STYLE;
switch (pRDC->VideoModeInfo.bitsPerPixel)
@@ -714,12 +715,12 @@ RDCSetupForDashedLine(ScrnInfoPtr pScrn,
bg = 0;
}
- cmdreg |= (((length-1) & 0x3F) << 24); /* line period */
+ cmdreg |= (((length-1) & 0x3F) << 24);
pRDC->ulCMDReg = cmdreg;
if (!pRDC->MMIO2D)
{
- /* Write to CMDQ */
+
pSingleCMD = (PKT_SC *) pjRequestCMDQ(pRDC, PKT_SINGLE_LENGTH*5);
RDCSetupDSTPitchHeight(pSingleCMD, pRDC->VideoModeInfo.ScreenPitch, -1);
@@ -735,7 +736,7 @@ RDCSetupForDashedLine(ScrnInfoPtr pScrn,
}
else
{
- /* Write to MMIO */
+
RDCSetupDSTPitchHeight_MMIO(pRDC->VideoModeInfo.ScreenPitch, -1);
RDCSetupFG_MMIO(fg);
RDCSetupBG_MMIO(bg);
@@ -748,7 +749,7 @@ RDCSetupForDashedLine(ScrnInfoPtr pScrn,
#endif
}
-/* Mono Pattern Fill */
+
static void
RDCSetupForMonoPatternFill(ScrnInfoPtr pScrn,
int patx, int paty, int fg, int bg,
@@ -762,7 +763,7 @@ RDCSetupForMonoPatternFill(ScrnInfoPtr pScrn,
#if Accel_2D_DEBUG
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Enter RDCSetupForMonoPatternFill(patx = %d, paty = %d, fg = 0x%x, bg = 0x%x, rop = 0x%x, planemask = 0x%x)\n==", patx, paty, fg, bg, rop, planemask);
#endif
- /* Modify Reg. Value */
+
cmdreg = CMD_BITBLT | CMD_PAT_MONOMASK;
switch (pRDC->VideoModeInfo.bitsPerPixel)
{
@@ -784,7 +785,7 @@ RDCSetupForMonoPatternFill(ScrnInfoPtr pScrn,
if (!pRDC->MMIO2D)
{
- /* Write to CMDQ */
+
pSingleCMD = (PKT_SC *) pjRequestCMDQ(pRDC, PKT_SINGLE_LENGTH*5);
RDCSetupDSTPitchHeight(pSingleCMD, pRDC->VideoModeInfo.ScreenPitch, -1);
@@ -809,7 +810,7 @@ RDCSetupForMonoPatternFill(ScrnInfoPtr pScrn,
#if Accel_2D_DEBUG
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Exit RDCSetupForMonoPatternFill()== \n");
#endif
-} /* end of RDCSetupForMonoPatternFill */
+}
static void
@@ -824,7 +825,7 @@ RDCSubsequentMonoPatternFill(ScrnInfoPtr pScrn,
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Enter RDCSetupForMonoPatternFillRDCSubsequentMonoPatternFill(patx = %d, paty = %d, dst_x = %d, dst_y = %d, width = %d, height = %d,)\n==", patx, paty, dst_x, dst_y, width, height);
#endif
- /* Modify Reg. Value */
+
cmdreg = pRDC->ulCMDReg;
if (pRDC->EnableClip)
cmdreg |= CMD_ENABLE_CLIP;
@@ -840,7 +841,7 @@ RDCSubsequentMonoPatternFill(ScrnInfoPtr pScrn,
if (!pRDC->MMIO2D)
{
- /* Write to CMDQ */
+
pSingleCMD = (PKT_SC *) pjRequestCMDQ(pRDC, PKT_SINGLE_LENGTH*4);
RDCSetupDSTBase(pSingleCMD, dstbase);
@@ -851,7 +852,7 @@ RDCSubsequentMonoPatternFill(ScrnInfoPtr pScrn,
pSingleCMD++;
RDCSetupCMDReg(pSingleCMD, cmdreg);
- /* Update Write Pointer */
+
mUpdateWritePointer;
}
@@ -868,7 +869,7 @@ RDCSubsequentMonoPatternFill(ScrnInfoPtr pScrn,
#if Accel_2D_DEBUG
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Exit RDCSubsequentMonoPatternFill()== \n");
#endif
-} /* end of RDCSubsequentMonoPatternFill */
+}
static void
RDCSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty,
@@ -884,7 +885,7 @@ RDCSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty,
#if Accel_2D_DEBUG
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Enter RDCSetupForMonoPatternFillRDCSetupForColor8x8PatternFill(patx = %d, paty = %d, rop = 0x%x, planemask = 0x%x, trans_col = 0x%x)\n==", patx, paty, rop, planemask, trans_col);
#endif
- /* Modify Reg. Value */
+
cmdreg = CMD_BITBLT | CMD_PAT_PATREG;
switch (pRDC->VideoModeInfo.bitsPerPixel)
@@ -911,7 +912,7 @@ RDCSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty,
if (!pRDC->MMIO2D)
{
- /* Write to CMDQ */
+
pSingleCMD = (PKT_SC *) pjRequestCMDQ(pRDC, PKT_SINGLE_LENGTH*(1 + ulPatSize/4));
RDCSetupDSTPitchHeight(pSingleCMD, pRDC->VideoModeInfo.ScreenPitch, -1);
pSingleCMD++;
@@ -940,7 +941,7 @@ RDCSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty,
#if Accel_2D_DEBUG
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Exit RDCSetupForColor8x8PatternFill()== \n");
#endif
-} /* end of RDCSetupForColor8x8PatternFill */
+}
static void
RDCSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, int patx, int paty,
@@ -953,7 +954,7 @@ RDCSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, int patx, int paty,
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Enter RDCSetupForMonoPatternFillRDCSubsequentColor8x8PatternFillRect(patx = %d, paty = %d, dst_x = %d, dst_y = %d, width = %d, height)\n==", patx, paty, dst_x, dst_y, width, height);
#endif
- /* Modify Reg. Value */
+
cmdreg = pRDC->ulCMDReg;
if (pRDC->EnableClip)
cmdreg |= CMD_ENABLE_CLIP;
@@ -970,7 +971,7 @@ RDCSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, int patx, int paty,
if (!pRDC->MMIO2D)
{
- /* Write to CMDQ */
+
pSingleCMD = (PKT_SC *) pjRequestCMDQ(pRDC, PKT_SINGLE_LENGTH*4);
RDCSetupDSTBase(pSingleCMD, dstbase);
@@ -981,7 +982,7 @@ RDCSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, int patx, int paty,
pSingleCMD++;
RDCSetupCMDReg(pSingleCMD, cmdreg);
- /* Update Write Pointer */
+
mUpdateWritePointer;
}
@@ -998,9 +999,9 @@ RDCSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, int patx, int paty,
#if Accel_2D_DEBUG
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Exit RDCSubsequentColor8x8PatternFillRect()== \n");
#endif
-} /* RDCSubsequentColor8x8PatternFillRect */
+}
+
-/* CPU to Screen Expand */
static void
RDCSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
int fg, int bg,
@@ -1014,7 +1015,7 @@ RDCSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
#if Accel_2D_DEBUG
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Enter RDCSetupForMonoPatternFillRDCSetupForCPUToScreenColorExpandFill(fg = 0x%x, bg = ox%x, rop = ox%x, planemask = ox%x)\n==", fg, bg, rop, planemask);
#endif
- /* Modify Reg. Value */
+
cmdreg = CMD_COLOREXP;
switch (pRDC->VideoModeInfo.bitsPerPixel)
@@ -1044,7 +1045,7 @@ RDCSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
if (!pRDC->MMIO2D)
{
- /* Write to CMDQ */
+
pSingleCMD = (PKT_SC *) pjRequestCMDQ(pRDC, PKT_SINGLE_LENGTH*3);
RDCSetupDSTPitchHeight(pSingleCMD, pRDC->VideoModeInfo.ScreenPitch, -1);
@@ -1081,7 +1082,7 @@ RDCSubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Enter RDCSetupForMonoPatternFillRDCSetupForCPUToScreenColorExpandFill(dst_x = %d, dst_y = %d, width = %d, height, offset = %d)\n==", dst_x, dst_y, width, height, offset);
#endif
- /* Modify Reg. Value */
+
cmdreg = pRDC->ulCMDReg;
if (pRDC->EnableClip)
cmdreg |= CMD_ENABLE_CLIP;
@@ -1097,7 +1098,7 @@ RDCSubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
if (!pRDC->MMIO2D)
{
- /* Write to CMDQ */
+
pSingleCMD = (PKT_SC *) pjRequestCMDQ(pRDC, PKT_SINGLE_LENGTH*5);
RDCSetupSRCPitch(pSingleCMD, ((width+7)/8));
@@ -1110,7 +1111,7 @@ RDCSubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
pSingleCMD++;
RDCSetupCMDReg(pSingleCMD, cmdreg);
- /* Update Write Pointer */
+
mUpdateWritePointer;
}
@@ -1133,7 +1134,7 @@ RDCSubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
}
-/* Screen to Screen Color Expand */
+
static void
RDCSetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn,
int fg, int bg,
@@ -1147,7 +1148,7 @@ RDCSetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn,
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Enter RDCSetupForMonoPatternFillRDCSetupForScreenToScreenColorExpandFill(fg = 0x%x, bg = ox%x, rop = ox%x, planemask = ox%x)\n==", fg, bg, rop, planemask);
#endif
- /* Modify Reg. Value */
+
cmdreg = CMD_ENHCOLOREXP;
switch (pRDC->VideoModeInfo.bitsPerPixel)
{
@@ -1175,7 +1176,7 @@ RDCSetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn,
if (!pRDC->MMIO2D)
{
- /* Write to CMDQ */
+
pSingleCMD = (PKT_SC *) pjRequestCMDQ(pRDC, PKT_SINGLE_LENGTH*3);
RDCSetupDSTPitchHeight(pSingleCMD, pRDC->VideoModeInfo.ScreenPitch, -1);
@@ -1214,7 +1215,7 @@ RDCSubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrn,
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Enter RDCSetupForMonoPatternFillRDCSubsequentScreenToScreenColorExpandFill(dst_x = %d, dst_y = %d, width = %d, height, src_x = %d, src_y = %d, offset = %d)\n==", dst_x, dst_y, width, height, src_x, src_y, offset);
#endif
- /* Modify Reg. Value */
+
cmdreg = pRDC->ulCMDReg;
if (pRDC->EnableClip)
@@ -1235,7 +1236,7 @@ RDCSubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrn,
if (!pRDC->MMIO2D)
{
- /* Write to CMDQ */
+
pSingleCMD = (PKT_SC *) pjRequestCMDQ(pRDC, PKT_SINGLE_LENGTH*6);
RDCSetupSRCBase(pSingleCMD, srcbase);
@@ -1250,7 +1251,7 @@ RDCSubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrn,
pSingleCMD++;
RDCSetupCMDReg(pSingleCMD, cmdreg);
- /* Update Write Pointer */
+
mUpdateWritePointer;
}
@@ -1273,7 +1274,7 @@ RDCSubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrn,
}
-/* Clipping */
+
static void
RDCSetClippingRectangle(ScrnInfoPtr pScrn,
int left, int top, int right, int bottom)
@@ -1288,7 +1289,7 @@ RDCSetClippingRectangle(ScrnInfoPtr pScrn,
if (!pRDC->MMIO2D)
{
- /* Write to CMDQ */
+
pSingleCMD = (PKT_SC *) pjRequestCMDQ(pRDC, PKT_SINGLE_LENGTH*2);
RDCSetupCLIP1(pSingleCMD, left, top);
@@ -1331,7 +1332,7 @@ static void RDCSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn,
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Enter RDCSetupForMonoPatternFillRDCSubsequentSolidTwoPointLine(x1 = %d, y1 = %d, x2 = %d, y2 = %d, flags = 0x%x)\n==", x1, y1, x2, y2, flags);
#endif
- /* Modify Reg. Value */
+
ulCommand = (pRDC->ulCMDReg & (~CMD_MASK)) | CMD_LINEDRAW | CMD_NORMAL_LINE;
if(flags & OMIT_LAST)
@@ -1356,7 +1357,7 @@ static void RDCSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn,
if (!pRDC->MMIO2D)
{
- /* Write to CMDQ */
+
pSingleCMD = (PKT_SC *) pjRequestCMDQ(pRDC, PKT_SINGLE_LENGTH*5);
RDCSetupDSTBase(pSingleCMD, dstbase);
@@ -1369,11 +1370,11 @@ static void RDCSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn,
pSingleCMD++;
RDCSetupCMDReg(pSingleCMD, ulCommand);
- /* Update Write Pointer */
+
mUpdateWritePointer;
- /* Patch KDE pass abnormal point, ycchen@052507 */
- vWaitEngIdle(pScrn, pRDC);
+
+
}
else
@@ -1390,9 +1391,9 @@ static void RDCSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn,
#if Accel_2D_DEBUG
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Exit RDCSubsequentSolidTwoPointLine()== \n");
#endif
-} /* end of M2010SubsequentSolidTwoPointLine */
+}
+
-/* M2010 Dash Line */
static void
RDCSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn,
int x1, int y1, int x2, int y2,
@@ -1407,7 +1408,7 @@ RDCSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn,
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Enter RDCSetupForMonoPatternFillRDCSubsequentDashedTwoPointLine(x1 = %d, y1 = %d, x2 = %d, y2 = %d, flags = 0x%x, phase = %d(0x%x)\n==", x1, y1, x2, y2, phase, phase);
#endif
- /* Modify Reg. Value */
+
ulCommand = pRDC->ulCMDReg | CMD_NORMAL_LINE;
if(flags & OMIT_LAST)
@@ -1432,7 +1433,7 @@ RDCSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn,
if (!pRDC->MMIO2D)
{
- /* Write to CMDQ */
+
pSingleCMD = (PKT_SC *) pjRequestCMDQ(pRDC, PKT_SINGLE_LENGTH*5);
RDCSetupDSTBase(pSingleCMD, dstbase);
@@ -1445,11 +1446,11 @@ RDCSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn,
pSingleCMD++;
RDCSetupCMDReg(pSingleCMD, ulCommand);
- /* Update Write Pointer */
+
mUpdateWritePointer;
- /* Patch KDE pass abnormal point, ycchen@052507 */
- vWaitEngIdle(pScrn, pRDC);
+
+
}
else
@@ -1468,4 +1469,4 @@ RDCSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn,
#endif
}
-#endif /* end of Accel_2D */
+#endif
diff --git a/src/rdc_cursor.c b/src/rdc_cursor.c
index e11b44b..4fecff1 100644
--- a/src/rdc_cursor.c
+++ b/src/rdc_cursor.c
@@ -18,6 +18,7 @@
* <jason.lin@rdc.com.tw>
*/
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -42,22 +43,22 @@
#include "xf86PciInfo.h"
#include "xf86Pci.h"
-/* framebuffer offscreen manager */
+
#include "xf86fbman.h"
-/* include xaa includes */
+
#include "xaa.h"
#include "xaarop.h"
-/* H/W cursor support */
+
#include "xf86Cursor.h"
#include "cursorstr.h"
-/* Driver specific headers */
+
#include "rdc.h"
#ifdef HWC
-/* Prototype type declaration */
+
Bool RDCCursorInit(ScreenPtr pScreen);
Bool bInitHWC(ScrnInfoPtr pScrn, RDCRecPtr pRDC);
static void RDCShowCursor(ScrnInfoPtr pScrn);
@@ -134,16 +135,16 @@ RDCCursorInit(ScreenPtr pScreen)
Bool bInitHWC(ScrnInfoPtr pScrn, RDCRecPtr pRDC)
{
- /* init cursor cache info */
- /* Set HWC_NUM in Options instead */
- /* pRDC->HWCInfo.HWC_NUM = DEFAULT_HWC_NUM; */
+
+
+
pRDC->HWCInfo.HWC_NUM_Next = 0;
#if HWC_DEBUG
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Enter bInitHWC()== \n");
#endif
- /* allocate HWC cache */
+
pRDC->HWCInfo.pjHWCVirtualAddr = pRDC->FBVirtualAddr + pRDC->HWCInfo.ulHWCOffsetAddr;
#if HWC_DEBUG
@@ -168,7 +169,7 @@ RDCShowCursor(ScrnInfoPtr pScrn)
if (pRDC->HWCInfo.cursortype ==HWC_COLOR)
jReg |= 0x01;
- SetIndexRegMask(CRTC_PORT, 0xCB, 0xFC, jReg); /* enable mono */
+ SetIndexRegMask(CRTC_PORT, 0xCB, 0xFC, jReg);
#if HWC_DEBUG
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Exit RDCShowCursor()== \n");
#endif
@@ -182,7 +183,7 @@ RDCHideCursor(ScrnInfoPtr pScrn)
#if HWC_DEBUG
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Enter RDCHideCursor()== \n");
#endif
- SetIndexRegMask(CRTC_PORT, 0xCB, 0xFC, 0x00); /* disable HWC */
+ SetIndexRegMask(CRTC_PORT, 0xCB, 0xFC, 0x00);
#if HWC_DEBUG
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Exit RDCHideCursor()== \n");
#endif
@@ -199,7 +200,7 @@ RDCSetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
#if HWC_DEBUG
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 7, "==Enter RDCSetCursorPosition(x = %d, y = %d)== \n", x, y);
#endif
- /* Set cursor info to Offscreen */
+
pjSignature = (UCHAR *) pRDC->HWCInfo.pjHWCVirtualAddr +
(HWC_SIZE+HWC_SIGNATURE_SIZE)*pRDC->HWCInfo.HWC_NUM_Next +
HWC_SIZE;
@@ -237,7 +238,7 @@ RDCSetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
if(mode->Flags & V_DBLSCAN)
y *= 2;
- /* Set to Reg. */
+
SetIndexReg(CRTC_PORT, 0xC2, (UCHAR) (x_offset));
SetIndexReg(CRTC_PORT, 0xC3, (UCHAR) (y_offset));
SetIndexReg(CRTC_PORT, 0xC4, (UCHAR) (x & 0xFF));
@@ -247,7 +248,7 @@ RDCSetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
SetIndexReg(CRTC_PORT, 0xCC, (UCHAR) (y_end & 0xFF));
SetIndexReg(CRTC_PORT, 0xCD, (UCHAR) ((y_end >> 8) & 0x07));
- /* Fire HWC */
+
RDCFireCursor(pScrn);
#if HWC_DEBUG
@@ -285,14 +286,14 @@ RDCLoadCursorImage(ScrnInfoPtr pScrn, UCHAR *src)
#if HWC_DEBUG
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Enter RDCLoadCursorImage()== \n");
#endif
- /* init cursor info. */
+
pRDC->HWCInfo.cursortype = HWC_MONO;
pRDC->HWCInfo.width = (USHORT) MAX_HWC_WIDTH;
pRDC->HWCInfo.height = (USHORT) MAX_HWC_HEIGHT;
pRDC->HWCInfo.offset_x = MAX_HWC_WIDTH - pRDC->HWCInfo.width;
pRDC->HWCInfo.offset_y = MAX_HWC_HEIGHT - pRDC->HWCInfo.height;
- /* copy cursor image to cache */
+
pjSrcXor = src;
pjSrcAnd = src + (MAX_HWC_WIDTH*MAX_HWC_HEIGHT/8);
pjDstData = pRDC->HWCInfo.pjHWCVirtualAddr+(HWC_SIZE+HWC_SIGNATURE_SIZE)*pRDC->HWCInfo.HWC_NUM_Next;
@@ -320,7 +321,7 @@ RDCLoadCursorImage(ScrnInfoPtr pScrn, UCHAR *src)
}
}
- /* Write Checksum as signature */
+
pjDstData = (UCHAR *) pRDC->HWCInfo.pjHWCVirtualAddr + (HWC_SIZE+HWC_SIGNATURE_SIZE)*pRDC->HWCInfo.HWC_NUM_Next + HWC_SIZE;
*((ULONG *) pjDstData) = ulCheckSum;
*((ULONG *) (pjDstData + HWC_SIGNATURE_SizeX)) = pRDC->HWCInfo.width;
@@ -328,14 +329,14 @@ RDCLoadCursorImage(ScrnInfoPtr pScrn, UCHAR *src)
*((ULONG *) (pjDstData + HWC_SIGNATURE_HOTSPOTX)) = 0;
*((ULONG *) (pjDstData + HWC_SIGNATURE_HOTSPOTY)) = 0;
- /* set pattern offset */
+
ulPatternAddr = ((pRDC->HWCInfo.ulHWCOffsetAddr+(HWC_SIZE+HWC_SIGNATURE_SIZE)*pRDC->HWCInfo.HWC_NUM_Next) >> 3);
SetIndexReg(CRTC_PORT, 0xC8, (UCHAR) (ulPatternAddr & 0xFF));
SetIndexReg(CRTC_PORT, 0xC9, (UCHAR) ((ulPatternAddr >> 8) & 0xFF));
SetIndexReg(CRTC_PORT, 0xCA, (UCHAR) ((ulPatternAddr >> 16) & 0xFF));
- /* update HWC_NUM_Next */
+
pRDC->HWCInfo.HWC_NUM_Next = (pRDC->HWCInfo.HWC_NUM_Next+1) % pRDC->HWCInfo.HWC_NUM;
#if HWC_DEBUG
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Exit RDCLoadCursorImage()== \n");
@@ -378,14 +379,14 @@ RDCLoadCursorARGB(ScrnInfoPtr pScrn, CursorPtr pCurs)
#if HWC_DEBUG
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Enter RDCLoadCursorARGB()== \n");
#endif
- /* init cursor info. */
+
pRDC->HWCInfo.cursortype = HWC_COLOR;
pRDC->HWCInfo.width = pCurs->bits->width;
pRDC->HWCInfo.height = pCurs->bits->height;
pRDC->HWCInfo.offset_x = MAX_HWC_WIDTH - pRDC->HWCInfo.width;
pRDC->HWCInfo.offset_y = MAX_HWC_HEIGHT - pRDC->HWCInfo.height;
- /* copy cursor image to cache */
+
ulSrcWidth = pRDC->HWCInfo.width;
ulSrcHeight = pRDC->HWCInfo.height;
@@ -426,11 +427,11 @@ RDCLoadCursorARGB(ScrnInfoPtr pScrn, CursorPtr pCurs)
pjSrcXor += 4;
}
- /* Point to next source and dest scans */
+
pjDstXor += lLastAlphaDstDelta;
- } /* end of for-loop */
+ }
- /* Write Checksum as signature */
+
pjDstXor = (UCHAR *) pRDC->HWCInfo.pjHWCVirtualAddr + (HWC_SIZE+HWC_SIGNATURE_SIZE)*pRDC->HWCInfo.HWC_NUM_Next + HWC_SIZE;
*((ULONG *) pjDstXor) = ulCheckSum;
*((ULONG *) (pjDstXor + HWC_SIGNATURE_SizeX)) = pRDC->HWCInfo.width;
@@ -438,13 +439,13 @@ RDCLoadCursorARGB(ScrnInfoPtr pScrn, CursorPtr pCurs)
*((ULONG *) (pjDstXor + HWC_SIGNATURE_HOTSPOTX)) = 0;
*((ULONG *) (pjDstXor + HWC_SIGNATURE_HOTSPOTY)) = 0;
- /* set pattern offset */
+
ulPatternAddr = ((pRDC->HWCInfo.ulHWCOffsetAddr +(HWC_SIZE+HWC_SIGNATURE_SIZE)*pRDC->HWCInfo.HWC_NUM_Next) >> 3);
SetIndexReg(CRTC_PORT, 0xC8, (UCHAR) (ulPatternAddr & 0xFF));
SetIndexReg(CRTC_PORT, 0xC9, (UCHAR) ((ulPatternAddr >> 8) & 0xFF));
SetIndexReg(CRTC_PORT, 0xCA, (UCHAR) ((ulPatternAddr >> 16) & 0xFF));
- /* update HWC_NUM_Next */
+
pRDC->HWCInfo.HWC_NUM_Next = (pRDC->HWCInfo.HWC_NUM_Next+1) % pRDC->HWCInfo.HWC_NUM;
#if HWC_DEBUG
@@ -468,7 +469,7 @@ RDCFireCursor(ScrnInfoPtr pScrn)
#if HWC_DEBUG
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Enter RDCFireCursor()== \n");
#endif
- SetIndexRegMask(CRTC_PORT, 0xCB, 0xFF, 0x00); /* dummp write to fire HWC */
+ SetIndexRegMask(CRTC_PORT, 0xCB, 0xFF, 0x00);
#if HWC_DEBUG
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Exit RDCFireCursor()== \n");
#endif
@@ -509,7 +510,6 @@ static void RDCShowCursor_HQ(ScrnInfoPtr pScrn)
*((volatile ULONG*)(pRDC->MMIOVirtualAddr + HWC_MMIO_ADDRESS)));
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, InternalLevel, "==Exit RDCShowCursor_HQ()== \n");
#endif
-
}
static void RDCSetCursorColors_HQ(ScrnInfoPtr pScrn, int bg, int fg)
@@ -560,31 +560,30 @@ static void RDCLoadCursorImage_HQ(ScrnInfoPtr pScrn, UCHAR *src)
RDCRecPtr pRDC = RDCPTR(pScrn);
UCHAR *pjSrcAnd, *pjSrcXor;
ULONG ulPatternOffset;
-
#if HWC_DEBUG
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Enter RDCLoadCursorImage_HQ()== \n");
#endif
- /* init cursor info. */
+
pRDC->HWCInfo.cursortype = HWC_MONO;
pRDC->HWCInfo.width = (USHORT) MAX_HWC_WIDTH;
pRDC->HWCInfo.height = (USHORT) MAX_HWC_HEIGHT;
pRDC->HWCInfo.offset_x = MAX_HWC_WIDTH - pRDC->HWCInfo.width;
pRDC->HWCInfo.offset_y = MAX_HWC_HEIGHT - pRDC->HWCInfo.height;
- /* copy cursor image to cache */
+
pjSrcXor = src;
pjSrcAnd = src + (MAX_HWC_WIDTH*MAX_HWC_HEIGHT/8);
memcpy(&(pRDC->HWCInfo.MonoHWC.ucXorBitmap),pjSrcXor, sizeof(pRDC->HWCInfo.MonoHWC.ucXorBitmap));
memcpy(&(pRDC->HWCInfo.MonoHWC.ucAndBitmap),pjSrcAnd, sizeof(pRDC->HWCInfo.MonoHWC.ucAndBitmap));
- /* set pattern offset */
+
ulPatternOffset = pRDC->HWCInfo.ulHWCOffsetAddr+HQ_HWC_SIZE*pRDC->HWCInfo.HWC_NUM_Next;
pRDC->HWCInfo.MonoHWC.pjPatternVirtualAddr = pRDC->FBVirtualAddr + ulPatternOffset;
*((ULONG*)(pRDC->MMIOVirtualAddr + HWC_MMIO_ADDRESS)) = ((ulPatternOffset >> 3) & 0xFFFFFF);
- /* update HWC_NUM_Next */
+
pRDC->HWCInfo.HWC_NUM_Next = (pRDC->HWCInfo.HWC_NUM_Next+1) % pRDC->HWCInfo.HWC_NUM;
#if HWC_DEBUG
@@ -595,7 +594,6 @@ static void RDCLoadCursorImage_HQ(ScrnInfoPtr pScrn, UCHAR *src)
static void RDCLoadCursorARGB_HQ(ScrnInfoPtr pScrn, CursorPtr pCurs)
{
RDCRecPtr pRDC = RDCPTR(pScrn);
-
UCHAR *pjDstXor, *pjSrcXor;
ULONG j, ulSrcWidthInByte, ulSrcHeight;
LONG ulDstCursorPitch;
@@ -604,7 +602,7 @@ static void RDCLoadCursorARGB_HQ(ScrnInfoPtr pScrn, CursorPtr pCurs)
#if HWC_DEBUG
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Enter RDCLoadCursorARGB_HQ()== \n");
#endif
- /* init cursor info. */
+
pRDC->HWCInfo.cursortype = HWC_COLOR;
pRDC->HWCInfo.width = pCurs->bits->width;
pRDC->HWCInfo.height = pCurs->bits->height;
@@ -613,7 +611,7 @@ static void RDCLoadCursorARGB_HQ(ScrnInfoPtr pScrn, CursorPtr pCurs)
pRDC->HWCInfo.offset_x = MAX_HWC_WIDTH - pRDC->HWCInfo.width;
pRDC->HWCInfo.offset_y = MAX_HWC_HEIGHT - pRDC->HWCInfo.height;
- /* copy cursor image to cache */
+
ulSrcWidthInByte = pRDC->HWCInfo.width << 2;
ulSrcHeight = pRDC->HWCInfo.height;
@@ -629,18 +627,18 @@ static void RDCLoadCursorARGB_HQ(ScrnInfoPtr pScrn, CursorPtr pCurs)
{
memcpy(pjDstXor,pjSrcXor, ulSrcWidthInByte);
- /* Point to next source and dest scans */
+
pjSrcXor += ulSrcWidthInByte;
pjDstXor += ulDstCursorPitch;
- } /* end of for-loop */
+ }
-
- /* set pattern offset */
- ulPatternAddr = ((pRDC->HWCInfo.ulHWCOffsetAddr +HQ_HWC_SIZE*pRDC->HWCInfo.HWC_NUM_Next) >> 3);
+
+ ulPatternAddr =
+ ((pRDC->HWCInfo.ulHWCOffsetAddr +HQ_HWC_SIZE*pRDC->HWCInfo.HWC_NUM_Next) >> 3);
*((volatile ULONG*)(pRDC->MMIOVirtualAddr + HWC_MMIO_ADDRESS)) = (ulPatternAddr & 0xFFFFFF);
- /* update HWC_NUM_Next */
+
pRDC->HWCInfo.HWC_NUM_Next = (pRDC->HWCInfo.HWC_NUM_Next+1) % pRDC->HWCInfo.HWC_NUM;
#if HWC_DEBUG
@@ -661,6 +659,7 @@ static void RDCSetCursorPosition_HQ(ScrnInfoPtr pScrn, int x, int y)
int iOverlayStartOffsetX, iOverlayStartOffsetY;
int iOverlaySrcWidth, iOverlaySrcHeight;
int iOverlayDstWidth, iOverlayDstHeight;
+ int iPanningVDDstWdith;
int iOverlayFetchCnt;
ULONG ulCursorCtrl;
Bool bNeedAdjustFrame = false;
@@ -675,7 +674,7 @@ static void RDCSetCursorPosition_HQ(ScrnInfoPtr pScrn, int x, int y)
x_offset = pRDC->HWCInfo.offset_x;
y_offset = pRDC->HWCInfo.offset_y;
- /* limit cursor in screen region */
+
if ((x+xhot) >= mode->HDisplay)
{
x = mode->HDisplay - xhot -1;
@@ -697,108 +696,163 @@ static void RDCSetCursorPosition_HQ(ScrnInfoPtr pScrn, int x, int y)
}
- /* adjust cursor position for panning mode */
- if (pRDC->DeviceInfo.ucDeviceID == 1)
+ if (pRDC->DeviceInfo.ucDeviceID == LCDINDEX)
{
- if (x+xhot >= pHWCInfo->iScreenOffset_x + (int)pRDC->DeviceInfo.MonitorSize.ulHorMaxResolution)
- {
- pHWCInfo->iScreenOffset_x = x + xhot - ((int)(pRDC->DeviceInfo.MonitorSize.ulHorMaxResolution) - 1);
- x = (int)(pRDC->DeviceInfo.MonitorSize.ulHorMaxResolution) - 1 - xhot;
- bNeedAdjustFrame = true;
- }
- else if (x+xhot < pHWCInfo->iScreenOffset_x)
- {
- pHWCInfo->iScreenOffset_x = x + xhot;
- x = -xhot;
- bNeedAdjustFrame = true;
- }
- else
- {
- x -= pHWCInfo->iScreenOffset_x;
- }
+ if (x+xhot >= pHWCInfo->iScreenOffset_x + (int)pRDC->DeviceInfo.MonitorSize.ulHorMaxResolution)
+ {
+ pHWCInfo->iScreenOffset_x = x + xhot - ((int)(pRDC->DeviceInfo.MonitorSize.ulHorMaxResolution) - 1);
+ x = (int)(pRDC->DeviceInfo.MonitorSize.ulHorMaxResolution) - 1 - xhot;
+ bNeedAdjustFrame = true;
+ }
+ else if (x+xhot < pHWCInfo->iScreenOffset_x)
+ {
+ pHWCInfo->iScreenOffset_x = x + xhot;
+ x = -xhot;
+ bNeedAdjustFrame = true;
+ }
+ else
+ {
+ x -= pHWCInfo->iScreenOffset_x;
+ }
- if (y+yhot >= pHWCInfo->iScreenOffset_y + (int)pRDC->DeviceInfo.MonitorSize.ulVerMaxResolution)
- {
- pHWCInfo->iScreenOffset_y = y + yhot - ((int)pRDC->DeviceInfo.MonitorSize.ulVerMaxResolution - 1);
- y = (int)pRDC->DeviceInfo.MonitorSize.ulVerMaxResolution - 1 - yhot;
- bNeedAdjustFrame = true;
- }
- else if (y+yhot < pHWCInfo->iScreenOffset_y)
- {
- pHWCInfo->iScreenOffset_y = y + yhot;
- y = -yhot;
- bNeedAdjustFrame = true;
- }
- else
- {
- y -= pHWCInfo->iScreenOffset_y;
- }
+ if (y+yhot >= pHWCInfo->iScreenOffset_y + (int)pRDC->DeviceInfo.MonitorSize.ulVerMaxResolution)
+ {
+ pHWCInfo->iScreenOffset_y = y + yhot - ((int)pRDC->DeviceInfo.MonitorSize.ulVerMaxResolution - 1);
+ y = (int)pRDC->DeviceInfo.MonitorSize.ulVerMaxResolution - 1 - yhot;
+ bNeedAdjustFrame = true;
+ }
+ else if (y+yhot < pHWCInfo->iScreenOffset_y)
+ {
+ pHWCInfo->iScreenOffset_y = y + yhot;
+ y = -yhot;
+ bNeedAdjustFrame = true;
+ }
+ else
+ {
+ y -= pHWCInfo->iScreenOffset_y;
+ }
- if (bNeedAdjustFrame)
+ if (bNeedAdjustFrame)
+ {
+ RDCAdjustFrame(pScrn->scrnIndex, pHWCInfo->iScreenOffset_x, pHWCInfo->iScreenOffset_y, 0);
+
+ if (pRDC->OverlayStatus.bOverlayEnable)
{
- RDCAdjustFrame(pScrn->scrnIndex, pHWCInfo->iScreenOffset_x, pHWCInfo->iScreenOffset_y, 0);
- if (pRDC->OverlayStatus.bOverlayEnable)
+ iOverlaySrcWidth = pRDC->OverlayStatus.iSrcWidth;
+ iOverlaySrcHeight = pRDC->OverlayStatus.iSrcHeight;
+
+ iOverlayDstWidth = pRDC->OverlayStatus.iDstWidth;
+ iOverlayDstHeight = pRDC->OverlayStatus.iDstHeight;
+
+ iOverlayStartX = pRDC->OverlayStatus.iDstLeft - pHWCInfo->iScreenOffset_x;
+ iOverlayStartY = pRDC->OverlayStatus.iDstTop - pHWCInfo->iScreenOffset_y;
+
+ iOverlayEndX = iOverlayStartX + iOverlayDstWidth - 1;
+ iOverlayEndY = iOverlayStartY + iOverlayDstHeight - 1;
+
+ iOverlayStartOffsetX = 0;
+ iOverlayStartOffsetY = 0;
+
+ if ((iOverlayEndX > 0) &&
+ (iOverlayEndX >= pRDC->DeviceInfo.MonitorSize.ulHorMaxResolution))
+ {
+ iOverlayEndX =
+ pRDC->DeviceInfo.MonitorSize.ulHorMaxResolution - 1;
+ }
+
+ if (iOverlayEndY >= pRDC->DeviceInfo.MonitorSize.ulVerMaxResolution)
+ {
+ iOverlayEndY =
+ pRDC->DeviceInfo.MonitorSize.ulVerMaxResolution - 1;
+ }
+
+ iOverlayDispCntX =
+ (iOverlaySrcWidth * (iOverlayEndX - iOverlayStartX + 1) -1) /
+ iOverlayDstWidth;
+
+ iOverlayDispCntY =
+ (iOverlaySrcHeight * (iOverlayEndY - iOverlayStartY + 1) -1) /
+ iOverlayDstHeight;
+
+ if (iOverlayStartX < 0)
+ {
+ iOverlayStartOffsetX =
+ (iOverlaySrcWidth * (-iOverlayStartX)) / iOverlayDstWidth;
+ iOverlayStartX = 0;
+ }
+
+ if (iOverlayStartY < 0)
+ {
+ iOverlayStartOffsetY =
+ (iOverlaySrcHeight * (-iOverlayStartY)) / iOverlayDstHeight;
+ iOverlayStartY = 0;
+ }
+
+ iPanningVDDstWdith = (iOverlayEndX - iOverlayStartX + 1);
+ if (iOverlaySrcWidth > iPanningVDDstWdith)
{
- iOverlaySrcWidth = pRDC->OverlayStatus.iSrcWidth;
- iOverlaySrcHeight = pRDC->OverlayStatus.iSrcHeight;
-
- iOverlayDstWidth = pRDC->OverlayStatus.iDstWidth;
- iOverlayDstHeight = pRDC->OverlayStatus.iDstHeight;
-
- iOverlayStartX = pRDC->OverlayStatus.iDstLeft - pHWCInfo->iScreenOffset_x;
- iOverlayStartY = pRDC->OverlayStatus.iDstTop - pHWCInfo->iScreenOffset_y;
- iOverlayEndX = iOverlayStartX + iOverlayDstWidth - 1;
- iOverlayEndY = iOverlayStartY + iOverlayDstHeight - 1;
- iOverlayStartOffsetX = 0;
- iOverlayStartOffsetY = 0;
+ iOverlayFetchCnt =
+ ((iPanningVDDstWdith << 1) + 7) >> 3;
+ }
+ else
+ {
- if (iOverlayEndX >= pRDC->DeviceInfo.MonitorSize.ulHorMaxResolution)
- {
- iOverlayEndX = pRDC->DeviceInfo.MonitorSize.ulHorMaxResolution - 1;
- }
+ iOverlayFetchCnt =
+ ((iOverlaySrcWidth << 1) + 7) >> 3;
+ }
+
+ if ((pRDC->ModePtr->HDisplay > pRDC->DeviceInfo.MonitorSize.ulHorMaxResolution)&&
+ (iOverlaySrcWidth < iOverlayDstWidth))
+ {
- if (iOverlayEndY >= pRDC->DeviceInfo.MonitorSize.ulVerMaxResolution)
- {
- iOverlayEndY = pRDC->DeviceInfo.MonitorSize.ulVerMaxResolution - 1;
- }
- iOverlayDispCntX = (iOverlaySrcWidth * (iOverlayEndX - iOverlayStartX + 1) -1) / iOverlayDstWidth;
- iOverlayDispCntY = (iOverlaySrcHeight * (iOverlayEndY - iOverlayStartY + 1) -1) / iOverlayDstHeight;
+ iOverlayFetchCnt =
+ (((iOverlayDispCntX - iOverlayStartOffsetX) << 1) + 7) >> 3;
+ }
+
+ if (iOverlayFetchCnt < 4)
+ iOverlayFetchCnt = 4;
- if (iOverlayStartX < 0)
- {
- iOverlayStartOffsetX = (iOverlaySrcWidth * (-iOverlayStartX)) / iOverlayDstWidth;
- iOverlayStartX = 0;
- }
+ if ((iOverlayEndX < 0) ||
+ (iOverlayStartX > pRDC->DeviceInfo.MonitorSize.ulHorMaxResolution) ||
+ (iOverlayStartY > pRDC->DeviceInfo.MonitorSize.ulVerMaxResolution))
+ {
+ pRDC->OverlayStatus.ulVidDispCtrl &= ~VDPS_ENABLE;
+ pRDC->OverlayStatus.bPanningOverlayEnable = FALSE;
- if (iOverlayStartY < 0)
+ while (!(GetReg(INPUT_STATUS1_READ) & 0x08))
{
- iOverlayStartOffsetY = (iOverlaySrcHeight * (-iOverlayStartY)) / iOverlayDstHeight;
- iOverlayStartY = 0;
+ xf86DrvMsgVerb(0, X_INFO, InternalLevel, "wait v sync\n");
}
- iOverlayFetchCnt = ((((iOverlaySrcWidth << 1) * (iOverlayEndX - iOverlayStartX + 1)+ iOverlayDstWidth - 1) / iOverlayDstWidth) + 7) >> 3;
-
- *(ULONG*)(pRDC->MMIOVirtualAddr + VDP_START_LOCATION) = (iOverlayStartX << 16) | iOverlayStartY;
- *(ULONG*)(pRDC->MMIOVirtualAddr + VDP_END_LOCATION) = (iOverlayEndX << 16) | iOverlayEndY;
- *(ULONG*)(pRDC->MMIOVirtualAddr + VDP_START_OFFSET) = (iOverlayStartOffsetX << 16) | iOverlayStartOffsetY;
- *(ULONG*)(pRDC->MMIOVirtualAddr + VDP_SRC_DISP_COUNT_ON_SCR) = (iOverlayDispCntY << 16) | iOverlayDispCntX;
- *(ULONG*)(pRDC->MMIOVirtualAddr + VDP_FETCH_COUNT) = iOverlayFetchCnt;
- *(ULONG*)(pRDC->MMIOVirtualAddr + VDP_REG_UPDATE_MOD_SELECT) = VDPS_FIRE;
+ *(ULONG*)(pRDC->MMIOVirtualAddr + VDP_CTL) = pRDC->OverlayStatus.ulVidDispCtrl;
}
else
{
- xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, InternalLevel, "overlay disabled\n");
+ pRDC->OverlayStatus.ulVidDispCtrl |= VDPS_ENABLE;
+ pRDC->OverlayStatus.bPanningOverlayEnable = TRUE;
+ *(ULONG*)(pRDC->MMIOVirtualAddr + VDP_CTL) = pRDC->OverlayStatus.ulVidDispCtrl;
}
+
+ *(ULONG*)(pRDC->MMIOVirtualAddr + VDP_START_LOCATION) = (iOverlayStartX << 16) | iOverlayStartY;
+ *(ULONG*)(pRDC->MMIOVirtualAddr + VDP_END_LOCATION) = (iOverlayEndX << 16) | iOverlayEndY;
+ *(ULONG*)(pRDC->MMIOVirtualAddr + VDP_START_OFFSET) = (iOverlayStartOffsetX << 16) | iOverlayStartOffsetY;
+ *(ULONG*)(pRDC->MMIOVirtualAddr + VDP_SRC_DISP_COUNT_ON_SCR) = (iOverlayDispCntY << 16) | iOverlayDispCntX;
+ *(ULONG*)(pRDC->MMIOVirtualAddr + VDP_FETCH_COUNT) = iOverlayFetchCnt;
+ *(ULONG*)(pRDC->MMIOVirtualAddr + VDP_REG_UPDATE_MOD_SELECT) = VDPS_FIRE;
+ }
+ else
+ {
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, InternalLevel, "overlay disabled\n");
}
+ }
}
- /* adjust cursor position by 1 line */
+
y++;
-
if(x < 0)
{
x_offset = (-x) + pRDC->HWCInfo.offset_x;
@@ -835,13 +889,13 @@ static void RDCSetCursorPosition_HQ(ScrnInfoPtr pScrn, int x, int y)
if(mode->Flags & V_DBLSCAN)
y *= 2;
- /* Set to Reg. */
+
*((volatile ULONG*)(pRDC->MMIOVirtualAddr + HWC_MMIO_OFFSET)) =
(x_offset & 0x3F) | ((y_offset & 0x3F) << 8) | ((y_end & 0x7FF) << 16);
*((volatile ULONG*)(pRDC->MMIOVirtualAddr + HWC_MMIO_POSITION)) =
(x & 0xFFF) | ((y & 0x7FF)<< 16);
- /* Fire HWC */
+
ulCursorCtrl = *((volatile ULONG*)(pRDC->MMIOVirtualAddr + HWC_MMIO_CTRL));
*((volatile ULONG*)(pRDC->MMIOVirtualAddr + HWC_MMIO_CTRL)) = ulCursorCtrl;
@@ -849,4 +903,4 @@ static void RDCSetCursorPosition_HQ(ScrnInfoPtr pScrn, int x, int y)
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, InternalLevel, "==Exit RDCSetCursorPosition()== \n");
#endif
}
-#endif /* End of HWC */
+#endif
diff --git a/src/rdc_cursor.h b/src/rdc_cursor.h
index 4ab1fad..69edd96 100644
--- a/src/rdc_cursor.h
+++ b/src/rdc_cursor.h
@@ -18,6 +18,7 @@
* <jason.lin@rdc.com.tw>
*/
+
#define MAX_HWC_WIDTH 64
#define MAX_HWC_HEIGHT 64
#define HWC_SIZE (MAX_HWC_WIDTH*MAX_HWC_HEIGHT*2)
@@ -28,7 +29,7 @@
#define HWC_MONO 0
#define HWC_COLOR 1
-/* define for signature structure */
+
#define HWC_SIGNATURE_CHECKSUM 0x00
#define HWC_SIGNATURE_SizeX 0x04
#define HWC_SIGNATURE_SizeY 0x08
diff --git a/src/rdc_driver.c b/src/rdc_driver.c
index 08ca023..8e7147b 100644
--- a/src/rdc_driver.c
+++ b/src/rdc_driver.c
@@ -18,6 +18,7 @@
* <jason.lin@rdc.com.tw>
*/
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -45,20 +46,20 @@
#include "xf86PciInfo.h"
#include "xf86Pci.h"
-/* framebuffer offscreen manager */
+
#include "xf86fbman.h"
-/* include xaa includes */
+
#include "xaa.h"
#include "xaarop.h"
-/* H/W cursor support */
+
#include "xf86Cursor.h"
-/* Driver specific headers */
+
#include "rdc.h"
-/* external reference fucntion */
+
#if !XSERVER_LIBPCIACCESS
extern Bool RDCMapMem(ScrnInfoPtr pScrn);
#endif
@@ -88,7 +89,7 @@ extern Bool RDCCursorInit(ScreenPtr pScreen);
extern DisplayModePtr RDCBuildModePool(ScrnInfoPtr pScrn);
extern void RDCVideoInit(ScreenPtr pScreen);
-/* Mandatory functions */
+
static void RDCIdentify(int flags);
const OptionInfoRec *RDCAvailableOptions(int chipid, int busid);
#if XSERVER_LIBPCIACCESS
@@ -105,7 +106,7 @@ static void RDCLeaveVT(int scrnIndex, int flags);
static void RDCFreeScreen(int scrnIndex, int flags);
static ModeStatus RDCValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags);
-/* Internally used functions */
+
static Bool RDCGetRec(ScrnInfoPtr pScrn);
static void RDCFreeRec(ScrnInfoPtr pScrn);
static Bool RDCSaveScreen(ScreenPtr pScreen, Bool unblack);
@@ -131,10 +132,7 @@ static const struct pci_id_match rdc_device_match[] = {
};
#endif
-/*
- * This is intentionally screen-independent. It indicates the binding
- * choice made in the first PreInit.
- */
+
_X_EXPORT DriverRec RDC = {
RDC_VERSION,
RDC_DRIVER_NAME,
@@ -155,7 +153,7 @@ _X_EXPORT DriverRec RDC = {
};
-/* Chipsets */
+
static SymTabRec RDCChipsets[] = {
{PCI_CHIP_M2010_A0, "M2010_A0"},
{PCI_CHIP_M2010, "M2010"},
@@ -217,6 +215,7 @@ const char *fbSymbols[] = {
const char *vbeSymbols[] = {
"VBEInit",
+ "VBEExtendedInit",
"VBEFreeModeInfo",
"VBEFreeVBEInfo",
"VBEGetModeInfo",
@@ -307,7 +306,7 @@ RDCSetup(pointer module, pointer opts, int *errmaj, int *errmin)
xf86DrvMsgVerb(0, X_INFO, DefaultLevel, "==Enter RDCSetup()== \n");
- /* This module should be loaded only once, but check to be sure. */
+
if (!setupDone)
{
@@ -320,22 +319,14 @@ RDCSetup(pointer module, pointer opts, int *errmaj, int *errmin)
#endif
);
- /* Tell the loader about symbols from other modules that this module might refer to. */
- /*========================================================
- void LoaderRefSymLists(const char **list0, ...)
- This function allows the registration of possibly unresolved symbols with
- the loader. When LoaderCheckUnresolved() is run it won't generate
- warnings for symbols registered in this way unless they were also registered
- as required symbols. The function takes one or more NULL terminated
- lists of symbols. The end of the argument list is indicated by a NULL
- argument.
- ==========================================================*/
+
+
LoaderRefSymLists(vgahwSymbols,
fbSymbols, xaaSymbols, ramdacSymbols,
vbeSymbols, vbeOptionalSymbols,
ddcSymbols, int10Symbols, NULL);
- /* The return value must be non-NULL on success even though there is no TearDownProc. */
+
xf86DrvMsgVerb(0, X_INFO, DefaultLevel, "==Exit1 RDCSetup()== return TRUE\n");
return (pointer) TRUE;
}
@@ -350,15 +341,9 @@ RDCSetup(pointer module, pointer opts, int *errmaj, int *errmin)
xf86DrvMsgVerb(0, X_INFO, DefaultLevel, "==Exit3 RDCSetup()== \n");
}
-#endif /* XFree86LOADER */
+#endif
+
-/*
- * RDCIdentify --
- *
- * Returns the string name for the driver based on the chipset. In this
- * case it will always be an RDC, so we can return a static string.
- *
- */
static void
RDCIdentify(int flags)
{
@@ -375,13 +360,7 @@ RDCAvailableOptions(int chipid, int busid)
}
#if XSERVER_LIBPCIACCESS
-/*
- * rdc_pci_probe --
- *
- * Look through the PCI bus to find cards that are rdc boards.
- * Setup the dispatch table for the rest of the driver functions.
- *
- */
+
static Bool rdc_pci_probe (DriverPtr driver,
int entity_num,
struct pci_device *device,
@@ -428,13 +407,7 @@ static Bool rdc_pci_probe (DriverPtr driver,
return pScrn != NULL;
}
#else
-/*
- * RDCProbe --
- *
- * Look through the PCI bus to find cards that are RDC boards.
- * Setup the dispatch table for the rest of the driver functions.
- *
- */
+
static Bool
RDCProbe(DriverPtr drv, int flags)
{
@@ -444,20 +417,14 @@ RDCProbe(DriverPtr drv, int flags)
xf86DrvMsgVerb(0, X_INFO, DefaultLevel, "==Enter RDCProbe== \n");
- /*
- * Find the config file Device sections that match this
- * driver, and return if there are none.
- */
+
if ((numDevSections = xf86MatchDevice(RDC_DRIVER_NAME, &devSections)) <= 0)
{
xf86DrvMsgVerb(0, X_INFO, 0, "==Exit1 RDCProbe()== return FALSE\n");
return FALSE;
}
- /*
- * This probing is just checking the PCI data the server already
- * collected.
- */
+
if (xf86GetPciVideoInfo() == NULL)
{
xf86DrvMsgVerb(0, X_INFO, 0, "==Exit2 RDCProbe()== return FALSE\n");
@@ -482,7 +449,7 @@ RDCProbe(DriverPtr drv, int flags)
{
ScrnInfoPtr pScrn = NULL;
- /* Allocate new ScrnInfoRec and claim the slot */
+
if ((pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i],
RDCPciChipsets, 0, 0, 0, 0, 0)))
{
@@ -501,9 +468,9 @@ RDCProbe(DriverPtr drv, int flags)
pScrn->ValidMode = RDCValidMode;
foundScreen = TRUE;
- } /* end of if */
- } /* end of for-loop */
- } /* end of if flags */
+ }
+ }
+ }
xfree(usedChips);
@@ -512,17 +479,12 @@ RDCProbe(DriverPtr drv, int flags)
}
#endif
-/*
- * RDCPreInit --
- *
- * Do initial setup of the board before we know what resolution we will
- * be running at.
- *
- */
+
static Bool
RDCPreInit(ScrnInfoPtr pScrn, int flags)
{
EntityInfoPtr pEnt;
+ vbeInfoPtr pVbe;
vgaHWPtr hwp;
int flags24;
rgb defaultWeight = { 0, 0, 0 };
@@ -533,7 +495,7 @@ RDCPreInit(ScrnInfoPtr pScrn, int flags)
MessageType from;
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Enter RDCPreInit()==\n");
- /* Suport one adapter only now */
+
if (pScrn->numEntities != 1)
{
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, ErrorLevel, "==Exit1 RDCPreInit()== return FALSE\n");
@@ -548,7 +510,24 @@ RDCPreInit(ScrnInfoPtr pScrn, int flags)
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Exit2 RDCPreInit()== return TRUE\n");
return TRUE;
}
-
+
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==RDCPreInit()==Before init VBE\n");
+
+ if (xf86LoadSubModule(pScrn, "int10") && xf86LoadSubModule(pScrn, "vbe"))
+ {
+ xf86LoaderReqSymLists(vbeSymbols, NULL);
+
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==RDCPreInit()==Load Vbe symbol\n");
+
+ pVbe = VBEExtendedInit(NULL,
+ pEnt->index,
+ SET_BIOS_SCRATCH | RESTORE_BIOS_SCRATCH);
+ if (pVbe == NULL)
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==RDCPreInit()==pVbe = NULL\n");
+ }
+
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==RDCPreInit()==After init VBE\n");
+
if (pEnt->location.type != BUS_PCI)
{
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, ErrorLevel, "==Exit3 RDCPreInit()== return FALSE\n");
@@ -561,7 +540,7 @@ RDCPreInit(ScrnInfoPtr pScrn, int flags)
return FALSE;
}
- /* The vgahw module should be loaded here when needed */
+
if (!xf86LoadSubModule(pScrn, "vgahw"))
{
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, ErrorLevel, "==Exit5 RDCPreInit()== return FALSE\n");
@@ -569,7 +548,7 @@ RDCPreInit(ScrnInfoPtr pScrn, int flags)
}
xf86LoaderReqSymLists(vgahwSymbols, NULL);
- /* The fb module should be loaded here when needed */
+
if (!xf86LoadSubModule(pScrn, "fb"))
{
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, ErrorLevel, "==Exit6 RDCPreInit()== return FALSE\n");
@@ -577,7 +556,7 @@ RDCPreInit(ScrnInfoPtr pScrn, int flags)
}
xf86LoaderReqSymLists(fbSymbols, NULL);
- /* Allocate a vgaHWRec */
+
if (!vgaHWGetHWRec(pScrn))
{
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, ErrorLevel, "==Exit7 RDCPreInit()== return FALSE\n");
@@ -585,7 +564,7 @@ RDCPreInit(ScrnInfoPtr pScrn, int flags)
}
hwp = VGAHWPTR(pScrn);
- /* Color Depth Check */
+
flags24 = Support32bppFb;
if (!xf86SetDepthBpp(pScrn, 0, 0, 0, flags24))
{
@@ -627,17 +606,14 @@ RDCPreInit(ScrnInfoPtr pScrn, int flags)
return FALSE;
}
- /* fill pScrn misc. */
+
pScrn->progClock = TRUE;
pScrn->rgbBits = 6;
- pScrn->monitor = pScrn->confScreen->monitor; /* should be initialized before set gamma */
+ pScrn->monitor = pScrn->confScreen->monitor;
pScrn->racMemFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT;
pScrn->racIoFlags = RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT;
- /*
- * If the driver can do gamma correction, it should call xf86SetGamma()
- * here.
- */
+
if (!xf86SetGamma(pScrn, zeros))
{
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "call xf86SetGamma failed \n");
@@ -658,7 +634,7 @@ RDCPreInit(ScrnInfoPtr pScrn, int flags)
return FALSE;
}
- /* Allocate driverPrivate */
+
if (!RDCGetRec(pScrn))
{
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "call RDCGetRec failed \n");
@@ -666,8 +642,9 @@ RDCPreInit(ScrnInfoPtr pScrn, int flags)
return FALSE;
}
- /* Fill RDC Info */
+
pRDC = RDCPTR(pScrn);
+ pRDC->pVbe = pVbe;
pRDC->pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
pRDC->PciInfo = xf86GetPciInfoForEntity(pRDC->pEnt->index);
#if !XSERVER_LIBPCIACCESS
@@ -675,10 +652,7 @@ RDCPreInit(ScrnInfoPtr pScrn, int flags)
pRDC->PciInfo->func);
#endif
- /* Process the options
- * pScrn->confScreen, pScrn->display, pScrn->monitor, pScrn->numEntities,
- * and pScrn->entityList should be initialized before
- */
+
xf86CollectOptions(pScrn, NULL);
if (!(pRDC->Options = xalloc(sizeof(RDCOptions))))
{
@@ -689,10 +663,7 @@ RDCPreInit(ScrnInfoPtr pScrn, int flags)
memcpy(pRDC->Options, RDCOptions, sizeof(RDCOptions));
xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pRDC->Options);
- /*
- * Set the Chipset and ChipRev, allowing config file entries to
- * override.
- */
+
if (pRDC->pEnt->device->chipset && *pRDC->pEnt->device->chipset)
{
pScrn->chipset = pRDC->pEnt->device->chipset;
@@ -722,15 +693,13 @@ RDCPreInit(ScrnInfoPtr pScrn, int flags)
xf86DrvMsgVerb(pScrn->scrnIndex, from, DefaultLevel, "Chipset: \"%s\"\n",
(pScrn->chipset != NULL) ? pScrn->chipset : "Unknown rdc");
- /* Resource Allocation */
+
#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0)
pRDC->IODBase = 0;
#else
pRDC->IODBase = pScrn->domainIOBase;
#endif
- /* "Patch" the PIOOffset inside vgaHW in order to force
- * the vgaHW module to use our relocated i/o ports.
- */
+
#if XSERVER_LIBPCIACCESS
VGAHWPTR(pScrn)->PIOOffset = pRDC->PIOOffset = pRDC->IODBase + pRDC->PciInfo->regions[2].base_addr - 0x380;
pRDC->RelocateIO = (IOADDRESS)(pRDC->PciInfo->regions[2].base_addr + pRDC->IODBase);
@@ -805,10 +774,10 @@ RDCPreInit(ScrnInfoPtr pScrn, int flags)
pRDC->MMIOMapSize = DEFAULT_MMIO_SIZE;
- /* Get Memory Bandwidth */
+
pRDC->MemoryBandwidth = RDCGetMemBandWidth(pScrn);
- /* Map resource */
+
if (!RDCMapMem(pScrn))
{
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Map FB Memory Failed \n");
@@ -829,7 +798,7 @@ RDCPreInit(ScrnInfoPtr pScrn, int flags)
return FALSE;
}
- /* init BIOS data */
+
{
CBIOS_ARGUMENTS CBiosArguments;
CBIOS_Extension CBiosExtension;
@@ -838,7 +807,7 @@ RDCPreInit(ScrnInfoPtr pScrn, int flags)
CBiosExtension.IOAddress = (USHORT)(pRDC->RelocateIO);
CBiosExtension.VideoVirtualAddress = (ULONG)(pRDC->FBVirtualAddr);
- CBiosArguments.reg.x.AX = 0x4f14;
+ CBiosArguments.reg.x.AX = OEMFunction;
CBiosArguments.reg.x.BX = CINT10DataInit;
CBiosArguments.reg.ex.ECX = (ULONG)pRDC->BIOSVirtualAddr;
CInt10(&CBiosExtension);
@@ -847,16 +816,14 @@ RDCPreInit(ScrnInfoPtr pScrn, int flags)
pScrn->memPhysBase = (ULONG)pRDC->FBPhysAddr;
pScrn->fbOffset = 0;
- /* Get Revision */
+
pRDC->jChipType = M2010;
- /* Do DDC
- * should be done after xf86CollectOptions
- */
+
pScrn->monitor->DDC = RDCDoDDC(pScrn, pRDC->pEnt->index);
- /* Built Mode Pool */
+
pScrn->modePool = RDCBuildModePool(pScrn);
if (!pScrn->modePool)
@@ -864,12 +831,12 @@ RDCPreInit(ScrnInfoPtr pScrn, int flags)
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "== No Video BIOS modes for chosen ==\n");
return FALSE;
}
- /* Mode Valid */
+
clockRanges = xnfcalloc(sizeof(ClockRange), 1);
clockRanges->next = NULL;
clockRanges->minClock = 9500;
clockRanges->maxClock = 266950;
- clockRanges->clockIndex = -1; /* -1 for programmable clocks */
+ clockRanges->clockIndex = -1;
clockRanges->interlaceAllowed = FALSE;
clockRanges->doubleScanAllowed = FALSE;
@@ -914,7 +881,7 @@ RDCPreInit(ScrnInfoPtr pScrn, int flags)
xf86SetDpi(pScrn, 0, 0);
- /* Accelaration Check */
+
pRDC->noAccel = TRUE;
pRDC->AccelInfoPtr = NULL;
pRDC->CMDQInfo.ulCMDQSize = 0;
@@ -956,10 +923,10 @@ RDCPreInit(ScrnInfoPtr pScrn, int flags)
}
#endif
- /* Setup HW support capability */
+
RDCSetHWCaps(pRDC);
- /* HW Cursor Check */
+
pRDC->noHWC = TRUE;
pRDC->HWCInfoPtr = NULL;
#ifdef HWC
@@ -992,7 +959,7 @@ RDCPreInit(ScrnInfoPtr pScrn, int flags)
}
#endif
- /* We won't be using the VGA access after the probe */
+
xf86SetOperatingState(resVgaIo, pRDC->pEnt->index, ResUnusedOpr);
xf86SetOperatingState(resVgaMem, pRDC->pEnt->index, ResDisableOpr);
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Exit24 RDCPreInit()== return TRUE\n");
@@ -1008,7 +975,7 @@ RDCScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
vgaHWPtr hwp;
VisualPtr visual;
- /* for FB Manager */
+
BoxRec FBMemBox;
int AvailFBSize;
@@ -1018,7 +985,7 @@ RDCScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pRDC = RDCPTR(pScrn);
hwp = VGAHWPTR(pScrn);
- /* AvailFBSize = pRDC->FbMapSize - pRDC->CMDQInfo.ulCMDQSize; */
+
AvailFBSize = pRDC->AvailableFBsize;
FBMemBox.x1 = 0;
@@ -1026,7 +993,7 @@ RDCScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
FBMemBox.x2 = pScrn->displayWidth;
FBMemBox.y2 = (AvailFBSize / (pScrn->displayWidth * ((pScrn->bitsPerPixel+1)/8))) - 1;
if (FBMemBox.y2 <= 0)
- FBMemBox.y2 = 32767; /* because FBMemBox.y2 is a value of short type, so its range is from -32768 ~ 32767*/
+ FBMemBox.y2 = 32767;
xf86DrvMsgVerb(scrnIndex, X_INFO, InfoLevel, "AvailFBSize = %d\n", AvailFBSize);
xf86DrvMsgVerb(scrnIndex, X_INFO, InfoLevel, "FBMemBox: x1 = %d, y1 = %d, x2 = %d, y2 = %d\n",FBMemBox.x1, FBMemBox.y1, FBMemBox.x2, FBMemBox.y2);
@@ -1053,7 +1020,7 @@ RDCScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
miClearVisualTypes();
- /* Re-implemented Direct Color support, -jens */
+
if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth), pScrn->rgbBits, pScrn->defaultVisual))
{
xf86DrvMsgVerb(scrnIndex, X_INFO, ErrorLevel, "==RDCScreenInit() Set Visual Type Fail== return FALSE\n");
@@ -1089,7 +1056,7 @@ RDCScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
if (pScrn->bitsPerPixel > 8)
{
- /* Fixup RGB ordering */
+
visual = pScreen->visuals + pScreen->numVisuals;
while (--visual >= pScreen->visuals)
{
@@ -1118,7 +1085,7 @@ RDCScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pRDC->noAccel = TRUE;
}
}
-#endif /* end of Accel_2D */
+#endif
miInitializeBackingStore(pScreen);
xf86SetBackingStore(pScreen);
@@ -1126,7 +1093,7 @@ RDCScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
- /* Init hardware cursor */
+
if (!pRDC->noHWC)
{
if (!RDCCursorInit(pScreen))
@@ -1150,20 +1117,20 @@ RDCScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
return FALSE;
}
- /* Init DPMS */
+
xf86DPMSInit(pScreen, RDCDisplayPowerManagementSet, 0);
pScreen->SaveScreen = RDCSaveScreen;
pRDC->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = RDCCloseScreen;
#if 0
- /* Remove restart flag file for utility */
+
UTRemoveRestartFlag(pBIOSInfo);
#endif
- /* Create a extension handler to receive the request of RDCutility. */
+
RDCDisplayExtensionInit(pScrn);
- /* Init Video */
+
if (pRDC->ENGCaps & ENG_CAP_VIDEO_DISP)
RDCVideoInit(pScreen);
@@ -1172,7 +1139,7 @@ RDCScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
xf86DrvMsgVerb(scrnIndex, X_INFO, DefaultLevel, "==RDCScreenInit() Normal Exit==\n");
return TRUE;
-} /* RDCScreenInit */
+}
Bool RDCSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
{
@@ -1203,14 +1170,16 @@ RDCAdjustFrame(int scrnIndex, int x, int y, int flags)
ULONG base;
xf86DrvMsgVerb(scrnIndex, X_INFO, DefaultLevel, "==Enter RDCAdjustFrame(x = %d, y = %d)== \n", x, y);
- base = y * pRDC->VideoModeInfo.ScreenPitch + x * pRDC->VideoModeInfo.bitsPerPixel / 8;
-
+ base = y * pRDC->VideoModeInfo.ScreenPitch +
+ x * pRDC->VideoModeInfo.bitsPerPixel / 8;
+
vSetStartAddressCRT1(pRDC, base);
+
xf86DrvMsgVerb(scrnIndex, X_INFO, DefaultLevel, "==Exit1 RDCAdjustFrame()== \n");
}
-/* enter into X Server */
+
static Bool
RDCEnterVT(int scrnIndex, int flags)
{
@@ -1230,7 +1199,7 @@ RDCEnterVT(int scrnIndex, int flags)
return TRUE;
}
-/* leave X server */
+
static void
RDCLeaveVT(int scrnIndex, int flags)
{
@@ -1239,6 +1208,7 @@ RDCLeaveVT(int scrnIndex, int flags)
RDCRecPtr pRDC = RDCPTR(pScrn);
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Enter RDCLeaveVT();== \n");
+
#ifdef HWC
pRDC->HWCInfoPtr->HideCursor(pScrn);
#endif
@@ -1274,7 +1244,6 @@ RDCValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
RDCRecPtr pRDC = RDCPTR(pScrn);
CBIOS_ARGUMENTS CBiosArguments;
CBIOS_Extension CBiosExtension;
- BYTE bCurrentDeviceIdx;
USHORT wLCDHorSize, wLCDVerSize;
USHORT wVESAModeHorSize, wVESAModeVerSize;
@@ -1286,27 +1255,12 @@ RDCValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
CBiosExtension.pCBiosArguments = &CBiosArguments;
CBiosExtension.IOAddress = (USHORT)(pRDC->RelocateIO);
CBiosExtension.VideoVirtualAddress = (ULONG)(pRDC->FBVirtualAddr);
- CBiosArguments.reg.x.AX = 0x4f14;
+ CBiosArguments.reg.x.AX = OEMFunction;
CBiosArguments.reg.x.BX = QueryDisplayPathInfo;
CInt10(&CBiosExtension);
- bCurrentDeviceIdx = (CBiosArguments.reg.ex.EBX & 0xf0000) >> 16;
+ pRDC->DeviceInfo.ucDeviceID = (CBiosArguments.reg.ex.EBX & 0xf0000) >> 16;
+
-/*
- if (bCurrentDeviceIdx == 0x1) // if LCD is active in disp1
- {
- if ((wVESAModeHorSize > 1280) || (wVESAModeVerSize > 1024))
- {
- return MODE_BAD;
- }
- }
- else
- {
- if (mode->PrivFlags & LCD_TIMING)
- {
- return MODE_BAD;
- }
- }
-*/
if (mode->Flags & V_INTERLACE)
{
if (verbose)
@@ -1318,40 +1272,50 @@ RDCValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
return MODE_NO_INTERLACE;
}
- if ((mode->HDisplay > 1680) || (mode->VDisplay > 1050))
+ if (pRDC->DeviceInfo.ucDeviceID == TVINDEX)
{
+ if ((mode->HDisplay == 640) && (mode->VDisplay == 480))
+ {
+ return MODE_OK;
+ }
+
+ if ((mode->HDisplay == 800) && (mode->VDisplay == 600))
+ {
+ return MODE_OK;
+ }
return MODE_BAD;
}
-
- if ((mode->HDisplay < 640) || (mode->VDisplay < 480))
+ else
{
- return MODE_BAD;
- }
+ if ((mode->HDisplay > 1680) || (mode->VDisplay > 1050))
+ {
+ return MODE_BAD;
+ }
- if ((mode->HDisplay >= 1280) &&
- ((pScrn->bitsPerPixel > 16) || (mode->VRefresh > 62.0)))
- {
- return MODE_BAD;
- }
+ if ((mode->HDisplay < 640) || (mode->VDisplay < 480))
+ {
+ return MODE_BAD;
+ }
- /* To Do */
- /* 1. Validate Mode by memory bandwidth */
- /* 2. If LCD enable, validate mode by panel size */
- /* 3. If TV enable, validate mode by TV type */
+ if ((mode->HDisplay >= 1280) &&
+ ((pScrn->bitsPerPixel > 16) || (mode->VRefresh > 62.0)))
+ {
+ return MODE_BAD;
+ }
+ }
+
+
+
+
+
Flags = RDCFilterModeByBandWidth(pScrn, mode);
return Flags;
}
-/* Internal used modules */
-/*
- * RDCGetRec and RDCFreeRec --
- *
- * Private data for the driver is stored in the screen structure.
- * These two functions create and destroy that private data.
- *
- */
+
+
static Bool
RDCGetRec(ScrnInfoPtr pScrn)
{
@@ -1396,7 +1360,7 @@ RDCSaveScreen(ScreenPtr pScreen, Bool unblack)
{
Bool RetStatus;
xf86DrvMsgVerb(0, X_INFO, DefaultLevel, "==Enter RDCSaveScreen(unblack = %d)== \n", unblack);
- /* more ref. SiS */
+
RetStatus = vgaHWSaveScreen(pScreen, unblack);
xf86DrvMsgVerb(0, X_INFO, DefaultLevel, "==Exit1 RDCSaveScreen()== return RetStatus\n");
@@ -1425,6 +1389,15 @@ RDCCloseScreen(int scrnIndex, ScreenPtr pScreen)
RDCRestore(pScrn);
vgaHWLock(hwp);
+
+ if (pRDC->DeviceInfo.ucDeviceID == TVINDEX)
+ {
+ if (VBESetVBEMode(pRDC->pVbe, 3, NULL) == FALSE)
+ {
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, ErrorLevel, "==RDCVBESetMode() Fail\n");
+ return FALSE;
+ }
+ }
}
RDCUnmapMem(pScrn);
@@ -1465,13 +1438,13 @@ RDCSave(ScrnInfoPtr pScrn)
vgaReg = &VGAHWPTR(pScrn)->SavedReg;
RDCReg = &pRDC->SavedReg;
- /* do save */
+
vgaHWSave(pScrn, vgaReg, VGA_SR_ALL);
- /* Ext. Save */
+
vRDCOpenKey(pScrn);
- /* save PLL value */
+
GetIndexReg(CRTC_PORT, 0xC0, RDCReg->ucPLLValue[0]);
GetIndexReg(CRTC_PORT, 0xC1, RDCReg->ucPLLValue[1]);
GetIndexReg(CRTC_PORT, 0xCF, RDCReg->ucPLLValue[2]);
@@ -1495,15 +1468,15 @@ RDCRestore(ScrnInfoPtr pScrn)
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Enter RDCRestore()== \n");
- /* do restore */
+
vgaHWProtect(pScrn, TRUE);
vgaHWRestore(pScrn, vgaReg, VGA_SR_ALL);
vgaHWProtect(pScrn, FALSE);
- /* Ext. restore */
+
vRDCOpenKey(pScrn);
- /* restore PLL value */
+
SetIndexReg(CRTC_PORT, 0xC0, RDCReg->ucPLLValue[0]);
SetIndexReg(CRTC_PORT, 0xC1, RDCReg->ucPLLValue[1]);
SetIndexReg(CRTC_PORT, 0xCF, RDCReg->ucPLLValue[2]);
@@ -1542,20 +1515,20 @@ RDCDoDDC(ScrnInfoPtr pScrn, int index)
RDCRecPtr pRDC = RDCPTR(pScrn);
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Enter RDCDoDDC()== \n");
- /* Honour Option "noDDC" */
+
if (xf86ReturnOptValBool(pRDC->Options, OPTION_NO_DDC, FALSE))
{
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Exit1 RDCDoDDC()== return(MonInfo)\n");
return MonInfo;
}
-
- if (xf86LoadSubModule(pScrn, "vbe") && (pVbe = VBEInit(NULL, index)))
+
+ pVbe = pRDC->pVbe;
+
+ if (pVbe)
{
- xf86LoaderReqSymLists(vbeSymbols, NULL);
MonInfo = vbeDoEDID(pVbe, NULL);
xf86PrintEDID(MonInfo);
xf86SetDDCproperties(pScrn, MonInfo);
- vbeFree(pVbe);
}
else
{
@@ -1597,13 +1570,15 @@ RDCModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
pRDC = RDCPTR(pScrn);
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Enter RDCModeInit()== \n");
-
+
CBiosExtension.pCBiosArguments = &CBiosArguments;
CBiosExtension.IOAddress = (USHORT)(pRDC->RelocateIO);
- CBiosArguments.reg.x.AX = 0x4f14;
+ CBiosArguments.reg.x.AX = OEMFunction;
CBiosArguments.reg.x.BX = QueryDisplayPathInfo;
CInt10(&CBiosExtension);
- if (((CBiosArguments.reg.ex.EBX >> 22) & 0xF) != 0x1) /* if not LCD */
+ pRDC->DeviceInfo.ucNewDeviceID = ((CBiosArguments.reg.ex.EBX >> 22) & 0xF);
+
+ if (pRDC->DeviceInfo.ucNewDeviceID != LCDINDEX)
{
if (mode->PrivFlags & LCD_TIMING)
{
@@ -1612,7 +1587,6 @@ RDCModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
}
}
-
vgaHWUnlock(hwp);
if (!vgaHWInit(pScrn, mode))
@@ -1628,10 +1602,10 @@ RDCModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
{
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, ErrorLevel, "==RDCModeInit() RDCSetMode Fail== return FALSE\n");
return FALSE;
- }
+ }
+
- /* update display path info */
- CBiosArguments.reg.x.AX = 0x4f14;
+ CBiosArguments.reg.x.AX = OEMFunction;
CBiosArguments.reg.x.BX = QueryDisplayPathInfo;
CInt10(&CBiosExtension);
if (CBiosArguments.reg.x.AX == VBEFunctionCallSuccessful)
@@ -1648,7 +1622,7 @@ RDCModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
xf86DrvMsgVerb(pScrn->scrnIndex, X_ERROR, ErrorLevel, "Query Display Path Info Fail(%04X)\n", CBiosArguments.reg.x.AX);
}
- CBiosArguments.reg.x.AX = 0x4f14;
+ CBiosArguments.reg.x.AX = OEMFunction;
CBiosArguments.reg.x.BX = QueryLCDPanelSizeMode;
CBiosArguments.reg.lh.CL = 0;
CInt10(&CBiosExtension);
@@ -1669,7 +1643,7 @@ RDCModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
xf86DrvMsgVerb(pScrn->scrnIndex, X_ERROR, ErrorLevel, "Query LCD Panel Size Fail(%04X)\n", CBiosArguments.reg.x.AX);
}
- /* reset screen offset */
+
pRDC->HWCInfo.iScreenOffset_x = 0;
pRDC->HWCInfo.iScreenOffset_y = 0;
RDCAdjustFrame(pScrn->scrnIndex, 0, 0, 0);
diff --git a/src/rdc_extension.c b/src/rdc_extension.c
index cba9c61..5d37c0a 100644
--- a/src/rdc_extension.c
+++ b/src/rdc_extension.c
@@ -18,9 +18,8 @@
* <jason.lin@rdc.com.tw>
*/
-/*
- * I N C L U D E S
- */
+
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -48,37 +47,35 @@
#include "xf86PciInfo.h"
#include "xf86Pci.h"
-/* framebuffer offscreen manager */
+
#include "xf86fbman.h"
-/* include xaa includes */
+
#include "xaa.h"
#include "xaarop.h"
-/* H/W cursor support */
+
#include "xf86Cursor.h"
-/* Driver specific headers */
+
#include "rdc.h"
-#include "X11/Xproto.h" /* For Xextension */
-#include "extnsionst.h" /* For Xextension */
-#include "dixstruct.h" /* For Xextension */
+#include "X11/Xproto.h"
+#include "extnsionst.h"
+#include "dixstruct.h"
#include "rdc_extension.h"
//#include <sys/ipc.h>
//#include <sys/shm.h>
-CARD32 *inBufPtr, *outBufPtr ; /* For share memory use */
+CARD32 *inBufPtr, *outBufPtr ;
+
-/* Record screen number. */
int g_ScreenNumber;
-/*
- Query the RDCGFX_API version.
-*/
+
static int ProcRDCGFXQueryVersion (ClientPtr client)
{
xRDCGFXQueryVersionReply rep;
@@ -104,29 +101,23 @@ static int ProcRDCGFXQueryVersion (ClientPtr client)
}
-/*
- Receive and process the request from AP.
-*/
+
static int ProcRDCGFXCommand(ClientPtr client)
{
xRDCGFXCommandReq *req = (xRDCGFXCommandReq*)client->requestBuffer; register int n;
int i, ret;
REQUEST_SIZE_MATCH(*req);
- /*if ((SIZEOF(xRDCGFXCommandReq) >> 2) != req->length) { \
- int lengthword = req->length; \
- SendErrToClient(client, FSBadLength, (pointer)&lengthword); \
- return (FSBadLength); \
- }*/
+
- /* Get pointer to ExtensionEntry */
+
if(!CheckExtension(RDC_GFX_UT_EXTENSION_NAME)) return BadMatch;
- /* Process the request. */
+
RDCGFXUtilityProc(req);
- //req->reqType = X_Reply;
- //req->length = (CARD16)(sizeof(xRDCGFXCommandReq) - sizeof(xGenericReply)) >> 2;
+
+
xGenericReply *reply = client->requestBuffer;
reply->type = X_Reply;
reply->length = 0;
@@ -143,7 +134,7 @@ static int ProcRDCGFXCommand(ClientPtr client)
}
}
#endif
- //WriteToClient(client, sizeof(xRDCGFXCommandReq), (char *)req);
+
WriteToClient(client, sizeof(xGenericReply), (char *)reply);
return client->noClientException;
}
@@ -170,7 +161,7 @@ void RDCDisplayExtensionInit(ScrnInfoPtr pScrn)
{
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 5, "==Enter RDCDisplayExtensionInit()== \n");
- // init share memory
+
int shm_in_id, shm_out_id ;
key_t in_key, out_key ;
char inBufName[32] = "/RDC/GFX/shm/inBuf" ;
@@ -186,7 +177,7 @@ void RDCDisplayExtensionInit(ScrnInfoPtr pScrn)
if(NULL == CheckExtension(RDC_GFX_UT_EXTENSION_NAME))
{
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 6, "== check point 1== \n");
- /* if extension doesn't exist, add it */
+
if (!AddExtension(RDC_GFX_UT_EXTENSION_NAME, 0, 0,
ProcRDCGFXDispatch,
ProcRDCGFXDispatch,
@@ -199,7 +190,7 @@ void RDCDisplayExtensionInit(ScrnInfoPtr pScrn)
}
else
{
- /* else if extension exists */
+
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "error: RDC GFX Extension Exists!\n");
}
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 5, "==Exit RDCDisplayExtensionInit()== \n");
@@ -216,26 +207,16 @@ int RDCGFXUtilityProc(xRDCGFXCommandReq* req)
CBIOSExtension.pCBiosArguments = &CBiosArguments;
CBIOSExtension.IOAddress = (USHORT)(pRDC->RelocateIO) ;
CBIOSExtension.VideoVirtualAddress = (ULONG)(pRDC->FBVirtualAddr);
- /*
- STChen[2006.7.11]: In SAMM case, a driver controls a screen.
- In the past, we have to move application's window to switch to correct driver.
- So I add following step to detect which driver we should use to avoid this problem.
-
- if (pRDC->pBIOSInfo->SAMM)
- {
- pScrn = RDCScreenSelection(pScrn, rep->primary_id, rep->secondary_id);
- pRDC = RDCPTR(pScrn);
- }
- */
+
ULONG ulResult;
switch(req->util_cmd_id)
{
- //
- // Output devices function group
- //
- case UT_QUERY_SUPPORT_DEVICE: /* done */
+
+
+
+ case UT_QUERY_SUPPORT_DEVICE:
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, "DrvEscape: Query Device Support");
if (req->outBufferSize != sizeof(ULONG))
@@ -254,7 +235,7 @@ int RDCGFXUtilityProc(xRDCGFXCommandReq* req)
}
break;
- case UT_QUERY_CONNECT_DEVICE: /* done */
+ case UT_QUERY_CONNECT_DEVICE:
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, "DrvEscape: Query Device Connect");
if (req->outBufferSize != sizeof(ULONG))
@@ -284,17 +265,17 @@ int RDCGFXUtilityProc(xRDCGFXCommandReq* req)
switch (inBufPtr[0] & 0xFFFF)
{
- case 0x04: /* B_CRT */
- CBiosArguments.reg.lh.CL = 3; /* CRT_ID */
+ case 0x04:
+ CBiosArguments.reg.lh.CL = 3;
break;
- case 0x01: /* B_LCD */
- CBiosArguments.reg.lh.CL = 1; /* LCD_ID */
+ case 0x01:
+ CBiosArguments.reg.lh.CL = 1;
break;
- case 0x02: /* B_DVI */
- CBiosArguments.reg.lh.CL = 2; /* DVI_ID */
+ case 0x02:
+ CBiosArguments.reg.lh.CL = 2;
break;
- case 0x20: /* B_TV */
- CBiosArguments.reg.lh.CL = 6; /* TV_ID */
+ case 0x20:
+ CBiosArguments.reg.lh.CL = 6;
break;
default:
CBiosArguments.reg.lh.CL = 0;
@@ -324,34 +305,34 @@ int RDCGFXUtilityProc(xRDCGFXCommandReq* req)
outBufPtr[0] = 0;
switch ((CBiosArguments.reg.ex.EBX & 0x000F0000) >> 16)
{
- case 3: /* CRT_ID */
- outBufPtr[0] |= 0x0004; /* B_CRT */
+ case 3:
+ outBufPtr[0] |= 0x0004;
break;
- case 1: /* LCD_ID */
- outBufPtr[0] |= 0x0001; /* B_LCD */
+ case 1:
+ outBufPtr[0] |= 0x0001;
break;
- case 2: /* DVI_ID */
- outBufPtr[0] |= 0x0002; /* B_DVI */
+ case 2:
+ outBufPtr[0] |= 0x0002;
break;
- case 6: /* TV_ID */
- outBufPtr[0] |= 0x0020; /* B_TV */
+ case 6:
+ outBufPtr[0] |= 0x0020;
break;
default:
break;
}
switch ((CBiosArguments.reg.ex.ECX & 0x000F0000) >> 16)
{
- case 3: /* CRT_ID */
- outBufPtr[0] |= 0x0004; /* B_CRT */
+ case 3:
+ outBufPtr[0] |= 0x0004;
break;
- case 1: /* LCD_ID */
- outBufPtr[0] |= 0x0001; /* B_LCD */
+ case 1:
+ outBufPtr[0] |= 0x0001;
break;
- case 2: /* DVI_ID */
- outBufPtr[0] |= 0x0002; /* B_DVI */
+ case 2:
+ outBufPtr[0] |= 0x0002;
break;
- case 6: /* TV_ID */
- outBufPtr[0] |= 0x0020; /* B_TV */
+ case 6:
+ outBufPtr[0] |= 0x0020;
break;
default:
break;
@@ -365,7 +346,7 @@ int RDCGFXUtilityProc(xRDCGFXCommandReq* req)
}
break;
- /* Query hardware info function group */
+
case UT_QUERY_HW_INFO:
if (req->outBufferSize != sizeof(UTHWINFO))
return UT_FAIL;
@@ -439,55 +420,7 @@ int RDCGFXUtilityProc(xRDCGFXCommandReq* req)
}
break;
#if 0
-/*
- case UT_QUERY_SAMM:
- {
- if (cjOut != sizeof(ULONG))
- return UT_INVALID;
- *(ULONG*)pvOut = ppdev->pMultiMon->bEnableSAMMMode;
-
- return (UT_SUCCESS);
- }
- break;
- case UT_SET_GAMMA:
- {
- if ((cjIn != sizeof(GammaTbl)) ||
- (((pGammaTbl)pvIn)->dwSize != MAX_CLUT_SIZE))
- return UT_INVALID;
-
- if (!EngDeviceIoControl(ppdev->hDriver,
- IOCTL_VIDEO_SET_COLOR_REGISTERS,
- ((pGammaTbl)pvIn)->pClut,
- ((pGammaTbl)pvIn)->dwSize,
- NULL,
- 0,
- &ulResult))
- {
- return UT_SUCCESS;
- }
- else
- return UT_FAIL;
- }
- break;
- case UT_QUERY_GAMMA:
- {
- if ((cjOut != sizeof(GammaTbl)) ||
- (((pGammaTbl)pvIn)->dwSize != MAX_CLUT_SIZE))
- return UT_INVALID;
-
- //
- // Get Gamma value from Look up table
- //
- if (*(ULONG*)pvIn & CRT)
- QueryRegistryValue(ppdev, CRTGamma, ((pGammaTbl)pvOut)->pClut, MAX_CLUT_SIZE);
- else if (*(ULONG*)pvIn & LCD)
- QueryRegistryValue(ppdev, LCDGamma, ((pGammaTbl)pvOut)->pClut, MAX_CLUT_SIZE);
-
- return UT_SUCCESS;
- }
- break;
-*/
#endif
case UT_SET_LCD_PWM:
if (req->inBufferSize != sizeof(UCHAR))
@@ -521,14 +454,14 @@ int RDCGFXUtilityProc(xRDCGFXCommandReq* req)
if (req->outBufferSize != sizeof(LCDINFO))
return UT_FAIL;
- // If color depth is 32 bpp, set it to 24.
+
int iDepth = pScrn->depth;
- if (iDepth == 32) // 24 and 32 bpp should have same index 2.
+ if (iDepth == 32)
iDepth = 24;
CBiosArguments.reg.x.AX = OEMFunction;
CBiosArguments.reg.x.BX = QueryLCDPanelSizeMode;
- CBiosArguments.reg.lh.CL = (iDepth/8) - 1; // Color depth : 0(8 bpp), 1(16 bpp), 2(24/32 bpp)
+ CBiosArguments.reg.lh.CL = (iDepth/8) - 1;
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, "Color depth is %d\n", CBiosArguments.reg.lh.CL);
if (CInt10(&CBIOSExtension))
{
@@ -540,29 +473,7 @@ int RDCGFXUtilityProc(xRDCGFXCommandReq* req)
}
break;
#if 0
-/*
- case UT_DECODER_JPEG_ENTRY:
- {
- DBG_GDI((0, "DrvEscape: UT_DECODER_JPEG_ENTRY"));
- ulResult = ExtJpegDecoderEntry(pso, cjIn, pvIn, cjOut, pvOut);
- return ulResult;
- }
- break;
- case UT_ENCODER_JPEG_ENTRY:
- {
- DBG_GDI((0, "DrvEscape: UT_ENCODER_JPEG_ENTRY"));
- ulResult = ExtJpegEncoderEntry(pso, cjIn, pvIn, cjOut, pvOut);
- return ulResult;
- }
- break;
- case UT_GET_USERMODE_DIRECTACCESS:
- {
- DBG_GDI((0, "DrvEscape: UT_GET_USERMODE_DIRECTACCESS")) ;
- ulResult = ExtUserModeDirectAccess(pso, cjIn, pvIn, cjOut, pvOut) ;
- return ulResult ;
- }
- break ;
-*/
+
#endif
default:
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, "RDCGFXUtilityProc: unknown command 0x%x", req->util_cmd_id);
diff --git a/src/rdc_extension.h b/src/rdc_extension.h
index 81144ee..5549b02 100644
--- a/src/rdc_extension.h
+++ b/src/rdc_extension.h
@@ -18,11 +18,12 @@
* <jason.lin@rdc.com.tw>
*/
-/******************************************************************************/
-/* */
-/* Escape function definite */
-/* */
-/******************************************************************************/
+
+
+
+
+
+
// user defined type.
typedef unsigned short WORD;
@@ -65,7 +66,7 @@ typedef unsigned long DWORD;
#define UT_GET_USERMODE_DIRECTACCESS 0x2200
-/* For display Xextension */
+
#define RDC_GFX_UT_EXTENSION_NAME "RDCGFX_API"
#define RDCGFX_PARM_NUM 256
@@ -74,7 +75,7 @@ typedef unsigned long DWORD;
#define X_RDCGFXCommand 1
typedef struct {
- BYTE type; /* X_Reply */
+ BYTE type;
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
@@ -100,26 +101,26 @@ typedef struct {
CARD32 pad;
} xRDCGFXCommandReq;
-/*============ Request and Reply Structures Definition==================*/
+
typedef union
{
- struct
- {
- WORD LCD ;
- WORD DVI ;
- WORD CRT ;
- WORD HDMI ;
- WORD HDTV ;
- WORD TV ;
- WORD LCD2 ;
- WORD DVI2 ;
- WORD CRT2 ;
- WORD HDMI2 ;
- WORD HDTV2 ;
- WORD TV2 ;
- WORD RESERVE ;
- } TABLE ;
- WORD MERGE ;
+ struct
+ {
+ WORD LCD;
+ WORD DVI;
+ WORD CRT;
+ WORD HDMI;
+ WORD HDTV;
+ WORD TV;
+ WORD LCD2;
+ WORD DVI2;
+ WORD CRT2;
+ WORD HDMI2;
+ WORD HDTV2;
+ WORD TV2;
+ WORD RESERVE;
+ } TABLE;
+ WORD MERGE;
} UTDEVICELIST;
typedef struct _UTHWINFO
@@ -132,7 +133,7 @@ typedef struct _UTHWINFO
}UTHWINFO;
typedef struct _UTBIOSDATA
- {
+{
ULONG wData1;
ULONG wData2;
ULONG wData3;
@@ -141,8 +142,8 @@ typedef struct _UTBIOSDATA
typedef struct _CLKINFO
{
- ULONG MemCLK; /*(The unit is MHz)*/
- ULONG EngCLK; /*(The unit is MHz)*/
+ ULONG MemCLK;
+ ULONG EngCLK;
}CLKINFO;
typedef struct _VIDEO_CLUTDATA
@@ -155,10 +156,10 @@ typedef struct _VIDEO_CLUTDATA
typedef struct
{
- USHORT NumEntries ; // total 256 entries
- USHORT FirstEntry ; // start from 0
+ USHORT NumEntries ;
+ USHORT FirstEntry ;
union
- {
+ {
VIDEO_CLUTDATA RgbArray ;
ULONG RgbLong ;
} LookupTable[1] ;
@@ -166,9 +167,9 @@ typedef struct
typedef struct
{
- DWORD device ; // the device
- DWORD dwSize; // the size of gamma tbl
- PVIDEO_CLUT table ; // the table
+ DWORD device ;
+ DWORD dwSize;
+ PVIDEO_CLUT table ;
} GammaTbl, *pGammaTbl ;
// LCD info structure.
diff --git a/src/rdc_mode.c b/src/rdc_mode.c
index 7834e68..dca4bc4 100644
--- a/src/rdc_mode.c
+++ b/src/rdc_mode.c
@@ -17,6 +17,7 @@
* For technical support :
* <jason.lin@rdc.com.tw>
*/
+
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -42,17 +43,17 @@
#include "xf86PciInfo.h"
#include "xf86Pci.h"
-/* framebuffer offscreen manager */
+
#include "xf86fbman.h"
-/* include xaa includes */
+
#include "xaa.h"
#include "xaarop.h"
-/* H/W cursor support */
+
#include "xf86Cursor.h"
-/* Driver specific headers */
+
#include "rdc.h"
RRateInfo RefreshRateMap[] = { {60.0f, FALSE, 0},
@@ -71,7 +72,7 @@ RRateInfo RefreshRateMap[] = { {60.0f, FALSE, 0},
{65.0f, FALSE, 15}};
-/* extern. function */
+
extern void vRDCOpenKey(ScrnInfoPtr pScrn);
extern Bool bRDCRegInit(ScrnInfoPtr pScrn);
@@ -82,7 +83,7 @@ extern Bool bEnable2D(ScrnInfoPtr pScrn, RDCRecPtr pRDC);
extern Bool bInitHWC(ScrnInfoPtr pScrn, RDCRecPtr pRDC);
#endif
-/* Prototype type declaration*/
+
Bool RDCSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode);
USHORT usGetVbeModeNum(ScrnInfoPtr pScrn, DisplayModePtr mode);
float fDifference(float Value1, float Value2);
@@ -91,7 +92,6 @@ Bool BTranslateIndexToRefreshRate(UCHAR ucRRateIndex, float *fRefreshRate);
char* pcConvertResolutionToString(ULONG ulResolution);
DisplayModePtr SearchDisplayModeRecPtr(DisplayModePtr pModePoolHead, CBIOS_ARGUMENTS CBiosArguments);
-
Bool
RDCSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
{
@@ -113,41 +113,46 @@ RDCSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
CBiosExtension.IOAddress = (USHORT)(pRDC->RelocateIO);
CBiosExtension.VideoVirtualAddress = (ULONG)(pRDC->FBVirtualAddr);
- /*CBiosArguments.reg.x.AX = 0x4f14;
- CBiosArguments.reg.x.BX = SetActiveDisplayDevice;
- CBiosArguments.reg.lh.CL = 0x13;
- CInt10(&CBiosExtension);*/
- /*xf86DrvMsg(pScrn->scrnIndex, X_INFO, "==RDCSetMode() Set Refresh Rate = %f== \n",mode->VRefresh);*/
- CBiosArguments.reg.x.AX = 0x4f14;
+
+
+ CBiosArguments.reg.x.AX = OEMFunction;
CBiosArguments.reg.x.BX = SetDisplay1RefreshRate;
CBiosArguments.reg.lh.CL = pModePrivate->ucRRate_ID;
CInt10(&CBiosExtension);
-
- usVESAMode = usGetVbeModeNum(pScrn, mode);
- /*xf86DrvMsg(pScrn->scrnIndex, X_INFO, "==RDCSetMode() Set VESA Mode 0x%x== \n",uVESAMode);*/
- CBiosArguments.reg.x.AX = VBESetMode;
- CBiosArguments.reg.x.BX = (0x4000 | usVESAMode);
- CInt10(&CBiosExtension);
- /*xf86DrvMsg(pScrn->scrnIndex, X_INFO, "==RDCSetMode() Set Scan Line pixels== \n");*/
+ usVESAMode = usGetVbeModeNum(pScrn, mode);
+
+ if (pRDC->DeviceInfo.ucNewDeviceID == TVINDEX)
+ {
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, ErrorLevel, "==RDCSetMode() VBios Set mode entry\n");
+ if (pRDC->pVbe == NULL)
+ {
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, ErrorLevel, "==RDCSetMode() pVbe = NULL\n");
+ return FALSE;
+ }
+
+ if (VBESetVBEMode(pRDC->pVbe, usVESAMode, NULL) == FALSE)
+ {
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, ErrorLevel, "==RDCSetMode() VBois set mode Fail\n");
+ return FALSE;
+ }
+ }
+ else
+ {
+ CBiosArguments.reg.x.AX = VBESetMode;
+ CBiosArguments.reg.x.BX = (0x4000 | usVESAMode);
+ CInt10(&CBiosExtension);
+ }
+
+
CBiosArguments.reg.x.AX = VBESetGetScanLineLength;
CBiosArguments.reg.lh.BL = 0x00;
CBiosArguments.reg.x.CX = (USHORT)(pScrn->displayWidth);
CInt10(&CBiosExtension);
- /*
- CBiosArguments.reg.x.AX = 0x4f14;
- CBiosArguments.reg.x.BX = SetVESAModeForDisplay2;
- CBiosArguments.reg.x.CX = (0x4000 | usVESAMode);
- CInt10(&CBiosExtension);
-
- CBiosArguments.reg.x.AX = 0x4f14;
- CBiosArguments.reg.x.BX = SetDisplay2PitchInPixels;
- CBiosArguments.reg.x.CX = (USHORT)(pScrn->displayWidth);
- CInt10(&CBiosExtension);
- */
- /* post set mode */
+
+
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 7, "==RDCSetMode() Enable 2D== \n");
#ifdef Accel_2D
@@ -220,10 +225,9 @@ DisplayModePtr RDCBuildModePool(ScrnInfoPtr pScrn)
RDCRecPtr pRDC = RDCPTR(pScrn);
MODE_PRIVATE *pModePrivate;
USHORT usSerialNum = 0;
- BYTE bCurrentDeviceIdx;
USHORT wLCDHorSize, wLCDVerSize;
USHORT wVESAModeHorSize, wVESAModeVerSize;
- BYTE bColorDepth; //0: 8bpp, 1: 16bpp, 2: 32bpp
+ BYTE bColorDepth;
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Enter RDCBuildModePool()== \n");
@@ -234,7 +238,7 @@ DisplayModePtr RDCBuildModePool(ScrnInfoPtr pScrn)
do {
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 5, "Mode serial Num 0x%x\n",usSerialNum);
- CBiosArguments.reg.x.AX = 0x4f14;
+ CBiosArguments.reg.x.AX = OEMFunction;
CBiosArguments.reg.x.BX = QuerySupportedMode;
CBiosArguments.reg.x.CX = usSerialNum++;
CInt10(&CBiosExtension);
@@ -261,7 +265,7 @@ DisplayModePtr RDCBuildModePool(ScrnInfoPtr pScrn)
pModePoolHead->prev = NULL;
pModePoolTail = pModePoolHead;
}
- /* pModePoolTail points to the last mode */
+
pModePoolTail->next = NULL;
pModePoolTail->name = pcConvertResolutionToString(CBiosArguments.reg.ex.EDX);
@@ -270,12 +274,12 @@ DisplayModePtr RDCBuildModePool(ScrnInfoPtr pScrn)
pModePoolTail->type = M_T_BUILTIN;
pModePoolTail->Flags = 0;
- /* allocate memory to pModePoolTail->Private */
+
pModePoolTail->PrivSize = sizeof(MODE_PRIVATE);
pModePoolTail->Private = xnfalloc(pModePoolTail->PrivSize);
pModePrivate = MODE_PRIVATE_PTR(pModePoolTail);
- /* required timing parameters */
+
pModePoolTail->Clock = pModePoolTail->SynthClock = CBiosArguments.reg.ex.EDI;
pModePoolTail->HDisplay = pModePoolTail->CrtcHDisplay = wVESAModeHorSize;
pModePoolTail->VDisplay = pModePoolTail->CrtcVDisplay = wVESAModeVerSize;
@@ -307,10 +311,10 @@ DisplayModePtr RDCBuildModePool(ScrnInfoPtr pScrn)
}
} while (CBiosArguments.reg.x.AX == VBEFunctionCallSuccessful);
- // query LCD panel modes
+
for (bColorDepth = 0; bColorDepth < 3; bColorDepth++)
{
- CBiosArguments.reg.x.AX = 0x4f14;
+ CBiosArguments.reg.x.AX = OEMFunction;
CBiosArguments.reg.x.BX = QueryLCDPanelSizeMode;
CBiosArguments.reg.x.CX = bColorDepth;
CInt10(&CBiosExtension);
@@ -333,7 +337,7 @@ DisplayModePtr RDCBuildModePool(ScrnInfoPtr pScrn)
pModePoolHead->prev = NULL;
pModePoolTail = pModePoolHead;
}
- /* pModePoolTail points to the last mode */
+
pModePoolTail->next = NULL;
pModePoolTail->name = pcConvertResolutionToString(CBiosArguments.reg.ex.EDX);
@@ -342,12 +346,12 @@ DisplayModePtr RDCBuildModePool(ScrnInfoPtr pScrn)
pModePoolTail->type = M_T_BUILTIN;
pModePoolTail->Flags = 0;
- /* allocate memory to pModePoolTail->Private */
+
pModePoolTail->PrivSize = sizeof(MODE_PRIVATE);
pModePoolTail->Private = xnfalloc(pModePoolTail->PrivSize);
pModePrivate = MODE_PRIVATE_PTR(pModePoolTail);
- /* required timing parameters */
+
pModePoolTail->Clock = pModePoolTail->SynthClock = CBiosArguments.reg.ex.EDI;
pModePoolTail->HDisplay = pModePoolTail->CrtcHDisplay = (CBiosArguments.reg.ex.EDX & 0x0000FFFF);
pModePoolTail->VDisplay = pModePoolTail->CrtcVDisplay = (CBiosArguments.reg.ex.EDX >> 16);
@@ -377,11 +381,11 @@ DisplayModePtr RDCBuildModePool(ScrnInfoPtr pScrn)
}
}
- /* To Do */
- /* Get Mode Support from VGA Bios, if platform has VGA Bios */
- /* Compare Bios mode and driver mode. */
- /* If they have the same mode information, replace driver mode with Bios mode*/
- /* If Bios has new mode, add it to mode pool*/
+
+
+
+
+
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DefaultLevel, "==Exit RDCBuildModePool()== pModePoolHead = 0x%x\n", pModePoolHead);
return pModePoolHead;
@@ -412,7 +416,7 @@ char* pcConvertResolutionToString(ULONG ulResolution)
pcResolution = xnfalloc(10);
- /* compute string size */
+
iIndex = 0;
iStringSize = 1;
diff --git a/src/rdc_mode.h b/src/rdc_mode.h
index f2bbec4..a5516f2 100644
--- a/src/rdc_mode.h
+++ b/src/rdc_mode.h
@@ -18,7 +18,8 @@
* <jason.lin@rdc.com.tw>
*/
-/* Mode Limitation */
+
+
#ifdef FPGA
#define MAX_HResolution 1024
#define MAX_VResolution 768
@@ -27,14 +28,14 @@
#define MAX_VResolution 1200
#endif
-/* Std. Table Index Definition */
+
#define TextModeIndex 0
#define EGAModeIndex 1
#define VGAModeIndex 2
#define HiCModeIndex 3
#define TrueCModeIndex 4
-/* DCLK Index */
+
#define VCLK25_175 0x00
#define VCLK28_322 0x01
#define VCLK31_5 0x02
@@ -51,10 +52,10 @@
#define VCLK135 0x0D
#define VCLK157_5 0x0E
#define VCLK162 0x0F
-/* #define VCLK193_25 0x10 */
+
#define VCLK154 0x10
-/* Flags Definition */
+
#define Charx8Dot 0x00000001
#define HalfDCLK 0x00000002
#define DoubleScanMode 0x00000004
@@ -66,15 +67,15 @@
#define HBorder 0x00000020
#define VBorder 0x00000010
-/* DAC Definition */
+
#define DAC_NUM_TEXT 64
#define DAC_NUM_EGA 64
#define DAC_NUM_VGA 256
-/* DisplayModePtr->PrivFlags */
+
#define LCD_TIMING 0x00010000
-/* Data Structure decalration for internal use */
+
typedef struct {
UCHAR MISC;
UCHAR SEQ[4];
diff --git a/src/rdc_tool.c b/src/rdc_tool.c
index 4ba363a..5fbe75a 100644
--- a/src/rdc_tool.c
+++ b/src/rdc_tool.c
@@ -17,6 +17,7 @@
* For technical support :
* <jason.lin@rdc.com.tw>
*/
+
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -44,20 +45,20 @@
#include "xf86PciInfo.h"
#include "xf86Pci.h"
-/* framebuffer offscreen manager */
+
#include "xf86fbman.h"
-/* include xaa includes */
+
#include "xaa.h"
#include "xaarop.h"
-/* H/W cursor support */
+
#include "xf86Cursor.h"
-/* Driver specific headers */
+
#include "rdc.h"
-/* Prototype type declaration*/
+
Bool RDCMapMem(ScrnInfoPtr pScrn);
Bool RDCUnmapMem(ScrnInfoPtr pScrn);
Bool RDCMapMMIO(ScrnInfoPtr pScrn);
@@ -173,7 +174,7 @@ Bool RDCMapVBIOS(ScrnInfoPtr pScrn)
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, ErrorLevel, "==Enter RDCMapVBIOS()==\n");
pRDC->ulROMType = 0;
- // Map C000
+
if (pRDC->ulROMType == 0)
{
pRDC->BIOSVirtualAddr = xf86MapVidMem(pScrn->scrnIndex, VIDMEM_READONLY, BIOS_ROM_PHY_BASE, BIOS_ROM_SIZE);
@@ -188,17 +189,17 @@ Bool RDCMapVBIOS(ScrnInfoPtr pScrn)
}
}
- // read ROM file
+
if (pRDC->ulROMType == 0)
{
- // open BIOS ROM file
+
fpVBIOS = fopen(BIOS_ROM_PATH_FILE, "r");
if (!fpVBIOS)
{
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, InfoLevel, "BIOS ROM file \"/root/RDCVBIOS.ROM\" not found()==\n");
}
- // memory allocate
+
pRDC->BIOSVirtualAddr = xnfalloc(BIOS_ROM_SIZE);
if (!pRDC->BIOSVirtualAddr)
{
@@ -206,7 +207,7 @@ Bool RDCMapVBIOS(ScrnInfoPtr pScrn)
fclose (fpVBIOS);
}
- // set ROM type
+
if (fpVBIOS && pRDC->BIOSVirtualAddr)
{
pRDC->ulROMType = 2;
@@ -221,7 +222,7 @@ Bool RDCMapVBIOS(ScrnInfoPtr pScrn)
if (pRDC->ulROMType == 0)
{
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, ErrorLevel, "==Exit1 RDCMapVBIOS()== No VBIOS\n");
- return false; // no VBIOS and ROM file
+ return false;
}
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, InfoLevel, "pRDC->ulROMType = %d\n", pRDC->ulROMType);
@@ -236,7 +237,7 @@ Bool RDCMapVBIOS(ScrnInfoPtr pScrn)
RDCUnmapVBIOS(pScrn);
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, ErrorLevel, "==Exit2 RDCMapVBIOS()== Not RDC VBIOS\n");
- return false; // not RDC VGA BIOS
+ return false;
}
}
diff --git a/src/rdc_vgatool.c b/src/rdc_vgatool.c
index 0d84bad..6ed94d8 100644
--- a/src/rdc_vgatool.c
+++ b/src/rdc_vgatool.c
@@ -18,6 +18,7 @@
* <jason.lin@rdc.com.tw>
*/
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -42,20 +43,20 @@
#include "xf86PciInfo.h"
#include "xf86Pci.h"
-/* framebuffer offscreen manager */
+
#include "xf86fbman.h"
-/* include xaa includes */
+
#include "xaa.h"
#include "xaarop.h"
-/* H/W cursor support */
+
#include "xf86Cursor.h"
-/* Driver specific headers */
+
#include "rdc.h"
-/* Prototype type declaration*/
+
void vRDCOpenKey(ScrnInfoPtr pScrn);
Bool bRDCRegInit(ScrnInfoPtr pScrn);
ULONG GetVRAMInfo(ScrnInfoPtr pScrn);
@@ -79,7 +80,7 @@ bRDCRegInit(ScrnInfoPtr pScrn)
{
RDCRecPtr pRDC = RDCPTR(pScrn);
- /* Enable MMIO */
+
SetIndexRegMask(CRTC_PORT,0xA1, 0xFF, 0x04);
return (TRUE);
@@ -133,15 +134,11 @@ RDCFilterModeByBandWidth(ScrnInfoPtr pScrn, DisplayModePtr mode)
void
vSetStartAddressCRT1(RDCRecPtr pRDC, ULONG base)
{
- /* base is byte aligned, flipping base address is quad-word aligned */
ULONG uc1stFlippingCmdReg;
- /* clear [27:3] base address of flipping control */
- uc1stFlippingCmdReg = *(ULONG *)MMIOREG_1ST_FLIP & (~MASK_1ST_FLIP_BASE);
-
- /* combine base with uc1stFlippingCmdReg */
- uc1stFlippingCmdReg |= (base & MASK_1ST_FLIP_BASE);
-
+
+
+ uc1stFlippingCmdReg = (base & MASK_1ST_FLIP_BASE) | CMD_ENABLE_1STFLIP;
*(ULONG *)MMIOREG_1ST_FLIP = uc1stFlippingCmdReg;
}
@@ -161,17 +158,17 @@ RDCGetMemBandWidth(ScrnInfoPtr pScrn)
switch(DEVICE_ID(pRDC->PciInfo))
{
case PCI_CHIP_M2010_A0:
- /* Bus width is 16bit, and DRAM utilization is 30% */
+
ulDRAMBusWidth = 16;
DRAMEfficiency = 300;
break;
case PCI_CHIP_M2011:
- /* Bus width is 32bit, and DRAM utilization is 60% */
+
ulDRAMBusWidth = 32;
DRAMEfficiency = 600;
break;
default:
- /* Bus width is 16bit, and DRAM utilization is 60% */
+
ulDRAMBusWidth = 16;
DRAMEfficiency = 600;
}
@@ -182,8 +179,8 @@ RDCGetMemBandWidth(ScrnInfoPtr pScrn)
vRDCOpenKey(pScrn);
- CBiosExtension.pCBiosArguments->reg.x.AX = 0x4F14;
- CBiosExtension.pCBiosArguments->reg.x.BX = 0x0000;
+ CBiosExtension.pCBiosArguments->reg.x.AX = OEMFunction;
+ CBiosExtension.pCBiosArguments->reg.x.BX = QueryBiosInfo;
CInt10(&CBiosExtension);
if ((CBiosExtension.pCBiosArguments->reg.lh.CL & (0x07)) == 0x03)
@@ -195,9 +192,9 @@ RDCGetMemBandWidth(ScrnInfoPtr pScrn)
ulMCLK = 200;
}
- /* Get Bandwidth */
- /* Use DDRII DRAM, so multiply 2 */
- /* Translate DRAM Bandwidth to byte, so div 8*/
+
+
+
ulDRAMBandwidth = ulMCLK * ulDRAMBusWidth * 2 / 8;
ActualDRAMBandwidth = ulDRAMBandwidth * DRAMEfficiency / 1000;
@@ -274,8 +271,8 @@ vRDCLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors,
VGA_LOAD_PALETTE_INDEX (DACIndex, DACR, DACG, DACB);
}
- } /* end of switch */
-} /* end of vRDCLoadPalette */
+ }
+}
void
RDCDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags)
@@ -291,25 +288,25 @@ RDCDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int fla
switch (PowerManagementMode)
{
case DPMSModeOn:
- /* Screen: On; HSync: On, VSync: On */
+
SEQ01 = 0x00;
CRB6 = 0x00;
break;
case DPMSModeStandby:
- /* Screen: Off; HSync: Off, VSync: On */
+
SEQ01 = 0x20;
CRB6 = 0x01;
break;
case DPMSModeSuspend:
- /* Screen: Off; HSync: On, VSync: Off */
+
SEQ01 = 0x20;
CRB6 = 0x02;
break;
case DPMSModeOff:
- /* Screen: Off; HSync: Off, VSync: Off */
+
SEQ01 = 0x20;
CRB6 = 0x03;
break;
diff --git a/src/rdc_vgatool.h b/src/rdc_vgatool.h
index 07cf2f7..f80d5a2 100644
--- a/src/rdc_vgatool.h
+++ b/src/rdc_vgatool.h
@@ -18,7 +18,37 @@
* <jason.lin@rdc.com.tw>
*/
-/* VRAM Size Definition */
+
+
+#define NoneDevice 0x0
+#define LCDINDEX 0x1
+#define DVIINDEX 0x2
+#define CRTINDEX 0x3
+#define HDMIINDEX 0x4
+#define HDTVINDEX 0x5
+#define TVINDEX 0x6
+#define LCD2INDEX 0x7
+#define DVI2INDEX 0x8
+#define CRT2INDEX 0x9
+#define HDMI2INDEX 0xA
+#define HDTV2INDEX 0xB
+#define TV2INDEX 0xC
+
+
+#define LCDBIT 0x0001
+#define DVIBIT 0x0002
+#define CRTBIT 0x0004
+#define HDMIBIT 0x0008
+#define HDTVBIT 0x0010
+#define TVBIT 0x0020
+#define LCD2BIT 0x0040
+#define DVI2BIT 0x0080
+#define CRT2BIT 0x0100
+#define HDMI2BIT 0x0200
+#define HDTV2BIT 0x0400
+#define TV2BIT 0x0800
+
+
#define VIDEOMEM_SIZE_08M 0x00800000
#define VIDEOMEM_SIZE_16M 0x01000000
#define VIDEOMEM_SIZE_32M 0x02000000
diff --git a/src/rdc_video.c b/src/rdc_video.c
index 3cde151..a508166 100644
--- a/src/rdc_video.c
+++ b/src/rdc_video.c
@@ -18,6 +18,7 @@
* <jason.lin@rdc.com.tw>
*/
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -42,25 +43,25 @@
#include "xf86PciInfo.h"
#include "xf86Pci.h"
-/* framebuffer offscreen manager */
+
#include "xf86fbman.h"
-/* include xaa includes */
+
#include "xaa.h"
#include "xaarop.h"
-/* H/W cursor support */
+
#include "xf86Cursor.h"
#include "cursorstr.h"
-/* FOURCC format support */
+
#include "fourcc.h"
-/* Driver specific headers */
+
#include "rdc.h"
-/* Function Declaration */
+
static XF86VideoAdaptorPtr RDCSetupImageVideoOverlay(ScreenPtr);
static void RDCStopVideo(ScrnInfoPtr,pointer,Bool);
static int RDCSetPortAttribute(ScrnInfoPtr,Atom,INT32,pointer);
@@ -74,7 +75,7 @@ void RDCUpdateVID(RDCRecPtr, RDCPortPrivPtr, BYTE);
void RDCCopyFOURCC(RDCRecPtr, unsigned char*, RDCPortPrivPtr, unsigned long,
unsigned long, int, short, short);
-/* Overlay windows max size */
+
#define IMAGE_MAX_WIDTH 1280
#define IMAGE_MAX_HEIGHT 1024
@@ -171,7 +172,7 @@ RDCSetupImageVideoOverlay(ScreenPtr pScreen)
}
adapt->type = XvWindowMask | XvInputMask | XvImageMask;
- adapt->flags = VIDEO_OVERLAID_IMAGES /*| VIDEO_CLIP_TO_VIEWPORT*/;
+ adapt->flags = VIDEO_OVERLAID_IMAGES ;
adapt->name = "RDC Video Overlay";
adapt->nEncodings = 1;
adapt->pEncodings = DummyEncoding;
@@ -183,7 +184,7 @@ RDCSetupImageVideoOverlay(ScreenPtr pScreen)
pXVPriv = (RDCPortPrivPtr)(&adapt->pPortPrivates[1]);
- /* Init Color Key */
+
pXVPriv->colorkey = (1 << pScrn->offset.red) |
(1 << pScrn->offset.green) |
(((pScrn->mask.blue >> pScrn->offset.blue) - 1) << pScrn->offset.blue);
@@ -206,7 +207,7 @@ RDCSetupImageVideoOverlay(ScreenPtr pScreen)
adapt->PutImage = RDCPutImage;
adapt->QueryImageAttributes = RDCQueryImageAttributesOverlay;
- /* Setting private data structure */
+
pXVPriv->VidhwInfo.dwVidCtl = 0;
pXVPriv->VidhwInfo.dwVideoSrcOffset = 0;
pXVPriv->VidhwInfo.dwFetch = 0;
@@ -219,8 +220,10 @@ RDCSetupImageVideoOverlay(ScreenPtr pScreen)
pXVPriv->VidhwInfo.dwVIDBuffer[1] = 0;
pXVPriv->VidhwInfo.dwVIDBuffer[2] = 0;
pXVPriv->VidhwInfo.dwColorKey = (pXVPriv->colorkey & 0x00FFFFFF) | VDPS_ENABLE_CK;
+ REGION_NULL(pScreen, &pXVPriv->clip);
- *(ULONG*)(pRDC->MMIOVirtualAddr + VDP_CTL) = 0;
+
+ *(ULONG*)(pRDC->MMIOVirtualAddr + VDP_CTL) = VDPS_ENABLE;
*(ULONG*)(pRDC->MMIOVirtualAddr + VDP_START_OFFSET) = 0;
*(ULONG*)(pRDC->MMIOVirtualAddr + VDP_FETCH_COUNT) = 0;
*(ULONG*)(pRDC->MMIOVirtualAddr + VDP_SRC_DISP_COUNT_ON_SCR) = 0;
@@ -229,10 +232,9 @@ RDCSetupImageVideoOverlay(ScreenPtr pScreen)
*(ULONG*)(pRDC->MMIOVirtualAddr + VDP_END_LOCATION) = 0;
*(ULONG*)(pRDC->MMIOVirtualAddr + VDP_ZOOM_CTL) = 0;
*(ULONG*)(pRDC->MMIOVirtualAddr + VDP_FB0) = 0;
- *(ULONG*)(pRDC->MMIOVirtualAddr + VDP_FIRST_COLORKEY) = pXVPriv->VidhwInfo.dwColorKey;
- *(ULONG*)(pRDC->MMIOVirtualAddr + VDP_SECOND_COLORKEY) = pXVPriv->VidhwInfo.dwColorKey;
-
- *(ULONG*)(pRDC->MMIOVirtualAddr + VDP_FIFO_THRESHOLD) = VDPS_FIFO_THRESHOLD;
+ *(ULONG*)(pRDC->MMIOVirtualAddr + VDP_FIRST_COLORKEY) = 0;
+ *(ULONG*)(pRDC->MMIOVirtualAddr + VDP_SECOND_COLORKEY) = 0;
+ *(ULONG*)(pRDC->MMIOVirtualAddr + VDP_FIFO_THRESHOLD) = 0;
*(ULONG*)(pRDC->MMIOVirtualAddr + VDP_CHROMA_KEY_LOW) = 0;
*(ULONG*)(pRDC->MMIOVirtualAddr + VDP_CHROMA_KEY_UPPER) = 0;
*(ULONG*)(pRDC->MMIOVirtualAddr + VDP_COLOR_ENHANCE_CTL1) = 0;
@@ -240,15 +242,15 @@ RDCSetupImageVideoOverlay(ScreenPtr pScreen)
*(ULONG*)(pRDC->MMIOVirtualAddr + VDP_COLOR_ENHANCE_CTL3) = 0;
*(ULONG*)(pRDC->MMIOVirtualAddr + VDP_COLOR_ENHANCE_CTL4) = 0;
-
- /* gotta uninit this someplace */
- REGION_NULL(pScreen, &pXVPriv->clip);
-
xvColorKey = MAKE_ATOM("XV_COLORKEY");
xvBrightness = MAKE_ATOM("XV_BRIGHTNESS");
xvContrast = MAKE_ATOM("XV_CONTRAST");
xvSaturation = MAKE_ATOM("XV_SATURATION");
+ pRDC->OverlayStatus.bOverlayEnable = FALSE;
+ pRDC->OverlayStatus.bPanningOverlayEnable = TRUE;
+ pRDC->OverlayStatus.ulVidDispCtrl = 0;
+
xf86DrvMsgVerb(0, X_INFO, DefaultLevel, "==RDCSetupImageVideoOverlay() exit==\n");
return adapt;
}
@@ -258,21 +260,30 @@ RDCStopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown)
{
RDCRecPtr pRDC = RDCPTR(pScrn);
RDCPortPrivPtr pXVPriv = (RDCPortPrivPtr)data;
-
+
xf86DrvMsgVerb(0, X_INFO, DefaultLevel, "==RDCStopVideo() Entry==\n");
- pRDC->OverlayStatus.bOverlayEnable = false;
+ REGION_EMPTY(pScrn->pScreen, &pXVPriv->clip);
- /* Turn Off overlay engine */
+
if (shutdown)
{
xf86DrvMsgVerb(0, X_INFO, DefaultLevel, "==RDCStopVideo() Stop Overlay==\n");
+
+ pRDC->OverlayStatus.bOverlayEnable = false;
+
while (!(GetReg(INPUT_STATUS1_READ) & 0x08))
{
- xf86DrvMsgVerb(0, X_INFO, DefaultLevel, "wait v sync\n");
+ xf86DrvMsgVerb(0, X_INFO, InternalLevel, "wait v sync\n");
}
+
*(ULONG*)(pRDC->MMIOVirtualAddr + VDP_CTL) = 0;
+
+
pXVPriv->VidhwInfo.dwVidCtl = 0;
+ pXVPriv->VidhwInfo.dwFetch = 0;
+ pXVPriv->VidhwInfo.dwWinStartXY =0;
+ pXVPriv->VidhwInfo.dwWinEndXY = 0;
}
xf86DrvMsgVerb(0, X_INFO, DefaultLevel, "==RDCStopVideo() Exit==\n");
@@ -386,19 +397,7 @@ RDCQueryBestSize(ScrnInfoPtr pScrn,
}
-/*
- * The source rectangle of the video is defined by (src_x, src_y, src_w, src_h).
- * The dest rectangle of the video is defined by (drw_x, drw_y, drw_w, drw_h).
- * id is a fourcc code for the format of the video.
- * buf is the pointer to the source data in system memory.
- * width and height are the w/h of the source data.
- * If "sync" is TRUE, then we must be finished with *buf at the point of return
- * (which we always are).
- * clipBoxes is the clipping region in screen space.
- * data is a pointer to our port private.
- * pDraw is a Drawable, which might not be the screen in the case of
- * compositing. It's a new argument to the function in the 1.1 server.
- */
+
static int
RDCPutImage(ScrnInfoPtr pScrn,
short src_x, short src_y,
@@ -425,7 +424,6 @@ RDCPutImage(ScrnInfoPtr pScrn,
xf86DrvMsgVerb(0, X_INFO, InfoLevel, "==Dst position X = %d, Y = %d==\n",drw_x, drw_y);
xf86DrvMsgVerb(0, X_INFO, InfoLevel, "==Dst size width = %d, Height = %d==\n",drw_w, drw_h);
- pOverlayStatus->bOverlayEnable = true;
pOverlayStatus->iDstLeft = (int)drw_x;
pOverlayStatus->iDstTop = (int)drw_y;
pOverlayStatus->iDstWidth = (int)drw_w;
@@ -435,7 +433,8 @@ RDCPutImage(ScrnInfoPtr pScrn,
ScreenWidth = pRDC->ModePtr->HDisplay;
ScreenHeight = pRDC->ModePtr->VDisplay;
- if (pRDC->DeviceInfo.ucDeviceID == 1) /* if Device == LCD */
+
+ if (pRDC->DeviceInfo.ucDeviceID == LCDINDEX)
{
ViewWidth = pRDC->DeviceInfo.MonitorSize.ulHorMaxResolution;
ViewHeight = pRDC->DeviceInfo.MonitorSize.ulVerMaxResolution;
@@ -446,10 +445,10 @@ RDCPutImage(ScrnInfoPtr pScrn,
ViewHeight = ScreenHeight;
}
- /* if device == LCD, adjust dst x,y */
- if (pRDC->DeviceInfo.ucDeviceID == 1)
+
+ if (pRDC->DeviceInfo.ucDeviceID == LCDINDEX)
{
- if (pScrn->bitsPerPixel == 16)
+ if (pScrn->bitsPerPixel == 16)
{
drw_x -= (pHWCInfo->iScreenOffset_x & ~0x3);
}
@@ -470,32 +469,32 @@ RDCPutImage(ScrnInfoPtr pScrn,
break;
}
- /* HW only support YUY2, So Destination is always YUY2 */
+
DstPitch = (width << 1);
- DstPitch = (DstPitch + 7) & ~7; /* Pitch 8 byte alignment */
+ DstPitch = (DstPitch + 7) & ~7;
size = DstPitch * height;
pRDCPortPriv->SrcPitch = DstPitch;
- /* Create Off-screen plan for overlay window*/
+
if(!(pRDCPortPriv->PackedBuf0 = RDCAllocateMemory(pScrn, pRDCPortPriv->PackedBuf0,
(pScrn->bitsPerPixel == 16) ? size : (size >> 1))))
return BadAlloc;
- /* Copy src data to desination buffer*/
+
RDCCopyFOURCC(pRDC, buf, pRDCPortPriv, SrcPitch, DstPitch, id, width, height);
- /* update cliplist */
+
if(!REGION_EQUAL(pScrn->pScreen, &pRDCPortPriv->clip, clipBoxes))
{
REGION_COPY(pScrn->pScreen, &pRDCPortPriv->clip, clipBoxes);
- /* draw these */
+
xf86DrvMsgVerb(0, X_INFO, InfoLevel, "==Color Key 0x%x==\n",pRDCPortPriv->colorkey);
xf86XVFillKeyHelper(pScrn->pScreen, pRDCPortPriv->colorkey, clipBoxes);
}
- /* Setting active rectangle */
+
if(0 == drw_w)
DstWidth = 1;
else
@@ -516,13 +515,15 @@ RDCPutImage(ScrnInfoPtr pScrn,
pRDCPortPriv->rSrc.right = src_x + src_w;
pRDCPortPriv->rDst.right = drw_x + drw_w;
- if (ViewWidth > ScreenWidth)
+ if (ViewWidth > ScreenWidth)
{
if ((drw_x + drw_w) > ScreenWidth)
{
pRDCPortPriv->rSrc.right -= (((drw_x + drw_w - ScreenWidth) * src_w) + (DstWidth >> 1)) / DstWidth;
pRDCPortPriv->rDst.right = ScreenWidth;
}
+ pRDCPortPriv->rDst.left = pRDCPortPriv->rDst.left * ViewWidth / ScreenWidth;
+ pRDCPortPriv->rDst.right = pRDCPortPriv->rDst.right * ViewWidth / ScreenWidth;
}
else
{
@@ -543,13 +544,15 @@ RDCPutImage(ScrnInfoPtr pScrn,
pRDCPortPriv->rSrc.bottom = src_y + src_h;
pRDCPortPriv->rDst.bottom = drw_y + drw_h;
- if (ViewHeight > ScreenHeight)
+ if (ViewHeight > ScreenHeight)
{
if ((drw_y + drw_h) > ScreenHeight)
{
pRDCPortPriv->rSrc.bottom -= (((drw_y + drw_h - ScreenHeight) * src_h) + (DstHeight >> 1)) / DstHeight;
pRDCPortPriv->rDst.bottom = ScreenHeight;
}
+ pRDCPortPriv->rDst.top = pRDCPortPriv->rDst.top * ViewHeight/ ScreenHeight;
+ pRDCPortPriv->rDst.bottom= pRDCPortPriv->rDst.bottom* ViewHeight/ ScreenHeight;
}
else
{
@@ -578,44 +581,50 @@ RDCQueryImageAttributesOverlay(ScrnInfoPtr pScrn,int id,
{
int size = 0, chromasize = 0;
- xf86DrvMsgVerb(0, X_INFO, DefaultLevel, "==RDCQueryImageAttributesOverlay() Entry; Width = %d, Height = %d==\n", *w, *h);
+ xf86DrvMsgVerb(0, X_INFO, DefaultLevel,
+ "==RDCQueryImageAttributes() Entry; Width = %d, Height = %d==\n",
+ *w, *h);
if ((!w) || (!h))
+ {
+ xf86DrvMsgVerb(0, X_INFO, DefaultLevel,
+ "==RDCQueryImageAttributesOverlay() W or H fail==\n");
return 0;
-
- if ((pitches == NULL) || (offsets == NULL))
- return 0;
-
- if (*w > IMAGE_MAX_WIDTH)
- *w = IMAGE_MAX_WIDTH;
- if (*h > IMAGE_MAX_HEIGHT)
- *h = IMAGE_MAX_HEIGHT;
-
- *offsets = 0;
+ }
+
+ if (offsets)
+ offsets[0] = 0;
switch (id)
{
case FOURCC_YV12:
- /* aligment width and height */
+
*w = (*w + 3) & ~3;
*h = (*h + 1) & ~1;
size = *w;
- pitches[0] = size;
+
+ if (pitches)
+ pitches[0] = size;
size *= *h;
chromasize = ((*h >> 1) * (*w >> 1));
- offsets[1] = size;
- pitches[1] = pitches[2] = (*w >> 1);
+ if (offsets)
+ offsets[1] = size;
+
+ if (pitches)
+ pitches[1] = pitches[2] = (*w >> 1);
+
size += chromasize;
- offsets[2] = size;
+ if (offsets)
+ offsets[2] = size;
+
size += chromasize;
break;
case FOURCC_YUY2:
- default:
- /* aligment width and height */
+
*w = (*w + 1) & ~1;
size = (*w << 1);
@@ -625,23 +634,28 @@ RDCQueryImageAttributesOverlay(ScrnInfoPtr pScrn,int id,
size *= *h;
break;
+ default:
+ xf86DrvMsgVerb(0, X_INFO, DefaultLevel,
+ "==RDCQueryImageAttributesOverlay() Format is not support");
+ return 0;
+ break;
}
-
- xf86DrvMsgVerb(0, X_INFO, InfoLevel, "==pitche0 = 0x%x; pitche1 = 0x%x; pitche2 = 0x%x==\n",
- pitches[0],pitches[1],pitches[2]);
-
- xf86DrvMsgVerb(0, X_INFO, InfoLevel, "==offset0 = 0x%x;offset1 = 0x%x;offset2 = 0x%x;==\n",
- offsets[0], offsets[1], offsets[2]);
+ if (pitches)
+ xf86DrvMsgVerb(0, X_INFO, InfoLevel,
+ "==pitche0 = 0x%x; pitche1 = 0x%x; pitche2 = 0x%x==\n",
+ pitches[0],pitches[1],pitches[2]);
+ if (offsets)
+ xf86DrvMsgVerb(0, X_INFO, InfoLevel,
+ "==offset0 = 0x%x;offset1 = 0x%x;offset2 = 0x%x;==\n",
+ offsets[0], offsets[1], offsets[2]);
xf86DrvMsgVerb(0, X_INFO, DefaultLevel, "==RDCQueryImageAttributesOverlay() Exit; Size = %d==\n",size);
return size;
}
-/*******************************************************************
-* Allocate Local video memory for video display *
-********************************************************************/
+
static FBLinearPtr
RDCAllocateMemory(
ScrnInfoPtr pScrn,
@@ -703,9 +717,7 @@ RDCAllocateMemory(
return newBuf;
}
-/*****************************************************************
-* Setting Video Display register *
-******************************************************************/
+
void RDCUpdateVID(RDCRecPtr pRDC, RDCPortPrivPtr pRDCPortPriv, BYTE bEnable)
{
unsigned long SrcWidth, DstWidth, SrcHeight, DstHeight;
@@ -713,11 +725,10 @@ void RDCUpdateVID(RDCRecPtr pRDC, RDCPortPrivPtr pRDCPortPriv, BYTE bEnable)
OV_RECTLPtr pRSrc = &pRDCPortPriv->rSrc;
OV_RECTLPtr pRDst = &pRDCPortPriv->rDst;
- ULONG dwVidCtl;
ULONG dwVideoSrcOffset;
- ULONG dwFetch; // Video engine fetch count
- ULONG dwVDisplayCount; // Video engine display count 0x26c,0x27c
- ULONG dwVSrcPitch; // Video engine stride
+ ULONG dwFetch;
+ ULONG dwVDisplayCount;
+ ULONG dwVSrcPitch;
ULONG dwWinStartXY;
ULONG dwWinEndXY;
ULONG dwzoomCtl;
@@ -725,27 +736,21 @@ void RDCUpdateVID(RDCRecPtr pRDC, RDCPortPrivPtr pRDCPortPriv, BYTE bEnable)
xf86DrvMsgVerb(0, X_INFO, DefaultLevel, "==RDCUpdateVID() Entry==\n");
- /* Enable or Disable VID */
- if (bEnable)
- dwVidCtl = VDPS_ENABLE|
- VDPS_SW_FLIP|
- VDPS_DISP_REQ_EXPIRE|
- VDPS_DISP_PRE_FETCH|
- VDPS_DISP1;
- else
- dwVidCtl = 0;
+
+ pRDC->OverlayStatus.ulVidDispCtrl = VDPS_ENABLE|
+ VDPS_SW_FLIP|
+ VDPS_DISP_REQ_EXPIRE|
+ VDPS_DISP_PRE_FETCH|
+ VDPS_DISP1;
+
+
SrcWidth = pRSrc->right - pRSrc->left;
SrcHeight = pRSrc->bottom - pRSrc->top;
DstWidth = pRDst->right - pRDst->left;
DstHeight = pRDst->bottom - pRDst->top;
- /* Color Key Setting */
-
- /* Chrome Key Setting */
-
-
dwVSrcPitch = pRDCPortPriv->SrcPitch;
dwVIDBuffer[0] = pRDCPortPriv->Packed0Offset;
@@ -753,12 +758,16 @@ void RDCUpdateVID(RDCRecPtr pRDC, RDCPortPrivPtr pRDCPortPriv, BYTE bEnable)
dwVideoSrcOffset = (pRSrc->left << 16) | pRSrc->top;
dwWinStartXY = (pRDst->left << 16) | pRDst->top;
dwWinEndXY = ((pRDst->right - 1) << 16) | (pRDst->bottom - 1);
+
- dwFetch = (((pRSrc->right - pRSrc->left) << 1) + 7) >> 3;
-
+ dwFetch = ((SrcWidth << 1) + 7) >> 3;
+
+ if (SrcWidth > DstWidth)
+ dwFetch = ((DstWidth << 1) + 7) >> 3;
+
if (dwFetch < 4)
dwFetch = 4;
-
+
dwzoomCtl &= 0x0000FFFF;
if (SrcWidth < DstWidth)
{
@@ -775,54 +784,83 @@ void RDCUpdateVID(RDCRecPtr pRDC, RDCPortPrivPtr pRDCPortPriv, BYTE bEnable)
xf86DrvMsgVerb(0, X_INFO, InfoLevel, "==Color Key 0x%x==\n",pVIDHwInfo->dwColorKey);
- if (pVIDHwInfo->dwVidCtl != dwVidCtl)
+ if (!(((int)pRDst->right < (int)pRDst->left) || ((int)pRDst->bottom < (int)pRDst->top)))
+ pRDC->OverlayStatus.bPanningOverlayEnable = true;
+
+
+
+ if (!pRDC->OverlayStatus.bPanningOverlayEnable)
+ {
+ pRDC->OverlayStatus.ulVidDispCtrl &= ~VDPS_ENABLE;
+ }
+
+ if (!pRDC->OverlayStatus.bOverlayEnable)
+ {
+ *(ULONG*)(pRDC->MMIOVirtualAddr + VDP_CTL) =
+ VDPS_ENABLE;
+ *(ULONG*)(pRDC->MMIOVirtualAddr + VDP_FIRST_COLORKEY) =
+ pVIDHwInfo->dwColorKey | VDPS_ENABLE_CK;
+ *(ULONG*)(pRDC->MMIOVirtualAddr + VDP_FIFO_THRESHOLD) =
+ VDPS_FIFO_THRESHOLD;
+ pRDC->OverlayStatus.bOverlayEnable = TRUE;
+ }
+
+ if (pVIDHwInfo->dwVidCtl != pRDC->OverlayStatus.ulVidDispCtrl)
{
- *(ULONG*)(pRDC->MMIOVirtualAddr + VDP_CTL) = dwVidCtl;
- pVIDHwInfo->dwVidCtl = dwVidCtl;
+ *(ULONG*)(pRDC->MMIOVirtualAddr + VDP_CTL) = pRDC->OverlayStatus.ulVidDispCtrl;
+ pVIDHwInfo->dwVidCtl = pRDC->OverlayStatus.ulVidDispCtrl;
xf86DrvMsgVerb(0, X_INFO, InfoLevel, "==VID CTRL Setting 0x%x==\n",pVIDHwInfo->dwVidCtl);
}
+
if (pVIDHwInfo->dwFetch != dwFetch)
{
*(ULONG*)(pRDC->MMIOVirtualAddr + VDP_FETCH_COUNT) = dwFetch;
pVIDHwInfo->dwFetch = dwFetch;
xf86DrvMsgVerb(0, X_INFO, InfoLevel, "==Fetch count 0x%x==\n",pVIDHwInfo->dwFetch);
}
+
if (pVIDHwInfo->dwVideoSrcOffset != dwVideoSrcOffset)
{
*(ULONG*)(pRDC->MMIOVirtualAddr + VDP_START_OFFSET) = dwVideoSrcOffset;
pVIDHwInfo->dwVideoSrcOffset = dwVideoSrcOffset;
xf86DrvMsgVerb(0, X_INFO, InfoLevel, "==Video Src Offset 0x%x==\n",pVIDHwInfo->dwVideoSrcOffset);
}
+
if (pVIDHwInfo->dwVDisplayCount != dwVDisplayCount)
{
*(ULONG*)(pRDC->MMIOVirtualAddr + VDP_SRC_DISP_COUNT_ON_SCR) = dwVDisplayCount;
pVIDHwInfo->dwVDisplayCount = dwVDisplayCount;
xf86DrvMsgVerb(0, X_INFO, InfoLevel, "==Display count 0x%x==\n",pVIDHwInfo->dwVDisplayCount);
}
+
if (pVIDHwInfo->dwWinStartXY != dwWinStartXY)
{
*(ULONG*)(pRDC->MMIOVirtualAddr + VDP_START_LOCATION) = dwWinStartXY;
pVIDHwInfo->dwWinStartXY = dwWinStartXY;
xf86DrvMsgVerb(0, X_INFO, InfoLevel, "==Start Location 0x%x==\n",pVIDHwInfo->dwWinStartXY);
}
+
if (pVIDHwInfo->dwWinEndXY != dwWinEndXY)
{
*(ULONG*)(pRDC->MMIOVirtualAddr + VDP_END_LOCATION) = dwWinEndXY;
pVIDHwInfo->dwWinEndXY = dwWinEndXY;
xf86DrvMsgVerb(0, X_INFO, InfoLevel, "==End Location 0x%x==\n",pVIDHwInfo->dwWinEndXY);
}
+
if (pVIDHwInfo->dwzoomCtl != dwzoomCtl)
{
*(ULONG*)(pRDC->MMIOVirtualAddr + VDP_ZOOM_CTL) = dwzoomCtl;
pVIDHwInfo->dwzoomCtl = dwzoomCtl;
xf86DrvMsgVerb(0, X_INFO, InfoLevel, "==Zoom Setting 0x%x==\n",pVIDHwInfo->dwzoomCtl);
}
+
if (pVIDHwInfo->dwVIDBuffer[0] != dwVIDBuffer[0])
{
*(ULONG*)(pRDC->MMIOVirtualAddr + VDP_FB0) = dwVIDBuffer[0];
pVIDHwInfo->dwVIDBuffer[0] = dwVIDBuffer[0];
xf86DrvMsgVerb(0, X_INFO, InfoLevel, "==Video Display Buffer 0x%x==\n",pVIDHwInfo->dwVIDBuffer[0]);
}
+
if (pVIDHwInfo->dwVSrcPitch != dwVSrcPitch)
{
*(ULONG*)(pRDC->MMIOVirtualAddr + VDP_FB_STRIDE) = dwVSrcPitch;
@@ -835,10 +873,7 @@ void RDCUpdateVID(RDCRecPtr pRDC, RDCPortPrivPtr pRDCPortPriv, BYTE bEnable)
xf86DrvMsgVerb(0, X_INFO, DefaultLevel, "==RDCUpdateVID() Exit==\n");
}
-/*****************************************************************
-* We copy video source from system memory to local video memory, *
-* and convert source format to YVY2 *
-******************************************************************/
+
void RDCCopyFOURCC(RDCRecPtr pRDC, unsigned char* pSrcStart, RDCPortPrivPtr pRDCPortPriv,
unsigned long SrcPitch, unsigned long DstPitch, int FourCC,
short width, short height)
diff --git a/src/rdc_video.h b/src/rdc_video.h
index f6d19cb..f3d318b 100644
--- a/src/rdc_video.h
+++ b/src/rdc_video.h
@@ -18,6 +18,7 @@
* <jason.lin@rdc.com.tw>
*/
+
#include "xf86.h"
// VIDEO Register definition VDISP
@@ -64,12 +65,12 @@
#define VDPS_V_INTERP BIT14
typedef struct {
- // overlay reg
+
ULONG dwVidCtl;
ULONG dwVideoSrcOffset;
- ULONG dwFetch; // Video engine fetch count
- ULONG dwVDisplayCount; // Video engine display count 0x26c,0x27c
- ULONG dwVSrcPitch; // Video engine stride
+ ULONG dwFetch;
+ ULONG dwVDisplayCount;
+ ULONG dwVSrcPitch;
ULONG dwWinStartXY;
ULONG dwWinEndXY;
ULONG dwzoomCtl;
@@ -77,9 +78,7 @@ typedef struct {
ULONG dwVIDBuffer[3];
} VIDHWINFO, *VIDHWINFOPtr;
-/*
- * structure for passing information to UpdateOverlay fn
- */
+
typedef struct _OV_RECTL
{
unsigned long left;
@@ -89,9 +88,7 @@ typedef struct _OV_RECTL
} OV_RECTL, *OV_RECTLPtr;
-/*
- * Xv port specific struct, each port has it's own struct
- */
+
typedef struct {
long brightness;
long saturation;
diff --git a/src/typedef.h b/src/typedef.h
index 3bd965b..583f625 100644
--- a/src/typedef.h
+++ b/src/typedef.h
@@ -19,11 +19,12 @@
*/
+
#define X_INFO 0
#define X_WARNING 1
#define X_ERROR 2
-/* Verberse level define */
+
typedef unsigned char UCHAR;
typedef unsigned short USHORT;
typedef unsigned long ULONG;
@@ -35,22 +36,22 @@ typedef enum _bool
}bool;
#ifndef ErrorLevel
- #define ErrorLevel 0 /* Report Error message */
+ #define ErrorLevel 0
#endif
#ifndef DefaultLevel
- #define DefaultLevel 4 /* Driver entry function */
+ #define DefaultLevel 4
#endif
#ifndef InfoLevel
- #define InfoLevel 5 /* Report information */
+ #define InfoLevel 5
#endif
#ifndef InternalLevel
- #define InternalLevel 6 /* Driver interanl function entry */
+ #define InternalLevel 6
#endif
-/* Related IO offset */
+
#define ATTR_ADDR 0X0040
#define ATTR_DATA_WRITE 0X0040
#define ATTR_DATA_READ 0X0041
@@ -78,7 +79,7 @@ typedef enum _bool
#define VBIOSVerNum 0x00000
-/* Scratch registers */
+
#define SCRATCH_01 0x81 * 0x100
#define IDX_SCRATCH_01 SCRATCH_01 + 0xFF
@@ -194,7 +195,7 @@ typedef enum _bool
#define IDX_LCD1_TABLE_INDEX SCRATCH_23 + 0xF0
#define IDX_LCD2_TABLE_INDEX SCRATCH_23 + 0x0F
-/* For Bit mask using */
+
#define BIT0 0x00000001
#define BIT1 0x00000002
#define BIT2 0x00000004
@@ -228,13 +229,13 @@ typedef enum _bool
#define BIT30 0x40000000
#define BIT31 0x80000000
-/* definition of output ports */
+
#define CRT_PORT 0
#define DVP1 1
#define DVP2 2
#define DVP12 3
-/* definition of RRATE_TABLE.RRate_ID */
+
#define RR60 0
#define RR50I 1
#define RR59_94I 2
@@ -252,7 +253,7 @@ typedef enum _bool
#define RR72 14
#define RR65 15
-/* Output Device Index */
+
#define LCD_ID 1
#define DVI_ID 2
#define CRT_ID 3
@@ -266,7 +267,7 @@ typedef enum _bool
#define HDTV2_ID 12
#define TV2_ID 13
-/* Output Device Combination Bit */
+
#define B_LCD BIT0
#define B_DVI BIT1
#define B_CRT BIT2
@@ -282,47 +283,47 @@ typedef enum _bool
-/* clock definition */
+
#define PLLReferenceClock 14318
#define MaxFCKVCO9003A 810000
#define MinFCKVCO9003A 350000
#define MaxFCKVCO9001A 1600000
#define MinFCKVCO9001A 833000
-/* DPMS State */
+
#define DPMS__ON 0
#define DPMS__STANDBY 1
#define DPMS__SUSPEND 2
#define DPMS__OFF 3
-/* definitions only for PANEL_TABLE.Attribute */
-#define SEQ BIT1 /* sequential output format */
-#define TTL BIT6 /* TTL LCD */
-/* _PORT_CONFIG.TX_Enc_ID */
-#define NONE 0x00 /* no TX/encoder */
+#define SEQ BIT1
+#define TTL BIT6
+
+
+#define NONE 0x00
#define TX_VT1636 0x01
#define TX_SIL1162 0x02
-#define TX_HW 0x03 /* hardwired TX */
+#define TX_HW 0x03
#define ENC_VT1625 0x04
-#define DSTN 0x05 /* DSTN */
+#define DSTN 0x05
-/* _PORT_CONFIG.Attribute */
-#define Dev_SUPPORT BIT0 /* Device Support */
+
+#define Dev_SUPPORT BIT0
#define TX_DIT BIT1
#define TX_PS BIT2
-#define DSTN_COLOR BIT3 /* DSTN color */
-#define DSTN_MONO 0 /* DSTN mono */
-#define DSTN_6X4 BIT4 /* DSTN 640x480 */
-#define DSTN_3X2 0 /* DSTN 320x240 */
+#define DSTN_COLOR BIT3
+#define DSTN_MONO 0
+#define DSTN_6X4 BIT4
+#define DSTN_3X2 0
#define TX_MSB BIT5
-/* definitions of display path */
+
#define DISP1 1
#define DISP2 2
-/* mode numbers */
+
#define MODE_640x480x8 0x101
#define MODE_800x600x8 0x103
@@ -397,7 +398,7 @@ typedef struct _PORT_CONFIG PORT_CONFIG;
typedef struct _VESA_TABLE VESA_TABLE;
struct _RRATE_TABLE {
- ULONG Clock; /* in khz */
+ ULONG Clock;
UCHAR RRate_ID;
USHORT Attribute;
USHORT H_Blank_Time;
@@ -458,7 +459,7 @@ typedef struct _REG_PACKAGE {
UCHAR RegMask;
} REG_PACKAGE;
#else
-/* definitions for SerialLoadTable() */
+
#define CR 0x00
#define SR 0x01
#define GR 0x02
@@ -484,7 +485,7 @@ struct _PORT_CONFIG
UCHAR Attribute;
}__attribute__((packed));;
-/* PCI Data Structure */
+
#define OFF_VID 0
#define OFF_DID 2
#define OFF_PTR_VPD 4
@@ -499,6 +500,6 @@ struct _PORT_CONFIG
#define OFF_LII 17
#define OFF_RESERVED 18
-/* Definition of PCI Data Structure.RESERVED */
+