Cursor code clean-up.

Eliminate several unused cursor related structure fields.  Fix HW
cursor on little-endian systems.  General clean-up.
This commit is contained in:
Ian Romanick
2006-11-20 14:13:32 -08:00
parent aa13e9098f
commit d2e6bc53f7
4 changed files with 18 additions and 82 deletions

View File

@@ -592,7 +592,6 @@ typedef struct {
Bool DGAactive;
Bool NoAccel;
Bool NoXvideo;
Bool HWCursor;
Bool TurboQueue;
int VESA;
int ForceCRT1Type;
@@ -618,14 +617,11 @@ typedef struct {
int xcurrent; /* for temp use in accel */
int ycurrent; /* for temp use in accel */
int CommandReg;
CARD16 CursorSize; /* Size of HWCursor area (bytes) */
/**
* see xgi_driver.c and xgi_cursor.c
*
* \bug This field is set to 0 but never used.
*/
CARD32 cursorOffset;
Bool HWCursor;
CARD16 CursorSize; /* Size of HWCursor area (bytes) */
xf86CursorInfoPtr CursorInfoPtr;
unsigned CursorOffset;
/**
* \bug This field is set to \c FALSE but never used.
@@ -634,7 +630,6 @@ typedef struct {
XGIRegRec SavedReg;
XGIRegRec ModeReg;
xf86CursorInfoPtr CursorInfoPtr;
XAAInfoRecPtr AccelInfoPtr;
CloseScreenProcPtr CloseScreen;
Bool (*ModeInit)(ScrnInfoPtr pScrn, DisplayModePtr mode);
@@ -804,11 +799,6 @@ typedef struct {
#endif
unsigned long ChipFlags;
unsigned long XGI_SD_Flags;
BOOLEAN UseHWARGBCursor;
int OptUseColorCursor;
int OptUseColorCursorBlend;
CARD32 OptColorCursorBlendThreshold;
unsigned short cursorBufferNum;
int vb;
BOOLEAN restorebyset;
BOOLEAN nocrt2ddcdetection;
@@ -831,9 +821,6 @@ typedef struct {
int FSTN;
BOOLEAN AddedPlasmaModes;
short scrnPitch2;
CARD32 CurFGCol, CurBGCol;
unsigned char * CurMonoSrc;
CARD32 * CurARGBDest;
unsigned long mmioSize;
#ifdef XGIMERGED
Bool MergedFB, MergedFBAuto;
@@ -860,7 +847,6 @@ typedef struct {
Bool AtLeastOneNonClone;
#endif
#endif
unsigned CursorOffset ;
/* Added for 3D */
unsigned long cmdQueue_shareWP_only2D;

View File

@@ -38,6 +38,7 @@
#include "xf86.h"
#include "xf86PciInfo.h"
#include "cursorstr.h"
#include "misc.h"
#include "vgaHW.h"
#include "xgi.h"
#include "regs.h"
@@ -49,13 +50,12 @@ extern void XGIWaitRetraceCRT1(ScrnInfoPtr pScrn);
extern void XGIWaitRetraceCRT2(ScrnInfoPtr pScrn);
static void XGIG1_SetCursorPosition(ScrnInfoPtr pScrn, int x, int y) ;
CARD32 BE_SWAP32 (CARD32 val)
{
return ((((val) & 0x000000ff) << 24) | \
(((val) & 0x0000ff00) << 8) | \
(((val) & 0x00ff0000) >> 8) | \
(((val) & 0xff000000) >> 24));
}
#if X_BYTE_ORDER == X_BIG_ENDIAN
# define BE_SWAP32(v) (lswapl(v))
#else
# define BE_SWAP32(v) (v)
#endif
/* Helper function for Xabre to convert mono image to ARGB */
/* The Xabre's cursor engine for CRT2 is buggy and can't
@@ -89,11 +89,7 @@ Volari_HideCursor(ScrnInfoPtr pScrn)
xgiG1CRT2_DisableHWCursor() ;
}
XGIG1_SetCursorPosition(pScrn, currX, currY) ;
vWaitCRT1VerticalRetrace(pScrn) ;
//#ifdef DEBUG4
XGIDumpCursorMMIO(pScrn) ;
//#endif
vWaitCRT1VerticalRetrace(pScrn) ;
}
static void
@@ -123,7 +119,6 @@ XGIG1_SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
xgiG1CRT2_SetCursorPositionX(x+13, x_preset) ;
xgiG1CRT2_SetCursorPositionY(y, y_preset) ;
}
XGIDumpCursorMMIO(pScrn);
}
static void
@@ -144,23 +139,16 @@ static void
Volari_LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
{
XGIPtr pXGI = XGIPTR(pScrn);
unsigned long cursor_addr = pXGI->CursorOffset ;
unsigned long cursor_base = pXGI->CursorOffset/1024 ;
unsigned char *pCursorShape ;
const unsigned long cursor_base = pXGI->CursorOffset / 1024;
unsigned char *const pCursorShape =
pXGI->FbBase + pXGI->CursorOffset;
/* cursor_addr = 1024*1024 ; */
/* cursor_base = 1024 ; */
pCursorShape = pXGI->FbBase + cursor_addr ;
memcpy(pCursorShape, src, 1024);
xgiG2CRT1_SetCursorAddressPattern(cursor_base,0) ;
/* xgiG2CRT1_SetCursorAddress(cursor_base) ; */
/* xgiG2CRT1_SetCursorPatternSelect(0) ; */
if (pXGI->VBFlags & CRT2_ENABLE) {
xgiG2CRT2_SetCursorAddressPattern(cursor_base,0) ;
/* xgiG1CRT2_SetCursorAddress(cursor_base) ; */
/* xgiG1CRT2_SetCursorPatternSelect(0) ; */
}
XGIG1_SetCursorPosition(pScrn, currX, currY) ;
}
@@ -189,7 +177,6 @@ XGIHWCursorInit(ScreenPtr pScreen)
if(!infoPtr) return FALSE;
pXGI->CursorInfoPtr = infoPtr;
pXGI->UseHWARGBCursor = FALSE;
switch (pXGI->Chipset) {
@@ -220,25 +207,3 @@ XGIHWCursorInit(ScreenPtr pScreen)
return(xf86InitCursor(pScreen, infoPtr));
}
//#ifdef DEBUG4
void
XGIDumpCursorMMIO(ScrnInfoPtr pScrn)
{
XGIPtr pXGI = XGIPTR(pScrn);
unsigned long i ;
/*
ErrorF("-------------------------------------------------\n" ) ;
ErrorF("Dump Cursor Information\n" ) ;
ErrorF("-------------------------------------------------\n" ) ;
for( i = 0x8500 ; i < 0x8540 ; i+=0x10 )
{
ErrorF( "MMIO[%04lX]=%08lX ", i,XGIMMIOLONG(i) ) ;
ErrorF( "MMIO[%04lX]=%08lX ", i+4,XGIMMIOLONG(i+4) ) ;
ErrorF( "MMIO[%04lX]=%08lX ", i+8,XGIMMIOLONG(i+8) ) ;
ErrorF( "MMIO[%04lX]=%08lX\n", i+12,XGIMMIOLONG(i+12) ) ;
}
*/
}
//#endif

View File

@@ -2947,17 +2947,9 @@ XGIPreInit(ScrnInfoPtr pScrn, int flags)
pXGI->xgi_HwDevExt.bSkipDramSizing = TRUE;
/* Calculate real availMem according to Accel/TurboQueue and
* HWCursur setting. Also, initialize some variables used
* in other modules.
*/
pXGI->cursorOffset = 0;
pXGI->CurARGBDest = NULL;
pXGI->CurMonoSrc = NULL;
pXGI->CurFGCol = pXGI->CurBGCol = 0;
/* TQ is max 64KiB. Reduce the available memory by 64KiB, and locate the
* HWCursur setting.
*
* TQ is max 64KiB. Reduce the available memory by 64KiB, and locate the
* TQ at the beginning of this last 64KiB block. This is done even when
* using the HWCursor, because the cursor only takes 2KiB and the queue
* does not seem to last that far anyway.

View File

@@ -68,9 +68,6 @@ typedef enum {
OPTION_USEROMDATA,
OPTION_NOINTERNALMODES,
OPTION_USEOEM,
OPTION_USERGBCURSOR,
OPTION_USERGBCURSORBLEND,
OPTION_USERGBCURSORBLENDTH,
OPTION_RESTOREBYSET,
OPTION_NODDCFORCRT2,
OPTION_FORCECRT2REDETECTION,
@@ -139,9 +136,6 @@ static const OptionInfoRec XGIOptions[] = {
{ OPTION_USEROMDATA, "UseROMData", OPTV_BOOLEAN, {0}, -1 },
{ OPTION_NOINTERNALMODES, "NoInternalModes", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_USEOEM, "UseOEMData", OPTV_BOOLEAN, {0}, -1 },
{ OPTION_USERGBCURSOR, "UseColorHWCursor", OPTV_BOOLEAN, {0}, -1 },
{ OPTION_USERGBCURSORBLEND, "ColorHWCursorBlending", OPTV_BOOLEAN, {0}, -1 },
{ OPTION_USERGBCURSORBLENDTH, "ColorHWCursorBlendThreshold", OPTV_INTEGER,{0},-1 },
{ OPTION_RESTOREBYSET, "RestoreBySetMode", OPTV_BOOLEAN, {0}, -1 },
{ OPTION_NODDCFORCRT2, "NoCRT2Detection", OPTV_BOOLEAN, {0}, -1 },
{ OPTION_FORCECRT2REDETECTION, "ForceCRT2ReDetection", OPTV_BOOLEAN, {0}, -1 },
@@ -316,7 +310,6 @@ xgiOptions(ScrnInfoPtr pScrn)
if(xf86ReturnOptValBool(pXGI->Options, OPTION_SW_CURSOR, FALSE)) {
from = X_CONFIG;
pXGI->HWCursor = FALSE;
pXGI->OptUseColorCursor = 0;
}
xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n",
pXGI->HWCursor ? "HW" : "SW");