# Uvesafb (简体中文)

一个新的 framebuffer 驱动已经加入 2.6.24 的内核。它比标准的 vesafb 有更多的特性，包括： 1) proper blanking and hardware suspension after delay； 2) 支持自定义分辨率，就像使用系统 BIOS 一样。 vesafb 支持的硬件它应该都支持。

# 虚拟 daemon

与别的 framebuffer 驱动不同，uvesafb 需要一个运行在用户空间的虚拟 daemon，叫做 v86d。也许，在 x86 架构上模拟 x86 看起来有点蠢，但如果有人想在其他架构上（尤其是不兼容 x86 的架构）使用 framebuffer，这就十分重要了。v86d 包里含有一个 initcpio 的 HOOK（叫 v86d），它被用来加载 uvesafb 模块，在需要的时候运行虚拟 daemon。

## V86d

用 pacman 安装 v86d。

    # pacman -S v86d

# 准备系统

- 记得从引导器配置中删除一切与 framebuffer 有关的内核启动参数。：vga=<×××> 将会强行加载老旧的 vesafb 驱动；当 uvesafb 被编译成一个模块后 (as in the Arch Linux stock kernel) video=<×××> 参数将不会被使用（亦即：将会无效，写了也白写，删了吧）。

- 在打算引导进 framebuffer 前请全面禁止 KMS。如果没有禁止掉，你将会得到一个漆黑的屏幕，你将只能按 “Ctrl-Alt-Del”重启，没别的办法。对于 Intel 的显卡，在GRUB启动项的后面追加 `i915.modeset=0` 来禁止 KMS。

# uvesafb 选项

uvesafb 选项能在 `/etc/modprobe.d/uvesafb.conf` 里配置，或者更通常些，在 `/etc/modprobe.d/modprobe.conf` 里配置。v86d 包中的默认配置把语法讲的很明确了，它还告诉你去哪里找更多的信息：

    # This file sets the parameters for uvesafb module.
    # The following format should be used:
    # options uvesafb mode=<xres>x<yres>[-<bpp>][@<refresh>] scroll=<ywrap|ypan|redraw> ...
    #
    # For more details see:
    # http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/fb/uvesafb.txt
    #
    options uvesafb mode=1280x800-32 scroll=ywrap

你能够用以下命令得到有效的分辨率：

     cat /sys/bus/platform/drivers/uvesafb/uvesafb.0/vbe_modes

## 加入 hooks 列表

将 v86d hook 添加到 mkinitcpio.conf 中的 HOOKS 里。把它放在 keymap, the resume from suspension 和 filesystems 的 hook 之前。

    HOOKS="base udev v86d ..."

然后你需要重新生成你的 initramfs，用 mkinitcpio（请自行调节选项以适合你的配置）：

    # mkinitcpio -p linux

# Uvesafb compiled into the kernel

If you compile your own kernel, then you can also compile uvesafb into the kernel and run v86d later, e.g. from /etc/rc.local. In this case, the options can be passed as kernel boot parameters in the format video=uvesafb:<options>. Please note that this solution is not viable in the case you want to combine uvesafb with 915resolution as suggested below.

# The homepage of uvesafb

The home page of uvesafb is http://dev.gentoo.org/~spock/projects/uvesafb where you can find some detailed information (you can ignore any information concerning patches for the kernel, because uvesafb is now in the vanilla kernel; moreover some information in the site assume that uvesafb is compiled in the kernel, while it is a module in the archlinux stock binary kernel).

# Uvesafb and 915resolution

In the following, we address a more complex scenario. Many intel video chipsets for widescreen laptops are known to have a buggish bios, which does not support the main, native resolution of the wide screen! For this reason, 915resolution was created to patch the bios at boot time and allowed the x server to use the widescreen resolution. Nowadays, the xserver is able to do this without the help of 915resolution. However, 915resolution can be combined with uvesafb in order to obtain a widescreen framebuffer, without any need to launch X at all. In this case, we need to load uvesafb after having run 915resolution, so that uvesafb can resort to the proper resolution.

## 915resolution-static

In this scenario, 915resolution needs to be compiled statically (since it is going to be in an initramfs, it can not be linked to external libraries). Thus you CAN NOT use the 915resolution package in the community repo. Look instead for 915resolution-static in AUR unsupported. It compiles 915 resolution statically and provides a 915 resolution hook, so you can run 915resolution before loading uvesafb and get the patched resolution. So install 915resolution-static via makepkg and pacman.

## The resolution

You need to edit the 915resolution hook in order to define the BIOS mode you want to replace and and the resolution you want to get. You can get infos about all the options for 915resolution with:

    915resolution -h

So edit /lib/initcpio/hooks/915resolution and modify the options for 915resolution:

    run_hook ()
    {
       msg -n ":: Patching the VBIOS..."
       /usr/sbin/915resolution 5c 1280 800
       msg "done."
    }

In the default, 5c is the code of the BIOS mode to replace. You can get a list of the available BIOS video modes with '915resolution -l': NOTE that you want to choose the code of a mode that you DO NOT need (neither in the framebuffer nor in X), because 915resolution will replace it with a new user-defined mode. '1280 800' is the new desired resolution.

## The HOOKS array

Add the 915resolution hook and, after it, the v86d hook to HOOKS in mkinitcpio.conf. Put them before the hooks for the keymap, the resume from suspension and the filesystems.

    HOOKS="base udev 915resolution v86d ..."

Then you need to regenerate your initramfs with mkinitcpio (adjust the following command to your setup):

    # mkinitcpio -p linux

# Troubleshooting

## Uvesafb cannot reserve memory

Check if you forgot to remove any "vga=xxx" kernel parameter -- this overrides the UVESA framebuffer with a standard VESA one.

## pci_root PNP0A08:00 address space collision + Uvesafb cannot reserve memory

This occurs on the Acer Aspire One 751h with the 2.6.34-ARCH kernel; whether it also occurs on other systems is unknown. Even without another framebuffer interfering with the uvesafb setup, uvesafb cannot reserve the necessary memory region.

You can fix this issue by adding the following to the kernel parameters in your bootloader's configuration.

    pci=nocrs

Category:

- Eye candy (简体中文)