# UVESAFB framebuffer on a Mac booting in EFI mode

## VanFanel

Booting my Mac in EFI mode (i.e. no BIOS emulation layer involved) is a reality now.

However, I'm kinda stuck with the default efifb framebuffer, wich is unable to set video modes and has problems switching from X to a framebuffer terminal, etc..

I've tried switching to uvesafb with no luck. 

uvesafb is built-in into my kernel. No modules involved. 

I can boot the same kernel with uvesafb in bios-emulation mode with grub legacy in BIOS mode, no problem at all. 

GRUB2 however, seems to need vbe.mod, but I built my GRUB2-for-EFI following instructions here: 

http://grub.enbug.org/TestingOnMacbook

...so if I configure the sources with 

```
  

export EFI_ARCH=x86_64

./configure --with-platform=efi --target=$EFI_ARCH --program-prefix=""

make

```

...then I get no vbe.mod  :Sad: 

So I simply ran 

```
  

export EFI_ARCH=x86_64

./configure --target=$EFI_ARCH --program-prefix=""

make

```

...and got a vbe.mod in grub-core

However, that vbe.mod wouldn't load on startup: "architecture-independant elf magic error"

Here's my EFI/grub2/grub.cfg

```

menuentry "Linux (with bios dump)" {

  insmod efi_uga

  insmod vbe

  insmod gfxterm

  search --set -f /boot/vmlinux

  loadbios /boot/vbios.bin /boot/int10.bin

  linux /boot/vmlinux real_root=/dev/sda3 video=uvesafb:640x480-16@70,mtrr:3,ywrap $

#  linux /boot/vmlinux real_root=/dev/sda3 video=efifb nocoldplug reboot=pci

  set debug=video

}

```

v86d is giving an error on boot:

```
commodore ~ # dmesg |grep v86d

v86d[457]: segfault at 0 ip 00000000004008b9 sp 00007fff233211f0 error 4 in v86d[400000+1a000]
```

uvesafb is well f***d, too:

```
commodore ~ # dmesg |grep uvesafb

uvesafb: Getting VBE info block failed (eax=0x4f00, err=1)

uvesafb: vbe_init() failed with -22

uvesafb: probe of uvesafb.0 failed with error -22
```

..and despite I'm telling the kernel (via grub.cfg) to use the uvesafb framebuffer, I'm running on the EFI framebuffer:

```
efifb: probing for efifb

efifb: framebuffer at 0x40010000, mapped to 0xffffc90004580000, using 3072k, total 3072k

efifb: mode is 1024x768x32, linelength=4096, pages=1

efifb: scrolling: redraw

efifb: Truecolor: size=8:8:8:8, shift=24:16:8:0
```

My kernel has EFI runtime active (needed to boot in EFI mode) and the EFI-based framebuffer, along with the uvesafb one.

I can boot with uvesafb with this same kernel in BIOS emulation mode. 

I've also tried to boot with and without the fakebios parameter, with and without the loadbios parameter (yes, I dumped my bios following the instructions I pointed out in the grub2 wiki), etc...

Still no luck... please, lend me a hand 

regards

----------

## VanFanel

No one uses UvesaFB with GRUB2 at least??

----------

## minimaul

To get a decent framebuffer on your mac under EFI, you're going to need to use Kernel Mode Setting.

Which mac do you have, and which graphics chips does it have?

----------

## VanFanel

@minimaul: It's a Mac Mini Core2duo with a nvidia gpu.

Anyway, KMS would mean using Nouveau: no 3D acceleration, and an unaccelerated framebuffer wich does NOT work with fbset. 

Who wants a framebuffer wthout being able to set custom resolutions on it? I even talked with Nouveau developers on IRC time ago, and they don't feel like adding fbset suport because they think letting the programs to change framebuffer resolution is not important. Good for them.

----------

## mattst88

 *VanFanel wrote:*   

> @minimaul: It's a Mac Mini Core2duo with a nvidia gpu.
> 
> Anyway, KMS would mean using Nouveau: no 3D acceleration, and an unaccelerated framebuffer wich does NOT work with fbset.

 

