7045469 Need matrox sparc ddx
authorhenryzh <henry.zhao@oracle.com>
Mon, 20 Feb 2012 11:30:42 -0800
changeset 1244 94b8d1e21e14
parent 1243 ae7306083bdb
child 1245 9a76fccb9dca
7045469 Need matrox sparc ddx
open-src/driver/Makefile
open-src/driver/xf86-video-mga/Makefile
open-src/driver/xf86-video-mga/g200se_pilot3_memory_bandwidth.patch
open-src/driver/xf86-video-mga/g200se_pilot3_memory_sizing.patch
open-src/driver/xf86-video-mga/g200se_pilot3_offscreen.patch
open-src/driver/xf86-video-mga/sparc.patch
open-src/xserver/xorg/patch-list
open-src/xserver/xorg/sparc-nopciprobe.patch
pkg/manifests/x11-server-xorg-driver-xorg-video-mga.p5m
pkg/manifests/x11-server-xorg-driver-xorg-video.p5m
--- a/open-src/driver/Makefile	Mon Feb 13 11:32:04 2012 -0800
+++ b/open-src/driver/Makefile	Mon Feb 20 11:30:42 2012 -0800
@@ -1,6 +1,6 @@
 # Makefile for X Consolidation Open Source Xorg driver modules
 #
-# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2012, Oracle and/or its affiliates. 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"),
@@ -29,6 +29,7 @@
 	xf86-input-mouse		\
 	xf86-input-void			\
 	xf86-video-ast			\
+	xf86-video-mga			\
 	xf86-video-dummy		
 
 OS_SUBDIRS_sparc = $(OS_SUBDIRS_common) \
@@ -43,7 +44,6 @@
 	xf86-video-cirrus		\
 	xf86-video-intel		\
 	xf86-video-mach64		\
-	xf86-video-mga			\
 	xf86-video-nv			\
 	xf86-video-openchrome		\
 	xf86-video-r128			\
--- a/open-src/driver/xf86-video-mga/Makefile	Mon Feb 13 11:32:04 2012 -0800
+++ b/open-src/driver/xf86-video-mga/Makefile	Mon Feb 20 11:30:42 2012 -0800
@@ -2,7 +2,7 @@
 #
 # xf86-video-mga Makefile
 #
-# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2012, Oracle and/or its affiliates. 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"),
@@ -37,7 +37,11 @@
 
 # Patches to apply to source after unpacking, in order
 SOURCE_PATCHES = no-hal.patch \
