Subject: Re: "xf86MapVidMem: could not mmap to screen" problem
To: Perry Trolard <perry.trolard@gmail.com>
From: Michael Lorenz <macallan@netbsd.org>
List: port-macppc
Date: 08/25/2007 15:18:17
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

On Aug 25, 2007, at 09:54, Perry Trolard wrote:

> Hi,
>
> On 8/25/07, Michael Lorenz <macallan@netbsd.org> wrote:
>> And you're absolutely sure that your kernel is built with options
>> OFB_FAKE_VGA_FB ?
>
> Yes, but just to be sure there's nothing weird that I'm missing I'm
> including my kernel config files below.
>
> Otherwise then, moving to, say, 4.0 would be a solution?

Yes.

> options MULTIPROCESSOR

That will only slow your kernel down if you don't have more than one 
CPU.

> # fast text console
> options OFB_ENABLE_CACHE
>
> # XFree86 option to get around "can't mmap screen ..." memory error
> options OFB_FAKE_VGA_FB

Hmm, I had a look at the source - the hack is not in 3.1
Since 4.x is still beta, here's what you'd need to change:

First, find ofb_mmap()
In there, between this block:
	pa = offset;
	for (i = 0; i < 6; i++) {
		switch (ap[0] & OFW_PCI_PHYS_HI_SPACEMASK) {
		case OFW_PCI_PHYS_HI_SPACE_MEM32:
			if (pa >= ap[2] && pa < ap[2] + ap[4])
				return pa;
		/* XXX I/O space? */
		}
		ap += 5;
	}

and the return -1 statement insert this:

#ifdef OFB_FAKE_VGA_FB
	if (offset >=0xa0000 && offset < 0xbffff)
		return dc->dc_paddr + offset - 0xa0000;
#endif

have fun
Michael
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)

iQEVAwUBRtCAecpnzkX8Yg2nAQJ2vQgAummKxbk+hFzsuyGuGwqklE13VkrZHCEg
hqD5HX7Gki7U/eGHW10fChYMYJka1OYasICmeD5/In7dYp8E2lCMDdA6xlqdpD21
EX2J6XgNr0pMy/RDHzhZvMavL4RIK+FJkXF5hMeWgIV8H3dHMer4Wpcc0aNHwDlx
beZy3Yx14hfoj54z9OfpOUQjyTVOfgT07rtIGGjNiCSVQqHl8Fk3NXRTnh8S8s6f
jIcy8AUb7xeZ9ujKhm1Qm5Skb0XQRcHFayZbc80fORBlQuY8Mux7Pdt14WpyZh+g
u4P5czW513/jEmxc5QXdskRgNFDmPZMEPCKYu6VaL+Mooxx+dnz1Gw==
=kFow
-----END PGP SIGNATURE-----