Need help getting eMac G4 graphics to work reddit / BSD ---------------------------------------------------------------------- G4G4G4G4 · 2018-08-25 13:19 **TL;DR:** I'm looking for a way in any of the BSDs to force kernel modesetting display modes in order to run BSD on my old eMac. **Long version:** So I got my hands on an old eMac G4 machine, and I'd like to run a modern operating system on it. Since it's an old BSD system (last vendor supported release: Mac OS X 10.5), I'd like to get a modern BSD up and running on it. If possible, I'd like to use NetBSD or OpenBSD on this thing since they are the two only remaining operating systems that continue publishing binary packages for 32-bit PowerPC-based systems like this. FreeBSD I would also accept, but compiling from source is a pain on this box. I've been tinkering with this computer for a while already. All hardware seems to be working out of the box on OpenBSD, FreeBSD and Linux. Except there is one big problem: kernel modesetting and DRM/KMS-based drivers. The machine comes with a Radeon 9600 GPU that is fully supported (in theory) by modern DRM/KMS-drivers. But this is not a regular PC, and Apple has done something non-standard with the screen which means I can't accelerated graphics to work. You see, on a PC with a DRM/KMS driver you usually have a display attached that tells its capabilities to the OS (using something called an EDID). The driver then proceeds to select a resolution and refresh rate of the display, and your display will work. If there's something wrong in this communication, it will resort to some default (e.g. 1024x768 @ 60 Hz) and it will work fine then. However, the Mac doesn't do this. The display never tells the OS what display modes it supports. The OS proceeds to pick some default (e.g. 1024x768@60), which the CRT display doesn't support. The result is a black screen - nothing is displayed at all. This happens on Linux distros, OpenBSD and FreeBSD because they all use more or less the same graphics stack. On Mac OS X, this doesn't happen because Apple presumably hardcoded the display's capabilities for these models in the OS. Interestingly, the Linux kernel provides a boot option that allows you manually specify an EDID string as a file during boot. By specifying `drm_kms_helper.edid_firmware=edid/your_edid.bin` during boot, you can point it to an EDID file that specifies the right display mode, and you will get a full accelerated desktop using that. Great, but I want to run BSD on this thing. I've looked through some documentation and I can't find any comparable option for any of the BSDs. The closest is FreeBSD's `kern.vt.fb.default_mode` boot option, but that only allows me to set the resolution, not refresh rate or display timings. It's a shame because if I can force the display mode, then the entire system would likely run like a dream. Does anybody know if there's any way to force a DRM/KMS driver's display mode on any of the BSDs? If there is no kernel option for it, can I compile a custom kernel that sets the right resolution? For the record, I know I can disable graphics acceleration and DRM/KMS, and I know there is an option to set an EDID file in the X.org options. But I'm really looking for a way to get kernel modesetting to fully work, without needing X.org. My end goal is to be able to run RetroArch (perhaps in KMS mode) on this thing. ---------------------------------------------------------------------- LocalRefuse · 2018-08-26 15:13 It sounds like you're assuming you have a problem before even trying out the OS. the assumption that the netbsd code is verbatim the linux one is false. it does do things differently. see this [2007 commit for exampl e](https://v4.freshbsd.org/commit/netbsd/src/f539152c921e941805de6bcfa f6d5c897ce5af30745283423d30ca284165a311) in any case, I recommend emailing port-macppc@netbsd.org and asking if you have problems after installation. ---------------------------------------------------------------------- G4G4G4G4 · 2018-08-26 17:32 >It sounds like you're assuming you have a problem before even trying out the OS. Well, as I said in my post I have tried OpenBSD, FreeBSD and (Debian) Linux on this box - I confirmed all other hardware worked. All have the same "black screen" issue, and my workaround on Linux suggests that there's a problem in kernel modesetting in the DRM driver that is *more or less* (I never said "verbatim copy") the same on all systems. OpenBSD, FreeBSD and NetBSD don't seem to allow me to work around that problem though - but hopefully NetBSD has a workaround built in. I will give NetBSD another try (only booted the installer so far) and try the mailing list otherwise. Thanks for the directions. **EDIT:** I've checked a NetBSD install, and the same issues pop up - screen blacks out when starting X.org, no matter what (valid) configuration is used there. ---------------------------------------------------------------------- Kernigh · 2018-08-30 03:17 When exactly do you get a black screen? Does this happen when your eMac boots, or not until you start X11? If possible, please share Xorg.0.log. Perhaps you can ssh into your eMac to run `startx` and scp or sftp to copy out the Xorg.0.log? > However, the Mac doesn't do this. The display never tells the OS what display modes it supports. The display in my PowerBook G4 (model PowerBook5,4) uses EDID and works with OpenBSD-current. I don't know if all Mac models use EDID. You are lucky to have Radeon and not nVidia graphics, but unlucky if there's no EDID. Here's [my dmesg and Xorg.0.log](https://gist.github. com/kernigh/ec48ceda302d4bdfdd5411cc7f29e133); the "EDID" and "Modelines"s are in Xorg.0.log. Linux's `drm_kms_helper.edid_firmware` seems to be missing in OpenBSD. I found this code in [/usr/src/sys/dev/pci/drm/drm_probe_helper.c](htt p://cvsweb.openbsd.org/cgi- bin/cvsweb/src/sys/dev/pci/drm/drm_probe_helper.c?rev=1.1&content- type=text/x-cvsweb-markup) #ifdef CONFIG_DRM_LOAD_EDID_FIRMWARE count = drm_load_edid_firmware(connector); if (count == 0) #endif but the config is never defined, and the function drm_load_edid_firmware() does not exist, so it is not possible to load EDID firmware this way. ---------------------------------------------------------------------- G4G4G4G4 · 2018-09-02 12:21 I get a black screen almost right away when I start up a graphical interface (using xdm or startx). All OSes I've tested *are* able to to display a TTY, but as soon as something that requires kernel modesetting the screen goes to black. Luckily people have created an [EDID for this eMac's display](https://github.com/qbancoffee/emac_ivad_board_init) \- so the only thing you need to fix kernel modesetting is an OS that allows you to use this EDID. ---------------------------------------------------------------------- Kernigh · 2018-09-02 22:05 I haven't seen dmesg or Xorg.0.log of your eMac, so I don't know what happened. The TTY doesn't require kernel modesetting, but might be using it. My radeondrm(4) machines look like they use kernel modesetting early during boot. When my PowerBook G4 boots OpenBSD/macppc, after most kernel messages but before [rc(8)](https://man.openbsd.org/rc), the screen glitches for a moment, then clears. This is in [my dmesg](https ://gist.github.com/kernigh/ec48ceda302d4bdfdd5411cc7f29e133) as `initializing kernel modesetting` then `radeondrm0: 1280x854, 32bpp`. When my OpenBSD/amd64 machine boots, the screen clears as it switches from VGA text mode (DOS font) to a mode with more pixels (BSD font). This is in my dmesg as `radeondrm0: 1920x1080, 32bpp`. I can disable kernel modesetting (KMS) in my PowerBook by entering [boot_config(8)](https://man.openbsd.org/boot_config) and doing `disable radeondrm`. Then the TTY still works but X doesn't work. I got a black screen from `startx` when I made /etc/X11/xorg.conf with a syntax error. I escaped the black screen by pressing Ctrl+Alt+F1. I have 6 virtual consoles at Ctrl+Alt+F1..F6, where F1 is the boot console and F5 is X. I normally run X with no xorg.conf file. If the screen is black but X is running, then one can ssh(1) to the user with the ~/.Xauthority file, `export DISPLAY=:0.0`, and run commands like [xrandr(1)](https://man.openbsd.org/xrandr). This would be useful if someone had run `xrandr --output LVDS --brightness 0`. ---------------------------------------------------------------------- G4G4G4G4 · 2018-09-03 21:51 I've been tinkering away at this problem quite a bit, but I'm 100% sure the problem is not in the X.org configuration unfortunately. It is actually [well-known problem](http://ppcluddite.blogspot.com/2012/03/installing-debian- linux-on-ppc-part-iv.html) at least on the Linux side of things. The combination of the CRT and the Radeon KMS driver is just a pain - any time KMS is invoked, it will break. And KMS drivers do not include legacy modesetting. Problems with the eMac display *before* KMS drivers were a thing could indeed be solved by proper X.org configuration, but not anymore. And the BSDs have included KMS drivers for this chip for a long while (NetBSD was the last to switch since version 7.0 in 2015). Again, the only fix I have for this is forcing Linux to boot with that EDID file or otherwise forcibly setting a supported [Linux kernel video modeline](https://wiki.archlinux.org/index.php/kernel_mode_setti ng#Forcing_modes) (forcing the video modeline creates an off center image but works well enough to install the system and setup the EDID, which does work perfectly). This seems to convince KMS drivers to do the right thing, as it should. It would be really great if any of the BSDs offered me this option, but it appears they don't. Anyway, thanks for the time replying so extensively. But I just might have to go the Linux route for this.