-		7027761.patch,-p1
+		7027761.patch,-p1 \
+		g200se_pilot3_memory_bandwidth.patch \
+		g200se_pilot3_memory_sizing.patch \
+		g200se_pilot3_offscreen.patch \
+		sparc.patch
 
 # Man pages to apply Sun footer to & attributes to list
 SUNTOUCHED_MANPAGES=man/*.man
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/driver/xf86-video-mga/g200se_pilot3_memory_bandwidth.patch	Mon Feb 20 11:30:42 2012 -0800
@@ -0,0 +1,114 @@
+diff -urp -x '*~' -x '*.orig' src/mga_driver.c src/mga_driver.c
+--- src/mga_driver.c	Fri Jul 15 13:01:36 2011
++++ src/mga_driver.c	Fri Jul 15 13:11:48 2011
+@@ -3290,15 +3290,72 @@
+ 	    outb(0xfac, 0x02);
+     }
+ 
+-    MGA_NOT_HAL(
+-	if (pMga->is_G200SE) {
++    /*
++     This function optimize the Priority Request control
++     Higher HiPriLvl will reduce drawing performance
++     We need to give enough bandwith to crtc to avoid visual artifact
++    */
++       if (pMga->is_G200SE)
++    {
++        if (pMga->reg_1e24 >= 0x02)
++        {
++            /* Calulate CRTC Priority value */
++            CARD8  ucHiPriLvl;
++            CARD32 ulBitsPerPixel;
++            CARD32 ulMemoryBandwidth;
++
++            /* uiBitsPerPixel can only be 8,16 or32 */
++            if (pScrn->bitsPerPixel > 16)
++            {
++                ulBitsPerPixel = 32;
++            }
++            else if (pScrn->bitsPerPixel >  8)
++            {
++                ulBitsPerPixel = 16;
++            }
++            else
++            {
++                ulBitsPerPixel = 8;
++            }
++
++
++            ulMemoryBandwidth = (mode->Clock * ulBitsPerPixel) / 1000;
++
++            if      (ulMemoryBandwidth    > 3100)  ucHiPriLvl = 0;
++            else if (ulMemoryBandwidth    > 2600)  ucHiPriLvl = 1;
++            else if (ulMemoryBandwidth    > 1900)  ucHiPriLvl = 2;
++            else if (ulMemoryBandwidth    > 1160)  ucHiPriLvl = 3;
++            else if (ulMemoryBandwidth    > 440)   ucHiPriLvl = 4;
++            else ucHiPriLvl = 5;
++
+             OUTREG8(0x1FDE, 0x06);
+-	    if (pMga->reg_1e24 == 0x01)
+-		OUTREG8(0x1FDF, 0x03);
+-	    else 
+-		OUTREG8(0x1FDF, 0x14);
++                   OUTREG8(0x1FDF, ucHiPriLvl);
++
++            xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Clock           == %d\n",   mode->Clock);
++            xf86DrvMsg(pScrn->scrnIndex, X_INFO, "BitsPerPixel    == %d\n",   pScrn->bitsPerPixel);
++            xf86DrvMsg(pScrn->scrnIndex, X_INFO, "MemoryBandwidth == %d\n",   ulMemoryBandwidth);
++            xf86DrvMsg(pScrn->scrnIndex, X_INFO, "HiPriLvl        == %02X\n", ucHiPriLvl);
++
+         }
+-    );
++        else
++        {
++            MGA_NOT_HAL(
++                xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Clock           == %d\n",   mode->Clock);
++                xf86DrvMsg(pScrn->scrnIndex, X_INFO, "BitsPerPixel    == %d\n",   pScrn->bitsPerPixel);
++                OUTREG8(0x1FDE, 0x06);
++                   if (pMga->reg_1e24 >= 0x01)
++                {
++                           OUTREG8(0x1FDF, 0x03);
++                    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "HiPriLvl        == 03\n");
++                }
++                   else
++                {
++                           OUTREG8(0x1FDF, 0x14);
++                    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "HiPriLvl        == 14h\n");
++                }
++            );
++        }
++    }
+ 
+     pMga->CurrentLayout.mode = mode;
+ 
+@@ -4362,13 +4419,23 @@
+     MGAPtr pMga = MGAPTR(pScrn);
+ 
+     if (pMga->Chipset == PCI_CHIP_MGAG200_SE_A_PCI) {
+-	if (mode->HDisplay > 1600)
+-	    return MODE_VIRTUAL_X;
+-	if (mode->VDisplay > 1200)
+-	    return MODE_VIRTUAL_Y;
+-	if (pMga->reg_1e24 == 0x01 &&
+-	    xf86ModeBandwidth(mode, pScrn->bitsPerPixel) > 244)
+-	    return MODE_BANDWIDTH;
++       if (pMga->reg_1e24 == 0x01) {
++               if (mode->HDisplay > 1600)
++                   return MODE_VIRTUAL_X;
++               if (mode->VDisplay > 1200)
++                   return MODE_VIRTUAL_Y;
++               if (xf86ModeBandwidth(mode, pScrn->bitsPerPixel) > 244)
++                   return MODE_BANDWIDTH;
++        } else {
++            if (pMga->reg_1e24 >= 0x02) {
++                   if (mode->HDisplay > 1920)
++                       return MODE_VIRTUAL_X;
++                   if (mode->VDisplay > 1200)
++                       return MODE_VIRTUAL_Y;
++                   if (xf86ModeBandwidth(mode, pScrn->bitsPerPixel) > 301)
++                       return MODE_BANDWIDTH;
++            }
++        }
+     } else if (pMga->is_G200WB){
+         if (mode->Flags & V_DBLSCAN)
+             return MODE_NO_DBLESCAN;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/driver/xf86-video-mga/g200se_pilot3_memory_sizing.patch	Mon Feb 20 11:30:42 2012 -0800
@@ -0,0 +1,82 @@
+--- src/mga_driver.c	Thu Feb  9 16:48:48 2012
++++ src/mga_driver.c	Thu Feb  9 15:21:20 2012
+@@ -1124,7 +1124,7 @@
+ 
+ 	if (pMga->is_G200SE)
+ 	    pMga->reg_1e24 = INREG(0x1e24); /* stash the model for later */
+-	if (pMga->reg_1e24 == 0x01) {
++	if (pMga->reg_1e24 >= 0x01) {
+ 	    MGAUnmapMem(pScrn);
+ 	    ProbeSize = 16384;
+ 	    ProbeSizeOffset = 0x10000;
+@@ -3582,13 +3582,20 @@
+     pMga = MGAPTR(pScrn);
+     MGAdac = &pMga->Dac;
+ 
+-    if (pMga->is_G200SE) {
+-	VRTemp = pScrn->videoRam;
+-	FBTemp = pMga->FbMapSize;
+-	pScrn->videoRam = 8192;
+-	pMga->FbMapSize = pScrn->videoRam * 1024;
++    if (pMga->is_G200SE)
++    {
++        VRTemp = pScrn->videoRam;
++        FBTemp = pMga->FbMapSize;
++        if (pMga->reg_1e24 >= 0x01)
++        {
++            pScrn->videoRam = 16384;
++        }
++        else
++        {
++            pScrn->videoRam = 8192;
++        }
++        pMga->FbMapSize = pScrn->videoRam * 1024;
+     }
+-    
+ 
+     /* Map the MGA memory and MMIO areas */
+     if (!MGAMapMem(pScrn))
+@@ -4320,6 +4327,7 @@
+     vgaHWPtr hwp = VGAHWPTR(pScrn);
+     MGAPtr pMga = MGAPTR(pScrn);
+     MGAEntPtr pMgaEnt = NULL;
++    CARD32 VRTemp, FBTemp;
+ 
+ #ifdef USEMGAHAL    
+     MGA_HAL( RESTORE_TEXTMODE_ON_DVI(pMga); );
+@@ -4327,6 +4335,21 @@
+     if (pMga->MergedFB)
+          MGACloseScreenMerged(scrnIndex, pScreen);
+ 
++    if (pMga->is_G200SE)
++    {
++        VRTemp = pScrn->videoRam;
++        FBTemp = pMga->FbMapSize;
++        if (pMga->reg_1e24 >= 0x01)
++        {
++            pScrn->videoRam = 16384;
++        }
++        else
++        {
++            pScrn->videoRam = 8192;
++        }
++        pMga->FbMapSize = pScrn->videoRam * 1024;
++    }
++
+     if (pScrn->vtSema) {
+ 	if (pMga->FBDev) {
+ 	    fbdevHWRestore(pScrn);
+@@ -4338,6 +4361,13 @@
+ 	    vgaHWUnmapMem(pScrn);
+ 	}
+     }
++
++    if (pMga->is_G200SE)
++    {
++        pScrn->videoRam = VRTemp;
++        pMga->FbMapSize = FBTemp;
++    }
++
+ #ifdef XF86DRI
+    if (pMga->directRenderingEnabled) {
+        MGADRICloseScreen(pScreen);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/driver/xf86-video-mga/g200se_pilot3_offscreen.patch	Mon Feb 20 11:30:42 2012 -0800
@@ -0,0 +1,11 @@
+--- src/mga_storm.c.    Wed Jan 11 12:42:02 2012
++++ src/mga_storm.c     Wed Jan 11 12:42:23 2012
+@@ -786,7 +786,6 @@
+     }
+
+     switch (pMga->Chipset) {
+-    case PCI_CHIP_MGAG200_SE_A_PCI:
+     case PCI_CHIP_MGAG200_SE_B_PCI:
+        maxlines = (min(pMga->FbUsableSize, 1*1024*1024)) /
+                   (pScrn->displayWidth * pMga->CurrentLayout.bitsPerPixel / 8);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/driver/xf86-video-mga/sparc.patch	Mon Feb 20 11:30:42 2012 -0800
@@ -0,0 +1,317 @@
+diff -ur old/src/mga.h new/src/mga.h
+--- src/mga.h	Wed Jan  4 18:11:17 2012
++++ src/mga.h	Wed Jan  4 18:12:40 2012
+@@ -47,6 +47,10 @@
+ #include "client.h"
+ #endif
+ 
++#ifdef __sparc__
++#include <sys/visual_io.h>
++#endif
++
+ typedef enum {
+     OPTION_SW_CURSOR,
+     OPTION_HW_CURSOR,
+@@ -201,6 +205,28 @@
+ #define MGA_MODULE_DATA mgaModuleData
+ #define MGA_DRIVER_NAME "mga"
+ 
++#ifdef __sparc__
++#ifndef VIS_GETPCICONFIG
++
++/*
++ * These definitions will be removed when they are included in the
++ * visual_io.h
++ */
++#define VIS_GETVIDEOMODENAME		(VIOC | 12)
++#define VIS_STOREVIDEOMODENAME		(VIOC | 13)
++#define VIS_MAX_VMODE_LEN		48
++
++typedef struct	vis_video_mode {
++	char		mode_name[VIS_MAX_VMODE_LEN];
++	uint32_t	vRefresh;
++	char		pad[96];
++} vis_video_mode_t;
++
++
++#define VIS_GETPCICONFIG		(VIOC | 14)
++#endif
++#endif
++
+ typedef struct {
+     unsigned char	ExtVga[6];
+     unsigned char 	DacClk[6];
+@@ -682,6 +708,9 @@
+                                        if in merged mode */
+ /* End of Merged Framebuffer Data */
+   int			HALGranularityOffX, HALGranularityOffY;
++#ifdef __sparc__
++    int			fd;
++#endif
+ } MGARec, *MGAPtr;
+ 
+ extern CARD32 MGAAtype[16];
+diff -ur old/src/mga_dacG.c new/src/mga_dacG.c
+--- src/mga_dacG.c	Wed Jan  4 18:11:17 2012
++++ src/mga_dacG.c	Thu Jan 19 11:54:04 2012
+@@ -1753,11 +1753,35 @@
+     MGAPtr pMga = MGAPTR(pScrn);
+     CARD32 *dst = (CARD32*)(pMga->FbBase + pMga->FbCursorOffset);
+     int i = 128;
+-    
+-    /* swap bytes in each line */
++#ifdef X_BYTE_ORDER != X_LITTLE_ENDIAN
++    MGAFBLayout *pLayout = &pMga->CurrentLayout;
++#endif
++
++    /* 
++     * HW cursor expects image that is both bytes and words swapped
++     * see DAC Registers section of the manual 
++     */
+     while( i-- ) {
++#if X_BYTE_ORDER == X_LITTLE_ENDIAN
++    	/* swap bytes in each line, byte swap happens during explict byte shift */
+         *dst++ = (src[4] << 24) | (src[5] << 16) | (src[6] << 8) | src[7];
+         *dst++ = (src[0] << 24) | (src[1] << 16) | (src[2] << 8) | src[3];
++#else
++	if (pLayout->depth == 8) {
++	    /* byte swap happens during assembly of word, no explict byte shift */
++            *dst++ = (src[7] << 24) | (src[6] << 16) | (src[5] << 8) | src[4];
++            *dst++ = (src[3] << 24) | (src[2] << 16) | (src[1] << 8) | src[0];
++	} else if (pLayout->depth == 16) {
++	    /* byte swap happens during assembly of word, partial byte shift to
++	       offset effects from HW cursor's double bytes reading */
++	    *dst++ = (src[6] << 24) | (src[7] << 16) | (src[4] << 8) | src[5];
++	    *dst++ = (src[2] << 24) | (src[3] << 16) | (src[0] << 8) | src[1];
++	} else {
++	    /* depth = 32. no byte swap needed, HW cursor's word reading does swap */
++	    *dst++ = ((CARD32 *)src)[1];
++	    *dst++ = ((CARD32 *)src)[0];
++	}
++#endif
+         src += 8;
+     }
+ }
+diff -ur old/src/mga_driver.c new/src/mga_driver.c
+--- src/mga_driver.c	Wed Jan  4 18:11:17 2012
++++ src/mga_driver.c	Wed Jan 11 12:45:12 2012
+@@ -104,6 +104,11 @@
+ 
+ #include <unistd.h>
+ 
++#ifdef __sparc__
++#include <stdio.h>
++#include <fcntl.h>
++#endif
++
+ /*
+  * Forward definitions for the functions that make up the driver.
+  */
+@@ -153,6 +158,10 @@
+ static void 	MGABlockHandler(int, pointer, pointer, pointer);
+ static void	MGAG100BlackMagic(ScrnInfoPtr pScrn);
+ 
++#ifdef __sparc__
++static void MGANotifyModeChanged(ScrnInfoPtr pScrn);
++#endif
++
+ static int MGAEntityIndex = -1;
+ 
+ #include "mga_merge.h"
+@@ -452,7 +461,16 @@
+ 
+     { 0, 0, 0 },
+ };
++
++#ifdef __sparc__
++/* mimic pci_device_private struct so that define of DEV_PATH becomes valid */
++static struct mga_device_private {
++    struct pci_device  base;
++    const char * device_string;
++};
++#define DEV_PATH(dev)    (((struct mga_device_private *) (dev))->device_string)
+ #endif
++#endif
+ 
+ /* Supported chipsets */
+ static SymTabRec MGAChipsets[] = {
+@@ -1295,9 +1316,11 @@
+ 
+     /* Map the VGA memory when the primary video */
+     if (pMga->Primary) {
++#if !defined(__sparc__)
+ 	hwp->MapSize = 0x10000;
+ 	if (!vgaHWMapMem(pScrn))
+ 	    return NULL;
++#endif
+     } else {
+ 	/* XXX Need to write an MGA mode ddc1SetSpeed */
+ 	if (pMga->DDC1SetSpeed == vgaHWddc1SetSpeedWeak()) {
+@@ -1340,6 +1363,7 @@
+ 					  pMga->ddc1Read ) ;
+ 		from = "DDC1";
+ 	    }
++#if !defined(__sparc__)
+ 	if (!MonInfo){
+ 	    vbeInfoPtr pVbe;
+ 	    if (xf86LoadSubModule(pScrn, "vbe")) {
+@@ -1349,6 +1373,7 @@
+ 		from = "VBE";
+ 	    }
+ 	}
++#endif
+     }
+ 
+     if (MonInfo) {
+@@ -1574,7 +1599,21 @@
+     pMga->PciInfo = xf86GetPciInfoForEntity(pMga->pEnt->index);
+     pMga->PciTag = pciTag(pMga->PciInfo->bus, pMga->PciInfo->device,
+ 			  pMga->PciInfo->func);
++#else
++#ifdef __sparc__
++    {
++	char        dev[128];
++	if (DEV_PATH(pMga->PciInfo))
++	    snprintf(dev, sizeof (dev), "%s%s", "/devices",
++		DEV_PATH(pMga->PciInfo));
++	else
++	    strcpy (dev, "/dev/fb0");
++
++	if ((pMga->fd = open(dev, O_RDWR)) < 0)
++	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Cannot open device %s\n", dev);
++    }
+ #endif
++#endif
+ 
+     pMga->Primary = xf86IsPrimaryPci(pMga->PciInfo);
+ 
+@@ -1960,7 +1999,7 @@
+         xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Enabling KVM\n");
+     }
+     
+-#if !defined(__powerpc__)
++#if (!defined(__powerpc__) && !defined(__sparc__))
+     pMga->softbooted = FALSE;
+     Default = (pMga->chip_attribs->dual_head_possible
+ 	       && !pMga->Primary && !pMga->SecondCrtc);
+@@ -3012,7 +3051,11 @@
+     /* Could call it dac2Saved */
+ 
+     /* Only save text mode fonts/text for the primary card */
++#ifdef __sparc__
++    (*pMga->Save)(pScrn, vgaReg, mgaReg, FALSE);
++#else
+     (*pMga->Save)(pScrn, vgaReg, mgaReg, pMga->Primary);
++#endif
+ }
+ 
+ #ifdef USEMGAHAL
+@@ -3370,6 +3413,10 @@
+ #ifdef DEBUG
+    MGAG450PrintPLL(pScrn);
+ #endif
++
++#ifdef __sparc__
++    MGANotifyModeChanged(pScrn);
++#endif
+     return TRUE;
+ }
+ 
+@@ -3467,7 +3514,11 @@
+ 	    }
+ 	    );	/* MGA_HAL */
+ #endif
++#ifdef __sparc__
++	(*pMga->Restore)(pScrn, vgaReg, mgaReg, FALSE);
++#else
+         (*pMga->Restore)(pScrn, vgaReg, mgaReg, TRUE);
++#endif
+     } else {
+         vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE);
+     }
+@@ -3658,9 +3709,11 @@
+     /* Map the VGA memory when the primary video */
+     if (!pMga->FBDev) {
+ 	if (pMga->Primary) {
++#if !defined(__sparc__)
+ 	    hwp->MapSize = 0x10000;
+ 	    if (!vgaHWMapMem(pScrn))
+ 		return FALSE;
++#endif
+ 	}
+ 
+ 	/* Save the current state */
+@@ -3916,6 +3969,10 @@
+ 
+     MGAInitVideo(pScreen);
+ 
++#ifdef __sparc__
++    MGANotifyModeChanged(pScrn);
++#endif
++
+ #ifdef XF86DRI
+     if (pMga->directRenderingEnabled) {
+        /* Now that mi, drm and others have done their thing,
+@@ -4352,6 +4409,11 @@
+     if (pMga->ScratchBuffer)
+ 	xfree(pMga->ScratchBuffer);
+ 
++#ifdef __sparc__
++    if (pMga->fd)
++	close(pMga->fd);
++#endif
++
+     pScrn->vtSema = FALSE;
+ 
+     if (xf86IsPc98())
+@@ -4757,3 +4819,21 @@
+     usleep(10);
+ }
+ 
++#ifdef __sparc__
++static void
++MGANotifyModeChanged(ScrnInfoPtr pScrn)
++{
++    struct vis_video_mode mode;
++    MGAPtr pMga = MGAPTR(pScrn);
++
++    if (pScrn->currentMode->name != NULL) {
++	strlcpy(mode.mode_name, pScrn->currentMode->name, VIS_MAX_VMODE_LEN);
++    } else {
++	strlcpy(mode.mode_name, " ", VIS_MAX_VMODE_LEN);
++    }
++    mode.vRefresh = pScrn->currentMode->VRefresh;
++
++    ioctl(pMga->fd, VIS_STOREVIDEOMODENAME, &mode);
++
++}
++#endif
+diff -ur old/src/mga_storm.c new/src/mga_storm.c
+--- src/mga_storm.c	Wed Jan  4 18:11:17 2012
++++ src/mga_storm.c	Wed Jan 11 12:41:33 2012
+@@ -989,7 +989,12 @@
+ #if X_BYTE_ORDER == X_LITTLE_ENDIAN
+    OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT );
+ #else
+-   OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT | 0x10000);
++   if (pLayout->depth == 8)
++	OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT);
++   else if (pLayout->depth == 16)
++	OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT | 0x10000);
++   else
++	OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT | 0x20000);
+ #endif
+    OUTREG(MGAREG_CXBNDRY, 0xFFFF0000); /* (maxX << 16) | minX */
+    OUTREG(MGAREG_YTOP, 0x00000000);    /* minPixelPointer */
+@@ -1077,9 +1082,9 @@
+         maccess |= (1 << 31);
+     }
+ 
+-    opmode |= opmode_table[ pLayout->bitsPerPixel / 8 ];
+-#if X_BYTE_ORDER == X_LITTLE_ENDIAN
+     opmode &= ~0x30000;
++#if X_BYTE_ORDER == X_BIG_ENDIAN
++    opmode |= opmode_table[ pLayout->bitsPerPixel / 8 ];
+ #endif
+ 
+     pMga->SetupForSolidFill = mgaSetupForSolidFill;
--- a/open-src/xserver/xorg/patch-list	Mon Feb 13 11:32:04 2012 -0800
+++ b/open-src/xserver/xorg/patch-list	Mon Feb 20 11:30:42 2012 -0800
@@ -17,7 +17,6 @@
 amd64-loader-path.patch,-p1
 fontmod.patch,-p1
 sparc-probe.patch,-p1
-sparc-nopciprobe.patch,-p1
 glx-impure.patch,-p1
 nvidia-autoconfig.patch,-p1
 autoconfig.patch,-p1
--- a/open-src/xserver/xorg/sparc-nopciprobe.patch	Mon Feb 13 11:32:04 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-# Copyright (c) 2009, Oracle and/or its affiliates. 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 (including the next
-# paragraph) 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,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS 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.
-#
-
-Omit Bus probing on sparc. It is terribly slow and we get the same info thru /dev/fb
-
-*** hw/xfree86/common/xf86Init.c.orig	Thu Dec 18 18:01:47 2008
-diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
-index e664ce4..1da5f5a 100644
---- a/hw/xfree86/common/xf86Init.c
-+++ b/hw/xfree86/common/xf86Init.c
-@@ -388,7 +388,10 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
-         DoShowOptions();
- 
-     /* Do a general bus probe.  This will be a PCI probe for x86 platforms */
-+#if (!defined(__sparc__) && !defined(__sparc))
-     xf86BusProbe();
-+#endif
-+
- 
-     if (xf86DoConfigure)
- 	DoConfigure();
--- a/pkg/manifests/x11-server-xorg-driver-xorg-video-mga.p5m	Mon Feb 13 11:32:04 2012 -0800
+++ b/pkg/manifests/x11-server-xorg-driver-xorg-video-mga.p5m	Mon Feb 20 11:30:42 2012 -0800
@@ -1,4 +1,4 @@
-# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2012, Oracle and/or its affiliates. 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"),
@@ -24,6 +24,8 @@
 set name=pkg.summary \
     value="xf86-video-mga - Matrox video driver for the Xorg X server"
 set name=pkg.description value="Xorg video driver for Matrox graphics devices"
-set name=variant.arch value=i386
 file path=usr/lib/xorg/modules/drivers/mga_drv.so
 file path=usr/share/man/man7/mga.7
+
+# SPARC version requires sparc kernel driver
+# $(sparc_ONLY)depend type=require fmri=pkg:/driver/graphics/mga
--- a/pkg/manifests/x11-server-xorg-driver-xorg-video.p5m	Mon Feb 13 11:32:04 2012 -0800
+++ b/pkg/manifests/x11-server-xorg-driver-xorg-video.p5m	Mon Feb 20 11:30:42 2012 -0800
@@ -1,4 +1,4 @@
-# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2012, Oracle and/or its affiliates. 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"),
@@ -52,7 +52,7 @@
 $(i386_ONLY)depend type=group fmri=pkg:/x11/server/xorg/driver/xorg-video-mach64
 
 # driver/xf86-video-mga
-$(i386_ONLY)depend type=group fmri=pkg:/x11/server/xorg/driver/xorg-video-mga
+depend type=group fmri=pkg:/x11/server/xorg/driver/xorg-video-mga
 
 # driver/xf86-video-nv
 $(i386_ONLY)depend type=group fmri=pkg:/x11/server/xorg/driver/xorg-video-nv