mirror of
https://github.com/X11Libre/xf86-video-mga.git
synced 2026-04-14 10:54:26 +00:00
Strip trailing whitespace from source files
Performed with: `git ls-files | xargs perl -i -p -e 's{[ \t]+$}{}'`
`git diff -w` & `git diff -b` show no diffs from this change
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-video-mga/-/merge_requests/17>
This commit is contained in:
committed by
Enrico Weigelt, metux IT consult
parent
983cff1eb9
commit
04a4e4b81b
4
.gitignore
vendored
4
.gitignore
vendored
@@ -71,8 +71,8 @@ core
|
||||
*.tar.bz2
|
||||
*.tar.gz
|
||||
#
|
||||
# Add & Override patterns for xf86-video-mga
|
||||
# Add & Override patterns for xf86-video-mga
|
||||
#
|
||||
# Edit the following section as needed
|
||||
# For example, !report.pc overrides *.pc. See 'man gitignore'
|
||||
#
|
||||
#
|
||||
|
||||
@@ -135,7 +135,7 @@ if test "x$EXA" = xyes; then
|
||||
CPPFLAGS="$SAVE_CPPFLAGS"
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
fi
|
||||
|
||||
SAVE_CPPFLAGS="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $XORG_CFLAGS"
|
||||
|
||||
@@ -233,7 +233,7 @@ Offset Type Description
|
||||
15 Primary hardware detect
|
||||
0 = hardware detection is off
|
||||
1 = use hardware detection to determine main output
|
||||
|
||||
|
||||
Display info values:
|
||||
0000 None
|
||||
0001 HD15
|
||||
|
||||
24
src/mga.h
24
src/mga.h
@@ -148,7 +148,7 @@ void MGAdbg_outreg32(ScrnInfoPtr, int,int, char*);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Read/write to the DAC via MMIO
|
||||
* Read/write to the DAC via MMIO
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -188,7 +188,7 @@ void MGAdbg_outreg32(ScrnInfoPtr, int,int, char*);
|
||||
count++; \
|
||||
} while( !( status & 0x08 ) && (count < 250000) );\
|
||||
} while (0)
|
||||
|
||||
|
||||
#define MGAWAITBUSY() \
|
||||
do { \
|
||||
unsigned int count = 0; \
|
||||
@@ -354,10 +354,10 @@ struct mga_VCO {
|
||||
* Minimum selectable frequency for this VCO, measured in kHz.
|
||||
*/
|
||||
unsigned min_freq;
|
||||
|
||||
|
||||
/**
|
||||
* Maximum selectable frequency for this VCO, measured in kHz.
|
||||
*
|
||||
*
|
||||
* If this value is zero, then the VCO is not available.
|
||||
*/
|
||||
unsigned max_freq;
|
||||
@@ -401,7 +401,7 @@ struct mga_bios_values {
|
||||
struct mga_VCO pixel; /**< Pixel VCO. */
|
||||
struct mga_VCO video; /**< Video VCO. */
|
||||
/*@}*/
|
||||
|
||||
|
||||
/**
|
||||
* Memory clock speed, measured in kHz.
|
||||
*/
|
||||
@@ -439,7 +439,7 @@ struct mga_device_attributes {
|
||||
|
||||
unsigned dri_capable:1;
|
||||
unsigned dri_chipset:3;
|
||||
|
||||
|
||||
unsigned HAL_chipset:1;
|
||||
|
||||
enum {
|
||||
@@ -447,12 +447,12 @@ struct mga_device_attributes {
|
||||
probe_BARs,
|
||||
new_BARs
|
||||
} BARs:2;
|
||||
|
||||
|
||||
uint32_t accel_flags;
|
||||
|
||||
|
||||
/** Default BIOS values. */
|
||||
struct mga_bios_values default_bios_values;
|
||||
|
||||
|
||||
/** Default memory probe offset / size values. */
|
||||
unsigned probe_size;
|
||||
unsigned probe_offset;
|
||||
@@ -613,7 +613,7 @@ typedef struct {
|
||||
|
||||
int irq;
|
||||
CARD32 reg_ien;
|
||||
|
||||
|
||||
Bool useOldDmaInit;
|
||||
Bool forcePciDma;
|
||||
#endif
|
||||
@@ -663,7 +663,7 @@ typedef struct {
|
||||
int M1frameY0;
|
||||
int M1frameX1;
|
||||
int M1frameY1;
|
||||
|
||||
|
||||
ScrnInfoPtr pScrn2; /*pointer to second CRTC screeninforec,
|
||||
if in merged mode */
|
||||
/* End of Merged Framebuffer Data */
|
||||
@@ -712,7 +712,7 @@ void MGAAdjustFrameCrtc2(ADJUST_FRAME_ARGS_DECL);
|
||||
void MGADisplayPowerManagementSetCrtc2(ScrnInfoPtr pScrn,
|
||||
int PowerManagementMode,
|
||||
int flags);
|
||||
void MGAAdjustGranularity(ScrnInfoPtr pScrn, int* x, int* y);
|
||||
void MGAAdjustGranularity(ScrnInfoPtr pScrn, int* x, int* y);
|
||||
|
||||
|
||||
void MGA2064SetupFuncs(ScrnInfoPtr pScrn);
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
static __inline__ CARD16 get_u16( const CARD8 * data )
|
||||
{
|
||||
CARD16 temp;
|
||||
|
||||
|
||||
temp = data[1];
|
||||
temp <<= 8;
|
||||
temp += data[0];
|
||||
@@ -73,14 +73,14 @@ static __inline__ CARD16 get_u16( const CARD8 * data )
|
||||
|
||||
/**
|
||||
* Parse version 0x01XX of the BIOS PInS structure.
|
||||
*
|
||||
*
|
||||
* Version 0x01XX of the BIOS PInS structure is only found in Millennium cards.
|
||||
*
|
||||
* \todo
|
||||
* There used to be an "OverclockMem" option that would scale the memory clock
|
||||
* by 12 instead 10. Add support for this back in.
|
||||
*/
|
||||
static void mga_parse_bios_ver_1( struct mga_bios_values * bios,
|
||||
static void mga_parse_bios_ver_1( struct mga_bios_values * bios,
|
||||
const CARD8 * bios_data )
|
||||
{
|
||||
unsigned maxdac;
|
||||
@@ -104,7 +104,7 @@ static void mga_parse_bios_ver_1( struct mga_bios_values * bios,
|
||||
default: maxdac = 240000; break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( get_u16( & bios_data[28] ) ) {
|
||||
bios->mem_clock = get_u16( & bios_data[28] ) * 10;
|
||||
}
|
||||
@@ -119,11 +119,11 @@ static void mga_parse_bios_ver_1( struct mga_bios_values * bios,
|
||||
|
||||
/**
|
||||
* Parse version 0x02XX of the BIOS PInS structure.
|
||||
*
|
||||
*
|
||||
* Version 0x02XX of the BIOS PInS structure is only found in Millennium II
|
||||
* and Mystique cards.
|
||||
*/
|
||||
static void mga_parse_bios_ver_2( struct mga_bios_values * bios,
|
||||
static void mga_parse_bios_ver_2( struct mga_bios_values * bios,
|
||||
const CARD8 * bios_data )
|
||||
{
|
||||
if ( bios_data[41] != 0xff ) {
|
||||
@@ -142,11 +142,11 @@ static void mga_parse_bios_ver_2( struct mga_bios_values * bios,
|
||||
|
||||
/**
|
||||
* Parse version 0x03XX of the BIOS PInS structure.
|
||||
*
|
||||
*
|
||||
* Version 0x03XX of the BIOS PInS structure is only found in G100 and G200
|
||||
* cards.
|
||||
*/
|
||||
static void mga_parse_bios_ver_3( struct mga_bios_values * bios,
|
||||
static void mga_parse_bios_ver_3( struct mga_bios_values * bios,
|
||||
const CARD8 * bios_data )
|
||||
{
|
||||
if ( bios_data[36] != 0xff ) {
|
||||
@@ -164,10 +164,10 @@ static void mga_parse_bios_ver_3( struct mga_bios_values * bios,
|
||||
|
||||
/**
|
||||
* Parse version 0x04XX of the BIOS PInS structure.
|
||||
*
|
||||
*
|
||||
* Version 0x04XX of the BIOS PInS structure is only found in G400 cards.
|
||||
*/
|
||||
static void mga_parse_bios_ver_4( struct mga_bios_values * bios,
|
||||
static void mga_parse_bios_ver_4( struct mga_bios_values * bios,
|
||||
const CARD8 * bios_data )
|
||||
{
|
||||
if ( bios_data[39] != 0xff ) {
|
||||
@@ -198,11 +198,11 @@ static void mga_parse_bios_ver_4( struct mga_bios_values * bios,
|
||||
|
||||
/**
|
||||
* Parse version 0x05XX of the BIOS PInS structure.
|
||||
*
|
||||
*
|
||||
* Version 0x05XX of the BIOS PInS structure is only found in G450 and G550
|
||||
* cards.
|
||||
*/
|
||||
static void mga_parse_bios_ver_5( struct mga_bios_values * bios,
|
||||
static void mga_parse_bios_ver_5( struct mga_bios_values * bios,
|
||||
const CARD8 * bios_data )
|
||||
{
|
||||
const unsigned scale = (bios_data[4] != 0) ? 8000 : 6000;
|
||||
@@ -338,7 +338,7 @@ Bool mga_read_and_process_bios( ScrnInfoPtr pScrn )
|
||||
"Could not retrieve video BIOS!\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* Get the output mode set by the BIOS */
|
||||
pMga->BiosOutputMode = bios_data[0x7ff1];
|
||||
|
||||
@@ -355,7 +355,7 @@ Bool mga_read_and_process_bios( ScrnInfoPtr pScrn )
|
||||
* image for the magic signature. This is the 16-bit value 0x412d. This
|
||||
* value is followed by the length of the PInS block. We know that this
|
||||
* must (currently) be either 0x80 or 0x40.
|
||||
*
|
||||
*
|
||||
* Happy hunting.
|
||||
*/
|
||||
for (offset = 0 ; offset < 0x7ffc ; offset++) {
|
||||
@@ -380,12 +380,12 @@ Bool mga_read_and_process_bios( ScrnInfoPtr pScrn )
|
||||
"Video BIOS info block at offset 0x%05lX\n",
|
||||
(long)(offset));
|
||||
|
||||
|
||||
|
||||
/* Determine the version of the PInS block. This will determine how the
|
||||
* data is processed. Only the first version of the PInS data structure
|
||||
* did *NOT* have the initial 0x412e (in little-endian order!) signature.
|
||||
*/
|
||||
|
||||
|
||||
pins_data = & bios_data[ offset ];
|
||||
if ( (pins_data[0] == 0x2e) && (pins_data[1] == 0x41) ) {
|
||||
version = pins_data[5];
|
||||
@@ -395,8 +395,8 @@ Bool mga_read_and_process_bios( ScrnInfoPtr pScrn )
|
||||
version = 1;
|
||||
pins_len = get_u16( pins_data );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ( (version < 1) || (version > 5) ) {
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
|
||||
"PInS data version (%u) not supported.\n", version);
|
||||
@@ -410,7 +410,7 @@ Bool mga_read_and_process_bios( ScrnInfoPtr pScrn )
|
||||
pins_len, expected_length[ version ], version);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
switch( version ) {
|
||||
case 1: mga_parse_bios_ver_1( & pMga->bios, pins_data ); break;
|
||||
case 2: mga_parse_bios_ver_2( & pMga->bios, pins_data ); break;
|
||||
@@ -418,7 +418,7 @@ Bool mga_read_and_process_bios( ScrnInfoPtr pScrn )
|
||||
case 4: mga_parse_bios_ver_4( & pMga->bios, pins_data ); break;
|
||||
case 5: mga_parse_bios_ver_5( & pMga->bios, pins_data ); break;
|
||||
}
|
||||
|
||||
|
||||
#ifdef BIOS_DEBUG
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
|
||||
"system VCO = [%u, %u]\n",
|
||||
|
||||
@@ -138,7 +138,7 @@ typedef struct {
|
||||
} drmMGABlit;
|
||||
|
||||
/* 3.1: An ioctl to get parameters that aren't available to the 3d
|
||||
* client any other way.
|
||||
* client any other way.
|
||||
*/
|
||||
#define MGA_PARAM_IRQ_NR 1
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
*
|
||||
*
|
||||
* Modified for TVP3026 by Harald Koenig <koenig@tat.physik.uni-tuebingen.de>
|
||||
*
|
||||
*
|
||||
* Modified for MGA Millennium by Xavier Ducoin <xavier@rd.lectra.fr>
|
||||
*
|
||||
* Doug Merritt <doug@netcom.com>
|
||||
@@ -36,7 +36,7 @@
|
||||
/*
|
||||
* This is a first cut at a non-accelerated version to work with the
|
||||
* new server design (DHD).
|
||||
*/
|
||||
*/
|
||||
|
||||
/* All drivers should typically include these */
|
||||
#include "xf86.h"
|
||||
@@ -70,7 +70,7 @@ static Bool MGA3026_i2cInit(ScrnInfoPtr pScrn);
|
||||
/*
|
||||
* implementation
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* indexes to ti3026 registers (the order is important)
|
||||
*/
|
||||
@@ -81,7 +81,7 @@ static const unsigned char MGADACregs[] = {
|
||||
};
|
||||
|
||||
/* note: to fix a cursor hw glitch, register 0x37 (blue color key) needs
|
||||
to be set to magic numbers, even though they are "never" used because
|
||||
to be set to magic numbers, even though they are "never" used because
|
||||
blue keying disabled in 0x38.
|
||||
|
||||
Matrox sez:
|
||||
@@ -93,9 +93,9 @@ static const unsigned char MGADACregs[] = {
|
||||
|
||||
/* also note: the values of the MUX control register 0x19 (index [2]) can be
|
||||
found in table 2-17 of the 3026 manual. If interlace is set, the values
|
||||
listed here are incremented by one.
|
||||
listed here are incremented by one.
|
||||
*/
|
||||
|
||||
|
||||
#define DACREGSIZE sizeof(MGADACregs)
|
||||
/*
|
||||
* initial values of ti3026 registers
|
||||
@@ -132,9 +132,9 @@ static const unsigned char MGADACbpp32[DACREGSIZE] = {
|
||||
0x00
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Read/write to the DAC via MMIO
|
||||
* Read/write to the DAC via MMIO
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -239,7 +239,7 @@ MGATi3026CalcClock (
|
||||
best_n = *n;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* 65 - ( 65 - x ) = x */
|
||||
*m = 65 - best_m;
|
||||
*n = 65 - best_n;
|
||||
@@ -280,37 +280,37 @@ MGATi3026SetMCLK( ScrnInfoPtr pScrn, long f_out )
|
||||
pclk_m = inTi3026( TVP3026_PIX_CLK_DATA );
|
||||
outTi3026( TVP3026_PLL_ADDR, 0, 0xfe );
|
||||
pclk_p = inTi3026( TVP3026_PIX_CLK_DATA );
|
||||
|
||||
|
||||
/* Stop PCLK (PLLEN = 0, PCLKEN = 0) */
|
||||
outTi3026( TVP3026_PLL_ADDR, 0, 0xfe );
|
||||
outTi3026( TVP3026_PIX_CLK_DATA, 0, 0x00 );
|
||||
|
||||
|
||||
/* Set PCLK to the new MCLK frequency (PLLEN = 1, PCLKEN = 0 ) */
|
||||
outTi3026( TVP3026_PLL_ADDR, 0, 0xfc );
|
||||
outTi3026( TVP3026_PIX_CLK_DATA, 0, ( mclk_n & 0x3f ) | 0xc0 );
|
||||
outTi3026( TVP3026_PIX_CLK_DATA, 0, mclk_m & 0x3f );
|
||||
outTi3026( TVP3026_PIX_CLK_DATA, 0, ( mclk_p & 0x03 ) | 0xb0 );
|
||||
|
||||
|
||||
/* Wait for PCLK PLL to lock on frequency */
|
||||
while (( inTi3026( TVP3026_PIX_CLK_DATA ) & 0x40 ) == 0 ) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Output PCLK on MCLK pin */
|
||||
mclk_ctl = inTi3026( TVP3026_MCLK_CTL );
|
||||
outTi3026( TVP3026_MCLK_CTL, 0, mclk_ctl & 0xe7 );
|
||||
outTi3026( TVP3026_MCLK_CTL, 0, mclk_ctl & 0xe7 );
|
||||
outTi3026( TVP3026_MCLK_CTL, 0, ( mclk_ctl & 0xe7 ) | 0x08 );
|
||||
|
||||
|
||||
/* Stop MCLK (PLLEN = 0 ) */
|
||||
outTi3026( TVP3026_PLL_ADDR, 0, 0xfb );
|
||||
outTi3026( TVP3026_MEM_CLK_DATA, 0, 0x00 );
|
||||
|
||||
|
||||
/* Set MCLK to the new frequency (PLLEN = 1) */
|
||||
outTi3026( TVP3026_PLL_ADDR, 0, 0xf3 );
|
||||
outTi3026( TVP3026_MEM_CLK_DATA, 0, ( mclk_n & 0x3f ) | 0xc0 );
|
||||
outTi3026( TVP3026_MEM_CLK_DATA, 0, mclk_m & 0x3f );
|
||||
outTi3026( TVP3026_MEM_CLK_DATA, 0, ( mclk_p & 0x03 ) | 0xb0 );
|
||||
|
||||
|
||||
/* Wait for MCLK PLL to lock on frequency */
|
||||
while (( inTi3026( TVP3026_MEM_CLK_DATA ) & 0x40 ) == 0 ) {
|
||||
|
||||
@@ -319,17 +319,17 @@ MGATi3026SetMCLK( ScrnInfoPtr pScrn, long f_out )
|
||||
/* Output MCLK PLL on MCLK pin */
|
||||
outTi3026( TVP3026_MCLK_CTL, 0, ( mclk_ctl & 0xe7 ) | 0x10 );
|
||||
outTi3026( TVP3026_MCLK_CTL, 0, ( mclk_ctl & 0xe7 ) | 0x18 );
|
||||
|
||||
|
||||
/* Stop PCLK (PLLEN = 0, PCLKEN = 0 ) */
|
||||
outTi3026( TVP3026_PLL_ADDR, 0, 0xfe );
|
||||
outTi3026( TVP3026_PIX_CLK_DATA, 0, 0x00 );
|
||||
|
||||
|
||||
/* Restore PCLK (PLLEN = ?, PCLKEN = ?) */
|
||||
outTi3026( TVP3026_PLL_ADDR, 0, 0xfc );
|
||||
outTi3026( TVP3026_PIX_CLK_DATA, 0, pclk_n );
|
||||
outTi3026( TVP3026_PIX_CLK_DATA, 0, pclk_m );
|
||||
outTi3026( TVP3026_PIX_CLK_DATA, 0, pclk_p );
|
||||
|
||||
|
||||
/* Wait for PCLK PLL to lock on frequency */
|
||||
while (( inTi3026( TVP3026_PIX_CLK_DATA ) & 0x40 ) == 0 ) {
|
||||
|
||||
@@ -363,7 +363,7 @@ MGATi3026SetMCLK( ScrnInfoPtr pScrn, long f_out )
|
||||
* Based on the TVP3026 code in the S3 driver.
|
||||
*/
|
||||
|
||||
static void
|
||||
static void
|
||||
MGATi3026SetPCLK( ScrnInfoPtr pScrn, long f_out, int bpp )
|
||||
{
|
||||
/* Pixel clock values */
|
||||
@@ -450,7 +450,7 @@ MGATi3026SetPCLK( ScrnInfoPtr pScrn, long f_out, int bpp )
|
||||
lp = 3;
|
||||
lq = ( int )( z / 1600.0 );
|
||||
}
|
||||
|
||||
|
||||
/* Values for the loop clock PLL registers */
|
||||
if ( pMga->CurrentLayout.bitsPerPixel == 24 ) {
|
||||
/* Packed pixel mode values */
|
||||
@@ -474,7 +474,7 @@ MGATi3026SetPCLK( ScrnInfoPtr pScrn, long f_out, int bpp )
|
||||
/*
|
||||
* MGA3026Init -- for mga2064 with ti3026
|
||||
*
|
||||
* The 'mode' parameter describes the video mode. The 'mode' structure
|
||||
* The 'mode' parameter describes the video mode. The 'mode' structure
|
||||
* as well as the 'vga256InfoRec' structure can be dereferenced for
|
||||
* information that is needed to initialize the mode. The 'new' macro
|
||||
* (see definition above) is used to simply fill in the structure.
|
||||
@@ -510,13 +510,13 @@ MGA3026Init(ScrnInfoPtr pScrn, DisplayModePtr mode)
|
||||
default:
|
||||
FatalError("MGA: unsupported bits per pixel\n");
|
||||
}
|
||||
|
||||
|
||||
/* Allocate the DacRegs space if not done already */
|
||||
if (pReg->DacRegs == NULL) {
|
||||
pReg->DacRegs = XNFcallocarray(DACREGSIZE, 1);
|
||||
}
|
||||
for (i = 0; i < DACREGSIZE; i++) {
|
||||
pReg->DacRegs[i] = initDAC[i];
|
||||
pReg->DacRegs[i] = initDAC[i];
|
||||
if (MGADACregs[i] == 0x1D)
|
||||
index_1d = i;
|
||||
}
|
||||
@@ -536,12 +536,12 @@ MGA3026Init(ScrnInfoPtr pScrn, DisplayModePtr mode)
|
||||
* 0x06.
|
||||
*/
|
||||
silicon_rev = inTi3026(TVP3026_SILICON_REV);
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
ErrorF("TVP3026 revision 0x%x (rev %s)\n",
|
||||
silicon_rev, (silicon_rev <= 0x20) ? "A" : "B");
|
||||
#endif
|
||||
|
||||
|
||||
if(silicon_rev <= 0x20) {
|
||||
/* rev A */
|
||||
pReg->DacRegs[0] = 0x07;
|
||||
@@ -582,14 +582,14 @@ MGA3026Init(ScrnInfoPtr pScrn, DisplayModePtr mode)
|
||||
|
||||
pReg->ExtVga[0] = 0;
|
||||
pReg->ExtVga[5] = 0;
|
||||
|
||||
|
||||
if (mode->Flags & V_INTERLACE)
|
||||
{
|
||||
pReg->ExtVga[0] = 0x80;
|
||||
pReg->ExtVga[5] = (hs + he - ht) >> 1;
|
||||
wd <<= 1;
|
||||
vt &= 0xFFFE;
|
||||
|
||||
|
||||
/* enable interlaced cursor */
|
||||
pReg->DacRegs[20] |= 0x20;
|
||||
}
|
||||
@@ -613,7 +613,7 @@ MGA3026Init(ScrnInfoPtr pScrn, DisplayModePtr mode)
|
||||
: pScrn->videoRam == 2048 ? 0x08 : 0x00);
|
||||
|
||||
pReg->ExtVga[4] = 0;
|
||||
|
||||
|
||||
pVga->CRTC[0] = ht - 4;
|
||||
pVga->CRTC[1] = hd;
|
||||
pVga->CRTC[2] = hd;
|
||||
@@ -629,7 +629,7 @@ MGA3026Init(ScrnInfoPtr pScrn, DisplayModePtr mode)
|
||||
((vt & 0x200) >> 4 ) |
|
||||
((vd & 0x200) >> 3 ) |
|
||||
((vs & 0x200) >> 2 );
|
||||
pVga->CRTC[9] = ((vd & 0x200) >> 4) | 0x40;
|
||||
pVga->CRTC[9] = ((vd & 0x200) >> 4) | 0x40;
|
||||
pVga->CRTC[16] = vs & 0xFF;
|
||||
pVga->CRTC[17] = (ve & 0x0F) | 0x20;
|
||||
pVga->CRTC[18] = vd & 0xFF;
|
||||
@@ -639,7 +639,7 @@ MGA3026Init(ScrnInfoPtr pScrn, DisplayModePtr mode)
|
||||
|
||||
if (mode->Flags & V_DBLSCAN)
|
||||
pVga->CRTC[9] |= 0x80;
|
||||
|
||||
|
||||
/* Per DDK vid.c line 75, sync polarity should be controlled
|
||||
* via the TVP3026 RAMDAC register 1D and so MISC Output Register
|
||||
* should always have bits 6 and 7 set. */
|
||||
@@ -667,7 +667,7 @@ MGA3026Init(ScrnInfoPtr pScrn, DisplayModePtr mode)
|
||||
else
|
||||
pReg->DacRegs[index_1d] |= 0x03; /* +hsync +vsync */
|
||||
}
|
||||
|
||||
|
||||
if (pMga->SyncOnGreen)
|
||||
pReg->DacRegs[index_1d] |= 0x20;
|
||||
|
||||
@@ -678,22 +678,22 @@ MGA3026Init(ScrnInfoPtr pScrn, DisplayModePtr mode)
|
||||
else
|
||||
pReg->Option &= ~0x1000;
|
||||
|
||||
/* must always have the pci retries on but rely on
|
||||
/* must always have the pci retries on but rely on
|
||||
polling to keep them from occurring */
|
||||
pReg->Option &= ~0x20000000;
|
||||
|
||||
pVga->MiscOutReg |= 0x0C;
|
||||
pVga->MiscOutReg |= 0x0C;
|
||||
/* XXX Need to check the first argument */
|
||||
MGATi3026SetPCLK( pScrn, mode->Clock, 1 << BppShift );
|
||||
|
||||
/* this one writes registers rather than writing to the
|
||||
/* this one writes registers rather than writing to the
|
||||
mgaReg->ModeReg and letting Restore write to the hardware
|
||||
but that's no big deal since we will Restore right after
|
||||
this function */
|
||||
|
||||
MGATi3026SetMCLK(pScrn, MGAdac->MemoryClock);
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
ErrorF("%6d: %02X %02X %02X %02X %02X %02X %08X\n", mode->Clock,
|
||||
pReg->DacClk[0], pReg->DacClk[1], pReg->DacClk[2], pReg->DacClk[3], pReg->DacClk[4], pReg->DacClk[5], (unsigned)pReg->Option);
|
||||
for (i=0; i<sizeof(MGADACregs); i++) ErrorF("%02X ", pReg->DacRegs[i]);
|
||||
@@ -710,10 +710,10 @@ MGA3026Init(ScrnInfoPtr pScrn, DisplayModePtr mode)
|
||||
* MGA3026Restore -- for mga2064 with ti3026
|
||||
*
|
||||
* This function restores a video mode. It basically writes out all of
|
||||
* the registers that have previously been saved in the vgaMGARec data
|
||||
* the registers that have previously been saved in the vgaMGARec data
|
||||
* structure.
|
||||
*/
|
||||
static void
|
||||
static void
|
||||
MGA3026Restore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
|
||||
Bool restoreFonts)
|
||||
{
|
||||
@@ -736,12 +736,12 @@ MGA3026Restore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
|
||||
|
||||
/* select pixel clock PLL as clock source */
|
||||
outTi3026(TVP3026_CLK_SEL, 0, mgaReg->DacRegs[3]);
|
||||
|
||||
|
||||
/* set loop and pixel clock PLL PLLEN bits to 0 */
|
||||
outTi3026(TVP3026_PLL_ADDR, 0, 0x2A);
|
||||
outTi3026(TVP3026_LOAD_CLK_DATA, 0, 0);
|
||||
outTi3026(TVP3026_PIX_CLK_DATA, 0, 0);
|
||||
|
||||
|
||||
/*
|
||||
* This function handles restoring the generic VGA registers.
|
||||
*/
|
||||
@@ -751,7 +751,7 @@ MGA3026Restore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
|
||||
|
||||
/*
|
||||
* Code to restore SVGA registers that have been saved/modified
|
||||
* goes here.
|
||||
* goes here.
|
||||
*/
|
||||
|
||||
/* program pixel clock PLL */
|
||||
@@ -767,7 +767,7 @@ MGA3026Restore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
|
||||
|
||||
/* set Q divider for loop clock PLL */
|
||||
outTi3026(TVP3026_MCLK_CTL, 0, mgaReg->DacRegs[18]);
|
||||
|
||||
|
||||
/* program loop PLL */
|
||||
outTi3026(TVP3026_PLL_ADDR, 0, 0x00);
|
||||
for (i = 3; i < 6; i++)
|
||||
@@ -788,7 +788,7 @@ MGA3026Restore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
|
||||
#ifdef DEBUG
|
||||
ErrorF("PCI retry (0-enabled / 1-disabled): %d\n",
|
||||
!!(mgaReg->Option & 0x20000000));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -802,7 +802,7 @@ MGA3026Save(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
|
||||
{
|
||||
int i;
|
||||
MGAPtr pMga = MGAPTR(pScrn);
|
||||
|
||||
|
||||
/* Allocate the DacRegs space if not done already */
|
||||
if (mgaReg->DacRegs == NULL) {
|
||||
mgaReg->DacRegs = XNFcallocarray(DACREGSIZE, 1);
|
||||
@@ -812,7 +812,7 @@ MGA3026Save(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
|
||||
* Code is needed to get back to bank zero.
|
||||
*/
|
||||
OUTREG16(0x1FDE, 0x0004);
|
||||
|
||||
|
||||
/*
|
||||
* This function will handle creating the data structure and filling
|
||||
* in the generic VGA portion.
|
||||
@@ -821,7 +821,7 @@ MGA3026Save(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
|
||||
MGA3026SavePalette(pScrn, vgaReg->DAC);
|
||||
|
||||
/*
|
||||
* The port I/O code necessary to read in the extended registers
|
||||
* The port I/O code necessary to read in the extended registers
|
||||
* into the fields of the vgaMGARec structure.
|
||||
*/
|
||||
for (i = 0; i < 6; i++)
|
||||
@@ -839,10 +839,10 @@ MGA3026Save(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
|
||||
for (i = 3; i < 6; i++)
|
||||
outTi3026(TVP3026_LOAD_CLK_DATA, 0, mgaReg->DacClk[i] =
|
||||
inTi3026(TVP3026_LOAD_CLK_DATA));
|
||||
|
||||
|
||||
for (i = 0; i < DACREGSIZE; i++)
|
||||
mgaReg->DacRegs[i] = inTi3026(MGADACregs[i]);
|
||||
|
||||
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
{
|
||||
uint32_t Option;
|
||||
@@ -853,8 +853,8 @@ MGA3026Save(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
|
||||
#else
|
||||
mgaReg->Option = pciReadLong(pMga->PciTag, PCI_OPTION_REG);
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
#ifdef DEBUG
|
||||
ErrorF("read: %02X %02X %02X %02X %02X %02X %08X\n",
|
||||
mgaReg->DacClk[0], mgaReg->DacClk[1], mgaReg->DacClk[2], mgaReg->DacClk[3], mgaReg->DacClk[4], mgaReg->DacClk[5], (unsigned)mgaReg->Option);
|
||||
for (i=0; i<sizeof(MGADACregs); i++) ErrorF("%02X ", mgaReg->DacRegs[i]);
|
||||
@@ -866,26 +866,26 @@ MGA3026Save(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
|
||||
|
||||
static void
|
||||
MGA3026LoadCursorImage(
|
||||
ScrnInfoPtr pScrn,
|
||||
ScrnInfoPtr pScrn,
|
||||
unsigned char *src
|
||||
)
|
||||
{
|
||||
MGAPtr pMga = MGAPTR(pScrn);
|
||||
int i = 1024;
|
||||
|
||||
|
||||
outTi3026(TVP3026_CURSOR_CTL, 0xf3, 0x00); /* reset A9,A8 */
|
||||
/* reset cursor RAM load address A7..A0 */
|
||||
outTi3026dreg(TVP3026_WADR_PAL, 0x00);
|
||||
outTi3026dreg(TVP3026_WADR_PAL, 0x00);
|
||||
|
||||
while(i--) {
|
||||
while (INREG8(0x1FDA) & 0x01);
|
||||
while (!(INREG8(0x1FDA) & 0x01));
|
||||
outTi3026dreg(TVP3026_CUR_RAM, *(src++));
|
||||
outTi3026dreg(TVP3026_CUR_RAM, *(src++));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
static void
|
||||
MGA3026ShowCursor(ScrnInfoPtr pScrn)
|
||||
{
|
||||
MGAPtr pMga = MGAPTR(pScrn);
|
||||
@@ -903,7 +903,7 @@ MGA3026HideCursor(ScrnInfoPtr pScrn)
|
||||
|
||||
static void
|
||||
MGA3026SetCursorPosition(
|
||||
ScrnInfoPtr pScrn,
|
||||
ScrnInfoPtr pScrn,
|
||||
int x, int y
|
||||
)
|
||||
{
|
||||
@@ -912,7 +912,7 @@ MGA3026SetCursorPosition(
|
||||
y += 64;
|
||||
|
||||
/* Output position - "only" 12 bits of location documented */
|
||||
|
||||
|
||||
outTi3026dreg(TVP3026_CUR_XLOW, x & 0xFF);
|
||||
outTi3026dreg(TVP3026_CUR_XHI, (x >> 8) & 0x0F);
|
||||
outTi3026dreg(TVP3026_CUR_YLOW, y & 0xFF);
|
||||
@@ -921,7 +921,7 @@ MGA3026SetCursorPosition(
|
||||
|
||||
static void
|
||||
MGA3026SetCursorColors(
|
||||
ScrnInfoPtr pScrn,
|
||||
ScrnInfoPtr pScrn,
|
||||
int bg, int fg
|
||||
)
|
||||
{
|
||||
@@ -941,7 +941,7 @@ MGA3026SetCursorColors(
|
||||
outTi3026dreg(TVP3026_CUR_COL_DATA, (fg & 0x000000FF));
|
||||
}
|
||||
|
||||
static Bool
|
||||
static Bool
|
||||
MGA3026UseHWCursor(ScreenPtr pScrn, CursorPtr pCurs)
|
||||
{
|
||||
if( XF86SCRNINFO(pScrn)->currentMode->Flags & V_DBLSCAN )
|
||||
@@ -969,14 +969,14 @@ MGA3026_ddc1Read(ScrnInfoPtr pScrn)
|
||||
}
|
||||
|
||||
static void
|
||||
MGA3026_I2CGetBits(I2CBusPtr b, int *clock, int *data)
|
||||
MGA3026_I2CGetBits(I2CBusPtr b, int *clock, int *data)
|
||||
{
|
||||
ScrnInfoPtr pScrn = xf86Screens[b->scrnIndex];
|
||||
MGAPtr pMga = MGAPTR(pScrn);
|
||||
unsigned char val;
|
||||
|
||||
/* Get the result. */
|
||||
val = inTi3026(TVP3026_GEN_IO_DATA);
|
||||
val = inTi3026(TVP3026_GEN_IO_DATA);
|
||||
*clock = (val & DDC_SCL_MASK) != 0;
|
||||
*data = (val & DDC_SDA_MASK) != 0;
|
||||
|
||||
@@ -1002,7 +1002,7 @@ MGA3026_I2CPutBits(I2CBusPtr b, int clock, int data)
|
||||
drv = ((!clock) ? DDC_SCL_MASK : 0) | ((!data) ? DDC_SDA_MASK : 0);
|
||||
/* Define the SDA (Data) and SCL (clock) as outputs */
|
||||
outTi3026(TVP3026_GEN_IO_CTL, ~(DDC_SDA_MASK | DDC_SCL_MASK), drv);
|
||||
outTi3026(TVP3026_GEN_IO_DATA, ~(DDC_SDA_MASK | DDC_SCL_MASK), val);
|
||||
outTi3026(TVP3026_GEN_IO_DATA, ~(DDC_SDA_MASK | DDC_SCL_MASK), val);
|
||||
|
||||
#ifdef DEBUG
|
||||
ErrorF("MGA3026_I2CPutBits(%p, %d, %d) val=0x%x\n", b, clock, data, val);
|
||||
@@ -1027,8 +1027,8 @@ MGA3026_i2cInit(ScrnInfoPtr pScrn)
|
||||
I2CPtr->I2CPutBits = MGA3026_I2CPutBits;
|
||||
I2CPtr->I2CGetBits = MGA3026_I2CGetBits;
|
||||
|
||||
/* I2CPutByte is timing out, experimenting with AcknTimeout
|
||||
* default is 2CPtr->AcknTimeout = 5;
|
||||
/* I2CPutByte is timing out, experimenting with AcknTimeout
|
||||
* default is 2CPtr->AcknTimeout = 5;
|
||||
*/
|
||||
/* I2CPtr->AcknTimeout = 10; */
|
||||
|
||||
@@ -1056,7 +1056,7 @@ MGA3026RamdacInit(ScrnInfoPtr pScrn)
|
||||
MGAdac->HideCursor = MGA3026HideCursor;
|
||||
MGAdac->ShowCursor = MGA3026ShowCursor;
|
||||
MGAdac->UseHWCursor = MGA3026UseHWCursor;
|
||||
MGAdac->CursorFlags =
|
||||
MGAdac->CursorFlags =
|
||||
#if X_BYTE_ORDER == X_LITTLE_ENDIAN
|
||||
HARDWARE_CURSOR_BIT_ORDER_MSBFIRST |
|
||||
#endif
|
||||
@@ -1065,7 +1065,7 @@ MGA3026RamdacInit(ScrnInfoPtr pScrn)
|
||||
|
||||
MGAdac->LoadPalette = MGA3026LoadPalette;
|
||||
MGAdac->RestorePalette = MGA3026RestorePalette;
|
||||
|
||||
|
||||
MGAdac->maxPixelClock = pMga->bios.pixel.max_freq;
|
||||
MGAdac->ClockFrom = X_PROBED;
|
||||
|
||||
@@ -1077,13 +1077,13 @@ MGA3026RamdacInit(ScrnInfoPtr pScrn)
|
||||
/* safety check */
|
||||
if ( (MGAdac->MemoryClock < 40000) ||
|
||||
(MGAdac->MemoryClock > 70000) )
|
||||
MGAdac->MemoryClock = 50000;
|
||||
MGAdac->MemoryClock = 50000;
|
||||
|
||||
/*
|
||||
* Should initialise a sane default when the probed value is
|
||||
* obviously garbage.
|
||||
*/
|
||||
|
||||
|
||||
/* Check if interleaving can be used and set the rounding value */
|
||||
if (pScrn->videoRam > 2048)
|
||||
pMga->Interleave = TRUE;
|
||||
@@ -1105,8 +1105,8 @@ MGA3026RamdacInit(ScrnInfoPtr pScrn)
|
||||
}
|
||||
|
||||
void MGA3026LoadPalette(
|
||||
ScrnInfoPtr pScrn,
|
||||
int numColors,
|
||||
ScrnInfoPtr pScrn,
|
||||
int numColors,
|
||||
int *indices,
|
||||
LOCO *colors,
|
||||
VisualPtr pVisual
|
||||
@@ -1164,7 +1164,7 @@ MGA3026RestorePalette(ScrnInfoPtr pScrn, unsigned char* pntr)
|
||||
int i = 768;
|
||||
|
||||
outTi3026dreg(TVP3026_WADR_PAL, 0x00);
|
||||
while(i--)
|
||||
while(i--)
|
||||
outTi3026dreg(TVP3026_COL_PAL, *(pntr++));
|
||||
}
|
||||
|
||||
@@ -1172,7 +1172,7 @@ MGA3026RestorePalette(ScrnInfoPtr pScrn, unsigned char* pntr)
|
||||
void MGA2064SetupFuncs(ScrnInfoPtr pScrn)
|
||||
{
|
||||
MGAPtr pMga = MGAPTR(pScrn);
|
||||
|
||||
|
||||
pMga->PreInit = MGA3026RamdacInit;
|
||||
pMga->Save = MGA3026Save;
|
||||
pMga->Restore = MGA3026Restore;
|
||||
|
||||
178
src/mga_dacG.c
178
src/mga_dacG.c
@@ -28,9 +28,9 @@
|
||||
/*
|
||||
* implementation
|
||||
*/
|
||||
|
||||
|
||||
#define DACREGSIZE 0x50
|
||||
|
||||
|
||||
/*
|
||||
* Only change bits shown in this mask. Ideally reserved bits should be
|
||||
* zeroed here. Also, don't change the vgaioen bit here since it is
|
||||
@@ -105,14 +105,14 @@ MGAG200E4ComputePLLParam(ScrnInfoPtr pScrn, long lFo, int *M, int *N, int *P)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ulVCO = ulPLLFreqRef * ((*N)+1) / ((*M)+1);
|
||||
ulFVV = (ulVCO - 800000) / 50000;
|
||||
|
||||
if (ulFVV > 15)
|
||||
ulFVV = 15;
|
||||
|
||||
*P |= (ulFVV << 4);
|
||||
*P |= (ulFVV << 4);
|
||||
|
||||
*M |= 0x80;
|
||||
}
|
||||
@@ -316,11 +316,11 @@ MGAG200EW3ComputePLLParam(ScrnInfoPtr pScrn ,long lFo, int *M, int *N, int *P)
|
||||
|
||||
if (ulFTmpDelta < ulFDelta) {
|
||||
ulFDelta = ulFTmpDelta;
|
||||
*M = (CARD8)((ulTestN & 0x100) >> 1) |
|
||||
*M = (CARD8)((ulTestN & 0x100) >> 1) |
|
||||
(CARD8)(ulTestM);
|
||||
*N = (CARD8)(ulTestN & 0xFF);
|
||||
*P = (CARD8)((ulTestN & 0x600) >> 3) |
|
||||
(CARD8)(ulTestP2 << 3) |
|
||||
*P = (CARD8)((ulTestN & 0x600) >> 3) |
|
||||
(CARD8)(ulTestP2 << 3) |
|
||||
(CARD8)ulTestP1;
|
||||
}
|
||||
}
|
||||
@@ -524,7 +524,7 @@ MGAG200WBPIXPLLSET(ScrnInfoPtr pScrn, MGARegPtr mgaReg)
|
||||
usleep(500);
|
||||
|
||||
// Reset the PLL
|
||||
// When we are varying the output frequency by more than
|
||||
// When we are varying the output frequency by more than
|
||||
// 10%, we must reset the PLL. However to be prudent, we
|
||||
// will reset it each time that we are changing it.
|
||||
ucTempByte = inMGAdac(MGA1064_VREF_CTL);
|
||||
@@ -571,7 +571,7 @@ MGAG200WBPIXPLLSET(ScrnInfoPtr pScrn, MGARegPtr mgaReg)
|
||||
ucTempByte &= ~MGA1064_PIX_CLK_CTL_CLK_DIS;
|
||||
outMGAdac(MGA1064_PIX_CLK_CTL, ucTempByte);
|
||||
|
||||
// Poll VCount. If it increments twice inside 150us,
|
||||
// Poll VCount. If it increments twice inside 150us,
|
||||
// we assume that the PLL has locked.
|
||||
ulLoopCount = 0;
|
||||
ulVCount = INREG(MGAREG_VCOUNT);
|
||||
@@ -677,7 +677,7 @@ static void MGAG200ERComputePLLParam(ScrnInfoPtr pScrn, long lFo, int *piM, int
|
||||
static void
|
||||
MGAG200ERPIXPLLSET(ScrnInfoPtr pScrn, MGARegPtr mgaReg)
|
||||
{
|
||||
//TODO G200ER Validate sequence
|
||||
//TODO G200ER Validate sequence
|
||||
CARD8 ucPixCtrl, ucTempByte;
|
||||
MGAPtr pMga = MGAPTR(pScrn);
|
||||
|
||||
@@ -748,7 +748,7 @@ MGAG200WBPrepareForModeSwitch(ScrnInfoPtr pScrn)
|
||||
}
|
||||
|
||||
// 3b- This step occurs only if the remote is actually scanning
|
||||
// We are waiting for the end of the frame which is a 1 on
|
||||
// We are waiting for the end of the frame which is a 1 on
|
||||
// remvsyncsts (XSPAREREG<1>)
|
||||
if (ulIterationMax)
|
||||
{
|
||||
@@ -853,7 +853,7 @@ MGAG200EHPIXPLLSET(ScrnInfoPtr pScrn, MGARegPtr mgaReg)
|
||||
ucTempByte &= ~MGA1064_PIX_CLK_CTL_CLK_POW_DOWN;
|
||||
outMGAdac(MGA1064_PIX_CLK_CTL, ucTempByte);
|
||||
|
||||
// Poll VCount. If it increments twice inside 150us,
|
||||
// Poll VCount. If it increments twice inside 150us,
|
||||
// we assume that the PLL has locked.
|
||||
ulLoopCount = 0;
|
||||
ulVCount = INREG(MGAREG_VCOUNT);
|
||||
@@ -939,7 +939,7 @@ MGAGCalcClock ( ScrnInfoPtr pScrn, long f_out,
|
||||
|
||||
/*
|
||||
* f_pll = f_vco / (p+1)
|
||||
* Choose p so that
|
||||
* Choose p so that
|
||||
* pMga->bios.pixel.min_freq <= f_vco <= pMga->bios.pixel.max_freq
|
||||
* we don't have to bother checking for this maximum limit.
|
||||
*/
|
||||
@@ -955,7 +955,7 @@ MGAGCalcClock ( ScrnInfoPtr pScrn, long f_out,
|
||||
{
|
||||
/* see values of ( n ) which we can't use */
|
||||
for ( n = feed_div_min; n <= feed_div_max; n++ )
|
||||
{
|
||||
{
|
||||
calc_f = ref_freq * (n + 1) / (m + 1) ;
|
||||
|
||||
/*
|
||||
@@ -968,22 +968,22 @@ MGAGCalcClock ( ScrnInfoPtr pScrn, long f_out,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Now all the calculations can be completed */
|
||||
f_vco = ref_freq * (*best_n + 1) / (*best_m + 1);
|
||||
|
||||
/* Adjustments for filtering pll feed back */
|
||||
if ( (50000.0 <= f_vco)
|
||||
&& (f_vco < 100000.0) )
|
||||
*s = 0;
|
||||
*s = 0;
|
||||
if ( (100000.0 <= f_vco)
|
||||
&& (f_vco < 140000.0) )
|
||||
*s = 1;
|
||||
*s = 1;
|
||||
if ( (140000.0 <= f_vco)
|
||||
&& (f_vco < 180000.0) )
|
||||
*s = 2;
|
||||
*s = 2;
|
||||
if ( (180000.0 <= f_vco) )
|
||||
*s = 3;
|
||||
*s = 3;
|
||||
|
||||
#ifdef DEBUG
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
|
||||
@@ -995,7 +995,7 @@ MGAGCalcClock ( ScrnInfoPtr pScrn, long f_out,
|
||||
/*
|
||||
* MGAGSetPCLK - Set the pixel (PCLK) clock.
|
||||
*/
|
||||
static void
|
||||
static void
|
||||
MGAGSetPCLK( ScrnInfoPtr pScrn, long f_out )
|
||||
{
|
||||
MGAPtr pMga = MGAPTR(pScrn);
|
||||
@@ -1088,12 +1088,12 @@ MGAGSetPCLK( ScrnInfoPtr pScrn, long f_out )
|
||||
|
||||
pReg->PllM = m;
|
||||
pReg->PllN = n;
|
||||
pReg->PllP = p;
|
||||
pReg->PllP = p;
|
||||
} else if (pMga->is_G200ER) {
|
||||
MGAG200ERComputePLLParam(pScrn, f_out, &m, &n, &p);
|
||||
pReg->PllM = m;
|
||||
pReg->PllN = n;
|
||||
pReg->PllP = p;
|
||||
pReg->PllP = p;
|
||||
} else {
|
||||
/* Do the calculations for m, n, p and s */
|
||||
MGAGCalcClock( pScrn, f_out, &m, &n, &p, &s );
|
||||
@@ -1107,7 +1107,7 @@ MGAGSetPCLK( ScrnInfoPtr pScrn, long f_out )
|
||||
}
|
||||
|
||||
/*
|
||||
* MGAGInit
|
||||
* MGAGInit
|
||||
*/
|
||||
static Bool
|
||||
MGAGInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
|
||||
@@ -1139,8 +1139,8 @@ MGAGInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
|
||||
|
||||
ModeInfo.ulDispWidth = mode->HDisplay;
|
||||
ModeInfo.ulDispHeight = mode->VDisplay;
|
||||
ModeInfo.ulFBPitch = mode->HDisplay;
|
||||
ModeInfo.ulBpp = pScrn->bitsPerPixel;
|
||||
ModeInfo.ulFBPitch = mode->HDisplay;
|
||||
ModeInfo.ulBpp = pScrn->bitsPerPixel;
|
||||
ModeInfo.flSignalMode = 0;
|
||||
ModeInfo.ulPixClock = mode->Clock;
|
||||
ModeInfo.ulHFPorch = mode->HSyncStart - mode->HDisplay;
|
||||
@@ -1162,9 +1162,9 @@ MGAGInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
|
||||
pReg->DacRegs = XNFcallocarray(DACREGSIZE, 1);
|
||||
}
|
||||
for (i = 0; i < DACREGSIZE; i++) {
|
||||
pReg->DacRegs[i] = initDAC[i];
|
||||
pReg->DacRegs[i] = initDAC[i];
|
||||
}
|
||||
|
||||
|
||||
switch(pMga->Chipset)
|
||||
{
|
||||
case PCI_CHIP_MGA1064:
|
||||
@@ -1227,7 +1227,7 @@ MGAGInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
|
||||
pReg->DacRegs[ MGA1064_SYS_PLL_P ] = 0x18;
|
||||
pReg->Option3 = 0x019B8419;
|
||||
pReg->Option = 0x5053C120;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(pMga->OverclockMem) {
|
||||
/* 125/166 */
|
||||
@@ -1243,7 +1243,7 @@ MGAGInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
|
||||
pReg->DacRegs[ MGA1064_SYS_PLL_P ] = 0x08;
|
||||
pReg->Option3 = 0x0190a421;
|
||||
pReg->Option = 0x50044120;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(pMga->HasSDRAM)
|
||||
pReg->Option &= ~(1 << 14);
|
||||
@@ -1320,7 +1320,7 @@ MGAGInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
|
||||
break;
|
||||
}
|
||||
|
||||
/* must always have the pci retries on but rely on
|
||||
/* must always have the pci retries on but rely on
|
||||
polling to keep them from occurring */
|
||||
pReg->Option &= ~0x20000000;
|
||||
|
||||
@@ -1345,7 +1345,7 @@ MGAGInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
|
||||
default:
|
||||
FatalError("MGA: unsupported depth\n");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This will initialize all of the generic VGA registers.
|
||||
*/
|
||||
@@ -1363,13 +1363,13 @@ MGAGInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
|
||||
vs = mode->CrtcVSyncStart - 1;
|
||||
ve = mode->CrtcVSyncEnd - 1;
|
||||
vt = mode->CrtcVTotal - 2;
|
||||
|
||||
|
||||
/* HTOTAL & 0x7 equal to 0x6 in 8bpp or 0x4 in 24bpp causes strange
|
||||
* vertical stripes
|
||||
*/
|
||||
*/
|
||||
if((ht & 0x07) == 0x06 || (ht & 0x07) == 0x04)
|
||||
ht++;
|
||||
|
||||
|
||||
if (pLayout->bitsPerPixel == 24)
|
||||
wd = (pLayout->displayWidth * 3) >> (4 - BppShift);
|
||||
else
|
||||
@@ -1377,7 +1377,7 @@ MGAGInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
|
||||
|
||||
pReg->ExtVga[0] = 0;
|
||||
pReg->ExtVga[5] = 0;
|
||||
|
||||
|
||||
if (mode->Flags & V_INTERLACE)
|
||||
{
|
||||
pReg->ExtVga[0] = 0x80;
|
||||
@@ -1407,7 +1407,7 @@ MGAGInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
|
||||
pReg->ExtVga[1] |= 0x88;
|
||||
}
|
||||
pReg->ExtVga_MgaReq = 0x05;
|
||||
|
||||
|
||||
pVga->CRTC[0] = ht - 4;
|
||||
pVga->CRTC[1] = hd;
|
||||
pVga->CRTC[2] = hd;
|
||||
@@ -1435,7 +1435,7 @@ MGAGInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
|
||||
|
||||
pReg->DacRegs[MGA1064_CURSOR_BASE_ADR_LOW] = pMga->FbCursorOffset >> 10;
|
||||
pReg->DacRegs[MGA1064_CURSOR_BASE_ADR_HI] = pMga->FbCursorOffset >> 18;
|
||||
|
||||
|
||||
if (pMga->SyncOnGreen) {
|
||||
pReg->DacRegs[MGA1064_GEN_CTL] &=
|
||||
~MGA1064_GEN_CTL_SYNC_ON_GREEN_DIS;
|
||||
@@ -1444,7 +1444,7 @@ MGAGInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
|
||||
}
|
||||
|
||||
/* select external clock */
|
||||
pVga->MiscOutReg |= 0x0C;
|
||||
pVga->MiscOutReg |= 0x0C;
|
||||
|
||||
if (mode->Flags & V_DBLSCAN)
|
||||
pVga->CRTC[9] |= 0x80;
|
||||
@@ -1458,7 +1458,7 @@ MGAGInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
|
||||
/* This disables the VGA memory aperture */
|
||||
pVga->MiscOutReg &= ~0x02;
|
||||
|
||||
/* Urgh. Why do we define our own xMODEINFO structure instead
|
||||
/* Urgh. Why do we define our own xMODEINFO structure instead
|
||||
* of just passing the blinkin' DisplayModePtr? If we're going to
|
||||
* just cut'n'paste routines from the HALlib, it would be better
|
||||
* just to strip the MacroVision stuff out of the HALlib and release
|
||||
@@ -1468,8 +1468,8 @@ MGAGInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
|
||||
/* Writing values to crtc2[] array */
|
||||
if (pMga->SecondCrtc)
|
||||
{
|
||||
MGACRTC2Get(pScrn, &ModeInfo);
|
||||
MGACRTC2GetPitch(pScrn, &ModeInfo);
|
||||
MGACRTC2Get(pScrn, &ModeInfo);
|
||||
MGACRTC2GetPitch(pScrn, &ModeInfo);
|
||||
MGACRTC2GetDisplayStart(pScrn, &ModeInfo,0,0,0);
|
||||
}
|
||||
|
||||
@@ -1494,7 +1494,7 @@ MGAPaletteLoadCallback(ScrnInfoPtr pScrn)
|
||||
MGAPaletteInfo *pal = pMga->palinfo;
|
||||
int i;
|
||||
|
||||
while (!(INREG8(0x1FDA) & 0x08));
|
||||
while (!(INREG8(0x1FDA) & 0x08));
|
||||
|
||||
for(i = 0; i < 256; i++) {
|
||||
if(pal->update) {
|
||||
@@ -1510,16 +1510,16 @@ MGAPaletteLoadCallback(ScrnInfoPtr pScrn)
|
||||
}
|
||||
|
||||
void MGAGLoadPalette(
|
||||
ScrnInfoPtr pScrn,
|
||||
int numColors,
|
||||
ScrnInfoPtr pScrn,
|
||||
int numColors,
|
||||
int *indices,
|
||||
LOCO *colors,
|
||||
VisualPtr pVisual
|
||||
){
|
||||
MGAPtr pMga = MGAPTR(pScrn);
|
||||
|
||||
if(pMga->Chipset == PCI_CHIP_MGAG400 || pMga->Chipset == PCI_CHIP_MGAG550){
|
||||
/* load them at the retrace in the block handler instead to
|
||||
if(pMga->Chipset == PCI_CHIP_MGAG400 || pMga->Chipset == PCI_CHIP_MGAG550){
|
||||
/* load them at the retrace in the block handler instead to
|
||||
work around some problems with static on the screen */
|
||||
while(numColors--) {
|
||||
pMga->palinfo[*indices].update = TRUE;
|
||||
@@ -1566,7 +1566,7 @@ MGAGSavePalette(ScrnInfoPtr pScrn, unsigned char* pntr)
|
||||
int i = 768;
|
||||
|
||||
outMGAdreg(MGA1064_RADR_PAL, 0x00);
|
||||
while(i--)
|
||||
while(i--)
|
||||
*(pntr++) = inMGAdreg(MGA1064_COL_PAL);
|
||||
}
|
||||
|
||||
@@ -1576,7 +1576,7 @@ MGAGSavePalette(ScrnInfoPtr pScrn, unsigned char* pntr)
|
||||
* This function restores a video mode. It basically writes out all of
|
||||
* the registers that have previously been saved.
|
||||
*/
|
||||
static void
|
||||
static void
|
||||
MGAGRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
|
||||
Bool restoreFonts)
|
||||
{
|
||||
@@ -1595,7 +1595,7 @@ MGAGRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
|
||||
* VESA modes. MATROX: hint, hint.
|
||||
*/
|
||||
if (MGAISGx50(pMga) && mgaReg->Clock) {
|
||||
/*
|
||||
/*
|
||||
* With HALlib program only when restoring to console!
|
||||
* To test this we check for Clock == 0.
|
||||
*/
|
||||
@@ -1617,8 +1617,8 @@ MGAGRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
|
||||
/*
|
||||
* Code is needed to get things back to bank zero.
|
||||
*/
|
||||
|
||||
/* restore DAC registers
|
||||
|
||||
/* restore DAC registers
|
||||
* according to the docs we shouldn't write to reserved regs*/
|
||||
for (i = 0; i < DACREGSIZE; i++) {
|
||||
if( (i <= 0x03) ||
|
||||
@@ -1633,17 +1633,17 @@ MGAGRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
|
||||
(MGAISGx50(pMga) && !mgaReg->PIXPLLCSaved &&
|
||||
((i == 0x2c) || (i == 0x2d) || (i == 0x2e) ||
|
||||
(i == 0x4c) || (i == 0x4d) || (i == 0x4e))))
|
||||
continue;
|
||||
continue;
|
||||
if (pMga->is_G200SE
|
||||
&& ((i == 0x2C) || (i == 0x2D) || (i == 0x2E)))
|
||||
continue;
|
||||
if ( (pMga->is_G200EV || pMga->is_G200WB || pMga->is_G200EH) &&
|
||||
(i >= 0x44) && (i <= 0x4E))
|
||||
continue;
|
||||
|
||||
|
||||
outMGAdac(i, mgaReg->DacRegs[i]);
|
||||
}
|
||||
|
||||
|
||||
if (pMga->is_G200ER)
|
||||
{
|
||||
outMGAdac(0x90, mgaReg->Dac_Index90);
|
||||
@@ -1653,18 +1653,18 @@ MGAGRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
|
||||
usleep(500);
|
||||
outMGAdac( 0x1a, 0x01);
|
||||
}
|
||||
|
||||
|
||||
if (!MGAISGx50(pMga)) {
|
||||
/* restore pci_option register */
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
pci_device_cfg_write_bits(pMga->PciInfo, optionMask,
|
||||
pci_device_cfg_write_bits(pMga->PciInfo, optionMask,
|
||||
mgaReg->Option, PCI_OPTION_REG);
|
||||
|
||||
if (pMga->Chipset != PCI_CHIP_MGA1064) {
|
||||
pci_device_cfg_write_bits(pMga->PciInfo, OPTION2_MASK,
|
||||
mgaReg->Option2, PCI_MGA_OPTION2);
|
||||
|
||||
if (pMga->Chipset == PCI_CHIP_MGAG400
|
||||
if (pMga->Chipset == PCI_CHIP_MGAG400
|
||||
|| pMga->Chipset == PCI_CHIP_MGAG550) {
|
||||
pci_device_cfg_write_bits(pMga->PciInfo, OPTION3_MASK,
|
||||
mgaReg->Option3,
|
||||
@@ -1685,7 +1685,7 @@ MGAGRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
|
||||
}
|
||||
|
||||
if (pMga->is_G200ER) {
|
||||
MGAG200ERPIXPLLSET(pScrn, mgaReg);
|
||||
MGAG200ERPIXPLLSET(pScrn, mgaReg);
|
||||
} else if (pMga->is_G200EV) {
|
||||
MGAG200EVPIXPLLSET(pScrn, mgaReg);
|
||||
} else if (pMga->is_G200WB) {
|
||||
@@ -1700,7 +1700,7 @@ MGAGRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
|
||||
|
||||
if (pMga->is_G200ER) {
|
||||
OUTREG8(MGAREG_CRTCEXT_INDEX, 0x24);
|
||||
OUTREG8(MGAREG_CRTCEXT_DATA, mgaReg->ExtVga_MgaReq);
|
||||
OUTREG8(MGAREG_CRTCEXT_DATA, mgaReg->ExtVga_MgaReq);
|
||||
}
|
||||
|
||||
if (pMga->is_G200WB) {
|
||||
@@ -1708,7 +1708,7 @@ MGAGRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
|
||||
{
|
||||
OUTREG8(MGAREG_CRTCEXT_INDEX, 0x34);
|
||||
OUTREG8(MGAREG_CRTCEXT_DATA, mgaReg->ExtVga_MgaReq);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* This handles restoring the generic VGA registers. */
|
||||
@@ -1720,14 +1720,14 @@ MGAGRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
|
||||
vgaHWRestore(pScrn, vgaReg,
|
||||
VGA_SR_MODE | (restoreFonts ? VGA_SR_FONTS : 0));
|
||||
}
|
||||
MGAGRestorePalette(pScrn, vgaReg->DAC);
|
||||
|
||||
MGAGRestorePalette(pScrn, vgaReg->DAC);
|
||||
|
||||
|
||||
if (pMga->is_G200EV) {
|
||||
OUTREG16(MGAREG_CRTCEXT_INDEX, 6);
|
||||
OUTREG16(MGAREG_CRTCEXT_DATA, 0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* this is needed to properly restore start address
|
||||
*/
|
||||
@@ -1744,11 +1744,11 @@ MGAGRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
|
||||
memset( &ModeInfo, 0, sizeof(ModeInfo) );
|
||||
|
||||
/* Enable Dual Head */
|
||||
MGACRTC2Set(pScrn, &ModeInfo);
|
||||
MGAEnableSecondOutPut(pScrn, &ModeInfo);
|
||||
MGACRTC2SetPitch(pScrn, &ModeInfo);
|
||||
MGACRTC2Set(pScrn, &ModeInfo);
|
||||
MGAEnableSecondOutPut(pScrn, &ModeInfo);
|
||||
MGACRTC2SetPitch(pScrn, &ModeInfo);
|
||||
MGACRTC2SetDisplayStart(pScrn, &ModeInfo,0,0,0);
|
||||
|
||||
|
||||
for (i = 0x80; i <= 0xa0; i ++) {
|
||||
if (i== 0x8d) {
|
||||
i = 0x8f;
|
||||
@@ -1757,9 +1757,9 @@ MGAGRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
|
||||
outMGAdac(i, mgaReg->dac2[ i - 0x80]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
ErrorF("Setting DAC:");
|
||||
for (i=0; i<DACREGSIZE; i++) {
|
||||
#if 1
|
||||
@@ -1776,7 +1776,7 @@ MGAGRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
|
||||
for (i=0; i<6; i++) ErrorF(" %02X", mgaReg->ExtVga[i]);
|
||||
ErrorF("\n");
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1817,7 +1817,7 @@ MGAGSave(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
|
||||
* Code is needed to get back to bank zero.
|
||||
*/
|
||||
OUTREG16(MGAREG_CRTCEXT_INDEX, 0x0004);
|
||||
|
||||
|
||||
/*
|
||||
* This function will handle creating the data structure and filling
|
||||
* in the generic VGA portion.
|
||||
@@ -1831,7 +1831,7 @@ MGAGSave(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
|
||||
(saveFonts ? VGA_SR_FONTS : 0));
|
||||
}
|
||||
MGAGSavePalette(pScrn, vgaReg->DAC);
|
||||
/*
|
||||
/*
|
||||
* Work around another bug in HALlib: it doesn't restore the
|
||||
* DAC width register correctly.
|
||||
*/
|
||||
@@ -1891,16 +1891,16 @@ MGAGSave(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
|
||||
OUTREG8(MGAREG_CRTCEXT_INDEX, 0x24);
|
||||
mgaReg->ExtVga_MgaReq = INREG8(MGAREG_CRTCEXT_DATA);
|
||||
}
|
||||
if (pMga->is_G200WB)
|
||||
if (pMga->is_G200WB)
|
||||
{
|
||||
if(pMga->Chipset == PCI_CHIP_MGAG200_EW3_PCI)
|
||||
{
|
||||
OUTREG8(MGAREG_CRTCEXT_INDEX, 0x34);
|
||||
mgaReg->ExtVga_MgaReq = INREG8(MGAREG_CRTCEXT_DATA);
|
||||
mgaReg->ExtVga_MgaReq = INREG8(MGAREG_CRTCEXT_DATA);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
ErrorF("Saved values:\nDAC:");
|
||||
for (i=0; i<DACREGSIZE; i++) {
|
||||
#if 1
|
||||
@@ -1927,7 +1927,7 @@ MGAGLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
|
||||
MGAPtr pMga = MGAPTR(pScrn);
|
||||
CARD32 *dst = (CARD32*)(pMga->FbBase + pMga->FbCursorOffset);
|
||||
int i = 128;
|
||||
|
||||
|
||||
/* swap bytes in each line */
|
||||
while( i-- ) {
|
||||
*dst++ = (src[4] << 24) | (src[5] << 16) | (src[6] << 8) | src[7];
|
||||
@@ -1936,7 +1936,7 @@ MGAGLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
MGAGShowCursor(ScrnInfoPtr pScrn)
|
||||
{
|
||||
MGAPtr pMga = MGAPTR(pScrn);
|
||||
@@ -1944,7 +1944,7 @@ MGAGShowCursor(ScrnInfoPtr pScrn)
|
||||
outMGAdac(MGA1064_CURSOR_CTL, 0x03);
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
MGAGShowCursorG100(ScrnInfoPtr pScrn)
|
||||
{
|
||||
MGAPtr pMga = MGAPTR(pScrn);
|
||||
@@ -1969,7 +1969,7 @@ MGAGSetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
|
||||
|
||||
/* cursor update must never occurs during a retrace period (pp 4-160) */
|
||||
while( INREG( MGAREG_Status ) & 0x08 );
|
||||
|
||||
|
||||
/* Output position - "only" 12 bits of location documented */
|
||||
OUTREG8( RAMDAC_OFFSET + MGA1064_CUR_XLOW, (x & 0xFF));
|
||||
OUTREG8( RAMDAC_OFFSET + MGA1064_CUR_XHI, (x & 0xF00) >> 8);
|
||||
@@ -2010,7 +2010,7 @@ MGAGSetCursorColorsG100(ScrnInfoPtr pScrn, int bg, int fg)
|
||||
outMGAdac(MGA1064_CURSOR_COL2_BLUE, (fg & 0x000000FF));
|
||||
}
|
||||
|
||||
static Bool
|
||||
static Bool
|
||||
MGAGUseHWCursor(ScreenPtr pScrn, CursorPtr pCurs)
|
||||
{
|
||||
MGAPtr pMga = MGAPTR(xf86ScreenToScrn(pScrn));
|
||||
@@ -2034,7 +2034,7 @@ MGAGUseHWCursor(ScreenPtr pScrn, CursorPtr pCurs)
|
||||
* If we want DDC on second head (P2) then we must use DDC2 protocol (I2C)
|
||||
*
|
||||
* Be careful, DDC1 and DDC2 refer to protocols, DDC_P1 and DDC_P2 refer to
|
||||
* DDC data coming in on which videoport on the card
|
||||
* DDC data coming in on which videoport on the card
|
||||
*/
|
||||
#define DDC_P1_SDA_MASK (1 << 1)
|
||||
#define DDC_P1_SCL_MASK (1 << 3)
|
||||
@@ -2066,7 +2066,7 @@ MGAG_ddc1Read(ScrnInfoPtr pScrn)
|
||||
i2c_index = 0;
|
||||
|
||||
const struct mgag_i2c_private *p = & i2c_priv[i2c_index];
|
||||
|
||||
|
||||
/* Define the SDA as an input */
|
||||
outMGAdacmsk(MGA1064_GEN_IO_CTL, ~(p->scl_mask | p->sda_mask), 0);
|
||||
|
||||
@@ -2091,10 +2091,10 @@ MGAG_I2CGetBits(I2CBusPtr b, int *clock, int *data)
|
||||
const struct mgag_i2c_private *p =
|
||||
(struct mgag_i2c_private *) b->DriverPrivate.ptr;
|
||||
unsigned char val;
|
||||
|
||||
|
||||
/* Get the result. */
|
||||
val = inMGAdac(MGA1064_GEN_IO_DATA);
|
||||
|
||||
|
||||
*clock = (val & p->scl_mask) != 0;
|
||||
*data = (val & p->sda_mask) != 0;
|
||||
#ifdef DEBUG
|
||||
@@ -2110,7 +2110,7 @@ MGAG_I2CGetBits(I2CBusPtr b, int *clock, int *data)
|
||||
static void
|
||||
MGAG_I2CPutBits(I2CBusPtr b, int clock, int data)
|
||||
{
|
||||
ScrnInfoPtr pScrn = xf86Screens[b->scrnIndex];
|
||||
ScrnInfoPtr pScrn = xf86Screens[b->scrnIndex];
|
||||
MGAPtr pMga = MGAPTR(pScrn);
|
||||
const struct mgag_i2c_private *p =
|
||||
(struct mgag_i2c_private *) b->DriverPrivate.ptr;
|
||||
@@ -2146,11 +2146,11 @@ mgag_create_i2c_bus(char *name, unsigned bus_index, unsigned scrn_index)
|
||||
I2CPtr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return I2CPtr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Bool
|
||||
MGAG_i2cInit(ScrnInfoPtr pScrn)
|
||||
{
|
||||
@@ -2216,7 +2216,7 @@ MGAG_i2cInit(ScrnInfoPtr pScrn)
|
||||
}
|
||||
|
||||
if (pMga->Maven == NULL) {
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
|
||||
"Failed to register MGA-TVO I2C device!\n");
|
||||
}
|
||||
}
|
||||
@@ -2243,7 +2243,7 @@ MGAGRamdacInit(ScrnInfoPtr pScrn)
|
||||
MGAdac->SetCursorPosition = MGAGSetCursorPosition;
|
||||
MGAdac->LoadCursorImage = MGAGLoadCursorImage;
|
||||
MGAdac->HideCursor = MGAGHideCursor;
|
||||
if ((pMga->Chipset == PCI_CHIP_MGAG100)
|
||||
if ((pMga->Chipset == PCI_CHIP_MGAG100)
|
||||
|| (pMga->Chipset == PCI_CHIP_MGAG100)) {
|
||||
MGAdac->SetCursorColors = MGAGSetCursorColorsG100;
|
||||
MGAdac->ShowCursor = MGAGShowCursorG100;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "dgaproc.h"
|
||||
|
||||
|
||||
static Bool MGA_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **,
|
||||
static Bool MGA_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **,
|
||||
int *, int *, int *);
|
||||
static Bool MGA_SetMode(ScrnInfoPtr, DGAModePtr);
|
||||
static int MGA_GetViewport(ScrnInfoPtr);
|
||||
@@ -34,14 +34,14 @@ FindSmallestPitch(
|
||||
int Bpp,
|
||||
int width
|
||||
){
|
||||
int Pitches1[] =
|
||||
int Pitches1[] =
|
||||
{640, 768, 800, 960, 1024, 1152, 1280, 1600, 1920, 2048, 0};
|
||||
int Pitches2[] =
|
||||
{512, 640, 768, 800, 832, 960, 1024, 1152, 1280, 1600, 1664,
|
||||
int Pitches2[] =
|
||||
{512, 640, 768, 800, 832, 960, 1024, 1152, 1280, 1600, 1664,
|
||||
1920, 2048, 0};
|
||||
int *linePitches = NULL;
|
||||
int pitch;
|
||||
|
||||
|
||||
|
||||
if(!pMga->NoAccel) {
|
||||
switch(pMga->Chipset) {
|
||||
@@ -62,9 +62,9 @@ FindSmallestPitch(
|
||||
while((*linePitches < width) || (*linePitches & pitch))
|
||||
linePitches++;
|
||||
return *linePitches;
|
||||
}
|
||||
}
|
||||
|
||||
return ((width + pitch) & ~pitch);
|
||||
return ((width + pitch) & ~pitch);
|
||||
}
|
||||
|
||||
static DGAModePtr
|
||||
@@ -92,7 +92,7 @@ SECOND_PASS:
|
||||
|
||||
while(1) {
|
||||
|
||||
|
||||
|
||||
pitch = FindSmallestPitch(pMga, Bpp, pMode->HDisplay);
|
||||
size = pitch * Bpp * pMode->VDisplay;
|
||||
|
||||
@@ -100,7 +100,7 @@ SECOND_PASS:
|
||||
(size <= pMga->FbUsableSize)) {
|
||||
|
||||
if(secondPitch)
|
||||
pitch = secondPitch;
|
||||
pitch = secondPitch;
|
||||
|
||||
if(!(newmodes = realloc(modes, (*num + 1) * sizeof(DGAModeRec))))
|
||||
break;
|
||||
@@ -126,7 +126,7 @@ SECOND_PASS:
|
||||
mode->viewportWidth = pMode->HDisplay;
|
||||
mode->viewportHeight = pMode->VDisplay;
|
||||
mode->xViewportStep = (3 - pMga->BppShifts[Bpp - 1]);
|
||||
if((Bpp == 3) &&
|
||||
if((Bpp == 3) &&
|
||||
(pMga->Chipset == PCI_CHIP_MGAG400 || pMga->Chipset == PCI_CHIP_MGAG550))
|
||||
mode->xViewportStep <<= 1;
|
||||
mode->yViewportStep = 1;
|
||||
@@ -135,7 +135,7 @@ SECOND_PASS:
|
||||
mode->address = pMga->FbStart;
|
||||
mode->bytesPerScanline = pitch * Bpp;
|
||||
mode->imageWidth = pitch;
|
||||
mode->imageHeight = pMga->FbUsableSize / mode->bytesPerScanline;
|
||||
mode->imageHeight = pMga->FbUsableSize / mode->bytesPerScanline;
|
||||
mode->pixmapWidth = pitch;
|
||||
switch (pMga->Chipset) {
|
||||
case PCI_CHIP_MGAG200_SE_A_PCI:
|
||||
@@ -144,7 +144,7 @@ SECOND_PASS:
|
||||
mode->bytesPerScanline;
|
||||
break;
|
||||
default:
|
||||
mode->pixmapHeight = (min(pMga->FbUsableSize, 16*1024*1024)) /
|
||||
mode->pixmapHeight = (min(pMga->FbUsableSize, 16*1024*1024)) /
|
||||
mode->bytesPerScanline;
|
||||
}
|
||||
mode->maxViewportX = mode->imageWidth - mode->viewportWidth;
|
||||
@@ -153,7 +153,7 @@ SECOND_PASS:
|
||||
|
||||
if( (pMga->Chipset == PCI_CHIP_MGA2064) ||
|
||||
(pMga->Chipset == PCI_CHIP_MGA2164) ||
|
||||
(pMga->Chipset == PCI_CHIP_MGA2164_AGP))
|
||||
(pMga->Chipset == PCI_CHIP_MGA2164_AGP))
|
||||
{
|
||||
int tmp;
|
||||
|
||||
@@ -183,58 +183,58 @@ SECOND_PASS:
|
||||
|
||||
Bool
|
||||
MGADGAInit(ScreenPtr pScreen)
|
||||
{
|
||||
{
|
||||
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
|
||||
MGAPtr pMga = MGAPTR(pScrn);
|
||||
DGAModePtr modes = NULL;
|
||||
int num = 0;
|
||||
|
||||
/* 8 */
|
||||
modes = MGASetupDGAMode (pScrn, modes, &num, 8, 8,
|
||||
modes = MGASetupDGAMode (pScrn, modes, &num, 8, 8,
|
||||
(pScrn->bitsPerPixel == 8),
|
||||
(pScrn->bitsPerPixel != 8) ? 0 : pScrn->displayWidth,
|
||||
0, 0, 0, PseudoColor);
|
||||
|
||||
/* 15 */
|
||||
modes = MGASetupDGAMode (pScrn, modes, &num, 16, 15,
|
||||
modes = MGASetupDGAMode (pScrn, modes, &num, 16, 15,
|
||||
(pScrn->bitsPerPixel == 16),
|
||||
(pScrn->depth != 15) ? 0 : pScrn->displayWidth,
|
||||
0x7c00, 0x03e0, 0x001f, TrueColor);
|
||||
|
||||
modes = MGASetupDGAMode (pScrn, modes, &num, 16, 15,
|
||||
modes = MGASetupDGAMode (pScrn, modes, &num, 16, 15,
|
||||
(pScrn->bitsPerPixel == 16),
|
||||
(pScrn->depth != 15) ? 0 : pScrn->displayWidth,
|
||||
0x7c00, 0x03e0, 0x001f, DirectColor);
|
||||
|
||||
/* 16 */
|
||||
modes = MGASetupDGAMode (pScrn, modes, &num, 16, 16,
|
||||
modes = MGASetupDGAMode (pScrn, modes, &num, 16, 16,
|
||||
(pScrn->bitsPerPixel == 16),
|
||||
(pScrn->depth != 16) ? 0 : pScrn->displayWidth,
|
||||
0xf800, 0x07e0, 0x001f, TrueColor);
|
||||
|
||||
modes = MGASetupDGAMode (pScrn, modes, &num, 16, 16,
|
||||
modes = MGASetupDGAMode (pScrn, modes, &num, 16, 16,
|
||||
(pScrn->bitsPerPixel == 16),
|
||||
(pScrn->depth != 16) ? 0 : pScrn->displayWidth,
|
||||
0xf800, 0x07e0, 0x001f, DirectColor);
|
||||
|
||||
/* 24 */
|
||||
modes = MGASetupDGAMode (pScrn, modes, &num, 24, 24,
|
||||
modes = MGASetupDGAMode (pScrn, modes, &num, 24, 24,
|
||||
(pScrn->bitsPerPixel == 24),
|
||||
(pScrn->bitsPerPixel != 24) ? 0 : pScrn->displayWidth,
|
||||
0xff0000, 0x00ff00, 0x0000ff, TrueColor);
|
||||
|
||||
modes = MGASetupDGAMode (pScrn, modes, &num, 24, 24,
|
||||
modes = MGASetupDGAMode (pScrn, modes, &num, 24, 24,
|
||||
(pScrn->bitsPerPixel == 24),
|
||||
(pScrn->bitsPerPixel != 24) ? 0 : pScrn->displayWidth,
|
||||
0xff0000, 0x00ff00, 0x0000ff, DirectColor);
|
||||
|
||||
/* 32 */
|
||||
modes = MGASetupDGAMode (pScrn, modes, &num, 32, 24,
|
||||
modes = MGASetupDGAMode (pScrn, modes, &num, 32, 24,
|
||||
(pScrn->bitsPerPixel == 32),
|
||||
(pScrn->bitsPerPixel != 32) ? 0 : pScrn->displayWidth,
|
||||
0xff0000, 0x00ff00, 0x0000ff, TrueColor);
|
||||
|
||||
modes = MGASetupDGAMode (pScrn, modes, &num, 32, 24,
|
||||
modes = MGASetupDGAMode (pScrn, modes, &num, 32, 24,
|
||||
(pScrn->bitsPerPixel == 32),
|
||||
(pScrn->bitsPerPixel != 32) ? 0 : pScrn->displayWidth,
|
||||
0xff0000, 0x00ff00, 0x0000ff, DirectColor);
|
||||
@@ -242,18 +242,18 @@ MGADGAInit(ScreenPtr pScreen)
|
||||
pMga->numDGAModes = num;
|
||||
pMga->DGAModes = modes;
|
||||
|
||||
return DGAInit(pScreen, &MGA_DGAFuncs, modes, num);
|
||||
return DGAInit(pScreen, &MGA_DGAFuncs, modes, num);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
static int
|
||||
BitsSet(unsigned long data)
|
||||
{
|
||||
unsigned long mask;
|
||||
int set = 0;
|
||||
|
||||
for(mask = 1; mask; mask <<= 1)
|
||||
if(mask & data) set++;
|
||||
if(mask & data) set++;
|
||||
|
||||
return set;
|
||||
}
|
||||
@@ -269,10 +269,10 @@ mgaDGASetPalette(ScrnInfoPtr pScrn)
|
||||
MGARamdacPtr MGAdac = &pMga->Dac;
|
||||
unsigned char DAC[256*3];
|
||||
int i;
|
||||
|
||||
|
||||
if (!MGAdac->RestorePalette)
|
||||
return;
|
||||
|
||||
|
||||
for (i = 0; i < 256; i++) {
|
||||
DAC[i*3] = i;
|
||||
DAC[i*3 + 1] = i;
|
||||
@@ -295,7 +295,7 @@ MGA_SetMode(
|
||||
if(!pMode) { /* restore the original mode */
|
||||
if(pMga->DGAactive)
|
||||
memcpy(&pMga->CurrentLayout, &SavedLayouts[index], sizeof(MGAFBLayout));
|
||||
|
||||
|
||||
pScrn->currentMode = pMga->CurrentLayout.mode;
|
||||
pScrn->SwitchMode(SWITCH_MODE_ARGS(pScrn, pScrn->currentMode));
|
||||
MGAAdjustFrame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0));
|
||||
@@ -308,7 +308,7 @@ MGA_SetMode(
|
||||
/* update CurrentLayout */
|
||||
pMga->CurrentLayout.bitsPerPixel = pMode->bitsPerPixel;
|
||||
pMga->CurrentLayout.depth = pMode->depth;
|
||||
pMga->CurrentLayout.displayWidth = pMode->bytesPerScanline /
|
||||
pMga->CurrentLayout.displayWidth = pMode->bytesPerScanline /
|
||||
(pMode->bitsPerPixel >> 3);
|
||||
pMga->CurrentLayout.weight.red = BitsSet(pMode->red_mask);
|
||||
pMga->CurrentLayout.weight.green = BitsSet(pMode->green_mask);
|
||||
@@ -319,13 +319,13 @@ MGA_SetMode(
|
||||
/* not strictly required but nice */
|
||||
mgaDGASetPalette(pScrn);
|
||||
}
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
static int
|
||||
MGA_GetViewport(
|
||||
ScrnInfoPtr pScrn
|
||||
){
|
||||
@@ -334,10 +334,10 @@ MGA_GetViewport(
|
||||
return pMga->DGAViewportStatus;
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
MGA_SetViewport(
|
||||
ScrnInfoPtr pScrn,
|
||||
int x, int y,
|
||||
ScrnInfoPtr pScrn,
|
||||
int x, int y,
|
||||
int flags
|
||||
){
|
||||
MGAPtr pMga = MGAPTR(pScrn);
|
||||
@@ -346,9 +346,9 @@ MGA_SetViewport(
|
||||
pMga->DGAViewportStatus = 0; /* MGAAdjustFrame loops until finished */
|
||||
}
|
||||
|
||||
static Bool
|
||||
static Bool
|
||||
MGA_OpenFramebuffer(
|
||||
ScrnInfoPtr pScrn,
|
||||
ScrnInfoPtr pScrn,
|
||||
char **name,
|
||||
unsigned char **mem,
|
||||
int *size,
|
||||
|
||||
152
src/mga_dh.c
152
src/mga_dh.c
@@ -1,5 +1,5 @@
|
||||
/*********************************************************************
|
||||
* G450: This is for Dual Head.
|
||||
* G450: This is for Dual Head.
|
||||
* Matrox Graphics
|
||||
* Author : Luugi Marsan
|
||||
**********************************************************************/
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "xf86.h"
|
||||
#include "xf86_OSproc.h"
|
||||
|
||||
/* Drivers that need to access the PCI config space directly need this */
|
||||
/* Drivers that need to access the PCI config space directly need this */
|
||||
#include "xf86Pci.h"
|
||||
|
||||
#include "mga_reg.h"
|
||||
@@ -76,11 +76,11 @@
|
||||
/* Does not write to the hard yet */
|
||||
void MGACRTC2Get(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo)
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
MGAPtr pMga = MGAPTR(pScrn);
|
||||
MGARegPtr pReg = &pMga->ModeReg;
|
||||
|
||||
|
||||
xMODEINFO tmpModeInfo;
|
||||
CARD32 ulHTotal;
|
||||
CARD32 ulHDispEnd;
|
||||
@@ -96,47 +96,47 @@ void MGACRTC2Get(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo)
|
||||
CARD32 ulCtl2;
|
||||
CARD32 ulDataCtl2;
|
||||
CARD32 ulDispHeight = pModeInfo->ulDispHeight;
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
#ifdef DEBUG
|
||||
ErrorF("ENTER MGACRTC2Get\n");
|
||||
#endif
|
||||
|
||||
|
||||
tmpModeInfo = *pModeInfo;
|
||||
|
||||
|
||||
|
||||
|
||||
/* First compute the Values */
|
||||
|
||||
|
||||
ulHTotal = tmpModeInfo.ulDispWidth +
|
||||
tmpModeInfo.ulHFPorch +
|
||||
tmpModeInfo.ulHBPorch +
|
||||
tmpModeInfo.ulHSync;
|
||||
|
||||
|
||||
ulHDispEnd = tmpModeInfo.ulDispWidth;
|
||||
ulHBlkStr = ulHDispEnd;
|
||||
ulHSyncStr = ulHBlkStr + tmpModeInfo.ulHFPorch;
|
||||
ulHSyncEnd = ulHSyncStr + tmpModeInfo.ulHSync;
|
||||
|
||||
|
||||
ulVTotal = ulDispHeight +
|
||||
tmpModeInfo.ulVFPorch +
|
||||
tmpModeInfo.ulVBPorch +
|
||||
tmpModeInfo.ulVSync;
|
||||
|
||||
|
||||
|
||||
|
||||
ulVDispEnd = ulDispHeight;
|
||||
ulVBlkStr = ulVDispEnd;
|
||||
ulVSyncStr = ulVBlkStr + tmpModeInfo.ulVFPorch;
|
||||
ulVSyncEnd = ulVSyncStr + tmpModeInfo.ulVSync;
|
||||
|
||||
|
||||
ulOffset = tmpModeInfo.ulFBPitch;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ulCtl2 = INREG(MGAREG_C2CTL);
|
||||
ulDataCtl2 = INREG(MGAREG_C2DATACTL);
|
||||
|
||||
|
||||
ulCtl2 &= 0xFF1FFFFF;
|
||||
ulDataCtl2 &= 0xFFFFFF00;
|
||||
|
||||
|
||||
switch (tmpModeInfo.ulBpp)
|
||||
{
|
||||
case 15: ulCtl2 |= 0x00200000;
|
||||
@@ -149,65 +149,65 @@ void MGACRTC2Get(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo)
|
||||
ulOffset <<= 2;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
pReg->crtc2[ MGAREG2_C2CTL ] = ulCtl2;
|
||||
pReg->crtc2[ MGAREG2_C2DATACTL ] = ulDataCtl2;
|
||||
|
||||
|
||||
/* Horizontal Value*/
|
||||
pReg->crtc2[MGAREG2_C2HPARAM] = (((ulHDispEnd-8) << 16) | (ulHTotal-8)) ;
|
||||
pReg->crtc2[MGAREG2_C2HSYNC] = (((ulHSyncEnd-8) << 16) | (ulHSyncStr-8)) ;
|
||||
|
||||
|
||||
pReg->crtc2[MGAREG2_C2HSYNC] = (((ulHSyncEnd-8) << 16) | (ulHSyncStr-8)) ;
|
||||
|
||||
|
||||
/*Vertical Value*/
|
||||
pReg->crtc2[MGAREG2_C2VPARAM] = (((ulVDispEnd-1) << 16) | (ulVTotal-1)) ;
|
||||
pReg->crtc2[MGAREG2_C2VSYNC] = (((ulVSyncEnd-1) << 16) | (ulVSyncStr-1)) ;
|
||||
|
||||
pReg->crtc2[MGAREG2_C2VPARAM] = (((ulVDispEnd-1) << 16) | (ulVTotal-1)) ;
|
||||
pReg->crtc2[MGAREG2_C2VSYNC] = (((ulVSyncEnd-1) << 16) | (ulVSyncStr-1)) ;
|
||||
|
||||
/** Offset value*/
|
||||
|
||||
|
||||
pReg->crtc2[MGAREG2_C2OFFSET] = ulOffset;
|
||||
|
||||
#ifdef DEBUG
|
||||
ErrorF("EXIT MGACRTC2Get\n");
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* Set CRTC 2*/
|
||||
/* Writes to the hardware */
|
||||
void MGACRTC2Set(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo)
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
MGAPtr pMga = MGAPTR(pScrn);
|
||||
MGARegPtr pReg = &pMga->ModeReg;
|
||||
|
||||
#ifdef DEBUG
|
||||
ErrorF("ENTER MGACRTC2Set\n");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* This writes to the registers manually */
|
||||
OUTREG(MGAREG_C2CTL, pReg->crtc2[MGAREG2_C2CTL]);
|
||||
OUTREG(MGAREG_C2DATACTL,pReg->crtc2[MGAREG2_C2DATACTL]);
|
||||
|
||||
|
||||
OUTREG(MGAREG_C2CTL, pReg->crtc2[MGAREG2_C2CTL]);
|
||||
OUTREG(MGAREG_C2DATACTL,pReg->crtc2[MGAREG2_C2DATACTL]);
|
||||
|
||||
|
||||
/* Horizontal Value*/
|
||||
OUTREG(MGAREG_C2HPARAM, pReg->crtc2[MGAREG2_C2HPARAM]);
|
||||
OUTREG(MGAREG_C2HSYNC, pReg->crtc2[MGAREG2_C2HSYNC]);
|
||||
|
||||
|
||||
OUTREG(MGAREG_C2HPARAM, pReg->crtc2[MGAREG2_C2HPARAM]);
|
||||
OUTREG(MGAREG_C2HSYNC, pReg->crtc2[MGAREG2_C2HSYNC]);
|
||||
|
||||
|
||||
/*Vertical Value*/
|
||||
OUTREG(MGAREG_C2VPARAM, pReg->crtc2[MGAREG2_C2VPARAM]);
|
||||
OUTREG(MGAREG_C2VSYNC, pReg->crtc2[MGAREG2_C2VSYNC]);
|
||||
|
||||
OUTREG(MGAREG_C2VPARAM, pReg->crtc2[MGAREG2_C2VPARAM]);
|
||||
OUTREG(MGAREG_C2VSYNC, pReg->crtc2[MGAREG2_C2VSYNC]);
|
||||
|
||||
/** Offset value*/
|
||||
|
||||
|
||||
OUTREG(MGAREG_C2OFFSET, pReg->crtc2[MGAREG2_C2OFFSET]);
|
||||
#ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
ErrorF("EXIT MGACRTC2Set\n");
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -232,43 +232,43 @@ void MGAEnableSecondOutPut(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo)
|
||||
/*--- Have to wait minimum time (2 access will be ok) */
|
||||
(void) INREG( MGAREG_Status);
|
||||
(void) INREG( MGAREG_Status);
|
||||
|
||||
|
||||
|
||||
|
||||
ulC2CTL &= ~MGAREG_C2CTL_PIXCLKSEL_MASK;
|
||||
ulC2CTL &= ~MGAREG_C2CTL_PIXCLKSELH_MASK;
|
||||
|
||||
|
||||
ulC2CTL |= MGAREG_C2CTL_PIXCLKSEL_VIDEOPLL;
|
||||
|
||||
|
||||
|
||||
OUTREG( MGAREG_C2CTL, ulC2CTL);
|
||||
|
||||
/*--- Enable Pixel clock oscillations on CRTC2*/
|
||||
ulC2CTL &= ~MGAREG_C2CTL_PIXCLKDIS_MASK;
|
||||
OUTREG( MGAREG_C2CTL, ulC2CTL);
|
||||
|
||||
|
||||
|
||||
|
||||
/* We don't use MISC synch pol, must be 0*/
|
||||
ucByte = INREG8( MGAREG_MEM_MISC_READ);
|
||||
|
||||
|
||||
OUTREG8(MGAREG_MEM_MISC_WRITE, (CARD8)(ucByte & ~(HSYNCPOL| VSYNCPOL) ));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* Set Rset to 0.7 V*/
|
||||
ucByte = inMGAdac(MGA1064_GEN_IO_CTL);
|
||||
ucByte &= ~0x40;
|
||||
pReg->DacRegs[MGA1064_GEN_IO_CTL] = ucByte;
|
||||
pReg->DacRegs[MGA1064_GEN_IO_CTL] = ucByte;
|
||||
outMGAdac (MGA1064_GEN_IO_CTL, ucByte);
|
||||
|
||||
|
||||
ucByte = inMGAdac( MGA1064_GEN_IO_DATA);
|
||||
ucByte &= ~0x40;
|
||||
pReg->DacRegs[MGA1064_GEN_IO_DATA]= ucByte;
|
||||
outMGAdac (MGA1064_GEN_IO_DATA, ucByte);
|
||||
|
||||
|
||||
/* Since G550 can swap outputs at BIOS initialisation, we must check which
|
||||
* DAC is 'logically' used as the secondary (don't assume its DAC2 anymore) */
|
||||
|
||||
|
||||
ulC2CTL = INREG(MGAREG_C2CTL);
|
||||
ucXDispCtrl = inMGAdac(MGA1064_DISP_CTL);
|
||||
|
||||
@@ -284,11 +284,11 @@ void MGAEnableSecondOutPut(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo)
|
||||
ucXDispCtrl |= MGA1064_DISP_CTL_DAC2OUTSEL_CRTC2;
|
||||
ulC2CTL &= ~MGAREG_C2CTL_CRTCDACSEL_MASK;
|
||||
}
|
||||
|
||||
|
||||
/* Enable CRTC2*/
|
||||
ulC2CTL |= MGAREG_C2CTL_C2_EN;
|
||||
|
||||
pReg->dac2[ MGA1064_DISP_CTL - 0x80] = ucXDispCtrl;
|
||||
pReg->dac2[ MGA1064_DISP_CTL - 0x80] = ucXDispCtrl;
|
||||
|
||||
|
||||
|
||||
@@ -319,7 +319,7 @@ void MGAEnableSecondOutPut(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo)
|
||||
MGA1064_PWR_CTL_RFIFO_EN |
|
||||
MGA1064_PWR_CTL_CFIFO_EN;
|
||||
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
ErrorF("EXIT MGAEnableSecondOutPut\n");
|
||||
#endif
|
||||
@@ -334,13 +334,13 @@ void MGACRTC2GetPitch (ScrnInfoPtr pScrn, xMODEINFO *pModeInfo)
|
||||
CARD32 ulOffset;
|
||||
MGAPtr pMga = MGAPTR(pScrn);
|
||||
MGARegPtr pReg;
|
||||
|
||||
|
||||
pReg = &pMga->ModeReg;
|
||||
#ifdef DEBUG
|
||||
ErrorF("ENTER MGACRTC2GetPitch\n");
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
switch(pModeInfo->ulBpp)
|
||||
{
|
||||
case 15:
|
||||
@@ -356,7 +356,7 @@ void MGACRTC2GetPitch (ScrnInfoPtr pScrn, xMODEINFO *pModeInfo)
|
||||
}
|
||||
|
||||
pReg->crtc2[MGAREG2_C2OFFSET] = ulOffset;
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
ErrorF("EXIT MGACRTC2GetPitch\n");
|
||||
#endif
|
||||
@@ -369,17 +369,17 @@ void MGACRTC2SetPitch (ScrnInfoPtr pScrn, xMODEINFO *pModeInfo)
|
||||
MGAPtr pMga = MGAPTR(pScrn);
|
||||
MGARegPtr pReg;
|
||||
pReg = &pMga->ModeReg;
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
ErrorF("ENTER CRCT2SetPitch\n");
|
||||
#endif
|
||||
|
||||
|
||||
OUTREG(MGAREG_C2OFFSET, pReg->crtc2[MGAREG2_C2OFFSET]);
|
||||
|
||||
OUTREG(MGAREG_C2OFFSET, pReg->crtc2[MGAREG2_C2OFFSET]);
|
||||
#ifdef DEBUG
|
||||
ErrorF("EXIT CRCT2SetPitch\n");
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -416,7 +416,7 @@ void MGACRTC2GetDisplayStart (ScrnInfoPtr pScrn, xMODEINFO *pModeInfo, CARD32 ba
|
||||
#ifdef DEBUG
|
||||
ErrorF("EXIT MGACRTC2GetDisplayStart\n");
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
void MGACRTC2SetDisplayStart (ScrnInfoPtr pScrn, xMODEINFO *pModeInfo, CARD32 base, CARD32 ulX, CARD32 ulY)
|
||||
@@ -427,12 +427,12 @@ void MGACRTC2SetDisplayStart (ScrnInfoPtr pScrn, xMODEINFO *pModeInfo, CARD32 ba
|
||||
#ifdef DEBUG
|
||||
ErrorF("ENTER MGACRTC2SetDisplayStart\n");
|
||||
#endif
|
||||
|
||||
OUTREG(MGAREG_C2STARTADD0, pReg->crtc2[MGAREG2_C2STARTADD0]);
|
||||
|
||||
OUTREG(MGAREG_C2STARTADD0, pReg->crtc2[MGAREG2_C2STARTADD0]);
|
||||
#ifdef DEBUG
|
||||
ErrorF("EXIT MGACRTC2SetDisplayStart\n");
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ static void MGAWaitForIdleDMA( ScrnInfoPtr pScrn )
|
||||
} while ( ret == -EBUSY && i++ < DRM_MGA_IDLE_RETRY );
|
||||
|
||||
/* if it's still busy just try quiescent */
|
||||
if ( ret == -EBUSY ) {
|
||||
if ( ret == -EBUSY ) {
|
||||
lock.flags = DRM_LOCK_QUIESCENT;
|
||||
do {
|
||||
ret = drmCommandWrite( pMga->drmFD, DRM_MGA_FLUSH,
|
||||
@@ -259,7 +259,7 @@ static unsigned int mylog2( unsigned int n )
|
||||
* \todo
|
||||
* The sizes used for the primary DMA buffer and the bin size and count for
|
||||
* the secondary DMA buffers should be configurable from the xorg.conf.
|
||||
*
|
||||
*
|
||||
* \todo
|
||||
* This routine should use \c mga_bios_values::host_interface to limit the
|
||||
* AGP mode. It the card is PCI, \c MGARec::agpSize should be forced to 0.
|
||||
@@ -333,7 +333,7 @@ static Bool MGADRIBootstrapDMA(ScreenPtr pScreen)
|
||||
xf86DrvMsg( pScreen->myNum, X_ERROR, "[agp] AGP not available\n" );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
mode = drmAgpGetMode( pMga->drmFD ); /* Default mode */
|
||||
vendor = drmAgpVendorId( pMga->drmFD );
|
||||
device = drmAgpDeviceId( pMga->drmFD );
|
||||
@@ -359,7 +359,7 @@ static Bool MGADRIBootstrapDMA(ScreenPtr pScreen)
|
||||
"[drm] Enabling AGP 2x PLL encoding\n" );
|
||||
OUTREG( MGAREG_AGP_PLL, MGA_AGP2XPLL_ENABLE );
|
||||
break;
|
||||
|
||||
|
||||
case 1:
|
||||
default:
|
||||
xf86DrvMsg( pScreen->myNum, X_INFO,
|
||||
@@ -399,7 +399,7 @@ static Bool MGADRIBootstrapDMA(ScreenPtr pScreen)
|
||||
}
|
||||
xf86DrvMsg( pScreen->myNum, X_INFO,
|
||||
"[agp] %d kB allocated with handle 0x%08x\n",
|
||||
pMGADRIServer->agp.size/1024,
|
||||
pMGADRIServer->agp.size/1024,
|
||||
(unsigned int) pMGADRIServer->agp.handle );
|
||||
|
||||
if ( drmAgpBind( pMga->drmFD, pMGADRIServer->agp.handle, 0 ) < 0 ) {
|
||||
@@ -781,7 +781,7 @@ Bool MGADRIScreenInit( ScreenPtr pScreen )
|
||||
|
||||
pDRIInfo->CreateContext = MGACreateContext;
|
||||
pDRIInfo->DestroyContext = MGADestroyContext;
|
||||
if ( xf86IsEntityShared( pScrn->entityList[0] )
|
||||
if ( xf86IsEntityShared( pScrn->entityList[0] )
|
||||
&& pMga->DualHeadEnabled) {
|
||||
pDRIInfo->SwapContext = MGADRISwapContextShared;
|
||||
} else {
|
||||
@@ -876,11 +876,11 @@ Bool MGADRIScreenInit( ScreenPtr pScreen )
|
||||
* support old version of the client-side driver that don't use the
|
||||
* new features of the 3.2 DRM).
|
||||
*/
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
||||
"[drm] Direct rendering on PCI cards requires DRM version 3.2 or higher\n");
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
||||
"[drm] and a recent client-side driver. Also make sure that 'OldDmaInit'\n");
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
||||
"[drm] is not selected in xorg.conf.'\n");
|
||||
return FALSE;
|
||||
}
|
||||
@@ -896,7 +896,7 @@ Bool MGADRIScreenInit( ScreenPtr pScreen )
|
||||
int scratch_int;
|
||||
|
||||
DRIGetDeviceInfo(pScreen, &pMGADRIServer->fb.handle,
|
||||
&scratch_int, &scratch_int,
|
||||
&scratch_int, &scratch_int,
|
||||
&scratch_int, &scratch_int,
|
||||
&scratch_ptr);
|
||||
}
|
||||
|
||||
158
src/mga_driver.c
158
src/mga_driver.c
@@ -43,7 +43,7 @@
|
||||
* Niels Gram Jeppesen
|
||||
* Added digital screen option for first head
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
@@ -138,7 +138,7 @@ static int MGAEntityIndex = -1;
|
||||
|
||||
static const struct mga_device_attributes attribs[] = {
|
||||
/* 2064 */
|
||||
[0] = { 1, 0, 0, 1, 0, 0, 0, 0, old_BARs,
|
||||
[0] = { 1, 0, 0, 1, 0, 0, 0, 0, old_BARs,
|
||||
(BLK_OPAQUE_EXPANSION | FASTBLT_BUG | USE_LINEAR_EXPANSION),
|
||||
{
|
||||
{ 0, 0 }, /* System VCO frequencies */
|
||||
@@ -481,7 +481,7 @@ static SymTabRec MGAChipsets[] = {
|
||||
{ PCI_CHIP_MGAG200_SE_A_PCI, "mgag200 SE A PCI" },
|
||||
{ PCI_CHIP_MGAG200_SE_B_PCI, "mgag200 SE B PCI" },
|
||||
{ PCI_CHIP_MGAG200_EV_PCI, "mgag200 EV Maxim" },
|
||||
{ PCI_CHIP_MGAG200_ER_PCI, "mgag200 ER SH7757" },
|
||||
{ PCI_CHIP_MGAG200_ER_PCI, "mgag200 ER SH7757" },
|
||||
{ PCI_CHIP_MGAG200_WINBOND_PCI, "mgag200 eW Nuvoton" },
|
||||
{ PCI_CHIP_MGAG200_EW3_PCI, "mgag200 eW3 Nuvoton" },
|
||||
{ PCI_CHIP_MGAG200_EH_PCI, "mgag200eH" },
|
||||
@@ -542,7 +542,7 @@ _X_EXPORT DriverRec MGA_C_NAME = {
|
||||
NULL,
|
||||
0,
|
||||
NULL,
|
||||
|
||||
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
mga_device_match,
|
||||
MGAPciProbe
|
||||
@@ -843,7 +843,7 @@ MGAProbe(DriverPtr drv, int flags)
|
||||
if (numUsed <= 0)
|
||||
return FALSE;
|
||||
|
||||
|
||||
|
||||
if (flags & PROBE_DETECT)
|
||||
foundScreen = TRUE;
|
||||
else for (i = 0; i < numUsed; i++) {
|
||||
@@ -892,14 +892,14 @@ MGAProbe(DriverPtr drv, int flags)
|
||||
attrib_no = 0;
|
||||
break;
|
||||
|
||||
case PCI_CHIP_MGA1064:
|
||||
case PCI_CHIP_MGA1064:
|
||||
attrib_no = 1;
|
||||
break;
|
||||
|
||||
case PCI_CHIP_MGA2164:
|
||||
attrib_no = 2;
|
||||
break;
|
||||
|
||||
|
||||
case PCI_CHIP_MGA2164_AGP:
|
||||
attrib_no = 3;
|
||||
break;
|
||||
@@ -947,11 +947,11 @@ MGAProbe(DriverPtr drv, int flags)
|
||||
case PCI_CHIP_MGAG200_EH_PCI:
|
||||
attrib_no = 14;
|
||||
break;
|
||||
|
||||
|
||||
case PCI_CHIP_MGAG200_ER_PCI:
|
||||
attrib_no = 15;
|
||||
break;
|
||||
|
||||
|
||||
case PCI_CHIP_MGAG200_EW3_PCI:
|
||||
attrib_no = 16;
|
||||
break;
|
||||
@@ -1154,7 +1154,7 @@ MGACountRam(ScrnInfoPtr pScrn)
|
||||
uint32_t Option, MaxMapSize;
|
||||
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
pci_device_cfg_read_u32(pMga->PciInfo, &Option,
|
||||
pci_device_cfg_read_u32(pMga->PciInfo, &Option,
|
||||
PCI_OPTION_REG);
|
||||
MaxMapSize = pMga->PciInfo->regions[0].size;
|
||||
#else
|
||||
@@ -1171,7 +1171,7 @@ MGACountRam(ScrnInfoPtr pScrn)
|
||||
ProbeSize = 16*1024;
|
||||
|
||||
if (ProbeSize * 1024 > MaxMapSize)
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
||||
"Fb size from config space doesn't fit option register\n");
|
||||
else {
|
||||
MGAUnmapMem(pScrn);
|
||||
@@ -1298,7 +1298,7 @@ MGAdoDDC(ScrnInfoPtr pScrn)
|
||||
pMga->DDC_Bus2 = NULL;
|
||||
return NULL;
|
||||
}
|
||||
} else
|
||||
} else
|
||||
return NULL;
|
||||
|
||||
/* - DDC can use I2C bus */
|
||||
@@ -1341,7 +1341,7 @@ MGAdoDDC(ScrnInfoPtr pScrn)
|
||||
/* Allow access to DDC */
|
||||
if (pMga->is_G200ER) {
|
||||
CARD8 ucData = inMGAdac(MGA1064_GEN_IO_CTL2);
|
||||
outMGAdac(MGA1064_GEN_IO_CTL2, ucData | 1);
|
||||
outMGAdac(MGA1064_GEN_IO_CTL2, ucData | 1);
|
||||
}
|
||||
|
||||
/* Initialize I2C buses - used by DDC if available */
|
||||
@@ -1354,7 +1354,7 @@ MGAdoDDC(ScrnInfoPtr pScrn)
|
||||
MonInfo = xf86DoEDID_DDC2(XF86_SCRN_ARG(pScrn), pMga->DDC_Bus2);
|
||||
from = "I2C";
|
||||
} else {
|
||||
/* Its the first head... */
|
||||
/* Its the first head... */
|
||||
if (pMga->DDC_Bus1) {
|
||||
MonInfo = xf86DoEDID_DDC2(XF86_SCRN_ARG(pScrn), pMga->DDC_Bus1);
|
||||
from = "I2C";
|
||||
@@ -1387,7 +1387,7 @@ MGAdoDDC(ScrnInfoPtr pScrn)
|
||||
/* Remove access to DDC */
|
||||
if (pMga->is_G200ER) {
|
||||
CARD8 ucData = inMGAdac(MGA1064_GEN_IO_CTL2);
|
||||
outMGAdac(MGA1064_GEN_IO_CTL2, ucData & ~1);
|
||||
outMGAdac(MGA1064_GEN_IO_CTL2, ucData & ~1);
|
||||
}
|
||||
|
||||
/* Restore previous state and unmap MGA memory and MMIO areas */
|
||||
@@ -1411,7 +1411,7 @@ MGAProbeDDC(ScrnInfoPtr pScrn, int index)
|
||||
if (xf86LoadSubModule(pScrn, "vbe")) {
|
||||
pVbe = VBEInit(NULL,index);
|
||||
ConfiguredMonitor = vbeDoEDID(pVbe, NULL);
|
||||
vbeFree(pVbe);
|
||||
vbeFree(pVbe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1570,7 +1570,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
|
||||
|
||||
xf86DrvMsg(pScrn->scrnIndex, from, "Chipset: \"%s\"", pScrn->chipset);
|
||||
if (pMga->Chipset == PCI_CHIP_MGAG400) {
|
||||
if (pMga->ChipRev >= 0x80)
|
||||
if (pMga->ChipRev >= 0x80)
|
||||
xf86ErrorF(" (G450)\n");
|
||||
else
|
||||
xf86ErrorF(" (G400)\n");
|
||||
@@ -1646,7 +1646,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
|
||||
* the second initialisation knows that something has been done before it.
|
||||
* This always assume that the first device initialised is the master
|
||||
* head, and the second the slave.
|
||||
*
|
||||
*
|
||||
*/
|
||||
if (xf86IsEntityShared(pScrn->entityList[0])) { /* dual-head mode */
|
||||
if (!xf86IsPrimInitDone(pScrn->entityList[0])) { /* Is it the first initialisation? */
|
||||
@@ -1892,7 +1892,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
|
||||
pMga->KVM = TRUE;
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Enabling KVM\n");
|
||||
}
|
||||
|
||||
|
||||
#if !defined(__powerpc__)
|
||||
pMga->softbooted = FALSE;
|
||||
Default = (pMga->chip_attribs->dual_head_possible
|
||||
@@ -2011,7 +2011,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
|
||||
if(!MGAISGx50(pMga)) {
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
||||
"\"Merged Framebuffer\" mode only supported on G450 and G550 boards.\n");
|
||||
} else {
|
||||
} else {
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
||||
"HALLib not loaded! NOT using \"Merged Framebuffer\" mode.\n");
|
||||
} /* ISMGAGx50() */
|
||||
@@ -2091,7 +2091,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
|
||||
case PCI_CHIP_MGAG200_EW3_PCI:
|
||||
case PCI_CHIP_MGAG200_EV_PCI:
|
||||
case PCI_CHIP_MGAG200_EH_PCI:
|
||||
case PCI_CHIP_MGAG200_ER_PCI:
|
||||
case PCI_CHIP_MGAG200_ER_PCI:
|
||||
case PCI_CHIP_MGAG200_EH3_PCI:
|
||||
case PCI_CHIP_MGAG400:
|
||||
case PCI_CHIP_MGAG550:
|
||||
@@ -2104,13 +2104,13 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
|
||||
*/
|
||||
|
||||
#if defined(__alpha__) && !defined(XSERVER_LIBPCIACCESS)
|
||||
/*
|
||||
/*
|
||||
* Some old Digital-OEMed Matrox Millennium I cards have a VGA
|
||||
* disable switch. If the disable is on, we can't read the BIOS,
|
||||
* and pMga->BiosAddress = 0x0. The disable switch is needed to
|
||||
* allow multi-head operation with brain-dead console code... ;-}
|
||||
*/
|
||||
|
||||
|
||||
if ((pMga->BiosAddress == 0) && !xf86IsPrimaryPci(pMga->PciInfo))
|
||||
xf86DrvMsg(pScrn->scrnIndex, pMga->BiosFrom,
|
||||
"BIOS not found, skipping read\n");
|
||||
@@ -2123,7 +2123,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
|
||||
* store which DAC this instance of the driver is taking care of. This is done
|
||||
* by checking a flag stored in the ROM by the BIOS at a fixed address. */
|
||||
|
||||
if (!pMga->SecondCrtc)
|
||||
if (!pMga->SecondCrtc)
|
||||
pMga->SecondOutput = FALSE;
|
||||
else
|
||||
pMga->SecondOutput = TRUE;
|
||||
@@ -2179,7 +2179,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
|
||||
pMgaEnt->masterFbAddress = pMga->FbAddress;
|
||||
pMga->FbMapSize =
|
||||
pMgaEnt->masterFbMapSize = pScrn->videoRam * 1024;
|
||||
pMgaEnt->slaveFbAddress = pMga->FbAddress +
|
||||
pMgaEnt->slaveFbAddress = pMga->FbAddress +
|
||||
pMgaEnt->masterFbMapSize;
|
||||
pMgaEnt->slaveFbMapSize = pMgaEnt->slavevideoRam * 1024;
|
||||
pMga->realSrcOrg = pMga->SrcOrg = 0;
|
||||
@@ -2208,7 +2208,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
|
||||
case PCI_CHIP_MGAG200_EV_PCI:
|
||||
case PCI_CHIP_MGAG200_EH_PCI:
|
||||
case PCI_CHIP_MGAG200_EH3_PCI:
|
||||
case PCI_CHIP_MGAG200_ER_PCI:
|
||||
case PCI_CHIP_MGAG200_ER_PCI:
|
||||
pMga->SrcOrg = 0;
|
||||
pMga->DstOrg = 0;
|
||||
break;
|
||||
@@ -2250,7 +2250,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
|
||||
pScrn->monitor->vrefresh[0].hi = 75.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* If the driver can do gamma correction, it should call xf86SetGamma()
|
||||
@@ -2327,7 +2327,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
|
||||
clockRanges->clockIndex = -1; /* programmable */
|
||||
clockRanges->interlaceAllowed = TRUE;
|
||||
clockRanges->doubleScanAllowed = TRUE;
|
||||
if (pMga->SecondCrtc == TRUE)
|
||||
if (pMga->SecondCrtc == TRUE)
|
||||
clockRanges->interlaceAllowed = FALSE;
|
||||
|
||||
clockRanges->ClockMulFactor = 1;
|
||||
@@ -2394,7 +2394,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
|
||||
case PCI_CHIP_MGAG200_EV_PCI:
|
||||
case PCI_CHIP_MGAG200_EH_PCI:
|
||||
case PCI_CHIP_MGAG200_EH3_PCI:
|
||||
case PCI_CHIP_MGAG200_ER_PCI:
|
||||
case PCI_CHIP_MGAG200_ER_PCI:
|
||||
case PCI_CHIP_MGAG400:
|
||||
case PCI_CHIP_MGAG550:
|
||||
maxPitch = 4096;
|
||||
@@ -2410,7 +2410,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
|
||||
pScrn->display->virtualY,
|
||||
pMga->FbMapSize,
|
||||
LOOKUP_BEST_REFRESH);
|
||||
|
||||
|
||||
free(linePitches);
|
||||
}
|
||||
|
||||
@@ -2440,13 +2440,13 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
|
||||
if ((pMga->softbooted || pMga->Primary)
|
||||
&& pMga->chip_attribs->probe_for_sdram) {
|
||||
uint32_t option_reg;
|
||||
|
||||
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
pci_device_cfg_read_u32(pMga->PciInfo, & option_reg,
|
||||
PCI_OPTION_REG);
|
||||
#else
|
||||
option_reg = pciReadLong(pMga->PciTag, PCI_OPTION_REG);
|
||||
#endif
|
||||
#endif
|
||||
pMga->HasSDRAM = ((option_reg & (1 << 14)) == 0);
|
||||
}
|
||||
else {
|
||||
@@ -2545,7 +2545,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
|
||||
pMga->FbUsableSize = pMgaEnt->slaveFbMapSize;
|
||||
pMga->HWCursor = FALSE;
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
pMga->FbUsableSize = pMga->FbMapSize - pMga->YDstOrg * bytesPerPixel;
|
||||
/* Allocate HW cursor buffer at the end of video ram */
|
||||
if( pMga->HWCursor && pMga->Dac.CursorOffscreenMemSize ) {
|
||||
@@ -2604,16 +2604,16 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
|
||||
pMga->CurrentLayout.weight.green = pScrn->weight.green;
|
||||
pMga->CurrentLayout.weight.blue = pScrn->weight.blue;
|
||||
pMga->CurrentLayout.mode = pScrn->currentMode;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(pMga->MergedFB) {
|
||||
MGAPreInitMergedFB(pScrn,flags);
|
||||
}
|
||||
|
||||
|
||||
|
||||
xf86SetPrimInitDone(pScrn->entityList[0]);
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -2758,7 +2758,7 @@ MGAMapMem(ScrnInfoPtr pScrn)
|
||||
0x800000);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -2776,7 +2776,7 @@ MGAUnmapMem(ScrnInfoPtr pScrn)
|
||||
struct pci_device * const dev = pMga->PciInfo;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
if (!pMga->FBDev) {
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
if(pMga->entityPrivate != NULL)
|
||||
@@ -2791,7 +2791,7 @@ MGAUnmapMem(ScrnInfoPtr pScrn)
|
||||
}
|
||||
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "UNMAPPING framebuffer 0x%08llX, 0x%llX.\n", (long long)(uintptr_t)pMga->FbBase, (long long)pMga->FbMapSize);
|
||||
pci_device_unmap_range(dev, pMga->FbBase,
|
||||
pci_device_unmap_range(dev, pMga->FbBase,
|
||||
pMga->FbMapSize);
|
||||
#else
|
||||
xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pMga->IOBase, 0x4000);
|
||||
@@ -2870,7 +2870,7 @@ MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
|
||||
/* if(pMga->MergedFB && mode && mode->Private && (mode->PrivSize == 0)) {
|
||||
mode = (DisplayModePtr)mode->Private;
|
||||
}*/
|
||||
|
||||
|
||||
/* Initialise the ModeReg values */
|
||||
if (!vgaHWInit(pScrn, mode))
|
||||
return FALSE;
|
||||
@@ -2905,8 +2905,8 @@ MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
|
||||
vgaHWProtect(pScrn, FALSE);
|
||||
}
|
||||
|
||||
/* Reset tagfifo*/
|
||||
if (pMga->is_G200ER)
|
||||
/* Reset tagfifo*/
|
||||
if (pMga->is_G200ER)
|
||||
{
|
||||
CARD32 ulMemCtl = INREG(MGAREG_MEMCTL);
|
||||
CARD8 ucSeq1;
|
||||
@@ -2927,12 +2927,12 @@ MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
This function optimize the Priority Request control
|
||||
Higher HiPriLvl will reduce drawing performance
|
||||
We need to give enough bandwidth to crtc to avoid visual artifact
|
||||
*/
|
||||
if (pMga->is_G200SE)
|
||||
if (pMga->is_G200SE)
|
||||
{
|
||||
if (pMga->reg_1e24 >= 0x02)
|
||||
{
|
||||
@@ -2946,16 +2946,16 @@ MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
|
||||
{
|
||||
ulBitsPerPixel = 32;
|
||||
}
|
||||
else if (pScrn->bitsPerPixel > 8)
|
||||
else if (pScrn->bitsPerPixel > 8)
|
||||
{
|
||||
ulBitsPerPixel = 16;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
ulBitsPerPixel = 8;
|
||||
}
|
||||
|
||||
|
||||
|
||||
ulMemoryBandwidth = (mode->Clock * ulBitsPerPixel) / 1000;
|
||||
|
||||
if (pMga->reg_1e24 >= 0x04)
|
||||
@@ -3016,31 +3016,31 @@ MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
|
||||
}
|
||||
|
||||
static
|
||||
void MGARestoreSecondCrtc(ScrnInfoPtr pScrn)
|
||||
void MGARestoreSecondCrtc(ScrnInfoPtr pScrn)
|
||||
{
|
||||
MGAPtr pMga = MGAPTR(pScrn);
|
||||
|
||||
|
||||
if (MGAISGx50(pMga)) {
|
||||
/* Force to return in clone mode */
|
||||
if (pMga->SecondOutput
|
||||
&& (xf86IsEntityShared(pScrn->entityList[0]) || pMga->SecondCrtc)
|
||||
if (pMga->SecondOutput
|
||||
&& (xf86IsEntityShared(pScrn->entityList[0]) || pMga->SecondCrtc)
|
||||
&& !pMga->MergedFB) {
|
||||
/* Do this branch if
|
||||
* SecondOutput
|
||||
* and not Unshared Primary
|
||||
/* Do this branch if
|
||||
* SecondOutput
|
||||
* and not Unshared Primary
|
||||
* and not Merged Mode (usually means Unshared Primary)
|
||||
*/
|
||||
CARD8 ucXDispCtrl = inMGAdac(MGA1064_DISP_CTL);
|
||||
|
||||
|
||||
ucXDispCtrl &= ~MGA1064_DISP_CTL_DAC2OUTSEL_MASK;
|
||||
ucXDispCtrl |= MGA1064_DISP_CTL_DAC2OUTSEL_CRTC1;
|
||||
|
||||
|
||||
outMGAdac(MGA1064_DISP_CTL, ucXDispCtrl);
|
||||
|
||||
|
||||
} else {
|
||||
CARD8 ucXDispCtrl = inMGAdac(MGA1064_DISP_CTL);
|
||||
CARD32 ulC2CTL = INREG(MGAREG_C2CTL);
|
||||
|
||||
|
||||
ucXDispCtrl &= ~MGA1064_DISP_CTL_DAC2OUTSEL_MASK;
|
||||
ucXDispCtrl |= MGA1064_DISP_CTL_DAC1OUTSEL_EN;
|
||||
ucXDispCtrl |= MGA1064_DISP_CTL_DAC2OUTSEL_CRTC1;
|
||||
@@ -3048,15 +3048,15 @@ void MGARestoreSecondCrtc(ScrnInfoPtr pScrn)
|
||||
/* crtcdacsel -> crtc1 */
|
||||
ulC2CTL &= ~MGAREG_C2CTL_CRTCDACSEL_CRTC2;
|
||||
ulC2CTL |= MGAREG_C2CTL_CRTCDACSEL_CRTC1;
|
||||
|
||||
|
||||
outMGAdac(MGA1064_DISP_CTL, ucXDispCtrl);
|
||||
OUTREG(MGAREG_C2CTL, ulC2CTL);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
/* Force to close second crtc */
|
||||
CARD32 ulC2CTL = INREG(MGAREG_C2CTL);
|
||||
|
||||
|
||||
ulC2CTL &= ~MGAREG_C2CTL_C2_EN;
|
||||
|
||||
OUTREG(MGAREG_C2CTL, ulC2CTL);
|
||||
@@ -3086,14 +3086,14 @@ MGARestore(ScrnInfoPtr pScrn)
|
||||
if((!xf86IsEntityShared(pScrn->entityList[0]) && !pMga->SecondCrtc)
|
||||
|| pMga->SecondCrtc || pMga->MergedFB) {
|
||||
/* if(pMga->MergedFB) {
|
||||
if(pMga->pScrn2)
|
||||
if(pMga->pScrn2)
|
||||
MGARestoreSecondCrtc(pMga->pScrn2);
|
||||
} else*/
|
||||
MGARestoreSecondCrtc(pScrn);
|
||||
/* if we are second instance of driver, we've done our job, exit */
|
||||
if(pMga->SecondCrtc) return;
|
||||
}
|
||||
|
||||
|
||||
/* Only restore text mode fonts/text for the primary card */
|
||||
if (pMga->is_G200SE) {
|
||||
MGAG200SEHWProtect(pScrn,TRUE);
|
||||
@@ -3168,7 +3168,7 @@ MGAScreenInit(SCREEN_INIT_ARGS_DECL)
|
||||
}
|
||||
pMga->FbMapSize = pScrn->videoRam * 1024;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Map the MGA memory and MMIO areas */
|
||||
if (!MGAMapMem(pScrn))
|
||||
@@ -3179,7 +3179,7 @@ MGAScreenInit(SCREEN_INIT_ARGS_DECL)
|
||||
* screen.
|
||||
*/
|
||||
if (!pMga->MergedFB) {
|
||||
if (pMga->SecondCrtc) {
|
||||
if (pMga->SecondCrtc) {
|
||||
mga_dpms_set_proc = MGADisplayPowerManagementSetCrtc2;
|
||||
pScreen->SaveScreen = MGASaveScreenCrtc2;
|
||||
}
|
||||
@@ -3232,7 +3232,7 @@ MGAScreenInit(SCREEN_INIT_ARGS_DECL)
|
||||
fbdevHWSave(pScrn);
|
||||
/* Disable VGA core, and leave memory access on */
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
pci_device_cfg_write_bits(pMga->PciInfo, 0x00000100, 0x00000000,
|
||||
pci_device_cfg_write_bits(pMga->PciInfo, 0x00000100, 0x00000000,
|
||||
PCI_OPTION_REG);
|
||||
#else
|
||||
pciSetBitsLong(pMga->PciTag, PCI_OPTION_REG, 0x100, 0x000);
|
||||
@@ -3249,7 +3249,7 @@ MGAScreenInit(SCREEN_INIT_ARGS_DECL)
|
||||
MGAStormEngineInit(pScrn);
|
||||
}
|
||||
|
||||
/* Darken the screen for aesthetic reasons and set the viewport
|
||||
/* Darken the screen for aesthetic reasons and set the viewport
|
||||
*/
|
||||
(*pScreen->SaveScreen)(pScreen, SCREEN_SAVER_ON);
|
||||
pScrn->AdjustFrame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0));
|
||||
@@ -3416,13 +3416,13 @@ MGAScreenInit(SCREEN_INIT_ARGS_DECL)
|
||||
"Hardware cursor initialization failed\n");
|
||||
}
|
||||
if(pMga->MergedFB) {
|
||||
/* Rotate and MergedFB are mutiualy exclusive, so we can use this
|
||||
/* Rotate and MergedFB are mutiualy exclusive, so we can use this
|
||||
* variable.
|
||||
*/
|
||||
if (!pMga->PointerMoved)
|
||||
if (!pMga->PointerMoved)
|
||||
pMga->PointerMoved = pScrn->PointerMoved;
|
||||
pScrn->PointerMoved = MGAMergePointerMoved;
|
||||
|
||||
pScrn->PointerMoved = MGAMergePointerMoved;
|
||||
|
||||
}
|
||||
|
||||
/* Initialise default colourmap */
|
||||
@@ -3509,11 +3509,11 @@ MGASwitchMode(SWITCH_MODE_ARGS_DECL)
|
||||
{
|
||||
SCRN_INFO_PTR(arg);
|
||||
if (mode->Flags & 0x80000000) {
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
} else
|
||||
return MGAModeInit(pScrn, mode);
|
||||
}
|
||||
|
||||
|
||||
/* Adjusts coordinates to match Panning granularity.
|
||||
* does nothing if the HALlib is not loaded
|
||||
*/
|
||||
@@ -3539,19 +3539,19 @@ MGAAdjustFrame(ADJUST_FRAME_ARGS_DECL)
|
||||
|
||||
pMga = MGAPTR(pScrn);
|
||||
pLayout = &pMga->CurrentLayout;
|
||||
|
||||
|
||||
/* wanted to improve panning granularity problems without risking
|
||||
* compatibility issues. Existing code looked hardware dependent.
|
||||
*/
|
||||
|
||||
if(pMga->ShowCache && y && pScrn->vtSema)
|
||||
y += pScrn->virtualY - 1;
|
||||
|
||||
|
||||
Base = (y * pLayout->displayWidth + x + pMga->YDstOrg) >>
|
||||
(3 - pMga->BppShifts[(pLayout->bitsPerPixel >> 3) - 1]);
|
||||
|
||||
if (pLayout->bitsPerPixel == 24) {
|
||||
if (pMga->Chipset == PCI_CHIP_MGAG400
|
||||
if (pMga->Chipset == PCI_CHIP_MGAG400
|
||||
|| pMga->Chipset == PCI_CHIP_MGAG550)
|
||||
Base &= ~1; /*1 Not sure why */
|
||||
|
||||
@@ -3669,7 +3669,7 @@ MGAEnterVTFBDev(VT_FUNC_ARGS_DECL)
|
||||
/* Set Panel mode between 20 and 54 MHz */ \
|
||||
outMGAdac(MGA1064_PAN_CTL, 0x7); \
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* This is called when VT switching away from the X server. Its job is
|
||||
@@ -3985,7 +3985,7 @@ MGADisplayPowerManagementSetCrtc2(ScrnInfoPtr pScrn, int PowerManagementMode,
|
||||
MAVW(STABLE, 0x02); makes picture stable?
|
||||
fixme? linux uses 0x14...
|
||||
MAVW(TEST, (MAVR(TEST) & 0x10));
|
||||
|
||||
|
||||
*/
|
||||
/* else monitor mode */
|
||||
|
||||
|
||||
@@ -33,8 +33,8 @@ static CARD32 G450RemovePFactor(ScrnInfoPtr pScrn, CARD8 ucP, CARD32 *pulFIn)
|
||||
{
|
||||
*pulFIn = *pulFIn * (2L << (ucP & 3));
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ static CARD32 G450CalculVCO(ScrnInfoPtr pScrn, CARD32 ulMNP, CARD32 *pulF)
|
||||
ucN = (CARD8)((ulMNP >> 8) & 0xff);
|
||||
|
||||
*pulF = (27000 * (2 * (ucN + 2)) + ((ucM + 1) >> 1)) / (ucM + 1);
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ static CARD32 G450CalculDeltaFreq(ScrnInfoPtr pScrn, CARD32 ulF1,
|
||||
{
|
||||
*pulDelta = ((ulF2 - ulF1) * 1000) / ulF1;
|
||||
}
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ static CARD32 G450FindNextPLLParam(ScrnInfoPtr pScrn, CARD32 ulFout,
|
||||
{
|
||||
ulVCOMin = 230000;
|
||||
}
|
||||
|
||||
|
||||
if((ucM == 9) && (ucP & 0x40))
|
||||
{
|
||||
*pulPLLMNP = 0xffffffff;
|
||||
@@ -132,7 +132,7 @@ static CARD32 G450FindNextPLLParam(ScrnInfoPtr pScrn, CARD32 ulFout,
|
||||
*pulPLLMNP |= (CARD32)ucM << 16;
|
||||
*pulPLLMNP |= (CARD32)ucN << 8;
|
||||
*pulPLLMNP |= (CARD32)ucP;
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
ErrorF("FINS_S: VCO = %d, S = %02X, *pulPLLMNP = %08X\n", (unsigned)ulVCO, (unsigned)ucS, (unsigned)*pulPLLMNP);
|
||||
#endif
|
||||
@@ -141,8 +141,8 @@ static CARD32 G450FindNextPLLParam(ScrnInfoPtr pScrn, CARD32 ulFout,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static CARD32 G450FindFirstPLLParam(ScrnInfoPtr pScrn, CARD32 ulFout,
|
||||
|
||||
static CARD32 G450FindFirstPLLParam(ScrnInfoPtr pScrn, CARD32 ulFout,
|
||||
CARD32 *pulPLLMNP)
|
||||
{
|
||||
CARD8 ucP;
|
||||
@@ -191,12 +191,12 @@ static CARD32 G450WriteMNP(ScrnInfoPtr pScrn, CARD32 ulMNP)
|
||||
MGAPtr pMga = MGAPTR(pScrn);
|
||||
|
||||
if (!pMga->SecondCrtc) {
|
||||
outMGAdac(MGA1064_PIX_PLLC_M, (CARD8)(ulMNP >> 16));
|
||||
outMGAdac(MGA1064_PIX_PLLC_N, (CARD8)(ulMNP >> 8));
|
||||
outMGAdac(MGA1064_PIX_PLLC_P, (CARD8) ulMNP);
|
||||
outMGAdac(MGA1064_PIX_PLLC_M, (CARD8)(ulMNP >> 16));
|
||||
outMGAdac(MGA1064_PIX_PLLC_N, (CARD8)(ulMNP >> 8));
|
||||
outMGAdac(MGA1064_PIX_PLLC_P, (CARD8) ulMNP);
|
||||
} else {
|
||||
outMGAdac(MGA1064_VID_PLL_M, (CARD8)(ulMNP >> 16));
|
||||
outMGAdac(MGA1064_VID_PLL_N, (CARD8)(ulMNP >> 8));
|
||||
outMGAdac(MGA1064_VID_PLL_N, (CARD8)(ulMNP >> 8));
|
||||
outMGAdac(MGA1064_VID_PLL_P, (CARD8) ulMNP);
|
||||
}
|
||||
return TRUE;
|
||||
@@ -208,12 +208,12 @@ static CARD32 G450ReadMNP(ScrnInfoPtr pScrn)
|
||||
CARD32 ret = 0;
|
||||
|
||||
if (!pMga->SecondCrtc) {
|
||||
ret = (CARD8)inMGAdac(MGA1064_PIX_PLLC_M) << 16;
|
||||
ret |= (CARD8)inMGAdac(MGA1064_PIX_PLLC_N) << 8;
|
||||
ret |= (CARD8)inMGAdac(MGA1064_PIX_PLLC_P);
|
||||
ret = (CARD8)inMGAdac(MGA1064_PIX_PLLC_M) << 16;
|
||||
ret |= (CARD8)inMGAdac(MGA1064_PIX_PLLC_N) << 8;
|
||||
ret |= (CARD8)inMGAdac(MGA1064_PIX_PLLC_P);
|
||||
} else {
|
||||
ret = (CARD8)inMGAdac(MGA1064_VID_PLL_M) << 16;
|
||||
ret |= (CARD8)inMGAdac(MGA1064_VID_PLL_N) << 8;
|
||||
ret |= (CARD8)inMGAdac(MGA1064_VID_PLL_N) << 8;
|
||||
ret |= (CARD8)inMGAdac(MGA1064_VID_PLL_P);
|
||||
}
|
||||
return ret;
|
||||
@@ -276,7 +276,7 @@ static CARD32 G450IsPllLocked(ScrnInfoPtr pScrn, Bool *lpbLocked)
|
||||
|
||||
ulFallBackCounter = 0;
|
||||
|
||||
do
|
||||
do
|
||||
{
|
||||
ucPLLStatus = INREG8(0x3c0a);
|
||||
ulFallBackCounter++;
|
||||
@@ -301,7 +301,7 @@ static CARD32 G450IsPllLocked(ScrnInfoPtr pScrn, Bool *lpbLocked)
|
||||
}
|
||||
|
||||
|
||||
double MGAG450SetPLLFreq(ScrnInfoPtr pScrn, long f_out)
|
||||
double MGAG450SetPLLFreq(ScrnInfoPtr pScrn, long f_out)
|
||||
{
|
||||
Bool bFoundValidPLL;
|
||||
Bool bLocked;
|
||||
@@ -370,13 +370,13 @@ double MGAG450SetPLLFreq(ScrnInfoPtr pScrn, long f_out)
|
||||
/* For pixel pll */
|
||||
if (!pMga->SecondCrtc) {
|
||||
ucMisc = INREG8(0x1FCC);
|
||||
OUTREG8(0x1fc2, (CARD8)(ucMisc | CLKSEL_MGA));
|
||||
OUTREG8(0x1fc2, (CARD8)(ucMisc | CLKSEL_MGA));
|
||||
}
|
||||
|
||||
for(CARD32 ulIndex = 0; !bFoundValidPLL && (ulIndex < ulMaxIndex); ulIndex++)
|
||||
{
|
||||
ulTryMNP = ulMNPTable[ulIndex];
|
||||
|
||||
|
||||
ucSTable[3] = 0xff;
|
||||
ucSTable[2] = 0xff;
|
||||
ucSTable[0] = (CARD8) (ulTryMNP & 0x38);
|
||||
@@ -389,12 +389,12 @@ double MGAG450SetPLLFreq(ScrnInfoPtr pScrn, long f_out)
|
||||
} else {
|
||||
ucSTable[1] = 8;
|
||||
}
|
||||
|
||||
|
||||
for(ucSIndex = 0; !bFoundValidPLL && (ucSTable[ucSIndex] != 0xff);
|
||||
ucSIndex++) {
|
||||
ulTryMNP &= 0xffffffc7;
|
||||
ulTryMNP |= (CARD32)ucSTable[ucSIndex];
|
||||
|
||||
|
||||
bLocked = TRUE;
|
||||
if((ulMNPTable[ulIndex] & 0xff00) < 0x300 ||
|
||||
(ulMNPTable[ulIndex] & 0xff00) > 0x7a00)
|
||||
@@ -406,50 +406,50 @@ double MGAG450SetPLLFreq(ScrnInfoPtr pScrn, long f_out)
|
||||
{
|
||||
G450WriteMNP(pScrn, ulTryMNP - 0x300);
|
||||
G450IsPllLocked(pScrn, &bLocked);
|
||||
}
|
||||
}
|
||||
|
||||
if(bLocked)
|
||||
{
|
||||
G450WriteMNP(pScrn, ulTryMNP + 0x300);
|
||||
G450IsPllLocked(pScrn, &bLocked);
|
||||
}
|
||||
}
|
||||
|
||||
if(bLocked)
|
||||
{
|
||||
G450WriteMNP(pScrn, ulTryMNP - 0x200);
|
||||
G450IsPllLocked(pScrn, &bLocked);
|
||||
}
|
||||
}
|
||||
|
||||
if(bLocked)
|
||||
{
|
||||
G450WriteMNP(pScrn, ulTryMNP + 0x200);
|
||||
G450IsPllLocked(pScrn, &bLocked);
|
||||
}
|
||||
}
|
||||
|
||||
if(bLocked)
|
||||
{
|
||||
G450WriteMNP(pScrn, ulTryMNP - 0x100);
|
||||
G450IsPllLocked(pScrn, &bLocked);
|
||||
}
|
||||
}
|
||||
|
||||
if(bLocked)
|
||||
{
|
||||
G450WriteMNP(pScrn, ulTryMNP + 0x100);
|
||||
G450IsPllLocked(pScrn, &bLocked);
|
||||
}
|
||||
}
|
||||
|
||||
if(bLocked)
|
||||
{
|
||||
G450WriteMNP(pScrn, ulTryMNP);
|
||||
G450IsPllLocked(pScrn, &bLocked);
|
||||
}
|
||||
}
|
||||
else if(!ulMNP)
|
||||
{
|
||||
G450WriteMNP(pScrn, ulTryMNP);
|
||||
G450IsPllLocked(pScrn, &bLocked);
|
||||
if(bLocked)
|
||||
{
|
||||
ulMNP = ulMNPTable[ulIndex];
|
||||
ulMNP = ulMNPTable[ulIndex];
|
||||
}
|
||||
bLocked = FALSE;
|
||||
}
|
||||
@@ -472,12 +472,12 @@ double MGAG450SetPLLFreq(ScrnInfoPtr pScrn, long f_out)
|
||||
G450WriteMNP(pScrn, ulMNPTable[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
long
|
||||
MGAG450SavePLLFreq(ScrnInfoPtr pScrn)
|
||||
MGAG450SavePLLFreq(ScrnInfoPtr pScrn)
|
||||
{
|
||||
CARD32 ulMNP = G450ReadMNP(pScrn);
|
||||
CARD8 ucP;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "mga.h"
|
||||
#include "mga_reg.h"
|
||||
|
||||
Bool
|
||||
Bool
|
||||
MGAHWCursorInit(ScreenPtr pScreen)
|
||||
{
|
||||
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
|
||||
@@ -18,12 +18,12 @@ MGAHWCursorInit(ScreenPtr pScreen)
|
||||
MGARamdacPtr MGAdac = &pMga->Dac;
|
||||
xf86CursorInfoPtr infoPtr;
|
||||
|
||||
if (!MGAdac->isHwCursor)
|
||||
if (!MGAdac->isHwCursor)
|
||||
return FALSE;
|
||||
|
||||
infoPtr = xf86CreateCursorInfoRec();
|
||||
if(!infoPtr) return FALSE;
|
||||
|
||||
|
||||
pMga->CursorInfoRec = infoPtr;
|
||||
|
||||
infoPtr->MaxWidth = MGAdac->CursorMaxWidth;
|
||||
|
||||
176
src/mga_merge.c
176
src/mga_merge.c
@@ -33,7 +33,7 @@ StrToRanges(range* r, const char* s) {
|
||||
gotdash = nextdash;
|
||||
nextdash = FALSE;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case '-':
|
||||
case ' ': case 0:
|
||||
@@ -51,12 +51,12 @@ StrToRanges(range* r, const char* s) {
|
||||
nextdash = (rangenum != 0); /*ignore dash if before any number.*/
|
||||
break;
|
||||
default :
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
} while(*(s++) != 0); /* run loop for every char including null terminator.*/
|
||||
|
||||
|
||||
return rangenum;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Copies mode i, links the result to dest, and returns it.
|
||||
@@ -75,14 +75,14 @@ CopyModeNLink(ScrnInfoPtr pScrn, DisplayModePtr dest, DisplayModePtr i, DisplayM
|
||||
((MergedDisplayModePtr)mode->Private)->Monitor2 = j;
|
||||
((MergedDisplayModePtr)mode->Private)->Monitor2Pos = srel;
|
||||
mode->PrivSize = 0;
|
||||
|
||||
|
||||
switch(srel) {
|
||||
case mgaLeftOf:
|
||||
case mgaLeftOf:
|
||||
case mgaRightOf:
|
||||
dx = min(pScrn->virtualX,i->HDisplay + j->HDisplay) - mode->HDisplay;
|
||||
dy = min(pScrn->virtualY, max(i->VDisplay,j->VDisplay)) - mode->VDisplay;
|
||||
break;
|
||||
case mgaAbove:
|
||||
case mgaAbove:
|
||||
case mgaBelow:
|
||||
dy = min(pScrn->virtualY,i->VDisplay + j->VDisplay) - mode->VDisplay;
|
||||
dx = min(pScrn->virtualX, max(i->HDisplay,j->HDisplay)) - mode->HDisplay;
|
||||
@@ -101,17 +101,17 @@ CopyModeNLink(ScrnInfoPtr pScrn, DisplayModePtr dest, DisplayModePtr i, DisplayM
|
||||
mode->VSyncEnd += dy;
|
||||
mode->VTotal += dy;
|
||||
mode->Clock = 0; /* Shows we're in Merge mode. */
|
||||
|
||||
|
||||
mode->next = mode;
|
||||
mode->prev = mode;
|
||||
|
||||
if(dest) {
|
||||
/* Insert node after "dest" */
|
||||
mode->next = dest->next;
|
||||
mode->next = dest->next;
|
||||
dest->next->prev = mode;
|
||||
mode->prev = dest;
|
||||
dest->next = mode;
|
||||
}
|
||||
}
|
||||
|
||||
return mode;
|
||||
}
|
||||
@@ -136,7 +136,7 @@ GenerateModeList(ScrnInfoPtr pScrn, const char* str,
|
||||
char modename[256];
|
||||
Bool gotdash = FALSE;
|
||||
MgaScrn2Rel sr;
|
||||
|
||||
|
||||
DisplayModePtr mode1 = NULL;
|
||||
DisplayModePtr mode2 = NULL;
|
||||
DisplayModePtr result = NULL;
|
||||
@@ -151,7 +151,7 @@ GenerateModeList(ScrnInfoPtr pScrn, const char* str,
|
||||
/* read new entry */
|
||||
strncpy(modename,strmode,str - strmode);
|
||||
modename[str - strmode] = 0;
|
||||
|
||||
|
||||
if(gotdash) {
|
||||
if(mode1 == NULL) return NULL;
|
||||
mode2 = GetModeFromName(modename,j);
|
||||
@@ -161,7 +161,7 @@ GenerateModeList(ScrnInfoPtr pScrn, const char* str,
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
|
||||
"Skipping metamode \"%s-%s\".\n",mode1->name,modename);
|
||||
mode1 = NULL;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mode1 = GetModeFromName(modename,i);
|
||||
if(!mode1) {
|
||||
@@ -183,25 +183,25 @@ GenerateModeList(ScrnInfoPtr pScrn, const char* str,
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
|
||||
"Skipping metamode \"%s\".\n",modename);
|
||||
mode1 = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
gotdash = FALSE;
|
||||
}
|
||||
strmode = str+1; /* number starts on next char */
|
||||
gotdash |= (*str == '-' || *str == ',');
|
||||
|
||||
|
||||
if(*str != 0) break; /* if end of string, we won't get a chance to catch a char and run the
|
||||
default case. do it now */
|
||||
|
||||
|
||||
default:
|
||||
if(!gotdash && mode1) { /* complete previous pair */
|
||||
sr = srel;
|
||||
if(!mode2) {
|
||||
if(!mode2) {
|
||||
mode2 = GetModeFromName(mode1->name,j);
|
||||
sr = mgaClone;
|
||||
}
|
||||
if(!mode2) {
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
|
||||
if(!mode2) {
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
|
||||
"Mode: \"%s\" is not a supported mode for monitor 2\n",mode1->name);
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
|
||||
"Skipping clone mode \"%s\".\n", mode1->name);
|
||||
@@ -213,15 +213,15 @@ GenerateModeList(ScrnInfoPtr pScrn, const char* str,
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
} while(*(str++) != 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* second CRTC init functions. Used to check monitor timings and refreshes.
|
||||
* this function looses lots of maintainability points due to redundancy,
|
||||
* this function looses lots of maintainability points due to redundancy,
|
||||
* but it still was the cleanest and least-intrusive way I found. */
|
||||
|
||||
Bool
|
||||
@@ -239,8 +239,8 @@ MGAPreInitMergedFB(ScrnInfoPtr pScrn1, int flags)
|
||||
xf86DrvMsg(pScrn1->scrnIndex, X_INFO, "==== Start of second screen initialization ====\n");
|
||||
pScrn = malloc(sizeof(ScrnInfoRec));
|
||||
memcpy(pScrn,pScrn1,sizeof(ScrnInfoRec));
|
||||
|
||||
pScrn->driverPrivate = NULL;
|
||||
|
||||
pScrn->driverPrivate = NULL;
|
||||
/* Allocate the MGARec driverPrivate */
|
||||
if (!MGAGetRec(pScrn)) {
|
||||
return FALSE;
|
||||
@@ -249,13 +249,13 @@ MGAPreInitMergedFB(ScrnInfoPtr pScrn1, int flags)
|
||||
pMga = MGAPTR(pScrn);
|
||||
pMga1 = MGAPTR(pScrn1);
|
||||
pMga1->pScrn2 = pScrn;
|
||||
|
||||
|
||||
/* Get the entity, and make sure it is PCI. */
|
||||
pMga->pEnt = pMga1->pEnt;
|
||||
|
||||
|
||||
/* Set pMga->device to the relevant Device section */
|
||||
pMga->device = pMga1->device;
|
||||
|
||||
|
||||
if (flags & PROBE_DETECT) {
|
||||
MGAProbeDDC(pScrn, pMga->pEnt->index); /*FIXME make sure this probes second monitor */
|
||||
return TRUE;
|
||||
@@ -271,24 +271,24 @@ MGAPreInitMergedFB(ScrnInfoPtr pScrn1, int flags)
|
||||
pScrn->monitor = malloc(sizeof(MonRec));
|
||||
/* copy everything we don't care about */
|
||||
memcpy(pScrn->monitor,pScrn1->monitor,sizeof(MonRec));
|
||||
pScrn->monitor->DDC = NULL; /*FIXME:have to try this */
|
||||
if ((s = xf86GetOptValString(pMga1->Options, OPTION_HSYNC2))) {
|
||||
pScrn->monitor->DDC = NULL; /*FIXME:have to try this */
|
||||
if ((s = xf86GetOptValString(pMga1->Options, OPTION_HSYNC2))) {
|
||||
pScrn->monitor->nHsync = StrToRanges(pScrn->monitor->hsync,s);
|
||||
}
|
||||
if ((s = xf86GetOptValString(pMga1->Options, OPTION_VREFRESH2))) {
|
||||
if ((s = xf86GetOptValString(pMga1->Options, OPTION_VREFRESH2))) {
|
||||
pScrn->monitor->nVrefresh = StrToRanges(pScrn->monitor->vrefresh,s);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
pMga->SecondCrtc = TRUE;
|
||||
pMga->HWCursor = FALSE;
|
||||
pScrn->AdjustFrame = MGAAdjustMergeFrames;
|
||||
pScrn1->AdjustFrame = MGAAdjustMergeFrames;
|
||||
|
||||
/* if (!xf86SetDepthBpp(pScrn, 0, 0, 0, flags24)) FIXME:have to copy result form scrn1
|
||||
|
||||
/* if (!xf86SetDepthBpp(pScrn, 0, 0, 0, flags24)) FIXME:have to copy result form scrn1
|
||||
if (!xf86SetWeight(pScrn, zeros, zeros)) {
|
||||
*/
|
||||
|
||||
@@ -301,7 +301,7 @@ MGAPreInitMergedFB(ScrnInfoPtr pScrn1, int flags)
|
||||
/* xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pMga->Options);*/
|
||||
pMga->Options = pMga1->Options;
|
||||
|
||||
|
||||
|
||||
/* Set the bits per RGB for 8bpp mode */
|
||||
if (pScrn->depth == 8)
|
||||
pScrn->rgbBits = 8;
|
||||
@@ -332,7 +332,7 @@ MGAPreInitMergedFB(ScrnInfoPtr pScrn1, int flags)
|
||||
pMga->HWCursor = FALSE;
|
||||
pMga->ShadowFB = FALSE;
|
||||
pMga->FBDev = FALSE;
|
||||
|
||||
|
||||
pMga->OverclockMem = pMga1->OverclockMem;
|
||||
pMga->TexturedVideo = pMga1->TexturedVideo;
|
||||
pMga->MergedFB = TRUE;
|
||||
@@ -388,7 +388,7 @@ MGAPreInitMergedFB(ScrnInfoPtr pScrn1, int flags)
|
||||
if ( (!pMga->Primary && !pMga->FBDev) )
|
||||
MGASoftReset(pScrn);
|
||||
|
||||
|
||||
|
||||
pScrn->videoRam = pScrn1->videoRam;
|
||||
pMga->FbMapSize = pMga1->FbMapSize;
|
||||
pMga->SrcOrg = pMga1->SrcOrg;
|
||||
@@ -507,10 +507,10 @@ MGAPreInitMergedFB(ScrnInfoPtr pScrn1, int flags)
|
||||
case PCI_CHIP_MGAG200_SE_A_PCI:
|
||||
case PCI_CHIP_MGAG200_SE_B_PCI:
|
||||
case PCI_CHIP_MGAG200_WINBOND_PCI:
|
||||
case PCI_CHIP_MGAG200_EW3_PCI:
|
||||
case PCI_CHIP_MGAG200_EW3_PCI:
|
||||
case PCI_CHIP_MGAG200_EV_PCI:
|
||||
case PCI_CHIP_MGAG200_EH_PCI:
|
||||
case PCI_CHIP_MGAG200_ER_PCI:
|
||||
case PCI_CHIP_MGAG200_ER_PCI:
|
||||
case PCI_CHIP_MGAG200_EH3_PCI:
|
||||
case PCI_CHIP_MGAG400:
|
||||
case PCI_CHIP_MGAG550:
|
||||
@@ -529,7 +529,7 @@ MGAPreInitMergedFB(ScrnInfoPtr pScrn1, int flags)
|
||||
pScrn->display->virtualY,
|
||||
pMga->FbMapSize,
|
||||
LOOKUP_BEST_REFRESH);
|
||||
|
||||
|
||||
free(linePitches);
|
||||
}
|
||||
|
||||
@@ -582,7 +582,7 @@ MGAPreInitMergedFB(ScrnInfoPtr pScrn1, int flags)
|
||||
* This is only needed for WRAM.
|
||||
*/
|
||||
|
||||
pMga->YDstOrg = pMga1->YDstOrg;
|
||||
pMga->YDstOrg = pMga1->YDstOrg;
|
||||
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "CRTC2: YDstOrg is set to %d\n",
|
||||
pMga->YDstOrg);
|
||||
pMga->FbUsableSize = pMga1->FbUsableSize;
|
||||
@@ -621,7 +621,7 @@ MGAPreInitMergedFB(ScrnInfoPtr pScrn1, int flags)
|
||||
default:
|
||||
Monitor2Pos = mgaRightOf;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Fool xf86 into thinking we have huge modes */
|
||||
@@ -635,7 +635,7 @@ MGAPreInitMergedFB(ScrnInfoPtr pScrn1, int flags)
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Parse Error reading MetaModes, or No modes left.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
pScrn1->modes = pScrn1->modes->next;
|
||||
pScrn1->currentMode = pScrn1->modes;
|
||||
} else {
|
||||
@@ -674,7 +674,7 @@ InRegion(int x, int y, region r) {
|
||||
if(test > hi) { \
|
||||
low += test-hi; \
|
||||
hi = test; } } while (0)
|
||||
void
|
||||
void
|
||||
MGAMergePointerMoved(SCRN_ARG_TYPE arg, int x, int y)
|
||||
{
|
||||
SCRN_INFO_PTR(arg);
|
||||
@@ -702,37 +702,37 @@ MGAMergePointerMoved(SCRN_ARG_TYPE arg, int x, int y)
|
||||
out.y0 = pScrn->frameY0;
|
||||
out.y1 = pScrn->frameY1+1;
|
||||
|
||||
/*
|
||||
/*
|
||||
* specify inner sliding window. being outsize both frames, and inside
|
||||
* the outer clipping window, causes corresponding frame to slide
|
||||
*/
|
||||
in1 = out;
|
||||
in2 = out;
|
||||
switch(((MergedDisplayModePtr)pScrn->currentMode->Private)->Monitor2Pos) {
|
||||
case mgaLeftOf :
|
||||
in1.x0 = f1.x0;
|
||||
in2.x1 = f2.x1;
|
||||
case mgaLeftOf :
|
||||
in1.x0 = f1.x0;
|
||||
in2.x1 = f2.x1;
|
||||
break;
|
||||
case mgaRightOf :
|
||||
in1.x1 = f1.x1;
|
||||
in2.x0 = f2.x0;
|
||||
case mgaRightOf :
|
||||
in1.x1 = f1.x1;
|
||||
in2.x0 = f2.x0;
|
||||
break;
|
||||
case mgaBelow :
|
||||
in1.y1 = f1.y1;
|
||||
in2.y0 = f2.y0;
|
||||
case mgaBelow :
|
||||
in1.y1 = f1.y1;
|
||||
in2.y0 = f2.y0;
|
||||
break;
|
||||
case mgaAbove :
|
||||
in1.y0 = f1.y0;
|
||||
in2.y1 = f2.y1;
|
||||
case mgaAbove :
|
||||
in1.y0 = f1.y0;
|
||||
in2.y1 = f2.y1;
|
||||
break;
|
||||
case mgaClone :
|
||||
case mgaClone :
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
deltay = 0;
|
||||
deltax = 0;
|
||||
|
||||
|
||||
if(InRegion(x,y,out)) {
|
||||
if( InRegion(x,y, in1) && !InRegion(x,y, f1) ) {
|
||||
REBOUND(f1.x0,f1.x1,x);
|
||||
@@ -746,10 +746,10 @@ MGAMergePointerMoved(SCRN_ARG_TYPE arg, int x, int y)
|
||||
}
|
||||
}
|
||||
else { /*outside outer clipping region*/
|
||||
if ( out.x0 > x) {
|
||||
if ( out.x0 > x) {
|
||||
deltax = x - out.x0;
|
||||
}
|
||||
if ( out.x1 < x) {
|
||||
if ( out.x1 < x) {
|
||||
deltax = x - out.x1;
|
||||
}
|
||||
f1.x0 += deltax;
|
||||
@@ -758,12 +758,12 @@ MGAMergePointerMoved(SCRN_ARG_TYPE arg, int x, int y)
|
||||
f2.x1 += deltax;
|
||||
pScrn->frameX0 += deltax;
|
||||
pScrn->frameX1 += deltax;
|
||||
|
||||
|
||||
if ( out.y0 > y) {
|
||||
|
||||
if ( out.y0 > y) {
|
||||
deltay = y - out.y0;
|
||||
}
|
||||
if ( out.y1 < y) {
|
||||
if ( out.y1 < y) {
|
||||
deltay = y - out.y1;
|
||||
}
|
||||
f1.y0 += deltay;
|
||||
@@ -772,12 +772,12 @@ MGAMergePointerMoved(SCRN_ARG_TYPE arg, int x, int y)
|
||||
f2.y1 += deltay;
|
||||
pScrn->frameY0 += deltay;
|
||||
pScrn->frameY1 += deltay;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (deltax != 0 || deltay != 0) {
|
||||
/* back to reality. */
|
||||
pMga->M1frameX0 = f1.x0;
|
||||
pMga->M1frameX0 = f1.x0;
|
||||
pMga->M1frameY0 = f1.y0;
|
||||
pScr2->frameX0 = f2.x0;
|
||||
pScr2->frameY0 = f2.y0;
|
||||
@@ -786,37 +786,37 @@ MGAMergePointerMoved(SCRN_ARG_TYPE arg, int x, int y)
|
||||
MGAAdjustGranularity(pScrn,&pMga->M1frameX0,&pMga->M1frameY0);
|
||||
MGAAdjustGranularity(pScrn,&pScr2->frameX0,&pScr2->frameY0);
|
||||
MGAAdjustGranularity(pScrn,&pScrn->frameX0,&pScrn->frameY0);
|
||||
|
||||
|
||||
pMga->M1frameX1 = pMga->M1frameX0 + MDMPTR(pScrn)->Monitor1->HDisplay -1;
|
||||
pMga->M1frameY1 = pMga->M1frameY0 + MDMPTR(pScrn)->Monitor1->VDisplay -1;
|
||||
pScr2->frameX1 = pScr2->frameX0 + MDMPTR(pScrn)->Monitor2->HDisplay -1;
|
||||
pScr2->frameY1 = pScr2->frameY0 + MDMPTR(pScrn)->Monitor2->VDisplay -1;
|
||||
pScrn->frameX1 = pScrn->frameX0 + pScrn->currentMode->HDisplay -1;
|
||||
pScrn->frameY1 = pScrn->frameY0 + pScrn->currentMode->VDisplay -1;
|
||||
|
||||
|
||||
MGAAdjustFrame(ADJUST_FRAME_ARGS(pScrn, pMga->M1frameX0, pMga->M1frameY0));
|
||||
MGAAdjustFrameCrtc2(ADJUST_FRAME_ARGS(pScrn, pScr2->frameX0, pScr2->frameY0));
|
||||
}
|
||||
|
||||
/* if(pMga->PointerMoved)
|
||||
/* if(pMga->PointerMoved)
|
||||
(*pMga->PointerMoved)(scrnIndex, x, y); FIXME: do I need to call old func?*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
MGAAdjustMergeFrames(ADJUST_FRAME_ARGS_DECL) {
|
||||
SCRN_INFO_PTR(arg);
|
||||
ScrnInfoPtr pScrn1 = pScrn;
|
||||
MGAPtr pMga = MGAPTR(pScrn1);
|
||||
MGAPtr pMga = MGAPTR(pScrn1);
|
||||
ScrnInfoPtr pScrn2 = pMga->pScrn2;
|
||||
int VTotal = pScrn1->currentMode->VDisplay;
|
||||
int HTotal = pScrn1->currentMode->HDisplay;
|
||||
int VTotal = pScrn1->currentMode->VDisplay;
|
||||
int HTotal = pScrn1->currentMode->HDisplay;
|
||||
int VMax = VTotal;
|
||||
int HMax = HTotal;
|
||||
|
||||
BOUND(x,0,pScrn1->virtualX-HTotal);
|
||||
BOUND(y,0,pScrn1->virtualY-VTotal);
|
||||
BOUND(y,0,pScrn1->virtualY-VTotal);
|
||||
switch(MDMPTR(pScrn1)->Monitor2Pos) {
|
||||
case mgaLeftOf:
|
||||
pScrn2->frameX0 = x;
|
||||
@@ -854,15 +854,15 @@ MGAAdjustMergeFrames(ADJUST_FRAME_ARGS_DECL) {
|
||||
BOUND(pMga->M1frameY0,0,pScrn1->virtualY -MDMPTR(pScrn1)->Monitor1->VDisplay);
|
||||
BOUND(pScrn2->frameX0,0,pScrn2->virtualX -MDMPTR(pScrn1)->Monitor2->HDisplay);
|
||||
BOUND(pScrn2->frameY0,0,pScrn2->virtualY -MDMPTR(pScrn1)->Monitor2->VDisplay);
|
||||
|
||||
|
||||
pScrn1->frameX0 = x;
|
||||
pScrn1->frameY0 = y;
|
||||
|
||||
|
||||
/* check granularity */
|
||||
MGAAdjustGranularity(pScrn1,&pMga->M1frameX0,&pMga->M1frameY0);
|
||||
MGAAdjustGranularity(pScrn1,&pScrn2->frameX0,&pScrn2->frameY0);
|
||||
MGAAdjustGranularity(pScrn1,&pScrn1->frameX0,&pScrn1->frameY0);
|
||||
|
||||
|
||||
/* complete shitty redundant info */
|
||||
pMga->M1frameX1 = pMga->M1frameX0 + MDMPTR(pScrn1)->Monitor1->HDisplay -1;
|
||||
pMga->M1frameY1 = pMga->M1frameY0 + MDMPTR(pScrn1)->Monitor1->VDisplay -1;
|
||||
@@ -879,7 +879,7 @@ MGAAdjustMergeFrames(ADJUST_FRAME_ARGS_DECL) {
|
||||
Bool
|
||||
MGACloseScreenMerged(ScreenPtr pScreen) {
|
||||
ScrnInfoPtr pScrn1 = xf86ScreenToScrn(pScreen);
|
||||
MGAPtr pMga = MGAPTR(pScrn1);
|
||||
MGAPtr pMga = MGAPTR(pScrn1);
|
||||
ScrnInfoPtr pScrn2 = pMga->pScrn2;
|
||||
|
||||
if(pScrn2) {
|
||||
@@ -893,27 +893,27 @@ MGACloseScreenMerged(ScreenPtr pScreen) {
|
||||
if(pScrn1->modes) {
|
||||
pScrn1->currentMode = pScrn1->modes;
|
||||
do {
|
||||
DisplayModePtr p = pScrn1->currentMode->next;
|
||||
DisplayModePtr p = pScrn1->currentMode->next;
|
||||
free(pScrn1->currentMode->Private);
|
||||
free(pScrn1->currentMode);
|
||||
pScrn1->currentMode = p;
|
||||
}while( pScrn1->currentMode != pScrn1->modes);
|
||||
}
|
||||
|
||||
|
||||
pScrn1->currentMode = pMga->M1currentMode;
|
||||
pScrn1->modes = pMga->M1modes;
|
||||
|
||||
return TRUE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
MGASaveScreenMerged(ScreenPtr pScreen, int mode)
|
||||
{
|
||||
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
|
||||
MGAPtr pMga = MGAPTR(pScrn);
|
||||
MGAPtr pMga = MGAPTR(pScrn);
|
||||
BOOL on = xf86IsUnblank(mode);
|
||||
CARD8 reg;
|
||||
|
||||
|
||||
if (on) {
|
||||
/* SetTimdeSinceLastInputEvent();*/
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* Merged mode stuff */
|
||||
/* include file for mga_driver.c DO NOT try to generate a .o with this file.*/
|
||||
|
||||
void MGADisplayPowerManagementSetMerged(ScrnInfoPtr pScrn,
|
||||
void MGADisplayPowerManagementSetMerged(ScrnInfoPtr pScrn,
|
||||
int PowerManagementMode,
|
||||
int flags);
|
||||
void MGAMergePointerMoved(SCRN_ARG_TYPE arg, int x, int y);
|
||||
@@ -13,7 +13,7 @@ Bool MGASaveScreenMerged(ScreenPtr pScreen, int mode);
|
||||
typedef struct _MergedDisplayModeRec {
|
||||
DisplayModePtr Monitor1;
|
||||
DisplayModePtr Monitor2;
|
||||
MgaScrn2Rel Monitor2Pos;
|
||||
MgaScrn2Rel Monitor2Pos;
|
||||
} MergedDisplayModeRec, *MergedDisplayModePtr;
|
||||
|
||||
#define MDMPTR(x) ((MergedDisplayModePtr)(x->currentMode->Private))
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 1999, The XFree86 Project Inc.
|
||||
Copyright (c) 1999, The XFree86 Project Inc.
|
||||
Written by Mark Vojkovich <markv@valinux.com>
|
||||
*/
|
||||
|
||||
@@ -23,14 +23,14 @@ MGARefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
|
||||
MGAPtr pMga = MGAPTR(pScrn);
|
||||
int width, height, Bpp, FBPitch;
|
||||
unsigned char *src, *dst;
|
||||
|
||||
|
||||
Bpp = pScrn->bitsPerPixel >> 3;
|
||||
FBPitch = BitmapBytePad(pScrn->displayWidth * pScrn->bitsPerPixel);
|
||||
|
||||
while(num--) {
|
||||
width = (pbox->x2 - pbox->x1) * Bpp;
|
||||
height = pbox->y2 - pbox->y1;
|
||||
src = pMga->ShadowPtr + (pbox->y1 * pMga->ShadowPitch) +
|
||||
src = pMga->ShadowPtr + (pbox->y1 * pMga->ShadowPitch) +
|
||||
(pbox->x1 * Bpp);
|
||||
dst = pMga->FbStart + (pbox->y1 * FBPitch) + (pbox->x1 * Bpp);
|
||||
|
||||
@@ -39,10 +39,10 @@ MGARefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
|
||||
dst += FBPitch;
|
||||
src += pMga->ShadowPitch;
|
||||
}
|
||||
|
||||
|
||||
pbox++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MGAPointerMoved(SCRN_ARG_TYPE arg, int x, int y)
|
||||
@@ -80,11 +80,11 @@ MGARefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
|
||||
height = (y2 - y1) >> 2; /* in dwords */
|
||||
|
||||
if(pMga->Rotate == 1) {
|
||||
dstPtr = pMga->FbStart +
|
||||
dstPtr = pMga->FbStart +
|
||||
(pbox->x1 * dstPitch) + pScrn->virtualX - y2;
|
||||
srcPtr = pMga->ShadowPtr + ((1 - y2) * srcPitch) + pbox->x1;
|
||||
} else {
|
||||
dstPtr = pMga->FbStart +
|
||||
dstPtr = pMga->FbStart +
|
||||
((pScrn->virtualY - pbox->x2) * dstPitch) + y1;
|
||||
srcPtr = pMga->ShadowPtr + (y1 * srcPitch) + pbox->x2 - 1;
|
||||
}
|
||||
@@ -94,8 +94,8 @@ MGARefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
|
||||
dst = (CARD32*)dstPtr;
|
||||
count = height;
|
||||
while(count--) {
|
||||
*(dst++) = src[0] | (src[srcPitch] << 8) |
|
||||
(src[srcPitch * 2] << 16) |
|
||||
*(dst++) = src[0] | (src[srcPitch] << 8) |
|
||||
(src[srcPitch * 2] << 16) |
|
||||
(src[srcPitch * 3] << 24);
|
||||
src += srcPitch * 4;
|
||||
}
|
||||
@@ -105,7 +105,7 @@ MGARefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
|
||||
|
||||
pbox++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
@@ -126,14 +126,14 @@ MGARefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
|
||||
height = (y2 - y1) >> 1; /* in dwords */
|
||||
|
||||
if(pMga->Rotate == 1) {
|
||||
dstPtr = (CARD16*)pMga->FbStart +
|
||||
dstPtr = (CARD16*)pMga->FbStart +
|
||||
(pbox->x1 * dstPitch) + pScrn->virtualX - y2;
|
||||
srcPtr = (CARD16*)pMga->ShadowPtr +
|
||||
srcPtr = (CARD16*)pMga->ShadowPtr +
|
||||
((1 - y2) * srcPitch) + pbox->x1;
|
||||
} else {
|
||||
dstPtr = (CARD16*)pMga->FbStart +
|
||||
dstPtr = (CARD16*)pMga->FbStart +
|
||||
((pScrn->virtualY - pbox->x2) * dstPitch) + y1;
|
||||
srcPtr = (CARD16*)pMga->ShadowPtr +
|
||||
srcPtr = (CARD16*)pMga->ShadowPtr +
|
||||
(y1 * srcPitch) + pbox->x2 - 1;
|
||||
}
|
||||
|
||||
@@ -173,11 +173,11 @@ MGARefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
|
||||
height = (y2 - y1) >> 2; /* blocks of 3 dwords */
|
||||
|
||||
if(pMga->Rotate == 1) {
|
||||
dstPtr = pMga->FbStart +
|
||||
dstPtr = pMga->FbStart +
|
||||
(pbox->x1 * dstPitch) + ((pScrn->virtualX - y2) * 3);
|
||||
srcPtr = pMga->ShadowPtr + ((1 - y2) * srcPitch) + (pbox->x1 * 3);
|
||||
} else {
|
||||
dstPtr = pMga->FbStart +
|
||||
dstPtr = pMga->FbStart +
|
||||
((pScrn->virtualY - pbox->x2) * dstPitch) + (y1 * 3);
|
||||
srcPtr = pMga->ShadowPtr + (y1 * srcPitch) + (pbox->x2 * 3) - 3;
|
||||
}
|
||||
@@ -188,18 +188,18 @@ MGARefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
|
||||
count = height;
|
||||
while(count--) {
|
||||
dst[0] = src[0] | (src[1] << 8) | (src[2] << 16) |
|
||||
(src[srcPitch] << 24);
|
||||
(src[srcPitch] << 24);
|
||||
dst[1] = src[srcPitch + 1] | (src[srcPitch + 2] << 8) |
|
||||
(src[srcPitch * 2] << 16) |
|
||||
(src[(srcPitch * 2) + 1] << 24);
|
||||
(src[(srcPitch * 2) + 1] << 24);
|
||||
dst[2] = src[(srcPitch * 2) + 2] | (src[srcPitch * 3] << 8) |
|
||||
(src[(srcPitch * 3) + 1] << 16) |
|
||||
(src[(srcPitch * 3) + 2] << 24);
|
||||
(src[(srcPitch * 3) + 2] << 24);
|
||||
dst += 3;
|
||||
src += srcPitch * 4;
|
||||
}
|
||||
srcPtr += pMga->Rotate * 3;
|
||||
dstPtr += dstPitch;
|
||||
dstPtr += dstPitch;
|
||||
}
|
||||
|
||||
pbox++;
|
||||
@@ -221,14 +221,14 @@ MGARefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
|
||||
height = pbox->y2 - pbox->y1;
|
||||
|
||||
if(pMga->Rotate == 1) {
|
||||
dstPtr = (CARD32*)pMga->FbStart +
|
||||
dstPtr = (CARD32*)pMga->FbStart +
|
||||
(pbox->x1 * dstPitch) + pScrn->virtualX - pbox->y2;
|
||||
srcPtr = (CARD32*)pMga->ShadowPtr +
|
||||
srcPtr = (CARD32*)pMga->ShadowPtr +
|
||||
((1 - pbox->y2) * srcPitch) + pbox->x1;
|
||||
} else {
|
||||
dstPtr = (CARD32*)pMga->FbStart +
|
||||
dstPtr = (CARD32*)pMga->FbStart +
|
||||
((pScrn->virtualY - pbox->x2) * dstPitch) + pbox->y1;
|
||||
srcPtr = (CARD32*)pMga->ShadowPtr +
|
||||
srcPtr = (CARD32*)pMga->ShadowPtr +
|
||||
(pbox->y1 * srcPitch) + pbox->x2 - 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ Bool mgaAccelInit( ScreenPtr pScreen )
|
||||
|
||||
pMga->RenderTime = 0;
|
||||
pMga->LinearScratch = 0;
|
||||
|
||||
|
||||
pMga->MaxFastBlitY = 0;
|
||||
pMga->MaxBlitDWORDS = 0x40000 >> 5;
|
||||
|
||||
@@ -357,7 +357,7 @@ void MGAStormEngineInit( ScrnInfoPtr pScrn )
|
||||
case PCI_CHIP_MGAG200_EW3_PCI:
|
||||
case PCI_CHIP_MGAG200_EV_PCI:
|
||||
case PCI_CHIP_MGAG200_EH_PCI:
|
||||
case PCI_CHIP_MGAG200_ER_PCI:
|
||||
case PCI_CHIP_MGAG200_ER_PCI:
|
||||
case PCI_CHIP_MGAG200_EH3_PCI:
|
||||
pMga->SrcOrg = 0;
|
||||
OUTREG(MGAREG_SRCORG, pMga->realSrcOrg);
|
||||
|
||||
16082
src/mga_ucode.h
16082
src/mga_ucode.h
File diff suppressed because it is too large
Load Diff
@@ -342,9 +342,9 @@ MGAG200SEHWProtect(ScrnInfoPtr pScrn, Bool on)
|
||||
{
|
||||
vgaHWPtr hwp = VGAHWPTR(pScrn);
|
||||
MGAPtr pMga = MGAPTR(pScrn);
|
||||
|
||||
|
||||
unsigned char tmp;
|
||||
|
||||
|
||||
if (pScrn->vtSema) {
|
||||
if (on) {
|
||||
/*
|
||||
@@ -362,7 +362,7 @@ MGAG200SEHWProtect(ScrnInfoPtr pScrn, Bool on)
|
||||
/*
|
||||
* Re-enable sequencer, then turn on screen.
|
||||
*/
|
||||
|
||||
|
||||
tmp = hwp->readSeq(hwp, 0x01);
|
||||
|
||||
MGAWAITVSYNC();
|
||||
|
||||
228
src/mga_video.c
228
src/mga_video.c
@@ -40,12 +40,12 @@ static int MGASetPortAttributeTexture(ScrnInfoPtr, Atom, INT32, pointer);
|
||||
static int MGAGetPortAttributeTexture(ScrnInfoPtr, Atom ,INT32 *, pointer);
|
||||
|
||||
static void MGAStopVideo(ScrnInfoPtr, pointer, Bool);
|
||||
static void MGAQueryBestSize(ScrnInfoPtr, Bool, short, short, short, short,
|
||||
static void MGAQueryBestSize(ScrnInfoPtr, Bool, short, short, short, short,
|
||||
unsigned int *, unsigned int *, pointer);
|
||||
static int MGAPutImage(ScrnInfoPtr, short, short, short, short, short,
|
||||
short, short, short, int, unsigned char*, short,
|
||||
static int MGAPutImage(ScrnInfoPtr, short, short, short, short, short,
|
||||
short, short, short, int, unsigned char*, short,
|
||||
short, Bool, RegionPtr, pointer, DrawablePtr);
|
||||
static int MGAQueryImageAttributes(ScrnInfoPtr, int, unsigned short *,
|
||||
static int MGAQueryImageAttributes(ScrnInfoPtr, int, unsigned short *,
|
||||
unsigned short *, int *, int *);
|
||||
static void MGAFreeMemory(ScrnInfoPtr pScrn, void *mem_struct);
|
||||
|
||||
@@ -54,7 +54,7 @@ static void MGAResetVideoOverlay(ScrnInfoPtr);
|
||||
static void MGAVideoTimerCallback(ScrnInfoPtr pScrn, Time time);
|
||||
|
||||
static XF86VideoAdaptorPtr MGASetupImageVideoILOAD(ScreenPtr);
|
||||
static int MGAPutImageILOAD(ScrnInfoPtr, short, short, short, short, short,
|
||||
static int MGAPutImageILOAD(ScrnInfoPtr, short, short, short, short, short,
|
||||
short, short, short, int, unsigned char*, short,
|
||||
short, Bool, RegionPtr, pointer, DrawablePtr);
|
||||
|
||||
@@ -86,23 +86,23 @@ void MGAInitVideo(ScreenPtr pScreen)
|
||||
if ((pScrn->bitsPerPixel != 8) && !pMga->NoAccel &&
|
||||
(pMga->SecondCrtc == FALSE) &&
|
||||
((pMga->Chipset == PCI_CHIP_MGA2164) ||
|
||||
(pMga->Chipset == PCI_CHIP_MGA2164_AGP) ||
|
||||
(pMga->Chipset == PCI_CHIP_MGA2164_AGP) ||
|
||||
/* (pMga->Chipset == PCI_CHIP_MGA2064) || */
|
||||
(pMga->Chipset == PCI_CHIP_MGAG200) ||
|
||||
(pMga->Chipset == PCI_CHIP_MGAG200) ||
|
||||
(pMga->Chipset == PCI_CHIP_MGAG200_PCI) ||
|
||||
(pMga->Chipset == PCI_CHIP_MGAG400) ||
|
||||
(pMga->Chipset == PCI_CHIP_MGAG550))) {
|
||||
if ((pMga->Chipset == PCI_CHIP_MGA2164) ||
|
||||
/* (pMga->Chipset == PCI_CHIP_MGA2064) || */
|
||||
/* (pMga->Chipset == PCI_CHIP_MGA2064) || */
|
||||
(pMga->Chipset == PCI_CHIP_MGA2164_AGP)) {
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using MGA 2164W ILOAD video\n");
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
|
||||
"This is an experimental driver and may not work on your machine.\n");
|
||||
|
||||
newAdaptor = MGASetupImageVideoILOAD(pScreen);
|
||||
pMga->TexturedVideo = TRUE;
|
||||
/* ^^^ this is not really true but the ILOAD scaler shares
|
||||
* much more code with the textured video than the overlay
|
||||
pMga->TexturedVideo = TRUE;
|
||||
/* ^^^ this is not really true but the ILOAD scaler shares
|
||||
* much more code with the textured video than the overlay
|
||||
*/
|
||||
} else if (pMga->TexturedVideo && (pScrn->bitsPerPixel != 24)) {
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using texture video\n");
|
||||
@@ -127,7 +127,7 @@ void MGAInitVideo(ScreenPtr pScreen)
|
||||
/* need to free this someplace */
|
||||
newAdaptors = malloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr *));
|
||||
if(newAdaptors) {
|
||||
memcpy(newAdaptors, adaptors, num_adaptors *
|
||||
memcpy(newAdaptors, adaptors, num_adaptors *
|
||||
sizeof(XF86VideoAdaptorPtr));
|
||||
newAdaptors[num_adaptors] = newAdaptor;
|
||||
adaptors = newAdaptors;
|
||||
@@ -161,7 +161,7 @@ static XF86VideoEncodingRec DummyEncoding[2] =
|
||||
|
||||
#define NUM_FORMATS 6
|
||||
|
||||
static XF86VideoFormatRec Formats[NUM_FORMATS] =
|
||||
static XF86VideoFormatRec Formats[NUM_FORMATS] =
|
||||
{
|
||||
{15, TrueColor}, {16, TrueColor}, {24, TrueColor},
|
||||
{15, DirectColor}, {16, DirectColor}, {24, DirectColor}
|
||||
@@ -187,24 +187,24 @@ static XF86ImageRec Images[NUM_IMAGES] =
|
||||
XVIMAGE_UYVY
|
||||
};
|
||||
|
||||
static void
|
||||
MGAResetVideoOverlay(ScrnInfoPtr pScrn)
|
||||
static void
|
||||
MGAResetVideoOverlay(ScrnInfoPtr pScrn)
|
||||
{
|
||||
MGAPtr pMga = MGAPTR(pScrn);
|
||||
MGAPortPrivPtr pPriv = pMga->portPrivate;
|
||||
|
||||
CHECK_DMA_QUIESCENT(pMga, pScrn);
|
||||
|
||||
|
||||
outMGAdac(0x51, 0x01); /* keying on */
|
||||
outMGAdac(0x52, 0xff); /* full mask */
|
||||
outMGAdac(0x53, 0xff);
|
||||
outMGAdac(0x54, 0xff);
|
||||
|
||||
outMGAdac(0x55, (pPriv->colorKey & pScrn->mask.red) >>
|
||||
outMGAdac(0x55, (pPriv->colorKey & pScrn->mask.red) >>
|
||||
pScrn->offset.red);
|
||||
outMGAdac(0x56, (pPriv->colorKey & pScrn->mask.green) >>
|
||||
outMGAdac(0x56, (pPriv->colorKey & pScrn->mask.green) >>
|
||||
pScrn->offset.green);
|
||||
outMGAdac(0x57, (pPriv->colorKey & pScrn->mask.blue) >>
|
||||
outMGAdac(0x57, (pPriv->colorKey & pScrn->mask.blue) >>
|
||||
pScrn->offset.blue);
|
||||
|
||||
OUTREG(MGAREG_BESLUMACTL, ((pPriv->brightness & 0xff) << 16) |
|
||||
@@ -224,7 +224,7 @@ MGAAllocAdaptor(ScrnInfoPtr pScrn, Bool doublebuffer)
|
||||
return NULL;
|
||||
|
||||
if(!(pPriv = calloc(1, sizeof(MGAPortPrivRec) +
|
||||
(sizeof(DevUnion) * MGA_MAX_PORTS))))
|
||||
(sizeof(DevUnion) * MGA_MAX_PORTS))))
|
||||
{
|
||||
free(adapt);
|
||||
return NULL;
|
||||
@@ -238,15 +238,15 @@ MGAAllocAdaptor(ScrnInfoPtr pScrn, Bool doublebuffer)
|
||||
xvBrightness = MAKE_ATOM("XV_BRIGHTNESS");
|
||||
xvContrast = MAKE_ATOM("XV_CONTRAST");
|
||||
xvColorKey = MAKE_ATOM("XV_COLORKEY");
|
||||
xvDoubleBuffer = MAKE_ATOM("XV_DOUBLE_BUFFER");
|
||||
xvDoubleBuffer = MAKE_ATOM("XV_DOUBLE_BUFFER");
|
||||
|
||||
pPriv->colorKey = pMga->videoKey;
|
||||
pPriv->videoStatus = 0;
|
||||
pPriv->brightness = 0;
|
||||
pPriv->contrast = 128;
|
||||
pPriv->lastPort = -1;
|
||||
pPriv->doubleBuffer = doublebuffer;
|
||||
pPriv->currentBuffer = 0;
|
||||
pPriv->doubleBuffer = doublebuffer;
|
||||
pPriv->currentBuffer = 0;
|
||||
|
||||
pMga->adaptor = adapt;
|
||||
pMga->portPrivate = pPriv;
|
||||
@@ -254,7 +254,7 @@ MGAAllocAdaptor(ScrnInfoPtr pScrn, Bool doublebuffer)
|
||||
return adapt;
|
||||
}
|
||||
|
||||
static XF86VideoAdaptorPtr
|
||||
static XF86VideoAdaptorPtr
|
||||
MGASetupImageVideoOverlay(ScreenPtr pScreen)
|
||||
{
|
||||
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
|
||||
@@ -274,7 +274,7 @@ MGASetupImageVideoOverlay(ScreenPtr pScreen)
|
||||
adapt->pFormats = Formats;
|
||||
adapt->nPorts = 1;
|
||||
adapt->pAttributes = Attributes;
|
||||
if (pMga->Chipset == PCI_CHIP_MGAG400 ||
|
||||
if (pMga->Chipset == PCI_CHIP_MGAG400 ||
|
||||
pMga->Chipset == PCI_CHIP_MGAG550) {
|
||||
adapt->nImages = 4;
|
||||
adapt->nAttributes = 4;
|
||||
@@ -303,7 +303,7 @@ MGASetupImageVideoOverlay(ScreenPtr pScreen)
|
||||
}
|
||||
|
||||
|
||||
static XF86VideoAdaptorPtr
|
||||
static XF86VideoAdaptorPtr
|
||||
MGASetupImageVideoTexture(ScreenPtr pScreen)
|
||||
{
|
||||
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
|
||||
@@ -345,7 +345,7 @@ MGASetupImageVideoTexture(ScreenPtr pScreen)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
static void
|
||||
MGAStopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown)
|
||||
{
|
||||
MGAPtr pMga = MGAPTR(pScrn);
|
||||
@@ -353,7 +353,7 @@ MGAStopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown)
|
||||
|
||||
if(pMga->TexturedVideo) return;
|
||||
|
||||
REGION_EMPTY(pScrn->pScreen, &pPriv->clip);
|
||||
REGION_EMPTY(pScrn->pScreen, &pPriv->clip);
|
||||
|
||||
if(shutdown) {
|
||||
if(pPriv->videoStatus & CLIENT_VIDEO_ON)
|
||||
@@ -366,16 +366,16 @@ MGAStopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown)
|
||||
} else {
|
||||
if(pPriv->videoStatus & CLIENT_VIDEO_ON) {
|
||||
pPriv->videoStatus |= OFF_TIMER;
|
||||
pPriv->offTime = currentTime.milliseconds + OFF_DELAY;
|
||||
pPriv->offTime = currentTime.milliseconds + OFF_DELAY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
static int
|
||||
MGASetPortAttributeOverlay(
|
||||
ScrnInfoPtr pScrn,
|
||||
ScrnInfoPtr pScrn,
|
||||
Atom attribute,
|
||||
INT32 value,
|
||||
INT32 value,
|
||||
pointer data
|
||||
){
|
||||
MGAPtr pMga = MGAPTR(pScrn);
|
||||
@@ -399,28 +399,28 @@ MGASetPortAttributeOverlay(
|
||||
} else
|
||||
if(attribute == xvColorKey) {
|
||||
pPriv->colorKey = value;
|
||||
outMGAdac(0x55, (pPriv->colorKey & pScrn->mask.red) >>
|
||||
outMGAdac(0x55, (pPriv->colorKey & pScrn->mask.red) >>
|
||||
pScrn->offset.red);
|
||||
outMGAdac(0x56, (pPriv->colorKey & pScrn->mask.green) >>
|
||||
outMGAdac(0x56, (pPriv->colorKey & pScrn->mask.green) >>
|
||||
pScrn->offset.green);
|
||||
outMGAdac(0x57, (pPriv->colorKey & pScrn->mask.blue) >>
|
||||
outMGAdac(0x57, (pPriv->colorKey & pScrn->mask.blue) >>
|
||||
pScrn->offset.blue);
|
||||
REGION_EMPTY(pScrn->pScreen, &pPriv->clip);
|
||||
REGION_EMPTY(pScrn->pScreen, &pPriv->clip);
|
||||
} else
|
||||
if(attribute == xvDoubleBuffer) {
|
||||
if((value < 0) || (value > 1))
|
||||
return BadValue;
|
||||
pPriv->doubleBuffer = value;
|
||||
pPriv->doubleBuffer = value;
|
||||
} else return BadMatch;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
static int
|
||||
static int
|
||||
MGAGetPortAttributeOverlay(
|
||||
ScrnInfoPtr pScrn,
|
||||
ScrnInfoPtr pScrn,
|
||||
Atom attribute,
|
||||
INT32 *value,
|
||||
INT32 *value,
|
||||
pointer data
|
||||
){
|
||||
MGAPtr pMga = MGAPTR(pScrn);
|
||||
@@ -443,38 +443,38 @@ MGAGetPortAttributeOverlay(
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
static int
|
||||
MGASetPortAttributeTexture(
|
||||
ScrnInfoPtr pScrn,
|
||||
ScrnInfoPtr pScrn,
|
||||
Atom attribute,
|
||||
INT32 value,
|
||||
INT32 value,
|
||||
pointer data
|
||||
) {
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
static int
|
||||
MGAGetPortAttributeTexture(
|
||||
ScrnInfoPtr pScrn,
|
||||
ScrnInfoPtr pScrn,
|
||||
Atom attribute,
|
||||
INT32 *value,
|
||||
INT32 *value,
|
||||
pointer data
|
||||
){
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
MGAQueryBestSize(
|
||||
ScrnInfoPtr pScrn,
|
||||
ScrnInfoPtr pScrn,
|
||||
Bool motion,
|
||||
short vid_w, short vid_h,
|
||||
short drw_w, short drw_h,
|
||||
unsigned int *p_w, unsigned int *p_h,
|
||||
short vid_w, short vid_h,
|
||||
short drw_w, short drw_h,
|
||||
unsigned int *p_w, unsigned int *p_h,
|
||||
pointer data
|
||||
){
|
||||
*p_w = drw_w;
|
||||
*p_h = drw_h;
|
||||
*p_h = drw_h;
|
||||
}
|
||||
|
||||
|
||||
@@ -610,7 +610,7 @@ MGADisplayVideoOverlay(
|
||||
int id,
|
||||
int offset,
|
||||
short width, short height,
|
||||
int pitch,
|
||||
int pitch,
|
||||
int x1, int y1, int x2, int y2,
|
||||
BoxPtr dstBox,
|
||||
short src_w, short src_h,
|
||||
@@ -656,16 +656,16 @@ MGADisplayVideoOverlay(
|
||||
|
||||
if(y1 & 0x00010000)
|
||||
OUTREG(MGAREG_BESCTL, 0x00040c41);
|
||||
else
|
||||
else
|
||||
OUTREG(MGAREG_BESCTL, 0x00040c01);
|
||||
|
||||
|
||||
OUTREG(MGAREG_BESHCOORD, (dstBox->x1 << 16) | (dstBox->x2 - 1));
|
||||
OUTREG(MGAREG_BESVCOORD, (dstBox->y1 << 16) | (dstBox->y2 - 1));
|
||||
|
||||
OUTREG(MGAREG_BESHSRCST, x1 & 0x03fffffc);
|
||||
OUTREG(MGAREG_BESHSRCEND, (x2 - 0x00010000) & 0x03fffffc);
|
||||
OUTREG(MGAREG_BESHSRCLST, (width - 1) << 16);
|
||||
|
||||
|
||||
OUTREG(MGAREG_BESPITCH, pitch >> 1);
|
||||
|
||||
OUTREG(MGAREG_BESV1WGHT, y1 & 0x0000fffc);
|
||||
@@ -706,16 +706,16 @@ MGADisplayVideoTexture(
|
||||
){
|
||||
MGAPtr pMga = MGAPTR(pScrn);
|
||||
int log2w = 0, log2h = 0, i, incx, incy, padw, padh;
|
||||
|
||||
|
||||
pitch >>= 1;
|
||||
|
||||
i = 12;
|
||||
while(--i) {
|
||||
if(width & (1 << i)) {
|
||||
log2w = i;
|
||||
if(width & ((1 << i) - 1))
|
||||
if(width & ((1 << i) - 1))
|
||||
log2w++;
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -723,9 +723,9 @@ MGADisplayVideoTexture(
|
||||
while(--i) {
|
||||
if(height & (1 << i)) {
|
||||
log2h = i;
|
||||
if(height & ((1 << i) - 1))
|
||||
log2h++;
|
||||
break;
|
||||
if(height & ((1 << i) - 1))
|
||||
log2h++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -733,7 +733,7 @@ MGADisplayVideoTexture(
|
||||
padh = 1 << log2h;
|
||||
incx = (src_w << 20)/(drw_w * padw);
|
||||
incy = (src_h << 20)/(drw_h * padh);
|
||||
|
||||
|
||||
CHECK_DMA_QUIESCENT(pMga, pScrn);
|
||||
|
||||
WAITFIFO(15);
|
||||
@@ -741,20 +741,20 @@ MGADisplayVideoTexture(
|
||||
OUTREG(MGAREG_TMR1, 0); /* sy inc */
|
||||
OUTREG(MGAREG_TMR2, 0); /* tx inc */
|
||||
OUTREG(MGAREG_TMR3, incy); /* ty inc */
|
||||
OUTREG(MGAREG_TMR4, 0x00000000);
|
||||
OUTREG(MGAREG_TMR4, 0x00000000);
|
||||
OUTREG(MGAREG_TMR5, 0x00000000);
|
||||
OUTREG(MGAREG_TMR8, 0x00010000);
|
||||
OUTREG(MGAREG_TEXORG, offset);
|
||||
OUTREG(MGAREG_TEXWIDTH, log2w | (((8 - log2w) & 63) << 9) |
|
||||
OUTREG(MGAREG_TEXWIDTH, log2w | (((8 - log2w) & 63) << 9) |
|
||||
((width - 1) << 18));
|
||||
OUTREG(MGAREG_TEXHEIGHT, log2h | (((8 - log2h) & 63) << 9) |
|
||||
OUTREG(MGAREG_TEXHEIGHT, log2h | (((8 - log2h) & 63) << 9) |
|
||||
((height - 1) << 18));
|
||||
if(id == FOURCC_UYVY)
|
||||
OUTREG(MGAREG_TEXCTL, 0x1A00010b | ((pitch & 0x07FF) << 9));
|
||||
else
|
||||
OUTREG(MGAREG_TEXCTL, 0x1A00010a | ((pitch & 0x07FF) << 9));
|
||||
OUTREG(MGAREG_TEXCTL2, 0x00000014);
|
||||
OUTREG(MGAREG_DWGCTL, 0x000c7076);
|
||||
OUTREG(MGAREG_DWGCTL, 0x000c7076);
|
||||
OUTREG(MGAREG_TEXFILTER, 0x01e00020);
|
||||
OUTREG(MGAREG_ALPHACTRL, 0x00000001);
|
||||
|
||||
@@ -766,7 +766,7 @@ MGADisplayVideoTexture(
|
||||
OUTREG(MGAREG_TMR6, (incx * (pbox->x1 - drw_x)) + padw);
|
||||
OUTREG(MGAREG_TMR7, (incy * (pbox->y1 - drw_y)) + padh);
|
||||
OUTREG(MGAREG_FXBNDRY, (pbox->x2 << 16) | (pbox->x1 & 0xffff));
|
||||
OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC,
|
||||
OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC,
|
||||
(pbox->y1 << 16) | (pbox->y2 - pbox->y1));
|
||||
pbox++;
|
||||
}
|
||||
@@ -774,15 +774,15 @@ MGADisplayVideoTexture(
|
||||
MGA_MARK_SYNC(pMga, pScrn);
|
||||
}
|
||||
|
||||
static int
|
||||
MGAPutImage(
|
||||
ScrnInfoPtr pScrn,
|
||||
short src_x, short src_y,
|
||||
static int
|
||||
MGAPutImage(
|
||||
ScrnInfoPtr pScrn,
|
||||
short src_x, short src_y,
|
||||
short drw_x, short drw_y,
|
||||
short src_w, short src_h,
|
||||
short src_w, short src_h,
|
||||
short drw_w, short drw_h,
|
||||
int id, unsigned char* buf,
|
||||
short width, short height,
|
||||
int id, unsigned char* buf,
|
||||
short width, short height,
|
||||
Bool Sync,
|
||||
RegionPtr clipBoxes, pointer data,
|
||||
DrawablePtr pDraw
|
||||
@@ -821,7 +821,7 @@ MGAPutImage(
|
||||
|
||||
dstPitch = ((width << 1) + 15) & ~15;
|
||||
new_size = dstPitch * height;
|
||||
|
||||
|
||||
switch(id) {
|
||||
case FOURCC_YV12:
|
||||
case FOURCC_I420:
|
||||
@@ -835,7 +835,7 @@ MGAPutImage(
|
||||
default:
|
||||
srcPitch = (width << 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
pPriv->video_offset = MGAAllocateMemory(pScrn, &pPriv->video_memory,
|
||||
pPriv->doubleBuffer ?
|
||||
@@ -872,7 +872,7 @@ MGAPutImage(
|
||||
offset3 = tmp;
|
||||
}
|
||||
nlines = ((((y2 + 0xffff) >> 16) + 1) & ~1) - top;
|
||||
MGACopyMungedData(buf + (top * srcPitch) + (left >> 1),
|
||||
MGACopyMungedData(buf + (top * srcPitch) + (left >> 1),
|
||||
buf + offset2, buf + offset3, dst_start,
|
||||
srcPitch, srcPitch2, dstPitch, nlines, npixels);
|
||||
break;
|
||||
@@ -887,7 +887,7 @@ MGAPutImage(
|
||||
|
||||
if(pMga->TexturedVideo) {
|
||||
pPriv->lastPort = (long)data;
|
||||
MGADisplayVideoTexture(pScrn, id, offset,
|
||||
MGADisplayVideoTexture(pScrn, id, offset,
|
||||
REGION_NUM_RECTS(clipBoxes), REGION_RECTS(clipBoxes),
|
||||
width, height, dstPitch, src_x, src_y, src_w, src_h,
|
||||
drw_x, drw_y, drw_w, drw_h);
|
||||
@@ -913,11 +913,11 @@ MGAPutImage(
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
static int
|
||||
MGAQueryImageAttributes(
|
||||
ScrnInfoPtr pScrn,
|
||||
int id,
|
||||
unsigned short *w, unsigned short *h,
|
||||
ScrnInfoPtr pScrn,
|
||||
int id,
|
||||
unsigned short *w, unsigned short *h,
|
||||
int *pitches, int *offsets
|
||||
){
|
||||
MGAPtr pMga = MGAPTR(pScrn);
|
||||
@@ -996,11 +996,11 @@ typedef struct {
|
||||
Bool isOn;
|
||||
} OffscreenPrivRec, * OffscreenPrivPtr;
|
||||
|
||||
static int
|
||||
static int
|
||||
MGAAllocateSurface(
|
||||
ScrnInfoPtr pScrn,
|
||||
int id,
|
||||
unsigned short w,
|
||||
unsigned short w,
|
||||
unsigned short h,
|
||||
XF86SurfacePtr surface
|
||||
){
|
||||
@@ -1043,7 +1043,7 @@ MGAAllocateSurface(
|
||||
pPriv->isOn = FALSE;
|
||||
|
||||
surface->pScrn = pScrn;
|
||||
surface->id = id;
|
||||
surface->id = id;
|
||||
surface->pitches[0] = pitch;
|
||||
surface->offsets[0] = offset;
|
||||
surface->devPrivate.ptr = (pointer)pPriv;
|
||||
@@ -1051,7 +1051,7 @@ MGAAllocateSurface(
|
||||
return Success;
|
||||
}
|
||||
|
||||
static int
|
||||
static int
|
||||
MGAStopSurface(
|
||||
XF86SurfacePtr surface
|
||||
){
|
||||
@@ -1068,7 +1068,7 @@ MGAStopSurface(
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
static int
|
||||
MGAFreeSurface(
|
||||
XF86SurfacePtr surface
|
||||
){
|
||||
@@ -1104,12 +1104,12 @@ MGASetSurfaceAttribute(
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
static int
|
||||
MGADisplaySurface(
|
||||
XF86SurfacePtr surface,
|
||||
short src_x, short src_y,
|
||||
short src_x, short src_y,
|
||||
short drw_x, short drw_y,
|
||||
short src_w, short src_h,
|
||||
short src_w, short src_h,
|
||||
short drw_w, short drw_h,
|
||||
RegionPtr clipBoxes
|
||||
){
|
||||
@@ -1130,7 +1130,7 @@ MGADisplaySurface(
|
||||
dstBox.y1 = drw_y;
|
||||
dstBox.y2 = drw_y + drw_h;
|
||||
|
||||
if(!xf86XVClipVideoHelper(&dstBox, &x1, &x2, &y1, &y2, clipBoxes,
|
||||
if(!xf86XVClipVideoHelper(&dstBox, &x1, &x2, &y1, &y2, clipBoxes,
|
||||
surface->width, surface->height))
|
||||
{
|
||||
return Success;
|
||||
@@ -1143,7 +1143,7 @@ MGADisplaySurface(
|
||||
|
||||
MGAResetVideoOverlay(pScrn);
|
||||
|
||||
MGADisplayVideoOverlay(pScrn, surface->id, surface->offsets[0],
|
||||
MGADisplayVideoOverlay(pScrn, surface->id, surface->offsets[0],
|
||||
surface->width, surface->height, surface->pitches[0],
|
||||
x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h);
|
||||
|
||||
@@ -1152,7 +1152,7 @@ MGADisplaySurface(
|
||||
pPriv->isOn = TRUE;
|
||||
/* we've prempted the XvImage stream so set its free timer */
|
||||
if(portPriv->videoStatus & CLIENT_VIDEO_ON) {
|
||||
REGION_EMPTY(pScrn->pScreen, &portPriv->clip);
|
||||
REGION_EMPTY(pScrn->pScreen, &portPriv->clip);
|
||||
UpdateCurrentTime();
|
||||
portPriv->videoStatus = FREE_TIMER;
|
||||
portPriv->freeTime = currentTime.milliseconds + FREE_DELAY;
|
||||
@@ -1163,7 +1163,7 @@ MGADisplaySurface(
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
static void
|
||||
MGAInitOffscreenImages(ScreenPtr pScreen)
|
||||
{
|
||||
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
|
||||
@@ -1176,7 +1176,7 @@ MGAInitOffscreenImages(ScreenPtr pScreen)
|
||||
return;
|
||||
|
||||
offscreenImages[0].image = &Images[0];
|
||||
offscreenImages[0].flags = VIDEO_OVERLAID_IMAGES |
|
||||
offscreenImages[0].flags = VIDEO_OVERLAID_IMAGES |
|
||||
VIDEO_CLIP_TO_VIEWPORT;
|
||||
offscreenImages[0].alloc_surface = MGAAllocateSurface;
|
||||
offscreenImages[0].free_surface = MGAFreeSurface;
|
||||
@@ -1191,7 +1191,7 @@ MGAInitOffscreenImages(ScreenPtr pScreen)
|
||||
|
||||
if(num == 2) {
|
||||
offscreenImages[1].image = &Images[3];
|
||||
offscreenImages[1].flags = VIDEO_OVERLAID_IMAGES |
|
||||
offscreenImages[1].flags = VIDEO_OVERLAID_IMAGES |
|
||||
VIDEO_CLIP_TO_VIEWPORT;
|
||||
offscreenImages[1].alloc_surface = MGAAllocateSurface;
|
||||
offscreenImages[1].free_surface = MGAFreeSurface;
|
||||
@@ -1210,7 +1210,7 @@ MGAInitOffscreenImages(ScreenPtr pScreen)
|
||||
|
||||
|
||||
/* Matrox MGA 2164W Xv extension support.
|
||||
* The extension is implemented as a HOST->FB image load in YUV format.
|
||||
* The extension is implemented as a HOST->FB image load in YUV format.
|
||||
* I decided not to use real hardware overlay since on the Millennium II
|
||||
* it would limit the size of the frame buffer to 4Mb (even on a 16Mb
|
||||
* card) due to an hardware limitation.
|
||||
@@ -1253,7 +1253,7 @@ MGASetupImageVideoILOAD(ScreenPtr pScreen)
|
||||
adapt->nPorts = MGA_MAX_PORTS;
|
||||
adapt->pAttributes = NULL;
|
||||
adapt->nAttributes = 0;
|
||||
|
||||
|
||||
/* number of supported color formats */
|
||||
adapt->pImages = Images;
|
||||
adapt->nImages = 4;
|
||||
@@ -1263,7 +1263,7 @@ MGASetupImageVideoILOAD(ScreenPtr pScreen)
|
||||
adapt->GetVideo = NULL;
|
||||
adapt->GetStill = NULL;
|
||||
adapt->StopVideo = MGAStopVideo;
|
||||
|
||||
|
||||
adapt->SetPortAttribute = MGASetPortAttributeTexture;
|
||||
adapt->GetPortAttribute = MGAGetPortAttributeTexture;
|
||||
adapt->QueryBestSize = MGAQueryBestSize;
|
||||
@@ -1275,14 +1275,14 @@ MGASetupImageVideoILOAD(ScreenPtr pScreen)
|
||||
return adapt;
|
||||
}
|
||||
|
||||
/* this function is optimized for alpha. It might be better also for
|
||||
other load/store risc architectures but I never tested on anything else
|
||||
/* this function is optimized for alpha. It might be better also for
|
||||
other load/store risc architectures but I never tested on anything else
|
||||
than my ev56 */
|
||||
static void CopyMungedScanline_AXP(CARD32 *fb_ptr, short src_w,
|
||||
CARD32 *tsp, CARD32 *tpu, CARD32 *tpv)
|
||||
{
|
||||
CARD32 k,y0,y1,u,v;
|
||||
|
||||
|
||||
for(k=src_w/8;k;k--) {
|
||||
y0=*tsp;
|
||||
y1=*(tsp+1);
|
||||
@@ -1309,7 +1309,7 @@ static void CopyMungedScanline_AXP(CARD32 *fb_ptr, short src_w,
|
||||
*(fb_ptr+3)=((y1&0x00ff0000)>>16)|((y1&0xff000000)>>8) |
|
||||
(v&0xff000000) | (u&0xff000000)>>16; */
|
||||
|
||||
tsp+=2; tpu++; tpv++;
|
||||
tsp+=2; tpu++; tpv++;
|
||||
fb_ptr+=4;
|
||||
}
|
||||
}
|
||||
@@ -1354,7 +1354,7 @@ static void CopyMungedScanlineFilter_AXP(CARD32 *fb_ptr, short src_w,
|
||||
u=*tpu1;
|
||||
v=*tpv1;
|
||||
|
||||
tsp1+=2; tsp2+=2; tpu1++; tpv1++;
|
||||
tsp1+=2; tsp2+=2; tpu1++; tpv1++;
|
||||
yf[0] = ((y0_1&0x000000ff)*oneminbeta + (y0_2&0x000000ff)*beta )>>8;
|
||||
yf[1] = (((y0_1&0x0000ff00)>>8)*oneminbeta + ((y0_2&0x0000ff00)>>8)*beta )>>8;
|
||||
yf[2] = (((y0_1&0x00ff0000)>>16)*oneminbeta + ((y0_2&0x00ff0000)>>16)*beta )>>8;
|
||||
@@ -1416,7 +1416,7 @@ static void CopyMungedScanlineFilterDown_AXP(CARD32 *fb_ptr, short src_w,
|
||||
{
|
||||
unsigned int k,y0_1,y1_1,y0_2,y1_2,u,v;
|
||||
int yf[8], uf[4], vf[4];
|
||||
|
||||
|
||||
for(k=src_w/8;k;k--) {
|
||||
y0_1=*tsp1;
|
||||
y1_1=*(tsp1+1);
|
||||
@@ -1581,7 +1581,7 @@ static void MGACopyScaledILOAD(
|
||||
|
||||
OUTREG(MGAREG_DWGCTL, MGADWG_ILOAD_HIQH | MGADWG_BUYUV | MGADWG_SHIFTZERO
|
||||
| MGADWG_SGNZERO | 0xc0000);
|
||||
|
||||
|
||||
OUTREG(MGAREG_AR0, pbox->x1 + drw_w -1); /* SRC LINE END why -1 ? */
|
||||
OUTREG(MGAREG_AR2, ( ( (src_w-1)<<16) / (drw_w-1)) + 1 ); /* ((SRC_X_DIM -1)<<16) / (DST_X_DIM-1) +1 */
|
||||
OUTREG(MGAREG_AR3, pbox->x1 ); /* SRC LINE START*/
|
||||
@@ -1591,11 +1591,11 @@ static void MGACopyScaledILOAD(
|
||||
OUTREG(MGAREG_CXBNDRY, pbox->x1 | ((pbox->x2-1)<<16 ) );
|
||||
OUTREG(MGAREG_YDST , pbox->y1+dl ); /* Y_START_POS */
|
||||
OUTREG(MGAREG_LEN + MGAREG_EXEC , 1); /* # of LINES */
|
||||
|
||||
|
||||
/* xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Data finished\n"); */
|
||||
|
||||
|
||||
fb_ptr=(CARD32 *)pMga->ILOADBase;
|
||||
|
||||
|
||||
switch(id) {
|
||||
case FOURCC_YV12:
|
||||
case FOURCC_I420:
|
||||
@@ -1616,7 +1616,7 @@ static void MGACopyScaledILOAD(
|
||||
/* CopyMungedScanline_AXP(fb_ptr,src_w,tsp,tpu,tpv); */
|
||||
|
||||
/* Filter does not work yet */
|
||||
CopyMungedScanlineFilter_AXP(fb_ptr,src_w,tsp,tpu,tpv,tsp2,tpu,tpv, beta, xds);
|
||||
CopyMungedScanlineFilter_AXP(fb_ptr,src_w,tsp,tpu,tpv,tsp2,tpu,tpv, beta, xds);
|
||||
/* if(l&1) {
|
||||
pu+=width/8;
|
||||
pv+=width/8;
|
||||
@@ -1762,12 +1762,12 @@ static void MGACopyILOAD(
|
||||
|
||||
#ifdef DEBUG_MGA2164
|
||||
char sbuf[255];
|
||||
|
||||
|
||||
sprintf(sbuf,"---- PBOX: x1=%d y1=%d w=%d h=%d (x2=%d y2=%d)\n",
|
||||
pbox->x1,pbox->y1,pbox->x2-pbox->x1,pbox->y2-pbox->y1,
|
||||
pbox->x2,pbox->y2);
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_INFO, sbuf);
|
||||
|
||||
|
||||
sprintf(sbuf,"in src: src_x=%d src_y=%d src_w=%d src_h=%d\n",
|
||||
src_x,src_y,src_w,src_h);
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_INFO, sbuf);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
|
||||
Tech Note: dwg.c
|
||||
|
||||
author: ajv
|
||||
author: ajv
|
||||
|
||||
purpose: to display MGA Storm's dwg register in human readable output.
|
||||
|
||||
@@ -10,12 +10,12 @@ compilation: cc -o stormdwg stormdwg.c or just type make
|
||||
usage: stormdwg hexval
|
||||
|
||||
hexval will then be decomposed into it's constituent parts and displayed in human
|
||||
readable format.
|
||||
readable format.
|
||||
|
||||
BUGS: none known except that it needs to kept up to date if the storms
|
||||
spec is changed
|
||||
|
||||
NOTE: This is not by itself a very usable utility.
|
||||
NOTE: This is not by itself a very usable utility.
|
||||
|
||||
Andrew van der Stock
|
||||
ajv@greebo.net
|
||||
|
||||
@@ -98,7 +98,7 @@ int main(int argc, char **argv)
|
||||
{
|
||||
fprintf(stderr, "usage: %s hexval\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
val = strtoul(argv[1], NULL, 16);
|
||||
|
||||
@@ -115,7 +115,7 @@ int main(int argc, char **argv)
|
||||
printf("atype: %s\n", atype[tmp]);
|
||||
|
||||
|
||||
if ( val & 128 )
|
||||
if ( val & 128 )
|
||||
printf("xy bitblt\n");
|
||||
else
|
||||
printf("linear bitblt\n");
|
||||
@@ -148,7 +148,7 @@ int main(int argc, char **argv)
|
||||
printf("shift is not affected\n");
|
||||
|
||||
|
||||
tmp = (val>>16) & 0x0f;
|
||||
tmp = (val>>16) & 0x0f;
|
||||
|
||||
if ( ((val >> 4) & 7) == 4 && tmp != 0x0c )
|
||||
printf("Error! Block (BLK) atype and non-source binary op chosen. Replace (S) bop will be used.\n");
|
||||
|
||||
Reference in New Issue
Block a user