diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2024-05-18 15:34:43 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2024-05-18 16:03:41 -0700 |
commit | 8f53239ad7aa65e198402b3ce20a4a47d7dca279 (patch) | |
tree | 0f20f5fac7322b83b9857146dc6ce2cd184bda39 /src | |
parent | 0d6cd745232b97ee13d03ab1d9de589b0907e791 (diff) |
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-siliconmotion/-/merge_requests/7>
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/smi.h | 9 | ||||
-rw-r--r-- | src/smi_driver.c | 37 | ||||
-rw-r--r-- | src/smi_output.c | 4 | ||||
-rw-r--r-- | src/smi_video.c | 10 | ||||
-rw-r--r-- | src/smi_xaa.c | 732 |
6 files changed, 13 insertions, 780 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 77b3b85..d249e40 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -36,7 +36,6 @@ siliconmotion_drv_la_SOURCES = \ smi_501.c \ smi_501.h \ smi_accel.c \ - smi_xaa.c \ smi_exa.c \ smi_dac.c \ smi_driver.c \ @@ -49,9 +49,6 @@ authorization from the XFree86 Project and Silicon Motion. #include "fb.h" -#ifdef HAVE_XAA_H -#include "xaa.h" -#endif #include "xf86fbman.h" #include "exa.h" #include "xf86cmap.h" @@ -252,9 +249,6 @@ typedef struct printed using a counter */ Bool useBIOS; /* Use BIOS for mode sets */ -#ifdef HAVE_XAA_H - XAAInfoRecPtr XAAInfoRec; /* XAA info Rec */ -#endif /* EXA */ ExaDriverPtr EXADriverPtr; @@ -379,9 +373,6 @@ void SMI_SetClippingRectangle(ScrnInfoPtr, int, int, int, int); void SMI_DisableClipping(ScrnInfoPtr); CARD32 SMI_DEDataFormat(int bpp); -/* smi_xaa.c */ -Bool SMI_XAAInit(ScreenPtr pScrn); - /* smi_exa.c */ Bool SMI_EXAInit(ScreenPtr pScrn); diff --git a/src/smi_driver.c b/src/smi_driver.c index 9d5c110..5f39e96 100644 --- a/src/smi_driver.c +++ b/src/smi_driver.c @@ -36,11 +36,6 @@ authorization from The XFree86 Project or Silicon Motion. #include "xf86int10.h" #include "vbe.h" -#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6 -#include "xf86Resources.h" -#include "xf86RAC.h" -#endif - #include "smi.h" #include "smi_501.h" #include "smilynx.h" @@ -746,17 +741,17 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags) from = X_DEFAULT; if ((strptr = (char *)xf86GetOptValString(pSmi->Options, OPTION_ACCELMETHOD))) { - if (!xf86NameCmp(strptr,"XAA")) { - from = X_CONFIG; - pSmi->useEXA = FALSE; - } else if(!xf86NameCmp(strptr,"EXA")) { + if (!xf86NameCmp(strptr,"EXA")) { from = X_CONFIG; pSmi->useEXA = TRUE; + } else { + from = X_CONFIG; + pSmi->useEXA = FALSE; } } xf86DrvMsg(pScrn->scrnIndex, from, "Using %s acceleration architecture\n", - pSmi->useEXA ? "EXA" : "XAA"); + pSmi->useEXA ? "EXA" : "no"); } if (IS_MSOC(pSmi)) { @@ -768,7 +763,7 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags) /* FIXME */ if (pSmi->CSCVideo && pSmi->useEXA && pSmi->Dualhead) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "CSCVideo requires XAA or EXA in single head mode.\n"); + "CSCVideo requires EXA in single head mode.\n"); pSmi->CSCVideo = FALSE; } } @@ -875,13 +870,11 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags) LEAVE(FALSE); } - /* Load XAA or EXA if needed */ + /* Load EXA if needed */ if (!pSmi->NoAccel) { if (!pSmi->useEXA) { - if (!xf86LoadSubModule(pScrn, "xaa")) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "No acceleration\n"); - pSmi->NoAccel = 1; - } + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "No acceleration\n"); + pSmi->NoAccel = 1; } else { XF86ModReqInfo req; int errmaj, errmin; @@ -1714,8 +1707,7 @@ SMI_ScreenInit(SCREEN_INIT_ARGS_DECL) if(!SMI_HWInit(pScrn)) LEAVE(FALSE); - /* Unless using EXA, regardless or using XAA or not, needs offscreen - * management at least for video. */ + /* Unless using EXA, needs offscreen management at least for video. */ if (pSmi->NoAccel || !pSmi->useEXA) { int numLines; BoxRec AvailFBArea; @@ -1738,7 +1730,7 @@ SMI_ScreenInit(SCREEN_INIT_ARGS_DECL) if (!pSmi->NoAccel) { if (pSmi->useEXA && !SMI_EXAInit(pScreen)) LEAVE(FALSE); - else if (!pSmi->useEXA && !SMI_XAAInit(pScreen)) + else if (!pSmi->useEXA) LEAVE(FALSE); } @@ -1750,9 +1742,7 @@ SMI_ScreenInit(SCREEN_INIT_ARGS_DECL) "Done writing mode. Register dump:\n"); SMI_PrintRegs(pScrn); -#ifdef HAVE_XMODES xf86DiDGAInit(pScreen, (unsigned long)(pSmi->FBBase + pScrn->fbOffset)); -#endif /* Initialise cursor functions */ miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); @@ -1844,11 +1834,6 @@ SMI_CloseScreen(CLOSE_SCREEN_ARGS_DECL) /* Restore console mode and unmap framebuffer */ SMI_LeaveVT(VT_FUNC_ARGS); -#ifdef HAVE_XAA_H - if (pSmi->XAAInfoRec != NULL) { - XAADestroyInfoRec(pSmi->XAAInfoRec); - } -#endif if (pSmi->EXADriverPtr) { exaDriverFini(pScreen); pSmi->EXADriverPtr = NULL; diff --git a/src/smi_output.c b/src/smi_output.c index 377ea4a..38ba7d0 100644 --- a/src/smi_output.c +++ b/src/smi_output.c @@ -144,11 +144,7 @@ SMI_OutputGetModes_native(xf86OutputPtr output) SMIPtr pSmi = SMIPTR(output->scrn); ENTER(); -#ifdef HAVE_XMODES LEAVE(xf86CVTMode(pSmi->lcdWidth, pSmi->lcdHeight, 60.0f, FALSE, FALSE)); -#else - LEAVE(NULL); -#endif } static void diff --git a/src/smi_video.c b/src/smi_video.c index 62de55d..d3b7a42 100644 --- a/src/smi_video.c +++ b/src/smi_video.c @@ -519,17 +519,11 @@ SMI_AddEncoding(XF86VideoEncodingPtr enc, int i, norm_string = VideoNorms[norm].name; input_string = VideoInputs[input].name; snprintf(channel_string, sizeof(channel_string), "%d", channel); - enc[i].id = i; -#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 10 if (Xasprintf(&name_string, "%s-%s-%s", norm_string, input_string, channel_string) < 0) LEAVE(-1); -#else - name_string = Xprintf("%s-%s-%s", - norm_string, input_string, channel_string); - if (NULL == name_string) - LEAVE(-1); -#endif + + enc[i].id = i; enc[i].name = name_string; enc[i].width = VideoNorms[norm].Wa; diff --git a/src/smi_xaa.c b/src/smi_xaa.c deleted file mode 100644 index cd861a1..0000000 --- a/src/smi_xaa.c +++ /dev/null @@ -1,732 +0,0 @@ -/* -Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved. -Copyright (C) 2000 Silicon Motion, 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 names of the XFree86 Project and -Silicon Motion 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 and silicon Motion. -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "smi.h" -#include "smi_501.h" - -#ifdef HAVE_XAA_H - -#include "miline.h" -#include "xaalocal.h" -#include "xaarop.h" -#include "servermd.h" - -static void SMI_SetupForScreenToScreenCopy(ScrnInfoPtr, int, int, int, - unsigned int, int); -static void SMI_SubsequentScreenToScreenCopy(ScrnInfoPtr, int, int, int, int, - int, int); -static void SMI_SetupForSolidFill(ScrnInfoPtr, int, int, unsigned); -static void SMI_SubsequentSolidFillRect(ScrnInfoPtr, int, int, int, int); -static void SMI_SubsequentSolidHorVertLine(ScrnInfoPtr, int, int, int, int); -static void SMI_SetupForCPUToScreenColorExpandFill(ScrnInfoPtr, int, int, int, - unsigned int); -static void SMI_SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr, int, int, int, - int, int); -static void SMI_SetupForMono8x8PatternFill(ScrnInfoPtr, int, int, int, int, int, - unsigned int); -static void SMI_SubsequentMono8x8PatternFillRect(ScrnInfoPtr, int, int, int, - int, int, int); -static void SMI_SetupForColor8x8PatternFill(ScrnInfoPtr, int, int, int, - unsigned int, int); -static void SMI_SubsequentColor8x8PatternFillRect(ScrnInfoPtr, int, int, int, - int, int, int); -#if SMI_USE_IMAGE_WRITES -static void SMI_SetupForImageWrite(ScrnInfoPtr, int, unsigned int, int, int, - int); -static void SMI_SubsequentImageWriteRect(ScrnInfoPtr, int, int, int, int, int); -#endif - -#endif -Bool -SMI_XAAInit(ScreenPtr pScreen) -{ -#ifdef HAVE_XAA_H - XAAInfoRecPtr infoPtr; - ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); - SMIPtr pSmi = SMIPTR(pScrn); - /*BoxRec AvailFBArea;*/ - Bool ret; - /*int numLines, maxLines;*/ - - ENTER(); - - pSmi->XAAInfoRec = infoPtr = XAACreateInfoRec(); - if (infoPtr == NULL) - LEAVE(FALSE); - - infoPtr->Flags = PIXMAP_CACHE - | LINEAR_FRAMEBUFFER - | OFFSCREEN_PIXMAPS; - - infoPtr->Sync = SMI_AccelSync; - - if (xf86IsEntityShared(pScrn->entityList[0])) - infoPtr->RestoreAccelState = SMI_EngineReset; - - /* Screen to screen copies */ - infoPtr->ScreenToScreenCopyFlags = NO_PLANEMASK - | ONLY_TWO_BITBLT_DIRECTIONS; - infoPtr->SetupForScreenToScreenCopy = SMI_SetupForScreenToScreenCopy; - infoPtr->SubsequentScreenToScreenCopy = SMI_SubsequentScreenToScreenCopy; - if (pScrn->bitsPerPixel == 24) { - infoPtr->ScreenToScreenCopyFlags |= NO_TRANSPARENCY; - } - if ((pSmi->Chipset == SMI_LYNX3D) && (pScrn->bitsPerPixel == 8)) { - infoPtr->ScreenToScreenCopyFlags |= GXCOPY_ONLY; - } - - /* Solid Fills */ - infoPtr->SolidFillFlags = NO_PLANEMASK; - infoPtr->SetupForSolidFill = SMI_SetupForSolidFill; - infoPtr->SubsequentSolidFillRect = SMI_SubsequentSolidFillRect; - - /* Solid Lines */ - infoPtr->SolidLineFlags = NO_PLANEMASK; - infoPtr->SetupForSolidLine = SMI_SetupForSolidFill; - infoPtr->SubsequentSolidHorVertLine = SMI_SubsequentSolidHorVertLine; - - /* Color Expansion Fills */ - infoPtr->CPUToScreenColorExpandFillFlags = ROP_NEEDS_SOURCE - | NO_PLANEMASK - | BIT_ORDER_IN_BYTE_MSBFIRST - | LEFT_EDGE_CLIPPING - | CPU_TRANSFER_PAD_DWORD - | SCANLINE_PAD_DWORD; - infoPtr->ColorExpandBase = pSmi->DataPortBase; - infoPtr->ColorExpandRange = pSmi->DataPortSize; - infoPtr->SetupForCPUToScreenColorExpandFill = - SMI_SetupForCPUToScreenColorExpandFill; - infoPtr->SubsequentCPUToScreenColorExpandFill = - SMI_SubsequentCPUToScreenColorExpandFill; - - /* 8x8 Mono Pattern Fills */ - infoPtr->Mono8x8PatternFillFlags = NO_PLANEMASK - | HARDWARE_PATTERN_PROGRAMMED_BITS - | HARDWARE_PATTERN_SCREEN_ORIGIN - | BIT_ORDER_IN_BYTE_MSBFIRST; - infoPtr->SetupForMono8x8PatternFill = SMI_SetupForMono8x8PatternFill; - infoPtr->SubsequentMono8x8PatternFillRect = - SMI_SubsequentMono8x8PatternFillRect; - - /* 8x8 Color Pattern Fills */ - if (!SMI_LYNX3D_SERIES(pSmi->Chipset) || (pScrn->bitsPerPixel != 24)) { - infoPtr->Color8x8PatternFillFlags = NO_PLANEMASK - | HARDWARE_PATTERN_SCREEN_ORIGIN; - infoPtr->SetupForColor8x8PatternFill = - SMI_SetupForColor8x8PatternFill; - infoPtr->SubsequentColor8x8PatternFillRect = - SMI_SubsequentColor8x8PatternFillRect; - } - -#if SMI_USE_IMAGE_WRITES - /* Image Writes */ - infoPtr->ImageWriteFlags = ROP_NEEDS_SOURCE - | NO_PLANEMASK - | CPU_TRANSFER_PAD_DWORD - | SCANLINE_PAD_DWORD; - infoPtr->ImageWriteBase = pSmi->DataPortBase; - infoPtr->ImageWriteRange = pSmi->DataPortSize; - infoPtr->SetupForImageWrite = SMI_SetupForImageWrite; - infoPtr->SubsequentImageWriteRect = SMI_SubsequentImageWriteRect; -#endif - - /* Clipping */ - infoPtr->ClippingFlags = HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY - | HARDWARE_CLIP_MONO_8x8_FILL - | HARDWARE_CLIP_COLOR_8x8_FILL - | HARDWARE_CLIP_SOLID_FILL - | HARDWARE_CLIP_SOLID_LINE - | HARDWARE_CLIP_DASHED_LINE; - infoPtr->SetClippingRectangle = SMI_SetClippingRectangle; - infoPtr->DisableClipping = SMI_DisableClipping; - - /* Pixmap Cache */ - if (pScrn->bitsPerPixel == 24) { - infoPtr->CachePixelGranularity = 16; - } else { - infoPtr->CachePixelGranularity = 128 / pScrn->bitsPerPixel; - } - - /* Offscreen Pixmaps */ - infoPtr->maxOffPixWidth = 4096; - infoPtr->maxOffPixHeight = 4096; - if (pScrn->bitsPerPixel == 24) { - infoPtr->maxOffPixWidth = 4096 / 3; - - if (pSmi->Chipset == SMI_LYNX) { - infoPtr->maxOffPixHeight = 4096 / 3; - } - } - - SMI_EngineReset(pScrn); - - ret = XAAInit(pScreen, infoPtr); - - LEAVE(ret); -#else - return FALSE; -#endif -} - - -#ifdef HAVE_XAA_H -/******************************************************************************/ -/* Screen to Screen Copies */ -/******************************************************************************/ - -static void -SMI_SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop, - unsigned int planemask, int trans) -{ - SMIPtr pSmi = SMIPTR(pScrn); - - ENTER(); - DEBUG("xdir=%d ydir=%d rop=%02X trans=%08X\n", xdir, ydir, rop, trans); - -#if X_BYTE_ORDER == X_BIG_ENDIAN - if (pScrn->depth >= 24) - trans = lswapl(trans); -#endif - pSmi->AccelCmd = XAAGetCopyROP(rop) - | SMI_BITBLT - | SMI_START_ENGINE; - - if ((xdir == -1) || (ydir == -1)) { - pSmi->AccelCmd |= SMI_RIGHT_TO_LEFT; - } - - if (trans != -1) { - pSmi->AccelCmd |= SMI_TRANSPARENT_SRC | SMI_TRANSPARENT_PXL; - WaitQueue(); - WRITE_DPR(pSmi, 0x20, trans); - } - - if (pSmi->ClipTurnedOn) { - WaitQueue(); - WRITE_DPR(pSmi, 0x2C, pSmi->ScissorsLeft); - pSmi->ClipTurnedOn = FALSE; - } - - LEAVE(); -} - -static void -SMI_SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2, - int y2, int w, int h) -{ - SMIPtr pSmi = SMIPTR(pScrn); - - ENTER(); - DEBUG("x1=%d y1=%d x2=%d y2=%d w=%d h=%d\n", x1, y1, x2, y2, w, h); - - if (pSmi->AccelCmd & SMI_RIGHT_TO_LEFT) { - x1 += w - 1; - y1 += h - 1; - x2 += w - 1; - y2 += h - 1; - } - - if (pScrn->bitsPerPixel == 24) { - x1 *= 3; - x2 *= 3; - w *= 3; - - if (pSmi->Chipset == SMI_LYNX) { - y1 *= 3; - y2 *= 3; - } - - if (pSmi->AccelCmd & SMI_RIGHT_TO_LEFT) { - x1 += 2; - x2 += 2; - } - } - - WaitIdle(); - WRITE_DPR(pSmi, 0x00, (x1 << 16) + (y1 & 0xFFFF)); - WRITE_DPR(pSmi, 0x04, (x2 << 16) + (y2 & 0xFFFF)); - WRITE_DPR(pSmi, 0x08, (w << 16) + (h & 0xFFFF)); - WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd); - - LEAVE(); -} - -/******************************************************************************/ -/* Solid Fills */ -/******************************************************************************/ - -static void -SMI_SetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, - unsigned int planemask) -{ - SMIPtr pSmi = SMIPTR(pScrn); - - ENTER(); - DEBUG("color=%08X rop=%02X\n", color, rop); - - pSmi->AccelCmd = XAAGetPatternROP(rop) - | SMI_BITBLT - | SMI_START_ENGINE; - -#if X_BYTE_ORDER == X_BIG_ENDIAN - if (pScrn->depth >= 24) { - /* because of the BGR values are in the MSB bytes, - * 'white' is not possible and -1 has a different meaning. - * As a work around (assuming white is more used as - * light yellow (#FFFF7F), we handle this as beining white. - * Thanks to the SM501 not being able to work in MSB on PCI - * on the PowerPC */ - if (color == 0x7FFFFFFF) - color = -1; - color = lswapl(color); - } -#endif - if (pSmi->ClipTurnedOn) { - WaitQueue(); - WRITE_DPR(pSmi, 0x2C, pSmi->ScissorsLeft); - pSmi->ClipTurnedOn = FALSE; - } else { - WaitQueue(); - } - WRITE_DPR(pSmi, 0x14, color); - WRITE_DPR(pSmi, 0x34, 0xFFFFFFFF); - WRITE_DPR(pSmi, 0x38, 0xFFFFFFFF); - - LEAVE(); -} - -void -SMI_SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h) -{ - SMIPtr pSmi = SMIPTR(pScrn); - - ENTER(); - DEBUG("x=%d y=%d w=%d h=%d\n", x, y, w, h); - - if (pScrn->bitsPerPixel == 24) { - x *= 3; - w *= 3; - - if (pSmi->Chipset == SMI_LYNX) { - y *= 3; - } - } - - if (IS_MSOC(pSmi)) { - /* Clip to prevent negative screen coordinates */ - if (x < 0) - x = 0; - if (y < 0) - y = 0; - } - - WaitQueue(); - WRITE_DPR(pSmi, 0x04, (x << 16) | (y & 0xFFFF)); - WRITE_DPR(pSmi, 0x08, (w << 16) | (h & 0xFFFF)); - WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd); - - LEAVE(); -} - -/******************************************************************************/ -/* Solid Lines */ -/******************************************************************************/ - -static void -SMI_SubsequentSolidHorVertLine(ScrnInfoPtr pScrn, int x, int y, int len, - int dir) -{ - SMIPtr pSmi = SMIPTR(pScrn); - int w, h; - - ENTER(); - DEBUG("x=%d y=%d len=%d dir=%d\n", x, y, len, dir); - - if (dir == DEGREES_0) { - w = len; - h = 1; - } else { - w = 1; - h = len; - } - - if (pScrn->bitsPerPixel == 24) { - x *= 3; - w *= 3; - - if (pSmi->Chipset == SMI_LYNX) { - y *= 3; - } - } - - WaitQueue(); - WRITE_DPR(pSmi, 0x04, (x << 16) | (y & 0xFFFF)); - WRITE_DPR(pSmi, 0x08, (w << 16) | (h & 0xFFFF)); - WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd); - - LEAVE(); -} - -/******************************************************************************/ -/* Color Expansion Fills */ -/******************************************************************************/ - -static void -SMI_SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg, int bg, - int rop, unsigned int planemask) -{ - SMIPtr pSmi = SMIPTR(pScrn); - - ENTER(); - DEBUG("fg=%08X bg=%08X rop=%02X\n", fg, bg, rop); - -#if X_BYTE_ORDER == X_BIG_ENDIAN - if (pScrn->depth >= 24) { - /* see remark elswere */ - if (fg == 0x7FFFFFFF) - fg = -1; - fg = lswapl(fg); - bg = lswapl(bg); - } -#endif - - pSmi->AccelCmd = XAAGetCopyROP(rop) - | SMI_HOSTBLT_WRITE - | SMI_SRC_MONOCHROME - | SMI_START_ENGINE; - - if (bg == -1) { - pSmi->AccelCmd |= SMI_TRANSPARENT_SRC; - - WaitQueue(); - WRITE_DPR(pSmi, 0x14, fg); - WRITE_DPR(pSmi, 0x18, ~fg); - WRITE_DPR(pSmi, 0x20, fg); - } else { -#if X_BYTE_ORDER == X_BIG_ENDIAN - if (bg == 0xFFFFFF7F) - bg = -1; -#endif - WaitQueue(); - WRITE_DPR(pSmi, 0x14, fg); - WRITE_DPR(pSmi, 0x18, bg); - } - - LEAVE(); -} - -void -SMI_SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int x, int y, int w, - int h, int skipleft) -{ - SMIPtr pSmi = SMIPTR(pScrn); - - ENTER(); - DEBUG("x=%d y=%d w=%d h=%d skipleft=%d\n", x, y, w, h, skipleft); - - if (pScrn->bitsPerPixel == 24) { - x *= 3; - w *= 3; - skipleft *= 3; - - if (pSmi->Chipset == SMI_LYNX) { - y *= 3; - } - } - - if (skipleft) { - WaitQueue(); - WRITE_DPR(pSmi, 0x2C, (pSmi->ScissorsLeft & 0xFFFF0000) - | (x + skipleft) | 0x2000); - pSmi->ClipTurnedOn = TRUE; - } else { - if (pSmi->ClipTurnedOn) { - WaitQueue(); - WRITE_DPR(pSmi, 0x2C, pSmi->ScissorsLeft); - pSmi->ClipTurnedOn = FALSE; - } else { - WaitQueue(); - } - } - WRITE_DPR(pSmi, 0x00, 0); - WRITE_DPR(pSmi, 0x04, (x << 16) | (y & 0xFFFF)); - WRITE_DPR(pSmi, 0x08, (w << 16) | (h & 0xFFFF)); - WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd); - - LEAVE(); -} - -/******************************************************************************/ -/* 8x8 Mono Pattern Fills */ -/******************************************************************************/ - -static void -SMI_SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty, int fg, - int bg, int rop, unsigned int planemask) -{ - SMIPtr pSmi = SMIPTR(pScrn); - - ENTER(); - DEBUG("patx=%08X paty=%08X fg=%08X bg=%08X rop=%02X\n", - patx, paty, fg, bg, rop); - -#if X_BYTE_ORDER == X_BIG_ENDIAN - if (pScrn->depth >= 24) { - if (fg == 0x7FFFFFFF) - fg = -1; - fg = lswapl(fg); - bg = lswapl(bg); - } -#endif - pSmi->AccelCmd = XAAGetPatternROP(rop) - | SMI_BITBLT - | SMI_START_ENGINE; - - if (pSmi->ClipTurnedOn) { - WaitQueue(); - WRITE_DPR(pSmi, 0x2C, pSmi->ScissorsLeft); - pSmi->ClipTurnedOn = FALSE; - } - - if (bg == -1) { - WaitQueue(); - WRITE_DPR(pSmi, 0x14, fg); - WRITE_DPR(pSmi, 0x18, ~fg); - WRITE_DPR(pSmi, 0x20, fg); - WRITE_DPR(pSmi, 0x34, patx); - WRITE_DPR(pSmi, 0x38, paty); - } else { -#if X_BYTE_ORDER == X_BIG_ENDIAN - if (bg == 0xFFFFFF7F) - bg = -1; -#endif - WaitQueue(); - WRITE_DPR(pSmi, 0x14, fg); - WRITE_DPR(pSmi, 0x18, bg); - WRITE_DPR(pSmi, 0x34, patx); - WRITE_DPR(pSmi, 0x38, paty); - } - - LEAVE(); -} - -static void -SMI_SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int patx, int paty, - int x, int y, int w, int h) -{ - SMIPtr pSmi = SMIPTR(pScrn); - - ENTER(); - DEBUG("x=%d y=%d w=%d h=%d\n", x, y, w, h); - - if (pScrn->bitsPerPixel == 24) { - x *= 3; - w *= 3; - if (pSmi->Chipset == SMI_LYNX) { - y *= 3; - } - } - - WaitQueue(); - WRITE_DPR(pSmi, 0x04, (x << 16) | (y & 0xFFFF)); - WRITE_DPR(pSmi, 0x08, (w << 16) | (h & 0xFFFF)); - WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd); - - LEAVE(); -} - -/******************************************************************************/ -/* 8x8 Color Pattern Fills */ -/******************************************************************************/ - -static void -SMI_SetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty, int rop, - unsigned int planemask, int trans_color) -{ - SMIPtr pSmi = SMIPTR(pScrn); - - ENTER(); - DEBUG("patx=%d paty=%d rop=%02X trans_color=%08X\n", - patx, paty, rop, trans_color); - - pSmi->AccelCmd = XAAGetPatternROP(rop) - | SMI_BITBLT - | SMI_COLOR_PATTERN - | SMI_START_ENGINE; - -#if X_BYTE_ORDER == X_BIG_ENDIAN - if (pScrn->depth >= 24) - trans_color = lswapl(trans_color); -#endif - if (pScrn->bitsPerPixel <= 16) { - /* PDR#950 */ - CARD8* pattern = pSmi->FBBase + - (patx + paty * pScrn->displayWidth) * pSmi->Bpp; - - WaitIdle(); - WRITE_DPR(pSmi, 0x0C, SMI_BITBLT | SMI_COLOR_PATTERN); - memcpy(pSmi->DataPortBase, pattern, 8 * pSmi->Bpp * 8); - } else { - if (pScrn->bitsPerPixel == 24) { - patx *= 3; - - if (pSmi->Chipset == SMI_LYNX) { - paty *= 3; - } - } - - WaitQueue(); - WRITE_DPR(pSmi, 0x00, (patx << 16) | (paty & 0xFFFF)); - } - - WaitQueue(); - - if (trans_color == -1) { - pSmi->AccelCmd |= SMI_TRANSPARENT_SRC | SMI_TRANSPARENT_PXL; - - WaitQueue(); - WRITE_DPR(pSmi, 0x20, trans_color); - } - - if (pSmi->ClipTurnedOn) { - WaitQueue(); - WRITE_DPR(pSmi, 0x2C, pSmi->ScissorsLeft); - pSmi->ClipTurnedOn = FALSE; - } - - LEAVE(); -} - -static void -SMI_SubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, int patx, int paty, - int x, int y, int w, int h) -{ - SMIPtr pSmi = SMIPTR(pScrn); - - ENTER(); - DEBUG("x=%d y=%d w=%d h=%d\n", x, y, w, h); - - if (pScrn->bitsPerPixel == 24) { - x *= 3; - w *= 3; - - if (pSmi->Chipset == SMI_LYNX) { - y *= 3; - } - } - - WaitQueue(); - WRITE_DPR(pSmi, 0x04, (x << 16) | (y & 0xFFFF)); - WRITE_DPR(pSmi, 0x08, (w << 16) | (h & 0xFFFF)); /* PDR#950 */ - WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd); - - LEAVE(); -} - -#if SMI_USE_IMAGE_WRITES -/******************************************************************************/ -/* Image Writes */ -/******************************************************************************/ - -static void -SMI_SetupForImageWrite(ScrnInfoPtr pScrn, int rop, unsigned int planemask, - int trans_color, int bpp, int depth) -{ - SMIPtr pSmi = SMIPTR(pScrn); - - ENTER(); - DEBUG("rop=%02X trans_color=%08X bpp=%d depth=%d\n", - rop, trans_color, bpp, depth); - -#if X_BYTE_ORDER == X_BIG_ENDIAN - if (pScrn->depth >= 24) - trans_color = lswapl(trans_color); -#endif - pSmi->AccelCmd = XAAGetCopyROP(rop) - | SMI_HOSTBLT_WRITE - | SMI_START_ENGINE; - - if (trans_color != -1) { -#if X_BYTE_ORDER == X_BIG_ENDIAN - if (trans_color == 0xFFFFFF7F) - trans_color = -1; -#endif - pSmi->AccelCmd |= SMI_TRANSPARENT_SRC | SMI_TRANSPARENT_PXL; - - WaitQueue(); - WRITE_DPR(pSmi, 0x20, trans_color); - } - - LEAVE(); -} - -static void -SMI_SubsequentImageWriteRect(ScrnInfoPtr pScrn, int x, int y, int w, int h, - int skipleft) -{ - SMIPtr pSmi = SMIPTR(pScrn); - - ENTER(); - DEBUG("x=%d y=%d w=%d h=%d skipleft=%d\n", x, y, w, h, skipleft); - - if (pScrn->bitsPerPixel == 24) { - x *= 3; - w *= 3; - skipleft *= 3; - - if (pSmi->Chipset == SMI_LYNX) { - y *= 3; - } - } - - if (skipleft) { - WaitQueue(); - WRITE_DPR(pSmi, 0x2C, (pSmi->ScissorsLeft & 0xFFFF0000) | - (x + skipleft) | 0x2000); - pSmi->ClipTurnedOn = TRUE; - } else { - if (pSmi->ClipTurnedOn) { - WaitQueue(); - WRITE_DPR(pSmi, 0x2C, pSmi->ScissorsLeft); - pSmi->ClipTurnedOn = FALSE; - } else { - WaitQueue(); - } - } - WRITE_DPR(pSmi, 0x00, 0); - WRITE_DPR(pSmi, 0x04, (x << 16) | (y * 0xFFFF)); - WRITE_DPR(pSmi, 0x08, (w << 16) | (h & 0xFFFF)); - WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd); - - LEAVE(); -} -#endif -#endif |