Bug 37542 - XFree86 4.2.0 Server MGA G550 Corrupted HW Cursor (PATCH)
Summary: XFree86 4.2.0 Server MGA G550 Corrupted HW Cursor (PATCH)
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Eric Anholt
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-04-28 22:30 UTC by Peter Johnson
Modified: 2002-10-07 19:10 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Johnson 2002-04-28 22:30:01 UTC
The MGA driver in XFree86 4.2.0 corrupts the hardware cursor when using
the Matrox G550 card.  The corrupted cursor usually appears as a pair of
sets of vertical lines taking up a 64x64 area instead of the normal
cursor contents.  This makes XFree86 unusable for normal use.

Fix: 

Workaround:
Add option "hw cursor" "off" to the G550 Device section of the
XF86Config file.  This disables the hardware cursor.

Fix:
This has been fixed in XFree86 CVS, as part of the following patch:
http://cvsweb.xfree86.org/cvsweb/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c.diff?r1=1.218&r2=1.219
(the specific XFree86 4.2.0 bug number is 98).

As this patch covers a number of bugs, the relevant part of the patch
to this specific bug is:
--- xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c	2002/02/21 02:46:38	1.218
+++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c	2002/04/04 14:05:43	1.219
@@ -2794,7 +2794,8 @@ MGAModeInit(ScrnInfoPtr pScrn, DisplayMo
 	    case PCI_CHIP_MGAG200:
 	    case PCI_CHIP_MGAG200_PCI:
 	    case PCI_CHIP_MGAG400:	      
-	      if(pMga->SecondCrtc == FALSE && pMga->HWCursor == TRUE) {
+	    case PCI_CHIP_MGAG550:
+		if(pMga->SecondCrtc == FALSE && pMga->HWCursor == TRUE) {
 		outMGAdac(MGA1064_CURSOR_BASE_ADR_LOW, 
 			  pMga->FbCursorOffset >> 10);
 		outMGAdac(MGA1064_CURSOR_BASE_ADR_HI, 

CAUTION: There are additional complications of adding this patch from a
Ports standpoint.  The XFree86-4-Server port has an option
WITH_MATROX_GXX_DRIVER that contains a patch to the mga_driver.c file
that will be rejected if the above patch is applied first.  The changes
made by the WITH_MATROX_GXX_DRIVER patch are very minor: it adds an
AGPSIZE option.  I'm not sure how this sort of conditional patch
conflict is handled in the ports system.
How-To-Repeat: Run XFree86 4.2.0 on a Matrox G550 card with the HW cursor enabled.
Comment 1 Dmitry Sivachenko freebsd_committer freebsd_triage 2002-05-04 22:46:56 UTC
Responsible Changed
From-To: freebsd-ports->jmz

Over to MAINTAINER.
Comment 2 Eric Anholt freebsd_committer freebsd_triage 2002-07-14 22:52:19 UTC
Responsible Changed
From-To: jmz->anholt

Switch maintainer.
Comment 3 Eric Anholt freebsd_committer freebsd_triage 2002-09-19 08:55:51 UTC
State Changed
From-To: open->closed

Committed, thanks!
Comment 4 Peter Johnson 2002-10-07 19:04:39 UTC
The patch in the ports tree doesn't apply if WITH_MATROX_GXX_DRIVER is
enabled, and it needs to be.  Notably, the patch needs to target a
slightly different location in the source:

--- programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c.orig	Wed Jan 23
08:47:32 2002
+++ programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c	Mon Oct  7
10:55:45 2002
@@ -2823,6 +2823,7 @@
 	    case PCI_CHIP_MGAG200:
 	    case PCI_CHIP_MGAG200_PCI:
 	    case PCI_CHIP_MGAG400:
+	    case PCI_CHIP_MGAG550:
 	      if(pMga->SecondCrtc == FALSE && pMga->HWCursor == TRUE) {
 		outMGAdac(MGA1064_CURSOR_BASE_ADR_LOW,
 			  pMga->FbCursorOffset >> 10);

Also, on a related issue, there's a mga_driver.c.rej file created when
using the WITH_MATROX_GXX_DRIVER option, with a couple of rejected
patches:
***************
*** 211,216 ****
      OPTION_CRTC2RAM,
      OPTION_INT10,
      OPTION_AGP_MODE,
      OPTION_DIGITAL,
      OPTION_TV,
      OPTION_TVSTANDARD,
--- 211,217 ----
      OPTION_CRTC2RAM,
      OPTION_INT10,
      OPTION_AGP_MODE,
+     OPTION_AGP_SIZE,
      OPTION_DIGITAL,
      OPTION_TV,
      OPTION_TVSTANDARD,
***************
*** 242,247 ****
      { OPTION_CRTC2RAM,		"Crtc2Ram",	OPTV_INTEGER,
{0}, FALSE },
      { OPTION_INT10,		"Int10",	OPTV_BOOLEAN,	{0}, FALSE
},
      { OPTION_AGP_MODE,		"AGPMode",	OPTV_INTEGER,
{0}, FALSE },
      { OPTION_DIGITAL,		"DigitalScreen",OPTV_BOOLEAN,	{0}, FALSE
},
      { OPTION_TV,		"TV",		OPTV_BOOLEAN,	{0}, FALSE
},
      { OPTION_TVSTANDARD,	"TVStandard",	OPTV_ANYSTR,	{0}, FALSE
},
--- 243,249 ----
      { OPTION_CRTC2RAM,		"Crtc2Ram",	OPTV_INTEGER,
{0}, FALSE },
      { OPTION_INT10,		"Int10",	OPTV_BOOLEAN,	{0}, FALSE
},
      { OPTION_AGP_MODE,		"AGPMode",	OPTV_INTEGER,
{0}, FALSE },
+     { OPTION_AGP_SIZE,          "AGPSize",      OPTV_INTEGER,   {0},
FALSE },
      { OPTION_DIGITAL,		"DigitalScreen",OPTV_BOOLEAN,	{0}, FALSE
},
      { OPTION_TV,		"TV",		OPTV_BOOLEAN,	{0}, FALSE
},
      { OPTION_TVSTANDARD,	"TVStandard",	OPTV_ANYSTR,	{0}, FALSE
},

This patch fails because OPTION_DIGITAL has split into OPTION_DIGITAL1 and
OPTION_DIGITAL2.  An updated patch including both the mouse cursor fix and
a fix for the above failed patch follows.

--- programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c.orig	Wed Jan 23
08:47:32 2002
+++ programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c	Mon Oct  7
11:00:22 2002
@@ -218,6 +218,7 @@
     OPTION_CRTC2RAM,
     OPTION_INT10,
     OPTION_AGP_MODE,
+    OPTION_AGP_SIZE,
     OPTION_DIGITAL1,
     OPTION_DIGITAL2,
     OPTION_TV,
@@ -256,6 +257,7 @@
     { OPTION_CRTC2RAM,		"Crtc2Ram",	OPTV_INTEGER,	{0}, FALSE
},
     { OPTION_INT10,		"Int10",	OPTV_BOOLEAN,	{0}, FALSE
},
     { OPTION_AGP_MODE,		"AGPMode",	OPTV_INTEGER,	{0}, FALSE
},
+    { OPTION_AGP_SIZE,		"AGPSize",	OPTV_INTEGER,	{0}, FALSE
},
     { OPTION_DIGITAL1,		"DigitalScreen1",OPTV_BOOLEAN,	{0}, FALSE
},
     { OPTION_DIGITAL2,		"DigitalScreen2",OPTV_BOOLEAN,	{0}, FALSE
},
     { OPTION_TV,		"TV",		OPTV_BOOLEAN,	{0}, FALSE
},
@@ -2823,6 +2825,7 @@
 	    case PCI_CHIP_MGAG200:
 	    case PCI_CHIP_MGAG200_PCI:
 	    case PCI_CHIP_MGAG400:
+	    case PCI_CHIP_MGAG550:
 	      if(pMga->SecondCrtc == FALSE && pMga->HWCursor == TRUE) {
 		outMGAdac(MGA1064_CURSOR_BASE_ADR_LOW,
 			  pMga->FbCursorOffset >> 10);

It looks like the proper way to include this in the ports build would be a
.else in the .if ${HaveMatroxHal} == NO line that enables the above patch.

-- 
Peter Johnson