framebuffer

From Noah.org
Jump to navigationJump to search


In this example a DisplayLink USB-to-display adapter shows up as a simple frame buffer device. Plug in the DisplayLink and dmesg and /var/log/kernel.log show something like this:

Dec 10 01:12:29 noah-kali kernel: [239555.456486] usb 3-2: new high-speed USB device number 11 using xhci_hcd
Dec 10 01:12:34 noah-kali kernel: [239560.475765] usb 3-2: device descriptor read/8, error -110
Dec 10 01:12:34 noah-kali kernel: [239560.596070] usb 3-2: device descriptor read/8, error -32
Dec 10 01:12:34 noah-kali kernel: [239560.811937] usb 3-2: new high-speed USB device number 12 using xhci_hcd
Dec 10 01:12:34 noah-kali kernel: [239560.828972] usb 3-2: New USB device found, idVendor=17e9, idProduct=01d7
Dec 10 01:12:34 noah-kali kernel: [239560.828992] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Dec 10 01:12:34 noah-kali kernel: [239560.828995] usb 3-2: Product: HP USB Graphics Adap
Dec 10 01:12:34 noah-kali kernel: [239560.828998] usb 3-2: Manufacturer: DisplayLink
Dec 10 01:12:34 noah-kali kernel: [239560.829000] usb 3-2: SerialNumber: 120761
Dec 10 01:12:34 noah-kali kernel: [239560.832656] udlfb: DisplayLink HP USB Graphics Adap - serial #120761
Dec 10 01:12:34 noah-kali kernel: [239560.832660] udlfb: vid_17e9&pid_01d7&rev_0101 driver's dlfb_data struct at eba63000
Dec 10 01:12:34 noah-kali kernel: [239560.832662] udlfb: console enable=1
Dec 10 01:12:34 noah-kali kernel: [239560.832663] udlfb: fb_defio enable=1
Dec 10 01:12:34 noah-kali kernel: [239560.832665] udlfb: shadow enable=1
Dec 10 01:12:34 noah-kali kernel: [239560.832747] udlfb: vendor descriptor length:22 data:22 5f 01 0020 05 00 01 03 04 02
Dec 10 01:12:34 noah-kali kernel: [239560.832749] udlfb: DL chip limited to 2080000 pixel modes
Dec 10 01:12:34 noah-kali kernel: [239560.832798] udlfb: allocated 4 65024 byte urbs
Dec 10 01:12:34 noah-kali kernel: [239560.910647] udlfb: 1280x1024 @ 60 Hz valid mode
Dec 10 01:12:34 noah-kali kernel: [239560.910653] udlfb: 720x400 @ 70 Hz valid mode
Dec 10 01:12:34 noah-kali kernel: [239560.910656] udlfb: 640x480 @ 60 Hz valid mode
Dec 10 01:12:34 noah-kali kernel: [239560.910657] udlfb: 640x480 @ 67 Hz valid mode
Dec 10 01:12:34 noah-kali kernel: [239560.910659] udlfb: 640x480 @ 72 Hz valid mode
Dec 10 01:12:34 noah-kali kernel: [239560.910661] udlfb: 640x480 @ 75 Hz valid mode
Dec 10 01:12:34 noah-kali kernel: [239560.910663] udlfb: 800x600 @ 56 Hz valid mode
Dec 10 01:12:34 noah-kali kernel: [239560.910665] udlfb: 800x600 @ 60 Hz valid mode
Dec 10 01:12:34 noah-kali kernel: [239560.910667] udlfb: 800x600 @ 72 Hz valid mode
Dec 10 01:12:34 noah-kali kernel: [239560.910669] udlfb: 800x600 @ 75 Hz valid mode
Dec 10 01:12:34 noah-kali kernel: [239560.910671] udlfb: 832x624 @ 75 Hz valid mode
Dec 10 01:12:34 noah-kali kernel: [239560.910673] udlfb: 1024x768 @ 60 Hz valid mode
Dec 10 01:12:34 noah-kali kernel: [239560.910675] udlfb: 1024x768 @ 70 Hz valid mode
Dec 10 01:12:34 noah-kali kernel: [239560.910677] udlfb: 1024x768 @ 75 Hz valid mode
Dec 10 01:12:34 noah-kali kernel: [239560.910679] udlfb: 1280x1024 @ 75 Hz valid mode
Dec 10 01:12:34 noah-kali kernel: [239560.910682] udlfb: Reallocating framebuffer. Addresses will change!
Dec 10 01:12:34 noah-kali kernel: [239560.911450] udlfb: 1024x768 @ 75 Hz valid mode
Dec 10 01:12:34 noah-kali kernel: [239560.911452] udlfb: set_par mode 1024x768
Dec 10 01:12:34 noah-kali kernel: [239560.914472] udlfb: DisplayLink USB device /dev/fb1 attached. 1024x768 resolution. Using 3072K framebuffer memory

Note the /dev/fb1 device created. The log message tells you that 3072K is set aside for the framebuffer. You can test this simply my dumping random bytes to the device file.

dd if=/dev/urandom of=/dev/fb1 bs=1024 count=$((3072/2))

Why is the count divided in 2? The device /dev/fb1 would complain if more data was written. The second half was possibly an off-screen buffer used for double-buffering. We can investigate more about the fb1 device.

cd /sys/class/graphics/fb1
cat bits_per_pixel
16
cat modes

Use fbset to tweak the framebuffer.

fbset -fb /dev/fb1 -move left