Initial revision
This commit is contained in:
parent
c56aaef790
commit
0a53864f95
16 changed files with 4245 additions and 0 deletions
47
src/atiaudio.c
Normal file
47
src/atiaudio.c
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiaudio.c,v 1.1 2003/07/24 22:08:27 tsi Exp $ */
|
||||
/*
|
||||
* Copyright 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting documentation, and
|
||||
* that the name of Marc Aurele La France not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. Marc Aurele La France makes no representations
|
||||
* about the suitability of this software for any purpose. It is provided
|
||||
* "as-is" without express or implied warranty.
|
||||
*
|
||||
* MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
|
||||
* EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "atiaudio.h"
|
||||
|
||||
/*
|
||||
* Audio chip definitions.
|
||||
*/
|
||||
const char *ATIAudioNames[] =
|
||||
{
|
||||
"Philips TEA5582",
|
||||
"Mono with audio mux",
|
||||
"Philips TDA9850",
|
||||
"Sony CXA2020S",
|
||||
"ITT MSP3410D",
|
||||
"Crystal CS4236B",
|
||||
"Philips TDA9851",
|
||||
"ITT MSP3415",
|
||||
"ITT MSP3430",
|
||||
"Unknown type (9)",
|
||||
"Unknown type (10)",
|
||||
"Unknown type (11)",
|
||||
"Unknown type (12)",
|
||||
"Unknown type (13)",
|
||||
"Unknown type (14)",
|
||||
"No audio"
|
||||
};
|
||||
52
src/atiaudio.h
Normal file
52
src/atiaudio.h
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiaudio.h,v 1.1 2003/07/24 22:08:27 tsi Exp $ */
|
||||
/*
|
||||
* Copyright 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting documentation, and
|
||||
* that the name of Marc Aurele La France not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. Marc Aurele La France makes no representations
|
||||
* about the suitability of this software for any purpose. It is provided
|
||||
* "as-is" without express or implied warranty.
|
||||
*
|
||||
* MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
|
||||
* EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef ___ATIAUDIO_H___
|
||||
#define ___ATIAUDIO_H___ 1
|
||||
|
||||
/*
|
||||
* Audio chip definitions.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
ATI_AUDIO_TEA5582,
|
||||
ATI_AUDIO_MONO,
|
||||
ATI_AUDIO_TDA9850,
|
||||
ATI_AUDIO_CXA2020S,
|
||||
ATI_AUDIO_MSP3410D,
|
||||
ATI_AUDIO_CS4236B,
|
||||
ATI_AUDIO_TDA9851,
|
||||
ATI_AUDIO_MSP3415,
|
||||
ATI_AUDIO_MSP3430,
|
||||
ATI_AUDIO_9,
|
||||
ATI_AUDIO_10,
|
||||
ATI_AUDIO_11,
|
||||
ATI_AUDIO_12,
|
||||
ATI_AUDIO_13,
|
||||
ATI_AUDIO_14,
|
||||
ATI_AUDIO_NONE
|
||||
} ATIAudioType;
|
||||
|
||||
extern const char *ATIAudioNames[];
|
||||
|
||||
#endif /* ___ATIAUDIO_H___ */
|
||||
47
src/atidecoder.c
Normal file
47
src/atidecoder.c
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidecoder.c,v 1.1 2003/07/24 22:08:28 tsi Exp $ */
|
||||
/*
|
||||
* Copyright 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting documentation, and
|
||||
* that the name of Marc Aurele La France not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. Marc Aurele La France makes no representations
|
||||
* about the suitability of this software for any purpose. It is provided
|
||||
* "as-is" without express or implied warranty.
|
||||
*
|
||||
* MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
|
||||
* EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "atidecoder.h"
|
||||
|
||||
/*
|
||||
* Video decoder definitions.
|
||||
*/
|
||||
const char *ATIDecoderNames[] =
|
||||
{
|
||||
"No decoder",
|
||||
"BrookTree BT819",
|
||||
"Brooktree BT829",
|
||||
"Brooktree BT829A",
|
||||
"Philips SA7111",
|
||||
"Philips SA7112",
|
||||
"ATI Rage Theater",
|
||||
"Unknown type (7)",
|
||||
"Unknown type (8)",
|
||||
"Unknown type (9)",
|
||||
"Unknown type (10)",
|
||||
"Unknown type (11)",
|
||||
"Unknown type (12)",
|
||||
"Unknown type (13)",
|
||||
"Unknown type (14)",
|
||||
"Unknown type (15)"
|
||||
};
|
||||
52
src/atidecoder.h
Normal file
52
src/atidecoder.h
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidecoder.h,v 1.1 2003/07/24 22:08:28 tsi Exp $ */
|
||||
/*
|
||||
* Copyright 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting documentation, and
|
||||
* that the name of Marc Aurele La France not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. Marc Aurele La France makes no representations
|
||||
* about the suitability of this software for any purpose. It is provided
|
||||
* "as-is" without express or implied warranty.
|
||||
*
|
||||
* MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
|
||||
* EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef ___ATIDECODER_H___
|
||||
#define ___ATIDECODER_H___ 1
|
||||
|
||||
/*
|
||||
* Video decoder definitions.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
ATI_DECODER_NONE,
|
||||
ATI_DECODER_BT819,
|
||||
ATI_DECODER_BT829,
|
||||
ATI_DECODER_BT829A,
|
||||
ATI_DECODER_SA7111,
|
||||
ATI_DECODER_SA7112,
|
||||
ATI_DECODER_THEATER,
|
||||
ATI_DECODER_7,
|
||||
ATI_DECODER_8,
|
||||
ATI_DECODER_9,
|
||||
ATI_DECODER_10,
|
||||
ATI_DECODER_11,
|
||||
ATI_DECODER_12,
|
||||
ATI_DECODER_13,
|
||||
ATI_DECODER_14,
|
||||
ATI_DECODER_15
|
||||
} ATIDecoderType;
|
||||
|
||||
extern const char *ATIDecoderNames[];
|
||||
|
||||
#endif /* ___ATIDECODER_H___ */
|
||||
387
src/atii2c.c
Normal file
387
src/atii2c.c
Normal file
|
|
@ -0,0 +1,387 @@
|
|||
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atii2c.c,v 1.3 2003/11/10 18:41:20 tsi Exp $ */
|
||||
/*
|
||||
* Copyright 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting documentation, and
|
||||
* that the name of Marc Aurele La France not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. Marc Aurele La France makes no representations
|
||||
* about the suitability of this software for any purpose. It is provided
|
||||
* "as-is" without express or implied warranty.
|
||||
*
|
||||
* MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
|
||||
* EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "atiadapter.h"
|
||||
#include "atii2c.h"
|
||||
#include "atiload.h"
|
||||
#include "atimach64i2c.h"
|
||||
#include "atistruct.h"
|
||||
|
||||
#include "xf86.h"
|
||||
|
||||
/* This is derived from GATOS code, with a liberal sprinkling of bug fixes */
|
||||
|
||||
/*
|
||||
* Some local macros for use by the mid-level I2C functions.
|
||||
*/
|
||||
|
||||
#define ATII2CDelay \
|
||||
(*pI2CBus->I2CUDelay)(pI2CBus, pI2CBus->HoldTime)
|
||||
|
||||
|
||||
#define ATII2CSCLDirOff \
|
||||
if (pATII2C->SCLDir != 0) \
|
||||
(*pATII2C->I2CSetBits)(pATII2C, pATI, \
|
||||
pATII2C->I2CCur & ~pATII2C->SCLDir)
|
||||
|
||||
#define ATII2CSCLDirOn \
|
||||
if (pATII2C->SCLDir != 0) \
|
||||
(*pATII2C->I2CSetBits)(pATII2C, pATI, \
|
||||
pATII2C->I2CCur | pATII2C->SCLDir)
|
||||
|
||||
#define ATII2CSDADirOff \
|
||||
if (pATII2C->SDADir != 0) \
|
||||
(*pATII2C->I2CSetBits)(pATII2C, pATI, \
|
||||
pATII2C->I2CCur & ~pATII2C->SDADir)
|
||||
|
||||
#define ATII2CSDADirOn \
|
||||
if (pATII2C->SDADir != 0) \
|
||||
(*pATII2C->I2CSetBits)(pATII2C, pATI, \
|
||||
pATII2C->I2CCur | pATII2C->SDADir)
|
||||
|
||||
|
||||
#define ATII2CSCLBitGet \
|
||||
((*pATII2C->I2CGetBits)(pATI) & pATII2C->SCLGet)
|
||||
|
||||
#define ATII2CSCLBitOff \
|
||||
do \
|
||||
{ \
|
||||
(*pATII2C->I2CSetBits)(pATII2C, pATI, \
|
||||
pATII2C->I2CCur & ~pATII2C->SCLSet); \
|
||||
ATII2CDelay; \
|
||||
} while (0)
|
||||
|
||||
#define ATII2CSCLBitOn \
|
||||
do \
|
||||
{ \
|
||||
(*pATII2C->I2CSetBits)(pATII2C, pATI, \
|
||||
pATII2C->I2CCur | pATII2C->SCLSet); \
|
||||
do /* Wait until all devices have released SCL */ \
|
||||
{ \
|
||||
ATII2CDelay; \
|
||||
} while (ATII2CSCLBitGet == 0); \
|
||||
} while (0)
|
||||
|
||||
|
||||
#define ATII2CSDABitGet \
|
||||
((*pATII2C->I2CGetBits)(pATI) & pATII2C->SDAGet)
|
||||
|
||||
#define ATII2CSDABitOff \
|
||||
do \
|
||||
{ \
|
||||
(*pATII2C->I2CSetBits)(pATII2C, pATI, \
|
||||
pATII2C->I2CCur & ~pATII2C->SDASet); \
|
||||
ATII2CDelay; \
|
||||
} while (0)
|
||||
|
||||
#define ATII2CSDABitOn \
|
||||
do \
|
||||
{ \
|
||||
(*pATII2C->I2CSetBits)(pATII2C, pATI, \
|
||||
pATII2C->I2CCur | pATII2C->SDASet); \
|
||||
ATII2CDelay; \
|
||||
} while (0)
|
||||
|
||||
#define ATII2CSDABitSet(_flag) \
|
||||
do \
|
||||
{ \
|
||||
if (_flag) \
|
||||
ATII2CSDABitOn; \
|
||||
else \
|
||||
ATII2CSDABitOff; \
|
||||
} while (0)
|
||||
|
||||
|
||||
/*
|
||||
* ATII2CAddress --
|
||||
*
|
||||
* This function puts a Start bit and an 8-bit address on the I2C bus.
|
||||
*/
|
||||
static Bool
|
||||
ATII2CAddress
|
||||
(
|
||||
I2CDevPtr pI2CDev,
|
||||
I2CSlaveAddr Address
|
||||
)
|
||||
{
|
||||
I2CBusPtr pI2CBus = pI2CDev->pI2CBus;
|
||||
ATII2CPtr pATII2C = pI2CBus->DriverPrivate.ptr;
|
||||
ATIPtr pATI = pATII2C->pATI;
|
||||
|
||||
/*
|
||||
* Set I2C line directions to out-bound. SCL will remain out-bound until
|
||||
* next I2C Stop.
|
||||
*/
|
||||
ATII2CSCLDirOn;
|
||||
ATII2CSDADirOn;
|
||||
|
||||
/*
|
||||
* Send Start bit. This is a pull-down of the data line while the clock
|
||||
* line is pulled up.
|
||||
*/
|
||||
ATII2CSDABitOn;
|
||||
ATII2CSCLBitOn;
|
||||
ATII2CSDABitOff;
|
||||
ATII2CSCLBitOff;
|
||||
|
||||
/* Send low byte of device address */
|
||||
if ((*pI2CBus->I2CPutByte)(pI2CDev, (I2CByte)Address))
|
||||
{
|
||||
/* Send top byte of address, if appropriate */
|
||||
if (((Address & 0x00F8U) != 0x00F0U) &&
|
||||
((Address & 0x00FEU) != 0x0000U))
|
||||
return TRUE;
|
||||
|
||||
if ((*pI2CBus->I2CPutByte)(pI2CDev, (I2CByte)(Address >> 8)))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Kill I2C transaction on failure */
|
||||
(*pI2CBus->I2CStop)(pI2CDev);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* ATII2CStop --
|
||||
*
|
||||
* This function puts a stop signal on the I2C bus.
|
||||
*/
|
||||
static void
|
||||
ATII2CStop
|
||||
(
|
||||
I2CDevPtr pI2CDev
|
||||
)
|
||||
{
|
||||
I2CBusPtr pI2CBus = pI2CDev->pI2CBus;
|
||||
ATII2CPtr pATII2C = pI2CBus->DriverPrivate.ptr;
|
||||
ATIPtr pATI = pATII2C->pATI;
|
||||
|
||||
ATII2CSDADirOn; /* Set data line direction to out-bound */
|
||||
|
||||
/*
|
||||
* Send Stop bit. This is a pull-up of the data line while the clock line
|
||||
* is pulled up.
|
||||
*/
|
||||
ATII2CSDABitOff;
|
||||
ATII2CSCLBitOn;
|
||||
ATII2CSDABitOn;
|
||||
ATII2CSCLBitOff;
|
||||
|
||||
/* Reset I2C line directions to in-bound */
|
||||
ATII2CSCLDirOff;
|
||||
ATII2CSDADirOff;
|
||||
}
|
||||
|
||||
/*
|
||||
* ATII2CPutByte --
|
||||
*
|
||||
* This function puts an 8-bit value on the I2C bus, starting with its MSB.
|
||||
*/
|
||||
static Bool
|
||||
ATII2CPutByte
|
||||
(
|
||||
I2CDevPtr pI2CDev,
|
||||
I2CByte Data
|
||||
)
|
||||
{
|
||||
I2CBusPtr pI2CBus = pI2CDev->pI2CBus;
|
||||
ATII2CPtr pATII2C = pI2CBus->DriverPrivate.ptr;
|
||||
ATIPtr pATI = pATII2C->pATI;
|
||||
int i;
|
||||
Bool Result;
|
||||
|
||||
ATII2CSDADirOn; /* Set data line direction to out-bound */
|
||||
|
||||
/* Send data byte */
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
ATII2CSDABitSet(Data & 0x80U);
|
||||
ATII2CSCLBitOn;
|
||||
ATII2CSCLBitOff;
|
||||
|
||||
Data <<= 1;
|
||||
}
|
||||
|
||||
ATII2CSDABitOn; /* Release data line */
|
||||
|
||||
ATII2CSDADirOff; /* Set data line direction to in-bound */
|
||||
|
||||
ATII2CSCLBitOn; /* Start bit-read clock pulse */
|
||||
|
||||
/* Get [N]ACK bit */
|
||||
if (ATII2CSDABitGet)
|
||||
Result = FALSE;
|
||||
else
|
||||
Result = TRUE;
|
||||
|
||||
ATII2CSCLBitOff; /* End clock pulse */
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
/*
|
||||
* ATII2CGetByte --
|
||||
*
|
||||
* This function retrieves an 8-bit value from the I2C bus.
|
||||
*/
|
||||
static Bool
|
||||
ATII2CGetByte
|
||||
(
|
||||
I2CDevPtr pI2CDev,
|
||||
I2CByte *pData,
|
||||
Bool Last
|
||||
)
|
||||
{
|
||||
I2CBusPtr pI2CBus = pI2CDev->pI2CBus;
|
||||
ATII2CPtr pATII2C = pI2CBus->DriverPrivate.ptr;
|
||||
ATIPtr pATI = pATII2C->pATI;
|
||||
unsigned long Value = 1;
|
||||
|
||||
do
|
||||
{
|
||||
ATII2CSCLBitOn; /* Start bit-read clock pulse */
|
||||
|
||||
/* Accumulate bit into byte value */
|
||||
Value <<= 1;
|
||||
if (ATII2CSDABitGet)
|
||||
Value++;
|
||||
|
||||
ATII2CSCLBitOff; /* End clock pulse */
|
||||
} while (Value <= (unsigned long)((I2CByte)(-1)));
|
||||
|
||||
*pData = (I2CByte)Value;
|
||||
|
||||
ATII2CSDADirOn; /* Set data line direction to out-bound */
|
||||
|
||||
/* Send [N]ACK bit */
|
||||
ATII2CSDABitSet(Last);
|
||||
ATII2CSCLBitOn;
|
||||
ATII2CSCLBitOff;
|
||||
|
||||
if (!Last)
|
||||
ATII2CSDABitOn; /* Release data line */
|
||||
|
||||
ATII2CSDADirOff; /* Set data line direction to in-bound */
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* ATICreateI2CBusRec --
|
||||
*
|
||||
* This function is called to initialise an I2CBusRec.
|
||||
*/
|
||||
I2CBusPtr
|
||||
ATICreateI2CBusRec
|
||||
(
|
||||
int iScreen,
|
||||
ATIPtr pATI,
|
||||
char *BusName
|
||||
)
|
||||
{
|
||||
I2CBusPtr pI2CBus;
|
||||
ATII2CPtr pATII2C = xnfcalloc(1, SizeOf(ATII2CRec));
|
||||
|
||||
if (!(pI2CBus = xf86CreateI2CBusRec()))
|
||||
{
|
||||
xf86DrvMsg(iScreen, X_WARNING, "Unable to allocate I2C Bus record.\n");
|
||||
xfree(pATII2C);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Fill in generic structure fields */
|
||||
pI2CBus->BusName = BusName;
|
||||
pI2CBus->scrnIndex = iScreen;
|
||||
|
||||
pI2CBus->I2CAddress = ATII2CAddress;
|
||||
pI2CBus->I2CStop = ATII2CStop;
|
||||
pI2CBus->I2CPutByte = ATII2CPutByte;
|
||||
pI2CBus->I2CGetByte = ATII2CGetByte;
|
||||
|
||||
pI2CBus->DriverPrivate.ptr = pATII2C;
|
||||
|
||||
pATII2C->pATI = pATI;
|
||||
|
||||
if (xf86I2CBusInit(pI2CBus))
|
||||
return pI2CBus;
|
||||
|
||||
xf86DrvMsg(iScreen, X_WARNING,
|
||||
"I2C bus %s initialisation failure.\n", BusName);
|
||||
xf86DestroyI2CBusRec(pI2CBus, TRUE, TRUE);
|
||||
xfree(pATII2C);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* ATII2CPreInit --
|
||||
*
|
||||
* This is called by ATIPreInit() to create I2C bus record(s) for the adapter.
|
||||
*/
|
||||
void
|
||||
ATII2CPreInit
|
||||
(
|
||||
ScrnInfoPtr pScreenInfo,
|
||||
ATIPtr pATI
|
||||
)
|
||||
{
|
||||
switch (pATI->Adapter)
|
||||
{
|
||||
case ATI_ADAPTER_MACH64:
|
||||
if (!ATILoadModule(pScreenInfo, "i2c", ATIi2cSymbols))
|
||||
return;
|
||||
|
||||
ATIMach64I2CPreInit(pScreenInfo, pATI);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* ATII2CFreeScreen --
|
||||
*
|
||||
* This is called by ATIFreeScreen() to remove the driver's I2C interface.
|
||||
*/
|
||||
void
|
||||
ATII2CFreeScreen
|
||||
(
|
||||
int iScreen
|
||||
)
|
||||
{
|
||||
I2CBusPtr pI2CBus, *ppI2CBus;
|
||||
ATII2CPtr pATII2C;
|
||||
int nI2CBus;
|
||||
|
||||
nI2CBus = xf86I2CGetScreenBuses(iScreen, &ppI2CBus);
|
||||
while (--nI2CBus >= 0)
|
||||
{
|
||||
pI2CBus = ppI2CBus[nI2CBus];
|
||||
pATII2C = pI2CBus->DriverPrivate.ptr;
|
||||
|
||||
xf86DestroyI2CBusRec(pI2CBus, TRUE, TRUE);
|
||||
xfree(pATII2C);
|
||||
}
|
||||
|
||||
xfree(ppI2CBus);
|
||||
}
|
||||
50
src/atii2c.h
Normal file
50
src/atii2c.h
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atii2c.h,v 1.1 2003/07/24 22:08:28 tsi Exp $ */
|
||||
/*
|
||||
* Copyright 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting documentation, and
|
||||
* that the name of Marc Aurele La France not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. Marc Aurele La France makes no representations
|
||||
* about the suitability of this software for any purpose. It is provided
|
||||
* "as-is" without express or implied warranty.
|
||||
*
|
||||
* MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
|
||||
* EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef ___ATII2C_H___
|
||||
#define ___ATII2C_H___ 1
|
||||
|
||||
#include "atipriv.h"
|
||||
#include "atiproto.h"
|
||||
|
||||
#include "xf86str.h"
|
||||
|
||||
#include "xf86i2c.h"
|
||||
|
||||
typedef struct _ATII2CRec ATII2CRec, *ATII2CPtr;
|
||||
|
||||
struct _ATII2CRec
|
||||
{
|
||||
ATIPtr pATI;
|
||||
void (*I2CSetBits) FunctionPrototype((ATII2CPtr, ATIPtr, CARD32));
|
||||
CARD32 (*I2CGetBits) FunctionPrototype((ATIPtr));
|
||||
CARD32 SCLDir, SCLGet, SCLSet;
|
||||
CARD32 SDADir, SDAGet, SDASet;
|
||||
CARD32 I2CCur;
|
||||
};
|
||||
|
||||
extern void ATII2CPreInit FunctionPrototype((ScrnInfoPtr, ATIPtr));
|
||||
extern I2CBusPtr ATICreateI2CBusRec FunctionPrototype((int, ATIPtr, char *));
|
||||
extern void ATII2CFreeScreen FunctionPrototype((int));
|
||||
|
||||
#endif /* ___ATII2C_H___ */
|
||||
862
src/atimach64accel.c
Normal file
862
src/atimach64accel.c
Normal file
|
|
@ -0,0 +1,862 @@
|
|||
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64accel.c,v 1.1 2003/04/23 21:51:28 tsi Exp $ */
|
||||
/*
|
||||
* Copyright 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting documentation, and
|
||||
* that the name of Marc Aurele La France not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. Marc Aurele La France makes no representations
|
||||
* about the suitability of this software for any purpose. It is provided
|
||||
* "as-is" without express or implied warranty.
|
||||
*
|
||||
* MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
|
||||
* EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
/*
|
||||
* Copyright 1999-2000 Precision Insight, Inc., Cedar Park, Texas.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||
* PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "ati.h"
|
||||
#include "atichip.h"
|
||||
#include "atimach64accel.h"
|
||||
#include "atimach64io.h"
|
||||
#include "atipriv.h"
|
||||
#include "atiregs.h"
|
||||
|
||||
#include "miline.h"
|
||||
|
||||
/* Used to test MMIO cache integrity in ATIMach64Sync() */
|
||||
#define TestRegisterCaching(_Register) \
|
||||
if (RegisterIsCached(_Register) && \
|
||||
(CacheSlot(_Register) != inm(_Register))) \
|
||||
{ \
|
||||
UncacheRegister(_Register); \
|
||||
xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, \
|
||||
#_Register " MMIO write cache disabled!\n"); \
|
||||
}
|
||||
|
||||
/*
|
||||
* X-to-Mach64 mix translation table.
|
||||
*/
|
||||
static CARD8 ATIMach64ALU[16] =
|
||||
{
|
||||
MIX_0, /* GXclear */
|
||||
MIX_AND, /* GXand */
|
||||
MIX_SRC_AND_NOT_DST, /* GXandReverse */
|
||||
MIX_SRC, /* GXcopy */
|
||||
MIX_NOT_SRC_AND_DST, /* GXandInverted */
|
||||
MIX_DST, /* GXnoop */
|
||||
MIX_XOR, /* GXxor */
|
||||
MIX_OR, /* GXor */
|
||||
MIX_NOR, /* GXnor */
|
||||
MIX_XNOR, /* GXequiv */
|
||||
MIX_NOT_DST, /* GXinvert */
|
||||
MIX_SRC_OR_NOT_DST, /* GXorReverse */
|
||||
MIX_NOT_SRC, /* GXcopyInverted */
|
||||
MIX_NOT_SRC_OR_DST, /* GXorInverted */
|
||||
MIX_NAND, /* GXnand */
|
||||
MIX_1 /* GXset */
|
||||
};
|
||||
|
||||
/*
|
||||
* ATIMach64ValidateClip --
|
||||
*
|
||||
* This function ensures the current scissor settings do not interfere with
|
||||
* the current draw request.
|
||||
*/
|
||||
static void
|
||||
ATIMach64ValidateClip
|
||||
(
|
||||
ATIPtr pATI,
|
||||
int sc_left,
|
||||
int sc_right,
|
||||
int sc_top,
|
||||
int sc_bottom
|
||||
)
|
||||
{
|
||||
if ((sc_left < (int)pATI->sc_left) || (sc_right > (int)pATI->sc_right))
|
||||
{
|
||||
outf(SC_LEFT_RIGHT, pATI->sc_left_right);
|
||||
pATI->sc_left = pATI->NewHW.sc_left;
|
||||
pATI->sc_right = pATI->NewHW.sc_right;
|
||||
}
|
||||
|
||||
if ((sc_top < (int)pATI->sc_top) || (sc_bottom > (int)pATI->sc_bottom))
|
||||
{
|
||||
outf(SC_TOP_BOTTOM, pATI->sc_top_bottom);
|
||||
pATI->sc_top = pATI->NewHW.sc_top;
|
||||
pATI->sc_bottom = pATI->NewHW.sc_bottom;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* ATIMach64Sync --
|
||||
*
|
||||
* This is called to wait for the draw engine to become idle.
|
||||
*/
|
||||
void
|
||||
ATIMach64Sync
|
||||
(
|
||||
ScrnInfoPtr pScreenInfo
|
||||
)
|
||||
{
|
||||
ATIPtr pATI = ATIPTR(pScreenInfo);
|
||||
|
||||
ATIMach64WaitForIdle(pATI);
|
||||
if (pATI->pXAAInfo)
|
||||
pATI->pXAAInfo->NeedToSync = FALSE;
|
||||
|
||||
if (pATI->OptionMMIOCache && pATI->OptionTestMMIOCache)
|
||||
{
|
||||
/*
|
||||
* For debugging purposes, attempt to verify that each cached register
|
||||
* should actually be cached.
|
||||
*/
|
||||
TestRegisterCaching(SRC_CNTL);
|
||||
|
||||
TestRegisterCaching(HOST_CNTL);
|
||||
|
||||
TestRegisterCaching(PAT_REG0);
|
||||
TestRegisterCaching(PAT_REG1);
|
||||
TestRegisterCaching(PAT_CNTL);
|
||||
|
||||
if (RegisterIsCached(SC_LEFT_RIGHT) && /* Special case */
|
||||
(CacheSlot(SC_LEFT_RIGHT) !=
|
||||
(SetWord(inm(SC_RIGHT), 1) | SetWord(inm(SC_LEFT), 0))))
|
||||
{
|
||||
UncacheRegister(SC_LEFT_RIGHT);
|
||||
xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING,
|
||||
"SC_LEFT_RIGHT write cache disabled!\n");
|
||||
}
|
||||
|
||||
if (RegisterIsCached(SC_TOP_BOTTOM) && /* Special case */
|
||||
(CacheSlot(SC_TOP_BOTTOM) !=
|
||||
(SetWord(inm(SC_BOTTOM), 1) | SetWord(inm(SC_TOP), 0))))
|
||||
{
|
||||
UncacheRegister(SC_TOP_BOTTOM);
|
||||
xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING,
|
||||
"SC_TOP_BOTTOM write cache disabled!\n");
|
||||
}
|
||||
|
||||
TestRegisterCaching(DP_BKGD_CLR);
|
||||
TestRegisterCaching(DP_FRGD_CLR);
|
||||
TestRegisterCaching(DP_WRITE_MASK);
|
||||
TestRegisterCaching(DP_MIX);
|
||||
|
||||
TestRegisterCaching(CLR_CMP_CLR);
|
||||
TestRegisterCaching(CLR_CMP_MSK);
|
||||
TestRegisterCaching(CLR_CMP_CNTL);
|
||||
|
||||
if (pATI->Block1Base)
|
||||
{
|
||||
TestRegisterCaching(OVERLAY_Y_X_START);
|
||||
TestRegisterCaching(OVERLAY_Y_X_END);
|
||||
|
||||
TestRegisterCaching(OVERLAY_GRAPHICS_KEY_CLR);
|
||||
TestRegisterCaching(OVERLAY_GRAPHICS_KEY_MSK);
|
||||
|
||||
TestRegisterCaching(OVERLAY_KEY_CNTL);
|
||||
|
||||
TestRegisterCaching(OVERLAY_SCALE_INC);
|
||||
TestRegisterCaching(OVERLAY_SCALE_CNTL);
|
||||
|
||||
TestRegisterCaching(SCALER_HEIGHT_WIDTH);
|
||||
|
||||
TestRegisterCaching(SCALER_TEST);
|
||||
|
||||
TestRegisterCaching(VIDEO_FORMAT);
|
||||
|
||||
if (pATI->Chip < ATI_CHIP_264VTB)
|
||||
{
|
||||
TestRegisterCaching(BUF0_OFFSET);
|
||||
TestRegisterCaching(BUF0_PITCH);
|
||||
TestRegisterCaching(BUF1_OFFSET);
|
||||
TestRegisterCaching(BUF1_PITCH);
|
||||
}
|
||||
else
|
||||
{
|
||||
TestRegisterCaching(SCALER_BUF0_OFFSET);
|
||||
TestRegisterCaching(SCALER_BUF1_OFFSET);
|
||||
TestRegisterCaching(SCALER_BUF_PITCH);
|
||||
|
||||
TestRegisterCaching(OVERLAY_EXCLUSIVE_HORZ);
|
||||
TestRegisterCaching(OVERLAY_EXCLUSIVE_VERT);
|
||||
|
||||
if (pATI->Chip >= ATI_CHIP_264GTPRO)
|
||||
{
|
||||
TestRegisterCaching(SCALER_COLOUR_CNTL);
|
||||
|
||||
TestRegisterCaching(SCALER_H_COEFF0);
|
||||
TestRegisterCaching(SCALER_H_COEFF1);
|
||||
TestRegisterCaching(SCALER_H_COEFF2);
|
||||
TestRegisterCaching(SCALER_H_COEFF3);
|
||||
TestRegisterCaching(SCALER_H_COEFF4);
|
||||
|
||||
TestRegisterCaching(SCALER_BUF0_OFFSET_U);
|
||||
TestRegisterCaching(SCALER_BUF0_OFFSET_V);
|
||||
TestRegisterCaching(SCALER_BUF1_OFFSET_U);
|
||||
TestRegisterCaching(SCALER_BUF1_OFFSET_V);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* For VTB's and later, the first CPU read of the framebuffer will return
|
||||
* zeroes, so do it here. This appears to be due to some kind of engine
|
||||
* caching of framebuffer data I haven't found any way of disabling, or
|
||||
* otherwise circumventing. Thanks to Mark Vojkovich for the suggestion.
|
||||
*/
|
||||
pATI = *(volatile ATIPtr *)pATI->pMemory;
|
||||
}
|
||||
|
||||
/*
|
||||
* ATIMach64SetupForScreenToScreenCopy --
|
||||
*
|
||||
* This function sets up the draw engine for a series of screen-to-screen copy
|
||||
* operations.
|
||||
*/
|
||||
static void
|
||||
ATIMach64SetupForScreenToScreenCopy
|
||||
(
|
||||
ScrnInfoPtr pScreenInfo,
|
||||
int xdir,
|
||||
int ydir,
|
||||
int rop,
|
||||
unsigned int planemask,
|
||||
int TransparencyColour
|
||||
)
|
||||
{
|
||||
ATIPtr pATI = ATIPTR(pScreenInfo);
|
||||
|
||||
ATIMach64WaitForFIFO(pATI, 3);
|
||||
outf(DP_WRITE_MASK, planemask);
|
||||
outf(DP_SRC, DP_MONO_SRC_ALLONES |
|
||||
SetBits(SRC_BLIT, DP_FRGD_SRC) | SetBits(SRC_BKGD, DP_BKGD_SRC));
|
||||
outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX));
|
||||
|
||||
#ifdef AVOID_DGA
|
||||
|
||||
if (TransparencyColour == -1)
|
||||
|
||||
#else /* AVOID_DGA */
|
||||
|
||||
if (!pATI->XAAForceTransBlit && (TransparencyColour == -1))
|
||||
|
||||
#endif /* AVOID_DGA */
|
||||
|
||||
{
|
||||
outf(CLR_CMP_CNTL, CLR_CMP_FN_FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
ATIMach64WaitForFIFO(pATI, 2);
|
||||
outf(CLR_CMP_CLR, TransparencyColour);
|
||||
outf(CLR_CMP_CNTL, CLR_CMP_FN_EQUAL | CLR_CMP_SRC_2D);
|
||||
}
|
||||
|
||||
pATI->dst_cntl = 0;
|
||||
|
||||
if (ydir > 0)
|
||||
pATI->dst_cntl |= DST_Y_DIR;
|
||||
if (xdir > 0)
|
||||
pATI->dst_cntl |= DST_X_DIR;
|
||||
|
||||
if (pATI->XModifier == 1)
|
||||
outf(DST_CNTL, pATI->dst_cntl);
|
||||
else
|
||||
pATI->dst_cntl |= DST_24_ROT_EN;
|
||||
}
|
||||
|
||||
/*
|
||||
* ATIMach64SubsequentScreenToScreenCopy --
|
||||
*
|
||||
* This function performs a screen-to-screen copy operation.
|
||||
*/
|
||||
static void
|
||||
ATIMach64SubsequentScreenToScreenCopy
|
||||
(
|
||||
ScrnInfoPtr pScreenInfo,
|
||||
int xSrc,
|
||||
int ySrc,
|
||||
int xDst,
|
||||
int yDst,
|
||||
int w,
|
||||
int h
|
||||
)
|
||||
{
|
||||
ATIPtr pATI = ATIPTR(pScreenInfo);
|
||||
|
||||
xSrc *= pATI->XModifier;
|
||||
xDst *= pATI->XModifier;
|
||||
w *= pATI->XModifier;
|
||||
|
||||
/* Disable clipping if it gets in the way */
|
||||
ATIMach64ValidateClip(pATI, xDst, xDst + w - 1, yDst, yDst + h - 1);
|
||||
|
||||
if (!(pATI->dst_cntl & DST_X_DIR))
|
||||
{
|
||||
xSrc += w - 1;
|
||||
xDst += w - 1;
|
||||
}
|
||||
|
||||
if (!(pATI->dst_cntl & DST_Y_DIR))
|
||||
{
|
||||
ySrc += h - 1;
|
||||
yDst += h - 1;
|
||||
}
|
||||
|
||||
if (pATI->XModifier != 1)
|
||||
outf(DST_CNTL, pATI->dst_cntl | SetBits((xDst / 4) % 6, DST_24_ROT));
|
||||
|
||||
ATIMach64WaitForFIFO(pATI, 4);
|
||||
outf(SRC_Y_X, SetWord(xSrc, 1) | SetWord(ySrc, 0));
|
||||
outf(SRC_WIDTH1, w);
|
||||
outf(DST_Y_X, SetWord(xDst, 1) | SetWord(yDst, 0));
|
||||
outf(DST_HEIGHT_WIDTH, SetWord(w, 1) | SetWord(h, 0));
|
||||
}
|
||||
|
||||
/*
|
||||
* ATIMach64SetupForSolidFill --
|
||||
*
|
||||
* This function sets up the draw engine for a series of solid fills.
|
||||
*/
|
||||
static void
|
||||
ATIMach64SetupForSolidFill
|
||||
(
|
||||
ScrnInfoPtr pScreenInfo,
|
||||
int colour,
|
||||
int rop,
|
||||
unsigned int planemask
|
||||
)
|
||||
{
|
||||
ATIPtr pATI = ATIPTR(pScreenInfo);
|
||||
|
||||
ATIMach64WaitForFIFO(pATI, 5);
|
||||
outf(DP_WRITE_MASK, planemask);
|
||||
outf(DP_SRC, DP_MONO_SRC_ALLONES |
|
||||
SetBits(SRC_FRGD, DP_FRGD_SRC) | SetBits(SRC_BKGD, DP_BKGD_SRC));
|
||||
outf(DP_FRGD_CLR, colour);
|
||||
outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX));
|
||||
|
||||
outf(CLR_CMP_CNTL, CLR_CMP_FN_FALSE);
|
||||
|
||||
if (pATI->XModifier == 1)
|
||||
outf(DST_CNTL, DST_X_DIR | DST_Y_DIR);
|
||||
}
|
||||
|
||||
/*
|
||||
* ATIMach64SubsequentSolidFillRect --
|
||||
*
|
||||
* This function performs a solid rectangle fill.
|
||||
*/
|
||||
static void
|
||||
ATIMach64SubsequentSolidFillRect
|
||||
(
|
||||
ScrnInfoPtr pScreenInfo,
|
||||
int x,
|
||||
int y,
|
||||
int w,
|
||||
int h
|
||||
)
|
||||
{
|
||||
ATIPtr pATI = ATIPTR(pScreenInfo);
|
||||
|
||||
if (pATI->XModifier != 1)
|
||||
{
|
||||
x *= pATI->XModifier;
|
||||
w *= pATI->XModifier;
|
||||
|
||||
outf(DST_CNTL, SetBits((x / 4) % 6, DST_24_ROT) |
|
||||
(DST_X_DIR | DST_Y_DIR | DST_24_ROT_EN));
|
||||
}
|
||||
|
||||
/* Disable clipping if it gets in the way */
|
||||
ATIMach64ValidateClip(pATI, x, x + w - 1, y, y + h - 1);
|
||||
|
||||
ATIMach64WaitForFIFO(pATI, 2);
|
||||
outf(DST_Y_X, SetWord(x, 1) | SetWord(y, 0));
|
||||
outf(DST_HEIGHT_WIDTH, SetWord(w, 1) | SetWord(h, 0));
|
||||
}
|
||||
|
||||
/*
|
||||
* ATIMach64SetupForSolidLine --
|
||||
*
|
||||
* This function sets up the draw engine for a series of solid lines. It is
|
||||
* not used for 24bpp because the engine doesn't support it.
|
||||
*/
|
||||
static void
|
||||
ATIMach64SetupForSolidLine
|
||||
(
|
||||
ScrnInfoPtr pScreenInfo,
|
||||
int colour,
|
||||
int rop,
|
||||
unsigned int planemask
|
||||
)
|
||||
{
|
||||
ATIPtr pATI = ATIPTR(pScreenInfo);
|
||||
|
||||
ATIMach64WaitForFIFO(pATI, 5);
|
||||
outf(DP_WRITE_MASK, planemask);
|
||||
outf(DP_SRC, DP_MONO_SRC_ALLONES |
|
||||
SetBits(SRC_FRGD, DP_FRGD_SRC) | SetBits(SRC_BKGD, DP_BKGD_SRC));
|
||||
outf(DP_FRGD_CLR, colour);
|
||||
outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX));
|
||||
|
||||
outf(CLR_CMP_CNTL, CLR_CMP_FN_FALSE);
|
||||
|
||||
ATIMach64ValidateClip(pATI, pATI->NewHW.sc_left, pATI->NewHW.sc_right,
|
||||
pATI->NewHW.sc_top, pATI->NewHW.sc_bottom);
|
||||
}
|
||||
|
||||
/*
|
||||
* ATIMach64SubsequentSolidHorVertLine --
|
||||
*
|
||||
* This is called to draw a solid horizontal or vertical line. This does a
|
||||
* one-pixel wide solid fill.
|
||||
*/
|
||||
static void
|
||||
ATIMach64SubsequentSolidHorVertLine
|
||||
(
|
||||
ScrnInfoPtr pScreenInfo,
|
||||
int x,
|
||||
int y,
|
||||
int len,
|
||||
int dir
|
||||
)
|
||||
{
|
||||
ATIPtr pATI = ATIPTR(pScreenInfo);
|
||||
|
||||
ATIMach64WaitForFIFO(pATI, 3);
|
||||
outf(DST_CNTL, DST_X_DIR | DST_Y_DIR);
|
||||
outf(DST_Y_X, SetWord(x, 1) | SetWord(y, 0));
|
||||
|
||||
if (dir == DEGREES_0)
|
||||
outf(DST_HEIGHT_WIDTH, SetWord(len, 1) | SetWord(1, 0));
|
||||
else /* if (dir == DEGREES_270) */
|
||||
outf(DST_HEIGHT_WIDTH, SetWord(1, 1) | SetWord(len, 0));
|
||||
}
|
||||
|
||||
/*
|
||||
* ATIMach64SubsequentSolidBresenhamLine --
|
||||
*
|
||||
* This function draws a line using the Bresenham line engine.
|
||||
*/
|
||||
static void
|
||||
ATIMach64SubsequentSolidBresenhamLine
|
||||
(
|
||||
ScrnInfoPtr pScreenInfo,
|
||||
int x,
|
||||
int y,
|
||||
int major,
|
||||
int minor,
|
||||
int err,
|
||||
int len,
|
||||
int octant
|
||||
)
|
||||
{
|
||||
ATIPtr pATI = ATIPTR(pScreenInfo);
|
||||
CARD32 dst_cntl = DST_LAST_PEL;
|
||||
|
||||
if (octant & YMAJOR)
|
||||
dst_cntl |= DST_Y_MAJOR;
|
||||
|
||||
if (!(octant & XDECREASING))
|
||||
dst_cntl |= DST_X_DIR;
|
||||
|
||||
if (!(octant & YDECREASING))
|
||||
dst_cntl |= DST_Y_DIR;
|
||||
|
||||
ATIMach64WaitForFIFO(pATI, 6);
|
||||
outf(DST_CNTL, dst_cntl);
|
||||
outf(DST_Y_X, SetWord(x, 1) | SetWord(y, 0));
|
||||
outf(DST_BRES_ERR, minor + err);
|
||||
outf(DST_BRES_INC, minor);
|
||||
outf(DST_BRES_DEC, minor - major);
|
||||
outf(DST_BRES_LNTH, len);
|
||||
}
|
||||
|
||||
/*
|
||||
* ATIMach64SetupForMono8x8PatternFill --
|
||||
*
|
||||
* This function sets up the draw engine for a series of 8x8 1bpp pattern
|
||||
* fills.
|
||||
*/
|
||||
static void
|
||||
ATIMach64SetupForMono8x8PatternFill
|
||||
(
|
||||
ScrnInfoPtr pScreenInfo,
|
||||
int patx,
|
||||
int paty,
|
||||
int fg,
|
||||
int bg,
|
||||
int rop,
|
||||
unsigned int planemask
|
||||
)
|
||||
{
|
||||
ATIPtr pATI = ATIPTR(pScreenInfo);
|
||||
|
||||
ATIMach64WaitForFIFO(pATI, 3);
|
||||
outf(DP_WRITE_MASK, planemask);
|
||||
outf(DP_SRC, DP_MONO_SRC_PATTERN |
|
||||
SetBits(SRC_FRGD, DP_FRGD_SRC) | SetBits(SRC_BKGD, DP_BKGD_SRC));
|
||||
outf(DP_FRGD_CLR, fg);
|
||||
|
||||
if (bg == -1)
|
||||
{
|
||||
outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX) |
|
||||
SetBits(MIX_DST, DP_BKGD_MIX));
|
||||
}
|
||||
else
|
||||
{
|
||||
ATIMach64WaitForFIFO(pATI, 2);
|
||||
outf(DP_BKGD_CLR, bg);
|
||||
outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX) |
|
||||
SetBits(ATIMach64ALU[rop], DP_BKGD_MIX));
|
||||
}
|
||||
|
||||
ATIMach64WaitForFIFO(pATI, 4);
|
||||
outf(PAT_REG0, patx);
|
||||
outf(PAT_REG1, paty);
|
||||
outf(PAT_CNTL, PAT_MONO_EN);
|
||||
|
||||
outf(CLR_CMP_CNTL, CLR_CMP_FN_FALSE);
|
||||
|
||||
if (pATI->XModifier == 1)
|
||||
outf(DST_CNTL, DST_X_DIR | DST_Y_DIR);
|
||||
}
|
||||
|
||||
/*
|
||||
* ATIMach64SubsequentMono8x8PatternFillRect --
|
||||
*
|
||||
* This function performs an 8x8 1bpp pattern fill.
|
||||
*/
|
||||
static void
|
||||
ATIMach64SubsequentMono8x8PatternFillRect
|
||||
(
|
||||
ScrnInfoPtr pScreenInfo,
|
||||
int patx,
|
||||
int paty,
|
||||
int x,
|
||||
int y,
|
||||
int w,
|
||||
int h
|
||||
)
|
||||
{
|
||||
ATIPtr pATI = ATIPTR(pScreenInfo);
|
||||
|
||||
if (pATI->XModifier != 1)
|
||||
{
|
||||
x *= pATI->XModifier;
|
||||
w *= pATI->XModifier;
|
||||
|
||||
outf(DST_CNTL, SetBits((x / 4) % 6, DST_24_ROT) |
|
||||
(DST_X_DIR | DST_Y_DIR | DST_24_ROT_EN));
|
||||
}
|
||||
|
||||
/* Disable clipping if it gets in the way */
|
||||
ATIMach64ValidateClip(pATI, x, x + w - 1, y, y + h - 1);
|
||||
|
||||
ATIMach64WaitForFIFO(pATI, 2);
|
||||
outf(DST_Y_X, SetWord(x, 1) | SetWord(y, 0));
|
||||
outf(DST_HEIGHT_WIDTH, SetWord(w, 1) | SetWord(h, 0));
|
||||
}
|
||||
|
||||
/*
|
||||
* ATIMach64SetupForScanlineCPUToScreenColorExpandFill --
|
||||
*
|
||||
* This function sets up the engine for a series of colour expansion fills.
|
||||
*/
|
||||
static void
|
||||
ATIMach64SetupForScanlineCPUToScreenColorExpandFill
|
||||
(
|
||||
ScrnInfoPtr pScreenInfo,
|
||||
int fg,
|
||||
int bg,
|
||||
int rop,
|
||||
unsigned int planemask
|
||||
)
|
||||
{
|
||||
ATIPtr pATI = ATIPTR(pScreenInfo);
|
||||
|
||||
ATIMach64WaitForFIFO(pATI, 3);
|
||||
outf(DP_WRITE_MASK, planemask);
|
||||
outf(DP_SRC, DP_MONO_SRC_HOST |
|
||||
SetBits(SRC_FRGD, DP_FRGD_SRC) | SetBits(SRC_BKGD, DP_BKGD_SRC));
|
||||
outf(DP_FRGD_CLR, fg);
|
||||
|
||||
if (bg == -1)
|
||||
{
|
||||
outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX) |
|
||||
SetBits(MIX_DST, DP_BKGD_MIX));
|
||||
}
|
||||
else
|
||||
{
|
||||
ATIMach64WaitForFIFO(pATI, 2);
|
||||
outf(DP_BKGD_CLR, bg);
|
||||
outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX) |
|
||||
SetBits(ATIMach64ALU[rop], DP_BKGD_MIX));
|
||||
}
|
||||
|
||||
outf(CLR_CMP_CNTL, CLR_CMP_FN_FALSE);
|
||||
|
||||
if (pATI->XModifier == 1)
|
||||
outf(DST_CNTL, DST_X_DIR | DST_Y_DIR);
|
||||
}
|
||||
|
||||
/*
|
||||
* ATIMach64SubsequentScanlineCPUToScreenColorExpandFill --
|
||||
*
|
||||
* This function sets up the engine for a single colour expansion fill.
|
||||
*/
|
||||
static void
|
||||
ATIMach64SubsequentScanlineCPUToScreenColorExpandFill
|
||||
(
|
||||
ScrnInfoPtr pScreenInfo,
|
||||
int x,
|
||||
int y,
|
||||
int w,
|
||||
int h,
|
||||
int skipleft
|
||||
)
|
||||
{
|
||||
ATIPtr pATI = ATIPTR(pScreenInfo);
|
||||
|
||||
if (pATI->XModifier != 1)
|
||||
{
|
||||
x *= pATI->XModifier;
|
||||
w *= pATI->XModifier;
|
||||
skipleft *= pATI->XModifier;
|
||||
|
||||
outf(DST_CNTL, SetBits((x / 4) % 6, DST_24_ROT) |
|
||||
(DST_X_DIR | DST_Y_DIR | DST_24_ROT_EN));
|
||||
}
|
||||
|
||||
pATI->ExpansionBitmapWidth = (w + 31) / 32;
|
||||
|
||||
ATIMach64WaitForFIFO(pATI, 3);
|
||||
pATI->sc_left = x + skipleft;
|
||||
pATI->sc_right = x + w - 1;
|
||||
outf(SC_LEFT_RIGHT,
|
||||
SetWord(pATI->sc_right, 1) | SetWord(pATI->sc_left, 0));
|
||||
outf(DST_Y_X, SetWord(x, 1) | SetWord(y, 0));
|
||||
outf(DST_HEIGHT_WIDTH,
|
||||
SetWord(pATI->ExpansionBitmapWidth * 32, 1) | SetWord(h, 0));
|
||||
}
|
||||
|
||||
/*
|
||||
* ATIMach64SubsequentColorExpandScanline --
|
||||
*
|
||||
* This function feeds a bitmap scanline to the engine for a colour expansion
|
||||
* fill. This is written to do burst transfers for those platforms that can do
|
||||
* them, and to improve CPU/engine concurrency.
|
||||
*/
|
||||
static void
|
||||
ATIMach64SubsequentColorExpandScanline
|
||||
(
|
||||
ScrnInfoPtr pScreenInfo,
|
||||
int iBuffer
|
||||
)
|
||||
{
|
||||
ATIPtr pATI = ATIPTR(pScreenInfo);
|
||||
CARD32 *pBitmapData = pATI->ExpansionBitmapScanlinePtr[iBuffer];
|
||||
int w = pATI->ExpansionBitmapWidth;
|
||||
int nDWord;
|
||||
|
||||
while (w > 0)
|
||||
{
|
||||
/*
|
||||
* Transfers are done in chunks of up to 64 bytes in length (32 on
|
||||
* earlier controllers).
|
||||
*/
|
||||
nDWord = w;
|
||||
if (nDWord > pATI->nHostFIFOEntries)
|
||||
nDWord = pATI->nHostFIFOEntries;
|
||||
|
||||
/* Make enough FIFO slots available */
|
||||
ATIMach64WaitForFIFO(pATI, nDWord);
|
||||
|
||||
/*
|
||||
* Always start transfers on a chuck-sized boundary. Note that
|
||||
* HOST_DATA_0 is actually on a 512-byte boundary, but *pBitmapData can
|
||||
* only be guaranteed to be on a chunk-sized boundary.
|
||||
*
|
||||
* Transfer current chunk. With any luck, the compiler won't mangle
|
||||
* this too badly...
|
||||
*/
|
||||
|
||||
# if defined(ATIMove32)
|
||||
|
||||
{
|
||||
ATIMove32(pATI->pHOST_DATA, pBitmapData, nDWord);
|
||||
}
|
||||
|
||||
# else
|
||||
|
||||
{
|
||||
volatile CARD32 *pDst;
|
||||
CARD32 *pSrc;
|
||||
unsigned int iDWord;
|
||||
|
||||
iDWord = 16 - nDWord;
|
||||
pDst = (volatile CARD32 *)pATI->pHOST_DATA - iDWord;
|
||||
pSrc = pBitmapData - iDWord;
|
||||
|
||||
switch (iDWord)
|
||||
{
|
||||
case 0: MMIO_MOVE32(pDst + 0, 0, *(pSrc + 0));
|
||||
case 1: MMIO_MOVE32(pDst + 1, 0, *(pSrc + 1));
|
||||
case 2: MMIO_MOVE32(pDst + 2, 0, *(pSrc + 2));
|
||||
case 3: MMIO_MOVE32(pDst + 3, 0, *(pSrc + 3));
|
||||
case 4: MMIO_MOVE32(pDst + 4, 0, *(pSrc + 4));
|
||||
case 5: MMIO_MOVE32(pDst + 5, 0, *(pSrc + 5));
|
||||
case 6: MMIO_MOVE32(pDst + 6, 0, *(pSrc + 6));
|
||||
case 7: MMIO_MOVE32(pDst + 7, 0, *(pSrc + 7));
|
||||
case 8: MMIO_MOVE32(pDst + 8, 0, *(pSrc + 8));
|
||||
case 9: MMIO_MOVE32(pDst + 9, 0, *(pSrc + 9));
|
||||
case 10: MMIO_MOVE32(pDst + 10, 0, *(pSrc + 10));
|
||||
case 11: MMIO_MOVE32(pDst + 11, 0, *(pSrc + 11));
|
||||
case 12: MMIO_MOVE32(pDst + 12, 0, *(pSrc + 12));
|
||||
case 13: MMIO_MOVE32(pDst + 13, 0, *(pSrc + 13));
|
||||
case 14: MMIO_MOVE32(pDst + 14, 0, *(pSrc + 14));
|
||||
case 15: MMIO_MOVE32(pDst + 15, 0, *(pSrc + 15));
|
||||
|
||||
default: /* Muffle compiler */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
# endif
|
||||
|
||||
/* Step to next chunk */
|
||||
pBitmapData += nDWord;
|
||||
w -= nDWord;
|
||||
pATI->nAvailableFIFOEntries -= nDWord;
|
||||
}
|
||||
|
||||
pATI->EngineIsBusy = TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* ATIMach64AccelInit --
|
||||
*
|
||||
* This function fills in structure fields needed for acceleration on Mach64
|
||||
* variants.
|
||||
*/
|
||||
int
|
||||
ATIMach64AccelInit
|
||||
(
|
||||
ATIPtr pATI,
|
||||
XAAInfoRecPtr pXAAInfo
|
||||
)
|
||||
{
|
||||
/* This doesn't seem quite right... */
|
||||
if (pATI->XModifier == 1)
|
||||
{
|
||||
pXAAInfo->Flags = PIXMAP_CACHE | OFFSCREEN_PIXMAPS;
|
||||
|
||||
#ifndef AVOID_CPIO
|
||||
|
||||
if (!pATI->BankInfo.BankSize)
|
||||
|
||||
#endif /* AVOID_CPIO */
|
||||
|
||||
{
|
||||
pXAAInfo->Flags |= LINEAR_FRAMEBUFFER;
|
||||
}
|
||||
}
|
||||
|
||||
/* Sync */
|
||||
pXAAInfo->Sync = ATIMach64Sync;
|
||||
|
||||
/* Screen-to-screen copy */
|
||||
pXAAInfo->SetupForScreenToScreenCopy = ATIMach64SetupForScreenToScreenCopy;
|
||||
pXAAInfo->SubsequentScreenToScreenCopy =
|
||||
ATIMach64SubsequentScreenToScreenCopy;
|
||||
|
||||
/* Solid fills */
|
||||
pXAAInfo->SetupForSolidFill = ATIMach64SetupForSolidFill;
|
||||
pXAAInfo->SubsequentSolidFillRect = ATIMach64SubsequentSolidFillRect;
|
||||
|
||||
/* 8x8 mono pattern fills */
|
||||
pXAAInfo->Mono8x8PatternFillFlags =
|
||||
|
||||
#if X_BYTE_ORDER != X_LITTLE_ENDIAN
|
||||
|
||||
BIT_ORDER_IN_BYTE_MSBFIRST |
|
||||
|
||||
#endif /* X_BYTE_ORDER */
|
||||
|
||||
HARDWARE_PATTERN_PROGRAMMED_BITS | HARDWARE_PATTERN_SCREEN_ORIGIN;
|
||||
pXAAInfo->SetupForMono8x8PatternFill = ATIMach64SetupForMono8x8PatternFill;
|
||||
pXAAInfo->SubsequentMono8x8PatternFillRect =
|
||||
ATIMach64SubsequentMono8x8PatternFillRect;
|
||||
|
||||
/*
|
||||
* Use scanline version of colour expansion, not only for the non-ix86
|
||||
* case, but also to avoid PCI retries.
|
||||
*/
|
||||
pXAAInfo->ScanlineCPUToScreenColorExpandFillFlags =
|
||||
LEFT_EDGE_CLIPPING | LEFT_EDGE_CLIPPING_NEGATIVE_X |
|
||||
CPU_TRANSFER_PAD_DWORD | SCANLINE_PAD_DWORD;
|
||||
if (pATI->XModifier != 1)
|
||||
pXAAInfo->ScanlineCPUToScreenColorExpandFillFlags |= TRIPLE_BITS_24BPP;
|
||||
pXAAInfo->NumScanlineColorExpandBuffers = 1;
|
||||
|
||||
/* Align bitmap data on a 64-byte boundary */
|
||||
pATI->ExpansionBitmapWidth = /* DWord size in bits */
|
||||
((pATI->displayWidth * pATI->XModifier) + 31) & ~31U;
|
||||
pATI->ExpansionBitmapScanlinePtr[1] =
|
||||
(CARD32 *)xnfalloc((pATI->ExpansionBitmapWidth >> 3) + 63);
|
||||
pATI->ExpansionBitmapScanlinePtr[0] =
|
||||
(pointer)(((unsigned long)pATI->ExpansionBitmapScanlinePtr[1] + 63) &
|
||||
~63UL);
|
||||
pXAAInfo->ScanlineColorExpandBuffers =
|
||||
(CARD8 **)pATI->ExpansionBitmapScanlinePtr;
|
||||
pXAAInfo->SetupForScanlineCPUToScreenColorExpandFill =
|
||||
ATIMach64SetupForScanlineCPUToScreenColorExpandFill;
|
||||
pXAAInfo->SubsequentScanlineCPUToScreenColorExpandFill =
|
||||
ATIMach64SubsequentScanlineCPUToScreenColorExpandFill;
|
||||
pXAAInfo->SubsequentColorExpandScanline =
|
||||
ATIMach64SubsequentColorExpandScanline;
|
||||
|
||||
/* The engine does not support the following primitives for 24bpp */
|
||||
if (pATI->XModifier != 1)
|
||||
return ATIMach64MaxY;
|
||||
|
||||
/* Solid lines */
|
||||
pXAAInfo->SetupForSolidLine = ATIMach64SetupForSolidLine;
|
||||
pXAAInfo->SubsequentSolidHorVertLine = ATIMach64SubsequentSolidHorVertLine;
|
||||
pXAAInfo->SubsequentSolidBresenhamLine =
|
||||
ATIMach64SubsequentSolidBresenhamLine;
|
||||
|
||||
return ATIMach64MaxY;
|
||||
}
|
||||
38
src/atimach64accel.h
Normal file
38
src/atimach64accel.h
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64accel.h,v 1.1 2003/04/23 21:51:29 tsi Exp $ */
|
||||
/*
|
||||
* Copyright 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting documentation, and
|
||||
* that the name of Marc Aurele La France not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. Marc Aurele La France makes no representations
|
||||
* about the suitability of this software for any purpose. It is provided
|
||||
* "as-is" without express or implied warranty.
|
||||
*
|
||||
* MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
|
||||
* EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef ___ATIMACH64ACCEL_H___
|
||||
#define ___ATIMACH64ACCEL_H___ 1
|
||||
|
||||
#include "atipriv.h"
|
||||
#include "atiproto.h"
|
||||
|
||||
#include "xaa.h"
|
||||
|
||||
#define ATIMach64MaxX 8191
|
||||
#define ATIMach64MaxY 32767
|
||||
|
||||
extern int ATIMach64AccelInit FunctionPrototype((ATIPtr, XAAInfoRecPtr));
|
||||
extern void ATIMach64Sync FunctionPrototype((ScrnInfoPtr));
|
||||
|
||||
#endif /* ___ATIMACH64ACCEL_H___ */
|
||||
400
src/atimach64cursor.c
Normal file
400
src/atimach64cursor.c
Normal file
|
|
@ -0,0 +1,400 @@
|
|||
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64cursor.c,v 1.1 2003/04/23 21:51:29 tsi Exp $ */
|
||||
/*
|
||||
* Copyright 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting documentation, and
|
||||
* that the name of Marc Aurele La France not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. Marc Aurele La France makes no representations
|
||||
* about the suitability of this software for any purpose. It is provided
|
||||
* "as-is" without express or implied warranty.
|
||||
*
|
||||
* MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
|
||||
* EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "ati.h"
|
||||
#include "aticrtc.h"
|
||||
#include "atimach64accel.h"
|
||||
#include "atimach64cursor.h"
|
||||
#include "atimach64io.h"
|
||||
|
||||
/*
|
||||
* ATIMach64SetCursorColours --
|
||||
*
|
||||
* Set hardware cursor foreground and background colours.
|
||||
*/
|
||||
static void
|
||||
ATIMach64SetCursorColours
|
||||
(
|
||||
ScrnInfoPtr pScreenInfo,
|
||||
int fg,
|
||||
int bg
|
||||
)
|
||||
{
|
||||
ATIPtr pATI = ATIPTR(pScreenInfo);
|
||||
|
||||
outr(CUR_CLR0, SetBits(fg, CUR_CLR));
|
||||
outr(CUR_CLR1, SetBits(bg, CUR_CLR));
|
||||
}
|
||||
|
||||
/*
|
||||
* ATIMach64SetCursorPosition --
|
||||
*
|
||||
* Set position of hardware cursor.
|
||||
*/
|
||||
static void
|
||||
ATIMach64SetCursorPosition
|
||||
(
|
||||
ScrnInfoPtr pScreenInfo,
|
||||
int x,
|
||||
int y
|
||||
)
|
||||
{
|
||||
ATIPtr pATI = ATIPTR(pScreenInfo);
|
||||
CARD16 CursorXOffset, CursorYOffset;
|
||||
|
||||
/* Adjust x & y when the cursor is partially obscured */
|
||||
if (x < 0)
|
||||
{
|
||||
if ((CursorXOffset = -x) > 63)
|
||||
CursorXOffset = 63;
|
||||
x = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
CursorXOffset = pScreenInfo->frameX1 - pScreenInfo->frameX0;
|
||||
if (x > CursorXOffset)
|
||||
x = CursorXOffset;
|
||||
CursorXOffset = 0;
|
||||
}
|
||||
|
||||
if (y < 0)
|
||||
{
|
||||
if ((CursorYOffset = -y) > 63)
|
||||
CursorYOffset = 63;
|
||||
y = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
CursorYOffset = pScreenInfo->frameY1 - pScreenInfo->frameY0;
|
||||
if (y > CursorYOffset)
|
||||
y = CursorYOffset;
|
||||
CursorYOffset = 0;
|
||||
}
|
||||
|
||||
/* Adjust for multiscanned modes */
|
||||
if (pScreenInfo->currentMode->Flags & V_DBLSCAN)
|
||||
y *= 2;
|
||||
if (pScreenInfo->currentMode->VScan > 1)
|
||||
y *= pScreenInfo->currentMode->VScan;
|
||||
|
||||
do
|
||||
{
|
||||
if (CursorYOffset != pATI->CursorYOffset)
|
||||
{
|
||||
pATI->CursorYOffset = CursorYOffset;
|
||||
outr(CUR_OFFSET, ((CursorYOffset << 4) + pATI->CursorOffset) >> 3);
|
||||
}
|
||||
else if (CursorXOffset == pATI->CursorXOffset)
|
||||
break;
|
||||
|
||||
pATI->CursorXOffset = CursorXOffset;
|
||||
outr(CUR_HORZ_VERT_OFF, SetBits(CursorXOffset, CUR_HORZ_OFF) |
|
||||
SetBits(CursorYOffset, CUR_VERT_OFF));
|
||||
} while (0);
|
||||
|
||||
outr(CUR_HORZ_VERT_POSN,
|
||||
SetBits(x, CUR_HORZ_POSN) | SetBits(y, CUR_VERT_POSN));
|
||||
}
|
||||
|
||||
/*
|
||||
* ATIMach64LoadCursorImage --
|
||||
*
|
||||
* Copy hardware cursor image into offscreen video memory.
|
||||
*/
|
||||
static void
|
||||
ATIMach64LoadCursorImage
|
||||
(
|
||||
ScrnInfoPtr pScreenInfo,
|
||||
CARD8 *pImage
|
||||
)
|
||||
{
|
||||
ATIPtr pATI = ATIPTR(pScreenInfo);
|
||||
CARD32 *pSrc = (pointer)pImage;
|
||||
volatile CARD32 *pDst = pATI->pCursorImage;
|
||||
|
||||
/* Synchronise video memory accesses */
|
||||
ATIMach64Sync(pScreenInfo);
|
||||
|
||||
# if defined(ATIMove32)
|
||||
|
||||
{
|
||||
ATIMove32(pDst, pSrc, 256);
|
||||
}
|
||||
|
||||
# else
|
||||
|
||||
{
|
||||
/* This is lengthy, but it does maximise burst modes */
|
||||
pDst[ 0] = pSrc[ 0]; pDst[ 1] = pSrc[ 1];
|
||||
pDst[ 2] = pSrc[ 2]; pDst[ 3] = pSrc[ 3];
|
||||
pDst[ 4] = pSrc[ 4]; pDst[ 5] = pSrc[ 5];
|
||||
pDst[ 6] = pSrc[ 6]; pDst[ 7] = pSrc[ 7];
|
||||
pDst[ 8] = pSrc[ 8]; pDst[ 9] = pSrc[ 9];
|
||||
pDst[ 10] = pSrc[ 10]; pDst[ 11] = pSrc[ 11];
|
||||
pDst[ 12] = pSrc[ 12]; pDst[ 13] = pSrc[ 13];
|
||||
pDst[ 14] = pSrc[ 14]; pDst[ 15] = pSrc[ 15];
|
||||
pDst[ 16] = pSrc[ 16]; pDst[ 17] = pSrc[ 17];
|
||||
pDst[ 18] = pSrc[ 18]; pDst[ 19] = pSrc[ 19];
|
||||
pDst[ 20] = pSrc[ 20]; pDst[ 21] = pSrc[ 21];
|
||||
pDst[ 22] = pSrc[ 22]; pDst[ 23] = pSrc[ 23];
|
||||
pDst[ 24] = pSrc[ 24]; pDst[ 25] = pSrc[ 25];
|
||||
pDst[ 26] = pSrc[ 26]; pDst[ 27] = pSrc[ 27];
|
||||
pDst[ 28] = pSrc[ 28]; pDst[ 29] = pSrc[ 29];
|
||||
pDst[ 30] = pSrc[ 30]; pDst[ 31] = pSrc[ 31];
|
||||
pDst[ 32] = pSrc[ 32]; pDst[ 33] = pSrc[ 33];
|
||||
pDst[ 34] = pSrc[ 34]; pDst[ 35] = pSrc[ 35];
|
||||
pDst[ 36] = pSrc[ 36]; pDst[ 37] = pSrc[ 37];
|
||||
pDst[ 38] = pSrc[ 38]; pDst[ 39] = pSrc[ 39];
|
||||
pDst[ 40] = pSrc[ 40]; pDst[ 41] = pSrc[ 41];
|
||||
pDst[ 42] = pSrc[ 42]; pDst[ 43] = pSrc[ 43];
|
||||
pDst[ 44] = pSrc[ 44]; pDst[ 45] = pSrc[ 45];
|
||||
pDst[ 46] = pSrc[ 46]; pDst[ 47] = pSrc[ 47];
|
||||
pDst[ 48] = pSrc[ 48]; pDst[ 49] = pSrc[ 49];
|
||||
pDst[ 50] = pSrc[ 50]; pDst[ 51] = pSrc[ 51];
|
||||
pDst[ 52] = pSrc[ 52]; pDst[ 53] = pSrc[ 53];
|
||||
pDst[ 54] = pSrc[ 54]; pDst[ 55] = pSrc[ 55];
|
||||
pDst[ 56] = pSrc[ 56]; pDst[ 57] = pSrc[ 57];
|
||||
pDst[ 58] = pSrc[ 58]; pDst[ 59] = pSrc[ 59];
|
||||
pDst[ 60] = pSrc[ 60]; pDst[ 61] = pSrc[ 61];
|
||||
pDst[ 62] = pSrc[ 62]; pDst[ 63] = pSrc[ 63];
|
||||
pDst[ 64] = pSrc[ 64]; pDst[ 65] = pSrc[ 65];
|
||||
pDst[ 66] = pSrc[ 66]; pDst[ 67] = pSrc[ 67];
|
||||
pDst[ 68] = pSrc[ 68]; pDst[ 69] = pSrc[ 69];
|
||||
pDst[ 70] = pSrc[ 70]; pDst[ 71] = pSrc[ 71];
|
||||
pDst[ 72] = pSrc[ 72]; pDst[ 73] = pSrc[ 73];
|
||||
pDst[ 74] = pSrc[ 74]; pDst[ 75] = pSrc[ 75];
|
||||
pDst[ 76] = pSrc[ 76]; pDst[ 77] = pSrc[ 77];
|
||||
pDst[ 78] = pSrc[ 78]; pDst[ 79] = pSrc[ 79];
|
||||
pDst[ 80] = pSrc[ 80]; pDst[ 81] = pSrc[ 81];
|
||||
pDst[ 82] = pSrc[ 82]; pDst[ 83] = pSrc[ 83];
|
||||
pDst[ 84] = pSrc[ 84]; pDst[ 85] = pSrc[ 85];
|
||||
pDst[ 86] = pSrc[ 86]; pDst[ 87] = pSrc[ 87];
|
||||
pDst[ 88] = pSrc[ 88]; pDst[ 89] = pSrc[ 89];
|
||||
pDst[ 90] = pSrc[ 90]; pDst[ 91] = pSrc[ 91];
|
||||
pDst[ 92] = pSrc[ 92]; pDst[ 93] = pSrc[ 93];
|
||||
pDst[ 94] = pSrc[ 94]; pDst[ 95] = pSrc[ 95];
|
||||
pDst[ 96] = pSrc[ 96]; pDst[ 97] = pSrc[ 97];
|
||||
pDst[ 98] = pSrc[ 98]; pDst[ 99] = pSrc[ 99];
|
||||
pDst[100] = pSrc[100]; pDst[101] = pSrc[101];
|
||||
pDst[102] = pSrc[102]; pDst[103] = pSrc[103];
|
||||
pDst[104] = pSrc[104]; pDst[105] = pSrc[105];
|
||||
pDst[106] = pSrc[106]; pDst[107] = pSrc[107];
|
||||
pDst[108] = pSrc[108]; pDst[109] = pSrc[109];
|
||||
pDst[110] = pSrc[110]; pDst[111] = pSrc[111];
|
||||
pDst[112] = pSrc[112]; pDst[113] = pSrc[113];
|
||||
pDst[114] = pSrc[114]; pDst[115] = pSrc[115];
|
||||
pDst[116] = pSrc[116]; pDst[117] = pSrc[117];
|
||||
pDst[118] = pSrc[118]; pDst[119] = pSrc[119];
|
||||
pDst[120] = pSrc[120]; pDst[121] = pSrc[121];
|
||||
pDst[122] = pSrc[122]; pDst[123] = pSrc[123];
|
||||
pDst[124] = pSrc[124]; pDst[125] = pSrc[125];
|
||||
pDst[126] = pSrc[126]; pDst[127] = pSrc[127];
|
||||
pDst[128] = pSrc[128]; pDst[129] = pSrc[129];
|
||||
pDst[130] = pSrc[130]; pDst[131] = pSrc[131];
|
||||
pDst[132] = pSrc[132]; pDst[133] = pSrc[133];
|
||||
pDst[134] = pSrc[134]; pDst[135] = pSrc[135];
|
||||
pDst[136] = pSrc[136]; pDst[137] = pSrc[137];
|
||||
pDst[138] = pSrc[138]; pDst[139] = pSrc[139];
|
||||
pDst[140] = pSrc[140]; pDst[141] = pSrc[141];
|
||||
pDst[142] = pSrc[142]; pDst[143] = pSrc[143];
|
||||
pDst[144] = pSrc[144]; pDst[145] = pSrc[145];
|
||||
pDst[146] = pSrc[146]; pDst[147] = pSrc[147];
|
||||
pDst[148] = pSrc[148]; pDst[149] = pSrc[149];
|
||||
pDst[150] = pSrc[150]; pDst[151] = pSrc[151];
|
||||
pDst[152] = pSrc[152]; pDst[153] = pSrc[153];
|
||||
pDst[154] = pSrc[154]; pDst[155] = pSrc[155];
|
||||
pDst[156] = pSrc[156]; pDst[157] = pSrc[157];
|
||||
pDst[158] = pSrc[158]; pDst[159] = pSrc[159];
|
||||
pDst[160] = pSrc[160]; pDst[161] = pSrc[161];
|
||||
pDst[162] = pSrc[162]; pDst[163] = pSrc[163];
|
||||
pDst[164] = pSrc[164]; pDst[165] = pSrc[165];
|
||||
pDst[166] = pSrc[166]; pDst[167] = pSrc[167];
|
||||
pDst[168] = pSrc[168]; pDst[169] = pSrc[169];
|
||||
pDst[170] = pSrc[170]; pDst[171] = pSrc[171];
|
||||
pDst[172] = pSrc[172]; pDst[173] = pSrc[173];
|
||||
pDst[174] = pSrc[174]; pDst[175] = pSrc[175];
|
||||
pDst[176] = pSrc[176]; pDst[177] = pSrc[177];
|
||||
pDst[178] = pSrc[178]; pDst[179] = pSrc[179];
|
||||
pDst[180] = pSrc[180]; pDst[181] = pSrc[181];
|
||||
pDst[182] = pSrc[182]; pDst[183] = pSrc[183];
|
||||
pDst[184] = pSrc[184]; pDst[185] = pSrc[185];
|
||||
pDst[186] = pSrc[186]; pDst[187] = pSrc[187];
|
||||
pDst[188] = pSrc[188]; pDst[189] = pSrc[189];
|
||||
pDst[190] = pSrc[190]; pDst[191] = pSrc[191];
|
||||
pDst[192] = pSrc[192]; pDst[193] = pSrc[193];
|
||||
pDst[194] = pSrc[194]; pDst[195] = pSrc[195];
|
||||
pDst[196] = pSrc[196]; pDst[197] = pSrc[197];
|
||||
pDst[198] = pSrc[198]; pDst[199] = pSrc[199];
|
||||
pDst[200] = pSrc[200]; pDst[201] = pSrc[201];
|
||||
pDst[202] = pSrc[202]; pDst[203] = pSrc[203];
|
||||
pDst[204] = pSrc[204]; pDst[205] = pSrc[205];
|
||||
pDst[206] = pSrc[206]; pDst[207] = pSrc[207];
|
||||
pDst[208] = pSrc[208]; pDst[209] = pSrc[209];
|
||||
pDst[210] = pSrc[210]; pDst[211] = pSrc[211];
|
||||
pDst[212] = pSrc[212]; pDst[213] = pSrc[213];
|
||||
pDst[214] = pSrc[214]; pDst[215] = pSrc[215];
|
||||
pDst[216] = pSrc[216]; pDst[217] = pSrc[217];
|
||||
pDst[218] = pSrc[218]; pDst[219] = pSrc[219];
|
||||
pDst[220] = pSrc[220]; pDst[221] = pSrc[221];
|
||||
pDst[222] = pSrc[222]; pDst[223] = pSrc[223];
|
||||
pDst[224] = pSrc[224]; pDst[225] = pSrc[225];
|
||||
pDst[226] = pSrc[226]; pDst[227] = pSrc[227];
|
||||
pDst[228] = pSrc[228]; pDst[229] = pSrc[229];
|
||||
pDst[230] = pSrc[230]; pDst[231] = pSrc[231];
|
||||
pDst[232] = pSrc[232]; pDst[233] = pSrc[233];
|
||||
pDst[234] = pSrc[234]; pDst[235] = pSrc[235];
|
||||
pDst[236] = pSrc[236]; pDst[237] = pSrc[237];
|
||||
pDst[238] = pSrc[238]; pDst[239] = pSrc[239];
|
||||
pDst[240] = pSrc[240]; pDst[241] = pSrc[241];
|
||||
pDst[242] = pSrc[242]; pDst[243] = pSrc[243];
|
||||
pDst[244] = pSrc[244]; pDst[245] = pSrc[245];
|
||||
pDst[246] = pSrc[246]; pDst[247] = pSrc[247];
|
||||
pDst[248] = pSrc[248]; pDst[249] = pSrc[249];
|
||||
pDst[250] = pSrc[250]; pDst[251] = pSrc[251];
|
||||
pDst[252] = pSrc[252]; pDst[253] = pSrc[253];
|
||||
pDst[254] = pSrc[254]; pDst[255] = pSrc[255];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* ATIMach64HideCursor --
|
||||
*
|
||||
* Turn off hardware cursor.
|
||||
*/
|
||||
static void
|
||||
ATIMach64HideCursor
|
||||
(
|
||||
ScrnInfoPtr pScreenInfo
|
||||
)
|
||||
{
|
||||
ATIPtr pATI = ATIPTR(pScreenInfo);
|
||||
|
||||
if (!(pATI->NewHW.gen_test_cntl & GEN_CUR_EN))
|
||||
return;
|
||||
|
||||
pATI->NewHW.gen_test_cntl &= ~GEN_CUR_EN;
|
||||
out8(GEN_TEST_CNTL, GetByte(pATI->NewHW.gen_test_cntl, 0));
|
||||
}
|
||||
|
||||
/*
|
||||
* ATIMach64ShowCursor --
|
||||
*
|
||||
* Turn on hardware cursor.
|
||||
*/
|
||||
static void
|
||||
ATIMach64ShowCursor
|
||||
(
|
||||
ScrnInfoPtr pScreenInfo
|
||||
)
|
||||
{
|
||||
ATIPtr pATI = ATIPTR(pScreenInfo);
|
||||
|
||||
if (pATI->NewHW.gen_test_cntl & GEN_CUR_EN)
|
||||
return;
|
||||
|
||||
pATI->NewHW.gen_test_cntl |= GEN_CUR_EN;
|
||||
out8(GEN_TEST_CNTL, GetByte(pATI->NewHW.gen_test_cntl, 0));
|
||||
}
|
||||
|
||||
/*
|
||||
* ATIMach64UseHWCursor --
|
||||
*
|
||||
* Notify cursor layer whether a hardware cursor is configured.
|
||||
*/
|
||||
static Bool
|
||||
ATIMach64UseHWCursor
|
||||
(
|
||||
ScreenPtr pScreen,
|
||||
CursorPtr pCursor
|
||||
)
|
||||
{
|
||||
ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum];
|
||||
ATIPtr pATI = ATIPTR(pScreenInfo);
|
||||
|
||||
if (!pATI->CursorBase)
|
||||
return FALSE;
|
||||
|
||||
#ifndef AVOID_CPIO
|
||||
|
||||
/*
|
||||
* For some reason, the hardware cursor isn't vertically scaled when a VGA
|
||||
* doublescanned or multiscanned mode is in effect.
|
||||
*/
|
||||
if (pATI->NewHW.crtc == ATI_CRTC_MACH64)
|
||||
return TRUE;
|
||||
if ((pScreenInfo->currentMode->Flags & V_DBLSCAN) ||
|
||||
(pScreenInfo->currentMode->VScan > 1))
|
||||
return FALSE;
|
||||
|
||||
#endif /* AVOID_CPIO */
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* ATIMach64CursorInit --
|
||||
*
|
||||
* Initialise xf86CursorInfoRec fields with information specific to Mach64
|
||||
* variants.
|
||||
*/
|
||||
Bool
|
||||
ATIMach64CursorInit
|
||||
(
|
||||
xf86CursorInfoPtr pCursorInfo
|
||||
)
|
||||
{
|
||||
/*
|
||||
* For Mach64 variants, toggling hardware cursors off and on causes display
|
||||
* artifacts. Ask the cursor support layers to always paint the cursor
|
||||
* (whether or not it is entirely transparent) and to not hide the cursor
|
||||
* when reloading its image. The two remaining reasons for turning off the
|
||||
* hardware cursor are when it moves to a different screen or on a switch
|
||||
* to a different virtual console.
|
||||
*/
|
||||
pCursorInfo->Flags = HARDWARE_CURSOR_TRUECOLOR_AT_8BPP |
|
||||
HARDWARE_CURSOR_INVERT_MASK |
|
||||
HARDWARE_CURSOR_SHOW_TRANSPARENT |
|
||||
HARDWARE_CURSOR_UPDATE_UNHIDDEN |
|
||||
HARDWARE_CURSOR_AND_SOURCE_WITH_MASK |
|
||||
|
||||
#if X_BYTE_ORDER != X_LITTLE_ENDIAN
|
||||
|
||||
HARDWARE_CURSOR_BIT_ORDER_MSBFIRST |
|
||||
|
||||
#endif /* X_BYTE_ORDER */
|
||||
|
||||
HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1;
|
||||
pCursorInfo->MaxWidth = pCursorInfo->MaxHeight = 64;
|
||||
|
||||
pCursorInfo->SetCursorColors = ATIMach64SetCursorColours;
|
||||
pCursorInfo->SetCursorPosition = ATIMach64SetCursorPosition;
|
||||
pCursorInfo->LoadCursorImage = ATIMach64LoadCursorImage;
|
||||
pCursorInfo->HideCursor = ATIMach64HideCursor;
|
||||
pCursorInfo->ShowCursor = ATIMach64ShowCursor;
|
||||
pCursorInfo->UseHWCursor = ATIMach64UseHWCursor;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
33
src/atimach64cursor.h
Normal file
33
src/atimach64cursor.h
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64cursor.h,v 1.1 2003/04/23 21:51:29 tsi Exp $ */
|
||||
/*
|
||||
* Copyright 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting documentation, and
|
||||
* that the name of Marc Aurele La France not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. Marc Aurele La France makes no representations
|
||||
* about the suitability of this software for any purpose. It is provided
|
||||
* "as-is" without express or implied warranty.
|
||||
*
|
||||
* MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
|
||||
* EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef ___ATIMACH64CURSOR_H___
|
||||
#define ___ATIMACH64CURSOR_H___ 1
|
||||
|
||||
#include "atiproto.h"
|
||||
|
||||
#include "xf86Cursor.h"
|
||||
|
||||
extern Bool ATIMach64CursorInit FunctionPrototype((xf86CursorInfoPtr));
|
||||
|
||||
#endif /* ___ATIMACH64CURSOR_H___ */
|
||||
466
src/atimach64i2c.c
Normal file
466
src/atimach64i2c.c
Normal file
|
|
@ -0,0 +1,466 @@
|
|||
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64i2c.c,v 1.1 2003/07/24 22:08:28 tsi Exp $ */
|
||||
/*
|
||||
* Copyright 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting documentation, and
|
||||
* that the name of Marc Aurele La France not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. Marc Aurele La France makes no representations
|
||||
* about the suitability of this software for any purpose. It is provided
|
||||
* "as-is" without express or implied warranty.
|
||||
*
|
||||
* MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
|
||||
* EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "ati.h"
|
||||
#include "atichip.h"
|
||||
#include "atii2c.h"
|
||||
#include "atimach64i2c.h"
|
||||
#include "atimach64io.h"
|
||||
#include "atituner.h"
|
||||
|
||||
/* MPP_CONFIG register values */
|
||||
#define MPP_INIT pATI->NewHW.mpp_config
|
||||
|
||||
#define MPP_WRITE (MPP_INIT )
|
||||
#define MPP_WRITEINC (MPP_INIT | (MPP_AUTO_INC_EN ))
|
||||
#define MPP_READ (MPP_INIT | ( MPP_BUFFER_MODE_PREFETCH))
|
||||
#define MPP_READINC (MPP_INIT | (MPP_AUTO_INC_EN | MPP_BUFFER_MODE_PREFETCH))
|
||||
|
||||
/*
|
||||
* ATIMach64MPPWaitForIdle --
|
||||
*
|
||||
* Support function to wait for the Multimedia Peripheral Port to become idle.
|
||||
* Currently, this function's return value indicates whether or not the port
|
||||
* became idle within 512 polling iterations. For now, this value is ignored
|
||||
* by the rest of the code, but might be used in the future.
|
||||
*/
|
||||
static Bool
|
||||
ATIMach64MPPWaitForIdle
|
||||
(
|
||||
ATIPtr pATI
|
||||
)
|
||||
{
|
||||
CARD32 Count = 0x0200;
|
||||
|
||||
while (in8(MPP_CONFIG + 3) & GetByte(MPP_BUSY, 3))
|
||||
{
|
||||
if (!--Count)
|
||||
return FALSE;
|
||||
usleep(1); /* XXX Excessive? */
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* ATIMach64MPPSetAddress --
|
||||
*
|
||||
* Sets a 16-bit ImpacTV address on the Multimedia Peripheral Port.
|
||||
*/
|
||||
static void
|
||||
ATIMach64MPPSetAddress
|
||||
(
|
||||
ATIPtr pATI,
|
||||
CARD16 Address
|
||||
)
|
||||
{
|
||||
ATIMach64MPPWaitForIdle(pATI);
|
||||
outr(MPP_CONFIG, MPP_WRITEINC);
|
||||
outr(MPP_ADDR, 0x00000008U);
|
||||
out8(MPP_DATA, (CARD8)Address);
|
||||
ATIMach64MPPWaitForIdle(pATI);
|
||||
out8(MPP_DATA, (CARD8)(Address >> 8));
|
||||
ATIMach64MPPWaitForIdle(pATI);
|
||||
outr(MPP_CONFIG, MPP_WRITE);
|
||||
outr(MPP_ADDR, 0x00000018U);
|
||||
ATIMach64MPPWaitForIdle(pATI);
|
||||
}
|
||||
|
||||
/*
|
||||
* ATIMach64ImpacTVProbe --
|
||||
*
|
||||
* This probes for an ImpacTV chip and returns its chip ID, or 0.
|
||||
*/
|
||||
static int
|
||||
ATIMach64ImpacTVProbe
|
||||
(
|
||||
int iScreen,
|
||||
ATIPtr pATI
|
||||
)
|
||||
{
|
||||
CARD8 ChipID = 0;
|
||||
|
||||
/* Assume ATIModePreInit() has already been called */
|
||||
outr(MPP_STROBE_SEQ, pATI->NewHW.mpp_strobe_seq);
|
||||
outr(TVO_CNTL, pATI->NewHW.tvo_cntl);
|
||||
|
||||
outr(MPP_CONFIG, MPP_READ);
|
||||
ATIMach64MPPWaitForIdle(pATI);
|
||||
outr(MPP_ADDR, 0x0000000AU);
|
||||
if (!(ChipID = in8(MPP_DATA)))
|
||||
{
|
||||
ATIMach64MPPWaitForIdle(pATI);
|
||||
outr(MPP_ADDR, 0x00000023U);
|
||||
if ((ChipID = in8(MPP_DATA)) != 0x54U)
|
||||
{
|
||||
ATIMach64MPPWaitForIdle(pATI);
|
||||
outr(MPP_ADDR, 0x0000000BU);
|
||||
ChipID = in8(MPP_DATA);
|
||||
}
|
||||
}
|
||||
ATIMach64MPPWaitForIdle(pATI);
|
||||
outr(MPP_CONFIG, MPP_WRITE);
|
||||
|
||||
if (ChipID)
|
||||
xf86DrvMsg(iScreen, X_PROBED, "ImpacTV chip ID 0x%02X detected.\n",
|
||||
ChipID);
|
||||
|
||||
return (int)(CARD16)ChipID;
|
||||
}
|
||||
|
||||
/*
|
||||
* ATIMach64ImpacTVSetBits --
|
||||
*
|
||||
* Controls I2C SDA and SCL lines through ImpacTV.
|
||||
*/
|
||||
static void
|
||||
ATIMach64ImpacTVSetBits
|
||||
(
|
||||
ATII2CPtr pATII2C,
|
||||
ATIPtr pATI,
|
||||
CARD32 Bits
|
||||
)
|
||||
{
|
||||
pATII2C->I2CCur = Bits;
|
||||
|
||||
ATIMach64MPPSetAddress(pATI, IT_I2C_CNTL);
|
||||
|
||||
outr(MPP_CONFIG, MPP_WRITE);
|
||||
|
||||
out8(MPP_DATA, (CARD8)Bits);
|
||||
|
||||
ATIMach64MPPWaitForIdle(pATI);
|
||||
}
|
||||
|
||||
/*
|
||||
* ATIMach64ImpacTVGetBits --
|
||||
*
|
||||
* Returns the status of an ImpacTV's I2C control lines.
|
||||
*/
|
||||
static CARD32
|
||||
ATIMach64ImpacTVGetBits
|
||||
(
|
||||
ATIPtr pATI
|
||||
)
|
||||
{
|
||||
ATIMach64MPPSetAddress(pATI, IT_I2C_CNTL);
|
||||
|
||||
outr(MPP_CONFIG, MPP_READ);
|
||||
|
||||
ATIMach64MPPWaitForIdle(pATI);
|
||||
|
||||
return in8(MPP_DATA);
|
||||
}
|
||||
|
||||
/*
|
||||
* ATIMach64I2C_CNTLSetBits --
|
||||
*
|
||||
* Controls SDA and SCL lines through a 3D Rage Pro's hardware assisted I2C.
|
||||
*/
|
||||
static void
|
||||
ATIMach64I2C_CNTLSetBits
|
||||
(
|
||||
ATII2CPtr pATII2C,
|
||||
ATIPtr pATI,
|
||||
CARD32 Bits
|
||||
)
|
||||
{
|
||||
pATII2C->I2CCur = Bits;
|
||||
|
||||
out8(I2C_CNTL_0 + 1, (CARD8)Bits);
|
||||
}
|
||||
|
||||
/*
|
||||
* ATIMach64I2C_CNTLGetBits --
|
||||
*
|
||||
* Returns the status of a 3D Rage Pro's hardware assisted I2C control lines.
|
||||
*/
|
||||
static CARD32
|
||||
ATIMach64I2C_CNTLGetBits
|
||||
(
|
||||
ATIPtr pATI
|
||||
)
|
||||
{
|
||||
return in8(I2C_CNTL_0 + 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* ATIMach64GP_IOSetBits --
|
||||
*
|
||||
* Controls SDA and SCL control lines through a Mach64's GP_IO register.
|
||||
*/
|
||||
static void
|
||||
ATIMach64GP_IOSetBits
|
||||
(
|
||||
ATII2CPtr pATII2C,
|
||||
ATIPtr pATI,
|
||||
CARD32 Bits
|
||||
)
|
||||
{
|
||||
pATII2C->I2CCur = Bits;
|
||||
|
||||
outr(GP_IO, Bits);
|
||||
}
|
||||
|
||||
/*
|
||||
* ATIMach64GP_IOGetBits --
|
||||
*
|
||||
* Returns the status of I2C control lines through a Mach64's GP_IO register.
|
||||
*/
|
||||
static CARD32
|
||||
ATIMach64GP_IOGetBits
|
||||
(
|
||||
ATIPtr pATI
|
||||
)
|
||||
{
|
||||
return inr(GP_IO);
|
||||
}
|
||||
|
||||
#define GPIO1_MASK \
|
||||
(DAC_GIO_STATE_1 | DAC_GIO_DIR_1)
|
||||
#define GPIO2_MASK \
|
||||
(GEN_GIO2_DATA_OUT | GEN_GIO2_DATA_IN | GEN_GIO2_WRITE)
|
||||
|
||||
/*
|
||||
* ATIMach64DAC_GENSetBits --
|
||||
*
|
||||
* Controls SDA and SCL control lines through a Mach64's GEN_TEST_CNTL and
|
||||
* DAC_CNTL registers.
|
||||
*/
|
||||
static void
|
||||
ATIMach64DAC_GENSetBits
|
||||
(
|
||||
ATII2CPtr pATII2C,
|
||||
ATIPtr pATI,
|
||||
CARD32 Bits
|
||||
)
|
||||
{
|
||||
CARD32 tmp;
|
||||
|
||||
pATII2C->I2CCur = Bits;
|
||||
|
||||
tmp = inr(DAC_CNTL) & ~GPIO1_MASK;
|
||||
outr(DAC_CNTL, tmp | (Bits & GPIO1_MASK));
|
||||
tmp = inr(GEN_TEST_CNTL) & ~GPIO2_MASK;
|
||||
outr(GEN_TEST_CNTL, tmp | (Bits & GPIO2_MASK));
|
||||
}
|
||||
|
||||
/*
|
||||
* ATIMach64DAC_GENGetBits --
|
||||
*
|
||||
* Returns the status of I2C control lines through a Mach64's GEN_TEST_CNTL and
|
||||
* DAC_CNTL registers.
|
||||
*/
|
||||
static CARD32
|
||||
ATIMach64DAC_GENGetBits
|
||||
(
|
||||
ATIPtr pATI
|
||||
)
|
||||
{
|
||||
return (inr(DAC_CNTL) & GPIO1_MASK) | (inr(GEN_TEST_CNTL) & GPIO2_MASK);
|
||||
}
|
||||
|
||||
/*
|
||||
* ATITVAddOnProbe --
|
||||
*
|
||||
* Probe for an ATI-TV add-on card at specific addresses on an I2C bus.
|
||||
*/
|
||||
static Bool
|
||||
ATITVAddOnProbe
|
||||
(
|
||||
ScrnInfoPtr pScreenInfo,
|
||||
ATIPtr pATI,
|
||||
I2CBusPtr pI2CBus
|
||||
)
|
||||
{
|
||||
I2CDevPtr pI2CDev = xnfcalloc(1, SizeOf(I2CDevRec));
|
||||
int Index;
|
||||
I2CByte tmp;
|
||||
|
||||
static const CARD8 ATITVAddOnAddresses[] = {0x70, 0x40, 0x78, 0x72, 0x42};
|
||||
|
||||
pI2CDev->DevName = "ATI-TV Add-on";
|
||||
pI2CDev->pI2CBus = pI2CBus;
|
||||
pI2CDev->StartTimeout = pI2CBus->StartTimeout;
|
||||
pI2CDev->BitTimeout = pI2CBus->BitTimeout;
|
||||
pI2CDev->AcknTimeout = pI2CBus->AcknTimeout;
|
||||
pI2CDev->ByteTimeout = pI2CBus->ByteTimeout;
|
||||
|
||||
for (Index = 0; Index < NumberOf(ATITVAddOnAddresses); Index++)
|
||||
{
|
||||
pI2CDev->SlaveAddr = ATITVAddOnAddresses[Index];
|
||||
|
||||
if (xf86I2CFindDev(pI2CBus, pI2CDev->SlaveAddr))
|
||||
continue;
|
||||
|
||||
tmp = 0xFFU;
|
||||
|
||||
if (!(*pI2CBus->I2CWriteRead)(pI2CDev, &tmp, 1, NULL, 0) ||
|
||||
!(*pI2CBus->I2CWriteRead)(pI2CDev, NULL, 0, &tmp, 1) ||
|
||||
(tmp == 0xFFU) || ((tmp = tmp & 0x1FU) == /*ATI_TUNER_NONE*/0))
|
||||
continue;
|
||||
|
||||
if (!xf86I2CDevInit(pI2CDev))
|
||||
{
|
||||
xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING,
|
||||
"Failed to register I2C device for ATI-TV add-on.\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if (pATI->Tuner != tmp)
|
||||
{
|
||||
if (pATI->Tuner != ATI_TUNER_NONE)
|
||||
xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING,
|
||||
"Tuner type mismatch: BIOS 0x%x, ATI-TV 0x%x.\n",
|
||||
pATI->Tuner, tmp);
|
||||
|
||||
pATI->Tuner = tmp;
|
||||
}
|
||||
|
||||
xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED,
|
||||
"%s tuner detected on ATI-TV add-on adapter at I2C bus address"
|
||||
" 0x%2x.\n", ATITuners[pATI->Tuner].name, pI2CDev->SlaveAddr);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
xfree(pI2CDev);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* ATIMach64I2CPreInit --
|
||||
*
|
||||
* This function potentially allocates an I2CBusRec and initialises it with
|
||||
* ATI-specific and Mach64-specific information.
|
||||
*/
|
||||
void
|
||||
ATIMach64I2CPreInit
|
||||
(
|
||||
ScrnInfoPtr pScreenInfo,
|
||||
ATIPtr pATI
|
||||
)
|
||||
{
|
||||
I2CBusPtr pI2CBus;
|
||||
ATII2CPtr pATII2C;
|
||||
|
||||
if ((pATI->Chip < ATI_CHIP_264CT) || (pATI->Chip >= ATI_CHIP_Mach64))
|
||||
return;
|
||||
|
||||
/* Create an I2CBusRec and generically prime it */
|
||||
if (!(pI2CBus = ATICreateI2CBusRec(pScreenInfo->scrnIndex, pATI, "Mach64")))
|
||||
return;
|
||||
|
||||
pATII2C = pI2CBus->DriverPrivate.ptr;
|
||||
|
||||
switch (pATI->Chip)
|
||||
{
|
||||
case ATI_CHIP_264GTPRO:
|
||||
case ATI_CHIP_264LTPRO:
|
||||
case ATI_CHIP_264XL:
|
||||
case ATI_CHIP_MOBILITY:
|
||||
/*
|
||||
* These have I2C-specific registers. Assume older I2C access
|
||||
* mechanisms are inoperative.
|
||||
*/
|
||||
pATII2C->I2CSetBits = ATIMach64I2C_CNTLSetBits;
|
||||
pATII2C->I2CGetBits = ATIMach64I2C_CNTLGetBits;
|
||||
pATII2C->SCLDir = pATII2C->SDADir = 0;
|
||||
pATII2C->SCLGet = pATII2C->SCLSet = GetByte(I2C_CNTL_SCL, 1);
|
||||
pATII2C->SDAGet = pATII2C->SDASet = GetByte(I2C_CNTL_SDA, 1);
|
||||
|
||||
out8(I2C_CNTL_1 + 2, GetByte(I2C_SEL, 2));
|
||||
out8(I2C_CNTL_0 + 0,
|
||||
GetByte(I2C_CNTL_STAT | I2C_CNTL_HPTR_RST, 0));
|
||||
break;
|
||||
|
||||
case ATI_CHIP_264VTB:
|
||||
case ATI_CHIP_264GTB:
|
||||
case ATI_CHIP_264VT3:
|
||||
case ATI_CHIP_264GTDVD:
|
||||
case ATI_CHIP_264LT:
|
||||
case ATI_CHIP_264VT4:
|
||||
case ATI_CHIP_264GT2C:
|
||||
/* If an ImpacTV chip is found, use it to provide I2C access */
|
||||
if (ATIMach64ImpacTVProbe(pScreenInfo->scrnIndex, pATI))
|
||||
{
|
||||
pATII2C->I2CSetBits = ATIMach64ImpacTVSetBits;
|
||||
pATII2C->I2CGetBits = ATIMach64ImpacTVGetBits;
|
||||
pATII2C->SCLDir = IT_SCL_DIR;
|
||||
pATII2C->SCLGet = IT_SCL_GET;
|
||||
pATII2C->SCLSet = IT_SCL_SET;
|
||||
pATII2C->SDADir = IT_SDA_DIR;
|
||||
pATII2C->SDAGet = IT_SDA_GET;
|
||||
pATII2C->SDASet = IT_SDA_SET;
|
||||
|
||||
ATIMach64MPPSetAddress(pATI, IT_I2C_CNTL);
|
||||
outr(MPP_CONFIG, MPP_WRITEINC);
|
||||
out8(MPP_DATA, 0x00U);
|
||||
out8(MPP_DATA, 0x55U);
|
||||
out8(MPP_DATA, 0x00U);
|
||||
out8(MPP_DATA, 0x00U);
|
||||
ATIMach64MPPWaitForIdle(pATI);
|
||||
break;
|
||||
}
|
||||
/* Otherwise, fall through to the older case */
|
||||
|
||||
case ATI_CHIP_264VT:
|
||||
case ATI_CHIP_264GT:
|
||||
/* First try GIO pins 11 (clock) and 4 (data) */
|
||||
pATII2C->I2CSetBits = ATIMach64GP_IOSetBits;
|
||||
pATII2C->I2CGetBits = ATIMach64GP_IOGetBits;
|
||||
pATII2C->SCLDir = GP_IO_DIR_B;
|
||||
pATII2C->SCLGet = pATII2C->SCLSet = GP_IO_B;
|
||||
pATII2C->SDADir = GP_IO_DIR_4;
|
||||
pATII2C->SDAGet = pATII2C->SDASet = GP_IO_4;
|
||||
|
||||
if (ATITVAddOnProbe(pScreenInfo, pATI, pI2CBus))
|
||||
break;
|
||||
|
||||
/* Next, try pins 10 (clock) and 12 (data) */
|
||||
pATII2C->SCLDir = GP_IO_DIR_A;
|
||||
pATII2C->SCLGet = pATII2C->SCLSet = GP_IO_A;
|
||||
pATII2C->SDADir = GP_IO_DIR_C;
|
||||
pATII2C->SDAGet = pATII2C->SDASet = GP_IO_C;
|
||||
|
||||
if (ATITVAddOnProbe(pScreenInfo, pATI, pI2CBus))
|
||||
break;
|
||||
/* Otherwise, fall back to ATI's first I2C implementation */
|
||||
|
||||
default:
|
||||
/*
|
||||
* First generation integrated controllers access GIO pin 1 (clock)
|
||||
* though DAC_CNTL, and pin 2 (data) through GEN_TEST_CNTL.
|
||||
*/
|
||||
pATII2C->I2CSetBits = ATIMach64DAC_GENSetBits;
|
||||
pATII2C->I2CGetBits = ATIMach64DAC_GENGetBits;
|
||||
pATII2C->SCLDir = DAC_GIO_DIR_1;
|
||||
pATII2C->SCLGet = pATII2C->SCLSet = DAC_GIO_STATE_1;
|
||||
pATII2C->SDADir = GEN_GIO2_WRITE;
|
||||
pATII2C->SDAGet = GEN_GIO2_DATA_IN;
|
||||
pATII2C->SDASet = GEN_GIO2_DATA_OUT;
|
||||
|
||||
(void)ATITVAddOnProbe(pScreenInfo, pATI, pI2CBus);
|
||||
break;
|
||||
}
|
||||
}
|
||||
34
src/atimach64i2c.h
Normal file
34
src/atimach64i2c.h
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64i2c.h,v 1.1 2003/07/24 22:08:28 tsi Exp $ */
|
||||
/*
|
||||
* Copyright 1997 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting documentation, and
|
||||
* that the name of Marc Aurele La France not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. Marc Aurele La France makes no representations
|
||||
* about the suitability of this software for any purpose. It is provided
|
||||
* "as-is" without express or implied warranty.
|
||||
*
|
||||
* MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
|
||||
* EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef ___ATIMACH64I2C_H___
|
||||
#define ___ATIMACH64I2C_H___ 1
|
||||
|
||||
#include "atipriv.h"
|
||||
#include "atiproto.h"
|
||||
|
||||
#include "xf86str.h"
|
||||
|
||||
extern void ATIMach64I2CPreInit FunctionPrototype((ScrnInfoPtr, ATIPtr));
|
||||
|
||||
#endif /* ___ATIMACH64I2C_H___ */
|
||||
1493
src/atimach64xv.c
Normal file
1493
src/atimach64xv.c
Normal file
File diff suppressed because it is too large
Load diff
40
src/atimach64xv.h
Normal file
40
src/atimach64xv.h
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64xv.h,v 1.1 2003/04/23 21:51:29 tsi Exp $ */
|
||||
/*
|
||||
* Copyright 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting documentation, and
|
||||
* that the name of Marc Aurele La France not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. Marc Aurele La France makes no representations
|
||||
* about the suitability of this software for any purpose. It is provided
|
||||
* "as-is" without express or implied warranty.
|
||||
*
|
||||
* MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
|
||||
* EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef ___ATIMACH64XV_H___
|
||||
#define ___ATIMACH64XV_H___ 1
|
||||
|
||||
#include "atipriv.h"
|
||||
#include "atiproto.h"
|
||||
|
||||
#include "xf86str.h"
|
||||
#include "xf86xv.h"
|
||||
|
||||
extern int ATIMach64XVInitialiseAdaptor
|
||||
FunctionPrototype((ScreenPtr, ScrnInfoPtr, ATIPtr,
|
||||
XF86VideoAdaptorPtr **));
|
||||
|
||||
extern void ATIMach64CloseXVideo
|
||||
FunctionPrototype((ScreenPtr, ScrnInfoPtr, ATIPtr));
|
||||
|
||||
#endif /* ___ATIMACH64XV_H___ */
|
||||
174
src/atituner.c
Normal file
174
src/atituner.c
Normal file
|
|
@ -0,0 +1,174 @@
|
|||
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atituner.c,v 1.1 2003/07/24 22:08:28 tsi Exp $ */
|
||||
/*
|
||||
* Copyright 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting documentation, and
|
||||
* that the name of Marc Aurele La France not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. Marc Aurele La France makes no representations
|
||||
* about the suitability of this software for any purpose. It is provided
|
||||
* "as-is" without express or implied warranty.
|
||||
*
|
||||
* MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
|
||||
* EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "atituner.h"
|
||||
|
||||
/* Temporary interface glitch */
|
||||
#if 0
|
||||
# include "fi12x6.h"
|
||||
#else
|
||||
typedef enum {
|
||||
FI12x6_TYPE_UNKNOWN = -1,
|
||||
FI12x6_TYPE_FI1236 = 0,
|
||||
FI12x6_TYPE_FI1216,
|
||||
FI12x6_TYPE_FI1216MF,
|
||||
FI12x6_TYPE_TEMIC_FN5AL,
|
||||
FI12x6_TYPE_MT2032,
|
||||
FI12x6_TYPE_MAX /* Must be last */
|
||||
} FI12x6TunerType;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* TV tuner definitions.
|
||||
*/
|
||||
const SymTabRec ATITuners[] =
|
||||
{
|
||||
{
|
||||
FI12x6_TYPE_UNKNOWN,
|
||||
"No tuner"
|
||||
},
|
||||
{
|
||||
FI12x6_TYPE_FI1236,
|
||||
"Philips FI1236 MK1 NTSC M/N North America"
|
||||
},
|
||||
{
|
||||
FI12x6_TYPE_FI1236,
|
||||
"Philips FI1236 MK2 NTSC M/N Japan"
|
||||
},
|
||||
{
|
||||
FI12x6_TYPE_FI1216,
|
||||
"Philips FI1216 MK2 PAL B/G"
|
||||
},
|
||||
{
|
||||
FI12x6_TYPE_UNKNOWN,
|
||||
"Philips FI1246 MK2 PAL I"
|
||||
},
|
||||
{
|
||||
FI12x6_TYPE_FI1216MF,
|
||||
"Philips FI1216 MF MK2 PAL B/G, SECAM L/L"
|
||||
},
|
||||
{
|
||||
FI12x6_TYPE_FI1236,
|
||||
"Philips FI1236 MK2 NTSC M/N North America"
|
||||
},
|
||||
{
|
||||
FI12x6_TYPE_UNKNOWN,
|
||||
"Philips FI1256 MK2 SECAM D/K"
|
||||
},
|
||||
{
|
||||
FI12x6_TYPE_FI1236,
|
||||
"Philips FM1236 MK2 NTSC M/N North America"
|
||||
},
|
||||
{
|
||||
FI12x6_TYPE_FI1216,
|
||||
"Philips FI1216 MK2 PAL B/G - External Tuner POD"
|
||||
},
|
||||
{
|
||||
FI12x6_TYPE_UNKNOWN,
|
||||
"Philips FI1246 MK2 PAL I - External Tuner POD"
|
||||
},
|
||||
{
|
||||
FI12x6_TYPE_FI1216MF,
|
||||
"Philips FI1216 MF MK2 PAL B/G, SECAM L/L - External Tuner POD"
|
||||
},
|
||||
{
|
||||
FI12x6_TYPE_FI1236,
|
||||
"Philips FI1236 MK2 NTSC M/N North America - External Tuner POD"
|
||||
},
|
||||
{
|
||||
FI12x6_TYPE_TEMIC_FN5AL,
|
||||
"Temic FN5AL.RF3X7595 PAL I/B/G/DK & SECAM DK"
|
||||
},
|
||||
{
|
||||
FI12x6_TYPE_FI1216MF,
|
||||
"Philips FQ1216 ME/P"
|
||||
},
|
||||
{
|
||||
FI12x6_TYPE_UNKNOWN,
|
||||
"Unknown type (15)"
|
||||
},
|
||||
{
|
||||
FI12x6_TYPE_UNKNOWN,
|
||||
"Alps TSBH5 NTSC M/N North America"
|
||||
},
|
||||
{
|
||||
FI12x6_TYPE_UNKNOWN,
|
||||
"Alps TSC?? NTSC M/N North America"
|
||||
},
|
||||
{
|
||||
FI12x6_TYPE_UNKNOWN,
|
||||
"Alps TSCH5 NTSC M/N North America with FM"
|
||||
},
|
||||
{
|
||||
FI12x6_TYPE_UNKNOWN,
|
||||
"Unknown type (19)"
|
||||
},
|
||||
{
|
||||
FI12x6_TYPE_UNKNOWN,
|
||||
"Unknown type (20)"
|
||||
},
|
||||
{
|
||||
FI12x6_TYPE_UNKNOWN,
|
||||
"Unknown type (21)"
|
||||
},
|
||||
{
|
||||
FI12x6_TYPE_UNKNOWN,
|
||||
"Unknown type (22)"
|
||||
},
|
||||
{
|
||||
FI12x6_TYPE_UNKNOWN,
|
||||
"Unknown type (23)"
|
||||
},
|
||||
{
|
||||
FI12x6_TYPE_UNKNOWN,
|
||||
"Unknown type (24)"
|
||||
},
|
||||
{
|
||||
FI12x6_TYPE_UNKNOWN,
|
||||
"Unknown type (25)"
|
||||
},
|
||||
{
|
||||
FI12x6_TYPE_UNKNOWN,
|
||||
"Unknown type (26)"
|
||||
},
|
||||
{
|
||||
FI12x6_TYPE_UNKNOWN,
|
||||
"Unknown type (27)"
|
||||
},
|
||||
{
|
||||
FI12x6_TYPE_UNKNOWN,
|
||||
"Unknown type (28)"
|
||||
},
|
||||
{
|
||||
FI12x6_TYPE_MT2032,
|
||||
"Microtune MT2032"
|
||||
},
|
||||
{
|
||||
FI12x6_TYPE_UNKNOWN,
|
||||
"Unknown type (30)"
|
||||
},
|
||||
{
|
||||
FI12x6_TYPE_UNKNOWN,
|
||||
"Unknown type (31)"
|
||||
}
|
||||
};
|
||||
70
src/atituner.h
Normal file
70
src/atituner.h
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atituner.h,v 1.1 2003/07/24 22:08:28 tsi Exp $ */
|
||||
/*
|
||||
* Copyright 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting documentation, and
|
||||
* that the name of Marc Aurele La France not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. Marc Aurele La France makes no representations
|
||||
* about the suitability of this software for any purpose. It is provided
|
||||
* "as-is" without express or implied warranty.
|
||||
*
|
||||
* MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
|
||||
* EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef ___ATITUNER_H___
|
||||
#define ___ATITUNER_H___ 1
|
||||
|
||||
#include "xf86str.h"
|
||||
|
||||
/*
|
||||
* TV Tuner definitions. Most of these are from Philips.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
ATI_TUNER_NONE,
|
||||
ATI_TUNER_FI1236MK1NA,
|
||||
ATI_TUNER_FI1236MK2J,
|
||||
ATI_TUNER_FI1216MK2BG,
|
||||
ATI_TUNER_FI1246MK2I,
|
||||
ATI_TUNER_FI1216MFMK2,
|
||||
ATI_TUNER_FI1236MK2NA,
|
||||
ATI_TUNER_FI1256MK2DK,
|
||||
ATI_TUNER_FM1236MK2NA,
|
||||
ATI_TUNER_FI1216MK2BGEXT,
|
||||
ATI_TUNER_FI1246MK2IEXT,
|
||||
ATI_TUNER_FI1216MFMK2EXT,
|
||||
ATI_TUNER_FI1236MK2NAEXT,
|
||||
ATI_TUNER_TEMIC_FN5AL,
|
||||
ATI_TUNER_FQ1216MEP,
|
||||
ATI_TUNER_15,
|
||||
ATI_TUNER_ALPS_TSBH5,
|
||||
ATI_TUNER_ALPS_TSCXX,
|
||||
ATI_TUNER_ALPS_TSCH5,
|
||||
ATI_TUNER_19,
|
||||
ATI_TUNER_20,
|
||||
ATI_TUNER_21,
|
||||
ATI_TUNER_22,
|
||||
ATI_TUNER_23,
|
||||
ATI_TUNER_24,
|
||||
ATI_TUNER_25,
|
||||
ATI_TUNER_26,
|
||||
ATI_TUNER_27,
|
||||
ATI_TUNER_28,
|
||||
ATI_TUNER_MT2032,
|
||||
ATI_TUNER_30,
|
||||
ATI_TUNER_31
|
||||
} ATITunerType;
|
||||
|
||||
extern const SymTabRec ATITuners[];
|
||||
|
||||
#endif /* ___ATITUNER_H___ */
|
||||
Loading…
Reference in a new issue