MacBookAir4,1 (mid-2011, 11.6") internal display changes logical mode, but physical mode is stuck at boot

Hi everyone! I was getting nostalgic for BeOS so I thought I’d give Haiku a try since beta 5 came out recently (congrats!). I happened to have an old 11" MacBook Air to experiment with. Booting from the install image and installing to the internal SSD was nice and easy, but one problem I noticed right away that I haven’t found anyone else discussing: while using the intel_extreme video driver for the integrated Sandy Bridge graphics, the internal LCD’s physical display mode appears to be stuck at whatever resolution it was left in by the bootloader. It correctly detects that the display’s native resolution is 1366x768, and chooses that as the default logical resolution, but the LCD still displays in 1024x768 with stretched pixels so that the right part of the desktop is offscreen. Playing around a bit, I tried booting the bootloader at different resolutions and those were held into booting the app_server as well. Using the vesa driver, the LCD is properly reconfigured when the mode changes (though of course it only provides the standard 4:3 640x480, 800x600, and 1024x768 modes).

I also tried using screenmode -m to manually set the modeline using timings cribbed from xorg running under Linux, and that also didn’t seem to have any effect on the LCD behavior. It also looks like screen blanking doesn’t manage to actually turn off the LCD (though, funny enough, screenmode -b does successfully change the backlight intensity). I was wondering if there were some other tweaks I could try to get the display mode to properly change.

2 Likes

I suspect you are running Haiku in Legacy Mode, Apple’s equivalent to BIOS/CSM. Did you follow the steps to install the EFI partition?

The intel driver is incomplete and missing a few things. If vesa works for you, you can enable it permanently in the kernel settings file.

Or, if you are interested in driver development, you can download intel specifications for sandy bridge graphics, go into the kernel debugger, and use the ie_reg command to read/write graphics card registers and see if you can figure out the sequence needed to reprogram the lcd. Then we can add that to the driver.

2 Likes

Thanks for the quick responses!

I had tried to get EFI booting a few times but couldn’t get Apple’s firmware to see the bootloader, so yeah, I went with an MBR-style install. I did see the same behavior when booting from the anyboot USB stick, though.

Or, if you are interested in driver development, you can download intel specifications for sandy bridge graphics, go into the kernel debugger, and use the ie_reg command to read/write graphics card registers and see if you can figure out the sequence needed to reprogram the lcd. Then we can add that to the driver.

I’ll give that a try. Thanks for the lead.

As a rule of thumb you need to use rEFInd boot manager to be able to boot/install Haiku on a Mac. There are confirmed cases where it can work without the rEFInd but honestly it’s a hit-and-miss, so just install rEFInd and try again.

1 Like

I think I have the exact same model as yours and I had no troubles with EFI except that I needed to install rEFInd to use the keyboard to access the boot menu.
But it was a while ago and frankly I don’t remember if the intel_extreme was enabled or not and if rEFInd made the boot possible.

1 Like

Interesting. Are you using the 64-bit or 32-bit build? I was trying to install the 32-bit build since I wanted to try running vintage BeOS binaries, but maybe the loader isn’t compatible with Apple’s 64-bit UEFI? I’ll give the 64-bit build a try to see if I get further with EFI.

If I can get good LCD behavior under an EFI boot, that’ll also be a nice way to get “good” and “bad” values from the ie_reg settings in both cases.

To follow up, I was able to get EFI booting working by switching to the x86_64 build and using rEFInd. This gets the LCD set to the right native resolution, but the intel_extreme driver gives me a corrupt screen; it looks like it’s getting the framebuffer pitch wrong so the display gets skewed horizontally. But I can use the fallback framebuffer driver at least.

2 Likes

All Macs from 2008 circa onward have a 64-bit EFI. Currently the Haiku “bitness” must match the EFI one and can’t be mixed.

2 Likes

@jckarter Thanks so much for posting this topic. This is conveniently relevant to me, as I’ve played around with Haiku off and on for a while and one of the machines I’ve been using it on is a 2011 Macbook Air 11". Over the past few days I’ve rekindled my Haiku itch and have become more determined to sort out at least some of the issues I’ve had on the Air. Your posts have helped shed some light on the quirks I’ve been noticing.

I wanted to add my experience to this, as it seems getting Haiku running well is extra difficult on Macs. I’m currently typing on an Asus K53e laptop running Haiku using the Dooble browser. Haiku on this machine works flawlessly out of the box (other than the webcam, as far as I can tell). The interesting thing is that this is also a Sandy Bridge laptop, so it’s got the same family of graphics that the Air has, yet I’ve experienced no driver issues. In Screen preferences:

  • the screen is correctly identified as an LG 15.5" display
  • the screen visualization shows “101 dpi”
  • screen real estate is properly filled at the native panel resolution of 1366 x 768
  • brightness works
  • graphics are identified as Intel HD/Iris (SandyBridge Mobile GT2

This is contrary to the Air, which does seem to work when booted in legacy mode, but as you stated, when set to the native panel resolution of 1366 x 768, the desktop extends well off the screen, and I have to set it to 1024 x 768 to get it to fit properly (for anyone who doesn’t know, the easy way to do this if your Deskbar is off the screen is to click on the Haiku drive and navigate to /boot/system/preferences and you can open up Screen from there). More interestingly, I tonight I noticed inside the Screen preferences the following:

  • the screen is detected as an Apple Computer Inc Color LCD 5.7" (this is obviously incorrect, and might explain the issue with screen real estate when set to the proper resolution)
  • no dpi is listed on the screen visualization
  • brightness still works
  • graphics are identified correctly

However, as you also stated, this driver only works “properly” when booted in legacy mode. When I boot it in EFI mode, I get the skewed screen that you described. I have tested this by wiping the SSD and changing the partitioning and reinstalling several times. Installing Haiku has always been fairly easy and I’ve never had an issue with loading it from scratch (I’ve never used rEFInd, but I’m also not installing it with an existing version of Mac OS), but another interesting thing is that I can only load the OS off USB in legacy mode. If I try to boot in EFI I usually get 3 beeps after the Haiku loading screen appears (which indicates a RAM problem, but I promise you, I have tested the RAM countless times on this machine (precisely because of this!) and it has consistently passed) or it starts to load and just hangs after a while. Yet, loading off the internal SSD in EFI does work! But with the graphics driver issues, which requires me to use the standard VESA driver.

All in all, it’s pretty puzzling to me, although I’m not all that surprised given that it’s Apple hardware. I think Haiku is still a really good choice for this era of Apple computer though and I’d love to see it work better, so I’m going to continue to see what I can figure out. Again, thanks so much for creating this thread!

Edit: Welp, just for reference, I couldn’t post this comment using Dooble, I had to open up WebPositive and copy and paste it in order for the reply to actually post. The button wasn’t doing anything in Dooble. Dang! I am really impressed with how good Dooble is and hadn’t ran into too many issues with it so far. Oh well, I can live with that.

I don’t know anything about how to do this (I’m not a coder), but I’m really interested in learning more about Haiku and device drivers so I’ll try to look into this more over the weekend. Thanks!

There is nothing specific about Apple hardware in your graphics problem. The intel_extreme driver seems to be missing some code to set the video mode completely and relies on the bios or efi firmware to set some things up. So if you try to change the video mode, it only gets halfway there. This could happen on any machine using the same generation of intel graphics.

The detection of the display size and dpi should be irrelevant, as long as the driver detected that there is a display, and found its native resolution (you can check that in the sysnog, where the driver will write various things about what it found and what it’s trying to do)

2 Likes

Yeah, but that’s where my confusion comes from, because I have another (non-Apple) machine with exactly that (same generation graphics), and there’s no problems with the Intel driver.

As I said, the driver is incomplete and relies on the bios or efi firmware to set up the lcd panel. Then the panel remains in whatever resolution was set.

So, it does not depend just on the hardware, but also on the firmware

Okay, I thought that might have been the implication but I wasn’t clear on that. I’m assuming that’s also why the driver works when booted in legacy but not in UEFI.

I appreciate all of your information and help, thank you very much!