mirror of
https://github.com/X11Libre/xf86-video-s3virge.git
synced 2026-03-24 01:24:29 +00:00
Raise minimum supported Xserver version to 1.18 (ABI_VIDEODRV_VERSION 20.0)
Already effectively required by use of XNFcallocarray() introduced in xorg/xserver@b96dc999 - xserver-1.18.0, released in Nov. 2015. Allows dropping remnants of code for XAA and pre-pciaccess X servers Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-video-s3virge/-/merge_requests/8>
This commit is contained in:
20
configure.ac
20
configure.ac
@@ -58,7 +58,7 @@ XORG_DRIVER_CHECK_EXT(XV, videoproto)
|
||||
XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
|
||||
|
||||
# Obtain compiler/linker options for the driver dependencies
|
||||
PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.99.901 xproto fontsproto $REQUIRED_MODULES])
|
||||
PKG_CHECK_MODULES(XORG, [xorg-server >= 1.18 xproto fontsproto $REQUIRED_MODULES])
|
||||
PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
|
||||
HAVE_XEXTPROTO_71="yes"; AC_DEFINE(HAVE_XEXTPROTO_71, 1, [xextproto 7.1 available]),
|
||||
HAVE_XEXTPROTO_71="no")
|
||||
@@ -79,24 +79,6 @@ if test "x$XSERVER_LIBPCIACCESS" = xyes; then
|
||||
fi
|
||||
AM_CONDITIONAL(XSERVER_LIBPCIACCESS, test "x$XSERVER_LIBPCIACCESS" = xyes)
|
||||
|
||||
AC_ARG_ENABLE(xaa,
|
||||
AS_HELP_STRING([--enable-xaa],
|
||||
[Enable legacy X Acceleration Architecture (XAA) [default=auto]]),
|
||||
[XAA="$enableval"],
|
||||
[XAA=auto])
|
||||
if test "x$XAA" != xno; then
|
||||
save_CFLAGS=$CFLAGS
|
||||
save_CPPFLAGS=$CPPFLAGS
|
||||
CFLAGS=$XORG_CFLAGS
|
||||
CPPFLAGS="$XORG_CFLAGS"
|
||||
AC_CHECK_HEADERS([xaa.h], XAA=yes, XAA=no)
|
||||
CFLAGS=$save_CFLAGS
|
||||
CPPFLAGS=$save_CPPFLAGS
|
||||
fi
|
||||
AC_MSG_CHECKING([whether to include XAA support])
|
||||
AM_CONDITIONAL(XAA, test "x$XAA" = xyes)
|
||||
AC_MSG_RESULT([$XAA])
|
||||
|
||||
# Checks for library functions
|
||||
# We don't use strlcat, strlcpy, or timingsafe_memcmp, but check to quiet
|
||||
# -Wredundant-decls warning from xorg/os.h which will otherwise redefine them.
|
||||
|
||||
@@ -42,6 +42,5 @@ s3virge_drv_la_SOURCES = \
|
||||
s3v_macros.h \
|
||||
s3v_pciids.h \
|
||||
s3v_pcirename.h \
|
||||
s3v_rop.h \
|
||||
s3v_shadow.c \
|
||||
s3v_xv.c
|
||||
|
||||
12
src/s3v.h
12
src/s3v.h
@@ -59,11 +59,6 @@ in this Software without prior written authorization from the XFree86 Project.
|
||||
|
||||
#include "fb.h"
|
||||
|
||||
/* Drivers using the XAA interface ... */
|
||||
#ifdef HAVE_XAA_H
|
||||
#include "xaa.h"
|
||||
#include "xaalocal.h"
|
||||
#endif
|
||||
#include "xf86fbman.h"
|
||||
#include "xf86cmap.h"
|
||||
#include "xf86i2c.h"
|
||||
@@ -195,9 +190,6 @@ typedef struct tagS3VRec {
|
||||
/* Compatibility variables */
|
||||
int vgaCRIndex, vgaCRReg;
|
||||
int Width, Bpp,Bpl, ScissB;
|
||||
/* XAA */
|
||||
unsigned PlaneMask;
|
||||
int bltbug_width1, bltbug_width2;
|
||||
/* In units as noted, set in PreInit */
|
||||
int videoRambytes;
|
||||
int videoRamKbytes;
|
||||
@@ -280,10 +272,6 @@ typedef struct tagS3VRec {
|
||||
/* Pointer used to save wrapped */
|
||||
/* CloseScreen function. */
|
||||
CloseScreenProcPtr CloseScreen;
|
||||
#ifdef HAVE_XAA_H
|
||||
/* XAA info Rec */
|
||||
XAAInfoRecPtr AccelInfoRec;
|
||||
#endif
|
||||
/* PCI info vars. */
|
||||
pciVideoPtr PciInfo;
|
||||
#ifndef XSERVER_LIBPCIACCESS
|
||||
|
||||
698
src/s3v_accel.c
698
src/s3v_accel.c
@@ -38,204 +38,12 @@ in this Software without prior written authorization from the XFree86 Project.
|
||||
|
||||
#include "servermd.h" /* LOG2_BYTES_PER_SCANLINE_PAD */
|
||||
|
||||
#ifdef HAVE_XAA_H
|
||||
static void S3VWriteMask(CARD32*, int);
|
||||
|
||||
static void S3VEngineReset(ScrnInfoPtr pScrn);
|
||||
/* s3v.h - static void S3VAccelSync(ScrnInfoPtr); */
|
||||
static void S3VSetupForSolidFill(ScrnInfoPtr, int, int, unsigned);
|
||||
static void S3VSubsequentSolidFillRect(ScrnInfoPtr, int, int, int, int);
|
||||
static void S3VSubsequentSolidFillRectPlaneMask(ScrnInfoPtr, int, int,
|
||||
int, int);
|
||||
static void S3VSetupForMono8x8PatternFill(ScrnInfoPtr,int, int, int, int,
|
||||
int, unsigned int);
|
||||
static void S3VSubsequentMono8x8PatternFillRect(ScrnInfoPtr,int, int,
|
||||
int, int, int, int);
|
||||
static void S3VSubsequentMono8x8PatternFillRectPlaneMask(ScrnInfoPtr,int, int,
|
||||
int, int, int, int);
|
||||
static void S3VSetupForScreenToScreenCopy(ScrnInfoPtr, int, int, int,
|
||||
unsigned int, int);
|
||||
static void S3VSubsequentScreenToScreenCopy(ScrnInfoPtr, int, int, int, int,
|
||||
int, int);
|
||||
static void S3VSetupForCPUToScreenColorExpand(ScrnInfoPtr, int, int, int,
|
||||
unsigned int);
|
||||
static void S3VSubsequentCPUToScreenColorExpand(ScrnInfoPtr, int, int, int,
|
||||
int, int);
|
||||
static void S3VSetupForImageWrite(ScrnInfoPtr, int, unsigned int, int,
|
||||
int, int);
|
||||
static void S3VSubsequentImageWriteRect(ScrnInfoPtr, int, int, int, int, int);
|
||||
static void S3VSubsequentSolidHorVertLine(ScrnInfoPtr, int, int, int, int);
|
||||
static void S3VSubsequentSolidHorVertLinePlaneMask(ScrnInfoPtr, int, int,
|
||||
int, int);
|
||||
#if 0
|
||||
static void S3VSubsequentSolidBresenhamLine(ScrnInfoPtr, int, int, int,
|
||||
int, int, int, int);
|
||||
static void S3VPolylinesThinSolidWrapper(DrawablePtr, GCPtr, int, int,
|
||||
DDXPointPtr);
|
||||
static void S3VPolySegmentThinSolidWrapper(DrawablePtr, GCPtr, int, xSegment*);
|
||||
#endif
|
||||
#endif
|
||||
static void S3VNopAllCmdSets(ScrnInfoPtr pScrn);
|
||||
|
||||
Bool
|
||||
S3VAccelInit(ScreenPtr pScreen)
|
||||
{
|
||||
#ifdef HAVE_XAA_H
|
||||
XAAInfoRecPtr infoPtr;
|
||||
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
|
||||
S3VPtr ps3v = S3VPTR(pScrn);
|
||||
BoxRec AvailFBArea;
|
||||
|
||||
ps3v->AccelInfoRec = infoPtr = XAACreateInfoRec();
|
||||
if(!infoPtr) return FALSE;
|
||||
|
||||
switch(ps3v->Chipset)
|
||||
{
|
||||
case S3_ViRGE:
|
||||
case S3_ViRGE_VX:
|
||||
ps3v->AccelFlags = BLT_BUG;
|
||||
break;
|
||||
default:
|
||||
ps3v->AccelFlags = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
ps3v->AccelFlags |= MONO_TRANS_BUG; /* which aren't broken ? */
|
||||
|
||||
|
||||
infoPtr->Flags = PIXMAP_CACHE |
|
||||
LINEAR_FRAMEBUFFER |
|
||||
OFFSCREEN_PIXMAPS;
|
||||
|
||||
infoPtr->Sync = S3VAccelSync;
|
||||
|
||||
/* Problem reports with solid fill on trio3d */
|
||||
if(!S3_TRIO_3D_SERIES(ps3v->Chipset))
|
||||
{
|
||||
/* Solid filled rects */
|
||||
infoPtr->SetupForSolidFill =
|
||||
S3VSetupForSolidFill;
|
||||
infoPtr->SubsequentSolidFillRect =
|
||||
S3VSubsequentSolidFillRect;
|
||||
}
|
||||
|
||||
/* Screen to screen copies */
|
||||
infoPtr->SetupForScreenToScreenCopy =
|
||||
S3VSetupForScreenToScreenCopy;
|
||||
infoPtr->SubsequentScreenToScreenCopy =
|
||||
S3VSubsequentScreenToScreenCopy;
|
||||
infoPtr->ScreenToScreenCopyFlags = NO_TRANSPARENCY;
|
||||
|
||||
/* Mono 8x8 patterns */
|
||||
infoPtr->SetupForMono8x8PatternFill =
|
||||
S3VSetupForMono8x8PatternFill;
|
||||
infoPtr->SubsequentMono8x8PatternFillRect =
|
||||
S3VSubsequentMono8x8PatternFillRect;
|
||||
infoPtr->Mono8x8PatternFillFlags = NO_TRANSPARENCY |
|
||||
HARDWARE_PATTERN_PROGRAMMED_BITS |
|
||||
HARDWARE_PATTERN_SCREEN_ORIGIN |
|
||||
BIT_ORDER_IN_BYTE_MSBFIRST;
|
||||
|
||||
|
||||
#ifndef __alpha__
|
||||
|
||||
/* disable color expand on GX2 until we trace down */
|
||||
/* lockups. locate 'html' in an xterm is a good */
|
||||
/* test case for an AGP GX2. */
|
||||
if (!S3_ViRGE_GX2_SERIES(ps3v->Chipset))
|
||||
{
|
||||
|
||||
|
||||
/* CPU to screen color expansion */
|
||||
infoPtr->CPUToScreenColorExpandFillFlags = ROP_NEEDS_SOURCE |
|
||||
CPU_TRANSFER_PAD_DWORD |
|
||||
SCANLINE_PAD_DWORD |
|
||||
BIT_ORDER_IN_BYTE_MSBFIRST |
|
||||
LEFT_EDGE_CLIPPING;
|
||||
|
||||
if(ps3v->AccelFlags & MONO_TRANS_BUG)
|
||||
infoPtr->CPUToScreenColorExpandFillFlags |= NO_TRANSPARENCY;
|
||||
|
||||
infoPtr->ColorExpandRange = 0x8000;
|
||||
infoPtr->ColorExpandBase = ps3v->MapBaseDense;
|
||||
infoPtr->SetupForCPUToScreenColorExpandFill =
|
||||
S3VSetupForCPUToScreenColorExpand;
|
||||
infoPtr->SubsequentCPUToScreenColorExpandFill =
|
||||
S3VSubsequentCPUToScreenColorExpand;
|
||||
|
||||
} /* if(!GX2...) */
|
||||
|
||||
|
||||
/* Image Writes */
|
||||
infoPtr->ImageWriteFlags = ROP_NEEDS_SOURCE |
|
||||
NO_TRANSPARENCY |
|
||||
CPU_TRANSFER_PAD_DWORD |
|
||||
SCANLINE_PAD_DWORD |
|
||||
NO_GXCOPY | /* added - kjb */
|
||||
LEFT_EDGE_CLIPPING;
|
||||
|
||||
infoPtr->ImageWriteRange = 0x8000;
|
||||
infoPtr->ImageWriteBase = ps3v->MapBaseDense;
|
||||
infoPtr->SetupForImageWrite = S3VSetupForImageWrite;
|
||||
infoPtr->SubsequentImageWriteRect = S3VSubsequentImageWriteRect;
|
||||
|
||||
/* on alpha, I see corruption in the xscreensaver program "hypercube"
|
||||
as the line acceleration is just stubs, it loses us nothing to
|
||||
disable it on alphas */
|
||||
|
||||
/* Lines */
|
||||
#if 0
|
||||
/* Bresenham lines are broken when passed through fb to xaa
|
||||
so I pulled all the line functions. This shouldn't hurt us
|
||||
a whole lot, since the Subsequent..Bresen stuff doesn't have
|
||||
any hardware accel yet anyway... And xaa will do horiz/vert
|
||||
lines with the rect fill (like we are doing here) anyway.
|
||||
KJB 9/11/00
|
||||
*/
|
||||
infoPtr->SetupForSolidLine = S3VSetupForSolidFill;
|
||||
infoPtr->SubsequentSolidHorVertLine = S3VSubsequentSolidHorVertLine;
|
||||
infoPtr->SubsequentSolidBresenhamLine = S3VSubsequentSolidBresenhamLine;
|
||||
infoPtr->PolySegmentThinSolid = S3VPolySegmentThinSolidWrapper;
|
||||
infoPtr->PolylinesThinSolid = S3VPolylinesThinSolidWrapper;
|
||||
#endif
|
||||
|
||||
#endif /* !__alpha__ */
|
||||
|
||||
/* And these are screen parameters used to setup the GE */
|
||||
|
||||
ps3v->Width = pScrn->displayWidth;
|
||||
/* Bytes per pixel */
|
||||
ps3v->Bpp = pScrn->bitsPerPixel / 8;
|
||||
/* Bytes per line */
|
||||
ps3v->Bpl = ps3v->Width * ps3v->Bpp;
|
||||
/* ScissB is max height, minus 1k */
|
||||
/* for hwcursor?, then limited by */
|
||||
/* ViRGE max height register of */
|
||||
/* 2047 */
|
||||
ps3v->ScissB = (pScrn->videoRam * 1024 - 1024) / ps3v->Bpl;
|
||||
if (ps3v->ScissB > 2047)
|
||||
ps3v->ScissB = 2047;
|
||||
|
||||
|
||||
S3VEngineReset(pScrn);
|
||||
|
||||
|
||||
AvailFBArea.x1 = 0;
|
||||
AvailFBArea.y1 = 0;
|
||||
AvailFBArea.x2 = pScrn->displayWidth;
|
||||
AvailFBArea.y2 = (pScrn->videoRam * 1024 - 1024) /
|
||||
(pScrn->displayWidth * pScrn->bitsPerPixel / 8);
|
||||
|
||||
xf86InitFBManager(pScreen, &AvailFBArea);
|
||||
|
||||
/* make sure offscreen pixmaps aren't bigger than our address space */
|
||||
infoPtr->maxOffPixWidth = 2048;
|
||||
infoPtr->maxOffPixHeight = 2048;
|
||||
|
||||
return (XAAInit(pScreen, infoPtr));
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
Bool
|
||||
@@ -465,512 +273,6 @@ S3VAccelSync(ScrnInfoPtr pScrn)
|
||||
WAITIDLE();
|
||||
}
|
||||
|
||||
#ifdef HAVE_XAA_H
|
||||
static void
|
||||
S3VEngineReset(ScrnInfoPtr pScrn)
|
||||
{
|
||||
S3VPtr ps3v = S3VPTR(pScrn);
|
||||
|
||||
ps3v->SrcBaseY = 0;
|
||||
ps3v->DestBaseY = 0;
|
||||
ps3v->Stride = pScrn->displayWidth * pScrn->bitsPerPixel >> 3;
|
||||
|
||||
switch(pScrn->bitsPerPixel) {
|
||||
case 8: ps3v->CommonCmd = DRAW | DST_8BPP;
|
||||
ps3v->FullPlaneMask = 0x000000ff;
|
||||
ps3v->bltbug_width1 = 51;
|
||||
ps3v->bltbug_width2 = 64;
|
||||
break;
|
||||
case 16: ps3v->CommonCmd = DRAW | DST_16BPP;
|
||||
ps3v->FullPlaneMask = 0x0000ffff;
|
||||
ps3v->bltbug_width1 = 26;
|
||||
ps3v->bltbug_width2 = 32;
|
||||
break;
|
||||
case 24: ps3v->CommonCmd = DRAW | DST_24BPP;
|
||||
ps3v->FullPlaneMask = 0x00ffffff;
|
||||
ps3v->bltbug_width1 = 16;
|
||||
ps3v->bltbug_width2 = 22;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
WAITFIFO(5);
|
||||
OUTREG(SRC_BASE, 0);
|
||||
OUTREG(DEST_BASE, 0);
|
||||
OUTREG(DEST_SRC_STR, ps3v->Stride | (ps3v->Stride << 16));
|
||||
|
||||
OUTREG(CLIP_L_R, ((0) << 16) | ps3v->Width);
|
||||
OUTREG(CLIP_T_B, ((0) << 16) | ps3v->ScissB);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S3VWriteMask(
|
||||
CARD32 *dstBase,
|
||||
int dwords
|
||||
){
|
||||
/* on alphas, be sure to call this with MapBaseDense, not MapBase! */
|
||||
int numLeft;
|
||||
CARD32 *dst = dstBase;
|
||||
|
||||
while(dwords >= 8192) {
|
||||
numLeft = 8192;
|
||||
while(numLeft) {
|
||||
dst[0] = ~0; dst[1] = ~0;
|
||||
dst[2] = ~0; dst[3] = ~0;
|
||||
dst += 4;
|
||||
numLeft -= 4;
|
||||
}
|
||||
dwords -= 8192;
|
||||
dst = dstBase;
|
||||
}
|
||||
while(dwords >= 4) {
|
||||
dst[0] = ~0; dst[1] = ~0;
|
||||
dst[2] = ~0; dst[3] = ~0;
|
||||
dst += 4;
|
||||
dwords -= 4;
|
||||
}
|
||||
if(!dwords) return;
|
||||
dst[0] = ~0;
|
||||
if(dwords == 1) return;
|
||||
dst[1] = ~0;
|
||||
if(dwords == 2) return;
|
||||
dst[2] = ~0;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/************************\
|
||||
| Solid Filled Rects |
|
||||
\************************/
|
||||
|
||||
static void
|
||||
S3VSetupForSolidFill(
|
||||
ScrnInfoPtr pScrn,
|
||||
int color, int rop,
|
||||
unsigned int planemask
|
||||
){
|
||||
S3VPtr ps3v = S3VPTR(pScrn);
|
||||
int mix;
|
||||
|
||||
mix = XAAHelpSolidROP(pScrn, &color, planemask, &rop);
|
||||
|
||||
ps3v->AccelCmd = ps3v->CommonCmd | (rop << 17) |
|
||||
CMD_XP | CMD_YP | CMD_AUTOEXEC | CMD_BITBLT;
|
||||
|
||||
if(mix & ROP_SRC) {
|
||||
ps3v->AccelCmd |= MIX_CPUDATA | CMD_ITA_DWORD | MIX_MONO_SRC;
|
||||
ps3v->AccelInfoRec->SubsequentSolidFillRect =
|
||||
S3VSubsequentSolidFillRectPlaneMask;
|
||||
ps3v->AccelInfoRec->SubsequentSolidHorVertLine =
|
||||
S3VSubsequentSolidHorVertLinePlaneMask;
|
||||
WAITFIFO(5);
|
||||
OUTREG(SRC_FG_CLR, planemask);
|
||||
} else {
|
||||
ps3v->AccelInfoRec->SubsequentSolidFillRect =
|
||||
S3VSubsequentSolidFillRect;
|
||||
ps3v->AccelInfoRec->SubsequentSolidHorVertLine =
|
||||
S3VSubsequentSolidHorVertLine;
|
||||
WAITFIFO(4);
|
||||
}
|
||||
|
||||
if(mix & ROP_PAT) {
|
||||
ps3v->AccelCmd |= MIX_MONO_PATT;
|
||||
OUTREG(PAT_FG_CLR, color);
|
||||
OUTREG(MONO_PAT_0, ~0);
|
||||
OUTREG(MONO_PAT_1, ~0);
|
||||
}
|
||||
|
||||
OUTREG(CMD_SET, ps3v->AccelCmd);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
S3VSubsequentSolidFillRect(
|
||||
ScrnInfoPtr pScrn,
|
||||
int x, int y,
|
||||
int w, int h
|
||||
){
|
||||
S3VPtr ps3v = S3VPTR(pScrn);
|
||||
|
||||
CHECK_DEST_BASE(y,h);
|
||||
|
||||
WAITFIFO(2);
|
||||
OUTREG(RWIDTH_HEIGHT, ((w - 1) << 16) | h);
|
||||
WAITCMD();
|
||||
OUTREG(RDEST_XY, (x << 16) | y);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
S3VSubsequentSolidFillRectPlaneMask(
|
||||
ScrnInfoPtr pScrn,
|
||||
int x, int y,
|
||||
int w, int h
|
||||
){
|
||||
S3VPtr ps3v = S3VPTR(pScrn);
|
||||
int dwords;
|
||||
|
||||
CHECK_DEST_BASE(y,h);
|
||||
|
||||
dwords = ((w + 31) >> 5) * h;
|
||||
|
||||
WAITFIFO(2);
|
||||
OUTREG(RWIDTH_HEIGHT, ((w - 1) << 16) | h);
|
||||
WAITCMD();
|
||||
OUTREG(RDEST_XY, (x << 16) | y);
|
||||
S3VWriteMask((CARD32*)ps3v->MapBaseDense, dwords);
|
||||
}
|
||||
|
||||
|
||||
/**************************\
|
||||
| Screen to Screen Copies |
|
||||
\**************************/
|
||||
|
||||
static void
|
||||
S3VSetupForScreenToScreenCopy(
|
||||
ScrnInfoPtr pScrn,
|
||||
int xdir, int ydir,
|
||||
int rop,
|
||||
unsigned int planemask,
|
||||
int trans
|
||||
){
|
||||
S3VPtr ps3v = S3VPTR(pScrn);
|
||||
|
||||
planemask &= ps3v->FullPlaneMask;
|
||||
ps3v->AccelCmd = ps3v->CommonCmd | CMD_AUTOEXEC | CMD_BITBLT;
|
||||
|
||||
if(planemask != ps3v->FullPlaneMask) {
|
||||
ps3v->AccelCmd |= (XAAGetCopyROP_PM(rop) << 17) | MIX_MONO_PATT;
|
||||
WAITFIFO(4);
|
||||
OUTREG(PAT_FG_CLR, planemask);
|
||||
OUTREG(MONO_PAT_0, ~0);
|
||||
OUTREG(MONO_PAT_1, ~0);
|
||||
}
|
||||
else {
|
||||
ps3v->AccelCmd |= XAAGetCopyROP(rop) << 17;
|
||||
WAITFIFO(1);
|
||||
}
|
||||
if(xdir == 1) ps3v->AccelCmd |= CMD_XP;
|
||||
if(ydir == 1) ps3v->AccelCmd |= CMD_YP;
|
||||
|
||||
OUTREG(CMD_SET, ps3v->AccelCmd);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S3VSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1,
|
||||
int x2, int y2, int w, int h)
|
||||
{
|
||||
S3VPtr ps3v = S3VPTR(pScrn);
|
||||
|
||||
CHECK_SRC_BASE(y1,h);
|
||||
CHECK_DEST_BASE(y2,h);
|
||||
|
||||
w--;
|
||||
|
||||
if(!(ps3v->AccelCmd & CMD_YP)) {
|
||||
y1 += h - 1; y2 += h - 1;
|
||||
}
|
||||
|
||||
if(!(ps3v->AccelCmd & CMD_XP)) {
|
||||
x1 += w; x2 += w;
|
||||
}
|
||||
|
||||
WAITFIFO(3);
|
||||
OUTREG(RWIDTH_HEIGHT, (w << 16) | h);
|
||||
OUTREG(RSRC_XY, (x1 << 16) | y1);
|
||||
WAITCMD();
|
||||
OUTREG(RDEST_XY, (x2 << 16) | y2);
|
||||
}
|
||||
|
||||
|
||||
/*********************\
|
||||
| 8x8 Pattern fills |
|
||||
\*********************/
|
||||
|
||||
|
||||
static void
|
||||
S3VSetupForMono8x8PatternFill(
|
||||
ScrnInfoPtr pScrn,
|
||||
int patx, int paty,
|
||||
int fg, int bg,
|
||||
int rop, unsigned int planemask
|
||||
){
|
||||
S3VPtr ps3v = S3VPTR(pScrn);
|
||||
int mix;
|
||||
|
||||
mix = XAAHelpPatternROP(pScrn, &fg, &bg, planemask, &rop);
|
||||
|
||||
ps3v->AccelCmd = ps3v->CommonCmd | (rop << 17) |
|
||||
CMD_XP | CMD_YP | CMD_AUTOEXEC | CMD_BITBLT;
|
||||
|
||||
if(mix & ROP_SRC) {
|
||||
ps3v->AccelCmd |= MIX_CPUDATA | CMD_ITA_DWORD | MIX_MONO_SRC;
|
||||
ps3v->AccelInfoRec->SubsequentMono8x8PatternFillRect =
|
||||
S3VSubsequentMono8x8PatternFillRectPlaneMask;
|
||||
WAITFIFO(6);
|
||||
OUTREG(SRC_FG_CLR, planemask);
|
||||
} else {
|
||||
ps3v->AccelInfoRec->SubsequentMono8x8PatternFillRect =
|
||||
S3VSubsequentMono8x8PatternFillRect;
|
||||
WAITFIFO(5);
|
||||
}
|
||||
|
||||
if(mix & ROP_PAT) {
|
||||
ps3v->AccelCmd |= MIX_MONO_PATT;
|
||||
OUTREG(PAT_FG_CLR, fg);
|
||||
OUTREG(PAT_BG_CLR, bg);
|
||||
OUTREG(MONO_PAT_0, patx);
|
||||
OUTREG(MONO_PAT_1, paty);
|
||||
}
|
||||
|
||||
OUTREG(CMD_SET, ps3v->AccelCmd);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S3VSubsequentMono8x8PatternFillRect(
|
||||
ScrnInfoPtr pScrn,
|
||||
int patx, int paty,
|
||||
int x, int y, int w, int h
|
||||
){
|
||||
S3VPtr ps3v = S3VPTR(pScrn);
|
||||
|
||||
CHECK_DEST_BASE(y,h);
|
||||
|
||||
WAITFIFO(2);
|
||||
OUTREG(RWIDTH_HEIGHT, ((w - 1) << 16) | h);
|
||||
WAITCMD();
|
||||
OUTREG(RDEST_XY, (x << 16) | y);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S3VSubsequentMono8x8PatternFillRectPlaneMask(
|
||||
ScrnInfoPtr pScrn,
|
||||
int patx, int paty,
|
||||
int x, int y, int w, int h
|
||||
){
|
||||
S3VPtr ps3v = S3VPTR(pScrn);
|
||||
int dwords;
|
||||
|
||||
CHECK_DEST_BASE(y,h);
|
||||
|
||||
dwords = ((w + 31) >> 5) * h;
|
||||
|
||||
WAITFIFO(2);
|
||||
OUTREG(RWIDTH_HEIGHT, ((w - 1) << 16) | h);
|
||||
WAITCMD();
|
||||
OUTREG(RDEST_XY, (x << 16) | y);
|
||||
|
||||
S3VWriteMask((CARD32*)ps3v->MapBaseDense, dwords);
|
||||
}
|
||||
|
||||
/*********************************\
|
||||
| CPU to Screen Color Expansion |
|
||||
\*********************************/
|
||||
|
||||
|
||||
static void
|
||||
S3VSetupForCPUToScreenColorExpand(
|
||||
ScrnInfoPtr pScrn,
|
||||
int fg, int bg,
|
||||
int rop,
|
||||
unsigned int planemask
|
||||
){
|
||||
S3VPtr ps3v = S3VPTR(pScrn);
|
||||
|
||||
planemask &= ps3v->FullPlaneMask;
|
||||
ps3v->AccelCmd = ps3v->CommonCmd | CMD_AUTOEXEC | CMD_BITBLT |
|
||||
CMD_XP | CMD_YP | CMD_ITA_DWORD | CMD_HWCLIP |
|
||||
MIX_CPUDATA | MIX_MONO_SRC;
|
||||
|
||||
|
||||
if(planemask == ps3v->FullPlaneMask) {
|
||||
ps3v->AccelCmd |= XAAGetCopyROP(rop) << 17;
|
||||
WAITFIFO(3);
|
||||
} else {
|
||||
ps3v->AccelCmd |= (XAAGetCopyROP_PM(rop) << 17) | MIX_MONO_PATT;
|
||||
WAITFIFO(6);
|
||||
OUTREG(MONO_PAT_0, ~0);
|
||||
OUTREG(MONO_PAT_1, ~0);
|
||||
OUTREG(PAT_FG_CLR, planemask);
|
||||
}
|
||||
|
||||
if(bg == -1)
|
||||
ps3v->AccelCmd |= MIX_MONO_TRANSP;
|
||||
else
|
||||
OUTREG(SRC_BG_CLR, bg);
|
||||
|
||||
OUTREG(SRC_FG_CLR, fg);
|
||||
OUTREG(CMD_SET, ps3v->AccelCmd);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
S3VSubsequentCPUToScreenColorExpand(
|
||||
ScrnInfoPtr pScrn,
|
||||
int x, int y,
|
||||
int w, int h,
|
||||
int skipleft
|
||||
){
|
||||
S3VPtr ps3v = S3VPTR(pScrn);
|
||||
|
||||
CHECK_DEST_BASE(y,h);
|
||||
WAITFIFO(3);
|
||||
OUTREG(CLIP_L_R, ((x + skipleft) << 16) | 0xffff);
|
||||
OUTREG(RWIDTH_HEIGHT, ((w - 1) << 16) | h);
|
||||
WAITCMD();
|
||||
OUTREG(RDEST_XY, (x << 16) | y);
|
||||
}
|
||||
|
||||
|
||||
/****************\
|
||||
| Image Writes |
|
||||
\****************/
|
||||
|
||||
|
||||
static void
|
||||
S3VSetupForImageWrite(
|
||||
ScrnInfoPtr pScrn,
|
||||
int rop, unsigned int planemask,
|
||||
int trans_color, int bpp, int depth
|
||||
){
|
||||
S3VPtr ps3v = S3VPTR(pScrn);
|
||||
|
||||
planemask &= ps3v->FullPlaneMask;
|
||||
ps3v->AccelCmd = ps3v->CommonCmd | CMD_AUTOEXEC | CMD_BITBLT |
|
||||
MIX_CPUDATA | CMD_ITA_DWORD | CMD_HWCLIP | CMD_XP | CMD_YP;
|
||||
|
||||
if(planemask != ps3v->FullPlaneMask) {
|
||||
ps3v->AccelCmd |= (XAAGetCopyROP_PM(rop) << 17) | MIX_MONO_PATT;
|
||||
WAITFIFO(4);
|
||||
OUTREG(PAT_FG_CLR, planemask);
|
||||
OUTREG(MONO_PAT_0, ~0);
|
||||
OUTREG(MONO_PAT_1, ~0);
|
||||
} else {
|
||||
ps3v->AccelCmd |= XAAGetCopyROP(rop) << 17;
|
||||
WAITFIFO(1);
|
||||
}
|
||||
|
||||
OUTREG(CMD_SET, ps3v->AccelCmd);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S3VSubsequentImageWriteRect(
|
||||
ScrnInfoPtr pScrn,
|
||||
int x, int y,
|
||||
int w, int h,
|
||||
int skipleft
|
||||
){
|
||||
S3VPtr ps3v = S3VPTR(pScrn);
|
||||
|
||||
CHECK_DEST_BASE(y,h);
|
||||
|
||||
WAITFIFO(3);
|
||||
OUTREG(CLIP_L_R, ((x + skipleft) << 16) | 0xffff);
|
||||
OUTREG(RWIDTH_HEIGHT, ((w - 1) << 16) | h);
|
||||
WAITCMD();
|
||||
OUTREG(RDEST_XY, (x << 16) | y);
|
||||
}
|
||||
|
||||
|
||||
/***********\
|
||||
| Lines |
|
||||
\***********/
|
||||
|
||||
|
||||
#if 0 /* Some line funcs are disabled at the moment */
|
||||
|
||||
static void
|
||||
S3VPolylinesThinSolidWrapper(
|
||||
DrawablePtr pDraw,
|
||||
GCPtr pGC,
|
||||
int mode,
|
||||
int npt,
|
||||
DDXPointPtr pPts
|
||||
){
|
||||
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
|
||||
S3VPtr ps3v = S3VPTR(infoRec->pScrn);
|
||||
ps3v->CurrentGC = pGC;
|
||||
/* fb support */
|
||||
ps3v->CurrentDrawable = pDraw;
|
||||
if(infoRec->NeedToSync)
|
||||
S3VAccelSync(infoRec->pScrn);
|
||||
XAAPolyLines(pDraw, pGC, mode, npt, pPts);
|
||||
}
|
||||
|
||||
static void
|
||||
S3VPolySegmentThinSolidWrapper(
|
||||
DrawablePtr pDraw,
|
||||
GCPtr pGC,
|
||||
int nseg,
|
||||
xSegment *pSeg
|
||||
){
|
||||
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
|
||||
S3VPtr ps3v = S3VPTR(infoRec->pScrn);
|
||||
ps3v->CurrentGC = pGC;
|
||||
/* fb support */
|
||||
ps3v->CurrentDrawable = pDraw;
|
||||
if(infoRec->NeedToSync)
|
||||
S3VAccelSync(infoRec->pScrn);
|
||||
XAAPolySegment(pDraw, pGC, nseg, pSeg);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void
|
||||
S3VSubsequentSolidHorVertLine(
|
||||
ScrnInfoPtr pScrn,
|
||||
int x, int y,
|
||||
int len, int dir
|
||||
){
|
||||
S3VPtr ps3v = S3VPTR(pScrn);
|
||||
int w, h;
|
||||
|
||||
if(dir == DEGREES_0) {
|
||||
w = len; h = 1;
|
||||
} else {
|
||||
w = 1; h = len;
|
||||
}
|
||||
|
||||
CHECK_DEST_BASE(y,h);
|
||||
|
||||
WAITFIFO(2);
|
||||
OUTREG(RWIDTH_HEIGHT, ((w - 1) << 16) | h);
|
||||
WAITCMD();
|
||||
OUTREG(RDEST_XY, (x << 16) | y);
|
||||
}
|
||||
|
||||
static void
|
||||
S3VSubsequentSolidHorVertLinePlaneMask(
|
||||
ScrnInfoPtr pScrn,
|
||||
int x, int y,
|
||||
int len, int dir
|
||||
){
|
||||
S3VPtr ps3v = S3VPTR(pScrn);
|
||||
int w, h, dwords;
|
||||
|
||||
if(dir == DEGREES_0) {
|
||||
w = len; h = 1; dwords = (len + 31) >> 5;
|
||||
} else {
|
||||
w = 1; h = len; dwords = len;
|
||||
}
|
||||
|
||||
CHECK_DEST_BASE(y,h);
|
||||
|
||||
WAITFIFO(2);
|
||||
OUTREG(RWIDTH_HEIGHT, ((w - 1) << 16) | h);
|
||||
WAITCMD();
|
||||
OUTREG(RDEST_XY, (x << 16) | y);
|
||||
|
||||
S3VWriteMask((CARD32*)ps3v->MapBaseDense, dwords);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
S3VWaitFifoGX2(S3VPtr ps3v, int slots )
|
||||
|
||||
@@ -72,10 +72,6 @@ static Bool S3V_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **,
|
||||
static Bool S3V_SetMode(ScrnInfoPtr, DGAModePtr);
|
||||
static int S3V_GetViewport(ScrnInfoPtr);
|
||||
static void S3V_SetViewport(ScrnInfoPtr, int, int, int);
|
||||
#ifdef HAVE_XAA_H
|
||||
static void S3V_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long);
|
||||
static void S3V_BlitRect(ScrnInfoPtr, int, int, int, int, int, int);
|
||||
#endif
|
||||
/* dummy... */
|
||||
|
||||
|
||||
@@ -87,12 +83,7 @@ DGAFunctionRec S3V_DGAFuncs = {
|
||||
S3V_SetViewport,
|
||||
S3V_GetViewport,
|
||||
S3VAccelSync,
|
||||
#ifdef HAVE_XAA_H
|
||||
S3V_FillRect,
|
||||
S3V_BlitRect,
|
||||
#else
|
||||
NULL, NULL,
|
||||
#endif
|
||||
NULL
|
||||
/* dummy... MGA_BlitTransRect */
|
||||
};
|
||||
@@ -139,10 +130,6 @@ SECOND_PASS:
|
||||
|
||||
currentMode->mode = pMode;
|
||||
currentMode->flags = DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE;
|
||||
#ifdef HAVE_XAA_H
|
||||
if(!ps3v->NoAccel)
|
||||
currentMode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT;
|
||||
#endif
|
||||
if(pMode->Flags & V_DBLSCAN)
|
||||
currentMode->flags |= DGA_DOUBLESCAN;
|
||||
if(pMode->Flags & V_INTERLACE)
|
||||
@@ -286,43 +273,6 @@ S3V_SetViewport(
|
||||
ps3v->DGAViewportStatus = 0; /* MGAAdjustFrame loops until finished */
|
||||
}
|
||||
|
||||
#ifdef HAVE_XAA_H
|
||||
static void
|
||||
S3V_FillRect (
|
||||
ScrnInfoPtr pScrn,
|
||||
int x, int y, int w, int h,
|
||||
unsigned long color
|
||||
){
|
||||
S3VPtr ps3v = S3VPTR(pScrn);
|
||||
|
||||
if(ps3v->AccelInfoRec) {
|
||||
(*ps3v->AccelInfoRec->SetupForSolidFill)(pScrn, color, GXcopy, ~0);
|
||||
(*ps3v->AccelInfoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h);
|
||||
SET_SYNC_FLAG(ps3v->AccelInfoRec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
S3V_BlitRect(
|
||||
ScrnInfoPtr pScrn,
|
||||
int srcx, int srcy,
|
||||
int w, int h,
|
||||
int dstx, int dsty
|
||||
){
|
||||
S3VPtr ps3v = S3VPTR(pScrn);
|
||||
|
||||
if(ps3v->AccelInfoRec) {
|
||||
int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1;
|
||||
int ydir = (srcy < dsty) ? -1 : 1;
|
||||
|
||||
(*ps3v->AccelInfoRec->SetupForScreenToScreenCopy)(
|
||||
pScrn, xdir, ydir, GXcopy, ~0, -1);
|
||||
(*ps3v->AccelInfoRec->SubsequentScreenToScreenCopy)(
|
||||
pScrn, srcx, srcy, dstx, dsty, w, h);
|
||||
SET_SYNC_FLAG(ps3v->AccelInfoRec);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static Bool
|
||||
|
||||
@@ -31,12 +31,6 @@ in this Software without prior written authorization from the XFree86 Project.
|
||||
#include <unistd.h>
|
||||
|
||||
#include "xf86.h"
|
||||
#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6
|
||||
#include "xf86Resources.h"
|
||||
/* Needed by Resources Access Control (RAC) */
|
||||
#include "xf86RAC.h"
|
||||
#endif
|
||||
|
||||
#include "xf86DDC.h"
|
||||
#include "vbe.h"
|
||||
|
||||
@@ -1311,15 +1305,12 @@ S3VPreInit(ScrnInfoPtr pScrn, int flags)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Load XAA if needed */
|
||||
if (!ps3v->NoAccel || ps3v->hwcursor ) {
|
||||
if (!xf86LoadSubModule(pScrn, "xaa")) {
|
||||
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, VERBLEV,
|
||||
"Falling back to shadowfb\n");
|
||||
ps3v->NoAccel = 1;
|
||||
ps3v->hwcursor = 0;
|
||||
ps3v->shadowFB = 1;
|
||||
}
|
||||
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, VERBLEV,
|
||||
"Falling back to shadowfb\n");
|
||||
ps3v->NoAccel = 1;
|
||||
ps3v->hwcursor = 0;
|
||||
ps3v->shadowFB = 1;
|
||||
}
|
||||
|
||||
/* Load ramdac if needed */
|
||||
@@ -3298,10 +3289,6 @@ S3VCloseScreen(CLOSE_SCREEN_ARGS_DECL)
|
||||
S3VUnmapMem(pScrn);
|
||||
}
|
||||
|
||||
#ifdef HAVE_XAA_H
|
||||
if (ps3v->AccelInfoRec)
|
||||
XAADestroyInfoRec(ps3v->AccelInfoRec);
|
||||
#endif
|
||||
if (ps3v->DGAModes)
|
||||
free(ps3v->DGAModes);
|
||||
|
||||
|
||||
206
src/s3v_rop.h
206
src/s3v_rop.h
@@ -1,206 +0,0 @@
|
||||
|
||||
/*
|
||||
Copyright (C) 1994-1998 The XFree86 Project, Inc. All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
|
||||
NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of the XFree86 Project shall not
|
||||
be used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from the XFree86 Project.
|
||||
*/
|
||||
|
||||
/* This file contains the data structures which map the X ROPs to the
|
||||
* ViRGE ROPs. It also contains other mappings which are used when supporting
|
||||
* planemasks and transparency.
|
||||
*
|
||||
* Created by Sebastien Marineau, 29/03/97.
|
||||
* This file should be included only from s3v_accel.c to avoid
|
||||
* duplicate symbols.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "regs3v.h"
|
||||
|
||||
static int s3vAlu[16] =
|
||||
{
|
||||
ROP_0, /* GXclear */
|
||||
ROP_DSa, /* GXand */
|
||||
ROP_SDna, /* GXandReverse */
|
||||
ROP_S, /* GXcopy */
|
||||
ROP_DSna, /* GXandInverted */
|
||||
ROP_D, /* GXnoop */
|
||||
ROP_DSx, /* GXxor */
|
||||
ROP_DSo, /* GXor */
|
||||
ROP_DSon, /* GXnor */
|
||||
ROP_DSxn, /* GXequiv */
|
||||
ROP_Dn, /* GXinvert*/
|
||||
ROP_SDno, /* GXorReverse */
|
||||
ROP_Sn, /* GXcopyInverted */
|
||||
ROP_DSno, /* GXorInverted */
|
||||
ROP_DSan, /* GXnand */
|
||||
ROP_1 /* GXset */
|
||||
};
|
||||
|
||||
/* S -> P, for solid and pattern fills. */
|
||||
static int s3vAlu_sp[16]=
|
||||
{
|
||||
ROP_0,
|
||||
ROP_DPa,
|
||||
ROP_PDna,
|
||||
ROP_P,
|
||||
ROP_DPna,
|
||||
ROP_D,
|
||||
ROP_DPx,
|
||||
ROP_DPo,
|
||||
ROP_DPon,
|
||||
ROP_DPxn,
|
||||
ROP_Dn,
|
||||
ROP_PDno,
|
||||
ROP_Pn,
|
||||
ROP_DPno,
|
||||
ROP_DPan,
|
||||
ROP_1
|
||||
};
|
||||
|
||||
/* ROP -> (ROP & P) | (D & ~P) */
|
||||
/* These are used to support a planemask for S->D ops */
|
||||
static int s3vAlu_pat[16] =
|
||||
{
|
||||
ROP_0_PaDPnao,
|
||||
ROP_DSa_PaDPnao,
|
||||
ROP_SDna_PaDPnao,
|
||||
ROP_S_PaDPnao,
|
||||
ROP_DSna_PaDPnao,
|
||||
ROP_D_PaDPnao,
|
||||
ROP_DSx_PaDPnao,
|
||||
ROP_DSo_PaDPnao,
|
||||
ROP_DSon_PaDPnao,
|
||||
ROP_DSxn_PaDPnao,
|
||||
ROP_Dn_PaDPnao,
|
||||
ROP_SDno_PaDPnao,
|
||||
ROP_Sn_PaDPnao,
|
||||
ROP_DSno_PaDPnao,
|
||||
ROP_DSan_PaDPnao,
|
||||
ROP_1_PaDPnao
|
||||
};
|
||||
|
||||
/* ROP_sp -> (ROP_sp & S) | (D & ~S) */
|
||||
/* This is used for our transparent mono pattern fills to support trans/plane*/
|
||||
static int s3vAlu_MonoTrans[16] =
|
||||
{
|
||||
ROP_0_SaDSnao,
|
||||
ROP_DPa_SaDSnao,
|
||||
ROP_PDna_SaDSnao,
|
||||
ROP_P_SaDSnao,
|
||||
ROP_DPna_SaDSnao,
|
||||
ROP_D_SaDSnao,
|
||||
ROP_DPx_SaDSnao,
|
||||
ROP_DPo_SaDSnao,
|
||||
ROP_DPon_SaDSnao,
|
||||
ROP_DPxn_SaDSnao,
|
||||
ROP_Dn_SaDSnao,
|
||||
ROP_PDno_SaDSnao,
|
||||
ROP_Pn_SaDSnao,
|
||||
ROP_DPno_SaDSnao,
|
||||
ROP_DPan_SaDSnao,
|
||||
ROP_1_SaDSnao
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* This function was taken from accel/s3v.h. It adjusts the width
|
||||
* of transfers for mono images to works around some bugs.
|
||||
*/
|
||||
|
||||
static __inline__ int S3VCheckLSPN(S3VPtr ps3v, int w, int dir)
|
||||
{
|
||||
int lspn = (w * ps3v->Bpp) & 63; /* scanline width in bytes modulo 64*/
|
||||
|
||||
if (ps3v->Bpp == 1) {
|
||||
if (lspn <= 8*1)
|
||||
w += 16;
|
||||
else if (lspn <= 16*1)
|
||||
w += 8;
|
||||
} else if (ps3v->Bpp == 2) {
|
||||
if (lspn <= 4*2)
|
||||
w += 8;
|
||||
else if (lspn <= 8*2)
|
||||
w += 4;
|
||||
} else { /* ps3v->Bpp == 3 */
|
||||
if (lspn <= 3*3)
|
||||
w += 6;
|
||||
else if (lspn <= 6*3)
|
||||
w += 3;
|
||||
}
|
||||
if (dir && w >= ps3v->bltbug_width1 && w <= ps3v->bltbug_width2) {
|
||||
w = ps3v->bltbug_width2 + 1;
|
||||
}
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
/* And this adjusts color bitblts widths to work around GE bugs */
|
||||
|
||||
static __inline__ int S3VCheckBltWidth(S3VPtr ps3v, int w)
|
||||
{
|
||||
if (w >= ps3v->bltbug_width1 && w <= ps3v->bltbug_width2) {
|
||||
w = ps3v->bltbug_width2 + 1;
|
||||
}
|
||||
return w;
|
||||
}
|
||||
|
||||
/* This next function determines if the Source operand is present in the
|
||||
* given ROP. The rule is that both the lower and upper nibble of the rop
|
||||
* have to be neither 0x00, 0x05, 0x0a or 0x0f. If a CPU-Screen blit is done
|
||||
* with a ROP which does not contain the source, the virge will hang when
|
||||
* data is written to the image transfer area.
|
||||
*/
|
||||
|
||||
static __inline__ Bool S3VROPHasSrc(int shifted_rop)
|
||||
{
|
||||
int rop = (shifted_rop & (0xff << 17)) >> 17;
|
||||
|
||||
if ((((rop & 0x0f) == 0x0a) | ((rop & 0x0f) == 0x0f)
|
||||
| ((rop & 0x0f) == 0x05) | ((rop & 0x0f) == 0x00)) &
|
||||
(((rop & 0xf0) == 0xa0) | ((rop & 0xf0) == 0xf0)
|
||||
| ((rop & 0xf0) == 0x50) | ((rop & 0xf0) == 0x00)))
|
||||
return FALSE;
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* This next function determines if the Destination operand is present in the
|
||||
* given ROP. The rule is that both the lower and upper nibble of the rop
|
||||
* have to be neither 0x00, 0x03, 0x0c or 0x0f.
|
||||
*/
|
||||
|
||||
static __inline__ Bool S3VROPHasDst(int shifted_rop)
|
||||
{
|
||||
int rop = (shifted_rop & (0xff << 17)) >> 17;
|
||||
|
||||
if ((((rop & 0x0f) == 0x0c) | ((rop & 0x0f) == 0x0f)
|
||||
| ((rop & 0x0f) == 0x03) | ((rop & 0x0f) == 0x00)) &
|
||||
(((rop & 0xf0) == 0xc0) | ((rop & 0xf0) == 0xf0)
|
||||
| ((rop & 0xf0) == 0x30) | ((rop & 0xf0) == 0x00)))
|
||||
return FALSE;
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user