Seriously? I think you've got your priorities switched.

 *VanFanel wrote:*   

> Who wants a framebuffer wthout being able to set custom resolutions on it? I even talked with Nouveau developers on IRC time ago, and they don't feel like adding fbset suport because they think letting the programs to change framebuffer resolution is not important. Good for them.

 

Who cares about the framebuffer console? Just use nouveau, get a nice looking console, load X and off you go with 3D and all. Use gnome-terminal or something instead of a virtual terminal.

----------

## VanFanel

I use the framebuffer console for things other than a virtual terminal. I use it to run SDL apps without tearing.

My vt's are Xterm ones, and they serve me well.

SDL, in Linux, relies on X11 (wich lacks vsync control), fbdev or directfb (on fbdev). The ONLY way to have tear-less SDL apps on Linux is using the DirectFB backend (not talking about SDL-GL apps, that's a different story).

Most developers understimate a propper framebuffer because they don't think how powerfull, fast and smooth an accelerated framebuffer is. An X-less system wich boots in seconds yet offers full 2D-acceleration! Just imagine the endless applications of something like that!

But Nvidiafb is long forgotten and doesn't support any new-ish hardware, and Nouveau's framebuffer is unusable for me. A single resolution / refresh rate is not usefull for different emulated systems that require different refresh rates to archieve smooth scrolls.

----------

## VanFanel

I use the framebuffer console for things other than a virtual terminal. I use it to run SDL apps without tearing.

My vt's are Xterm ones, and they serve me well.

SDL, in Linux, relies on X11 (wich lacks vsync control), fbdev or directfb (on fbdev). The ONLY way to have tear-less SDL apps on Linux is using the DirectFB backend (not talking about SDL-GL apps, that's a different story).

Most developers understimate a propper framebuffer because they don't think how powerfull, fast and smooth an accelerated framebuffer is. An X-less system wich boots in seconds yet offers full 2D-acceleration! Just imagine the endless applications of something like that!

But Nvidiafb is long forgotten and doesn't support any new-ish hardware, and Nouveau's framebuffer is unusable for me. A single resolution / refresh rate is not usefull for different emulated systems that require different refresh rates to archieve smooth scrolls.

Does Nouveau provide a way to change it's framebuffer resolution? Or a way to control vsync? Well, uvesafb + binary nvidia, as bad as the mix sounds, DO provide ways for archieving that.Last edited by VanFanel on Wed Feb 09, 2011 7:22 pm; edited 1 time in total

----------

## mattst88

 *VanFanel wrote:*   

> I use the framebuffer console for things other than a virtual terminal. I use it to run SDL apps without tearing.
> 
> My vt's are Xterm ones, and they serve me well.
> 
> SDL, in Linux, relies on X11 (wich lacks vsync control), fbdev or directfb (on fbdev). The ONLY way to have tear-less SDL apps on Linux is using the DirectFB backend (not talking about SDL-GL apps, that's a different story).
> ...

 

I don't have any Nvidia cards, but this article says that Nouveau supports DRI2 page-flipping and sync-to-vblank support since October of last year.

My Intel Sandy Bridge system supports this as well, and page-flipping was recently added to Radeon too.

Are you sure this doesn't work? Maybe you're talking about something different?

Anyway, you could try to help figure out what doesn't work and why with current projects (KMS, nouveau, etc), you know. Developers like that.

----------

## VanFanel

 *Quote:*   

> Developers like that.

 

Nouveau developers don't seem interested in anything framebuffer-related. I talked to them months ago. They develop for pleasure and they work on the parts they feel interested in.

EDIT: from the articles you pointed me to, it seems Nouveau provides tear-less desktop ON Xorg AND Wayland!

Jeez, I think I'm in for A LOT of Nouveau adventure again... I have to rethink: maybe, if I can get vsync on X11 backend, I can say good-bye to uvesafb and use X11 as the SDL backend!

And of course I could try Wayland, to see it it's what I dream for a Linux graphical system.

Oh, I forgot, thanks for the ideas, and I HATE you for all the time I'm going to invest on Gentoo once more....  :Very Happy:  But souch is the life of the Gentoo edge-runner...

----------

