drm/mgag200: Fix big-endian support

Christian Zigotzky <[email protected]> Sun, 2 Aug 2026 20:06:21 +0200
Newsgroups org.ozlabs.lists.linuxppc-dev
Message-ID <[email protected]>
Hello Ren=C3=A9,

Many thanks for your patch. [1]

I have bought the PCI graphics card Matrox G200 G2+/QUADP-PL/7 32MB with 4x D=
VI. It is an AGP card connected via PCI.=20

We use the new DRM driver MGAG200 since the kernel 7.2.0-rc4 and the old DRM=
 legacy driver for Matrox g200/g400 graphics cards since the stable long-ter=
m kernel 5.10.260.

I tested it with the RC5 of kernel 7.2 in my PowerPC machine (e5500) today. U=
nfortunately, the DRM driver mgag200 can't read the PCI ROM. Maybe only an x=
86 ROM?

xrandr detects the ports but reports that they are not connected, even thoug=
h the cables are plugged in.

I also tested it with the stable long-term kernel 5.10.261 with the old lega=
cy DRM drivers for Matrox graphics cards.
I installed the Xorg MGA server xf86-video-mga-2.0.0_3 for the old legacy DR=
M driver but unfortunately I get only a black screen.

Is it possible to use this card with PPC Linux?

More information:

lspci -vvv

0001:05:00.0 VGA compatible controller: Matrox Electronics Systems Ltd. MGA G=
200 AGP (rev 03) (prog-if 00 [VGA controller])
	Subsystem: Matrox Electronics Systems Ltd. G200 Multi-Monitor
	Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-=
 Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=3Dmedium >TAbort- <=
TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 128 (4000ns min, 8000ns max), Cache Line Size: 32 bytes
	Interrupt: pin A routed to IRQ 18
	Region 0: Memory at c20000000 (32-bit, prefetchable) [size=3D16M]
	Region 1: Memory at c21000000 (32-bit, non-prefetchable) [size=3D16=
K]
	Region 2: Memory at c21800000 (32-bit, non-prefetchable) [size=3D8M=
]
	Expansion ROM at c21010000 [disabled] [size=3D64K]
	Capabilities: [dc] Power Management version 1
		Flags: PMEClk- DSI+ D1- D2- AuxCurrent=3D0mA PME(D0-,D1-,D2=
-,D3hot-,D3cold-)
		Status: D0 NoSoftRst- PME-Enable- DSel=3D0 DScale=3D0 PME-
	Capabilities: [f0] AGP version 1.0
		Status: RQ=3D32 Iso- ArqSz=3D0 Cal=3D0 SBA+ ITACoh- GART64-=
 HTrans- 64bit- FW- AGP3- Rate=3Dx1,x2
		Command: RQ=3D1 ArqSz=3D0 Cal=3D0 SBA- AGP- GART64- 64bit- =
FW- Rate=3D<none>
	Kernel driver in use: mgag200

0001:05:04.0 Display controller: Matrox Electronics Systems Ltd. MGA G200 AG=
P (rev 03)
	Subsystem: Matrox Electronics Systems Ltd. G200 Multi-Monitor
	Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-=
 Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=3Dmedium >TAbort- <=
TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 128 (4000ns min, 8000ns max), Cache Line Size: 32 bytes
	Interrupt: pin A routed to IRQ 18
	Region 0: Memory at c22000000 (32-bit, prefetchable) [size=3D16M]
	Region 1: Memory at c23000000 (32-bit, non-prefetchable) [size=3D16=
K]
	Region 2: Memory at c23800000 (32-bit, non-prefetchable) [size=3D8M=
]
	Expansion ROM at c21020000 [disabled] [size=3D64K]
	Capabilities: [dc] Power Management version 1
		Flags: PMEClk- DSI+ D1- D2- AuxCurrent=3D0mA PME(D0-,D1-,D2=
-,D3hot-,D3cold-)
		Status: D0 NoSoftRst- PME-Enable- DSel=3D0 DScale=3D0 PME-
	Capabilities: [f0] AGP version 1.0
		Status: RQ=3D32 Iso- ArqSz=3D0 Cal=3D0 SBA+ ITACoh- GART64-=
 HTrans- 64bit- FW- AGP3- Rate=3Dx1,x2
		Command: RQ=3D1 ArqSz=3D0 Cal=3D0 SBA- AGP- GART64- 64bit- =
FW- Rate=3D<none>
	Kernel driver in use: mgag200

0001:05:08.0 Display controller: Matrox Electronics Systems Ltd. MGA G200 AG=
P (rev 03)
	Subsystem: Matrox Electronics Systems Ltd. G200 Multi-Monitor
	Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-=
 Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=3Dmedium >TAbort- <=
TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 128 (4000ns min, 8000ns max), Cache Line Size: 32 bytes
	Interrupt: pin A routed to IRQ 18
	Region 0: Memory at c24000000 (32-bit, prefetchable) [size=3D16M]
	Region 1: Memory at c25000000 (32-bit, non-prefetchable) [size=3D16=
K]
	Region 2: Memory at c25800000 (32-bit, non-prefetchable) [size=3D8M=
]
	Expansion ROM at c21030000 [disabled] [size=3D64K]
	Capabilities: [dc] Power Management version 1
		Flags: PMEClk- DSI+ D1- D2- AuxCurrent=3D0mA PME(D0-,D1-,D2=
-,D3hot-,D3cold-)
		Status: D0 NoSoftRst- PME-Enable- DSel=3D0 DScale=3D0 PME-
	Capabilities: [f0] AGP version 1.0
		Status: RQ=3D32 Iso- ArqSz=3D0 Cal=3D0 SBA+ ITACoh- GART64-=
 HTrans- 64bit- FW- AGP3- Rate=3Dx1,x2
		Command: RQ=3D1 ArqSz=3D0 Cal=3D0 SBA- AGP- GART64- 64bit- =
FW- Rate=3D<none>
	Kernel driver in use: mgag200

0001:05:0c.0 Display controller: Matrox Electronics Systems Ltd. MGA G200 AG=
P (rev 03)
	Subsystem: Matrox Electronics Systems Ltd. G200 Multi-Monitor
	Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-=
 Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=3Dmedium >TAbort- <=
TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 128 (4000ns min, 8000ns max), Cache Line Size: 32 bytes
	Interrupt: pin A routed to IRQ 18
	Region 0: Memory at c26000000 (32-bit, prefetchable) [size=3D16M]
	Region 1: Memory at c27000000 (32-bit, non-prefetchable) [size=3D16=
K]
	Region 2: Memory at c27800000 (32-bit, non-prefetchable) [size=3D8M=
]
	Expansion ROM at c21040000 [disabled] [size=3D64K]
	Capabilities: [dc] Power Management version 1
		Flags: PMEClk- DSI+ D1- D2- AuxCurrent=3D0mA PME(D0-,D1-,D2=
-,D3hot-,D3cold-)
		Status: D0 NoSoftRst- PME-Enable- DSel=3D0 DScale=3D0 PME-
	Capabilities: [f0] AGP version 1.0
		Status: RQ=3D32 Iso- ArqSz=3D0 Cal=3D0 SBA+ ITACoh- GART64-=
 HTrans- 64bit- FW- AGP3- Rate=3Dx1,x2
		Command: RQ=3D1 ArqSz=3D0 Cal=3D0 SBA- AGP- GART64- 64bit- =
FW- Rate=3D<none>
	Kernel driver in use: mgag200


dmesg | grep -i mga

[    2.302206] [drm] Initialized mgag200 1.0.0 for 0001:05:00.0 on minor 1
[    2.303761] mgag200 0001:05:00.0: [drm] Cannot find any crtc or sizes
[    2.304697] mgag200 0001:05:04.0: Invalid PCI ROM header signature: expec=
ting 0xaa55, got 0xffff
[    2.305792] [drm] Initialized mgag200 1.0.0 for 0001:05:04.0 on minor 2
[    2.308281] mgag200 0001:05:04.0: [drm] Cannot find any crtc or sizes
[    2.308802] mgag200 0001:05:08.0: Invalid PCI ROM header signature: expec=
ting 0xaa55, got 0xffff
[    2.309319] [drm] Initialized mgag200 1.0.0 for 0001:05:08.0 on minor 3
[    2.309785] mgag200 0001:05:00.0: [drm] Cannot find any crtc or sizes
[    2.310900] mgag200 0001:05:08.0: [drm] Cannot find any crtc or sizes
[    2.311895] mgag200 0001:05:0c.0: Invalid PCI ROM header signature: expec=
ting 0xaa55, got 0xffff
[    2.312633] [drm] Initialized mgag200 1.0.0 for 0001:05:0c.0 on minor 4
[    2.312844] mgag200 0001:05:04.0: [drm] Cannot find any crtc or sizes
[    2.315512] mgag200 0001:05:0c.0: [drm] Cannot find any crtc or sizes
[    2.317178] mgag200 0001:05:08.0: [drm] Cannot find any crtc or sizes
[    2.323318] mgag200 0001:05:0c.0: [drm] Cannot find any crtc or sizes

xrandr

=E2=80=A6

VGA-4-4 disconnected (normal left inverted right x axis y axis)
VGA-3-3 disconnected (normal left inverted right x axis y axis)
VGA-2-2 disconnected (normal left inverted right x axis y axis)
VGA-1-1 disconnected (normal left inverted right x axis y axis)

=E2=80=A6

lspci -nnk | grep VGA

0001:05:00.0 VGA compatible controller [0300]: Matrox Electronics Systems Lt=
d. MGA G200 AGP [102b:0521] (rev 03)

Thanks,
Christian

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commi=
t/drivers/gpu/drm/mgag200/mgag200_mode.c?id=3D6cb31fba137d45e682ce455b8ea364=
f44d5d4f98=