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/A@@ -4194,3 +4253,21 @@ MGAG100BlackMagic(ScrnInfoPtr pScrn)
1244N/A+MGANotifyModeChanged(ScrnInfoPtr pScrn)
1244N/A+ struct vis_video_mode mode;
1244N/A+ MGAPtr pMga = MGAPTR(pScrn);
1244N/A+ if (pScrn->currentMode->name != NULL) {
1244N/A+ ioctl(pMga->fd, VIS_STOREVIDEOMODENAME, &mode);
1265N/Aindex 96bb6b9..57fdba5 100644
1265N/A@@ -989,7 +989,12 @@ static void mgaRestoreAccelState(ScrnInfoPtr pScrn)
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 */
1265N/A@@ -1077,9 +1082,9 @@ void MGAStormEngineInit( ScrnInfoPtr pScrn )
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;