1265N/Aindex 77406f1..25dcf53 100644
1265N/A@@ -200,6 +204,28 @@ void MGAdbg_outreg32(ScrnInfoPtr, int,int, char*);
1244N/A #define MGA_MODULE_DATA mgaModuleData
1244N/A #define MGA_DRIVER_NAME "mga"
1244N/A+ * These definitions will be removed when they are included in the
1244N/A+#define VIS_GETVIDEOMODENAME (VIOC | 12)
1244N/A+#define VIS_STOREVIDEOMODENAME (VIOC | 13)
1244N/A+#define VIS_MAX_VMODE_LEN 48
1244N/A+typedef struct vis_video_mode {
1244N/A+ char mode_name[VIS_MAX_VMODE_LEN];
1244N/A+#define VIS_GETPCICONFIG (VIOC | 14)
1265N/A@@ -667,6 +693,9 @@ typedef struct {
1244N/A /* End of Merged Framebuffer Data */
1244N/A int HALGranularityOffX, HALGranularityOffY;
1244N/A extern CARD32 MGAAtype[16];
1265N/A@@ -1711,11 +1711,35 @@ MGAGLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
1244N/A MGAPtr pMga = MGAPTR(pScrn);
1244N/A CARD32 *dst = (CARD32*)(pMga->FbBase + pMga->FbCursorOffset);
1244N/A- /* swap bytes in each line */
1244N/A+#ifdef X_BYTE_ORDER != X_LITTLE_ENDIAN
1244N/A+ MGAFBLayout *pLayout = &pMga->CurrentLayout;
1244N/A+ * HW cursor expects image that is both bytes and words swapped
1244N/A+ * see DAC Registers section of the manual
1244N/A+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
1244N/A+ /* swap bytes in each line, byte swap happens during explict byte shift */
1244N/A *dst++ = (src[4] << 24) | (src[5] << 16) | (src[6] << 8) | src[7];
1244N/A *dst++ = (src[0] << 24) | (src[1] << 16) | (src[2] << 8) | src[3];
1244N/A+ if (pLayout->depth == 8) {
1244N/A+ /* byte swap happens during assembly of word, no explict byte shift */
1244N/A+ *dst++ = (src[7] << 24) | (src[6] << 16) | (src[5] << 8) | src[4];
1244N/A+ *dst++ = (src[3] << 24) | (src[2] << 16) | (src[1] << 8) | src[0];
1244N/A+ } else if (pLayout->depth == 16) {
1244N/A+ /* byte swap happens during assembly of word, partial byte shift to
1244N/A+ offset effects from HW cursor's double bytes reading */
1244N/A+ *dst++ = (src[6] << 24) | (src[7] << 16) | (src[4] << 8) | src[5];
1244N/A+ *dst++ = (src[2] << 24) | (src[3] << 16) | (src[0] << 8) | src[1];
1244N/A+ /* depth = 32. no byte swap needed, HW cursor's word reading does swap */
1244N/A+ *dst++ = ((CARD32 *)src)[1];
1244N/A+ *dst++ = ((CARD32 *)src)[0];
1244N/A * Forward definitions for the functions that make up the driver.
1265N/A@@ -156,6 +161,10 @@ static Bool MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode);
1244N/A static void MGABlockHandler(int, pointer, pointer, pointer);
1244N/A static void MGAG100BlackMagic(ScrnInfoPtr pScrn);
1244N/A+static void MGANotifyModeChanged(ScrnInfoPtr pScrn);
1244N/A static int MGAEntityIndex = -1;
1265N/A@@ -455,6 +464,15 @@ static const struct pci_id_match mga_device_match[] = {
1244N/A+/* mimic pci_device_private struct so that define of DEV_PATH becomes valid */
1244N/A+static struct mga_device_private {
1244N/A+ const char * device_string;
1244N/A+#define DEV_PATH(dev) (((struct mga_device_private *) (dev))->device_string)
1265N/A@@ -1296,9 +1314,11 @@ MGAdoDDC(ScrnInfoPtr pScrn)
1244N/A /* Map the VGA memory when the primary video */
1244N/A /* XXX Need to write an MGA mode ddc1SetSpeed */
1244N/A if (pMga->DDC1SetSpeed == vgaHWddc1SetSpeedWeak()) {
1265N/A@@ -1341,6 +1361,7 @@ MGAdoDDC(ScrnInfoPtr pScrn)
1244N/A if (xf86LoadSubModule(pScrn, "vbe")) {
1265N/A@@ -1350,6 +1371,7 @@ MGAdoDDC(ScrnInfoPtr pScrn)
1265N/A@@ -1571,6 +1593,20 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
1244N/A pMga->PciInfo = xf86GetPciInfoForEntity(pMga->pEnt->index);
1244N/A pMga->PciTag = pciTag(pMga->PciInfo->bus, pMga->PciInfo->device,
1244N/A+ if (DEV_PATH(pMga->PciInfo))
1244N/A+ snprintf(dev, sizeof (dev), "%s%s", "/devices",
1244N/A+ if ((pMga->fd = open(dev, O_RDWR)) < 0)
1244N/A+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Cannot open device %s\n", dev);
1244N/A pMga->Primary = xf86IsPrimaryPci(pMga->PciInfo);
1265N/A@@ -1922,7 +1958,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
1244N/A xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Enabling KVM\n");
1244N/A+#if (!defined(__powerpc__) && !defined(__sparc__))
1244N/A Default = (pMga->chip_attribs->dual_head_possible
1244N/A && !pMga->Primary && !pMga->SecondCrtc);
1265N/A@@ -2838,7 +2874,11 @@ MGASave(ScrnInfoPtr pScrn)
1244N/A /* Could call it dac2Saved */
1244N/A+ (*pMga->Save)(pScrn, vgaReg, mgaReg, FALSE);
1244N/A (*pMga->Save)(pScrn, vgaReg, mgaReg, pMga->Primary);
1265N/A@@ -2996,6 +3036,10 @@ MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
1244N/A+ MGANotifyModeChanged(pScrn);
1265N/A@@ -3085,7 +3129,11 @@ MGARestore(ScrnInfoPtr pScrn)
1265N/A+ (*pMga->Restore)(pScrn, vgaReg, mgaReg, FALSE);
1244N/A (*pMga->Restore)(pScrn, vgaReg, mgaReg, TRUE);
1244N/A vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE);
1265N/A@@ -3215,9 +3263,11 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
1244N/A /* Map the VGA memory when the primary video */
1244N/A /* Save the current state */
1265N/A@@ -3473,6 +3523,10 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
1244N/A+ MGANotifyModeChanged(pScrn);
1244N/A if (pMga->directRenderingEnabled) {
1244N/A /* Now that mi, drm and others have done their thing,
1265N/A@@ -3792,6 +3846,13 @@ MGACloseScreen(int scrnIndex, ScreenPtr pScreen)
1265N/A+ MGANotifyModeChanged(pScrn);
1265N/A xf86ClearPrimInitDone(pScrn->entityList[0]);
1265N/Aindex 96bb6b9..57fdba5 100644
1329N/A static void mgaSubsequentSolidTwoPointLine( ScrnInfoPtr pScrn, int x1, int y1,
1329N/A int x2, int y2, int flags );
1329N/A+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
1329N/A static void mgaSetupForMono8x8PatternFill( ScrnInfoPtr pScrn,
1329N/A int patx, int paty, int fg, int bg, int rop, unsigned int planemask );
1329N/A static void mgaSubsequentMono8x8PatternFillTrap( ScrnInfoPtr pScrn,
1329N/A int patx, int paty, int y, int h, int left, int dxL, int dyL, int eL,
1329N/A int right, int dxR, int dyR, int eR );
1329N/A static void mgaSetupForScanlineImageWrite( ScrnInfoPtr pScrn, int rop,
1329N/A unsigned int planemask, int transparency_color, int bpp, int depth );
1329N/A static void MGAFillSolidSpansDMA(ScrnInfoPtr pScrn, int fg, int rop,
1329N/A unsigned int planemask, int n, DDXPointPtr ppt,
1329N/A+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
1329N/A static void MGAFillMono8x8PatternRectsTwoPass(ScrnInfoPtr pScrn, int fg, int bg,
1329N/A int rop, unsigned int planemask, int nBox,
1329N/A BoxPtr pBox, int pattern0, int pattern1,
1329N/A static void MGAValidatePolyArc(GCPtr, unsigned long, DrawablePtr);
1329N/A static void MGAValidatePolyPoint(GCPtr, unsigned long, DrawablePtr);
1329N/A static void MGAFillCacheBltRects(ScrnInfoPtr, int, unsigned int, int, BoxPtr,
1329N/A /* fill out infoPtr here */
1329N/A infoPtr->Flags = PIXMAP_CACHE |
1329N/A+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
1329N/A infoPtr->SetClippingRectangle = MGASetClippingRectangle;
1329N/A infoPtr->DisableClipping = MGADisableClipping;
1329N/A+#if X_BYTE_ORDER == X_BIG_ENDIAN
1329N/A infoPtr->ClippingFlags = HARDWARE_CLIP_SOLID_LINE |
1329N/A+ infoPtr->ClippingFlags = HARDWARE_CLIP_SOLID_LINE |
1329N/A HARDWARE_CLIP_DASHED_LINE |
1329N/A HARDWARE_CLIP_MONO_8x8_FILL;
1329N/A-#if X_BYTE_ORDER == X_LITTLE_ENDIAN
1329N/A infoPtr->DashedLineFlags = LINE_PATTERN_MSBFIRST_LSBJUSTIFIED;
1329N/A infoPtr->SetupForDashedLine = mgaSetupForDashedLine;
1329N/A infoPtr->SubsequentDashedTwoPointLine = mgaSubsequentDashedTwoPointLine;
1329N/A infoPtr->DashPatternMaxLength = 128;
1329N/A infoPtr->Mono8x8PatternFillFlags = HARDWARE_PATTERN_PROGRAMMED_BITS |
1329N/A mgaSubsequentMono8x8PatternFillRect;
1329N/A infoPtr->SubsequentMono8x8PatternFillTrap =
1329N/A mgaSubsequentMono8x8PatternFillTrap;
1329N/A /* cpu to screen color expansion */
1329N/A infoPtr->ScanlineCPUToScreenColorExpandFillFlags =
1329N/A infoPtr->FillSolidSpans = MGAFillSolidSpansDMA;
1329N/A+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
1329N/A if(pMga->AccelFlags & TWO_PASS_COLOR_EXPAND) {
1329N/A if(infoPtr->SetupForMono8x8PatternFill)
1329N/A infoPtr->FillMono8x8PatternRects =
1329N/A MGAFillMono8x8PatternRectsTwoPass;
1329N/A if(infoPtr->SetupForSolidFill) {
1329N/A infoPtr->ValidatePolyArc = MGAValidatePolyArc;
1329N/A infoPtr->SolidLineFlags |= NO_PLANEMASK;
1329N/A #if X_BYTE_ORDER == X_LITTLE_ENDIAN
1329N/A infoPtr->DashedLineFlags |= NO_PLANEMASK;
1329N/A infoPtr->Mono8x8PatternFillFlags |= NO_PLANEMASK;
1329N/A infoPtr->ScreenToScreenColorExpandFillFlags |= NO_PLANEMASK;
1329N/A infoPtr->FillSolidRectsFlags |= NO_PLANEMASK;
1329N/A infoPtr->FillSolidSpansFlags |= NO_PLANEMASK;
1329N/A+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
1329N/A infoPtr->FillMono8x8PatternRectsFlags |= NO_PLANEMASK;
1329N/A infoPtr->FillCacheBltRectsFlags |= NO_PLANEMASK;
1244N/A #if X_BYTE_ORDER == X_LITTLE_ENDIAN
1244N/A OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT );
1244N/A- OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT | 0x10000);
1244N/A+ OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT);
1244N/A+ else if (pLayout->depth == 16)
1244N/A+ OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT | 0x10000);
1244N/A+ OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT | 0x20000);
1244N/A OUTREG(MGAREG_CXBNDRY, 0xFFFF0000); /* (maxX << 16) | minX */
1244N/A OUTREG(MGAREG_YTOP, 0x00000000); /* minPixelPointer */
1244N/A- opmode |= opmode_table[ pLayout->bitsPerPixel / 8 ];
1244N/A-#if X_BYTE_ORDER == X_LITTLE_ENDIAN
1244N/A+#if X_BYTE_ORDER == X_BIG_ENDIAN
1244N/A+ opmode |= opmode_table[ pLayout->bitsPerPixel / 8 ];
1244N/A pMga->SetupForSolidFill = mgaSetupForSolidFill;
1329N/A OUTREG(MGAREG_DWGCTL, pMga->FilledRectCMD);
1329N/A+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
1329N/A /***************************\
1329N/A OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (y << 16) | h);
1329N/A OUTREG(MGAREG_DWGCTL, pMga->PatternRectCMD);
1329N/A+#endif /* X_BYTE_ORDER == X_LITTLE_ENDIAN */
1329N/A+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
1329N/A MGAFillMono8x8PatternRectsTwoPass(
1329N/A+#endif /* X_BYTE_ORDER == X_LITTLE_ENDIAN */
1333N/A+MGANotifyModeChanged(ScrnInfoPtr pScrn)
1333N/A+ struct vis_video_mode mode;
1333N/A+ MGAPtr pMga = MGAPTR(pScrn);
1333N/A+ if (pScrn->currentMode->name != NULL) {
1333N/A+ ioctl(pMga->fd, VIS_STOREVIDEOMODENAME, &mode);
1333N/A * Initialise a new mode. This is currently still using the old